diff options
author | VladimirMangos <vladimir@getmangos.com> | 2011-02-04 15:45:59 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2011-02-04 15:45:59 +0100 |
commit | b5b9aa96478e396794b067fed2f9c71ec8bbd4cf (patch) | |
tree | 8c622fd319adb2ab472d9a94f7bec88cb16787d9 /src | |
parent | da4d38b00c994d564bbb1813b88937a9c86015f6 (diff) |
Core/Instances: Fixed creature difficulty templates for non-battleground maps
Signed-off-by: Shauren <shauren.trinity@gmail.com>
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Entities/Creature/Creature.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 81fef99cf26..03b3773cff7 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -267,23 +267,24 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData *data // get difficulty 1 mode entry uint32 actualEntry = Entry; CreatureInfo const *cinfo = normalInfo; - // TODO correctly implement spawnmodes for non-bg maps - for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1; ++diff) + for (uint8 diff = uint8(GetMap()->GetSpawnMode()); diff > 0;) { - if (normalInfo->DifficultyEntry[diff]) + // we already have valid Map pointer for current creature! + if (normalInfo->DifficultyEntry[diff - 1]) { - // we already have valid Map pointer for current creature! - if (GetMap()->GetSpawnMode() > diff) - { - cinfo = ObjectMgr::GetCreatureTemplate(normalInfo->DifficultyEntry[diff]); - if (!cinfo) - { - // maybe check such things already at startup - sLog->outErrorDb("Creature::UpdateEntry creature difficulty %u entry %u does not exist.", diff + 1, actualEntry); - return false; - } - } + cinfo = ObjectMgr::GetCreatureTemplate(normalInfo->DifficultyEntry[diff - 1]); + if (cinfo) + break; // template found + + // check and reported at startup, so just ignore (restore normalInfo) + cinfo = normalInfo; } + + // for instances heroic to normal, other cases attempt to retrieve previous difficulty + if (diff >= RAID_DIFFICULTY_10MAN_HEROIC && GetMap()->IsDungeon()) + diff -= 2; // to normal raid difficulty cases + else + --diff; } SetEntry(Entry); // normal entry always |