public static void SendLearnedSpell(IPacketReceiver client, uint spellId) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_LEARNED_SPELL, 4)) { packet.WriteUInt(spellId); packet.WriteUShort(0); // 3.3.3a client.Send(packet, addEnd: false); } }
public static void SendLearnedSpell(IPacketReceiver client, uint spellId) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_LEARNED_SPELL, 4)) { packet.WriteUInt(spellId); packet.WriteUShort(0); // 3.3.3a client.Send(packet); } }
public static void SendPetitionQueryResponse(IPacketReceiver client, PetitionCharter charter) { string name = charter.Petition.Name; using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PETITION_QUERY_RESPONSE, 4 + 8 + name.Length + 1 + 1 + 4 * 12 + 2 + 10)) { packet.WriteUInt(charter.EntityId.Low); packet.WriteULong(charter.Owner.EntityId.Full); packet.WriteCString(name); packet.WriteByte(0); var type = (uint)charter.Petition.Type; if (type == (uint)PetitionType.Guild) { packet.WriteUInt(type); packet.WriteUInt(type); packet.WriteUInt(0); } else { packet.WriteUInt(type - 1); packet.WriteUInt(type - 1); packet.WriteUInt(type); } packet.WriteUInt(0); packet.WriteUInt(0); packet.WriteUInt(0); packet.WriteUInt(0); packet.WriteUShort(0); packet.WriteUInt(0); packet.WriteUInt(0); packet.WriteUInt(0); for (int i = 0; i < 10; ++i) { packet.WriteByte(0); } packet.WriteUInt(0); if (type == (uint)PetitionType.Guild) { packet.WriteUInt(0); } else { packet.WriteUInt(1); } client.Send(packet); } }
public static void SendPetitionQueryResponse(IPacketReceiver client, PetitionCharter charter) { string name = charter.Petition.Name; using (RealmPacketOut packet = new RealmPacketOut((PacketId)RealmServerOpCode.SMSG_PETITION_QUERY_RESPONSE, 12 + name.Length + 1 + 1 + 48 + 2 + 10)) { packet.WriteUInt(charter.EntityId.Low); packet.WriteULong(charter.Owner.EntityId.Full); packet.WriteCString(name); packet.WriteByte(0); uint type = (uint)charter.Petition.Type; if (type == 9U) { packet.WriteUInt(type); packet.WriteUInt(type); packet.WriteUInt(0); } else { packet.WriteUInt(type - 1U); packet.WriteUInt(type - 1U); packet.WriteUInt(type); } packet.WriteUInt(0); packet.WriteUInt(0); packet.WriteUInt(0); packet.WriteUInt(0); packet.WriteUShort(0); packet.WriteUInt(0); packet.WriteUInt(0); packet.WriteUInt(0); for (int index = 0; index < 10; ++index) { packet.WriteByte(0); } packet.WriteUInt(0); if (type == 9U) { packet.WriteUInt(0); } else { packet.WriteUInt(1); } client.Send(packet, false); } }
/// <summary> /// Sends the requested party member stats data to the client /// </summary> /// <param name="client">realm client</param> /// <param name="member">The character whose stats is going to be retrieved</param> /// <param name="flags">The stats to be retrieved from the <paramref name="member" /></param> private static void SendPartyMemberStatsInternal(IPacketReceiver client, GroupMember member, GroupUpdateFlags flags, RealmServerOpCode opcode) { using (RealmPacketOut packet = new RealmPacketOut(opcode)) { if (opcode == RealmServerOpCode.SMSG_PARTY_MEMBER_STATS_FULL) { packet.Write((byte)0); } member.WriteIdPacked(packet); if (!member.IsOnline) { packet.WriteUShort((ushort)0); client.Send(packet, false); } else { packet.Write((uint)flags); Character character = member.Character; if (flags.HasFlag(GroupUpdateFlags.Status)) { packet.Write((ushort)character.Status); } if (flags.HasFlag(GroupUpdateFlags.Health)) { packet.Write(character.Health); } if (flags.HasFlag(GroupUpdateFlags.MaxHealth)) { packet.Write(character.MaxHealth); } if (flags.HasFlag(GroupUpdateFlags.PowerType)) { packet.Write((byte)character.PowerType); } if (flags.HasFlag(GroupUpdateFlags.Power)) { packet.Write((ushort)character.Power); } if (flags.HasFlag(GroupUpdateFlags.MaxPower)) { packet.Write((ushort)character.MaxPower); } if (flags.HasFlag(GroupUpdateFlags.Level)) { packet.Write((ushort)character.Level); } if (flags.HasFlag(GroupUpdateFlags.ZoneId)) { packet.Write(character.Zone != null ? (ushort)character.Zone.Id : (ushort)0); } if (flags.HasFlag(GroupUpdateFlags.Position)) { packet.Write((ushort)character.Position.X); packet.Write((ushort)character.Position.Y); } if (flags.HasFlag(GroupUpdateFlags.Auras)) { ulong auraUpdateMask = character.AuraUpdateMask; packet.Write(auraUpdateMask); for (byte index = 0; index < (byte)56; ++index) { if (((long)auraUpdateMask & 1L << index) != 0L) { Aura at = character.Auras.GetAt(index); packet.Write(at.Spell.Id); packet.Write((byte)at.Flags); } } } NPC activePet = character.ActivePet; if (activePet == null) { packet.Write((byte)0); packet.Write(0UL); client.Send(packet, false); } else { if (flags.HasFlag(GroupUpdateFlags.PetGuid)) { packet.Write(activePet.EntityId); } if (flags.HasFlag(GroupUpdateFlags.PetName)) { packet.WriteCString(activePet.Name); } if (flags.HasFlag(GroupUpdateFlags.PetDisplayId)) { packet.Write((ushort)activePet.DisplayId); } if (flags.HasFlag(GroupUpdateFlags.PetHealth)) { packet.Write(activePet.Health); } if (flags.HasFlag(GroupUpdateFlags.PetMaxHealth)) { packet.Write(activePet.MaxHealth); } if (flags.HasFlag(GroupUpdateFlags.PetPowerType)) { packet.Write((byte)activePet.PowerType); } if (flags.HasFlag(GroupUpdateFlags.PetPower)) { packet.Write((ushort)activePet.Power); } if (flags.HasFlag(GroupUpdateFlags.PetMaxPower)) { packet.Write((ushort)activePet.MaxPower); } if (flags.HasFlag(GroupUpdateFlags.PetAuras)) { ulong auraUpdateMask = activePet.AuraUpdateMask; packet.Write(auraUpdateMask); for (byte index = 0; index < (byte)56; ++index) { if (((long)auraUpdateMask & 1L << index) != 0L) { Aura at = activePet.Auras.GetAt(index); packet.Write(at.Spell.Id); packet.Write((byte)at.Flags); } } } client.Send(packet, false); } } } }
/// <summary> /// Sends the requested party member stats data to the client /// </summary> /// <param name="client">realm client</param> /// <param name="member">The character whose stats is going to be retrieved</param> /// <param name="flags">The stats to be retrieved from the <paramref name="member"/></param> private static void SendPartyMemberStatsInternal(IPacketReceiver client, GroupMember member, GroupUpdateFlags flags, RealmServerOpCode opcode) { using (var packet = new RealmPacketOut(opcode)) { if (opcode == RealmServerOpCode.SMSG_PARTY_MEMBER_STATS_FULL) { packet.Write((byte)0); //arena something } member.WriteIdPacked(packet); if (!member.IsOnline) { packet.WriteUShort((ushort)CharacterStatus.OFFLINE); client.Send(packet); return; } packet.Write((uint)flags); var chr = member.Character; if (flags.HasFlag(GroupUpdateFlags.Status)) { packet.Write((ushort)chr.Status); } if (flags.HasFlag(GroupUpdateFlags.Health)) { packet.Write(chr.Health); } if (flags.HasFlag(GroupUpdateFlags.MaxHealth)) { packet.Write(chr.MaxHealth); } if (flags.HasFlag(GroupUpdateFlags.PowerType)) { packet.Write((byte)chr.PowerType); } if (flags.HasFlag(GroupUpdateFlags.Power)) { packet.Write((ushort)chr.Power); } if (flags.HasFlag(GroupUpdateFlags.MaxPower)) { packet.Write((ushort)chr.MaxPower); } if (flags.HasFlag(GroupUpdateFlags.Level)) { packet.Write((ushort)chr.Level); } if (flags.HasFlag(GroupUpdateFlags.ZoneId)) { packet.Write((ushort)(chr.Zone != null ? chr.Zone.Id : ZoneId.None)); } if (flags.HasFlag(GroupUpdateFlags.Position)) { packet.Write((ushort)chr.Position.X); packet.Write((ushort)chr.Position.Y); } if (flags.HasFlag(GroupUpdateFlags.Auras)) { ulong auraMask = chr.AuraUpdateMask; packet.Write(auraMask); Aura currAura; for (byte i = 0; i < AuraHandler.MaxAuras; ++i) { if ((auraMask & ((ulong)1 << i)) != 0) { currAura = chr.Auras.GetAt(i); packet.Write(currAura.Spell.Id); packet.Write((byte)currAura.Flags); } } } NPC targetPet = chr.ActivePet; if (targetPet == null) //no pet { packet.Write((byte)0); //name packet.Write(0UL); //auras client.Send(packet); return; } if (flags.HasFlag(GroupUpdateFlags.PetGuid)) { packet.Write(targetPet.EntityId); } if (flags.HasFlag(GroupUpdateFlags.PetName)) { packet.WriteCString(targetPet.Name); } if (flags.HasFlag(GroupUpdateFlags.PetDisplayId)) { packet.Write((ushort)targetPet.DisplayId); } if (flags.HasFlag(GroupUpdateFlags.PetHealth)) { packet.Write(targetPet.Health); } if (flags.HasFlag(GroupUpdateFlags.PetMaxHealth)) { packet.Write(targetPet.MaxHealth); } if (flags.HasFlag(GroupUpdateFlags.PetPowerType)) { packet.Write((byte)targetPet.PowerType); } if (flags.HasFlag(GroupUpdateFlags.PetPower)) { packet.Write((ushort)targetPet.Power); } if (flags.HasFlag(GroupUpdateFlags.PetMaxPower)) { packet.Write((ushort)targetPet.MaxPower); } if (flags.HasFlag(GroupUpdateFlags.PetAuras)) { ulong auraMask = targetPet.AuraUpdateMask; packet.Write(auraMask); Aura currAura; for (byte i = 0; i < AuraHandler.MaxAuras; ++i) { if ((auraMask & ((ulong)1 << i)) != 0) { currAura = targetPet.Auras.GetAt(i);//chr.Auras.GetAt(i); packet.Write(currAura.Spell.Id); packet.Write((byte)currAura.Flags); } } } client.Send(packet); } }
public static void SendPetitionQueryResponse(IPacketReceiver client, PetitionCharter charter) { string name = charter.Petition.Name; using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PETITION_QUERY_RESPONSE, 4 + 8 + name.Length + 1 + 1 + 4 * 12 + 2 + 10)) { packet.WriteUInt(charter.EntityId.Low); packet.WriteULong(charter.Owner.EntityId.Full); packet.WriteCString(name); packet.WriteByte(0); var type = (uint)charter.Petition.Type; if(type == (uint)PetitionType.Guild) { packet.WriteUInt(type); packet.WriteUInt(type); packet.WriteUInt(0); } else { packet.WriteUInt(type-1); packet.WriteUInt(type-1); packet.WriteUInt(type); } packet.WriteUInt(0); packet.WriteUInt(0); packet.WriteUInt(0); packet.WriteUInt(0); packet.WriteUShort(0); packet.WriteUInt(0); packet.WriteUInt(0); packet.WriteUInt(0); for(int i = 0; i < 10; ++i) packet.WriteByte(0); packet.WriteUInt(0); if(type == (uint)PetitionType.Guild) packet.WriteUInt(0); else packet.WriteUInt(1); client.Send(packet); } }
/// <summary> /// Sends the requested party member stats data to the client /// </summary> /// <param name="client">realm client</param> /// <param name="member">The character whose stats is going to be retrieved</param> /// <param name="flags">The stats to be retrieved from the <paramref name="member"/></param> private static void SendPartyMemberStatsInternal(IPacketReceiver client, GroupMember member, GroupUpdateFlags flags, RealmServerOpCode opcode) { using (var packet = new RealmPacketOut(opcode)) { if (opcode == RealmServerOpCode.SMSG_PARTY_MEMBER_STATS_FULL) { packet.Write((byte)0); //arena something } member.WriteIdPacked(packet); if (!member.IsOnline) { packet.WriteUShort((ushort)CharacterStatus.OFFLINE); client.Send(packet, addEnd: false); return; } packet.Write((uint)flags); var chr = member.Character; if (flags.HasFlag(GroupUpdateFlags.Status)) { packet.Write((ushort)chr.Status); } if (flags.HasFlag(GroupUpdateFlags.Health)) { packet.Write(chr.Health); } if (flags.HasFlag(GroupUpdateFlags.MaxHealth)) { packet.Write(chr.MaxHealth); } if (flags.HasFlag(GroupUpdateFlags.PowerType)) { packet.Write((byte)chr.PowerType); } if (flags.HasFlag(GroupUpdateFlags.Power)) { packet.Write((ushort)chr.Power); } if (flags.HasFlag(GroupUpdateFlags.MaxPower)) { packet.Write((ushort)chr.MaxPower); } if (flags.HasFlag(GroupUpdateFlags.Level)) { packet.Write((ushort)chr.Level); } if (flags.HasFlag(GroupUpdateFlags.ZoneId)) { packet.Write((ushort)(chr.Zone != null ? chr.Zone.Id : ZoneId.None)); } if (flags.HasFlag(GroupUpdateFlags.Position)) { packet.Write((ushort)chr.Position.X); packet.Write((ushort)chr.Position.Y); } if (flags.HasFlag(GroupUpdateFlags.Auras)) { ulong auraMask = chr.AuraUpdateMask; packet.Write(auraMask); Aura currAura; for (byte i = 0; i < AuraHandler.MaxAuras; ++i) { if ((auraMask & ((ulong)1 << i)) != 0) { currAura = chr.Auras.GetAt(i); packet.Write(currAura.Spell.Id); packet.Write((byte)currAura.Flags); } } } NPC targetPet = chr.ActivePet; if (targetPet == null) //no pet { packet.Write((byte)0); //name packet.Write(0UL); //auras client.Send(packet, addEnd: false); return; } if (flags.HasFlag(GroupUpdateFlags.PetGuid)) { packet.Write(targetPet.EntityId); } if (flags.HasFlag(GroupUpdateFlags.PetName)) { packet.WriteCString(targetPet.Name); } if (flags.HasFlag(GroupUpdateFlags.PetDisplayId)) { packet.Write((ushort)targetPet.DisplayId); } if (flags.HasFlag(GroupUpdateFlags.PetHealth)) { packet.Write(targetPet.Health); } if (flags.HasFlag(GroupUpdateFlags.PetMaxHealth)) { packet.Write(targetPet.MaxHealth); } if (flags.HasFlag(GroupUpdateFlags.PetPowerType)) { packet.Write((byte)targetPet.PowerType); } if (flags.HasFlag(GroupUpdateFlags.PetPower)) { packet.Write((ushort)targetPet.Power); } if (flags.HasFlag(GroupUpdateFlags.PetMaxPower)) { packet.Write((ushort)targetPet.MaxPower); } if (flags.HasFlag(GroupUpdateFlags.PetAuras)) { ulong auraMask = targetPet.AuraUpdateMask; packet.Write(auraMask); Aura currAura; for (byte i = 0; i < AuraHandler.MaxAuras; ++i) { if ((auraMask & ((ulong)1 << i)) != 0) { currAura = targetPet.Auras.GetAt(i); //chr.Auras.GetAt(i); packet.Write(currAura.Spell.Id); packet.Write((byte)currAura.Flags); } } } client.Send(packet, addEnd: false); } }