TrinityCore
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{
40 bool Validate(SpellInfo const* /*spellInfo*/) override
41 {
42 return ValidateSpellInfo(
43 {
49 });
50 }
51
52 void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
53 {
54 Unit* target = GetTarget();
56 target->CastSpell(target, SPELL_MEAL_PERIODIC);
57 }
58
59 void OnPeriodic(AuraEffect const* /*aurEff*/)
60 {
61 // Every 5 seconds
62 Unit* target = GetTarget();
63
64 // If our player is no longer sit, remove all auras
65 if (target->GetStandState() != UNIT_STAND_STATE_SIT)
66 {
68 target->RemoveAura(GetAura());
69 return;
70 }
71
72 target->CastSpell(target, SPELL_BASKET_CHECK); // unknown use, it targets Romantic Basket
74
75 bool foundSomeone = false;
76 // For nearby players, check if they have the same aura. If so, cast Romantic Picnic (45123)
77 // required by achievement and "hearts" visual
78 std::list<Player*> playerList;
81 Cell::VisitWorldObjects(target, searcher, INTERACTION_DISTANCE * 2);
82 for (std::list<Player*>::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr)
83 {
84 if (Player* playerFound = (*itr))
85 {
86 if (target != playerFound && playerFound->HasAura(GetId()))
87 {
88 playerFound->CastSpell(playerFound, SPELL_ROMANTIC_PICNIC_ACHIEV, true);
89 target->CastSpell(target, SPELL_ROMANTIC_PICNIC_ACHIEV, true);
90 foundSomeone = true;
91 break;
92 }
93 }
94 }
95
96 if (!foundSomeone && target->HasAura(SPELL_ROMANTIC_PICNIC_ACHIEV))
98 }
99
100 void Register() override
101 {
104 }
105};
106
107/*######
108## Item 21813: Bag of Heart Candies
109######*/
110
112{
122
123std::array<uint32, 8> const CreateHeartCandySpells =
124{
127};
128
129// 26678 - Create Heart Candy
131{
132 bool Validate(SpellInfo const* /*spellInfo*/) override
133 {
135 }
136
137 void HandleScript(SpellEffIndex /*effIndex*/)
138 {
140 }
141
142 void Register() override
143 {
145 }
146};
147
148/*######
149## Quest 24536, 24655: Something Stinks
150######*/
151
153{
156
157// 70192 - Fragrant Air Analysis
159{
160 bool Validate(SpellInfo const* spellInfo) override
161 {
162 return ValidateSpellInfo({ uint32(spellInfo->GetEffect(EFFECT_0).CalcValue()) });
163 }
164
165 void HandleScript(SpellEffIndex /*effIndex*/)
166 {
168 }
169
170 void Register() override
171 {
173 }
174};
175
176// 71507 - Heavily Perfumed
178{
179 bool Validate(SpellInfo const* spellInfo) override
180 {
181 return ValidateSpellInfo({ uint32(spellInfo->GetEffect(EFFECT_0).CalcValue()) });
182 }
183
184 void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
185 {
187 }
188
189 void Register() override
190 {
192 }
193};
194
195// 71508 - Recently Analyzed
197{
198 bool Validate(SpellInfo const* /*spellInfo*/) override
199 {
201 }
202
203 void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
204 {
205 if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
207 }
208
209 void Register() override
210 {
212 }
213};
214
215/*######
216## Quest 24629, 24635, 24636: A Perfect Puff of Perfume & A Cloudlet of Classy Cologne & Bonbon Blitz
217######*/
218
219// 69438 - Sample Satisfaction
221{
222 void OnPeriodic(AuraEffect const* /*aurEff*/)
223 {
224 if (roll_chance_i(30))
225 Remove();
226 }
227
228 void Register() override
229 {
231 }
232};
233
234/*######
235## Quest 24541, 24656: Pilfering Perfume
236######*/
237
239{
241
243 MODEL_GOBLIN_FEMALE = 31003
245
246// 71450 - Crown Parcel Service Uniform
248{
249 bool Validate(SpellInfo const* spellInfo) override
250 {
251 return ValidateSpellInfo({ uint32(spellInfo->GetEffect(EFFECT_0).CalcValue()) });
252 }
253
254 void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
255 {
256 Unit* target = GetTarget();
257 if (target->GetTypeId() == TYPEID_PLAYER)
258 {
259 if (target->GetNativeGender() == GENDER_MALE)
261 else
263 }
264 }
265
266 void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
267 {
269 }
270
271 void Register() override
272 {
275 }
276};
277
278// 71522 - Crown Chemical Co. Supplies
279// 71539 - Crown Chemical Co. Supplies
281{
282 bool Validate(SpellInfo const* /*spellInfo*/) override
283 {
285 }
286
287 void HandleScript(SpellEffIndex /*effIndex*/)
288 {
290 }
291
292 void Register() override
293 {
295 }
296};
297
298/*######
299## Item 49351, 49352: Perfume Neutralizer & Cologne Neutralizer
300######*/
301
302// 68529 - Perfume Immune
303// 68530 - Cologne Immune
305{
306 bool Validate(SpellInfo const* spellInfo) override
307 {
308 return ValidateSpellInfo(
309 {
310 uint32(spellInfo->GetEffect(EFFECT_0).CalcValue()),
311 uint32(spellInfo->GetEffect(EFFECT_1).CalcValue())
312 });
313 }
314
315 void HandleScript(SpellEffIndex /*effIndex*/)
316 {
318 }
319
320 void Register() override
321 {
324 }
325};
326
328{
338}
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint32_t uint32
Definition: Define.h:142
#define INTERACTION_DISTANCE
Definition: ObjectDefines.h:24
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
bool roll_chance_i(int chance)
Definition: Random.h:59
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_1
Definition: SharedDefines.h:31
@ EFFECT_0
Definition: SharedDefines.h:30
@ GENDER_MALE
@ SPELL_EFFECT_SCRIPT_EFFECT
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_EXPIRE
@ SPELL_AURA_DUMMY
@ SPELL_AURA_TRANSFORM
@ SPELL_AURA_PERIODIC_DUMMY
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define AuraEffectPeriodicFn(F, I, N)
Definition: SpellScript.h:2046
#define AuraEffectApplyFn(F, I, N, M)
Definition: SpellScript.h:2029
#define AuraEffectRemoveFn(F, I, N, M)
Definition: SpellScript.h:2040
@ UNIT_STAND_STATE_SIT
Definition: UnitDefines.h:43
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
Definition: SpellScript.h:2039
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition: SpellScript.h:2045
HookList< EffectApplyHandler > AfterEffectApply
Definition: SpellScript.h:2028
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:173
int32 CalcValue(WorldObject const *caster=nullptr, int32 const *basePoints=nullptr, Unit const *target=nullptr, float *variance=nullptr, uint32 castItemId=0, int32 itemLevel=-1) const
Definition: SpellInfo.cpp:495
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition: SpellInfo.h:577
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
Definition: SpellScript.h:839
Unit * GetHitUnit() const
int32 GetEffectValue() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
Definition: Unit.h:627
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3685
void SetStandState(UnitStandStateType state, uint32 animKitID=0)
Definition: Unit.cpp:10100
virtual Gender GetNativeGender() const
Definition: Unit.h:757
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
UnitStandStateType GetStandState() const
Definition: Unit.h:886
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
virtual void SetDisplayId(uint32 displayId, bool setNative=false)
Definition: Unit.cpp:10148
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *spellInfo) override
void AfterRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *spellInfo) override
bool Validate(SpellInfo const *spellInfo) override
void AfterRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
void OnApply(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *spellInfo) override
void AfterApply(AuraEffect const *, AuraEffectHandleModes)
void AfterRemove(AuraEffect const *, AuraEffectHandleModes)
PilferingPerfume
@ SPELL_SERVICE_UNIFORM
@ MODEL_GOBLIN_FEMALE
@ MODEL_GOBLIN_MALE
void AddSC_event_love_is_in_the_air()
CreateHeartCandy
@ 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:109
static void VisitWorldObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:191