aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/scripts/Spells/spell_holiday.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/server/scripts/Spells/spell_holiday.cpp b/src/server/scripts/Spells/spell_holiday.cpp
index 19b6a29e24b..dabe978b58c 100644
--- a/src/server/scripts/Spells/spell_holiday.cpp
+++ b/src/server/scripts/Spells/spell_holiday.cpp
@@ -23,40 +23,38 @@
#include "ScriptPCH.h"
// 45102 Romantic Picnic
-
enum SpellsPicnic
{
- SPELL_BASKET_CHECK = 45119, // Holiday - Valentine - Romantic Picnic Near Basket Check
- SPELL_MEAL_PERIODIC = 45103, // Holiday - Valentine - Romantic Picnic Meal Periodic - effect dummy
- SPELL_MEAL_EAT_VISUAL = 45120, // Holiday - Valentine - Romantic Picnic Meal Eat Visual
- // SPELL_MEAL_PARTICLE = 45114, // Holiday - Valentine - Romantic Picnic Meal Particle - unused
- SPELL_DRINK_VISUAL = 45121, // Holiday - Valentine - Romantic Picnic Drink Visual
- SPELL_ROMANTIC_PICNIC_ACHIEV = 45123, // Romantic Picnic periodic = 5000
+ SPELL_BASKET_CHECK = 45119, // Holiday - Valentine - Romantic Picnic Near Basket Check
+ SPELL_MEAL_PERIODIC = 45103, // Holiday - Valentine - Romantic Picnic Meal Periodic - effect dummy
+ SPELL_MEAL_EAT_VISUAL = 45120, // Holiday - Valentine - Romantic Picnic Meal Eat Visual
+ //SPELL_MEAL_PARTICLE = 45114, // Holiday - Valentine - Romantic Picnic Meal Particle - unused
+ SPELL_DRINK_VISUAL = 45121, // Holiday - Valentine - Romantic Picnic Drink Visual
+ SPELL_ROMANTIC_PICNIC_ACHIEV = 45123, // Romantic Picnic periodic = 5000
};
class spell_love_is_in_the_air_romantic_picnic : public SpellScriptLoader
{
-public:
- spell_love_is_in_the_air_romantic_picnic() : SpellScriptLoader("spell_love_is_in_the_air_romantic_picnic") { }
-
- class spell_love_is_in_the_air_romantic_picnic_AuraScript : public AuraScript
- {
- PrepareAuraScript(spell_love_is_in_the_air_romantic_picnic_AuraScript);
+ public:
+ spell_love_is_in_the_air_romantic_picnic() : SpellScriptLoader("spell_love_is_in_the_air_romantic_picnic") { }
- void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
+ class spell_love_is_in_the_air_romantic_picnic_AuraScript : public AuraScript
{
- if (Unit* target = GetTarget())
+ PrepareAuraScript(spell_love_is_in_the_air_romantic_picnic_AuraScript);
+
+ void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
+ Unit* target = GetTarget();
target->SetStandState(UNIT_STAND_STATE_SIT);
target->CastSpell(target, SPELL_MEAL_PERIODIC, false);
}
- }
- void OnPeriodic(AuraEffect const* /*aurEff*/)
- {
- // Every 5 seconds
- if (Unit* target = GetTarget())
+ void OnPeriodic(AuraEffect const* /*aurEff*/)
{
+ // Every 5 seconds
+ Unit* target = GetTarget();
+ Unit* caster = GetCaster();
+
// If our player is no longer sit, remove all auras
if (target->getStandState() != UNIT_STAND_STATE_SIT)
{
@@ -79,8 +77,11 @@ public:
{
if ((*itr) != target && (*itr)->HasAura(GetId())) // && (*itr)->getStandState() == UNIT_STAND_STATE_SIT)
{
- GetCaster()->CastSpell(*itr, SPELL_ROMANTIC_PICNIC_ACHIEV, true);
- GetCaster()->CastSpell(target, SPELL_ROMANTIC_PICNIC_ACHIEV, true);
+ if (caster)
+ {
+ caster->CastSpell(*itr, SPELL_ROMANTIC_PICNIC_ACHIEV, true);
+ caster->CastSpell(target, SPELL_ROMANTIC_PICNIC_ACHIEV, true);
+ }
foundSomeone = true;
// break;
}
@@ -89,19 +90,18 @@ public:
if (!foundSomeone && target->HasAura(SPELL_ROMANTIC_PICNIC_ACHIEV))
target->RemoveAura(SPELL_ROMANTIC_PICNIC_ACHIEV);
}
- }
- void Register()
+ void Register()
+ {
+ AfterEffectApply += AuraEffectApplyFn(spell_love_is_in_the_air_romantic_picnic_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_love_is_in_the_air_romantic_picnic_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
{
- AfterEffectApply += AuraEffectApplyFn(spell_love_is_in_the_air_romantic_picnic_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
- OnEffectPeriodic += AuraEffectPeriodicFn(spell_love_is_in_the_air_romantic_picnic_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
+ return new spell_love_is_in_the_air_romantic_picnic_AuraScript();
}
- };
-
- AuraScript* GetAuraScript() const
- {
- return new spell_love_is_in_the_air_romantic_picnic_AuraScript();
- }
};
void AddSC_holiday_spell_scripts()