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


C# RealmPacketIn.ReadEntityId方法代码示例

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


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

示例1: HandleAction

		public static void HandleAction(IRealmClient client, RealmPacketIn packet)
		{
			var entityId = packet.ReadEntityId();

			var chr = client.ActiveCharacter;
			var pet = chr.Map.GetObject(entityId) as NPC;

			if (pet != null && pet == chr.ActivePet && pet.IsAlive)
			{
				var record = pet.PetRecord;
				if (record != null)
				{
					var data = (PetActionEntry)packet.ReadUInt32();

					switch (data.Type)
					{
						case PetActionType.SetMode:
							// mode
							pet.SetPetAttackMode(data.AttackMode);
							break;
						case PetActionType.SetAction:
							// action
							var targetAction = data.Action;
							pet.SetPetAction(targetAction);
							break;
						default:
							// spell cast
							var target = chr.Map.GetObject(packet.ReadEntityId());
							pet.CastPetSpell(data.SpellId, target);
							break;
					}
				}
			}
		}
开发者ID:KroneckerX,项目名称:WCell,代码行数:34,代码来源:PetHandler.cs

示例2: HandleAuctionSellItem

		public static void HandleAuctionSellItem(IRealmClient client, RealmPacketIn packet)
		{
			var chr = client.ActiveCharacter;
			var auctioneerId = packet.ReadEntityId();
			var itemId = packet.ReadEntityId();
			var bid = packet.ReadUInt32();
			var buyout = packet.ReadUInt32();
			var time = packet.ReadUInt32();

			var auctioneer = chr.Region.GetObject(auctioneerId) as NPC;
			AuctionMgr.Instance.AuctionSellItem(chr, auctioneer, itemId, bid, buyout, time);
		}
开发者ID:pallmall,项目名称:WCell,代码行数:12,代码来源:AuctionHandler.cs

示例3: HandleSendMail

		public static void HandleSendMail(IRealmClient client, RealmPacketIn packet)
		{
			var chr = client.ActiveCharacter;

			var mailboxId = packet.ReadEntityId();

			if (!CheckMailBox(chr, chr.Region.GetObject(mailboxId) as GameObject))
			{
				return;
			}

			var recipientName = packet.ReadCString();
			var subject = packet.ReadCString();
			var msg = packet.ReadCString();

			var stationary = (MailStationary)Enum.ToObject(typeof(MailStationary), packet.ReadUInt32());
			var unkowwn1 = packet.ReadUInt32();			// 4 unknown bytes

			var itemCount = packet.ReadByte();
			if (itemCount > MailMgr.MaxStoredItems)
				return;

			var items = new List<Item>(itemCount);
			for (var i = 0; i < itemCount; i++)
			{
				var slot = packet.ReadByte();
				var itemId = packet.ReadEntityId();
				var item = chr.Mail.GetItemToMail(itemId);

				if (item != null)
				{
					items.Add(item);
				}
				else
				{
					// invalid item
					return;
				}
			}

			var money = packet.ReadUInt32();
			var cod = packet.ReadUInt32();

			var unknown2 = packet.ReadUInt32();
			var unknown3 = packet.ReadUInt32();
			var unknown4 = packet.ReadByte();

			chr.Mail.SendMail(recipientName, subject, msg, stationary, items, money, cod);
		}
开发者ID:pallmall,项目名称:WCell,代码行数:49,代码来源:MailHandler.cs

示例4: RemoveFriendRequest

        public static void RemoveFriendRequest(IRealmClient client, RealmPacketIn packet)
        {
            var relCharId = packet.ReadEntityId();

            RelationMgr.Instance.RemoveRelation(client.ActiveCharacter.EntityId.Low, relCharId.Low, 
                                                CharacterRelationType.Friend);
        }
开发者ID:pallmall,项目名称:WCell,代码行数:7,代码来源:RelationHandler.cs

