aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Globals/ObjectMgr.cpp
diff options
context:
space:
mode:
authorRat <gmstreetrat@gmail.com>2014-12-01 21:09:23 +0100
committerRat <gmstreetrat@gmail.com>2014-12-01 21:09:23 +0100
commitb91ac01bc7b9f9a60b85f7e92b88a8d4c16d350c (patch)
tree752ff4331fa77c4ad907f30c075b930072ca18e8 /src/server/game/Globals/ObjectMgr.cpp
parente7f3f11ed5d7fec26de2c4fd9f2cb219d8019f9b (diff)
parent05913b82084ed2b640c7e44e7a55bdb7b797ca5c (diff)
Merge branch '6.x' of https://github.com/TrinityCore/TrinityCore into Spells
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 040c9600852..4858800b3d2 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -482,8 +482,8 @@ void ObjectMgr::LoadCreatureTemplate(Field* fields)
creatureTemplate.SubName = fields[12].GetString();
creatureTemplate.IconName = fields[13].GetString();
creatureTemplate.GossipMenuId = fields[14].GetUInt32();
- creatureTemplate.minlevel = fields[15].GetUInt8();
- creatureTemplate.maxlevel = fields[16].GetUInt8();
+ creatureTemplate.minlevel = fields[15].GetInt16();
+ creatureTemplate.maxlevel = fields[16].GetInt16();
creatureTemplate.expansion = uint32(fields[17].GetInt16());
creatureTemplate.expansionUnknown = uint32(fields[18].GetUInt16());
creatureTemplate.faction = uint32(fields[19].GetUInt16());
@@ -674,18 +674,6 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
cInfo->Entry, cInfo->expansion, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->expansion);
}
- if (cInfo->minlevel > difficultyInfo->minlevel)
- {
- TC_LOG_ERROR("sql.sql", "Creature (Entry: %u, minlevel %u) has lower `minlevel` in difficulty %u mode (Entry: %u, minlevel %u).",
- cInfo->Entry, cInfo->minlevel, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->minlevel);
- }
-
- if (cInfo->maxlevel > difficultyInfo->maxlevel)
- {
- TC_LOG_ERROR("sql.sql", "Creature (Entry: %u, maxlevel %u) has lower `maxlevel` in difficulty %u mode (Entry: %u, maxlevel %u).",
- cInfo->Entry, cInfo->maxlevel, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->maxlevel);
- }
-
if (cInfo->faction != difficultyInfo->faction)
{
TC_LOG_ERROR("sql.sql", "Creature (Entry: %u, faction %u) has different `faction` in difficulty %u mode (Entry: %u, faction %u).",
@@ -983,6 +971,27 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
const_cast<CreatureTemplate*>(cInfo)->flags_extra &= CREATURE_FLAG_EXTRA_DB_ALLOWED;
}
+ // -1 is used in the client for auto-updating the levels
+ // having their expansion set to it to the latest one
+ if (cInfo->expansion == -1)
+ {
+ const_cast<CreatureTemplate*>(cInfo)->minlevel = (MAX_LEVEL + cInfo->minlevel);
+ const_cast<CreatureTemplate*>(cInfo)->maxlevel = (MAX_LEVEL + cInfo->maxlevel);
+ const_cast<CreatureTemplate*>(cInfo)->expansion = EXPANSION_WARLORDS_OF_DRAENOR;
+ }
+
+ if (cInfo->minlevel < 1 || cInfo->minlevel > STRONG_MAX_LEVEL)
+ {
+ TC_LOG_ERROR("sql.sql", "Creature (ID: %u): MinLevel %i is not within [1, 255], value has been set to 1.", cInfo->Entry, cInfo->minlevel);
+ const_cast<CreatureTemplate*>(cInfo)->minlevel = 1;
+ }
+
+ if (cInfo->maxlevel < 1 || cInfo->maxlevel > STRONG_MAX_LEVEL)
+ {
+ TC_LOG_ERROR("sql.sql", "Creature (ID: %u): MaxLevel %i is not within [1, 255], value has been set to 1.", cInfo->Entry, cInfo->maxlevel);
+ const_cast<CreatureTemplate*>(cInfo)->maxlevel = 1;
+ }
+
const_cast<CreatureTemplate*>(cInfo)->ModDamage *= Creature::_GetDamageMod(cInfo->rank);
}
@@ -9361,4 +9370,4 @@ std::string ObjectMgr::GetRealmName(uint32 realm) const
{
RealmNameContainer::const_iterator iter = _realmNameStore.find(realm);
return iter != _realmNameStore.end() ? iter->second : "";
-} \ No newline at end of file
+}