Core/Packets: fixed QueryCreatureResponse

This commit is contained in:
joschiwald
2014-11-15 06:40:16 +01:00
parent 1e51d22d29
commit 0a9f34059e
3 changed files with 33 additions and 31 deletions

View File

@@ -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__

View File

@@ -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;
}

View File

@@ -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) { }