Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(DB/Quest) Zapped Giants now behave correctly #21100

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
24 changes: 24 additions & 0 deletions data/sql/updates/pending_db_world/rev_1736100900062273000.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--
UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` IN (5357, 5358, 5359, 5360, 5361);
DELETE FROM `smart_scripts` WHERE (`entryorguid` = 5359) AND (`source_type` = 0) AND (`id` = 1);
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(5359, 0, 1, 0, 8, 0, 100, 0, 23359, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 'Shore Strider - On Spellhit \'Transmogrify!\' - Starts an attack');

DELETE FROM `smart_scripts` WHERE (`entryorguid` = 5360) AND (`source_type` = 0) AND (`id` = 1);
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(5360, 0, 1, 0, 8, 0, 100, 0, 23359, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 'Deep Strider - On Spellhit \'Transmogrify!\' - Starts an attack');

DELETE FROM `smart_scripts` WHERE (`entryorguid` = 5357) AND (`source_type` = 0) AND (`id` = 1);
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(5357, 0, 1, 0, 8, 0, 100, 0, 23359, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 'Land Walker - On Spellhit \'Transmogrify!\' - Starts an attack');

DELETE FROM `smart_scripts` WHERE (`entryorguid` = 5361) AND (`source_type` = 0) AND (`id` = 1);
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(5361, 0, 1, 0, 8, 0, 100, 0, 23359, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 'Wave Strider - On Spellhit \'Transmogrify!\' - Starts an attack');

DELETE FROM `smart_scripts` WHERE (`entryorguid` = 5358) AND (`source_type` = 0) AND (`id` = 1);
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(5358, 0, 1, 0, 8, 0, 100, 0, 23359, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 'Cliff Giant - On Spellhit \'Transmogrify!\' - Starts an attack');
-- Add spell script for Transmogrify!
DELETE FROM `spell_script_names` WHERE `spell_id`=23359 AND `ScriptName`='spell_transmogrify';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES(23359, 'spell_transmogrify');
33 changes: 33 additions & 0 deletions src/server/scripts/Kalimdor/zone_feralas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,40 @@ class spell_gordunni_trap : public SpellScript
}
};

enum ZAPPED_GIANTS
{
NPC_SHORE_STRIDER = 5359,
NPC_DEEP_STRIDER = 5360,
NPC_LAND_WALKER = 5357,
NPC_WAVE_STRIDER = 5361,
NPC_CLIFF_GIANT = 5358
};

class spell_transmogrify : public SpellScript
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no need for a spellscript here. target selection like this can be done with conditions in the database. please update the pr accordingly

{
PrepareSpellScript(spell_transmogrify);

SpellCastResult CheckTarget()
{
Unit* target = GetExplTargetUnit();

std::unordered_set<uint32> validCreatureIds = { NPC_SHORE_STRIDER, NPC_DEEP_STRIDER, NPC_LAND_WALKER, NPC_WAVE_STRIDER, NPC_CLIFF_GIANT };

// Validate the target
if (!target || !validCreatureIds.contains(target->GetEntry()))
return SPELL_FAILED_BAD_TARGETS;

return SPELL_CAST_OK;
}

void Register() override
{
OnCheckCast += SpellCheckCastFn(spell_transmogrify::CheckTarget);
}
};

void AddSC_feralas()
{
RegisterSpellScript(spell_gordunni_trap);
RegisterSpellScript(spell_transmogrify);
}
Loading