[8775] implement all creature difficulties + support bgs with this

former know as heroic_entry we now have 3 of those
which let us chose different creature_templates for different
map-types

normal maps will need a bit more support to use correct
spawnmodes

but for battlegrounds it works already good:
they are divided by levelrange:
    0-59  == normal spawn -> spiritguides level 60
    60-69 == difficulty=1 -> spritiguides level 70
    70-79 == difficulty=2 -> spiritguides level 80
    80    == difficulty=3 -> spiritguides level 80

this is needed mostly for alterac valley to get
right creature-templates spawned
and with that all creature->SetLevel hacks could
get removed from alterac valley code
This commit is contained in:
balrok 2009-11-05 10:22:10 +01:00
parent adde82b73c
commit c50df41b3c
18 changed files with 121 additions and 82 deletions

View file

@ -191,17 +191,21 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data )
// get difficulty 1 mode entry
uint32 actualEntry = Entry;
CreatureInfo const *cinfo = normalInfo;
if(normalInfo->DifficultyEntry1)
// TODO correctly implement spawnmodes for non-bg maps
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1; ++diff)
{
//we already have valid Map pointer for current creature!
//FIXME: spawn modes 2-3 must have own case DifficultyEntryN
if(GetMap()->GetSpawnMode() > 0)
if (normalInfo->DifficultyEntry[diff])
{
cinfo = objmgr.GetCreatureTemplate(normalInfo->DifficultyEntry1);
if(!cinfo)
// we already have valid Map pointer for current creature!
if (GetMap()->GetSpawnMode() > diff)
{
sLog.outErrorDb("Creature::UpdateEntry creature difficulty 1 entry %u does not exist.", actualEntry);
return false;
cinfo = objmgr.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;
}
}
}
}
@ -362,9 +366,6 @@ void Creature::Update(uint32 diff)
else
setDeathState( JUST_ALIVED );
if (GetMap()->IsBattleGround() && ((BattleGroundMap*)GetMap())->GetBG())
((BattleGroundMap*)GetMap())->GetBG()->OnCreatureRespawn(this); // for alterac valley needed to adjust the correct level again
//Call AI respawn virtual function
i_AI->JustRespawned();