Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
stormstout_brewery.cpp
Go to the documentation of this file.
1
/*
2
* This file is part of Project SkyFire https://www.projectskyfire.org.
3
* See LICENSE.md file for Copyright information
4
*/
5
6
#include "
ScriptMgr.h
"
7
#include "
ScriptedCreature.h
"
8
#include "
stormstout_brewery.h
"
9
#include "
Player.h
"
10
11
enum
Spells
12
{
13
SPELL_SSB_BANANA_BAR
= 107297,
14
SPELL_SSB_BANANA_BAR_REMOVE
= 107347
15
};
16
17
#define SAY_OOK_OOK_1 "Who crashing Ook party!?"
18
19
void
SummonOokOokIfReady
(
InstanceScript
* instance,
Creature
* creature,
Unit
* killer)
20
{
21
instance->
SetData
(
DATA_BANANA_EVENT
,
SPECIAL
);
// Increment DeathCount
22
killer->
SetPower
(
POWER_ALTERNATE_POWER
, instance->
GetData64
(
DATA_BANANA_EVENT
));
23
24
if
(instance->
GetData64
(
DATA_BANANA_EVENT
) > 39)
25
{
26
if
(
Creature
* pOokOok = creature->
FindNearestCreature
(
NPC_OOK_OOK
, 45.0f,
true
))
27
{
28
pOokOok->MonsterYell(
SAY_OOK_OOK_1
,
Language::LANG_UNIVERSAL
, 0);
29
pOokOok->SendPlaySound(28798,
true
);
30
31
pOokOok->GetMotionMaster()->MoveJump(
OokOokLandPos
, pOokOok->GetExactDist2d(
OokOokLandPos
.GetPositionX(),
OokOokLandPos
.GetPositionY()) * 10.0f / 5.0f, 5.0f);
32
pOokOok->SetHomePosition(
OokOokLandPos
);
33
pOokOok->setFaction(14);
34
}
35
killer->
CastSpell
(killer,
SPELL_SSB_BANANA_BAR_REMOVE
,
true
);
36
instance->
SetBossState
(
DATA_BANANA_EVENT
,
DONE
);
37
}
38
};
39
40
void
SummonHoptallusIfReady
(
InstanceScript
* instance,
Creature
* creature,
Unit
* killer)
41
{
42
if
(instance->
GetBossState
(
DATA_RABBIT_EVENT
) ==
DONE
)
43
return
;
44
45
if
(
Creature
* pHoptalus = creature->
FindNearestCreature
(
NPC_HOPTALLUS
, 45.0f,
true
))
46
{
47
pHoptalus->GetMotionMaster()->MoveJump(
HoptallusLandPos
, pHoptalus->GetExactDist2d(
HoptallusLandPos
.GetPositionX(),
HoptallusLandPos
.GetPositionY()) * 10.0f / 5.0f, 5.0f);
48
pHoptalus->SetHomePosition(
HoptallusLandPos
);
49
pHoptalus->setFaction(14);
50
}
51
instance->
SetBossState
(
DATA_RABBIT_EVENT
,
DONE
);
52
};
53
54
class
AreaTrigger_at_ssb_banana_bar
:
public
AreaTriggerScript
55
{
56
public
:
57
AreaTrigger_at_ssb_banana_bar
() :
AreaTriggerScript
(
"at_ssb_banana_bar"
) { }
58
59
bool
OnTrigger
(
Player
* player,
AreaTriggerEntry
const
*
/*trigger*/
)
OVERRIDE
60
{
61
// Only trigger once
62
if
(
InstanceScript
* instance = player->GetInstanceScript())
63
{
64
if
(instance->GetBossState(
DATA_BANANA_EVENT
) ==
DONE
)
65
return
false
;
66
67
if
(player->IsAlive())
68
{
69
player->CastSpell(player,
SPELL_SSB_BANANA_BAR
,
true
);
70
StartBananaEvent
(instance, player);
71
return
true
;
72
}
73
}
74
return
false
;
75
}
76
77
void
StartBananaEvent
(
InstanceScript
* instance,
Player
* player)
78
{
79
instance->
SetData
(
DATA_BANANA_EVENT
,
IN_PROGRESS
);
// Reset DeathCount
80
player->
SetPower
(
POWER_ALTERNATE_POWER
, instance->
GetData64
(
DATA_BANANA_EVENT
));
81
}
82
};
83
84
class
npc_banana_hozen
:
public
CreatureScript
85
{
86
public
:
87
npc_banana_hozen
() :
CreatureScript
(
"npc_banana_hozen"
) { }
88
89
struct
npc_banana_hozenAI
:
public
ScriptedAI
90
{
91
npc_banana_hozenAI
(
Creature
* creature) :
ScriptedAI
(creature)
92
{
93
instance
= creature->
GetInstanceScript
();
94
}
95
96
void
Reset
()
OVERRIDE
{ }
97
98
void
EnterCombat
(
Unit
*
/*who*/
)
OVERRIDE
{ }
99
100
void
JustDied
(
Unit
* killer)
OVERRIDE
101
{
102
if
(
instance
)
103
SummonOokOokIfReady
(
instance
,
me
, killer);
104
}
105
106
void
UpdateAI
(
uint32
diff)
OVERRIDE
107
{
108
if
(
instance
->GetBossState(
DATA_BANANA_EVENT
) ==
DONE
)
109
{
110
if
(
me
->GetEntry() ==
NPC_ANIMAL1
||
me
->GetEntry() ==
NPC_ANIMAL2
)
111
{
112
if
(!
me
->isMoving())
113
{
114
me
->SetSpeed(
MOVE_RUN
, 1.5f);
115
me
->GetMotionMaster()->MovePoint(1,
BananaFleePos
);
116
me
->DespawnOrUnsummon(15000);
117
}
118
}
119
}
120
121
if
(!
UpdateVictim
())
122
return
;
123
124
DoMeleeAttackIfReady
();
125
}
126
127
InstanceScript
*
instance
;
128
};
129
130
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
131
{
132
return
new
npc_banana_hozenAI
(creature);
133
}
134
};
135
136
class
npc_bopper
:
public
CreatureScript
137
{
138
public
:
139
npc_bopper
() :
CreatureScript
(
"npc_bopper"
) { }
140
141
struct
npc_bopperAI
:
public
ScriptedAI
142
{
143
npc_bopperAI
(
Creature
* creature) :
ScriptedAI
(creature)
144
{
145
instance
= creature->
GetInstanceScript
();
146
}
147
148
void
Reset
()
OVERRIDE
{ }
149
150
void
EnterCombat
(
Unit
*
/*who*/
)
OVERRIDE
{ }
151
152
void
JustDied
(
Unit
* killer)
OVERRIDE
153
{
154
if
(
instance
)
155
SummonHoptallusIfReady
(
instance
,
me
, killer);
156
}
157
158
void
UpdateAI
(
uint32
diff)
OVERRIDE
159
{
160
if
(!
UpdateVictim
())
161
return
;
162
163
DoMeleeAttackIfReady
();
164
}
165
166
InstanceScript
*
instance
;
167
};
168
169
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
170
{
171
return
new
npc_bopperAI
(creature);
172
}
173
};
174
175
void
AddSC_stormstout_brewery
()
176
{
177
new
AreaTrigger_at_ssb_banana_bar
();
178
new
npc_banana_hozen
();
179
new
npc_bopper
();
180
}
Spells
Spells
Definition
BattlegroundIC.h:645
uint32
std::uint32_t uint32
Definition
Define.h:77
OVERRIDE
#define OVERRIDE
Definition
Define.h:60
IN_PROGRESS
@ IN_PROGRESS
Definition
InstanceScript.h:47
DONE
@ DONE
Definition
InstanceScript.h:49
SPECIAL
@ SPECIAL
Definition
InstanceScript.h:50
Player.h
ScriptMgr.h
ScriptedCreature.h
POWER_ALTERNATE_POWER
@ POWER_ALTERNATE_POWER
Definition
SharedDefines.h:225
Language::LANG_UNIVERSAL
@ LANG_UNIVERSAL
Definition
SharedDefines.h:839
MOVE_RUN
@ MOVE_RUN
Definition
Unit.h:556
AreaTrigger_at_ssb_banana_bar
Definition
stormstout_brewery.cpp:55
AreaTrigger_at_ssb_banana_bar::OnTrigger
bool OnTrigger(Player *player, AreaTriggerEntry const *) OVERRIDE
Definition
stormstout_brewery.cpp:59
AreaTrigger_at_ssb_banana_bar::StartBananaEvent
void StartBananaEvent(InstanceScript *instance, Player *player)
Definition
stormstout_brewery.cpp:77
AreaTrigger_at_ssb_banana_bar::AreaTrigger_at_ssb_banana_bar
AreaTrigger_at_ssb_banana_bar()
Definition
stormstout_brewery.cpp:57
AreaTriggerScript::AreaTriggerScript
AreaTriggerScript(const char *name)
Definition
ScriptMgr.cpp:1448
CreatureAI
Definition
CreatureAI.h:54
CreatureAI::UpdateVictim
bool UpdateVictim()
Definition
CreatureAI.cpp:192
Creature
Definition
Creature.h:427
CreatureScript::CreatureScript
CreatureScript(const char *name)
Definition
ScriptMgr.cpp:1436
InstanceScript
Definition
InstanceScript.h:123
InstanceScript::SetBossState
virtual bool SetBossState(uint32 id, EncounterState state)
Definition
InstanceScript.cpp:182
InstanceScript::GetBossState
EncounterState GetBossState(uint32 id) const
Definition
InstanceScript.h:185
Player
Definition
Player.h:1289
UnitAI::DoMeleeAttackIfReady
void DoMeleeAttackIfReady()
Definition
UnitAI.cpp:28
Unit
Definition
Unit.h:1367
Unit::CastSpell
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, uint64 originalCaster=0)
Definition
UnitCombat.cpp:324
Unit::SetPower
void SetPower(Powers power, int32 val)
Definition
Unit.cpp:5255
WorldObject::GetInstanceScript
InstanceScript * GetInstanceScript()
Definition
Object.cpp:1612
WorldObject::FindNearestCreature
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition
Object.cpp:2801
ZoneScript::SetData
virtual void SetData(uint32, uint32)
Definition
ZoneScript.h:37
ZoneScript::GetData64
virtual uint64 GetData64(uint32) const
Definition
ZoneScript.h:32
npc_banana_hozen
Definition
stormstout_brewery.cpp:85
npc_banana_hozen::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
stormstout_brewery.cpp:130
npc_banana_hozen::npc_banana_hozen
npc_banana_hozen()
Definition
stormstout_brewery.cpp:87
npc_bopper
Definition
stormstout_brewery.cpp:137
npc_bopper::npc_bopper
npc_bopper()
Definition
stormstout_brewery.cpp:139
npc_bopper::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
stormstout_brewery.cpp:169
AddSC_stormstout_brewery
void AddSC_stormstout_brewery()
Definition
stormstout_brewery.cpp:175
SummonOokOokIfReady
void SummonOokOokIfReady(InstanceScript *instance, Creature *creature, Unit *killer)
Definition
stormstout_brewery.cpp:19
SPELL_SSB_BANANA_BAR
@ SPELL_SSB_BANANA_BAR
Definition
stormstout_brewery.cpp:13
SPELL_SSB_BANANA_BAR_REMOVE
@ SPELL_SSB_BANANA_BAR_REMOVE
Definition
stormstout_brewery.cpp:14
SAY_OOK_OOK_1
#define SAY_OOK_OOK_1
Definition
stormstout_brewery.cpp:17
SummonHoptallusIfReady
void SummonHoptallusIfReady(InstanceScript *instance, Creature *creature, Unit *killer)
Definition
stormstout_brewery.cpp:40
stormstout_brewery.h
BananaFleePos
Position const BananaFleePos
Definition
stormstout_brewery.h:39
OokOokLandPos
Position const OokOokLandPos
Definition
stormstout_brewery.h:38
HoptallusLandPos
Position const HoptallusLandPos
Definition
stormstout_brewery.h:41
NPC_OOK_OOK
@ NPC_OOK_OOK
Definition
stormstout_brewery.h:25
NPC_HOPTALLUS
@ NPC_HOPTALLUS
Definition
stormstout_brewery.h:29
NPC_ANIMAL2
@ NPC_ANIMAL2
Definition
stormstout_brewery.h:27
NPC_ANIMAL1
@ NPC_ANIMAL1
Definition
stormstout_brewery.h:26
DATA_RABBIT_EVENT
@ DATA_RABBIT_EVENT
Definition
stormstout_brewery.h:18
DATA_BANANA_EVENT
@ DATA_BANANA_EVENT
Definition
stormstout_brewery.h:16
AreaTriggerEntry
Definition
DBCStructure.h:716
ScriptedAI::me
Creature * me
Definition
ScriptedCreature.h:182
ScriptedAI::ScriptedAI
ScriptedAI(Creature *creature)
Definition
ScriptedCreature.cpp:85
npc_banana_hozen::npc_banana_hozenAI
Definition
stormstout_brewery.cpp:90
npc_banana_hozen::npc_banana_hozenAI::EnterCombat
void EnterCombat(Unit *) OVERRIDE
Definition
stormstout_brewery.cpp:98
npc_banana_hozen::npc_banana_hozenAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
stormstout_brewery.cpp:106
npc_banana_hozen::npc_banana_hozenAI::npc_banana_hozenAI
npc_banana_hozenAI(Creature *creature)
Definition
stormstout_brewery.cpp:91
npc_banana_hozen::npc_banana_hozenAI::JustDied
void JustDied(Unit *killer) OVERRIDE
Definition
stormstout_brewery.cpp:100
npc_banana_hozen::npc_banana_hozenAI::Reset
void Reset() OVERRIDE
Definition
stormstout_brewery.cpp:96
npc_banana_hozen::npc_banana_hozenAI::instance
InstanceScript * instance
Definition
stormstout_brewery.cpp:127
npc_bopper::npc_bopperAI
Definition
stormstout_brewery.cpp:142
npc_bopper::npc_bopperAI::instance
InstanceScript * instance
Definition
stormstout_brewery.cpp:166
npc_bopper::npc_bopperAI::npc_bopperAI
npc_bopperAI(Creature *creature)
Definition
stormstout_brewery.cpp:143
npc_bopper::npc_bopperAI::JustDied
void JustDied(Unit *killer) OVERRIDE
Definition
stormstout_brewery.cpp:152
npc_bopper::npc_bopperAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
stormstout_brewery.cpp:158
npc_bopper::npc_bopperAI::Reset
void Reset() OVERRIDE
Definition
stormstout_brewery.cpp:148
npc_bopper::npc_bopperAI::EnterCombat
void EnterCombat(Unit *) OVERRIDE
Definition
stormstout_brewery.cpp:150
src
server
scripts
Pandaria
StormstoutBrewery
stormstout_brewery.cpp
Generated on
for Project SkyFire Core by
1.17.0