Skip to content

Commit

Permalink
[10386] Correct creature entry selection for raid difficulties
Browse files Browse the repository at this point in the history
Original patch provided by False.Genesis.
  • Loading branch information
VladimirMangos committed Aug 20, 2010
1 parent 41808eb commit b2b9a87
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
35 changes: 20 additions & 15 deletions src/game/Creature.cpp
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion 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__

0 comments on commit b2b9a87

Please sign in to comment.