Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
kezan.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 "
ScriptedGossip.h
"
9
#include "
Player.h
"
10
11
/*####
12
## npc_defiant_troll (http://www.wowhead.com/quest=14069)
13
####*/
14
15
enum
DefiantTrollEnum
16
{
17
DEFFIANT_KILL_CREDIT
= 34830,
18
SPELL_LIGHTNING_VISUAL
= 45870,
19
SPELL_ENRAGE
= 45111,
20
QUEST_GOOD_HELP_IS_HARD_TO_FIND
= 14069,
21
GO_DEPOSIT
= 195489,
22
SAY_WORK
= 0
23
};
24
25
class
npc_defiant_troll
:
public
CreatureScript
26
{
27
public
:
28
npc_defiant_troll
() :
CreatureScript
(
"npc_defiant_troll"
) { }
29
30
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
31
{
32
return
new
npc_defiant_trollAI
(creature);
33
}
34
35
struct
npc_defiant_trollAI
:
public
ScriptedAI
36
{
37
npc_defiant_trollAI
(
Creature
* creature) :
ScriptedAI
(creature) { }
38
39
uint32
rebuffTimer
;
40
bool
work
;
41
42
void
Reset
()
OVERRIDE
43
{
44
rebuffTimer
= 0;
45
work
=
false
;
46
me
->CastSpell(
me
,
SPELL_ENRAGE
,
true
);
47
}
48
49
void
MovementInform
(
uint32
/*type*/
,
uint32
id
)
OVERRIDE
50
{
51
if
(
id
== 1)
52
work
=
true
;
53
}
54
55
bool
IsWorking
()
const
{
return
work
; }
56
57
void
UpdateAI
(
uint32
diff)
OVERRIDE
58
{
59
if
(
IsWorking
())
60
me
->HandleEmoteCommand(
EMOTE_ONESHOT_WORK_MINING
);
61
62
if
(
rebuffTimer
<= diff)
63
{
64
Reset
();
65
66
switch
(std::rand() % 2)
67
{
68
case
0:
69
me
->HandleEmoteCommand(
EMOTE_STATE_EXCLAIM
);
70
break
;
71
case
1:
72
me
->HandleEmoteCommand(
EMOTE_STATE_DANCE
);
73
break
;
74
case
2:
75
me
->HandleEmoteCommand(
EMOTE_ONESHOT_NONE
);
76
break
;
77
}
78
rebuffTimer
= 120000;
// Rebuff again in 2 minutes
79
}
80
else
81
rebuffTimer
-= diff;
82
83
if
(!
UpdateVictim
())
84
return
;
85
86
//DoMeleeAttackIfReady();
87
}
88
};
89
90
bool
OnGossipHello
(
Player
* player,
Creature
* creature)
OVERRIDE
91
{
92
if
(player->GetQuestStatus(
QUEST_GOOD_HELP_IS_HARD_TO_FIND
) ==
QUEST_STATUS_INCOMPLETE
&& !
CAST_AI
(
npc_defiant_troll::npc_defiant_trollAI
, creature->AI())->IsWorking())
93
{
94
player->CastSpell(creature,
SPELL_LIGHTNING_VISUAL
,
true
);
95
player->KilledMonsterCredit(
DEFFIANT_KILL_CREDIT
, creature->GetGUID());
96
creature->AI()->Talk(
SAY_WORK
);
97
creature->RemoveAllAuras();
98
99
if
(
GameObject
* deposit = creature->
FindNearestGameObject
(
GO_DEPOSIT
, 20))
100
creature->GetMotionMaster()->MovePoint(1, deposit->GetPositionX() - 1.0f, deposit->GetPositionY(), deposit->GetPositionZ());
101
102
if
(player->GetQuestStatus(
QUEST_GOOD_HELP_IS_HARD_TO_FIND
) ==
QUEST_STATUS_COMPLETE
)
103
player->RemoveAura(
SPELL_LIGHTNING_VISUAL
);
104
105
player->CLOSE_GOSSIP_MENU();
106
107
return
true
;
108
}
109
110
player->CLOSE_GOSSIP_MENU();
111
112
return
false
;
113
}
114
};
115
116
void
AddSC_kezan
()
117
{
118
new
npc_defiant_troll
();
119
}
uint32
std::uint32_t uint32
Definition
Define.h:77
OVERRIDE
#define OVERRIDE
Definition
Define.h:60
Player.h
QUEST_STATUS_INCOMPLETE
@ QUEST_STATUS_INCOMPLETE
Definition
QuestDef.h:89
QUEST_STATUS_COMPLETE
@ QUEST_STATUS_COMPLETE
Definition
QuestDef.h:87
ScriptMgr.h
ScriptedCreature.h
CAST_AI
#define CAST_AI(a, b)
Definition
ScriptedCreature.h:14
ScriptedGossip.h
EMOTE_ONESHOT_WORK_MINING
@ EMOTE_ONESHOT_WORK_MINING
Definition
SharedDefines.h:2297
EMOTE_STATE_DANCE
@ EMOTE_STATE_DANCE
Definition
SharedDefines.h:2139
EMOTE_ONESHOT_NONE
@ EMOTE_ONESHOT_NONE
Definition
SharedDefines.h:2131
EMOTE_STATE_EXCLAIM
@ EMOTE_STATE_EXCLAIM
Definition
SharedDefines.h:2244
SPELL_ENRAGE
@ SPELL_ENRAGE
Definition
alterac_valley.cpp:14
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
Player
Definition
Player.h:1289
WorldObject::FindNearestGameObject
GameObject * FindNearestGameObject(uint32 entry, float range) const
Definition
Object.cpp:2810
npc_defiant_troll
Definition
kezan.cpp:26
npc_defiant_troll::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
kezan.cpp:30
npc_defiant_troll::npc_defiant_troll
npc_defiant_troll()
Definition
kezan.cpp:28
npc_defiant_troll::OnGossipHello
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
Definition
kezan.cpp:90
DefiantTrollEnum
DefiantTrollEnum
Definition
kezan.cpp:16
SAY_WORK
@ SAY_WORK
Definition
kezan.cpp:22
SPELL_ENRAGE
@ SPELL_ENRAGE
Definition
kezan.cpp:19
SPELL_LIGHTNING_VISUAL
@ SPELL_LIGHTNING_VISUAL
Definition
kezan.cpp:18
DEFFIANT_KILL_CREDIT
@ DEFFIANT_KILL_CREDIT
Definition
kezan.cpp:17
QUEST_GOOD_HELP_IS_HARD_TO_FIND
@ QUEST_GOOD_HELP_IS_HARD_TO_FIND
Definition
kezan.cpp:20
GO_DEPOSIT
@ GO_DEPOSIT
Definition
kezan.cpp:21
AddSC_kezan
void AddSC_kezan()
Definition
kezan.cpp:116
ScriptedAI::me
Creature * me
Definition
ScriptedCreature.h:182
ScriptedAI::ScriptedAI
ScriptedAI(Creature *creature)
Definition
ScriptedCreature.cpp:85
npc_defiant_troll::npc_defiant_trollAI
Definition
kezan.cpp:36
npc_defiant_troll::npc_defiant_trollAI::work
bool work
Definition
kezan.cpp:40
npc_defiant_troll::npc_defiant_trollAI::MovementInform
void MovementInform(uint32, uint32 id) OVERRIDE
Definition
kezan.cpp:49
npc_defiant_troll::npc_defiant_trollAI::Reset
void Reset() OVERRIDE
Definition
kezan.cpp:42
npc_defiant_troll::npc_defiant_trollAI::rebuffTimer
uint32 rebuffTimer
Definition
kezan.cpp:39
npc_defiant_troll::npc_defiant_trollAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
kezan.cpp:57
npc_defiant_troll::npc_defiant_trollAI::npc_defiant_trollAI
npc_defiant_trollAI(Creature *creature)
Definition
kezan.cpp:37
npc_defiant_troll::npc_defiant_trollAI::IsWorking
bool IsWorking() const
Definition
kezan.cpp:55
src
server
scripts
Maelstrom
kezan.cpp
Generated on
for Project SkyFire Core by
1.17.0