diff options
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 74 |
1 files changed, 60 insertions, 14 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 46d9cf9d9bd..eddedb75126 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -711,8 +711,8 @@ void ObjectMgr::LoadCreatureTemplateAddons() { uint32 oldMSTime = getMSTime(); - // 0 1 2 3 4 5 6 7 - QueryResult result = WorldDatabase.Query("SELECT entry, path_id, mount, bytes1, bytes2, emote, visibilityDistanceType, auras FROM creature_template_addon"); + // 0 1 2 3 4 5 6 7 8 9 10 + QueryResult result = WorldDatabase.Query("SELECT entry, path_id, mount, StandState, AnimTier, VisFlags, SheathState, PvPFlags, emote, visibilityDistanceType, auras FROM creature_template_addon"); if (!result) { @@ -737,12 +737,15 @@ void ObjectMgr::LoadCreatureTemplateAddons() creatureAddon.path_id = fields[1].GetUInt32(); creatureAddon.mount = fields[2].GetUInt32(); - creatureAddon.bytes1 = fields[3].GetUInt32(); - creatureAddon.bytes2 = fields[4].GetUInt32(); - creatureAddon.emote = fields[5].GetUInt32(); - creatureAddon.visibilityDistanceType = VisibilityDistanceType(fields[6].GetUInt8()); + creatureAddon.standState = fields[3].GetUInt8(); + creatureAddon.animTier = fields[4].GetUInt8(); + creatureAddon.visFlags = fields[5].GetUInt8(); + creatureAddon.sheathState = fields[6].GetUInt8(); + creatureAddon.pvpFlags = fields[7].GetUInt8(); + creatureAddon.emote = fields[8].GetUInt32(); + creatureAddon.visibilityDistanceType = VisibilityDistanceType(fields[9].GetUInt8()); - for (std::string_view aura : Trinity::Tokenize(fields[7].GetStringView(), ' ', false)) + for (std::string_view aura : Trinity::Tokenize(fields[10].GetStringView(), ' ', false)) { SpellInfo const* spellInfo = nullptr; @@ -782,6 +785,26 @@ void ObjectMgr::LoadCreatureTemplateAddons() } } + if (creatureAddon.standState >= MAX_UNIT_STAND_STATE) + { + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid unit stand state (%u) defined in `creature_addon`. Truncated to 0.", entry, creatureAddon.standState); + creatureAddon.standState = 0; + } + + if (AnimTier(creatureAddon.animTier) >= AnimTier::Max) + { + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid animation tier (%u) defined in `creature_addon`. Truncated to 0.", entry, creatureAddon.animTier); + creatureAddon.animTier = 0; + } + + if (creatureAddon.sheathState >= MAX_SHEATH_STATE) + { + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid sheath state (%u) defined in `creature_addon`. Truncated to 0.", entry, creatureAddon.sheathState); + creatureAddon.sheathState = 0; + } + + // PvPFlags don't need any checking for the time being since they cover the entire range of a byte + if (!sEmotesStore.LookupEntry(creatureAddon.emote)) { TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid emote (%u) defined in `creature_template_addon`.", entry, creatureAddon.emote); @@ -1259,8 +1282,8 @@ void ObjectMgr::LoadCreatureAddons() { uint32 oldMSTime = getMSTime(); - // 0 1 2 3 4 5 6 7 - QueryResult result = WorldDatabase.Query("SELECT guid, path_id, mount, bytes1, bytes2, emote, visibilityDistanceType, auras FROM creature_addon"); + // 0 1 2 3 4 5 6 7 8 9 10 + QueryResult result = WorldDatabase.Query("SELECT guid, path_id, mount, StandState, AnimTier, VisFlags, SheathState, PvPFlags, emote, visibilityDistanceType, auras FROM creature_addon"); if (!result) { @@ -1292,12 +1315,15 @@ void ObjectMgr::LoadCreatureAddons() } creatureAddon.mount = fields[2].GetUInt32(); - creatureAddon.bytes1 = fields[3].GetUInt32(); - creatureAddon.bytes2 = fields[4].GetUInt32(); - creatureAddon.emote = fields[5].GetUInt32(); - creatureAddon.visibilityDistanceType = VisibilityDistanceType(fields[6].GetUInt8()); + creatureAddon.standState = fields[3].GetUInt8(); + creatureAddon.animTier = fields[4].GetUInt8(); + creatureAddon.visFlags = fields[5].GetUInt8(); + creatureAddon.sheathState = fields[6].GetUInt8(); + creatureAddon.pvpFlags = fields[7].GetUInt8(); + creatureAddon.emote = fields[8].GetUInt32(); + creatureAddon.visibilityDistanceType = VisibilityDistanceType(fields[9].GetUInt8()); - for (std::string_view aura : Trinity::Tokenize(fields[7].GetStringView(), ' ', false)) + for (std::string_view aura : Trinity::Tokenize(fields[10].GetStringView(), ' ', false)) { SpellInfo const* spellInfo = nullptr; if (Optional<uint32> spellId = Trinity::StringTo<uint32>(aura)) @@ -1336,6 +1362,26 @@ void ObjectMgr::LoadCreatureAddons() } } + if (creatureAddon.standState >= MAX_UNIT_STAND_STATE) + { + TC_LOG_ERROR("sql.sql", "Creature (GUID: %u) has invalid unit stand state (%u) defined in `creature_addon`. Truncated to 0.", guid, creatureAddon.standState); + creatureAddon.standState = 0; + } + + if (AnimTier(creatureAddon.animTier) >= AnimTier::Max) + { + TC_LOG_ERROR("sql.sql", "Creature (GUID: %u) has invalid animation tier (%u) defined in `creature_addon`. Truncated to 0.", guid, creatureAddon.animTier); + creatureAddon.animTier = 0; + } + + if (creatureAddon.sheathState >= MAX_SHEATH_STATE) + { + TC_LOG_ERROR("sql.sql", "Creature (GUID: %u) has invalid sheath state (%u) defined in `creature_addon`. Truncated to 0.", guid, creatureAddon.sheathState); + creatureAddon.sheathState = 0; + } + + // PvPFlags don't need any checking for the time being since they cover the entire range of a byte + if (!sEmotesStore.LookupEntry(creatureAddon.emote)) { TC_LOG_ERROR("sql.sql", "Creature (GUID: %u) has invalid emote (%u) defined in `creature_addon`.", guid, creatureAddon.emote); |