mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-28 16:16:27 +00:00
fix(Scripts/Noblegarden): fix bunny transformation on egg looting (#21957)
This commit is contained in:
@@ -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');
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
61
src/server/scripts/Events/noblegarden.cpp
Normal file
61
src/server/scripts/Events/noblegarden.cpp
Normal file
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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);
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user