mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 21:26:23 +00:00
feat(gameobject): allow gameobjects to loot money + align table with TC (#1368)
This commit is contained in:
@@ -6437,11 +6437,11 @@ void ObjectMgr::LoadGameObjectTemplate()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
// 0 1 2 3 4 5 6 7 8 9
|
||||
QueryResult result = WorldDatabase.Query("SELECT entry, type, displayId, name, IconName, castBarCaption, unk1, faction, flags, size, "
|
||||
// 10 11 12 13 14 15 16 17 18 19 20 21 22
|
||||
// 0 1 2 3 4 5 6 7
|
||||
QueryResult result = WorldDatabase.Query("SELECT entry, type, displayId, name, IconName, castBarCaption, unk1, size, "
|
||||
// 8 9 10 11 12 13 14 15 16 17 18 19 20
|
||||
"Data0, Data1, Data2, Data3, Data4, Data5, Data6, Data7, Data8, Data9, Data10, Data11, Data12, "
|
||||
// 23 24 25 26 27 28 29 30 31 32 33 34 35
|
||||
// 21 22 23 24 25 26 27 28 29 30 31 32 33
|
||||
"Data13, Data14, Data15, Data16, Data17, Data18, Data19, Data20, Data21, Data22, Data23, AIName, ScriptName "
|
||||
"FROM gameobject_template");
|
||||
|
||||
@@ -6469,15 +6469,13 @@ void ObjectMgr::LoadGameObjectTemplate()
|
||||
got.IconName = fields[4].GetString();
|
||||
got.castBarCaption = fields[5].GetString();
|
||||
got.unk1 = fields[6].GetString();
|
||||
got.faction = uint32(fields[7].GetUInt16());
|
||||
got.flags = fields[8].GetUInt32();
|
||||
got.size = fields[9].GetFloat();
|
||||
got.size = fields[7].GetFloat();
|
||||
|
||||
for (uint8 i = 0; i < MAX_GAMEOBJECT_DATA; ++i)
|
||||
got.raw.data[i] = fields[10 + i].GetInt32(); // data1 and data6 can be -1
|
||||
got.raw.data[i] = fields[8 + i].GetInt32(); // data1 and data6 can be -1
|
||||
|
||||
got.AIName = fields[34].GetString();
|
||||
got.ScriptId = GetScriptId(fields[35].GetCString());
|
||||
got.AIName = fields[32].GetString();
|
||||
got.ScriptId = GetScriptId(fields[33].GetCString());
|
||||
got.IsForQuests = false;
|
||||
|
||||
// Checks
|
||||
@@ -6621,6 +6619,71 @@ void ObjectMgr::LoadGameObjectTemplate()
|
||||
sLog->outString();
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadGameObjectTemplateAddons()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
// 0 1 2 3 4
|
||||
QueryResult result = WorldDatabase.Query("SELECT entry, faction, flags, mingold, maxgold FROM gameobject_template_addon");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
sLog->outString(">> Loaded 0 gameobject template addon definitions. DB table `gameobject_template_addon` is empty.");
|
||||
sLog->outString();
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 count = 0;
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 entry = fields[0].GetUInt32();
|
||||
|
||||
GameObjectTemplate const* got = sObjectMgr->GetGameObjectTemplate(entry);
|
||||
if (!got)
|
||||
{
|
||||
sLog->outErrorDb(
|
||||
"GameObject template (Entry: %u) does not exist but has a record in `gameobject_template_addon`",
|
||||
entry);
|
||||
continue;
|
||||
}
|
||||
|
||||
GameObjectTemplateAddon& gameObjectAddon = _gameObjectTemplateAddonStore[entry];
|
||||
gameObjectAddon.faction = uint32(fields[1].GetUInt16());
|
||||
gameObjectAddon.flags = fields[2].GetUInt32();
|
||||
gameObjectAddon.mingold = fields[3].GetUInt32();
|
||||
gameObjectAddon.maxgold = fields[4].GetUInt32();
|
||||
|
||||
// checks
|
||||
if (gameObjectAddon.faction && !sFactionTemplateStore.LookupEntry(gameObjectAddon.faction))
|
||||
sLog->outErrorDb(
|
||||
"GameObject (Entry: %u) has invalid faction (%u) defined in `gameobject_template_addon`.",
|
||||
entry, gameObjectAddon.faction);
|
||||
|
||||
if (gameObjectAddon.maxgold > 0)
|
||||
{
|
||||
switch (got->type)
|
||||
{
|
||||
case GAMEOBJECT_TYPE_CHEST:
|
||||
case GAMEOBJECT_TYPE_FISHINGHOLE:
|
||||
break;
|
||||
default:
|
||||
sLog->outErrorDb(
|
||||
"GameObject (Entry %u GoType: %u) cannot be looted but has maxgold set in `gameobject_template_addon`.",
|
||||
entry, got->type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
++count;
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
sLog->outString(">> Loaded %u game object template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
sLog->outString();
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadExplorationBaseXP()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
@@ -9013,6 +9076,15 @@ bool ObjectMgr::IsGameObjectStaticTransport(uint32 entry)
|
||||
return goinfo && goinfo->type == GAMEOBJECT_TYPE_TRANSPORT;
|
||||
}
|
||||
|
||||
GameObjectTemplateAddon const* ObjectMgr::GetGameObjectTemplateAddon(uint32 entry) const
|
||||
{
|
||||
auto itr = _gameObjectTemplateAddonStore.find(entry);
|
||||
if (itr != _gameObjectTemplateAddonStore.end())
|
||||
return &itr->second;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CreatureTemplate const* ObjectMgr::GetCreatureTemplate(uint32 entry)
|
||||
{
|
||||
return entry < _creatureTemplateStoreFast.size() ? _creatureTemplateStoreFast[entry] : NULL;
|
||||
|
||||
Reference in New Issue
Block a user