TrinityCore
Loading...
Searching...
No Matches
love_is_in_the_air.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "ScriptMgr.h"
19#include "CellImpl.h"
20#include "Containers.h"
21#include "CreatureAIImpl.h"
22#include "GridNotifiersImpl.h"
23#include "Player.h"
24#include "SpellAuraEffects.h"
25#include "SpellScript.h"
26
28{
29 SPELL_BASKET_CHECK = 45119, // Holiday - Valentine - Romantic Picnic Near Basket Check
30 SPELL_MEAL_PERIODIC = 45103, // Holiday - Valentine - Romantic Picnic Meal Periodic - effect dummy
31 SPELL_MEAL_EAT_VISUAL = 45120, // Holiday - Valentine - Romantic Picnic Meal Eat Visual
32 // SPELL_MEAL_PARTICLE = 45114, // Holiday - Valentine - Romantic Picnic Meal Particle - unused
33 SPELL_DRINK_VISUAL = 45121, // Holiday - Valentine - Romantic Picnic Drink Visual
34 SPELL_ROMANTIC_PICNIC_ACHIEV = 45123, // Romantic Picnic periodic = 5000
35};
36
37// 45102 - Romantic Picnic
39{
41
42 bool Validate(SpellInfo const* /*spellInfo*/) override
43 {
44 return ValidateSpellInfo(
45 {
51 });
52 }
53
54 void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
55 {
56 Unit* target = GetTarget();
58 target->CastSpell(target, SPELL_MEAL_PERIODIC);
59 }
60
61 void OnPeriodic(AuraEffect const* /*aurEff*/)
62 {
63 // Every 5 seconds
64 Unit* target = GetTarget();
65
66 // If our player is no longer sit, remove all auras
67 if (target->GetStandState() != UNIT_STAND_STATE_SIT)
68 {
70 target->RemoveAura(GetAura());
71 return;
72 }
73
74 target->CastSpell(target, SPELL_BASKET_CHECK); // unknown use, it targets Romantic Basket
76
77 bool foundSomeone = false;
78 // For nearby players, check if they have the same aura. If so, cast Romantic Picnic (45123)
79 // required by achievement and "hearts" visual
80 std::list<Player*> playerList;
83 Cell::VisitWorldObjects(target, searcher, INTERACTION_DISTANCE * 2);
84 for (std::list<Player*>::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr)
85 {
86 if (Player* playerFound = (*itr))
87 {
88 if (target != playerFound && playerFound->HasAura(GetId()))
89 {
90 playerFound->CastSpell(playerFound, SPELL_ROMANTIC_PICNIC_ACHIEV, true);
91 target->CastSpell(target, SPELL_ROMANTIC_PICNIC_ACHIEV, true);
92 foundSomeone = true;
93 break;
94 }
95 }
96 }
97
98 if (!foundSomeone && target->HasAura(SPELL_ROMANTIC_PICNIC_ACHIEV))
100 }
101
107};
108
109/*######
110## Item 21813: Bag of Heart Candies
111######*/
112
124
130
131// 26678 - Create Heart Candy
151
152/*######
153## Quest 24536, 24655: Something Stinks
154######*/
155
160
161// 71507 - Heavily Perfumed
181
182// 71508 - Recently Analyzed
203
204/*######
205## Quest 24629, 24635, 24636: A Perfect Puff of Perfume & A Cloudlet of Classy Cologne & Bonbon Blitz
206######*/
207
208// 69438 - Sample Satisfaction
224
225/*######
226## Quest 24541, 24656: Pilfering Perfume
227######*/
228
236
237// 71450 - Crown Parcel Service Uniform
270
271// 71522 - Crown Chemical Co. Supplies
272// 71539 - Crown Chemical Co. Supplies
292
293/*######
294## Item 49351, 49352: Perfume Neutralizer & Cologne Neutralizer
295######*/
296
297// 68529 - Perfume Immune
298// 68530 - Cologne Immune
323
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint32_t uint32
Definition Define.h:133
#define INTERACTION_DISTANCE
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
bool roll_chance_i(int chance)
Definition Random.h:59
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
@ GENDER_MALE
@ AURA_REMOVE_BY_EXPIRE
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_DUMMY
@ SPELL_AURA_TRANSFORM
@ SPELL_AURA_PERIODIC_DUMMY
#define SpellEffectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define AuraEffectApplyFn(F, I, N, M)
#define AuraEffectRemoveFn(F, I, N, M)
@ UNIT_STAND_STATE_SIT
Definition UnitDefines.h:35
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectPeriodicHandler > OnEffectPeriodic
HookList< EffectApplyHandler > AfterEffectApply
SpellEffectInfo const & GetEffectInfo(SpellEffIndex effIndex) const
Aura * GetAura() const
Unit * GetTarget() const
void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
uint32 GetId() const
TypeID GetTypeId() const
Definition Object.h:93
int32 CalcValue(WorldObject const *caster=nullptr, int32 const *basePoints=nullptr) const
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition SpellInfo.h:483
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
Unit * GetHitUnit() const
int32 GetEffectValue() const
HookList< EffectHandler > OnEffectHitTarget
Definition Unit.h:769
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3638
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4535
virtual Gender GetNativeGender() const
Definition Unit.h:900
virtual void SetDisplayId(uint32 modelId)
Definition Unit.cpp:10407
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
void SetStandState(UnitStandStateType state)
Definition Unit.cpp:10363
UnitStandStateType GetStandState() const
Definition Unit.h:1001
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
PrepareSpellScript(spell_love_is_in_the_air_cancel_service_uniform)
PrepareSpellScript(spell_love_is_in_the_air_create_heart_candy)
void AfterRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *spellInfo) override
PrepareAuraScript(spell_love_is_in_the_air_heavily_perfumed)
PrepareSpellScript(spell_love_is_in_the_air_perfume_cologne_immune)
bool Validate(SpellInfo const *spellInfo) override
void AfterRemove(AuraEffect const *, AuraEffectHandleModes)
PrepareAuraScript(spell_love_is_in_the_air_recently_analyzed)
bool Validate(SpellInfo const *) override
void OnApply(AuraEffect const *, AuraEffectHandleModes)
PrepareAuraScript(spell_love_is_in_the_air_romantic_picnic)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_love_is_in_the_air_sample_satisfaction)
bool Validate(SpellInfo const *spellInfo) override
PrepareAuraScript(spell_love_is_in_the_air_service_uniform)
void AfterApply(AuraEffect const *, AuraEffectHandleModes)
void AfterRemove(AuraEffect const *, AuraEffectHandleModes)
@ SPELL_SERVICE_UNIFORM
@ MODEL_GOBLIN_FEMALE
@ MODEL_GOBLIN_MALE
void AddSC_event_love_is_in_the_air()
@ SPELL_CREATE_HEART_CANDY_1
@ SPELL_CREATE_HEART_CANDY_4
@ SPELL_CREATE_HEART_CANDY_7
@ SPELL_CREATE_HEART_CANDY_5
@ SPELL_CREATE_HEART_CANDY_2
@ SPELL_CREATE_HEART_CANDY_3
@ SPELL_CREATE_HEART_CANDY_8
@ SPELL_CREATE_HEART_CANDY_6
@ SPELL_HEAVILY_PERFUMED
@ SPELL_BASKET_CHECK
@ SPELL_ROMANTIC_PICNIC_ACHIEV
@ SPELL_MEAL_PERIODIC
@ SPELL_DRINK_VISUAL
@ SPELL_MEAL_EAT_VISUAL
std::array< uint32, 8 > const CreateHeartCandySpells
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition Containers.h:108
static void VisitWorldObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition CellImpl.h:180