[11610] Select proper spell difficulty subtitution.

Fix mostly affect cases when absent 25-man difficulties spell version.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
PSZ 2011-06-05 21:49:51 +04:00 committed by VladimirMangos
parent 753b0cd969
commit 3a60c4ae3b
4 changed files with 10 additions and 8 deletions

View file

@ -319,7 +319,7 @@ Spell::Spell( Unit* caster, SpellEntry const *info, bool triggered, ObjectGuid o
if (info->SpellDifficultyId && caster->GetTypeId() != TYPEID_PLAYER && caster->IsInWorld() && caster->GetMap()->IsDungeon()) if (info->SpellDifficultyId && caster->GetTypeId() != TYPEID_PLAYER && caster->IsInWorld() && caster->GetMap()->IsDungeon())
{ {
if (SpellEntry const* spellEntry = GetSpellEntryByDifficulty(info->SpellDifficultyId, caster->GetMap()->GetDifficulty())) if (SpellEntry const* spellEntry = GetSpellEntryByDifficulty(info->SpellDifficultyId, caster->GetMap()->GetDifficulty(), caster->GetMap()->IsRaid()))
m_spellInfo = spellEntry; m_spellInfo = spellEntry;
else else
m_spellInfo = info; m_spellInfo = info;

View file

@ -4496,16 +4496,18 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
return true; return true;
} }
SpellEntry const* GetSpellEntryByDifficulty(uint32 id, Difficulty difficulty) SpellEntry const* GetSpellEntryByDifficulty(uint32 id, Difficulty difficulty, bool isRaid)
{ {
SpellDifficultyEntry const* spellDiff = sSpellDifficultyStore.LookupEntry(id); SpellDifficultyEntry const* spellDiff = sSpellDifficultyStore.LookupEntry(id);
if (!spellDiff) if (!spellDiff)
return NULL; return NULL;
if (!spellDiff->spellId[difficulty]) for (Difficulty diff = difficulty; diff >= REGULAR_DIFFICULTY; diff = GetPrevDifficulty(diff, isRaid))
return NULL; {
if (spellDiff->spellId[diff])
SpellEntry const* spellEntry = sSpellStore.LookupEntry(spellDiff->spellId[difficulty]); return sSpellStore.LookupEntry(spellDiff->spellId[difficulty]);
return spellEntry; }
return NULL;
} }

View file

@ -531,7 +531,7 @@ bool IsDiminishingReturnsGroupDurationLimited(DiminishingGroup group);
DiminishingReturnsType GetDiminishingReturnsGroupType(DiminishingGroup group); DiminishingReturnsType GetDiminishingReturnsGroupType(DiminishingGroup group);
int32 GetDiminishingReturnsLimitDuration(DiminishingGroup group, SpellEntry const* spellproto); int32 GetDiminishingReturnsLimitDuration(DiminishingGroup group, SpellEntry const* spellproto);
SpellEntry const* GetSpellEntryByDifficulty(uint32 id, Difficulty difficulty); SpellEntry const* GetSpellEntryByDifficulty(uint32 id, Difficulty difficulty, bool isRaid);
// Spell proc event related declarations (accessed using SpellMgr functions) // Spell proc event related declarations (accessed using SpellMgr functions)
enum ProcFlags enum ProcFlags

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 "11609" #define REVISION_NR "11610"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__