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 "Containers.h"
20#include "CreatureAIImpl.h"
21#include "Player.h"
22#include "SpellAuraEffects.h"
23#include "SpellScript.h"
24
26{
27 SPELL_BASKET_CHECK = 45119, // Holiday - Valentine - Romantic Picnic Near Basket Check
28 SPELL_MEAL_PERIODIC = 45103, // Holiday - Valentine - Romantic Picnic Meal Periodic - effect dummy
29 SPELL_MEAL_EAT_VISUAL = 45120, // Holiday - Valentine - Romantic Picnic Meal Eat Visual
30 // SPELL_MEAL_PARTICLE = 45114, // Holiday - Valentine - Romantic Picnic Meal Particle - unused
31 SPELL_DRINK_VISUAL = 45121, // Holiday - Valentine - Romantic Picnic Drink Visual
32 SPELL_ROMANTIC_PICNIC_ACHIEV = 45123, // Romantic Picnic periodic = 5000
33};
34
35// 45102 - Romantic Picnic
37{
38 bool Validate(SpellInfo const* /*spellInfo*/) override
39 {
40 return ValidateSpellInfo(
41 {
47 });
48 }
49
50 void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
51 {
52 Unit* target = GetTarget();
54 target->CastSpell(target, SPELL_MEAL_PERIODIC);
55 }
56
57 void OnPeriodic(AuraEffect const* /*aurEff*/)
58 {
59 // Every 5 seconds
60 Unit* target = GetTarget();
61
62 // If our player is no longer sit, remove all auras
63 if (target->GetStandState() != UNIT_STAND_STATE_SIT)
64 {
66 target->RemoveAura(GetAura());
67 return;
68 }
69
70 target->CastSpell(target, SPELL_BASKET_CHECK); // unknown use, it targets Romantic Basket
72
73 bool foundSomeone = false;
74 // For nearby players, check if they have the same aura. If so, cast Romantic Picnic (45123)
75 // required by achievement and "hearts" visual
76 std::vector<Player*> playerList;
77 target->GetPlayerListInGrid(playerList, INTERACTION_DISTANCE * 2);
78 for (Player* playerFound : playerList)
79 {
80 if (target != playerFound && playerFound->HasAura(GetId()))
81 {
82 playerFound->CastSpell(playerFound, SPELL_ROMANTIC_PICNIC_ACHIEV, true);
83 target->CastSpell(target, SPELL_ROMANTIC_PICNIC_ACHIEV, true);
84 foundSomeone = true;
85 break;
86 }
87 }
88
89 if (!foundSomeone && target->HasAura(SPELL_ROMANTIC_PICNIC_ACHIEV))
91 }
92
98};
99
100/*######
101## Item 21813: Bag of Heart Candies
102######*/
103
115
121
122// 26678 - Create Heart Candy
140
141/*######
142## Quest 24536, 24655: Something Stinks
143######*/
144
149
150// 70192 - Fragrant Air Analysis
168
169// 71507 - Heavily Perfumed
171{
172 bool Validate(SpellInfo const* spellInfo) override
173 {
174 return ValidateSpellInfo({ uint32(spellInfo->GetEffect(EFFECT_0).CalcValueAsInt()) });
175 }
176
177 void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
178 {
179 GetTarget()->CastSpell(GetTarget(), uint32(GetEffectInfo(EFFECT_0).CalcValueAsInt()));
180 }
181
186};
187
188// 71508 - Recently Analyzed
207
208/*######
209## Quest 24629, 24635, 24636: A Perfect Puff of Perfume & A Cloudlet of Classy Cologne & Bonbon Blitz
210######*/
211
212// 69438 - Sample Satisfaction
226
227/*######
228## Quest 24541, 24656: Pilfering Perfume
229######*/
230
238
239// 71450 - Crown Parcel Service Uniform
270
271// 71522 - Crown Chemical Co. Supplies
272// 71539 - Crown Chemical Co. Supplies
290
291/*######
292## Item 49351, 49352: Perfume Neutralizer & Cologne Neutralizer
293######*/
294
295// 68529 - Perfume Immune
296// 68530 - Cologne Immune
319
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint32_t uint32
Definition Define.h:154
#define INTERACTION_DISTANCE
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
bool roll_chance(T chance)
Definition Random.h:55
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ 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)
#define AuraEffectPeriodicFn(F, I, N)
#define AuraEffectApplyFn(F, I, N, M)
#define AuraEffectRemoveFn(F, I, N, M)
@ UNIT_STAND_STATE_SIT
Definition UnitDefines.h:43
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
uint32 GetId() const
TypeID GetTypeId() const
Definition BaseEntity.h:166
int32 CalcValueAsInt(WorldObject const *caster=nullptr, SpellEffectValue const *basePoints=nullptr, Unit const *target=nullptr, float *variance=nullptr, uint32 castItemId=0, int32 itemLevel=-1) const
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition SpellInfo.h:588
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetCaster() const
int32 GetEffectValueAsInt() const
HookList< EffectHandler > OnEffectHit
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Definition Unit.h:635
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3828
void SetStandState(UnitStandStateType state, uint32 animKitID=0)
Definition Unit.cpp:10731
virtual Gender GetNativeGender() const
Definition Unit.h:769
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4804
UnitStandStateType GetStandState() const
Definition Unit.h:900
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3974
virtual void SetDisplayId(uint32 displayId, bool setNative=false)
Definition Unit.cpp:10779
void GetPlayerListInGrid(Container &playerContainer, float maxSearchRange, bool alive=true) const
Definition Object.cpp:2678
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
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)
@ 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) -> std::add_const_t< decltype(*std::ranges::begin(container))> &
Definition Containers.h:110