[10386] Correct creature entry selection for raid difficulties

Original patch provided by False.Genesis.
This commit is contained in:
VladimirMangos 2010-08-20 18:28:05 +04:00
parent 77ae9a63b8
commit 23be9ae496
2 changed files with 21 additions and 16 deletions

View file

@ -204,26 +204,31 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data )
return false; return false;
} }
// get difficulty 1 mode entry // difficulties for dungeons/battleground ordered in normal way
uint32 actualEntry = Entry; // 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; CreatureInfo const *cinfo = normalInfo;
// TODO correctly implement spawnmodes for non-bg maps for (uint8 diff = uint8(GetMap()->GetDifficulty()); diff > 0;)
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1; ++diff)
{ {
// we already have valid Map pointer for current creature!
if (normalInfo->DifficultyEntry[diff]) if (normalInfo->DifficultyEntry[diff])
{ {
// we already have valid Map pointer for current creature! cinfo = ObjectMgr::GetCreatureTemplate(normalInfo->DifficultyEntry[diff]);
if (GetMap()->GetSpawnMode() > diff) if (cinfo)
{ break; // template found
cinfo = ObjectMgr::GetCreatureTemplate(normalInfo->DifficultyEntry[diff]);
if (!cinfo) // check and reported at startup, so just ignore (restore normalInfo)
{ cinfo = normalInfo;
// maybe check such things already at startup
sLog.outErrorDb("Creature::UpdateEntry creature difficulty %u entry %u does not exist.", diff + 1, actualEntry);
return false;
}
}
} }
// 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 SetEntry(Entry); // normal entry always

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "10385" #define REVISION_NR "10386"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__