当前位置: 首页>>代码示例>>C#>>正文


C# Packet.PutULong方法代码示例

本文整理汇总了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);
		}
开发者ID:xKamuna,项目名称:aura,代码行数:32,代码来源:Send.Effects.cs

示例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);
		}
开发者ID:xKamuna,项目名称:aura,代码行数:49,代码来源:Send.NPCs.cs


注:本文中的Aura.Shared.Network.Packet.PutULong方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。