示例5: HandleGossipSelectOption

		public static void HandleGossipSelectOption(IRealmClient client, RealmPacketIn packet)
		{
			var targetEntityId = packet.ReadEntityId();
			var unknown = packet.ReadUInt32();				// usually Zero, sometimes in the thousands for quest givers, Same as the first int sent in SMSG_GOSSIP_MESSAGE
			var selectedOption = packet.ReadUInt32();

		    string extra = string.Empty;
			if (packet.Position < packet.Length)
			{
				extra = packet.ReadCString();
			}

			var chr = client.ActiveCharacter;
			var worldObject = chr.Region.GetObject(targetEntityId);

			if (worldObject == null)
				return;

			var conversation = chr.GossipConversation;

			if (conversation == null || conversation.Speaker != worldObject)
				return;

			conversation.HandleSelectedItem(selectedOption, extra);
		}
开发者ID:pallmall,项目名称:WCell,代码行数:25,代码来源:GossipHandler.cs

示例6: HandleTextEmote

        public static void HandleTextEmote(IRealmClient client, RealmPacketIn packet)
        {
            var chr = client.ActiveCharacter;
            if (!chr.CanMove || !chr.CanInteract) return;

            var emote = (TextEmote)packet.ReadUInt32();
            packet.SkipBytes(4);
            var targetId = packet.ReadEntityId();
            var target = chr.Map.GetObject(targetId) as INamed;
            if (target != null)
            {
                SendTextEmote(chr, emote, target);
            }

            EmoteType animation;
            EmoteDBC.EmoteRelationReader.Entries.TryGetValue((int)emote, out animation);

            switch (animation)
            {
                //The client seems to handle these on its own.
                case EmoteType.StateSleep:
                case EmoteType.StateSit:
                case EmoteType.StateKneel:
                case EmoteType.StateDance:
                    chr.EmoteState = animation;
                    break;
                default:
                    chr.Emote(animation);
                    break;
            }

            //todo: Achievement and scripting hooks/events.
        }
开发者ID:ebakkedahl,项目名称:WCell,代码行数:33,代码来源:EmoteHandler.cs

示例7: HandleGossipHello

		public static void HandleGossipHello(IRealmClient client, RealmPacketIn packet)
		{
			var targetEntityId = packet.ReadEntityId();

			var chr = client.ActiveCharacter;
			var target = chr.Region.GetObject(targetEntityId) as Unit;

			if (target == null)
				return;

			if (chr.GossipConversation != null)
			{
				chr.GossipConversation = null;
			}

			var menu = target.GossipMenu;
			if (menu == null)
				return;

			if (target is NPC)
			{
				if (!((NPC)target).CanInteractWith(chr))
				{
					return;
				}
			}
			else if (!chr.Role.IsStaff)
			{
				return;
			}
			chr.OnInteract(target);
			var conversation = new GossipConversation(menu, chr, target, menu.KeepOpen);
			client.ActiveCharacter.GossipConversation = conversation;
			conversation.DisplayCurrentMenu();
		}
开发者ID:pallmall,项目名称:WCell,代码行数:35,代码来源:GossipHandler.cs

示例8: NameQueryRequest

		public static void NameQueryRequest(IRealmClient client, RealmPacketIn packet)
		{
			var id = packet.ReadEntityId();

			ILivingEntity entity = client.ActiveCharacter;

			if (entity.EntityId.Low != id.Low)
			{
				entity = World.GetNamedEntity(id.Low) as ILivingEntity;
			}

			if (entity != null)
			{
				SendNameQueryReply(client, entity);
			}
			else
			{
				RealmServer.IOQueue.AddMessage(new Message(() =>
				{
					var record = CharacterRecord.LoadRecordByEntityId(id.Low);
					if (record == null)
					{
						s_log.Warn("{0} queried name of non-existing Character: " + id, client);
					}
					else
					{
						SendNameQueryReply(client, record);
					}
				}));
			}
		}
开发者ID:Jeroz,项目名称:WCell,代码行数:31,代码来源:QueryHandler.cs

