From 92fdb7aed16d1d0869aaa6d93f82a5478a018ffc Mon Sep 17 00:00:00 2001 From: untaught Date: Fri, 9 Aug 2013 12:55:26 +0100 Subject: DB/SAI: Fix quest Jormuttar is Soo Fat... Scripts/Spells: Script spell Bear Flank Master Closes #10484 --- src/server/scripts/Spells/spell_quest.cpp | 57 +++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'src/server/scripts/Spells') diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 10cc62a8a91..fcf87e9bfac 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -1785,6 +1785,62 @@ class spell_q12847_summon_soul_moveto_bunny : public SpellScriptLoader } }; +enum BearFlankMaster +{ + SPELL_BEAR_FLANK_MASTER = 56565, + SPELL_CREATE_BEAR_FLANK = 56566, + SPELL_BEAR_FLANK_FAIL = 56569 +}; + +class spell_q13011_bear_flank_master : public SpellScriptLoader +{ + public: + spell_q13011_bear_flank_master() : SpellScriptLoader("spell_q13011_bear_flank_master") { } + + class spell_q13011_bear_flank_master_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q13011_bear_flank_master_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_BEAR_FLANK_MASTER) || !sSpellMgr->GetSpellInfo(SPELL_CREATE_BEAR_FLANK)) + return false; + return true; + } + + bool Load() OVERRIDE + { + return GetCaster()->GetTypeId() == TYPEID_UNIT; + } + + void HandleScript(SpellEffIndex effIndex) + { + bool failed = RAND(0, 1); // 50% chance + Creature* creature = GetCaster()->ToCreature(); + if (Player* player = GetHitPlayer()) + { + if (failed) + { + player->CastSpell(creature, SPELL_BEAR_FLANK_FAIL); + creature->AI()->Talk(0, player->GetGUID()); + } + else + player->CastSpell(player, SPELL_CREATE_BEAR_FLANK); + } + } + + void Register() OVERRIDE + { + OnEffectHitTarget += SpellEffectFn(spell_q13011_bear_flank_master_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_q13011_bear_flank_master_SpellScript(); + } +}; + class spell_q13086_cannons_target : public SpellScriptLoader { public: @@ -1863,5 +1919,6 @@ void AddSC_quest_spell_scripts() new spell_q13291_q13292_q13239_q13261_frostbrood_skytalon_grab_decoy(); new spell_q13291_q13292_q13239_q13261_armored_decoy_summon_skytalon(); new spell_q12847_summon_soul_moveto_bunny(); + new spell_q13011_bear_flank_master(); new spell_q13086_cannons_target(); } -- cgit v1.2.3 From 8aff3945f275b2285413ffadef616da1eb513faa Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Fri, 9 Aug 2013 19:59:52 +0200 Subject: Scripted: Fix non pch build --- src/server/scripts/Pet/pet_dk.cpp | 4 +++- src/server/scripts/Pet/pet_hunter.cpp | 2 +- src/server/scripts/Pet/pet_mage.cpp | 2 ++ src/server/scripts/Pet/pet_priest.cpp | 1 + src/server/scripts/Pet/pet_shaman.cpp | 4 ++++ src/server/scripts/Spells/spell_quest.cpp | 5 +++-- src/server/scripts/World/npcs_special.cpp | 2 -- 7 files changed, 14 insertions(+), 6 deletions(-) (limited to 'src/server/scripts/Spells') diff --git a/src/server/scripts/Pet/pet_dk.cpp b/src/server/scripts/Pet/pet_dk.cpp index 7a3776fb0b5..aac2eb0f89e 100644 --- a/src/server/scripts/Pet/pet_dk.cpp +++ b/src/server/scripts/Pet/pet_dk.cpp @@ -22,13 +22,15 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "CombatAI.h" +#include "GridNotifiers.h" enum DeathKnightSpells { SPELL_DK_SUMMON_GARGOYLE_1 = 49206, SPELL_DK_SUMMON_GARGOYLE_2 = 50514, SPELL_DK_DISMISS_GARGOYLE = 50515, - SPELL_DK_SANCTUARY = 54661, + SPELL_DK_SANCTUARY = 54661 }; class npc_pet_dk_ebon_gargoyle : public CreatureScript diff --git a/src/server/scripts/Pet/pet_hunter.cpp b/src/server/scripts/Pet/pet_hunter.cpp index 90281654710..80551be9131 100644 --- a/src/server/scripts/Pet/pet_hunter.cpp +++ b/src/server/scripts/Pet/pet_hunter.cpp @@ -101,7 +101,7 @@ class npc_pet_hunter_snake_trap : public CreatureScript if (_spellTimer <= diff) { - if (_isViper) //Viper + if (_isViper) // Viper { if (urand(0, 2) == 0) //33% chance to cast { diff --git a/src/server/scripts/Pet/pet_mage.cpp b/src/server/scripts/Pet/pet_mage.cpp index 479cbc69ada..85247b29f84 100644 --- a/src/server/scripts/Pet/pet_mage.cpp +++ b/src/server/scripts/Pet/pet_mage.cpp @@ -22,6 +22,8 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "CombatAI.h" +#include "Pet.h" enum MageSpells { diff --git a/src/server/scripts/Pet/pet_priest.cpp b/src/server/scripts/Pet/pet_priest.cpp index fa273de1870..4b565aaec10 100644 --- a/src/server/scripts/Pet/pet_priest.cpp +++ b/src/server/scripts/Pet/pet_priest.cpp @@ -22,6 +22,7 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "PassiveAI.h" #include "PetAI.h" enum PriestSpells diff --git a/src/server/scripts/Pet/pet_shaman.cpp b/src/server/scripts/Pet/pet_shaman.cpp index 63ce0d6b3e3..c770be86692 100644 --- a/src/server/scripts/Pet/pet_shaman.cpp +++ b/src/server/scripts/Pet/pet_shaman.cpp @@ -63,6 +63,8 @@ class npc_pet_shaman_earth_elemental : public CreatureScript if (!UpdateVictim()) return; + events.Update(diff); + if (_events.ExecuteEvent() == EVENT_SHAMAN_ANGEREDEARTH) { DoCastVictim(SPELL_SHAMAN_ANGEREDEARTH); @@ -108,6 +110,8 @@ class npc_pet_shaman_fire_elemental : public CreatureScript if (me->HasUnitState(UNIT_STATE_CASTING)) return; + events.Update(diff); + while (uint32 eventId = _events.ExecuteEvent()) { switch (eventId) diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index fcf87e9bfac..ca94f871d03 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -1803,7 +1803,8 @@ class spell_q13011_bear_flank_master : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE { - if (!sSpellMgr->GetSpellInfo(SPELL_BEAR_FLANK_MASTER) || !sSpellMgr->GetSpellInfo(SPELL_CREATE_BEAR_FLANK)) + if (!sSpellMgr->GetSpellInfo(SPELL_BEAR_FLANK_MASTER) || + !sSpellMgr->GetSpellInfo(SPELL_CREATE_BEAR_FLANK)) return false; return true; } @@ -1813,7 +1814,7 @@ class spell_q13011_bear_flank_master : public SpellScriptLoader return GetCaster()->GetTypeId() == TYPEID_UNIT; } - void HandleScript(SpellEffIndex effIndex) + void HandleScript(SpellEffIndex /*effIndex*/) { bool failed = RAND(0, 1); // 50% chance Creature* creature = GetCaster()->ToCreature(); diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index f45462fa80c..8e103f105c1 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -49,9 +49,7 @@ EndContentData */ #include "ObjectMgr.h" #include "ScriptMgr.h" #include "World.h" -#include "PetAI.h" #include "PassiveAI.h" -#include "CombatAI.h" #include "GameEventMgr.h" #include "GridNotifiers.h" #include "GridNotifiersImpl.h" -- cgit v1.2.3