本文整理汇总了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;
}
}
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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.
}
示例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();
}
示例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);
}
}));
}
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
}