TrinityCore
zone_felwood.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 "MotionMaster.h"
20#include "Player.h"
21#include "ScriptedCreature.h"
22#include "SpellScript.h"
23
24/*######
25## npc_whisperwind_lasher
26######*/
27
29{
32 SPELL_STAND = 37752,
37};
38
40{
41public:
42 npc_whisperwind_lasher() : CreatureScript("npc_whisperwind_lasher") { }
43
45 {
46 npc_whisperwind_lasherAI(Creature* creature) : ScriptedAI(creature) { }
47
48 void Reset() override
49 {
50 lasherClicked = false;
51 }
52
53 void OnSpellClick(Unit* clicker, bool spellClickHandled) override
54 {
55 if (!spellClickHandled)
56 return;
57
59 {
63 }
64 else
65 {
66 me->SetUninteractible(true);
67 }
68
73 lasherClicked = true;
74
75 if (Player* player = clicker->ToPlayer())
76 player->KilledMonsterCredit(NPC_WHISPERWIND_LASHER);
77 }
78
79 void UpdateAI(uint32 diff) override
80 {
81 if (!lasherClicked)
82 return;
83
84 events.Update(diff);
85
86 while (uint32 eventId = events.ExecuteEvent())
87 {
88 switch (eventId)
89 {
90 case EVENT_CHECK_OOC:
91 if (!me->IsInCombat())
93 else
95 break;
96 }
97 }
98 }
99
100 private:
102 bool lasherClicked = false;
103 };
104
105 CreatureAI* GetAI(Creature* creature) const override
106 {
107 return new npc_whisperwind_lasherAI(creature);
108 }
109};
110
111/*#####
112# Spell 88254 "Swipe Honey" scripted for quest 27989 "Ruumbo Demands Honey"
113#####*/
114
116{
119 SPELL_BEES = 94064
121
123{
124public:
125 spell_swipe_honey() : SpellScriptLoader("spell_swipe_honey") { }
126
128 {
130 {
131 if (GetCaster()->FindNearestCreature(NPC_HONEY_BUNNY, 5.0f, true))
132 return SPELL_CAST_OK;
134 }
135
136 void HandleDummy(SpellEffIndex /* effIndex */)
137 {
138 if (Creature* honey = GetCaster()->FindNearestCreature(NPC_HONEY_BUNNY, 5.0f, true))
139 {
140 if (Player* player = GetCaster()->ToPlayer())
141 {
142 player->AddItem(ITEM_HONEY_GLOB, 1);
143
144 if (urand(1, 100) < 30)
145 honey->CastSpell(player, SPELL_BEES);
146 else
147 honey->DespawnOrUnsummon();
148 }
149 }
150 }
151
152 void Register() override
153 {
156 }
157 };
158
159 SpellScript* GetSpellScript() const override
160 {
162 }
163};
164
165/*#####
166# Spell 88425 "Bees! BEES!" scripted for quest 27989 "Ruumbo Demands Honey"
167#####*/
168
170{
172 SPELL_BEES_BEES = 88425
174
176{
177public: spell_beesbees() : SpellScriptLoader("spell_beesbees") { }
178
180 {
182 {
183 if (Creature* honey = GetCaster()->ToCreature())
184 {
185 if (Player* player = GetHitPlayer())
186 {
187 honey->AI()->Talk(BOSS_EMOTE_BEES, player);
188 honey->CastSpell(player, SPELL_BEES_BEES);
189 honey->DespawnOrUnsummon();
190 }
191 }
192 }
193
194 void Register() override
195 {
197 }
198 };
199
200 SpellScript* GetSpellScript() const override
201 {
202 return new spell_beesbees_SpellScript();
203 }
204};
205
206/*#####
207# Spell 88665 "Ruumbo's Silly Dance" scripted for quest 27995 "Dance for Ruumbo!"
208#####*/
209
211{
212 NPC_DRIZZLE = 47556,
213 NPC_FERLI = 47558,
214 MAP_KALIMDOR = 1
216
217Position const DrizzleSpawnPos = { 3852.52f, -1321.92f, 213.3353f, 5.72468f };
218Position const FerliSpawnPos = { 3850.44f, -1323.34f, 213.2113f, 5.637414f };
219
221{
222public: spell_ruumbos_silly_dance() : SpellScriptLoader("spell_ruumbos_silly_dance") { }
223
225 {
227 {
228 if (Player* player = GetHitPlayer())
229 {
230 player->SetEmoteState(EMOTE_STATE_DANCE);
231
232 if (player->GetMapId() == MAP_KALIMDOR)
233 {
234 player->SummonCreature(NPC_DRIZZLE, DrizzleSpawnPos, TEMPSUMMON_TIMED_DESPAWN, 20s);
235 player->SummonCreature(NPC_FERLI, FerliSpawnPos, TEMPSUMMON_TIMED_DESPAWN, 20s);
236 }
237 }
238 }
239
240 void Register() override
241 {
243 }
244 };
245
246 SpellScript* GetSpellScript() const override
247 {
249 }
250};
251
253{
255 new spell_swipe_honey();
256 new spell_beesbees();
258}
uint32_t uint32
Definition: Define.h:142
@ TEMPSUMMON_TIMED_DESPAWN
Definition: ObjectDefines.h:65
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
bool roll_chance_i(int chance)
Definition: Random.h:59
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_0
Definition: SharedDefines.h:30
@ EMOTE_STATE_DANCE
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
SpellCastResult
@ SPELL_FAILED_OUT_OF_RANGE
@ SPELL_CAST_OK
#define SpellCheckCastFn(F)
Definition: SpellScript.h:830
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
@ UNIT_NPC_FLAG_SPELLCLICK
Definition: UnitDefines.h:321
Creature *const me
Definition: CreatureAI.h:61
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void MoveRandom(float wanderDistance=0.0f, Optional< Milliseconds > duration={}, MovementSlot slot=MOTION_SLOT_DEFAULT)
void SetEntry(uint32 entry)
Definition: Object.h:162
static Player * ToPlayer(Object *o)
Definition: Object.h:213
HookList< CheckCastHandler > OnCheckCast
Definition: SpellScript.h:829
Player * GetHitPlayer() const
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
Definition: Unit.h:627
void SetFaction(uint32 faction) override
Definition: Unit.h:859
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
void RemoveNpcFlag(NPCFlags flags)
Definition: Unit.h:983
void SetUninteractible(bool apply)
Definition: Unit.cpp:8147
bool IsInCombat() const
Definition: Unit.h:1043
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
CreatureAI * GetAI(Creature *creature) const override
SpellScript * GetSpellScript() const override
SpellScript * GetSpellScript() const override
SpellScript * GetSpellScript() const override
void OnSpellClick(Unit *clicker, bool spellClickHandled) override
Position const FerliSpawnPos
void AddSC_felwood()
RuumbosSillyDance
@ NPC_FERLI
@ MAP_KALIMDOR
@ NPC_DRIZZLE
WhisperwindLasher
@ EVENT_CHECK_OOC
@ NPC_CORRUPTED_LASHER
@ SPELL_INFECTED_WOULD
@ SPELL_STAND
@ NPC_WHISPERWIND_LASHER
@ FACTION_HOSTILE
@ CHANCE_HOSTILE
SwipeHoney
@ ITEM_HONEY_GLOB
@ NPC_HONEY_BUNNY
@ SPELL_BEES
BeesBEES
@ BOSS_EMOTE_BEES
@ SPELL_BEES_BEES
Position const DrizzleSpawnPos