aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Spells/spell_holiday.cpp116
1 files changed, 58 insertions, 58 deletions
diff --git a/src/server/scripts/Spells/spell_holiday.cpp b/src/server/scripts/Spells/spell_holiday.cpp
index 52b4c0ca1d3..d1aa22aaba0 100644
--- a/src/server/scripts/Spells/spell_holiday.cpp
+++ b/src/server/scripts/Spells/spell_holiday.cpp
@@ -42,75 +42,75 @@ enum SpellsPicnic
SPELL_ROMANTIC_PICNIC_ACHIEV = 45123, // Romantic Picnic periodic = 5000
};
-class spell_love_is_in_the_air_romantic_picnic : public SpellScriptLoader
+class spell_love_is_in_the_air_romantic_picnic : public AuraScript
{
- public:
- spell_love_is_in_the_air_romantic_picnic() : SpellScriptLoader("spell_love_is_in_the_air_romantic_picnic") { }
+ PrepareAuraScript(spell_love_is_in_the_air_romantic_picnic);
- class spell_love_is_in_the_air_romantic_picnic_AuraScript : public AuraScript
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo(
{
- PrepareAuraScript(spell_love_is_in_the_air_romantic_picnic_AuraScript);
+ SPELL_BASKET_CHECK,
+ SPELL_MEAL_PERIODIC,
+ SPELL_MEAL_EAT_VISUAL,
+ SPELL_DRINK_VISUAL,
+ SPELL_ROMANTIC_PICNIC_ACHIEV
+ });
+ }
- void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
- {
- Unit* target = GetTarget();
- target->SetStandState(UNIT_STAND_STATE_SIT);
- target->CastSpell(target, SPELL_MEAL_PERIODIC, false);
- }
+ void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* target = GetTarget();
+ target->SetStandState(UNIT_STAND_STATE_SIT);
+ target->CastSpell(target, SPELL_MEAL_PERIODIC);
+ }
- void OnPeriodic(AuraEffect const* /*aurEff*/)
- {
- // Every 5 seconds
- Unit* target = GetTarget();
- Unit* caster = GetCaster();
+ void OnPeriodic(AuraEffect const* /*aurEff*/)
+ {
+ // Every 5 seconds
+ Unit* target = GetTarget();
- // If our player is no longer sit, remove all auras
- if (target->GetStandState() != UNIT_STAND_STATE_SIT)
- {
- target->RemoveAura(SPELL_ROMANTIC_PICNIC_ACHIEV);
- target->RemoveAura(GetAura());
- return;
- }
+ // If our player is no longer sit, remove all auras
+ if (target->GetStandState() != UNIT_STAND_STATE_SIT)
+ {
+ target->RemoveAurasDueToSpell(SPELL_ROMANTIC_PICNIC_ACHIEV);
+ target->RemoveAura(GetAura());
+ return;
+ }
- target->CastSpell(target, SPELL_BASKET_CHECK, false); // unknown use, it targets Romantic Basket
- target->CastSpell(target, RAND(SPELL_MEAL_EAT_VISUAL, SPELL_DRINK_VISUAL), false);
-
- bool foundSomeone = false;
- // For nearby players, check if they have the same aura. If so, cast Romantic Picnic (45123)
- // required by achievement and "hearts" visual
- std::list<Player*> playerList;
- Trinity::AnyPlayerInObjectRangeCheck checker(target, INTERACTION_DISTANCE*2);
- Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(target, playerList, checker);
- Cell::VisitWorldObjects(target, searcher, INTERACTION_DISTANCE * 2);
- for (std::list<Player*>::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr)
+ target->CastSpell(target, SPELL_BASKET_CHECK); // unknown use, it targets Romantic Basket
+ target->CastSpell(target, RAND(SPELL_MEAL_EAT_VISUAL, SPELL_DRINK_VISUAL));
+
+ bool foundSomeone = false;
+ // For nearby players, check if they have the same aura. If so, cast Romantic Picnic (45123)
+ // required by achievement and "hearts" visual
+ std::list<Player*> playerList;
+ Trinity::AnyPlayerInObjectRangeCheck checker(target, INTERACTION_DISTANCE*2);
+ Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(target, playerList, checker);
+ Cell::VisitWorldObjects(target, searcher, INTERACTION_DISTANCE * 2);
+ for (std::list<Player*>::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr)
+ {
+ if (Player* playerFound = (*itr))
+ {
+ if (target != playerFound && playerFound->HasAura(GetId()))
{
- if ((*itr) != target && (*itr)->HasAura(GetId())) // && (*itr)->GetStandState() == UNIT_STAND_STATE_SIT)
- {
- if (caster)
- {
- caster->CastSpell(*itr, SPELL_ROMANTIC_PICNIC_ACHIEV, true);
- caster->CastSpell(target, SPELL_ROMANTIC_PICNIC_ACHIEV, true);
- }
- foundSomeone = true;
- // break;
- }
+ playerFound->CastSpell(playerFound, SPELL_ROMANTIC_PICNIC_ACHIEV, true);
+ target->CastSpell(target, SPELL_ROMANTIC_PICNIC_ACHIEV, true);
+ foundSomeone = true;
+ break;
}
-
- if (!foundSomeone && target->HasAura(SPELL_ROMANTIC_PICNIC_ACHIEV))
- target->RemoveAura(SPELL_ROMANTIC_PICNIC_ACHIEV);
}
+ }
- void Register() override
- {
- 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);
- }
- };
+ if (!foundSomeone && target->HasAura(SPELL_ROMANTIC_PICNIC_ACHIEV))
+ target->RemoveAurasDueToSpell(SPELL_ROMANTIC_PICNIC_ACHIEV);
+ }
- AuraScript* GetAuraScript() const override
- {
- return new spell_love_is_in_the_air_romantic_picnic_AuraScript();
- }
+ void Register() override
+ {
+ AfterEffectApply += AuraEffectApplyFn(spell_love_is_in_the_air_romantic_picnic::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_love_is_in_the_air_romantic_picnic::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
+ }
};
enum HallowEndCandysSpells
@@ -1918,7 +1918,7 @@ class spell_midsummer_fling_torch_missed : public SpellScript
void AddSC_holiday_spell_scripts()
{
// Love is in the Air
- new spell_love_is_in_the_air_romantic_picnic();
+ RegisterSpellScript(spell_love_is_in_the_air_romantic_picnic);
// Hallow's End
new spell_hallow_end_candy();
new spell_hallow_end_candy_pirate();