本文整理汇总了C#中Aura.Shared.Network.Packet.PutULong方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.PutULong方法的具体用法?C# Packet.PutULong怎么用?C# Packet.PutULong使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aura.Shared.Network.Packet
的用法示例。
在下文中一共展示了Packet.PutULong方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Effect
/// <summary>
/// Broadcasts Effect in range of creature, with the given packet id.
/// </summary>
/// <remarks>
/// Parameters have to be casted to the proper type, use carefully!
/// </remarks>
/// <param name="id"></param>
/// <param name="entity"></param>
/// <param name="effectId"></param>
/// <param name="parameters"></param>
public static void Effect(long id, Entity entity, int effectId, params object[] parameters)
{
var packet = new Packet(Op.Effect, id);
packet.PutInt(effectId);
foreach (var p in parameters)
{
if (p is byte) packet.PutByte((byte)p);
else if (p is bool) packet.PutByte((bool)p);
else if (p is short) packet.PutShort((short)p);
else if (p is ushort) packet.PutUShort((ushort)p);
else if (p is int) packet.PutInt((int)p);
else if (p is uint) packet.PutUInt((uint)p);
else if (p is long) packet.PutLong((long)p);
else if (p is ulong) packet.PutULong((ulong)p);
else if (p is float) packet.PutFloat((float)p);
else if (p is string) packet.PutString((string)p);
else
throw new Exception("Unsupported effect parameter: " + p.GetType());
}
entity.Region.Broadcast(packet, entity);
}
示例2: OpenBank
/// <summary>
/// Sends OpenBank to creature's client.
/// </summary>
/// <param name="creature"></param>
/// <param name="bank"></param>
/// <param name="race"></param>
public static void OpenBank(Creature creature, BankInventory bank, BankTabRace race)
{
var packet = new Packet(Op.OpenBank, creature.EntityId);
packet.PutByte(1);
packet.PutByte((byte)race);
packet.PutLong(DateTime.Now);
packet.PutByte(0);
packet.PutString(creature.Client.Account.Id);
packet.PutString("Global"); // Current bank id
packet.PutString("Bank"); // Current bank title
packet.PutInt(bank.Gold);
var tabList = bank.GetTabList(race);
packet.PutInt(tabList.Count);
foreach (var tab in tabList)
{
packet.PutString(tab.Name);
packet.PutByte((byte)tab.Race);
// [190200, NA204 (2015-05-19)] ?
// Haven't opened a bank in a while, could've been
// added earlier. -- exec
{
packet.PutInt(0);
}
packet.PutInt(tab.Width);
packet.PutInt(tab.Height);
var itemList = tab.GetItemList();
packet.PutInt(itemList.Count);
foreach (var item in itemList)
{
packet.PutString("Global"); // Bank id
packet.PutULong(18446744017659355058);
packet.PutULong(0);
packet.AddItemInfo(item, ItemPacketType.Private);
}
}
creature.Client.Send(packet);
}