Script/Holiday: Cleanup and fix possible crash from 32b2fccf33
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
#include "ScriptPCH.h"
|
||||
|
||||
// 45102 Romantic Picnic
|
||||
|
||||
enum SpellsPicnic
|
||||
{
|
||||
SPELL_BASKET_CHECK = 45119, // Holiday - Valentine - Romantic Picnic Near Basket Check
|
||||
@@ -43,20 +42,19 @@ public:
|
||||
{
|
||||
PrepareAuraScript(spell_love_is_in_the_air_romantic_picnic_AuraScript);
|
||||
|
||||
void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Unit* target = GetTarget())
|
||||
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())
|
||||
{
|
||||
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,7 +90,6 @@ public:
|
||||
if (!foundSomeone && target->HasAura(SPELL_ROMANTIC_PICNIC_ACHIEV))
|
||||
target->RemoveAura(SPELL_ROMANTIC_PICNIC_ACHIEV);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user