[11842] Add spell difficulty selection for creature*_addon auras

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
Schmoozerd 2011-11-07 21:46:47 +01:00
parent 35d2d4a316
commit 62c4f5e6bf
4 changed files with 13 additions and 6 deletions

View file

@ -784,7 +784,7 @@ bool Creature::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo cons
cPos.GetMap()->GetCreatureLinkingHolder()->AddMasterToHolder(this); cPos.GetMap()->GetCreatureLinkingHolder()->AddMasterToHolder(this);
} }
LoadCreatureAddon(); LoadCreatureAddon(false, cPos.GetMap());
return true; return true;
} }
@ -1911,7 +1911,7 @@ CreatureDataAddon const* Creature::GetCreatureAddon() const
} }
//creature_addon table //creature_addon table
bool Creature::LoadCreatureAddon(bool reload) bool Creature::LoadCreatureAddon(bool reload /*= false*/, Map* map /*= NULL*/)
{ {
CreatureDataAddon const *cainfo = GetCreatureAddon(); CreatureDataAddon const *cainfo = GetCreatureAddon();
if(!cainfo) if(!cainfo)
@ -1965,7 +1965,14 @@ bool Creature::LoadCreatureAddon(bool reload)
continue; continue;
} }
CastSpell(this, *cAura, true); SpellEntry const* spellInfo = sSpellStore.LookupEntry(*cAura); // Already checked on load
// Get Difficulty mode for initial case (npc not yet added to map)
if (spellInfo->SpellDifficultyId && !reload && map && map->IsDungeon())
if (SpellEntry const* spellEntry = GetSpellEntryByDifficulty(spellInfo->SpellDifficultyId, map->GetDifficulty(), map->IsRaid()))
spellInfo = spellEntry;
CastSpell(this, spellInfo, true);
} }
} }
return true; return true;

View file

@ -462,7 +462,7 @@ class MANGOS_DLL_SPEC Creature : public Unit
void RemoveFromWorld(); void RemoveFromWorld();
bool Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const* cinfo, Team team = TEAM_NONE, const CreatureData *data = NULL, GameEventCreatureData const* eventData = NULL); bool Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const* cinfo, Team team = TEAM_NONE, const CreatureData *data = NULL, GameEventCreatureData const* eventData = NULL);
bool LoadCreatureAddon(bool reload = false); bool LoadCreatureAddon(bool reload = false, Map* map = NULL);
void SelectLevel(const CreatureInfo *cinfo, float percentHealth = 100.0f, float percentMana = 100.0f); void SelectLevel(const CreatureInfo *cinfo, float percentHealth = 100.0f, float percentMana = 100.0f);
void LoadEquipment(uint32 equip_entry, bool force=false); void LoadEquipment(uint32 equip_entry, bool force=false);

View file

@ -64,7 +64,7 @@ bool Totem::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const*
if (InstanceData* iData = GetMap()->GetInstanceData()) if (InstanceData* iData = GetMap()->GetInstanceData())
iData->OnCreatureCreate(this); iData->OnCreatureCreate(this);
LoadCreatureAddon(); LoadCreatureAddon(false, cPos.GetMap());
return true; return true;
} }

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 "11841" #define REVISION_NR "11842"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__