diff --git a/data/sql/updates/pending_db_world/rev_1745009912305741300.sql b/data/sql/updates/pending_db_world/rev_1745009912305741300.sql new file mode 100644 index 000000000..8be409c4f --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1745009912305741300.sql @@ -0,0 +1,6 @@ +-- replace noblegarden gameobject script by spell script +UPDATE `gameobject_template` SET `ScriptName` = '' WHERE (`ScriptName` = 'go_noblegarden_colored_egg') AND (`entry` BETWEEN 113768 AND 113772); + +-- 61712 Summon Noblegarden Bunny Controller +DELETE FROM `spell_script_names` WHERE (`spell_id` = 61712) AND (`ScriptName` = 'spell_summon_noblegarden_bunny_controller'); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (61712, 'spell_summon_noblegarden_bunny_controller'); diff --git a/src/server/scripts/Events/events_script_loader.cpp b/src/server/scripts/Events/events_script_loader.cpp index 529ce2410..e6ade3a6c 100644 --- a/src/server/scripts/Events/events_script_loader.cpp +++ b/src/server/scripts/Events/events_script_loader.cpp @@ -24,6 +24,7 @@ void AddSC_event_love_in_the_air(); void AddSC_event_midsummer_scripts(); void AddSC_event_childrens_week(); void AddSC_event_firework_show_scripts(); +void AddSC_event_noblegarden_scripts(); // The name of this function should match: // void Add${NameOfDirectory}Scripts() @@ -37,4 +38,5 @@ void AddEventsScripts() AddSC_event_midsummer_scripts(); AddSC_event_childrens_week(); AddSC_event_firework_show_scripts(); + AddSC_event_noblegarden_scripts(); } diff --git a/src/server/scripts/Events/noblegarden.cpp b/src/server/scripts/Events/noblegarden.cpp new file mode 100644 index 000000000..df04be6c1 --- /dev/null +++ b/src/server/scripts/Events/noblegarden.cpp @@ -0,0 +1,61 @@ +/* + * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by the + * Free Software Foundation; either version 3 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "Player.h" +#include "SpellScript.h" +#include "SpellScriptLoader.h" + +enum eNoblegarden +{ + SPELL_NOBLEGARDEN_BUNNY = 61734 +}; + +// 61712 Summon Noblegarden Bunny Controller +class spell_summon_noblegarden_bunny_controller : public SpellScript +{ + PrepareSpellScript(spell_summon_noblegarden_bunny_controller); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_NOBLEGARDEN_BUNNY }); + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Player* player = GetHitPlayer()) + player->CastSpell(player, SPELL_NOBLEGARDEN_BUNNY, true); + } + + SpellCastResult CheckCast() + { + if (roll_chance_i(5)) + return SPELL_CAST_OK; + + return SPELL_FAILED_UNKNOWN; + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_summon_noblegarden_bunny_controller::HandleDummy, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnCheckCast += SpellCheckCastFn(spell_summon_noblegarden_bunny_controller::CheckCast); + } +}; + +void AddSC_event_noblegarden_scripts() +{ + RegisterSpellScript(spell_summon_noblegarden_bunny_controller); +} diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index 567850c00..f458cbbd5 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -28,21 +28,6 @@ #include "Spell.h" // Ours -/*###### -## go_noblegarden_colored_egg -######*/ -class go_noblegarden_colored_egg : public GameObjectScript -{ -public: - go_noblegarden_colored_egg() : GameObjectScript("go_noblegarden_colored_egg") { } - - bool OnGossipHello(Player* player, GameObject* /*go*/) override - { - if (roll_chance_i(5)) - player->CastSpell(player, 61734, true); // SPELL NOBLEGARDEN BUNNY - return false; - } -}; class go_seer_of_zebhalak : public GameObjectScript { @@ -1948,7 +1933,6 @@ public: void AddSC_go_scripts() { // Ours - new go_noblegarden_colored_egg(); new go_seer_of_zebhalak(); new go_mistwhisper_treasure(); new go_witherbark_totem_bundle();