fix(Scripts/StormPeaks): fix Jokkum summon for quest "Krolmir, Hammer of Storms" (#25392)

Co-authored-by: sudlud <sudlud@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Grimgravy
2026-06-25 18:58:55 -03:00
committed by GitHub
parent e668cc117d
commit 96593c03e8
2 changed files with 77 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
-- Riding Jokkum cast is now handled by spell_q13010_jokkum_summon
DELETE FROM `smart_scripts` WHERE (`entryorguid` = 30331) AND (`source_type` = 0) AND (`id` IN (5));
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_q13010_jokkum_summon';
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_riding_jokkum';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(56541, 'spell_q13010_jokkum_summon'),
(56606, 'spell_riding_jokkum');

View File

@@ -1290,6 +1290,73 @@ struct npc_oathbound_warder : public ScriptedAI
}
};
class spell_q13010_jokkum_summon : public SpellScript
{
PrepareSpellScript(spell_q13010_jokkum_summon);
void HandleSummon(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Unit* caster = GetCaster();
Player* player = caster->ToPlayer();
if (!player)
return;
if (player->IsInDisallowedMountForm())
player->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
uint32 entry = uint32(GetSpellInfo()->Effects[effIndex].MiscValue);
SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(uint32(GetSpellInfo()->Effects[effIndex].MiscValueB));
uint32 duration = uint32(GetSpellInfo()->GetDuration());
Position pos = caster->GetPosition();
if (Creature* summon = caster->GetMap()->SummonCreature(entry, pos, properties, duration, caster, GetSpellInfo()->Id))
{
uint32 spellId = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
caster->CastSpell(summon, spellId, true);
if (summon->IsImmuneToNPC())
summon->SetDisableGravity(false);
}
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_q13010_jokkum_summon::HandleSummon, EFFECT_0, SPELL_EFFECT_SUMMON);
}
};
enum KingJokkum
{
NPC_KING_JOKKUM = 30331
};
class spell_riding_jokkum : public AuraScript
{
PrepareAuraScript(spell_riding_jokkum);
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* charm = GetUnitOwner()->GetCharm();
if (!charm || charm->GetEntry() != NPC_KING_JOKKUM)
return;
Creature* summoned = charm->ToCreature();
if (!summoned)
return;
AuraRemoveMode removeMode = GetTargetApplication()->GetRemoveMode();
if (removeMode == AURA_REMOVE_BY_CANCEL)
summoned->DespawnOrUnsummon();
}
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_riding_jokkum::HandleEffectRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
void AddSC_storm_peaks()
{
RegisterCreatureAI(npc_frosthound);
@@ -1316,4 +1383,6 @@ void AddSC_storm_peaks()
RegisterSpellScript(spell_fatal_strike);
RegisterSpellScript(spell_player_mount_wyrm);
RegisterSpellScript(spell_eject_passenger_wild_wyrm);
RegisterSpellScript(spell_q13010_jokkum_summon);
RegisterSpellScript(spell_riding_jokkum);
}