From ebc59011619105a1de23420c21708befaffbcad5 Mon Sep 17 00:00:00 2001 From: XTZGZoReX Date: Mon, 11 Jan 2010 18:13:21 +0100 Subject: * 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 --- src/game/ObjectMgr.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/game/ObjectMgr.cpp') 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(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); } -- cgit v1.2.3