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


C# RealmPacketIn.ReadPackedEntityId方法代码示例

本文整理汇总了C#中RealmPacketIn.ReadPackedEntityId方法的典型用法代码示例。如果您正苦于以下问题:C# RealmPacketIn.ReadPackedEntityId方法的具体用法?C# RealmPacketIn.ReadPackedEntityId怎么用?C# RealmPacketIn.ReadPackedEntityId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RealmPacketIn的用法示例。


在下文中一共展示了RealmPacketIn.ReadPackedEntityId方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleDeleteEquipmentSet

        public static void HandleDeleteEquipmentSet(IRealmClient client, RealmPacketIn packet)
        {
            var setGuid = packet.ReadPackedEntityId();

            var chr = client.ActiveCharacter;

            chr.Inventory.DeleteEquipmentSet(setGuid);
        }
开发者ID:Zakkgard,项目名称:WCell,代码行数:8,代码来源:ItemHandler.cs

示例2: HandleChangeSeatsOnControlledVehicle

        public static void HandleChangeSeatsOnControlledVehicle(IRealmClient client, RealmPacketIn packet)
        {
        	var guid = packet.ReadPackedEntityId();
			var oldVehicle = client.ActiveCharacter.Map.GetObject(guid) as Vehicle;
			if (oldVehicle == null)
				return;
        	uint clientTime;
        	MovementHandler.ReadMovementInfo(packet, client.ActiveCharacter, oldVehicle, out clientTime);

			var newVehicleGuid = packet.ReadPackedEntityId();
			var newVehicle = client.ActiveCharacter.Map.GetObject(newVehicleGuid) as Vehicle;
			if (newVehicle == null)
				return;

			var passenger = client.ActiveCharacter;
        	var oldSeat = passenger.m_vehicleSeat;

			//shouldnt need this, but fall back just in case
			if (oldSeat == null)
				oldVehicle.FindSeatOccupiedBy(passenger);

			//uh oh!
			if(oldSeat == null)
				return;

        	var seatId = packet.ReadByte();
        	var newSeat = newVehicle.Seats[seatId];
			//something went wrong
			if(newSeat == null)
				return;

			//cheater?!
			if(newSeat.Passenger != null)
				return;

			oldSeat.ClearSeat();
			newSeat.Enter(passenger);
        }
开发者ID:remixod,项目名称:netServer,代码行数:38,代码来源:VehicleHandler.cs

示例3: HandleUseEquipmentSet

        public static void HandleUseEquipmentSet(IRealmClient client, RealmPacketIn packet)
        {
            var equipmentSwap = new EquipmentSwapHolder[19];
            for (var i = 0; i < 19; i++)
            {
                equipmentSwap[i] = new EquipmentSwapHolder
                {
                    ItemGuid = packet.ReadPackedEntityId(),
                    SrcContainer = (InventorySlot)packet.ReadByte(),
                    SrcSlot = packet.ReadByte()
                };
            }

            var chr = client.ActiveCharacter;
            chr.Inventory.UseEquipmentSet(equipmentSwap);
        }
开发者ID:Zakkgard,项目名称:WCell,代码行数:16,代码来源:ItemHandler.cs

示例4: HandleSetEquipmentSet

        public static void HandleSetEquipmentSet(IRealmClient client, RealmPacketIn packet)
        {
            var setEntityId = packet.ReadPackedEntityId();
            var setId = packet.ReadInt32();
            var name = packet.ReadCString();
            var icon = packet.ReadCString();

            var itemList = new EntityId[19];
            for (var i = 0; i < 19; i++)
            {
                itemList[i] = packet.ReadPackedEntityId();
            }

            var chr = client.ActiveCharacter;

            chr.Inventory.SetEquipmentSet(setEntityId, setId, name, icon, itemList);
        }
开发者ID:Zakkgard,项目名称:WCell,代码行数:17,代码来源:ItemHandler.cs

示例5: HandleRequestVehicleSwitchSeat

 public static void HandleRequestVehicleSwitchSeat(IRealmClient client, RealmPacketIn packet) 
 {
     var guid = packet.ReadPackedEntityId();
     byte seat = packet.ReadByte();
 }
开发者ID:remixod,项目名称:netServer,代码行数:5,代码来源:VehicleHandler.cs

示例6: HandleInspectAchievements

		public static void HandleInspectAchievements(IRealmClient client, RealmPacketIn packet)
		{
			var targetGuid = packet.ReadPackedEntityId();
			var targetChr = World.GetCharacter(targetGuid.Low);
			if (targetChr != null && targetChr.IsInContext)
			{
				SendRespondInspectAchievements(targetChr);
			}
		}
开发者ID:NVN,项目名称:WCell,代码行数:9,代码来源:AchievementHandler.cs

