Core/Spells: only provide base difficulty spell Ids to criteria events to match their requirements (see It's Not Easy Being Green' for reference)

This commit is contained in:
Ovahlord committed 2023-10-11 02:09:44 +02:00
1 parent faa4fbfbce
commit 4ff88148c8
3 files changed
+14 -7

No files matched your search

+4 -3
View File
@@ -2930,9 +2930,10 @@ SpellMissInfo Spell::PreprocessSpellHit(Unit* unit, bool scaleAura, TargetInfo&
if (Player* player = unit->ToPlayer())
{
player->FailAchievementCriteria(AchievementCriteriaFailEvent::BeSpellTarget, m_spellInfo->Id);
player->StartAchievementCriteria(AchievementCriteriaStartEvent::BeSpellTarget, m_spellInfo->Id);
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, m_spellInfo->Id, 0, 0, m_caster);
uint32 baseSpellId = sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->Id, REGULAR_DIFFICULTY);
player->FailAchievementCriteria(AchievementCriteriaFailEvent::BeSpellTarget, baseSpellId);
player->StartAchievementCriteria(AchievementCriteriaStartEvent::BeSpellTarget, baseSpellId);
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, baseSpellId, 0, 0, m_caster);
}
if (Player* player = m_caster->ToPlayer())
+9 -4
View File
@@ -176,13 +176,18 @@ void SpellMgr::SetSpellDifficultyId(uint32 spellId, uint32 id)
uint32 SpellMgr::GetSpellIdForDifficulty(uint32 spellId, WorldObject const* caster) const
{
if (!GetSpellInfo(spellId))
return spellId;
if (!caster || !caster->GetMap() || !caster->GetMap()->IsDungeon())
return spellId;
uint32 mode = uint32(caster->GetMap()->GetSpawnMode());
return GetSpellIdForDifficulty(spellId, Difficulty(caster->GetMap()->GetSpawnMode()));
}
uint32 SpellMgr::GetSpellIdForDifficulty(uint32 spellId, Difficulty difficulty) const
{
if (!GetSpellInfo(spellId))
return spellId;
uint32 mode = difficulty;
if (mode >= MAX_DIFFICULTY)
{
TC_LOG_ERROR("spells", "SpellMgr::GetSpellIdForDifficulty: Incorrect difficulty for spell %u.", spellId);
+1
View File
@@ -616,6 +616,7 @@ class TC_GAME_API SpellMgr
uint32 GetSpellDifficultyId(uint32 spellId) const;
void SetSpellDifficultyId(uint32 spellId, uint32 id);
uint32 GetSpellIdForDifficulty(uint32 spellId, WorldObject const* caster) const;
uint32 GetSpellIdForDifficulty(uint32 spellId, Difficulty difficulty) const;
SpellInfo const* GetSpellForDifficultyFromSpell(SpellInfo const* spell, WorldObject const* caster) const;
// Spell Ranks table