aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Spells
diff options
context:
space:
mode:
authorNay <dnpd.dd@gmail.com>2012-08-27 22:43:07 +0100
committerNay <dnpd.dd@gmail.com>2012-08-27 22:43:07 +0100
commite09591b8a7f06ae25eda7544d8555ca9a7e79960 (patch)
treec3dcd1f4f26a5c27c54f198764f6ae55f52b28a1 /src/server/scripts/Spells
parent353ebad6b91ee97469bd0ff0aaebadf3b8f28183 (diff)
parentc4f011f3324bc90631472bf2aa1b89590742909a (diff)
Merge remote-tracking branch 'origin/master' into 4.3.4
Conflicts: src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
Diffstat (limited to 'src/server/scripts/Spells')
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp92
-rw-r--r--src/server/scripts/Spells/spell_quest.cpp4
2 files changed, 94 insertions, 2 deletions
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index a35d243593e..170f00d4111 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -3077,6 +3077,96 @@ class spell_gen_mount : public SpellScriptLoader
uint32 _mount310;
};
+enum FoamSword
+{
+ ITEM_FOAM_SWORD_GREEN = 45061,
+ ITEM_FOAM_SWORD_PINK = 45176,
+ ITEM_FOAM_SWORD_BLUE = 45177,
+ ITEM_FOAM_SWORD_RED = 45178,
+ ITEM_FOAM_SWORD_YELLOW = 45179,
+
+ SPELL_BONKED = 62991,
+ SPELL_FOAM_SWORD_DEFEAT = 62994,
+ SPELL_ON_GUARD = 62972,
+};
+
+class spell_gen_upper_deck_create_foam_sword : public SpellScriptLoader
+{
+ public:
+ spell_gen_upper_deck_create_foam_sword() : SpellScriptLoader("spell_gen_upper_deck_create_foam_sword") { }
+
+ class spell_gen_upper_deck_create_foam_sword_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_gen_upper_deck_create_foam_sword_SpellScript);
+
+ void HandleScript(SpellEffIndex effIndex)
+ {
+ if (Player* player = GetHitPlayer())
+ {
+ static uint32 const itemId[5] = { ITEM_FOAM_SWORD_GREEN, ITEM_FOAM_SWORD_PINK, ITEM_FOAM_SWORD_BLUE, ITEM_FOAM_SWORD_RED, ITEM_FOAM_SWORD_YELLOW };
+ // player can only have one of these items
+ for (uint8 i = 0; i < 5; ++i)
+ {
+ if (player->HasItemCount(itemId[i], 1, true))
+ return;
+ }
+
+ CreateItem(effIndex, itemId[urand(0, 4)]);
+ }
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_gen_upper_deck_create_foam_sword_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_gen_upper_deck_create_foam_sword_SpellScript();
+ }
+};
+
+class spell_gen_bonked : public SpellScriptLoader
+{
+ public:
+ spell_gen_bonked() : SpellScriptLoader("spell_gen_bonked") { }
+
+ class spell_gen_bonked_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_gen_bonked_SpellScript);
+
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ if (Player* target = GetHitPlayer())
+ {
+ Aura const* aura = GetHitAura();
+ if (!(aura && aura->GetStackAmount() == 3))
+ return;
+
+ target->CastSpell(target, SPELL_FOAM_SWORD_DEFEAT, true);
+ target->RemoveAurasDueToSpell(SPELL_BONKED);
+
+ if (Aura const* aura = target->GetAura(SPELL_ON_GUARD))
+ {
+ if (Item* item = target->GetItemByGuid(aura->GetCastItemGUID()))
+ target->DestroyItemCount(item->GetEntry(), 1, true);
+ }
+ }
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_gen_bonked_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_gen_bonked_SpellScript();
+ }
+};
+
void AddSC_generic_spell_scripts()
{
new spell_gen_absorb0_hitlimit1();
@@ -3149,4 +3239,6 @@ void AddSC_generic_spell_scripts()
new spell_gen_mount("spell_blazing_hippogryph", 0, 0, 0, SPELL_BLAZING_HIPPOGRYPH_150, SPELL_BLAZING_HIPPOGRYPH_280);
new spell_gen_mount("spell_celestial_steed", 0, SPELL_CELESTIAL_STEED_60, SPELL_CELESTIAL_STEED_100, SPELL_CELESTIAL_STEED_150, SPELL_CELESTIAL_STEED_280, SPELL_CELESTIAL_STEED_310);
new spell_gen_mount("spell_x53_touring_rocket", 0, 0, 0, SPELL_X53_TOURING_ROCKET_150, SPELL_X53_TOURING_ROCKET_280, SPELL_X53_TOURING_ROCKET_310);
+ new spell_gen_upper_deck_create_foam_sword();
+ new spell_gen_bonked();
}
diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp
index fad1f6605be..8b67a52d300 100644
--- a/src/server/scripts/Spells/spell_quest.cpp
+++ b/src/server/scripts/Spells/spell_quest.cpp
@@ -1261,9 +1261,9 @@ class spell_q12372_cast_from_gossip_trigger : public SpellScriptLoader
void HandleScript(SpellEffIndex /*effIndex*/)
{
- Player* caster = GetCaster()->ToPlayer();
- caster->CastSpell(caster, SPELL_SUMMON_WYRMREST_DEFENDER, true);
+ GetCaster()->CastSpell(GetCaster(), SPELL_SUMMON_WYRMREST_DEFENDER, true);
}
+
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_q12372_cast_from_gossip_trigger_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);