Core/Misc: converted quest, creature and quest query packets to packet class and ported query data caching from 335 branch
This commit is contained in:
1 parent
8c4491f3a0
commit
64c4b4f529
22 files changed
+924
-387
No files matched your search
@@ -37,6 +37,7 @@
|
||||
#include "OutdoorPvPMgr.h"
|
||||
#include "PhasingHandler.h"
|
||||
#include "PoolMgr.h"
|
||||
#include "QueryPackets.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "Transport.h"
|
||||
@@ -57,6 +58,60 @@ QuaternionData QuaternionData::fromEulerAnglesZYX(float Z, float Y, float X)
|
||||
return QuaternionData(quat.x, quat.y, quat.z, quat.w);
|
||||
}
|
||||
|
||||
void GameObjectTemplate::InitializeQueryData()
|
||||
{
|
||||
WorldPacket queryTemp;
|
||||
for (uint8 loc = LOCALE_enUS; loc < TOTAL_LOCALES; ++loc)
|
||||
{
|
||||
queryTemp = BuildQueryData(static_cast<LocaleConstant>(loc));
|
||||
QueryData[loc] = queryTemp;
|
||||
}
|
||||
}
|
||||
|
||||
WorldPacket GameObjectTemplate::BuildQueryData(LocaleConstant loc) const
|
||||
{
|
||||
WorldPackets::Query::QueryGameObjectResponse queryTemp;
|
||||
|
||||
std::string locName = name;
|
||||
std::string locIconName = IconName;
|
||||
std::string locCastBarCaption = castBarCaption;
|
||||
|
||||
if (GameObjectLocale const* gameObjectLocale = sObjectMgr->GetGameObjectLocale(entry))
|
||||
{
|
||||
ObjectMgr::GetLocaleString(gameObjectLocale->Name, loc, locName);
|
||||
ObjectMgr::GetLocaleString(gameObjectLocale->CastBarCaption, loc, locCastBarCaption);
|
||||
}
|
||||
|
||||
queryTemp.GameObjectID = entry;
|
||||
queryTemp.Allow = true;
|
||||
|
||||
queryTemp.Stats.Type = type;
|
||||
queryTemp.Stats.DisplayID = displayId;
|
||||
queryTemp.Stats.Name[0] = locName;
|
||||
queryTemp.Stats.IconName = locIconName;
|
||||
queryTemp.Stats.CastBarCaption = locCastBarCaption;
|
||||
queryTemp.Stats.UnkString = unk1;
|
||||
|
||||
for (uint8 i = 0; i < MAX_GAMEOBJECT_DATA; ++i)
|
||||
queryTemp.Stats.Data[i] = raw.data[i];
|
||||
|
||||
queryTemp.Stats.Size = size;
|
||||
|
||||
for (uint32 i = 0; i < MAX_GAMEOBJECT_QUEST_ITEMS; ++i)
|
||||
queryTemp.Stats.QuestItems[i] = 0;
|
||||
|
||||
if (std::vector<uint32> const* items = sObjectMgr->GetCreatureQuestItemList(entry))
|
||||
for (uint32 i = 0; i < MAX_GAMEOBJECT_QUEST_ITEMS; ++i)
|
||||
if (i < items->size())
|
||||
queryTemp.Stats.QuestItems[i] = (*items)[i];
|
||||
|
||||
queryTemp.Stats.RequiredLevel = RequiredLevel;
|
||||
|
||||
queryTemp.Write();
|
||||
queryTemp.ShrinkToFit();
|
||||
return queryTemp.Move();
|
||||
}
|
||||
|
||||
GameObject::GameObject() : WorldObject(false), MapObject(),
|
||||
m_model(nullptr), m_goValue(), m_AI(nullptr), m_respawnCompatibilityMode(false), _triggerJustAppeared(true)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user