Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
razorfen_downs.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
/* ScriptData
7
SDName: Razorfen_Downs
8
SD%Complete: 100
9
SDComment: Support for Henry Stern(2 recipes)
10
SDCategory: Razorfen Downs
11
EndScriptData */
12
13
/* ContentData
14
npc_henry_stern
15
EndContentData */
16
17
#include "
ScriptMgr.h
"
18
#include "
ScriptedCreature.h
"
19
#include "
ScriptedGossip.h
"
20
#include "
razorfen_downs.h
"
21
#include "
Player.h
"
22
23
/*###
24
# npc_henry_stern
25
####*/
26
27
enum
Spells
28
{
29
SPELL_TEACHING_GOLDTHORN_TEA
= 13029,
30
SPELL_TEACHING_MIGHTY_TROLLS_BLOOD_POTION
= 13030
31
};
32
33
enum
Gossips
34
{
35
GOSSIP_COOKING_SKILL_HIGH
= 1444,
36
GOSSIP_COOKING_SKILL_LOW
= 1501,
37
GOSSIP_ALCHEMY_SKILL_HIGH
= 1442,
38
GOSSIP_ALCHEMY_SKILL_LOW
= 1502
39
};
40
41
class
npc_henry_stern
:
public
CreatureScript
42
{
43
public
:
44
npc_henry_stern
() :
CreatureScript
(
"npc_henry_stern"
) { }
45
46
struct
npc_henry_sternAI
:
public
ScriptedAI
47
{
48
npc_henry_sternAI
(
Creature
* creature) :
ScriptedAI
(creature) { }
49
50
void
sGossipSelect
(
Player
* player,
uint32
/*sender*/
,
uint32
action)
OVERRIDE
51
{
52
if
(action == 0)
53
{
54
if
(player->GetBaseSkillValue(
SKILL_COOKING
) >= 175)
55
{
56
player->PrepareGossipMenu(
me
,
GOSSIP_COOKING_SKILL_HIGH
);
57
player->SendPreparedGossip(
me
);
58
DoCast
(player,
SPELL_TEACHING_GOLDTHORN_TEA
);
59
}
60
else
61
{
62
player->PrepareGossipMenu(
me
,
GOSSIP_COOKING_SKILL_LOW
);
63
player->SendPreparedGossip(
me
);
64
}
65
}
66
67
if
(action == 1)
68
{
69
if
(player->GetBaseSkillValue(
SKILL_ALCHEMY
) >= 180)
70
{
71
player->PrepareGossipMenu(
me
,
GOSSIP_ALCHEMY_SKILL_HIGH
);
72
player->SendPreparedGossip(
me
);
73
DoCast
(player,
SPELL_TEACHING_MIGHTY_TROLLS_BLOOD_POTION
);
74
}
75
else
76
{
77
player->PrepareGossipMenu(
me
,
GOSSIP_ALCHEMY_SKILL_LOW
);
78
player->SendPreparedGossip(
me
);
79
}
80
}
81
}
82
};
83
84
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
85
{
86
return
new
npc_henry_sternAI
(creature);
87
}
88
};
89
90
/*######
91
## go_gong
92
######*/
93
94
class
go_gong
:
public
GameObjectScript
95
{
96
public
:
97
go_gong
() :
GameObjectScript
(
"go_gong"
) { }
98
99
bool
OnGossipHello
(
Player
*
/*player*/
,
GameObject
* go)
OVERRIDE
100
{
101
//basic support, not blizzlike data is missing...
102
InstanceScript
* instance = go->GetInstanceScript();
103
104
if
(instance)
105
{
106
instance->
SetData
(
DATA_GONG_WAVES
, instance->
GetData
(
DATA_GONG_WAVES
)+1);
107
return
true
;
108
}
109
110
return
false
;
111
}
112
};
113
114
enum
TombCreature
115
{
116
SPELL_WEB
= 745
117
};
118
119
class
npc_tomb_creature
:
public
CreatureScript
120
{
121
public
:
122
npc_tomb_creature
() :
CreatureScript
(
"npc_tomb_creature"
) { }
123
124
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
125
{
126
return
new
npc_tomb_creatureAI
(creature);
127
}
128
129
struct
npc_tomb_creatureAI
:
public
ScriptedAI
130
{
131
npc_tomb_creatureAI
(
Creature
* creature) :
ScriptedAI
(creature)
132
{
133
instance
= creature->
GetInstanceScript
();
134
}
135
136
InstanceScript
*
instance
;
137
138
uint32
uiWebTimer
;
139
140
void
Reset
()
OVERRIDE
141
{
142
uiWebTimer
= std::rand() % 8000 + 5000;
143
}
144
145
void
UpdateAI
(
uint32
uiDiff)
OVERRIDE
146
{
147
if
(!
UpdateVictim
())
148
return
;
149
150
//from acid
151
if
(
me
->GetEntry() ==
NPC_TOMB_REAVER
)
152
{
153
if
(
uiWebTimer
<= uiDiff)
154
{
155
DoCastVictim
(
SPELL_WEB
);
156
uiWebTimer
= std::rand() % 16000 + 7000;
157
}
else
uiWebTimer
-= uiDiff;
158
}
159
160
DoMeleeAttackIfReady
();
161
}
162
163
void
JustDied
(
Unit
*
/*killer*/
)
OVERRIDE
164
{
165
if
(
instance
)
166
instance
->SetData(
DATA_GONG_WAVES
,
instance
->GetData(
DATA_GONG_WAVES
)+1);
167
}
168
};
169
};
170
171
void
AddSC_razorfen_downs
()
172
{
173
new
npc_henry_stern
();
174
new
go_gong
();
175
new
npc_tomb_creature
();
176
}
Spells
Spells
Definition
BattlegroundIC.h:645
uint32
std::uint32_t uint32
Definition
Define.h:77
OVERRIDE
#define OVERRIDE
Definition
Define.h:60
Player.h
ScriptMgr.h
ScriptedCreature.h
ScriptedGossip.h
SKILL_COOKING
@ SKILL_COOKING
Definition
SharedDefines.h:3409
SKILL_ALCHEMY
@ SKILL_ALCHEMY
Definition
SharedDefines.h:3404
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
GameObject
Definition
GameObject.h:629
GameObjectScript::GameObjectScript
GameObjectScript(const char *name)
Definition
ScriptMgr.cpp:1442
InstanceScript
Definition
InstanceScript.h:123
Player
Definition
Player.h:1289
UnitAI::DoMeleeAttackIfReady
void DoMeleeAttackIfReady()
Definition
UnitAI.cpp:28
UnitAI::DoCast
void DoCast(uint32 spellId)
Definition
UnitAI.cpp:110
UnitAI::DoCastVictim
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition
UnitAI.cpp:168
Unit
Definition
Unit.h:1367
WorldObject::GetInstanceScript
InstanceScript * GetInstanceScript()
Definition
Object.cpp:1612
ZoneScript::GetData
virtual uint32 GetData(uint32) const
Definition
ZoneScript.h:36
ZoneScript::SetData
virtual void SetData(uint32, uint32)
Definition
ZoneScript.h:37
go_gong
Definition
razorfen_downs.cpp:95
go_gong::go_gong
go_gong()
Definition
razorfen_downs.cpp:97
go_gong::OnGossipHello
bool OnGossipHello(Player *, GameObject *go) OVERRIDE
Definition
razorfen_downs.cpp:99
npc_henry_stern
Definition
razorfen_downs.cpp:42
npc_henry_stern::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
razorfen_downs.cpp:84
npc_henry_stern::npc_henry_stern
npc_henry_stern()
Definition
razorfen_downs.cpp:44
npc_tomb_creature
Definition
razorfen_downs.cpp:120
npc_tomb_creature::npc_tomb_creature
npc_tomb_creature()
Definition
razorfen_downs.cpp:122
npc_tomb_creature::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
razorfen_downs.cpp:124
SPELL_WEB
@ SPELL_WEB
Definition
hyjal_trash.cpp:29
Gossips
Gossips
Definition
razorfen_downs.cpp:34
GOSSIP_COOKING_SKILL_LOW
@ GOSSIP_COOKING_SKILL_LOW
Definition
razorfen_downs.cpp:36
GOSSIP_COOKING_SKILL_HIGH
@ GOSSIP_COOKING_SKILL_HIGH
Definition
razorfen_downs.cpp:35
GOSSIP_ALCHEMY_SKILL_HIGH
@ GOSSIP_ALCHEMY_SKILL_HIGH
Definition
razorfen_downs.cpp:37
GOSSIP_ALCHEMY_SKILL_LOW
@ GOSSIP_ALCHEMY_SKILL_LOW
Definition
razorfen_downs.cpp:38
SPELL_TEACHING_MIGHTY_TROLLS_BLOOD_POTION
@ SPELL_TEACHING_MIGHTY_TROLLS_BLOOD_POTION
Definition
razorfen_downs.cpp:30
SPELL_TEACHING_GOLDTHORN_TEA
@ SPELL_TEACHING_GOLDTHORN_TEA
Definition
razorfen_downs.cpp:29
AddSC_razorfen_downs
void AddSC_razorfen_downs()
Definition
razorfen_downs.cpp:171
TombCreature
TombCreature
Definition
razorfen_downs.cpp:115
SPELL_WEB
@ SPELL_WEB
Definition
razorfen_downs.cpp:116
razorfen_downs.h
NPC_TOMB_REAVER
@ NPC_TOMB_REAVER
Definition
razorfen_downs.h:28
DATA_GONG_WAVES
@ DATA_GONG_WAVES
Definition
razorfen_downs.h:12
ScriptedAI::me
Creature * me
Definition
ScriptedCreature.h:182
ScriptedAI::ScriptedAI
ScriptedAI(Creature *creature)
Definition
ScriptedCreature.cpp:85
npc_henry_stern::npc_henry_sternAI
Definition
razorfen_downs.cpp:47
npc_henry_stern::npc_henry_sternAI::npc_henry_sternAI
npc_henry_sternAI(Creature *creature)
Definition
razorfen_downs.cpp:48
npc_henry_stern::npc_henry_sternAI::sGossipSelect
void sGossipSelect(Player *player, uint32, uint32 action) OVERRIDE
Definition
razorfen_downs.cpp:50
npc_tomb_creature::npc_tomb_creatureAI
Definition
razorfen_downs.cpp:130
npc_tomb_creature::npc_tomb_creatureAI::uiWebTimer
uint32 uiWebTimer
Definition
razorfen_downs.cpp:138
npc_tomb_creature::npc_tomb_creatureAI::UpdateAI
void UpdateAI(uint32 uiDiff) OVERRIDE
== Triggered Actions Requested ==================
Definition
razorfen_downs.cpp:145
npc_tomb_creature::npc_tomb_creatureAI::JustDied
void JustDied(Unit *) OVERRIDE
Definition
razorfen_downs.cpp:163
npc_tomb_creature::npc_tomb_creatureAI::npc_tomb_creatureAI
npc_tomb_creatureAI(Creature *creature)
Definition
razorfen_downs.cpp:131
npc_tomb_creature::npc_tomb_creatureAI::Reset
void Reset() OVERRIDE
Definition
razorfen_downs.cpp:140
npc_tomb_creature::npc_tomb_creatureAI::instance
InstanceScript * instance
Definition
razorfen_downs.cpp:136
src
server
scripts
Kalimdor
RazorfenDowns
razorfen_downs.cpp
Generated on
for Project SkyFire Core by
1.17.0