diff options
author | joschiwald <joschiwald.trinity@gmail.com> | 2014-11-15 06:40:16 +0100 |
---|---|---|
committer | joschiwald <joschiwald.trinity@gmail.com> | 2014-11-15 06:40:16 +0100 |
commit | 0a9f34059ef03fa54b7c0533a4b4933db5eb7a9d (patch) | |
tree | 2fa05bf474f5a2a4bba41944f2a391403d91aeaa /src | |
parent | 1e51d22d2990c69c4725133733c99599ddb0abd1 (diff) |
Core/Packets: fixed QueryCreatureResponse
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Server/Packets/MiscPackets.h | 30 | ||||
-rw-r--r-- | src/server/game/Server/Packets/QueryPackets.cpp | 30 | ||||
-rw-r--r-- | src/server/game/Server/Packets/SpellPackets.h | 4 |
3 files changed, 33 insertions, 31 deletions
diff --git a/src/server/game/Server/Packets/MiscPackets.h b/src/server/game/Server/Packets/MiscPackets.h index d185b4dc10f..8b78074090f 100644 --- a/src/server/game/Server/Packets/MiscPackets.h +++ b/src/server/game/Server/Packets/MiscPackets.h @@ -1,19 +1,19 @@ /* -* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by the -* Free Software Foundation; either version 2 of the License, or (at your -* option) any later version. -* -* This program is distributed in the hope that it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -* more details. -* -* You should have received a copy of the GNU General Public License along -* with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ #ifndef MiscPackets_h__ #define MiscPackets_h__ diff --git a/src/server/game/Server/Packets/QueryPackets.cpp b/src/server/game/Server/Packets/QueryPackets.cpp index 23c851d36ce..3076c221c71 100644 --- a/src/server/game/Server/Packets/QueryPackets.cpp +++ b/src/server/game/Server/Packets/QueryPackets.cpp @@ -27,29 +27,33 @@ WorldPacket const* WorldPackets::Query::QueryCreatureResponse::Write() _worldPacket << CreatureID; _worldPacket.WriteBit(Allow); + _worldPacket.FlushBits(); + if (Allow) { - _worldPacket.WriteBits(uint32(Stats.Title.length()+1), 11); - _worldPacket.WriteBits(uint32(Stats.TitleAlt.length()+1), 11); - _worldPacket.WriteBits(uint32(Stats.CursorName.length()+1), 6); + _worldPacket.WriteBits(Stats.Title.length() + 1, 11); + _worldPacket.WriteBits(Stats.TitleAlt.length() + 1, 11); + _worldPacket.WriteBits(Stats.CursorName.length() + 1, 6); _worldPacket.WriteBit(Stats.Leader); for (uint32 i = 0; i < MAX_CREATURE_NAMES; ++i) { - _worldPacket.WriteBits(uint32(Stats.Name[i].length()+1), 11); - _worldPacket.WriteBits(uint32(Stats.NameAlt[i].length()+1), 11); + _worldPacket.WriteBits(Stats.Name[i].length() + 1, 11); + _worldPacket.WriteBits(Stats.NameAlt[i].length() + 1, 11); } for (uint32 i = 0; i < MAX_CREATURE_NAMES; ++i) { if (!Stats.Name[i].empty()) _worldPacket << Stats.Name[i]; + if (!Stats.NameAlt[i].empty()) _worldPacket << Stats.NameAlt[i]; } - _worldPacket << Stats.Flags[0]; - _worldPacket << Stats.Flags[1]; + for (uint8 i = 0; i < 2; ++i) + _worldPacket << Stats.Flags[i]; + _worldPacket << Stats.CreatureType; _worldPacket << Stats.CreatureFamily; _worldPacket << Stats.Classification; @@ -69,20 +73,18 @@ WorldPacket const* WorldPackets::Query::QueryCreatureResponse::Write() _worldPacket << int32(0); // FlagQuest - if (Stats.Title.length()) + if (!Stats.Title.empty()) _worldPacket << Stats.Title; - if (Stats.TitleAlt.length()) + if (!Stats.TitleAlt.empty()) _worldPacket << Stats.TitleAlt; - if (Stats.CursorName.length()) + if (!Stats.CursorName.empty()) _worldPacket << Stats.CursorName; - for (uint32 i = 0; i < Stats.QuestItems.size(); ++i) - _worldPacket << Stats.QuestItems[i]; + for (int32 questItem : Stats.QuestItems) + _worldPacket << questItem; } - - _worldPacket.FlushBits(); return &_worldPacket; } diff --git a/src/server/game/Server/Packets/SpellPackets.h b/src/server/game/Server/Packets/SpellPackets.h index 6c76ca53c75..dde50e46759 100644 --- a/src/server/game/Server/Packets/SpellPackets.h +++ b/src/server/game/Server/Packets/SpellPackets.h @@ -32,8 +32,8 @@ namespace WorldPackets CategoryCooldownInfo(uint32 category, int32 cooldown) : Category(category), ModCooldown(cooldown) { } - uint32 Category = 0; - int32 ModCooldown = 0; + uint32 Category = 0; ///< SpellCategory Id + int32 ModCooldown = 0; ///< Reduced Cooldown in ms }; CategoryCooldown() : ServerPacket(SMSG_SPELL_CATEGORY_COOLDOWN, 4) { } |