public static void SendArenaTeamRosterResponse(IPacketReceiver client, ArenaTeam team) { using (var packet = CreateArenaTeamRosterResponsePacket(team)) { client.Send(packet); } }
public static void SendAllAuras(IPacketReceiver rcv, Unit owner) { using (var packet = CreateAllAuraPacket(owner)) { rcv.Send(packet); } }
public static void SendBreakTarget(IPacketReceiver rcvr, IEntity target) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_BREAK_TARGET, 8)) { packet.Write(target.EntityId); rcvr.Send(packet); } }
public static void SendCancelAutoRepeat(IPacketReceiver client, IEntity entity) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_CANCEL_AUTO_REPEAT)) { entity.EntityId.WritePacked(packet); client.Send(packet); } }
public void SetUp() { request = new SomeRequest(); serverAddress = Mock.Of<IServerAddress>(); packetReceiver = Mock.Of<IPacketReceiver>(); packetConverter = Mock.Of<IPacketConverter>(); responseReceiver = new ResponseReveiver(packetReceiver, packetConverter); }
/// <summary> /// An instance has been reset /// </summary> public static void SendInstanceReset(IPacketReceiver client, MapId mapId) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_UPDATE_LAST_INSTANCE, 4)) { packet.Write((int)mapId); client.Send(packet); } }
public static void SendAllAuras(IPacketReceiver rcv, Unit owner) { if (!owner.IsAreaActive) return; using (var packet = CreateAllAuraPacket(owner)) { rcv.Send(packet); } }
public static void SendGameObjectTextPage(IPacketReceiver rcv, IEntity obj) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_GAMEOBJECT_PAGETEXT, 8)) { packet.Write(obj.EntityId); rcv.Send(packet); } }
public static void SendUpdateWorldState(IPacketReceiver rcv, WorldStateId key, int value) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_UPDATE_WORLD_STATE, 300)) { packet.Write((uint)key); packet.Write(value); rcv.Send(packet); } }
/// <summary> /// Makes the given faction visible to the client. /// </summary> public static void SendVisible(IPacketReceiver client, FactionReputationIndex reputationIndex) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SET_FACTION_VISIBLE, 4)) { packet.Write((int)reputationIndex); client.Send(packet); } }
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 SendAreaTriggerMessage(IPacketReceiver client, string msg) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_AREA_TRIGGER_MESSAGE, (msg.Length * 2) + 4)) { packet.WriteUIntPascalString(msg); packet.Write((byte)0); client.Send(packet); } }
public static void SendItemNameQueryResponse(IPacketReceiver client, ItemTemplate item) { using (var outPacket = new RealmPacketOut(RealmServerOpCode.SMSG_ITEM_NAME_QUERY_RESPONSE, 4 + item.DefaultName.Length)) { outPacket.WriteInt(item.Id); outPacket.WriteCString(item.DefaultName); client.Send(outPacket); } }
/// <summary> /// Lets player know they are at war with a certain faction. /// </summary> public static void SendSetAtWar(IPacketReceiver client, Reputation rep) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SET_FACTION_ATWAR, 5)) { packet.Write((int)rep.Faction.ReputationIndex); packet.Write((byte)rep.Flags); // rep flags client.Send(packet); } }
/*[ClientPacketHandler(RealmServerOpCode.CMSG_SET_PVP_TITLE)] public static void HandleSetPvPTitle(IRealmClient client, RealmPacketIn packet) { }*/ public static void SendPVPCredit(IPacketReceiver receiver, uint points, Character victim) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PVP_CREDIT)) { packet.Write(points); packet.Write(victim.EntityId); packet.Write((int)victim.PvPRank); receiver.Send(packet); } }
/// <summary> /// Correct for 3.0.9 /// </summary> /// <param name="client"></param> /// <param name="obj1"></param> /// <param name="obj2"></param> /// <param name="spellId"></param> /// <param name="b1"></param> public static void SendSpellOrDamageImmune(IPacketReceiver client, ObjectBase obj1, ObjectBase obj2, int spellId, bool b1) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SPELLORDAMAGE_IMMUNE, 21)) { packet.Write(obj1.EntityId); packet.Write(obj2.EntityId); packet.Write(spellId); packet.Write(b1); client.Send(packet); } }
/// <summary> /// Sends a responce detailing the results of the client's mail request. /// </summary> public static void SendResult(IPacketReceiver client, uint mailId, MailResult result, MailError err, uint itemId, int itemCount) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_SEND_MAIL_RESULT, 20)) { packet.Write(mailId); packet.Write((uint)result); packet.Write((uint)err); packet.Write(itemId); packet.Write(itemCount); client.Send(packet, false); } }
/// <summary>Sends a reputation update.</summary> public static void SendReputationStandingUpdate(IPacketReceiver client, Reputation rep) { using (RealmPacketOut packet = new RealmPacketOut((PacketId)RealmServerOpCode.SMSG_SET_FACTION_STANDING, 16)) { packet.Write(0.0f); packet.Write((byte)0); packet.Write(1); packet.Write((uint)rep.Faction.ReputationIndex); packet.Write(rep.Value); client.Send(packet, false); } }
/// <summary>Correct for 3.0.9</summary> /// <param name="client"></param> /// <param name="obj1"></param> /// <param name="obj2"></param> /// <param name="spellId"></param> /// <param name="b1"></param> public static void SendSpellOrDamageImmune(IPacketReceiver client, ObjectBase obj1, ObjectBase obj2, int spellId, bool b1) { using (RealmPacketOut packet = new RealmPacketOut((PacketId)RealmServerOpCode.SMSG_SPELLORDAMAGE_IMMUNE, 21)) { packet.Write((ulong)obj1.EntityId); packet.Write((ulong)obj2.EntityId); packet.Write(spellId); packet.Write(b1); client.Send(packet, false); } }
public static void SendBattlegroundError(IPacketReceiver rcv, BattlegroundJoinError err) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_GROUP_JOINED_BATTLEGROUND, 4)) { packet.Write((int)err); if (err == BattlegroundJoinError.JoinTimedOut || err == BattlegroundJoinError.JoinFailed) { packet.Write(0UL); } rcv.Send(packet, false); } }
public static void ClearStatus(IPacketReceiver client, int queueIndex) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_BATTLEFIELD_STATUS)) { packet.Write(queueIndex); // We write an empty BGID, this makes the client clear out data for this queue packet.Write(0ul); client.Send(packet); return; } }
/// <summary>Send Group Invite packet</summary> /// <param name="client">realm client</param> /// <param name="inviter">nick of player invited you</param> public static void SendGroupInvite(IPacketReceiver client, string inviter) { using (RealmPacketOut packet = new RealmPacketOut((PacketId)RealmServerOpCode.SMSG_GROUP_INVITE, inviter.Length + 10)) { packet.Write((byte)1); packet.WriteCString(inviter); packet.Write(0U); packet.Write((byte)0); packet.Write(0U); client.Send(packet, false); } }
public static void SendPetitionDecline(IPacketReceiver client, Character chr, PetitionRecord record) { using (var packet = new RealmPacketOut(RealmServerOpCode.MSG_PETITION_DECLINE, 8)) { var character = World.GetCharacter(record.OwnerId); if (character != null) { packet.WriteULong(chr.EntityId.Full); character.Client.Send(packet, addEnd: false); } } }
public static void SendRealmStateResponse(IPacketReceiver client, uint realmNo) { string str = "01/01/01"; using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_REALM_SPLIT, 9 + str.Length)) { packet.WriteUInt(realmNo); packet.WriteUInt(0U); packet.WriteCString(str); client.Send(packet, false); } }
public static void SendPetitionDecline(IPacketReceiver client, Character chr, PetitionRecord record) { using (RealmPacketOut packet = new RealmPacketOut((PacketId)RealmServerOpCode.MSG_PETITION_DECLINE, 8)) { Character character = WCell.RealmServer.Global.World.GetCharacter(record.OwnerId); if (character == null) { return; } packet.WriteULong(chr.EntityId.Full); character.Client.Send(packet, false); } }
/// <summary> /// Sends a reputation update. /// </summary> public static void SendReputationStandingUpdate(IPacketReceiver client, Reputation rep) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SET_FACTION_STANDING, 16)) { packet.Write(0f); // Refer-A-Friend bonus reputation packet.Write((byte)0); packet.Write(1); // count (we only ever send 1) packet.Write((uint)rep.Faction.ReputationIndex); packet.Write(rep.Value); client.Send(packet); } }
public static void SendMessage(IPacketReceiver target, string sender, string message, Color c) { var character = target as Character; if (character == null) { return; } using (var p = CreateGlobalChatMessage(sender, message, c, character.Client.Locale)) { target.Send(p, addEnd: false); } }
public static void SendSetSpellMissilePosition(IPacketReceiver client, EntityId casterId, byte castCount, Vector3 position) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SET_PROJECTILE_POSITION, 21)) { casterId.WritePacked(packet); packet.WriteByte(castCount); packet.WriteFloat(position.X); packet.WriteFloat(position.Y); packet.WriteFloat(position.Z); client.Send(packet, addEnd: false); } }
/// <summary> /// Sends the given list of messages as motd (displays as a regular system-msg) /// </summary> public static void SendMotd(IPacketReceiver client, params string[] messages) { //using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_MOTD, 4 + messages.Length * 20)) //{ // packet.Write(messages.Length); // foreach (var msg in messages) // { // packet.WriteCString(msg); // } // client.Send(packet); //} }
public static void SendConsoleCommandsListMessage(IPacketReceiver client, IEnumerable <CommandBase> commands) { var commandsInfos = (from command in commands let aliases = command.GetFullAliases() let usage = command.GetSafeUsage() from alias in aliases select Tuple.Create(alias, usage, command.Description ?? string.Empty)).ToList(); client.Send( new ConsoleCommandsListMessage( commandsInfos.Select(x => x.Item1), commandsInfos.Select(x => x.Item2), commandsInfos.Select(x => x.Item3))); }
public static void SendEquipmentSetSaved(IPacketReceiver client, EquipmentSet set) { if (set == null) { return; } using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_EQUIPMENT_SET_SAVED)) { packet.Write(set.Id); packet.Write(set.SetGuid); client.Send(packet, false); } }
/// <summary> /// Sends result of actions connected with groups /// </summary> /// <param name="client">the client to send to</param> /// <param name="resultType">The result type</param> /// <param name="resultCode">The <see cref="GroupResult"/> result code</param> /// <param name="name">name of player event has happened to</param> public static void SendResult(IPacketReceiver client, GroupResult resultCode, GroupResultType resultType, string name) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PARTY_COMMAND_RESULT, 4 + name.Length + 4 + 4)) { packet.Write((uint)resultType); packet.WriteCString(name); packet.Write((uint)resultCode); packet.Write((uint)0); // 3.3.3, lfg cooldown? client.Send(packet); } }
public static void SendPartyInvitationDetailsMessage(IPacketReceiver client, PartyInvitation invitation) { client.Send(new PartyInvitationDetailsMessage( invitation.Party.Id, (sbyte)invitation.Party.Type, invitation.Party.Name, invitation.Source.Id, invitation.Source.Name, invitation.Party.Leader.Id, invitation.Party.Members.Select(entry => entry.GetPartyInvitationMemberInformations()), invitation.Party.Guests.Select(invitation.Party.GetPartyGuestInformations) )); }
/// <summary> /// Sends result of actions connected with arenas /// </summary> /// <param name="client">the client to send to</param> /// <param name="commandId">command executed</param> /// <param name="name">name of player event has happened to</param> /// <param name="resultCode">The <see cref="ArenaTeamResult"/> result code</param> public static void SendResult(IPacketReceiver client, ArenaTeamCommandId commandId, string team, string player, ArenaTeamResult resultCode) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ARENA_TEAM_COMMAND_RESULT)) { packet.WriteUInt((uint)commandId); packet.WriteCString(team); packet.WriteCString(player); packet.WriteUInt((uint)resultCode); client.Send(packet); } }
public static void SendMode(IPacketReceiver receiver, IEntity pet, PetAttackMode attackMode, PetAction action, PetFlags flags) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PET_MODE, 12)) { packet.Write(pet.EntityId); packet.Write((byte)attackMode); packet.Write((byte)action); packet.Write((ushort)flags); receiver.Send(packet); } }
/// <summary> /// item1 and item2 can be null, but item1 must be set in case of YOU_MUST_REACH_LEVEL_N. /// </summary> /// <param name="client"></param> /// <param name="error"></param> public static void SendInventoryError(IPacketReceiver client, InventoryError error) { using (RealmPacketOut packet = new RealmPacketOut( RealmServerOpCode.SMSG_INVENTORY_CHANGE_FAILURE, error == InventoryError.YOU_MUST_REACH_LEVEL_N ? 22 : 18)) { packet.WriteByte((byte)error); packet.WriteULong(0); packet.WriteULong(0); packet.WriteByte(0); client.Send(packet, false); } }
/// <summary> /// Sends result of actions connected with arenas /// </summary> /// <param name="client">the client to send to</param> /// <param name="commandId">command executed</param> /// <param name="name">name of player event has happened to</param> /// <param name="resultCode">The <see cref="ArenaTeamResult"/> result code</param> public static void SendResult(IPacketReceiver client, ArenaTeamCommandId commandId, string team, string player, ArenaTeamResult resultCode) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ARENA_TEAM_COMMAND_RESULT)) { packet.WriteUInt((uint)commandId); packet.WriteCString(team); packet.WriteCString(player); packet.WriteUInt((uint)resultCode); client.Send(packet); } }
/// <summary> /// Send Point of interest which will then appear on the minimap /// </summary> public static void SendGossipPOI(IPacketReceiver rcv, GossipPOIFlags Flags, float X, float Y, int Data, int Icon, string Name) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_GOSSIP_POI)) { packet.Write((uint)Flags); packet.Write(X); packet.Write(Y); packet.Write(Data); packet.Write(Icon); packet.WriteCString(Name); rcv.Send(packet); } }
public Connection(JsonValue config) { string proto = config["proto"]; switch (proto) { case "TCP": { string addr = config["addr"]; int port = config["port"]; tcpClient = new TcpClient(); tcpClient.Connect(IPAddress.Parse(addr), port); reader = new TcpPacketReceiver(tcpClient); writer = new TcpPacketSender(tcpClient); break; } case "UDP": { string addr = config["addr"]; int port = config["port"]; udpClient = new UdpClient(); udpClient.Connect(IPAddress.Parse(addr), port); reader = new UDPPacketReceiver(udpClient, addr, port); writer = new UDPPacketSender(udpClient); break; } case "UART": { string port = config["port"]; sport = new SerialPort(port) { StopBits = StopBits.One, BaudRate = config["baudrate"], Parity = Parity.None, DataBits = 8 }; sport.Open(); System.Threading.Thread.Sleep(2000); reader = new SerialPacketReceiver(sport); writer = new SerialPacketSender(sport); break; } default: { throw new ArgumentOutOfRangeException(); } } }
public static void SendSlaveSwitchContextMessage(IPacketReceiver client, FightActor source, FightActor target) { if (target is SummonedMonster) { var spells = (target as SummonedMonster).Monster.Spells.Select(x => x.GetSpellItem()); List <Shortcut> shortcuts = new List <Shortcut>(); for (sbyte i = 0; i < spells.Count(); i++) { shortcuts.Add(new ShortcutSpell(i, (ushort)spells.ElementAt(i).spellId)); } target.Stats.Initialize((target as SummonedMonster).Monster); client.Send(new SlaveSwitchContextMessage(source.Id, target.Id, spells, target.GetSlaveStats(source), shortcuts)); } }
/// <summary>Used for any PeriodicAura (repeating ticks)</summary> /// <param name="extra">Always seems to be one</param> public static void SendPeriodicAuraLog(IPacketReceiver client, WorldObject caster, WorldObject target, uint spellId, uint extra, AuraTickFlags flags, int amount) { using (RealmPacketOut packet = new RealmPacketOut((PacketId)RealmServerOpCode.SMSG_PERIODICAURALOG, 32)) { caster.EntityId.WritePacked((BinaryWriter)packet); target.EntityId.WritePacked((BinaryWriter)packet); packet.WriteUInt(spellId); packet.WriteUInt(extra); packet.WriteUInt((uint)flags); packet.WriteUInt(amount); target.SendPacketToArea(packet, true, false, Locale.Any, new float?()); } }
public static void SendChatAdminServerMessage(IPacketReceiver client, ChatActivableChannelsEnum channel, string message, int timestamp, string fingerprint, int senderId, string senderName, int accountId) { if (!string.IsNullOrEmpty(message)) { client.Send(new ChatAdminServerMessage((sbyte)channel, message, timestamp, fingerprint, senderId, senderName, accountId)); } }
/// <summary> /// Sends the new state of the trading window to other party /// </summary> /// <param name="otherParty">Whether this is sending the own info to the other party (or, if false, to oneself)</param> /// <param name="client">receiving party</param> /// <param name="money">new amount of money</param> /// <param name="items">new items</param> public static void SendTradeUpdate(IPacketReceiver client, bool otherParty, uint money, Item[] items) { using (var pkt = new RealmPacketOut(RealmServerOpCode.SMSG_TRADE_STATUS_EXTENDED, 30 + 18 * 4 * items.Length)) { pkt.Write(otherParty); pkt.Write(0); // Trade id pkt.Write(items.Length); pkt.Write(items.Length); pkt.Write(money); pkt.Write(0); for (var i = 0; i < items.Length; i++) { pkt.WriteByte(i); var item = items[i]; if (item != null) { pkt.Write(item.EntryId); pkt.Write(item.Template.DisplayId); pkt.Write(item.Amount); pkt.Write(0); pkt.Write(item.GiftCreator); var enchant = item.GetEnchantment(EnchantSlot.Permanent); pkt.Write(enchant != null ? enchant.Entry.Id : 0); pkt.Zero(4 * 3); pkt.Write(item.Creator); pkt.Write(item.SpellCharges); pkt.Write(item.Template.RandomSuffixFactor); pkt.Write(item.RandomPropertiesId); var itemLock = item.Lock; pkt.Write(itemLock != null ? itemLock.Id : 0); pkt.Write(item.MaxDurability); pkt.Write(item.Durability); } else { pkt.Zero(18 * 4); } } client.Send(pkt, addEnd: false); } }
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 a "name query" reply to the client.</summary> /// <param name="client">the client to send to</param> /// <param name="entity">the character information to be sent</param> public static void SendNameQueryReply(IPacketReceiver client, ILivingEntity entity) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_NAME_QUERY_RESPONSE)) { entity.EntityId.WritePacked((BinaryWriter)packet); packet.Write((byte)0); packet.WriteCString(entity.Name); packet.Write((byte)0); packet.Write((byte)entity.Race); packet.Write((byte)entity.Gender); packet.Write((byte)entity.Class); packet.Write((byte)0); client.Send(packet, false); } }
public static void SendRealmStateResponse(IPacketReceiver client, uint realmNo) { //uint realmSplitState = 0; // realmNo = 0; const RealmState realmState = RealmState.Normal; var splitDate = "01/01/01"; using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_REALM_SPLIT, 8 + 1 + splitDate.Length)) { packet.WriteUInt(realmNo); packet.WriteUInt((uint)realmState); packet.WriteCString(splitDate); client.Send(packet); } }
public static void SendChatServerCopyMessage(IPacketReceiver client, Character sender, Character receiver, ChatActivableChannelsEnum channel, string message, int timestamp, string fingerprint) { if (!sender.UserGroup.IsGameMaster) { message = message.HtmlEntities(); } client.Send(new ChatServerCopyMessage( (sbyte)channel, message, timestamp, fingerprint, receiver.Id, receiver.Name)); }
/// <summary> /// Used for any PeriodicAura (repeating ticks) /// </summary> /// <param name="extra">Always seems to be one</param> public static void SendPeriodicAuraLog(IPacketReceiver client, WorldObject caster, WorldObject target, uint spellId, uint extra, AuraTickFlags flags, int amount) { // TODO: Update struct for 3.0.2 using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PERIODICAURALOG, 32)) { caster.EntityId.WritePacked(packet); target.EntityId.WritePacked(packet); packet.WriteUInt(spellId); packet.WriteUInt(extra); packet.WriteUInt((uint)flags); packet.WriteUInt(amount); target.SendPacketToArea(packet, true); } }
public static void SendInitWorldStates(IPacketReceiver rcv, MapId map, ZoneId zone, uint areaId, params WorldState[] states) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_INIT_WORLD_STATES, 300)) { packet.Write((uint)map); packet.Write((uint)zone); packet.Write(areaId); packet.Write((ushort)states.Length); foreach (var state in states) { packet.Write((uint)state.Key); packet.Write(state.DefaultValue); } rcv.Send(packet); } }
/// <summary> /// Used for any PeriodicAura (repeating ticks) /// </summary> /// <param name="extra">Always seems to be one</param> public static void SendPeriodicAuraLog(IPacketReceiver client, WorldObject caster, WorldObject target, uint spellId, uint extra, AuraTickFlags flags, int amount) { // TODO: Update struct using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PERIODICAURALOG, 32)) { caster.EntityId.WritePacked(packet); target.EntityId.WritePacked(packet); packet.WriteUInt(spellId); packet.WriteUInt(extra); packet.WriteUInt((uint)flags); packet.WriteUInt(amount); target.SendPacketToArea(packet, true, false); } }
public static void SendInitWorldStates(IPacketReceiver rcv, WorldStateCollection states, Zone newZone) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_INIT_WORLD_STATES, 300)) { packet.Write((uint)newZone.Map.Id); packet.Write((uint)newZone.ParentZoneId); packet.Write((uint)newZone.Id); var countPos = packet.Position; packet.Position += 2; var count = AppendWorldStates(packet, newZone); packet.Position = countPos; packet.Write((ushort)count); rcv.Send(packet); } }
/// <summary> /// Sends to the specified client the Who List based on the given characters /// </summary> /// <param name="client">The client to send the list</param> /// <param name="characters">The list of characters that matched the Who List search</param> public static void SendWhoList(IPacketReceiver client, ICollection<Character> characters) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_WHO)) { packet.Write(characters.Count); packet.Write(characters.Count); foreach (Character character in characters) { packet.WriteCString(character.Name); packet.WriteCString(character.Guild != null ? character.Guild.Name : string.Empty); //TODO: Add Guild name here packet.Write(character.Level); packet.WriteUInt((byte)character.Class); packet.WriteUInt((byte)character.Race); packet.WriteByte(0); //New in 2.4.x packet.Write(character.Zone != null ? (uint)character.Zone.Id : 0); } client.Send(packet); } }
public static bool SendTotemCreated(IPacketReceiver client, Spell totemSpell, EntityId totemEntityId) { var chr = client as Character; if (chr == null) return false; var effect = totemSpell.GetEffect(SpellEffectType.Summon); if (effect == null) return false; var slot = effect.SummonEntry.Slot - 1; using(var packet = new RealmPacketOut(RealmServerOpCode.SMSG_TOTEM_CREATED)) { packet.Write(slot); packet.Write(totemEntityId); packet.Write(totemSpell.GetDuration(chr.SharedReference)); packet.Write(totemSpell.Id); client.Send(packet); } return true; }
public static void SendPlayerPositions(IPacketReceiver client, IList<Character> players, IList<Character> flagCarriers) { using (var packet = new RealmPacketOut(RealmServerOpCode.MSG_BATTLEGROUND_PLAYER_POSITIONS)) { if (players != null) { packet.Write(players.Count); // for the players side foreach (var player in players) { packet.Write(player.EntityId); // player guid packet.Write(player.Position.X); // player x packet.Write(player.Position.Y); // player y } } else { packet.Write(0); } if (flagCarriers != null) { packet.Write(flagCarriers.Count); foreach (var player in flagCarriers) { packet.Write(player.EntityId); packet.Write(player.Position.X); packet.Write(player.Position.Y); } } else { packet.Write(0); } client.Send(packet); } }
/// <summary> /// "Your group joined Name" /// </summary> /// <param name="battleground"></param> public static void SendGroupJoinedBattleground(IPacketReceiver rcv, BattlegroundId battleground) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_GROUP_JOINED_BATTLEGROUND, 4)) { packet.Write((int)battleground); rcv.Send(packet); } }
public static void SendBattlegroundError(IPacketReceiver rcv, BattlegroundJoinError err) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_GROUP_JOINED_BATTLEGROUND, 4)) { packet.Write((int)err); if (err == BattlegroundJoinError.JoinTimedOut || err == BattlegroundJoinError.JoinFailed) packet.Write((ulong)0); rcv.Send(packet); } }
public static void SendPlayerLeft(IPacketReceiver rcv, Character leavingCharacter) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_BATTLEGROUND_PLAYER_LEFT, 8)) { packet.Write(leavingCharacter.EntityId); rcv.Send(packet); } }
public static void SendPlayerJoined(IPacketReceiver rcv, Character joiningCharacter) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_BATTLEGROUND_PLAYER_JOINED, 8)) { packet.Write(joiningCharacter.EntityId); rcv.Send(packet); } }
public static void SendPvpData(IPacketReceiver reciever, BattlegroundSide side, Battleground bg) { bg.EnsureContext(); using (var packet = new RealmPacketOut(RealmServerOpCode.MSG_PVP_LOG_DATA, 10 + bg.PlayerCount * 40)) { var winner = bg.Winner; packet.Write(bg.IsArena); if (bg.IsArena) { // TODO: Arena for (var i = 0; i < 2; i++) { packet.Write(0); // old rating packet.Write(3999); // new rating (3000 + diff) packet.Write(0); // matchmaking value (lvl group/rank?) } packet.WriteCString(string.Empty); // arena team names packet.WriteCString(string.Empty); } var isFinished = bg.Winner != null; packet.Write(isFinished); if (isFinished) { packet.Write((byte)bg.Winner.Side); } var chrs = bg.Characters; var chrCount = 0; var chrCountPos = packet.Position; packet.Position += 4; for (var i = 0; i < chrCount; i++) { var chr = chrs[i]; if (!chr.IsInBattleground) { continue; } var stats = chr.Battlegrounds.Stats; ++chrCount; packet.Write(chr.EntityId); // player guid packet.Write(stats.KillingBlows); if (bg.IsArena) { packet.Write(winner != null && chr.Battlegrounds.Team == winner); // is on the winning team } else { packet.Write(stats.HonorableKills); packet.Write(stats.Deaths); packet.Write(stats.BonusHonor); } packet.Write(stats.TotalDamage); packet.Write(stats.TotalHealing); packet.Write(stats.SpecialStatCount); stats.WriteSpecialStats(packet); } packet.Position = chrCountPos; packet.Write(chrCount); reciever.Send(packet); } }
public static void ClearStatus(IPacketReceiver client, int queueIndex) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_BATTLEFIELD_STATUS)) { packet.Write(queueIndex); // We write an empty BGID, this makes the client clear out data for this queue packet.Write(0ul); client.Send(packet); return; } }