From b2b9a8741d044fc2fde14e85cd569d303ebb76e2 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Fri, 20 Aug 2010 18:28:05 +0400 Subject: [PATCH] [10386] Correct creature entry selection for raid difficulties Original patch provided by False.Genesis. --- src/game/Creature.cpp | 35 ++++++++++++++++++++--------------- src/shared/revision_nr.h | 2 +- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 62f268188b7..f41f3279af4 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -204,26 +204,31 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data ) return false; } - // get difficulty 1 mode entry - uint32 actualEntry = Entry; + // difficulties for dungeons/battleground ordered in normal way + // and if more high version not exist must be used lesser version + // for raid order different: + // 10 man normal version must be used instead not existed 10 man heroic version + // 25 man normal version must be used instead not existed 24 man heroic version 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()->GetDifficulty()); diff > 0;) { + // we already have valid Map pointer for current creature! if (normalInfo->DifficultyEntry[diff]) { - // 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]); + if (cinfo) + break; // template found + + // check and reported at startup, so just ignore (restore normalInfo) + cinfo = normalInfo; } + + // for raid heroic to normal, for other to prev in normal order + if ((diff == int(RAID_DIFFICULTY_10MAN_HEROIC) || diff == int(RAID_DIFFICULTY_25MAN_HEROIC)) && + GetMap()->IsRaid()) + diff -= 2; // to normal raid difficulty cases + else + --diff; } SetEntry(Entry); // normal entry always diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 1b2c29217eb..97a0c1906c5 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10385" + #define REVISION_NR "10386" #endif // __REVISION_NR_H__