diff options
author | XTZGZoReX <none@none> | 2010-01-11 18:13:21 +0100 |
---|---|---|
committer | XTZGZoReX <none@none> | 2010-01-11 18:13:21 +0100 |
commit | ebc59011619105a1de23420c21708befaffbcad5 (patch) | |
tree | 666c087cf6fd4f639d97b49055026c9e1e7a1c49 /src/game/ObjectMgr.cpp | |
parent | 879948260fc5d701937183b48fec2bfd8a966ee3 (diff) |
* Fix crash when there's no creature_classlevelstats entry for a creature level.
* All this really does is fill in default values of 1.. If you got custom content, you'll have to fill in the creature_classlevelstats table yourself. This patch doesn't automagically fix stats for you.
--HG--
branch : trunk
Diffstat (limited to 'src/game/ObjectMgr.cpp')
-rw-r--r-- | src/game/ObjectMgr.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index abcae59a427..b762e2bd85f 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -8968,6 +8968,31 @@ void ObjectMgr::LoadCreatureClassLevelStats() delete result; + for (uint32 i = 0; i < sCreatureStorage.MaxEntry; ++i) + { + CreatureInfo const* info = sCreatureStorage.LookupEntry<CreatureInfo>(i); + if (!info) + continue; + + CreatureBaseStats const* stats = GetCreatureBaseStats(info->maxlevel, info->unit_class); + if (!stats) + { + sLog.outErrorDb("Missing base stats for creature template %u maxlevel %u, adding default values", + info->Entry, info->maxlevel); + + CreatureBaseStats new_stats = CreatureBaseStats(); + + new_stats.BaseArmor = 1; + for (uint8 j = 0; j < MAX_CREATURE_BASE_HP; ++j) + new_stats.BaseHealth[j] = 1; + new_stats.BaseMana = 0; + new_stats.Class = info->unit_class; + new_stats.Level = info->maxlevel; + + m_creatureBaseStatsList.push_back(new_stats); + } + } + sLog.outString(); sLog.outString( ">> Loaded %u creature base stats.", counter); } |