示例9: HandleLoot

		public static void HandleLoot(IRealmClient client, RealmPacketIn packet)
		{
			var objId = packet.ReadEntityId();
			var chr = client.ActiveCharacter;
			var looter = chr.LooterEntry;
			var looted = chr.Region.GetObject(objId);

			if (looted != null)
			{
				looter.Release();		// make sure that the Character is not still looting something else

				var loot = looted.Loot;
				if (loot == null)
				{
					SendLootFail(chr, looted);
					// TODO: Kneel and unkneel?
				}
				else if (looter.MayLoot(loot))
				{
					// we are either already a looter or become a new one
					chr.CancelAllActions();
					looter.Loot = loot;

					SendLootResponse(chr, loot);
				}
				else
				{
					SendLootFail(chr, looted);
				}
			}
		}
开发者ID:pallmall,项目名称:WCell,代码行数:31,代码来源:LootHandler.cs

示例10: SetRelationNoteRequest

        public static void SetRelationNoteRequest(IRealmClient client, RealmPacketIn packet)
        {
			EntityId characterId = packet.ReadEntityId();
			string note = packet.ReadCString();

			RelationMgr.Instance.SetRelationNote(client.ActiveCharacter.EntityId.Low, characterId.Low, 
												note, CharacterRelationType.Friend);
        }
开发者ID:pallmall,项目名称:WCell,代码行数:8,代码来源:RelationHandler.cs

示例11: HandleProposeTrade

        public static void HandleProposeTrade(IRealmClient client, RealmPacketIn packet)
        {
            var targetGuid = packet.ReadEntityId();
            var targetChr = World.GetCharacter(targetGuid.Low);

            if (TradeInfo.CheckRequirements(client.ActiveCharacter, targetChr))
                TradeInfo.Propose(client.ActiveCharacter, targetChr);
        }
开发者ID:pallmall,项目名称:WCell,代码行数:8,代码来源:TradeHandler.cs

示例12: HandleAuctionHello

		public static void HandleAuctionHello(IRealmClient client, RealmPacketIn packet)
		{
			var chr = client.ActiveCharacter;
			var auctioneerId = packet.ReadEntityId();

			var auctioneer = chr.Map.GetObject(auctioneerId) as NPC;
			AuctionMgr.Instance.AuctionHello(chr, auctioneer);
		}
开发者ID:Zerant,项目名称:WCell,代码行数:8,代码来源:AuctionHandler.cs

示例13: HandleAuctionRemoveItem

		public static void HandleAuctionRemoveItem(IRealmClient client, RealmPacketIn packet)
		{
			var chr = client.ActiveCharacter;
			var auctioneerId = packet.ReadEntityId();
			var auctionId = packet.ReadUInt32();

			var auctioneer = chr.Map.GetObject(auctioneerId) as NPC;
			AuctionMgr.Instance.CancelAuction(chr, auctioneer, auctionId);
		}
开发者ID:Zerant,项目名称:WCell,代码行数:9,代码来源:AuctionHandler.cs

示例14: HandleGOUse

		public static void HandleGOUse(IRealmClient client, RealmPacketIn packet)
		{
			var goId = packet.ReadEntityId();

			var go = client.ActiveCharacter.Region.GetGO(goId.Low);
			if (go != null)
			{
				go.Use(client.ActiveCharacter);
			}
		}
开发者ID:ray2006,项目名称:WCell,代码行数:10,代码来源:GameObjectHandler.cs

示例15: HandleAvailableNodesQuery

		public static void HandleAvailableNodesQuery(IRealmClient client, RealmPacketIn packet)
		{
			var vendorId = packet.ReadEntityId();
			var vendor = client.ActiveCharacter.Region.GetObject(vendorId) as NPC;

			if (vendor != null)
			{
				vendor.TalkToFM(client.ActiveCharacter);
			}
		}
开发者ID:pallmall,项目名称:WCell,代码行数:10,代码来源:TaxiHandler.cs


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