Skip to content

Commit

Permalink
Unit/Spell: Port all scripts from Unit::CalculateAuraDuration to spel…
Browse files Browse the repository at this point in the history
…lscripts
  • Loading branch information
killerwife committed Jan 12, 2024
1 parent 3d5244d commit 2fbd924
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 36 deletions.
31 changes: 29 additions & 2 deletions sql/scriptdev2/spell.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,26 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(54925,'spell_glyph_of_seal_of_command'),
(68082,'spell_glyph_of_seal_of_command_mana'),
(54939,'spell_glyph_of_divinity'),
(54937,'spell_glyph_of_holy_light');
(54937,'spell_glyph_of_holy_light'),
(19740,'spell_blessing_of_might'),
(19834,'spell_blessing_of_might'),
(19835,'spell_blessing_of_might'),
(19836,'spell_blessing_of_might'),
(19837,'spell_blessing_of_might'),
(19838,'spell_blessing_of_might'),
(25291,'spell_blessing_of_might'),
(27140,'spell_blessing_of_might'),
(48931,'spell_blessing_of_might'),
(48932,'spell_blessing_of_might'),
(19742,'spell_blessing_of_wisdom'),
(19850,'spell_blessing_of_wisdom'),
(19852,'spell_blessing_of_wisdom'),
(19853,'spell_blessing_of_wisdom'),
(19854,'spell_blessing_of_wisdom'),
(25290,'spell_blessing_of_wisdom'),
(27142,'spell_blessing_of_wisdom'),
(48935,'spell_blessing_of_wisdom'),
(48936,'spell_blessing_of_wisdom');

-- Warlock
INSERT INTO spell_scripts(Id, ScriptName) VALUES
Expand Down Expand Up @@ -1596,7 +1615,15 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(61387,'spell_typhoon'),
(53227,'spell_typhoon'),
(54845,'spell_glyph_of_starfire'),
(40121,'spell_swift_flight_form_passive');
(40121,'spell_swift_flight_form_passive'),
(467,'spell_thorns_druid'),
(782,'spell_thorns_druid'),
(1075,'spell_thorns_druid'),
(8914,'spell_thorns_druid'),
(9756,'spell_thorns_druid'),
(9910,'spell_thorns_druid'),
(26992,'spell_thorns_druid'),
(53307,'spell_thorns_druid');

-- Rogue
INSERT INTO spell_scripts(Id, ScriptName) VALUES
Expand Down
34 changes: 0 additions & 34 deletions src/game/Entities/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9931,40 +9931,6 @@ int32 Unit::CalculateAuraDuration(SpellEntry const* spellInfo, uint32 effectMask
duration = 0;
}

if (caster == this)
{
switch (spellInfo->SpellFamilyName)
{
case SPELLFAMILY_DRUID:
// Thorns
if (spellInfo->SpellIconID == 53 && (spellInfo->SpellFamilyFlags & uint64(0x0000000000000100)))
{
// Glyph of Thorns
if (Aura* aur = GetAura(57862, EFFECT_INDEX_0))
duration += aur->GetModifier()->m_amount * MINUTE * IN_MILLISECONDS;
}
break;
case SPELLFAMILY_PALADIN:
// Blessing of Might
if (spellInfo->SpellIconID == 298 && spellInfo->SpellFamilyFlags & uint64(0x0000000000000002))
{
// Glyph of Blessing of Might
if (Aura* aur = GetAura(57958, EFFECT_INDEX_0))
duration += aur->GetModifier()->m_amount * MINUTE * IN_MILLISECONDS;
}
// Blessing of Wisdom
else if (spellInfo->SpellIconID == 306 && spellInfo->SpellFamilyFlags & uint64(0x0000000000010000))
{
// Glyph of Blessing of Wisdom
if (Aura* aur = GetAura(57979, EFFECT_INDEX_0))
duration += aur->GetModifier()->m_amount * MINUTE * IN_MILLISECONDS;
}
break;
default:
break;
}
}

return duration;
}

Expand Down
14 changes: 14 additions & 0 deletions src/game/Spells/Scripts/Scripting/ClassScripts/Druid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,19 @@ struct GlyphOfStarfire : public AuraScript
}
};

// 467 - Thorns
struct ThornsDruid : public AuraScript
{
virtual int32 OnDurationCalculate(WorldObject const* caster, Unit const* target, int32 duration) const override
{
if (caster == target)
// Glyph of Thorns
if (Aura const* aur = target->GetAura(57862, EFFECT_INDEX_0))
duration += aur->GetModifier()->m_amount * MINUTE * IN_MILLISECONDS;
return duration;
}
};

// TODO: Glyph of Entangling Roots

void LoadDruidScripts()
Expand All @@ -357,4 +370,5 @@ void LoadDruidScripts()
RegisterSpellScript<Nourish>("spell_nourish");
RegisterSpellScript<GlyphOfTyphoon>("spell_typhoon");
RegisterSpellScript<GlyphOfStarfire>("spell_glyph_of_starfire");
RegisterSpellScript<ThornsDruid>("spell_thorns_druid");
}
28 changes: 28 additions & 0 deletions src/game/Spells/Scripts/Scripting/ClassScripts/Paladin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,32 @@ struct GlyphOfHolyLight : public AuraScript
}
};

// 19740 - Blessing Of Might
struct BlessingOfMight : public AuraScript
{
virtual int32 OnDurationCalculate(WorldObject const* caster, Unit const* target, int32 duration) const override
{
if (caster == target)
// Glyph of Blessing of Might
if (Aura const* aur = target->GetAura(57958, EFFECT_INDEX_0))
duration += aur->GetModifier()->m_amount * MINUTE * IN_MILLISECONDS;
return duration;
}
};

// 19740 - Blessing Of Wisdom
struct BlessingOfWisdom : public AuraScript
{
virtual int32 OnDurationCalculate(WorldObject const* caster, Unit const* target, int32 duration) const override
{
if (caster == target)
// Glyph of Blessing of Wisdom
if (Aura const* aur = target->GetAura(57979, EFFECT_INDEX_0))
duration += aur->GetModifier()->m_amount * MINUTE * IN_MILLISECONDS;
return duration;
}
};

void LoadPaladinScripts()
{
RegisterSpellScript<IncreasedHolyLightHealing>("spell_increased_holy_light_healing");
Expand All @@ -404,4 +430,6 @@ void LoadPaladinScripts()
RegisterSpellScript<GlyphOfSealOfCommandMana>("spell_glyph_of_seal_of_command_mana");
RegisterSpellScript<GlyphOfDivinity>("spell_glyph_of_divinity");
RegisterSpellScript<GlyphOfHolyLight>("spell_glyph_of_holy_light");
RegisterSpellScript<BlessingOfMight>("spell_blessing_of_might");
RegisterSpellScript<BlessingOfWisdom>("spell_blessing_of_wisdom");
}

0 comments on commit 2fbd924

Please sign in to comment.