本文整理汇总了C#中RealmPacketIn类的典型用法代码示例。如果您正苦于以下问题:C# RealmPacketIn类的具体用法?C# RealmPacketIn怎么用?C# RealmPacketIn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RealmPacketIn类属于命名空间,在下文中一共展示了RealmPacketIn类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
示例2: 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);
}
}));
}
}
示例3: 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);
}
示例4: HandleStopWatchingFaction
public static void HandleStopWatchingFaction(IRealmClient client, RealmPacketIn packet)
{
var reputationIndex = (FactionReputationIndex)packet.ReadInt32();
bool isInactive = packet.ReadBoolean();
client.ActiveCharacter.Reputations.SetInactive(reputationIndex, isInactive);
}
示例5: HandleRemoveGlyph
public static void HandleRemoveGlyph(IRealmClient client, RealmPacketIn packet)
{
var slot = packet.ReadUInt32();
var chr = client.ActiveCharacter;
chr.RemoveGlyph((byte)slot);
SendTalentGroupList(chr.Talents);
}
示例6: HandleCancel
public static void HandleCancel(IRealmClient client, RealmPacketIn packet)
{
if (client.ActiveCharacter.Duel != null)
{
client.ActiveCharacter.Duel.Finish(DuelWin.Knockout, client.ActiveCharacter);
}
}
示例7: HandleJoin
public static void HandleJoin(IRealmClient client, RealmPacketIn packet)
{
var roles = packet.ReadUInt32();
packet.SkipBytes(2);
var dungeonsCount = packet.ReadByte();
if (dungeonsCount == 0)
return;
for (byte i = 0; i < dungeonsCount; ++i)
{
// dungeons id/type
var packedDungeon = packet.ReadUInt32();
var id = packedDungeon & 0x00FFFFFF;
var type = packedDungeon & 0xFF000000;
}
byte counter2 = packet.ReadByte();
packet.SkipBytes(counter2); // lua: GetLFGInfoLocal
string comment = packet.ReadCString();
//SendLfgJoinResult();
//SendLfgUpdate();
}
示例8: HandleCreateTicketPacket
public static void HandleCreateTicketPacket(IRealmClient client, RealmPacketIn packet)
{
var chr = client.ActiveCharacter;
if (chr.Ticket == null)
{
var map = (MapId)packet.ReadUInt32();
var x = packet.ReadFloat();
var y = packet.ReadFloat();
var z = packet.ReadFloat();
var msg = packet.ReadCString();
var type = (TicketType)packet.ReadUInt32(); // prev. unk0
var unk1 = packet.ReadByte(); // unk1, 1
var unk2 = packet.ReadUInt32(); // unk2, 0
var unk3 = packet.ReadUInt32(); // unk3, 0
var ticket = new Ticket(chr, msg, type);
TicketMgr.Instance.AddTicket(ticket);
chr.Ticket = ticket;
SendCreateResponse(client, TicketInfoResponse.Saved);
}
else
{
SendCreateResponse(client, TicketInfoResponse.Fail);
}
}
示例9: Accept
public static void Accept(IRealmClient client, RealmPacketIn packet)
{
var invitee = client.ActiveCharacter;
var listInviters = RelationMgr.Instance.GetPassiveRelations(invitee.EntityId.Low,
CharacterRelationType.GuildInvite);
var invite = listInviters.FirstOrDefault();
if (invite == null)
return;
Character inviter = World.GetCharacter(invite.CharacterId);
if (inviter == null)
return;
//Removes the guild invite relation between the inviter and invitee
RelationMgr.Instance.RemoveRelation(invite);
var guildMember = inviter.GuildMember;
if (guildMember == null)
return;
var guild = guildMember.Guild;
//Add the invitee to the guild
guild.AddMember(invitee);
}
示例10: 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.
}
示例11: AddIgnoreRequest
public static void AddIgnoreRequest(IRealmClient client, RealmPacketIn packet)
{
string relCharacterName = packet.ReadCString();
RelationMgr.Instance.AddRelation(client.ActiveCharacter, relCharacterName,
string.Empty, CharacterRelationType.Ignored);
}
示例12: RemoveFriendRequest
public static void RemoveFriendRequest(IRealmClient client, RealmPacketIn packet)
{
var relCharId = packet.ReadEntityId();
RelationMgr.Instance.RemoveRelation(client.ActiveCharacter.EntityId.Low, relCharId.Low,
CharacterRelationType.Friend);
}
示例13: 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;
}
}
}
}
示例14: HandleInstanceReset
public static void HandleInstanceReset(IRealmClient client, RealmPacketIn packet)
{
if (client.ActiveCharacter != null && client.ActiveCharacter.HasInstanceCollection)
{
client.ActiveCharacter.Instances.TryResetInstances();
}
}
示例15: HandleDungeonDifficulty
public static void HandleDungeonDifficulty(IRealmClient client, RealmPacketIn packet)
{
var chr = client.ActiveCharacter;
if (chr.Map.IsInstance)
{
// Cannot change difficulty while in instance
return;
}
var difficultyIndex = packet.ReadUInt32();
var group = chr.Group;
if (group != null)
{
if (group.Leader.Character != chr)
{
// Only leader can change difficulty
return;
}
}
var instances = chr.Instances;
if (instances.TryResetInstances())
{
if (group != null)
{
group.DungeonDifficulty = difficultyIndex;
}
else
{
chr.DungeonDifficulty = (DungeonDifficulty)difficultyIndex;
}
}
}