Skip to content

Commit

Permalink
Spell: Move Black Qiraji mount to SpellScript
Browse files Browse the repository at this point in the history
  • Loading branch information
insunaa committed Apr 1, 2024
1 parent c126a37 commit ebd093b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
1 change: 1 addition & 0 deletions sql/scriptdev2/spell.sql
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(26591,'spell_teleport_image'),
(26608,'spell_viscidus_despawn_adds'),
(26619,'spell_periodic_scarab_trigger'),
(26656,'spell_summon_black_qiraji_battle_tank'),
(26686,'spell_aq_whirlwind'),
(26767,'spell_cthun_tentacles_summon'),
(26769,'spell_cthun_periodic_eye_trigger'),
Expand Down
21 changes: 21 additions & 0 deletions src/game/AI/ScriptDevAI/scripts/world/item_scripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,26 @@ struct GoblinBomb : public SpellScript
}
};

struct SummonBlackQirajiBattleTank : public SpellScript
{
void OnEffectExecute(Spell* spell, SpellEffectIndex /*effIdx*/) const override
{
Unit* unitTarget = spell->GetUnitTarget();
if (!unitTarget)
return;

// Prevent stacking of mounts
unitTarget->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);

// Two separate mounts depending on area id (allows use both in and out of specific instance)
switch (unitTarget->GetAreaId())
{
[[unlikely]] case 3428: unitTarget->CastSpell(nullptr, 25863, TRIGGERED_NONE); break;
default: unitTarget->CastSpell(nullptr, 26655, TRIGGERED_NONE);
}
}
};

void AddSC_item_scripts()
{
Script* pNewScript = new Script;
Expand All @@ -238,4 +258,5 @@ void AddSC_item_scripts()
RegisterSpellScript<OrbOfDeception>("spell_orb_of_deception");
RegisterSpellScript<SummonGoblinBomb>("spell_summon_goblin_bomb");
RegisterSpellScript<GoblinBomb>("spell_goblin_bomb");
RegisterSpellScript<SummonBlackQirajiBattleTank>("spell_summon_black_qiraji_battle_tank");
}
19 changes: 0 additions & 19 deletions src/game/Spells/SpellEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4170,25 +4170,6 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx)
unitTarget->CastSpell(nullptr, 26529, TRIGGERED_NONE);
return;
}
case 26656: // Summon Black Qiraji Battle Tank
{
if (!unitTarget)
return;

if (unitTarget->HasAura(25863) || unitTarget->HasAura(26655))
return; // protection against visual glitch

// Prevent stacking of mounts
unitTarget->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);

// Two separate mounts depending on area id (allows use both in and out of specific instance)
if (unitTarget->GetAreaId() == 3428)
unitTarget->CastSpell(unitTarget, 25863, TRIGGERED_NONE);
else
unitTarget->CastSpell(unitTarget, 26655, TRIGGERED_NONE);

return;
}
case 26663: // Valentine - Orgrimmar Grunt
case 26923: // Valentine - Thunderbluff Watcher
case 26924: // Valentine - Undercity Guardian
Expand Down

0 comments on commit ebd093b

Please sign in to comment.