Core/ObjectMgr: Refactor sGOStorage

This commit is contained in:
leak
2011-04-28 22:54:30 +02:00
parent 3ab83417f5
commit e2e9431ca3
23 changed files with 327 additions and 280 deletions
@@ -137,7 +137,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
}
case SMART_SCRIPT_TYPE_GAMEOBJECT:
{
if (!sGOStorage.LookupEntry<GameObjectInfo>((uint32)temp.entryOrGuid))
if (!sObjectMgr->GetGameObjectTemplate((uint32)temp.entryOrGuid))
{
sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: GameObject entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
continue;
@@ -241,7 +241,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder e)
case SMART_TARGET_GAMEOBJECT_DISTANCE:
case SMART_TARGET_GAMEOBJECT_RANGE:
{
if (e.target.goDistance.entry && !sGOStorage.LookupEntry<GameObjectInfo>(e.target.goDistance.entry))
if (e.target.goDistance.entry && !sObjectMgr->GetGameObjectTemplate(e.target.goDistance.entry))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.goDistance.entry);
return false;
@@ -1282,7 +1282,7 @@ class SmartAIMgr
}
inline bool IsGameObjectValid(SmartScriptHolder e, uint32 entry)
{
if (!sGOStorage.LookupEntry<GameObjectInfo>(uint32(entry)))
if (!sObjectMgr->GetGameObjectTemplate(entry))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
@@ -901,7 +901,7 @@ Transport* BattlegroundIC::CreateTransport(uint32 goEntry,uint32 period)
{
Transport* t = new Transport(period,0);
const GameObjectInfo* goinfo = sObjectMgr->GetGameObjectInfo(goEntry);
const GameObjectTemplate* goinfo = sObjectMgr->GetGameObjectTemplate(goEntry);
if (!goinfo)
{
+13 -17
View File
@@ -612,7 +612,7 @@ bool ChatHandler::HandleListObjectCommand(const char *args)
return false;
}
GameObjectInfo const * gInfo = ObjectMgr::GetGameObjectInfo(go_id);
GameObjectTemplate const * gInfo = sObjectMgr->GetGameObjectTemplate(go_id);
if (!gInfo)
{
PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, go_id);
@@ -1307,21 +1307,17 @@ bool ChatHandler::HandleLookupObjectCommand(const char *args)
uint32 count = 0;
uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
for (uint32 id = 0; id< sGOStorage.MaxEntry; id++)
GameObjectTemplateContainer const* gotc = sObjectMgr->GetGameObjectTemplates();
for (GameObjectTemplateContainer::const_iterator itr = gotc->begin(); itr != gotc->end(); ++itr)
{
GameObjectInfo const* gInfo = sGOStorage.LookupEntry<GameObjectInfo>(id);
if (!gInfo)
continue;
int loc_idx = GetSessionDbLocaleIndex();
if (loc_idx >= 0)
uint8 localeIndex = GetSessionDbLocaleIndex();
if (localeIndex >= 0)
{
uint8 uloc_idx = uint8(loc_idx);
if (GameObjectLocale const *gl = sObjectMgr->GetGameObjectLocale(id))
if (GameObjectLocale const *gl = sObjectMgr->GetGameObjectLocale(itr->second.entry))
{
if (gl->Name.size() > uloc_idx && !gl->Name[uloc_idx].empty())
if (gl->Name.size() > localeIndex && !gl->Name[localeIndex].empty())
{
std::string name = gl->Name[uloc_idx];
std::string name = gl->Name[localeIndex];
if (Utf8FitTo(name, wnamepart))
{
@@ -1332,9 +1328,9 @@ bool ChatHandler::HandleLookupObjectCommand(const char *args)
}
if (m_session)
PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, id, id, name.c_str());
PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, itr->second.entry, itr->second.entry, name.c_str());
else
PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, id, name.c_str());
PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->second.entry, name.c_str());
if (!found)
found = true;
@@ -1345,7 +1341,7 @@ bool ChatHandler::HandleLookupObjectCommand(const char *args)
}
}
std::string name = gInfo->name;
std::string name = itr->second.name;
if (name.empty())
continue;
@@ -1358,9 +1354,9 @@ bool ChatHandler::HandleLookupObjectCommand(const char *args)
}
if (m_session)
PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, id, id, name.c_str());
PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, itr->second.entry, itr->second.entry, name.c_str());
else
PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, id, name.c_str());
PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->second.entry, name.c_str());
if (!found)
found = true;
+2 -2
View File
@@ -1226,7 +1226,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
{
case SPELL_TARGET_TYPE_GAMEOBJECT:
{
if (cond->mConditionValue2 && !sGOStorage.LookupEntry<GameObjectInfo>(cond->mConditionValue2))
if (cond->mConditionValue2 && !sObjectMgr->GetGameObjectTemplate(cond->mConditionValue2))
{
sLog->outErrorDb("SpellTarget condition has non existing gameobject (%u) as target, skipped", cond->mConditionValue2);
return false;
@@ -1369,7 +1369,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
}
case CONDITION_NEAR_GAMEOBJECT:
{
if (!sGOStorage.LookupEntry<GameObjectInfo>(cond->mConditionValue1))
if (!sObjectMgr->GetGameObjectTemplate(cond->mConditionValue1))
{
sLog->outErrorDb("NearGameObject condition has non existing gameobject template entry (%u), skipped", cond->mConditionValue1);
return false;
@@ -87,7 +87,7 @@ bool GameObject::AIM_Initialize()
std::string GameObject::GetAIName() const
{
return ObjectMgr::GetGameObjectInfo(GetEntry())->AIName;
return sObjectMgr->GetGameObjectTemplate(GetEntry())->AIName;
}
void GameObject::CleanupsBeforeDelete(bool /*finalCleanup*/)
@@ -113,7 +113,7 @@ void GameObject::CleanupsBeforeDelete(bool /*finalCleanup*/)
ownerType = "pet";
sLog->outError("Delete GameObject (GUID: %u Entry: %u SpellId %u LinkedGO %u) that lost references to owner (GUID %u Type '%s') GO list. Crash possible later.",
GetGUIDLow(), GetGOInfo()->id, m_spellId, GetGOInfo()->GetLinkedGameObjectEntry(), GUID_LOPART(owner_guid), ownerType);
GetGUIDLow(), GetGOInfo()->entry, m_spellId, GetGOInfo()->GetLinkedGameObjectEntry(), GUID_LOPART(owner_guid), ownerType);
}
}
}
@@ -146,7 +146,7 @@ void GameObject::RemoveFromWorld()
if (Unit * owner = GetOwner())
owner->RemoveGameObject(this,false);
else
sLog->outError("Delete GameObject (GUID: %u Entry: %u) that have references in not found creature %u GO list. Crash possible later.",GetGUIDLow(),GetGOInfo()->id,GUID_LOPART(owner_guid));
sLog->outError("Delete GameObject (GUID: %u Entry: %u) that have references in not found creature %u GO list. Crash possible later.",GetGUIDLow(),GetGOInfo()->entry,GUID_LOPART(owner_guid));
}
WorldObject::RemoveFromWorld();
sObjectAccessor->RemoveObject(this);
@@ -175,14 +175,14 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMa
return false;
}
GameObjectInfo const* goinfo = ObjectMgr::GetGameObjectInfo(name_id);
GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(name_id);
if (!goinfo)
{
sLog->outErrorDb("Gameobject (GUID: %u Entry: %u) not created: it have not exist entry in `gameobject_template`. Map: %u (X: %f Y: %f Z: %f) ang: %f rotation0: %f rotation1: %f rotation2: %f rotation3: %f",guidlow, name_id, map->GetId(), x, y, z, ang, rotation0, rotation1, rotation2, rotation3);
return false;
}
Object::_Create(guidlow, goinfo->id, HIGHGUID_GAMEOBJECT);
Object::_Create(guidlow, goinfo->entry, HIGHGUID_GAMEOBJECT);
m_goInfo = goinfo;
@@ -202,7 +202,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMa
SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);
SetEntry(goinfo->id);
SetEntry(goinfo->entry);
SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId);
@@ -276,7 +276,7 @@ void GameObject::Update(uint32 diff)
case GAMEOBJECT_TYPE_TRAP:
{
// Arming Time for GAMEOBJECT_TYPE_TRAP (6)
GameObjectInfo const* goInfo = GetGOInfo();
GameObjectTemplate const* goInfo = GetGOInfo();
// Bombs
if (goInfo->trap.type == 2)
m_cooldownTime = time(NULL) + 10; // Hardcoded tooltip value
@@ -386,7 +386,7 @@ void GameObject::Update(uint32 diff)
if (isSpawned())
{
// traps can have time and can not have
GameObjectInfo const* goInfo = GetGOInfo();
GameObjectTemplate const* goInfo = GetGOInfo();
if (goInfo->type == GAMEOBJECT_TYPE_TRAP)
{
if (m_cooldownTime >= time(NULL))
@@ -653,7 +653,7 @@ void GameObject::SaveToDB()
void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
{
const GameObjectInfo *goI = GetGOInfo();
const GameObjectTemplate *goI = GetGOInfo();
if (!goI)
return;
@@ -816,7 +816,7 @@ bool GameObject::hasInvolvedQuest(uint32 quest_id) const
bool GameObject::IsTransport() const
{
// If something is marked as a transport, don't transmit an out of range packet for it.
GameObjectInfo const * gInfo = GetGOInfo();
GameObjectTemplate const * gInfo = GetGOInfo();
if (!gInfo) return false;
return gInfo->type == GAMEOBJECT_TYPE_TRANSPORT || gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT;
}
@@ -825,7 +825,7 @@ bool GameObject::IsTransport() const
bool GameObject::IsDynTransport() const
{
// If something is marked as a transport, don't transmit an out of range packet for it.
GameObjectInfo const * gInfo = GetGOInfo();
GameObjectTemplate const * gInfo = GetGOInfo();
if (!gInfo) return false;
return gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT || (gInfo->type == GAMEOBJECT_TYPE_TRANSPORT && !gInfo->transport.pause);
}
@@ -919,7 +919,7 @@ bool GameObject::ActivateToQuest(Player *pTarget) const
void GameObject::TriggeringLinkedGameObject(uint32 trapEntry, Unit* target)
{
GameObjectInfo const* trapInfo = sGOStorage.LookupEntry<GameObjectInfo>(trapEntry);
GameObjectTemplate const* trapInfo = sObjectMgr->GetGameObjectTemplate(trapEntry);
if (!trapInfo || trapInfo->type != GAMEOBJECT_TYPE_TRAP)
return;
@@ -1084,7 +1084,7 @@ void GameObject::Use(Unit* user)
//Sitting: Wooden bench, chairs enzz
case GAMEOBJECT_TYPE_CHAIR: //7
{
GameObjectInfo const* info = GetGOInfo();
GameObjectTemplate const* info = GetGOInfo();
if (!info)
return;
@@ -1174,7 +1174,7 @@ void GameObject::Use(Unit* user)
//big gun, its a spell/aura
case GAMEOBJECT_TYPE_GOOBER: //10
{
GameObjectInfo const* info = GetGOInfo();
GameObjectTemplate const* info = GetGOInfo();
if (user->GetTypeId() == TYPEID_PLAYER)
{
@@ -1210,7 +1210,7 @@ void GameObject::Use(Unit* user)
if (Battleground* bg = player->GetBattleground())
bg->EventPlayerUsedGO(player, this);
player->CastedCreatureOrGO(info->id, GetGUID(), 0);
player->CastedCreatureOrGO(info->entry, GetGUID(), 0);
}
if (uint32 trapEntry = info->goober.linkedTrapId)
@@ -1237,7 +1237,7 @@ void GameObject::Use(Unit* user)
}
case GAMEOBJECT_TYPE_CAMERA: //13
{
GameObjectInfo const* info = GetGOInfo();
GameObjectTemplate const* info = GetGOInfo();
if (!info)
return;
@@ -1343,7 +1343,7 @@ void GameObject::Use(Unit* user)
Unit* owner = GetOwner();
GameObjectInfo const* info = GetGOInfo();
GameObjectTemplate const* info = GetGOInfo();
// ritual owner is set for GO's without owner (not summoned)
if (!m_ritualOwner && !owner)
@@ -1421,7 +1421,7 @@ void GameObject::Use(Unit* user)
}
case GAMEOBJECT_TYPE_SPELLCASTER: //22
{
GameObjectInfo const* info = GetGOInfo();
GameObjectTemplate const* info = GetGOInfo();
if (!info)
return;
@@ -1443,7 +1443,7 @@ void GameObject::Use(Unit* user)
}
case GAMEOBJECT_TYPE_MEETINGSTONE: //23
{
GameObjectInfo const* info = GetGOInfo();
GameObjectTemplate const* info = GetGOInfo();
if (user->GetTypeId() != TYPEID_PLAYER)
return;
@@ -1464,7 +1464,7 @@ void GameObject::Use(Unit* user)
if (level < info->meetingstone.minLevel)
return;
if (info->id == 194097)
if (info->entry == 194097)
spellId = 61994; // Ritual of Summoning
else
spellId = 59782; // Summoning Stone Effect
@@ -1508,7 +1508,7 @@ void GameObject::Use(Unit* user)
Player* player = user->ToPlayer();
player->SendLoot(GetGUID(), LOOT_FISHINGHOLE);
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT, GetGOInfo()->id);
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT, GetGOInfo()->entry);
return;
}
@@ -1533,10 +1533,10 @@ void GameObject::Use(Unit* user)
// 179786 - Warsong Flag
// EotS:
// 184142 - Netherstorm Flag
GameObjectInfo const* info = GetGOInfo();
GameObjectTemplate const* info = GetGOInfo();
if (info)
{
switch(info->id)
switch(info->entry)
{
case 179785: // Silverwing Flag
// check if it's correct bg
@@ -1561,7 +1561,7 @@ void GameObject::Use(Unit* user)
}
case GAMEOBJECT_TYPE_BARBER_CHAIR: //32
{
GameObjectInfo const* info = GetGOInfo();
GameObjectTemplate const* info = GetGOInfo();
if (!info)
return;
@@ -38,15 +38,15 @@ class GameObjectAI;
#define MAX_GAMEOBJECT_QUEST_ITEMS 6
// from `gameobject_template`
struct GameObjectInfo
struct GameObjectTemplate
{
uint32 id;
uint32 entry;
uint32 type;
uint32 displayId;
char *name;
char *IconName;
char *castBarCaption;
char *unk1;
const char* name;
const char* IconName;
const char* castBarCaption;
const char* unk1;
uint32 faction;
uint32 flags;
float size;
@@ -398,9 +398,11 @@ struct GameObjectInfo
// not use for specific field access (only for output with loop by all filed), also this determinate max union size
struct
{
uint32 data[24];
uint32 data[MAX_GAMEOBJECT_DATA];
} raw;
};
char const* AIName;
uint32 ScriptId;
@@ -528,6 +530,9 @@ struct GameObjectInfo
}
};
// Benchmarked: Faster than std::map (insert/find)
typedef UNORDERED_MAP<uint32, GameObjectTemplate> GameObjectTemplateContainer;
class OPvPCapturePoint;
union GameObjectValue
@@ -620,7 +625,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>
bool Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 artKit = 0);
void Update(uint32 p_time);
static GameObject* GetGameObject(WorldObject& object, uint64 guid);
GameObjectInfo const* GetGOInfo() const { return m_goInfo; }
GameObjectTemplate const* GetGOInfo() const { return m_goInfo; }
GameObjectData const* GetGOData() const { return m_goData; }
GameObjectValue * GetGOValue() const { return m_goValue; }
@@ -791,7 +796,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>
ChairSlotAndUser ChairListSlots;
uint32 m_DBTableGuid; ///< For new or temporary gameobjects is 0 for saved it is lowguid
GameObjectInfo const* m_goInfo;
GameObjectTemplate const* m_goInfo;
GameObjectData const* m_goData;
GameObjectValue * const m_goValue;
+1 -1
View File
@@ -2279,7 +2279,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float
if (!IsInWorld())
return NULL;
GameObjectInfo const* goinfo = ObjectMgr::GetGameObjectInfo(entry);
GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry);
if (!goinfo)
{
sLog->outErrorDb("Gameobject template %u not found in database!", entry);
@@ -54,7 +54,7 @@ void MapManager::LoadTransports()
Transport *t = new Transport(period, scriptId);
const GameObjectInfo *goinfo = ObjectMgr::GetGameObjectInfo(entry);
const GameObjectTemplate *goinfo = sObjectMgr->GetGameObjectTemplate(entry);
if (!goinfo)
{
@@ -207,7 +207,7 @@ bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, floa
Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT);
GameObjectInfo const* goinfo = ObjectMgr::GetGameObjectInfo(entry);
GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry);
if (!goinfo)
{
@@ -223,7 +223,7 @@ bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, floa
//SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);
SetUInt32Value(GAMEOBJECT_FLAGS, MAKE_PAIR32(0x28, 0x64));
SetUInt32Value(GAMEOBJECT_LEVEL, m_period);
SetEntry(goinfo->id);
SetEntry(goinfo->entry);
SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId);
+231 -183
View File
@@ -1648,7 +1648,7 @@ void ObjectMgr::RemoveCreatureFromGrid(uint32 guid, CreatureData const* data)
uint32 ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, float y, float z, float o, uint32 spawntimedelay, float rotation0, float rotation1, float rotation2, float rotation3)
{
GameObjectInfo const* goinfo = GetGameObjectInfo(entry);
GameObjectTemplate const* goinfo = GetGameObjectTemplate(entry);
if (!goinfo)
return 0;
@@ -1821,7 +1821,7 @@ void ObjectMgr::LoadGameobjects()
uint32 guid = fields[ 0].GetUInt32();
uint32 entry = fields[ 1].GetUInt32();
GameObjectInfo const* gInfo = GetGameObjectInfo(entry);
GameObjectTemplate const* gInfo = GetGameObjectTemplate(entry);
if (!gInfo)
{
sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u) with non existing gameobject entry %u, skipped.", guid, entry);
@@ -4726,7 +4726,7 @@ void ObjectMgr::LoadQuests()
for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
{
int32 id = qinfo->ReqCreatureOrGOId[j];
if (id < 0 && !sGOStorage.LookupEntry<GameObjectInfo>(-id))
if (id < 0 && !sObjectMgr->GetGameObjectTemplate(-id))
{
sLog->outErrorDb("Quest %u has `ReqCreatureOrGOId%d` = %i but gameobject %u does not exist, quest can't be done.",
qinfo->GetQuestId(),j+1,id,uint32(-id));
@@ -5229,7 +5229,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
continue;
}
GameObjectInfo const* info = GetGameObjectInfo(data->id);
GameObjectTemplate const* info = GetGameObjectTemplate(data->id);
if (!info)
{
sLog->outErrorDb("Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",
@@ -5244,7 +5244,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
info->type == GAMEOBJECT_TYPE_TRAP)
{
sLog->outErrorDb("Table `%s` have gameobject type (%u) unsupported by command SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",
tableName.c_str(), info->id, tmp.id);
tableName.c_str(), info->entry, tmp.id);
continue;
}
break;
@@ -5279,7 +5279,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
continue;
}
GameObjectInfo const* info = GetGameObjectInfo(data->id);
GameObjectTemplate const* info = GetGameObjectTemplate(data->id);
if (!info)
{
sLog->outErrorDb("Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in %s for script id %u",
@@ -5290,7 +5290,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
if (info->type != GAMEOBJECT_TYPE_DOOR)
{
sLog->outErrorDb("Table `%s` has gameobject type (%u) non supported by command %s for script id %u",
tableName.c_str(), info->id, GetScriptCommandName(tmp.command).c_str(), tmp.id);
tableName.c_str(), info->entry, GetScriptCommandName(tmp.command).c_str(), tmp.id);
continue;
}
@@ -5443,12 +5443,11 @@ void ObjectMgr::LoadEventScripts()
std::set<uint32> evt_scripts;
// Load all possible script entries from gameobjects
for (uint32 i = 1; i < sGOStorage.MaxEntry; ++i)
{
if (GameObjectInfo const * goInfo = sGOStorage.LookupEntry<GameObjectInfo>(i))
if (uint32 eventId = goInfo->GetEventScriptId())
evt_scripts.insert(eventId);
}
GameObjectTemplateContainer const* gotc = sObjectMgr->GetGameObjectTemplates();
for (GameObjectTemplateContainer::const_iterator itr = gotc->begin(); itr != gotc->end(); ++itr)
if (uint32 eventId = itr->second.GetEventScriptId())
evt_scripts.insert(eventId);
// Load all possible script entries from spells
for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i)
{
@@ -7050,213 +7049,256 @@ struct SQLGameObjectLoader : public SQLStorageLoaderBase<SQLGameObjectLoader>
}
};
inline void CheckGOLockId(GameObjectInfo const* goInfo,uint32 dataN,uint32 N)
inline void CheckGOLockId(GameObjectTemplate* goInfo,uint32 dataN,uint32 N)
{
if (sLockStore.LookupEntry(dataN))
return;
sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but lock (Id: %u) not found.",
goInfo->id,goInfo->type,N,goInfo->door.lockId,goInfo->door.lockId);
goInfo->entry,goInfo->type,N,goInfo->door.lockId,goInfo->door.lockId);
}
inline void CheckGOLinkedTrapId(GameObjectInfo const* goInfo,uint32 dataN,uint32 N)
inline void CheckGOLinkedTrapId(GameObjectTemplate const* goInfo,uint32 dataN,uint32 N)
{
if (GameObjectInfo const* trapInfo = sGOStorage.LookupEntry<GameObjectInfo>(dataN))
if (GameObjectTemplate const* trapInfo = sObjectMgr->GetGameObjectTemplate(dataN))
{
if (trapInfo->type != GAMEOBJECT_TYPE_TRAP)
sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but GO (Entry %u) have not GAMEOBJECT_TYPE_TRAP (%u) type.",
goInfo->id,goInfo->type,N,dataN,dataN,GAMEOBJECT_TYPE_TRAP);
goInfo->entry,goInfo->type,N,dataN,dataN,GAMEOBJECT_TYPE_TRAP);
}
}
inline void CheckGOSpellId(GameObjectInfo const* goInfo,uint32 dataN,uint32 N)
inline void CheckGOSpellId(GameObjectTemplate const* goInfo,uint32 dataN,uint32 N)
{
if (sSpellStore.LookupEntry(dataN))
return;
sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but Spell (Entry %u) not exist.",
goInfo->id,goInfo->type,N,dataN,dataN);
goInfo->entry,goInfo->type,N,dataN,dataN);
}
inline void CheckAndFixGOChairHeightId(GameObjectInfo const* goInfo,uint32 const& dataN,uint32 N)
inline void CheckAndFixGOChairHeightId(GameObjectTemplate const* goInfo,uint32 const& dataN,uint32 N)
{
if (dataN <= (UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR))
return;
sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but correct chair height in range 0..%i.",
goInfo->id,goInfo->type,N,dataN,UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR);
goInfo->entry,goInfo->type,N,dataN,UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR);
// prevent client and server unexpected work
const_cast<uint32&>(dataN) = 0;
}
inline void CheckGONoDamageImmuneId(GameObjectInfo const* goInfo,uint32 dataN,uint32 N)
inline void CheckGONoDamageImmuneId(GameObjectTemplate* goTemplate, uint32 dataN, uint32 N)
{
// 0/1 correct values
if (dataN <= 1)
return;
sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) noDamageImmune field value.",
goInfo->id,goInfo->type,N,dataN);
sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) noDamageImmune field value.", goTemplate->entry, goTemplate->type, N, dataN);
}
inline void CheckGOConsumable(GameObjectInfo const* goInfo,uint32 dataN,uint32 N)
inline void CheckGOConsumable(GameObjectTemplate const* goInfo,uint32 dataN,uint32 N)
{
// 0/1 correct values
if (dataN <= 1)
return;
sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) consumable field value.",
goInfo->id,goInfo->type,N,dataN);
goInfo->entry,goInfo->type,N,dataN);
}
void ObjectMgr::LoadGameobjectInfo()
void ObjectMgr::LoadGameObjectTemplate()
{
uint32 oldMSTime = getMSTime();
SQLGameObjectLoader loader;
loader.Load(sGOStorage);
// 0 1 2 3 4 5 6 7 8 9 10 11 12
QueryResult result = WorldDatabase.Query("SELECT entry, type, displayId, name, IconName, castBarCaption, unk1, faction, flags, size, questItem1, questItem2, questItem3, "
// 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
"questItem4, questItem5, questItem6, data0, data1, data2, data3, data4, data5, data6, data7, data8, data9, data10, data11, data12, "
// 29 30 31 32 33 34 35 36 37 38 39 40 41
"data13, data14, data15, data16, data17, data18, data19, data20, data21, data22, data23, AIName, ScriptName "
"FROM gameobject_template");
// some checks
for (uint32 id = 1; id < sGOStorage.MaxEntry; id++)
if (!result)
{
GameObjectInfo const* goInfo = sGOStorage.LookupEntry<GameObjectInfo>(id);
if (!goInfo)
continue;
// some GO types have unused go template, check goInfo->displayId at GO spawn data loading or ignore
switch(goInfo->type)
{
case GAMEOBJECT_TYPE_DOOR: //0
{
if (goInfo->door.lockId)
CheckGOLockId(goInfo,goInfo->door.lockId,1);
CheckGONoDamageImmuneId(goInfo,goInfo->door.noDamageImmune,3);
break;
}
case GAMEOBJECT_TYPE_BUTTON: //1
{
if (goInfo->button.lockId)
CheckGOLockId(goInfo,goInfo->button.lockId,1);
CheckGONoDamageImmuneId(goInfo,goInfo->button.noDamageImmune,4);
break;
}
case GAMEOBJECT_TYPE_QUESTGIVER: //2
{
if (goInfo->questgiver.lockId)
CheckGOLockId(goInfo,goInfo->questgiver.lockId,0);
CheckGONoDamageImmuneId(goInfo,goInfo->questgiver.noDamageImmune,5);
break;
}
case GAMEOBJECT_TYPE_CHEST: //3
{
if (goInfo->chest.lockId)
CheckGOLockId(goInfo,goInfo->chest.lockId,0);
CheckGOConsumable(goInfo,goInfo->chest.consumable,3);
if (goInfo->chest.linkedTrapId) // linked trap
CheckGOLinkedTrapId(goInfo,goInfo->chest.linkedTrapId,7);
break;
}
case GAMEOBJECT_TYPE_TRAP: //6
{
if (goInfo->trap.lockId)
CheckGOLockId(goInfo,goInfo->trap.lockId,0);
break;
}
case GAMEOBJECT_TYPE_CHAIR: //7
CheckAndFixGOChairHeightId(goInfo,goInfo->chair.height,1);
break;
case GAMEOBJECT_TYPE_SPELL_FOCUS: //8
{
if (goInfo->spellFocus.focusId)
{
if (!sSpellFocusObjectStore.LookupEntry(goInfo->spellFocus.focusId))
sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data0=%u but SpellFocus (Id: %u) not exist.",
id,goInfo->type,goInfo->spellFocus.focusId,goInfo->spellFocus.focusId);
}
if (goInfo->spellFocus.linkedTrapId) // linked trap
CheckGOLinkedTrapId(goInfo,goInfo->spellFocus.linkedTrapId,2);
break;
}
case GAMEOBJECT_TYPE_GOOBER: //10
{
if (goInfo->goober.lockId)
CheckGOLockId(goInfo,goInfo->goober.lockId,0);
CheckGOConsumable(goInfo,goInfo->goober.consumable,3);
if (goInfo->goober.pageId) // pageId
{
if (!GetPageText(goInfo->goober.pageId))
sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data7=%u but PageText (Entry %u) not exist.",
id,goInfo->type,goInfo->goober.pageId,goInfo->goober.pageId);
}
CheckGONoDamageImmuneId(goInfo,goInfo->goober.noDamageImmune,11);
if (goInfo->goober.linkedTrapId) // linked trap
CheckGOLinkedTrapId(goInfo,goInfo->goober.linkedTrapId,12);
break;
}
case GAMEOBJECT_TYPE_AREADAMAGE: //12
{
if (goInfo->areadamage.lockId)
CheckGOLockId(goInfo,goInfo->areadamage.lockId,0);
break;
}
case GAMEOBJECT_TYPE_CAMERA: //13
{
if (goInfo->camera.lockId)
CheckGOLockId(goInfo,goInfo->camera.lockId,0);
break;
}
case GAMEOBJECT_TYPE_MO_TRANSPORT: //15
{
if (goInfo->moTransport.taxiPathId)
{
if (goInfo->moTransport.taxiPathId >= sTaxiPathNodesByPath.size() || sTaxiPathNodesByPath[goInfo->moTransport.taxiPathId].empty())
sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data0=%u but TaxiPath (Id: %u) not exist.",
id,goInfo->type,goInfo->moTransport.taxiPathId,goInfo->moTransport.taxiPathId);
}
break;
}
case GAMEOBJECT_TYPE_SUMMONING_RITUAL: //18
break;
case GAMEOBJECT_TYPE_SPELLCASTER: //22
{
// always must have spell
CheckGOSpellId(goInfo,goInfo->spellcaster.spellId,0);
break;
}
case GAMEOBJECT_TYPE_FLAGSTAND: //24
{
if (goInfo->flagstand.lockId)
CheckGOLockId(goInfo,goInfo->flagstand.lockId,0);
CheckGONoDamageImmuneId(goInfo,goInfo->flagstand.noDamageImmune,5);
break;
}
case GAMEOBJECT_TYPE_FISHINGHOLE: //25
{
if (goInfo->fishinghole.lockId)
CheckGOLockId(goInfo,goInfo->fishinghole.lockId,4);
break;
}
case GAMEOBJECT_TYPE_FLAGDROP: //26
{
if (goInfo->flagdrop.lockId)
CheckGOLockId(goInfo,goInfo->flagdrop.lockId,0);
CheckGONoDamageImmuneId(goInfo,goInfo->flagdrop.noDamageImmune,3);
break;
}
case GAMEOBJECT_TYPE_BARBER_CHAIR: //32
CheckAndFixGOChairHeightId(goInfo,goInfo->barberChair.chairheight,0);
break;
}
sLog->outString(">> Loaded 0 gameobject definitions. DB table `gameobject_template` is empty.");
sLog->outString();
return;
}
sLog->outString(">> Loaded %u game object templates in %u ms", sGOStorage.RecordCount, GetMSTimeDiffToNow(oldMSTime));
uint32 count = 0;
do
{
Field *fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
GameObjectTemplate got;
got.entry = entry;
got.type = uint32(fields[1].GetUInt8());
got.displayId = fields[2].GetUInt32();
got.name = fields[3].GetCString();
got.IconName = fields[4].GetCString();
got.castBarCaption = fields[5].GetCString();
got.unk1 = fields[6].GetCString();
got.faction = uint32(fields[7].GetUInt16());
got.flags = fields[8].GetUInt32();
got.size = fields[9].GetFloat();
for (uint8 i = 0; i < MAX_GAMEOBJECT_QUEST_ITEMS; ++i)
{
got.questItems[i] = fields[10 + i].GetUInt32();
}
for (uint8 i = 0; i < MAX_GAMEOBJECT_DATA; ++i)
{
got.raw.data[i] = fields[16 + i].GetUInt32();
}
got.AIName = fields[40].GetCString();
got.ScriptId = GetScriptId(fields[41].GetCString());
// Checks
switch(got.type)
{
case GAMEOBJECT_TYPE_DOOR: //0
{
if (got.door.lockId)
CheckGOLockId(&got, got.door.lockId, 1);
CheckGONoDamageImmuneId(&got, got.door.noDamageImmune, 3);
break;
}
case GAMEOBJECT_TYPE_BUTTON: //1
{
if (got.button.lockId)
CheckGOLockId(&got, got.button.lockId, 1);
CheckGONoDamageImmuneId(&got, got.button.noDamageImmune, 4);
break;
}
case GAMEOBJECT_TYPE_QUESTGIVER: //2
{
if (got.questgiver.lockId)
CheckGOLockId(&got, got.questgiver.lockId, 0);
CheckGONoDamageImmuneId(&got, got.questgiver.noDamageImmune, 5);
break;
}
case GAMEOBJECT_TYPE_CHEST: //3
{
if (got.chest.lockId)
CheckGOLockId(&got, got.chest.lockId, 0);
CheckGOConsumable(&got, got.chest.consumable, 3);
if (&got.chest.linkedTrapId) // linked trap
CheckGOLinkedTrapId(&got, got.chest.linkedTrapId, 7);
break;
}
case GAMEOBJECT_TYPE_TRAP: //6
{
if (got.trap.lockId)
CheckGOLockId(&got, got.trap.lockId, 0);
break;
}
case GAMEOBJECT_TYPE_CHAIR: //7
CheckAndFixGOChairHeightId(&got, got.chair.height, 1);
break;
case GAMEOBJECT_TYPE_SPELL_FOCUS: //8
{
if (got.spellFocus.focusId)
{
if (!sSpellFocusObjectStore.LookupEntry(got.spellFocus.focusId))
sLog->outErrorDb("GameObject (Entry: %u GoType: %u) have data0=%u but SpellFocus (Id: %u) not exist.",
entry, got.type, got.spellFocus.focusId, got.spellFocus.focusId);
}
if (got.spellFocus.linkedTrapId) // linked trap
CheckGOLinkedTrapId(&got, got.spellFocus.linkedTrapId, 2);
break;
}
case GAMEOBJECT_TYPE_GOOBER: //10
{
if (got.goober.lockId)
CheckGOLockId(&got, got.goober.lockId, 0);
CheckGOConsumable(&got, got.goober.consumable, 3);
if (got.goober.pageId) // pageId
{
if (!GetPageText(got.goober.pageId))
sLog->outErrorDb("GameObject (Entry: %u GoType: %u) have data7=%u but PageText (Entry %u) not exist.",
entry, got.type, got.goober.pageId, got.goober.pageId);
}
CheckGONoDamageImmuneId(&got, got.goober.noDamageImmune, 11);
if (got.goober.linkedTrapId) // linked trap
CheckGOLinkedTrapId(&got, got.goober.linkedTrapId, 12);
break;
}
case GAMEOBJECT_TYPE_AREADAMAGE: //12
{
if (got.areadamage.lockId)
CheckGOLockId(&got, got.areadamage.lockId, 0);
break;
}
case GAMEOBJECT_TYPE_CAMERA: //13
{
if (got.camera.lockId)
CheckGOLockId(&got, got.camera.lockId, 0);
break;
}
case GAMEOBJECT_TYPE_MO_TRANSPORT: //15
{
if (got.moTransport.taxiPathId)
{
if (got.moTransport.taxiPathId >= sTaxiPathNodesByPath.size() || sTaxiPathNodesByPath[got.moTransport.taxiPathId].empty())
sLog->outErrorDb("GameObject (Entry: %u GoType: %u) have data0=%u but TaxiPath (Id: %u) not exist.",
entry, got.type, got.moTransport.taxiPathId, got.moTransport.taxiPathId);
}
break;
}
case GAMEOBJECT_TYPE_SUMMONING_RITUAL: //18
break;
case GAMEOBJECT_TYPE_SPELLCASTER: //22
{
// always must have spell
CheckGOSpellId(&got, got.spellcaster.spellId, 0);
break;
}
case GAMEOBJECT_TYPE_FLAGSTAND: //24
{
if (got.flagstand.lockId)
CheckGOLockId(&got, got.flagstand.lockId, 0);
CheckGONoDamageImmuneId(&got, got.flagstand.noDamageImmune, 5);
break;
}
case GAMEOBJECT_TYPE_FISHINGHOLE: //25
{
if (got.fishinghole.lockId)
CheckGOLockId(&got, got.fishinghole.lockId, 4);
break;
}
case GAMEOBJECT_TYPE_FLAGDROP: //26
{
if (got.flagdrop.lockId)
CheckGOLockId(&got, got.flagdrop.lockId, 0);
CheckGONoDamageImmuneId(&got, got.flagdrop.noDamageImmune, 3);
break;
}
case GAMEOBJECT_TYPE_BARBER_CHAIR: //32
CheckAndFixGOChairHeightId(&got, got.barberChair.chairheight, 0);
break;
}
// Add to gameobject to map
GameObjectTemplateStore[entry] = got;
++count;
}
while (result->NextRow());
sLog->outString(">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
@@ -8099,7 +8141,7 @@ void ObjectMgr::LoadGameobjectQuestRelations()
for (QuestRelations::iterator itr = mGOQuestRelations.begin(); itr != mGOQuestRelations.end(); ++itr)
{
GameObjectInfo const* goInfo = GetGameObjectInfo(itr->first);
GameObjectTemplate const* goInfo = GetGameObjectTemplate(itr->first);
if (!goInfo)
sLog->outErrorDb("Table `gameobject_questrelation` have data for not existed gameobject entry (%u) and existed quest %u",itr->first,itr->second);
else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
@@ -8113,7 +8155,7 @@ void ObjectMgr::LoadGameobjectInvolvedRelations()
for (QuestRelations::iterator itr = mGOQuestInvolvedRelations.begin(); itr != mGOQuestInvolvedRelations.end(); ++itr)
{
GameObjectInfo const* goInfo = GetGameObjectInfo(itr->first);
GameObjectTemplate const* goInfo = GetGameObjectTemplate(itr->first);
if (!goInfo)
sLog->outErrorDb("Table `gameobject_involvedrelation` have data for not existed gameobject entry (%u) and existed quest %u",itr->first,itr->second);
else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
@@ -8338,7 +8380,7 @@ void ObjectMgr::LoadGameObjectForQuests()
mGameObjectForQuestSet.clear(); // need for reload case
if (!sGOStorage.MaxEntry)
if (!sObjectMgr->GetGameObjectTemplates()->empty())
{
sLog->outString(">> Loaded 0 GameObjects for quests");
sLog->outString();
@@ -8348,41 +8390,38 @@ void ObjectMgr::LoadGameObjectForQuests()
uint32 count = 0;
// collect GO entries for GO that must activated
for (uint32 go_entry = 1; go_entry < sGOStorage.MaxEntry; ++go_entry)
GameObjectTemplateContainer const* gotc = sObjectMgr->GetGameObjectTemplates();
for (GameObjectTemplateContainer::const_iterator itr = gotc->begin(); itr != gotc->end(); ++itr)
{
GameObjectInfo const* goInfo = sGOStorage.LookupEntry<GameObjectInfo>(go_entry);
if (!goInfo)
continue;
switch(goInfo->type)
switch(itr->second.type)
{
// scan GO chest with loot including quest items
case GAMEOBJECT_TYPE_CHEST:
{
uint32 loot_id = goInfo->GetLootId();
uint32 loot_id = (itr->second.GetLootId());
// find quest loot for GO
if (goInfo->chest.questId || LootTemplates_Gameobject.HaveQuestLootFor(loot_id))
if (itr->second.chest.questId || LootTemplates_Gameobject.HaveQuestLootFor(loot_id))
{
mGameObjectForQuestSet.insert(go_entry);
mGameObjectForQuestSet.insert(itr->second.entry);
++count;
}
break;
}
case GAMEOBJECT_TYPE_GENERIC:
{
if (goInfo->_generic.questID > 0) //quests objects
if (itr->second._generic.questID > 0) //quests objects
{
mGameObjectForQuestSet.insert(go_entry);
mGameObjectForQuestSet.insert(itr->second.entry);
count++;
}
break;
}
case GAMEOBJECT_TYPE_GOOBER:
{
if (goInfo->goober.questId > 0) //quests objects
if (itr->second.goober.questId > 0) //quests objects
{
mGameObjectForQuestSet.insert(go_entry);
mGameObjectForQuestSet.insert(itr->second.entry);
count++;
}
break;
@@ -9648,3 +9687,12 @@ void ObjectMgr::FreeGroupStorageId(Group* group)
mGroupStorage[storageId] = NULL;
}
GameObjectTemplate const* ObjectMgr::GetGameObjectTemplate(uint32 entry)
{
GameObjectTemplateContainer::const_iterator itr = GameObjectTemplateStore.find(entry);
if (itr != GameObjectTemplateStore.end())
return &(itr->second);
return NULL;
}
+5 -4
View File
@@ -45,7 +45,6 @@
#include <functional>
extern SQLStorage sCreatureStorage;
extern SQLStorage sGOStorage;
class Group;
class Guild;
@@ -640,11 +639,12 @@ class ObjectMgr
Player* GetPlayer(uint64 guid) const { return ObjectAccessor::FindPlayer(guid); }
Player* GetPlayerByLowGUID(uint32 lowguid) const;
static GameObjectInfo const *GetGameObjectInfo(uint32 id) { return sGOStorage.LookupEntry<GameObjectInfo>(id); }
GameObjectTemplate const* GetGameObjectTemplate(uint32 entry);
GameObjectTemplateContainer const* GetGameObjectTemplates() { return &GameObjectTemplateStore; }
int LoadReferenceVendor(int32 vendor, int32 item_id, std::set<uint32> *skip_vendors);
void LoadGameobjectInfo();
void AddGameobjectInfo(GameObjectInfo *goinfo);
void LoadGameObjectTemplate();
void AddGameobjectInfo(GameObjectTemplate *goinfo);
Group * GetGroupByGUID(uint32 guid) const;
void AddGroup(Group* group) { mGroupSet.insert(group); }
@@ -1405,6 +1405,7 @@ class ObjectMgr
CreatureLocaleMap mCreatureLocaleMap;
GameObjectDataMap mGameObjectDataMap;
GameObjectLocaleMap mGameObjectLocaleMap;
GameObjectTemplateContainer GameObjectTemplateStore;
ItemTemplateContainer ItemTemplateStore;
ItemLocaleMap mItemLocaleMap;
@@ -1214,7 +1214,7 @@ namespace Trinity
x(_x), y(_y), z(_z), range(_range), entry(_entry) {}
bool operator() (GameObject* go)
{
if (!entry || (go->GetGOInfo() && go->GetGOInfo()->id == entry))
if (!entry || (go->GetGOInfo() && go->GetGOInfo()->entry == entry))
return go->IsInRange(x, y, z, range);
else return false;
}
+8 -9
View File
@@ -1522,19 +1522,18 @@ void LoadLootTemplates_Gameobject()
uint32 count = LootTemplates_Gameobject.LoadAndCollectLootIds(ids_set);
// remove real entries and check existence loot
for (uint32 i = 1; i < sGOStorage.MaxEntry; ++i)
GameObjectTemplateContainer const* gotc = sObjectMgr->GetGameObjectTemplates();
for (GameObjectTemplateContainer::const_iterator itr = gotc->begin(); itr != gotc->end(); ++itr)
{
if (GameObjectInfo const* gInfo = sGOStorage.LookupEntry<GameObjectInfo>(i))
if (uint32 lootid = itr->second.GetLootId())
{
if (uint32 lootid = gInfo->GetLootId())
{
if (sObjectMgr->IsGoOfSpecificEntrySpawned(gInfo->id) && ids_set.find(lootid) == ids_set.end())
LootTemplates_Gameobject.ReportNotExistedId(lootid);
else
ids_setUsed.insert(lootid);
}
if (sObjectMgr->IsGoOfSpecificEntrySpawned(itr->second.entry) && ids_set.find(lootid) == ids_set.end())
LootTemplates_Gameobject.ReportNotExistedId(lootid);
else
ids_setUsed.insert(lootid);
}
}
for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
ids_set.erase(*itr);
@@ -1439,6 +1439,7 @@ enum GameobjectTypes
};
#define MAX_GAMEOBJECT_TYPE 36 // sending to client this or greater value can crash client.
#define MAX_GAMEOBJECT_DATA 24 // Max number of uint32 vars in gameobject_template data field
enum GameObjectFlags
{
+1 -1
View File
@@ -120,7 +120,7 @@ bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, float x, fl
sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Creating capture point %u", entry);
// check info existence
GameObjectInfo const* goinfo = ObjectMgr::GetGameObjectInfo(entry);
GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry);
if (!goinfo || goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT)
{
sLog->outError("OutdoorPvP: GO %u is not capture point!", entry);
+1 -1
View File
@@ -683,7 +683,7 @@ void PoolMgr::LoadFromDB()
continue;
}
GameObjectInfo const* goinfo = ObjectMgr::GetGameObjectInfo(data->id);
GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(data->id);
if (goinfo->type != GAMEOBJECT_TYPE_CHEST &&
goinfo->type != GAMEOBJECT_TYPE_GOOBER &&
goinfo->type != GAMEOBJECT_TYPE_FISHINGHOLE)
@@ -213,12 +213,12 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket & recv_data)
/// Only _static_ data send in this packet !!!
void WorldSession::HandleGameObjectQueryOpcode(WorldPacket & recv_data)
{
uint32 entryID;
recv_data >> entryID;
uint32 entry;
recv_data >> entry;
uint64 guid;
recv_data >> guid;
const GameObjectInfo *info = ObjectMgr::GetGameObjectInfo(entryID);
const GameObjectTemplate *info = sObjectMgr->GetGameObjectTemplate(entry);
if (info)
{
std::string Name;
@@ -232,15 +232,15 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket & recv_data)
int loc_idx = GetSessionDbLocaleIndex();
if (loc_idx >= 0)
{
if (GameObjectLocale const *gl = sObjectMgr->GetGameObjectLocale(entryID))
if (GameObjectLocale const *gl = sObjectMgr->GetGameObjectLocale(entry))
{
sObjectMgr->GetLocaleString(gl->Name, loc_idx, Name);
sObjectMgr->GetLocaleString(gl->CastBarCaption, loc_idx, CastBarCaption);
}
}
sLog->outDetail("WORLD: CMSG_GAMEOBJECT_QUERY '%s' - Entry: %u. ", info->name, entryID);
sLog->outDetail("WORLD: CMSG_GAMEOBJECT_QUERY '%s' - Entry: %u. ", info->name, entry);
WorldPacket data (SMSG_GAMEOBJECT_QUERY_RESPONSE, 150);
data << uint32(entryID);
data << uint32(entry);
data << uint32(info->type);
data << uint32(info->displayId);
data << Name;
@@ -258,9 +258,9 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket & recv_data)
else
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_GAMEOBJECT_QUERY - Missing gameobject info for (GUID: %u, ENTRY: %u)",
GUID_LOPART(guid), entryID);
GUID_LOPART(guid), entry);
WorldPacket data (SMSG_GAMEOBJECT_QUERY_RESPONSE, 4);
data << uint32(entryID | 0x80000000);
data << uint32(entry | 0x80000000);
SendPacket(&data);
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_GAMEOBJECT_QUERY_RESPONSE");
}
+2 -2
View File
@@ -2773,7 +2773,7 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex)
// Get lockId
if (gameObjTarget)
{
GameObjectInfo const* goInfo = gameObjTarget->GetGOInfo();
GameObjectTemplate const* goInfo = gameObjTarget->GetGOInfo();
// Arathi Basin banner opening !
if ((goInfo->type == GAMEOBJECT_TYPE_BUTTON && goInfo->button.noDamageImmune) ||
(goInfo->type == GAMEOBJECT_TYPE_GOOBER && goInfo->goober.losOK))
@@ -6340,7 +6340,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
{
uint32 name_id = m_spellInfo->EffectMiscValue[effIndex];
GameObjectInfo const* goinfo = ObjectMgr::GetGameObjectInfo(name_id);
GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(name_id);
if (!goinfo)
{
+1 -1
View File
@@ -1284,7 +1284,7 @@ void World::SetInitialWorldSettings()
sObjectMgr->LoadPageTexts();
sLog->outString("Loading Game Object Templates..."); // must be after LoadPageTexts
sObjectMgr->LoadGameobjectInfo();
sObjectMgr->LoadGameObjectTemplate();
sLog->outString("Loading Spell Rank Data...");
sSpellMgr->LoadSpellRanks();