Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
magisters_terrace.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: Magisters_Terrace
8
SD%Complete: 100
9
SDComment: Quest support: 11490(post-event)
10
SDCategory: Magisters Terrace
11
EndScriptData */
12
13
/* ContentData
14
npc_kalecgos
15
EndContentData */
16
17
#include "
ScriptMgr.h
"
18
#include "
ScriptedCreature.h
"
19
#include "
ScriptedGossip.h
"
20
#include "
Player.h
"
21
#include "
SpellInfo.h
"
22
23
/*######
24
## npc_kalecgos
25
######*/
26
27
enum
Spells
28
{
29
SPELL_TRANSFORM_TO_KAEL
= 44670,
30
SPELL_ORB_KILL_CREDIT
= 46307
31
};
32
33
enum
Creatures
34
{
35
NPC_KAEL
= 24848
//human form entry
36
};
37
38
enum
Misc
39
{
40
POINT_ID_LAND
= 1
41
};
42
43
const
float
afKaelLandPoint
[] = {225.045f, -276.236f, -5.434f};
44
45
#define GOSSIP_ITEM_KAEL_1 "Who are you?"
46
#define GOSSIP_ITEM_KAEL_2 "What can we do to assist you?"
47
#define GOSSIP_ITEM_KAEL_3 "What brings you to the Sunwell?"
48
#define GOSSIP_ITEM_KAEL_4 "You're not alone here?"
49
#define GOSSIP_ITEM_KAEL_5 "What would Kil'jaeden want with a mortal woman?"
50
51
// This is friendly keal that appear after used Orb.
52
// If we assume DB handle summon, summon appear somewhere outside the platform where Orb is
53
class
npc_kalecgos
:
public
CreatureScript
54
{
55
public
:
56
npc_kalecgos
() :
CreatureScript
(
"npc_kalecgos"
) { }
57
58
bool
OnGossipSelect
(
Player
* player,
Creature
* creature,
uint32
/*sender*/
,
uint32
action)
OVERRIDE
59
{
60
player->PlayerTalkClass->ClearMenus();
61
switch
(action)
62
{
63
case
GOSSIP_ACTION_INFO_DEF
:
64
player->ADD_GOSSIP_ITEM(
GOSSIP_ICON_CHAT
,
GOSSIP_ITEM_KAEL_2
,
GOSSIP_SENDER_MAIN
,
GOSSIP_ACTION_INFO_DEF
+ 1);
65
player->SEND_GOSSIP_MENU(12500, creature->GetGUID());
66
break
;
67
case
GOSSIP_ACTION_INFO_DEF
+1:
68
player->ADD_GOSSIP_ITEM(
GOSSIP_ICON_CHAT
,
GOSSIP_ITEM_KAEL_3
,
GOSSIP_SENDER_MAIN
,
GOSSIP_ACTION_INFO_DEF
+ 2);
69
player->SEND_GOSSIP_MENU(12502, creature->GetGUID());
70
break
;
71
case
GOSSIP_ACTION_INFO_DEF
+2:
72
player->ADD_GOSSIP_ITEM(
GOSSIP_ICON_CHAT
,
GOSSIP_ITEM_KAEL_4
,
GOSSIP_SENDER_MAIN
,
GOSSIP_ACTION_INFO_DEF
+ 3);
73
player->SEND_GOSSIP_MENU(12606, creature->GetGUID());
74
break
;
75
case
GOSSIP_ACTION_INFO_DEF
+3:
76
player->ADD_GOSSIP_ITEM(
GOSSIP_ICON_CHAT
,
GOSSIP_ITEM_KAEL_5
,
GOSSIP_SENDER_MAIN
,
GOSSIP_ACTION_INFO_DEF
+ 4);
77
player->SEND_GOSSIP_MENU(12607, creature->GetGUID());
78
break
;
79
case
GOSSIP_ACTION_INFO_DEF
+4:
80
player->SEND_GOSSIP_MENU(12608, creature->GetGUID());
81
break
;
82
}
83
84
return
true
;
85
}
86
87
bool
OnGossipHello
(
Player
* player,
Creature
* creature)
OVERRIDE
88
{
89
if
(creature->IsQuestGiver())
90
player->PrepareQuestMenu(creature->GetGUID());
91
92
player->ADD_GOSSIP_ITEM(
GOSSIP_ICON_CHAT
,
GOSSIP_ITEM_KAEL_1
,
GOSSIP_SENDER_MAIN
,
GOSSIP_ACTION_INFO_DEF
);
93
player->SEND_GOSSIP_MENU(12498, creature->GetGUID());
94
95
return
true
;
96
}
97
98
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
99
{
100
return
new
npc_kalecgosAI
(creature);
101
}
102
103
struct
npc_kalecgosAI
:
public
ScriptedAI
104
{
105
npc_kalecgosAI
(
Creature
* creature) :
ScriptedAI
(creature) { }
106
107
uint32
m_uiTransformTimer
;
108
109
void
Reset
()
OVERRIDE
110
{
111
m_uiTransformTimer
= 0;
112
113
// we must assume he appear as dragon somewhere outside the platform of orb, and then move directly to here
114
if
(
me
->GetEntry() !=
NPC_KAEL
)
115
me
->GetMotionMaster()->MovePoint(
POINT_ID_LAND
,
afKaelLandPoint
[0],
afKaelLandPoint
[1],
afKaelLandPoint
[2]);
116
}
117
118
void
MovementInform
(
uint32
uiType,
uint32
uiPointId)
OVERRIDE
119
{
120
if
(uiType !=
POINT_MOTION_TYPE
)
121
return
;
122
123
if
(uiPointId ==
POINT_ID_LAND
)
124
m_uiTransformTimer
=
MINUTE
*
IN_MILLISECONDS
;
125
}
126
127
// some targeting issues with the spell, so use this workaround as temporary solution
128
void
DoWorkaroundForQuestCredit
()
129
{
130
Map
* map =
me
->GetMap();
131
132
if
(!map || map->
IsHeroic
())
133
return
;
134
135
Map::PlayerList
const
&lList = map->
GetPlayers
();
136
137
if
(lList.
isEmpty
())
138
return
;
139
140
SpellInfo
const
* spell =
sSpellMgr
->GetSpellInfo(
SPELL_ORB_KILL_CREDIT
);
141
142
for
(
Map::PlayerList::const_iterator
i = lList.
begin
(); i != lList.
end
(); ++i)
143
{
144
if
(
Player
* player = i->GetSource())
145
{
146
if
(spell && spell->
Effects
[0].
MiscValue
)
147
player->KilledMonsterCredit(spell->
Effects
[0].
MiscValue
, 0);
148
}
149
}
150
}
151
152
void
UpdateAI
(
uint32
uiDiff)
OVERRIDE
153
{
154
if
(
m_uiTransformTimer
)
155
{
156
if
(
m_uiTransformTimer
<= uiDiff)
157
{
158
DoCast
(
me
,
SPELL_ORB_KILL_CREDIT
,
false
);
159
DoWorkaroundForQuestCredit
();
160
161
// Transform and update entry, now ready for quest/read gossip
162
DoCast
(
me
,
SPELL_TRANSFORM_TO_KAEL
,
false
);
163
me
->UpdateEntry(
NPC_KAEL
);
164
165
m_uiTransformTimer
= 0;
166
}
else
m_uiTransformTimer
-= uiDiff;
167
}
168
}
169
};
170
};
171
172
void
AddSC_magisters_terrace
()
173
{
174
new
npc_kalecgos
();
175
}
Spells
Spells
Definition
BattlegroundIC.h:645
IN_MILLISECONDS
@ IN_MILLISECONDS
Definition
Common.h:125
MINUTE
@ MINUTE
Definition
Common.h:119
uint32
std::uint32_t uint32
Definition
Define.h:77
OVERRIDE
#define OVERRIDE
Definition
Define.h:60
GOSSIP_ICON_CHAT
@ GOSSIP_ICON_CHAT
Definition
GossipDef.h:46
POINT_MOTION_TYPE
@ POINT_MOTION_TYPE
Definition
MotionMaster.h:33
Player.h
ScriptMgr.h
ScriptedCreature.h
ScriptedGossip.h
GOSSIP_SENDER_MAIN
@ GOSSIP_SENDER_MAIN
Definition
ScriptedGossip.h:58
GOSSIP_ACTION_INFO_DEF
@ GOSSIP_ACTION_INFO_DEF
Definition
ScriptedGossip.h:56
SpellInfo.h
sSpellMgr
#define sSpellMgr
Definition
SpellMgr.h:744
Creatures
Creatures
Definition
alterac_valley.cpp:28
Misc
Misc
Definition
boss_occuthar.cpp:37
CreatureAI
Definition
CreatureAI.h:54
Creature
Definition
Creature.h:427
CreatureScript::CreatureScript
CreatureScript(const char *name)
Definition
ScriptMgr.cpp:1436
LinkedListHead::isEmpty
bool isEmpty() const
Definition
LinkedList.h:86
Map
Definition
Map.h:238
Map::PlayerList
MapRefManager PlayerList
Definition
Map.h:406
Map::IsHeroic
bool IsHeroic() const
Definition
Map.cpp:3044
Map::GetPlayers
PlayerList const & GetPlayers() const
Definition
Map.h:407
MapRefManager::end
iterator end()
Definition
MapRefManager.h:25
MapRefManager::begin
iterator begin()
Definition
MapRefManager.h:24
MapRefManager::const_iterator
LinkedListHead::Iterator< MapReference const > const_iterator
Definition
MapRefManager.h:17
Player
Definition
Player.h:1289
SpellEffectInfo::MiscValue
int32 MiscValue
Definition
SpellInfo.h:99
SpellInfo
Definition
SpellInfo.h:158
SpellInfo::Effects
SpellEffectInfo Effects[MAX_SPELL_EFFECTS]
Definition
SpellInfo.h:255
UnitAI::DoCast
void DoCast(uint32 spellId)
Definition
UnitAI.cpp:110
npc_kalecgos
Definition
magisters_terrace.cpp:54
npc_kalecgos::npc_kalecgos
npc_kalecgos()
Definition
magisters_terrace.cpp:56
npc_kalecgos::OnGossipHello
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
Definition
magisters_terrace.cpp:87
npc_kalecgos::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
magisters_terrace.cpp:98
npc_kalecgos::OnGossipSelect
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32 action) OVERRIDE
Definition
magisters_terrace.cpp:58
afKaelLandPoint
const float afKaelLandPoint[]
Definition
magisters_terrace.cpp:43
GOSSIP_ITEM_KAEL_2
#define GOSSIP_ITEM_KAEL_2
Definition
magisters_terrace.cpp:46
NPC_KAEL
@ NPC_KAEL
Definition
magisters_terrace.cpp:35
GOSSIP_ITEM_KAEL_1
#define GOSSIP_ITEM_KAEL_1
Definition
magisters_terrace.cpp:45
POINT_ID_LAND
@ POINT_ID_LAND
Definition
magisters_terrace.cpp:40
GOSSIP_ITEM_KAEL_5
#define GOSSIP_ITEM_KAEL_5
Definition
magisters_terrace.cpp:49
SPELL_ORB_KILL_CREDIT
@ SPELL_ORB_KILL_CREDIT
Definition
magisters_terrace.cpp:30
SPELL_TRANSFORM_TO_KAEL
@ SPELL_TRANSFORM_TO_KAEL
Definition
magisters_terrace.cpp:29
GOSSIP_ITEM_KAEL_3
#define GOSSIP_ITEM_KAEL_3
Definition
magisters_terrace.cpp:47
GOSSIP_ITEM_KAEL_4
#define GOSSIP_ITEM_KAEL_4
Definition
magisters_terrace.cpp:48
AddSC_magisters_terrace
void AddSC_magisters_terrace()
Definition
magisters_terrace.cpp:172
ScriptedAI::me
Creature * me
Definition
ScriptedCreature.h:182
ScriptedAI::ScriptedAI
ScriptedAI(Creature *creature)
Definition
ScriptedCreature.cpp:85
npc_kalecgos::npc_kalecgosAI
Definition
magisters_terrace.cpp:104
npc_kalecgos::npc_kalecgosAI::UpdateAI
void UpdateAI(uint32 uiDiff) OVERRIDE
== Triggered Actions Requested ==================
Definition
magisters_terrace.cpp:152
npc_kalecgos::npc_kalecgosAI::DoWorkaroundForQuestCredit
void DoWorkaroundForQuestCredit()
Definition
magisters_terrace.cpp:128
npc_kalecgos::npc_kalecgosAI::npc_kalecgosAI
npc_kalecgosAI(Creature *creature)
Definition
magisters_terrace.cpp:105
npc_kalecgos::npc_kalecgosAI::m_uiTransformTimer
uint32 m_uiTransformTimer
Definition
magisters_terrace.cpp:107
npc_kalecgos::npc_kalecgosAI::MovementInform
void MovementInform(uint32 uiType, uint32 uiPointId) OVERRIDE
Definition
magisters_terrace.cpp:118
npc_kalecgos::npc_kalecgosAI::Reset
void Reset() OVERRIDE
Definition
magisters_terrace.cpp:109
src
server
scripts
EasternKingdoms
MagistersTerrace
magisters_terrace.cpp
Generated on
for Project SkyFire Core by
1.17.0