示例7: Start

		/// <summary>
		/// This starts a spell-cast, requested by the client.
		/// The client submits where or what the user selected in the packet.
		/// </summary>
		internal SpellFailedReason Start(Spell spell, RealmPacketIn packet, byte castId, byte unkFlags, uint glyphSlot = (uint)0)
		{
			IsPlayerCast = true;

			//var stopwatch = Stopwatch.StartNew();

			if (IsCasting)
			{
				if (!IsChanneling)
				{
					SpellHandler.SendCastFailed(Client, castId, spell, SpellFailedReason.SpellInProgress);
					return SpellFailedReason.SpellInProgress;
				}
				else
				{
					Cancel(SpellFailedReason.DontReport);
				}
			}

			GlyphSlot = glyphSlot;

			Map = CasterObject.Map;
			Phase = CasterObject.Phase;

			IsCasting = true;
			Spell = spell;
			Id = castId;

			//byte unkFlag = packet.ReadByte();

			// TODO: Corpse flags
			//(targetFlags & SpellCastTargetFlags.Corpse) != 0 || 
			//    (targetFlags & SpellCastTargetFlags.ReleasedCorpse) != 0) {

			// read the target-information, sent with the Spell
			WorldObject selected = null;
			bool targetFound = false;
			TargetFlags = (SpellTargetFlags)packet.ReadUInt32();

			// 0x0
			if (TargetFlags == SpellTargetFlags.Self)
			{
				targetFound = true;
				TargetLoc = CasterObject.Position;
				selected = CasterObject;
			}
			// 0x18A02
			if (TargetFlags.HasAnyFlag(
				SpellTargetFlags.SpellTargetFlag_Dynamic_0x10000 |
				SpellTargetFlags.Corpse |
				SpellTargetFlags.Object |
				SpellTargetFlags.PvPCorpse |
				SpellTargetFlags.Unit))
			{
				// The user selected an Object
				var uid = packet.ReadPackedEntityId();
				selected = Map.GetObject(uid);

				if (selected == null || !CasterObject.CanSee(selected))
				{
					Cancel(SpellFailedReason.BadTargets);
					return SpellFailedReason.BadTargets;
				}

				targetFound = true;
				TargetLoc = selected.Position;
			}
			// 0x1010
			if (CasterObject is Character && TargetFlags.HasAnyFlag(SpellTargetFlags.TradeItem | SpellTargetFlags.Item))
			{
				var uid = packet.ReadPackedEntityId();
				TargetItem = ((Character)CasterObject).Inventory.GetItem(uid);
				if (TargetItem == null || !TargetItem.CanBeUsed)
				{
					Cancel(SpellFailedReason.ItemGone);
					return SpellFailedReason.ItemGone;
				}
			}
			// 0x20
			if (TargetFlags.HasAnyFlag(SpellTargetFlags.SourceLocation))
			{
				Map.GetObject(packet.ReadPackedEntityId());		// since 3.2.0
				//SourceLoc = new Vector3(packet.ReadFloat(), packet.ReadFloat(), packet.ReadFloat());
			}

			SourceLoc = CasterObject.Position;

			// 0x40
			if (TargetFlags.HasAnyFlag(SpellTargetFlags.DestinationLocation))
			{
				selected = Map.GetObject(packet.ReadPackedEntityId());
				TargetLoc = new Vector3(packet.ReadFloat(), packet.ReadFloat(), packet.ReadFloat());
				//Console.WriteLine("SpellCast.Start - DestLoc {0}", TargetLoc);
				targetFound = true;
			}
			// 0x2000
//.........这里部分代码省略.........
开发者ID:primax,项目名称:WCell,代码行数:101,代码来源:SpellCast.cs

示例8: HandleUpdateMissilePosition

		public static void HandleUpdateMissilePosition(IRealmClient client, RealmPacketIn packet)
		{
			var casterGuid = packet.ReadPackedEntityId();
			var spellId = (SpellId)packet.ReadInt32();
			var castCount = packet.ReadByte();
			var position = packet.ReadVector3();
		}
开发者ID:primax,项目名称:WCell,代码行数:7,代码来源:SpellHandler.cs

示例9: ReadTargetInfoFromPacket

        private SpellFailedReason ReadTargetInfoFromPacket(RealmPacketIn packet)
        {
            TargetFlags = (SpellTargetFlags)packet.ReadUInt32();

            // TODO: Corpse flags

            if (TargetFlags == SpellTargetFlags.Self)
            {
                SelectedTarget = CasterObject;
                TargetLoc = SelectedTarget.Position;
                return SpellFailedReason.Ok;
            }

            if (TargetFlags.HasAnyFlag(SpellTargetFlags.WorldObject))
            {
                var entityId = packet.ReadPackedEntityId();
                SelectedTarget = Map.GetObject(entityId);

                if (SelectedTarget == null || !CasterObject.CanSee(SelectedTarget))
                {
                    Cancel(SpellFailedReason.BadTargets);
                    return SpellFailedReason.BadTargets;
                }

                TargetLoc = SelectedTarget.Position;
            }

            if (CasterObject is Character && TargetFlags.HasAnyFlag(SpellTargetFlags.AnyItem))
            {
                var entityId = packet.ReadPackedEntityId();
                TargetItem = CasterChar.Inventory.GetItem(entityId);

                if (TargetItem == null || !TargetItem.CanBeUsed)
                {
                    Cancel(SpellFailedReason.ItemGone);
                    return SpellFailedReason.ItemGone;
                }
            }

            if (TargetFlags.HasAnyFlag(SpellTargetFlags.SourceLocation))
            {
                Map.GetObject(packet.ReadPackedEntityId());		// since 3.2.0
                //SourceLoc = new Vector3(packet.ReadFloat(), packet.ReadFloat(), packet.ReadFloat());
            }
            SourceLoc = CasterObject.Position;

            if (TargetFlags.HasAnyFlag(SpellTargetFlags.DestinationLocation))
            {
                SelectedTarget = Map.GetObject(packet.ReadPackedEntityId());
                TargetLoc = new Vector3(packet.ReadFloat(), packet.ReadFloat(), packet.ReadFloat());
            }

            if (TargetFlags.HasAnyFlag(SpellTargetFlags.String))
            {
                StringTarget = packet.ReadCString();
            }

            return SpellFailedReason.Ok;
        }
开发者ID:ebakkedahl,项目名称:WCell,代码行数:59,代码来源:SpellCast.cs


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