Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
zone_desolace.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: Desolace
8
SD%Complete: 100
9
SDComment: Quest support: 5561, 5581
10
SDCategory: Desolace
11
EndScriptData */
12
13
/* ContentData
14
npc_aged_dying_ancient_kodo
15
go_demon_portal
16
EndContentData */
17
18
#include "
ScriptMgr.h
"
19
#include "
ScriptedCreature.h
"
20
#include "
ScriptedGossip.h
"
21
#include "
ScriptedEscortAI.h
"
22
#include "
Player.h
"
23
#include "
SpellInfo.h
"
24
25
enum
DyingKodo
26
{
27
SAY_SMEED_HOME
= 0,
28
29
QUEST_KODO
= 5561,
30
31
NPC_SMEED
= 11596,
32
NPC_AGED_KODO
= 4700,
33
NPC_DYING_KODO
= 4701,
34
NPC_ANCIENT_KODO
= 4702,
35
NPC_TAMED_KODO
= 11627,
36
37
SPELL_KODO_KOMBO_ITEM
= 18153,
38
SPELL_KODO_KOMBO_PLAYER_BUFF
= 18172,
39
SPELL_KODO_KOMBO_DESPAWN_BUFF
= 18377,
40
SPELL_KODO_KOMBO_GOSSIP
= 18362
41
};
42
43
class
npc_aged_dying_ancient_kodo
:
public
CreatureScript
44
{
45
public
:
46
npc_aged_dying_ancient_kodo
() :
CreatureScript
(
"npc_aged_dying_ancient_kodo"
) { }
47
48
bool
OnGossipHello
(
Player
* player,
Creature
* creature)
OVERRIDE
49
{
50
if
(player->HasAura(
SPELL_KODO_KOMBO_PLAYER_BUFF
) && creature->HasAura(
SPELL_KODO_KOMBO_DESPAWN_BUFF
))
51
{
52
player->TalkedToCreature(creature->GetEntry(), 0);
53
player->RemoveAurasDueToSpell(
SPELL_KODO_KOMBO_PLAYER_BUFF
);
54
}
55
56
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
57
return
true
;
58
}
59
60
struct
npc_aged_dying_ancient_kodoAI
:
public
ScriptedAI
61
{
62
npc_aged_dying_ancient_kodoAI
(
Creature
* creature) :
ScriptedAI
(creature) { }
63
64
void
MoveInLineOfSight
(
Unit
* who)
65
{
66
if
(who->
GetEntry
() ==
NPC_SMEED
&&
me
->IsWithinDistInMap(who, 10.0f) && !
me
->HasAura(
SPELL_KODO_KOMBO_GOSSIP
))
67
{
68
me
->GetMotionMaster()->Clear();
69
DoCast
(
me
,
SPELL_KODO_KOMBO_GOSSIP
,
true
);
70
if
(
Creature
* smeed = who->
ToCreature
())
71
smeed->AI()->Talk(
SAY_SMEED_HOME
);
72
}
73
}
74
75
void
SpellHit
(
Unit
* caster,
SpellInfo
const
* spell)
76
{
77
if
(spell->
Id
==
SPELL_KODO_KOMBO_ITEM
)
78
{
79
if
(!(caster->
HasAura
(
SPELL_KODO_KOMBO_PLAYER_BUFF
) ||
me
->HasAura(
SPELL_KODO_KOMBO_DESPAWN_BUFF
))
80
&& (
me
->GetEntry() ==
NPC_AGED_KODO
||
me
->GetEntry() ==
NPC_DYING_KODO
||
me
->GetEntry() ==
NPC_ANCIENT_KODO
))
81
{
82
caster->
CastSpell
(caster,
SPELL_KODO_KOMBO_PLAYER_BUFF
,
true
);
83
DoCast
(
me
,
SPELL_KODO_KOMBO_DESPAWN_BUFF
,
true
);
84
85
me
->UpdateEntry(
NPC_TAMED_KODO
);
86
me
->GetMotionMaster()->MoveFollow(caster,
PET_FOLLOW_DIST
,
me
->GetFollowAngle());
87
}
88
}
89
else
if
(spell->
Id
==
SPELL_KODO_KOMBO_GOSSIP
)
90
{
91
me
->SetFlag(
UNIT_FIELD_NPC_FLAGS
,
UNIT_NPC_FLAG_GOSSIP
);
92
me
->DespawnOrUnsummon(60000);
93
}
94
}
95
};
96
97
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
98
{
99
return
new
npc_aged_dying_ancient_kodoAI
(creature);
100
}
101
};
102
103
/*######
104
## go_demon_portal
105
######*/
106
107
enum
DemonPortal
108
{
109
NPC_DEMON_GUARDIAN
= 11937,
110
111
QUEST_PORTAL_OF_THE_LEGION
= 5581,
112
};
113
114
class
go_demon_portal
:
public
GameObjectScript
115
{
116
public
:
117
go_demon_portal
() :
GameObjectScript
(
"go_demon_portal"
) { }
118
119
bool
OnGossipHello
(
Player
* player,
GameObject
* go)
120
{
121
if
(player->
GetQuestStatus
(
QUEST_PORTAL_OF_THE_LEGION
) ==
QUEST_STATUS_INCOMPLETE
&& !go->
FindNearestCreature
(
NPC_DEMON_GUARDIAN
, 5.0f,
true
))
122
{
123
if
(
Creature
* guardian = player->
SummonCreature
(
NPC_DEMON_GUARDIAN
, go->
GetPositionX
(), go->
GetPositionY
(), go->
GetPositionZ
(), 0.0f,
TempSummonType::TEMPSUMMON_DEAD_DESPAWN
, 0))
124
guardian->AI()->AttackStart(player);
125
}
126
127
return
true
;
128
}
129
};
130
131
void
AddSC_desolace
()
132
{
133
new
npc_aged_dying_ancient_kodo
();
134
new
go_demon_portal
();
135
}
OVERRIDE
#define OVERRIDE
Definition
Define.h:60
TempSummonType::TEMPSUMMON_DEAD_DESPAWN
@ TEMPSUMMON_DEAD_DESPAWN
Definition
Object.h:74
PET_FOLLOW_DIST
#define PET_FOLLOW_DIST
Definition
PetDefines.h:57
Player.h
QUEST_STATUS_INCOMPLETE
@ QUEST_STATUS_INCOMPLETE
Definition
QuestDef.h:89
ScriptMgr.h
ScriptedCreature.h
ScriptedEscortAI.h
ScriptedGossip.h
SpellInfo.h
UNIT_NPC_FLAG_GOSSIP
@ UNIT_NPC_FLAG_GOSSIP
Definition
Unit.h:687
UNIT_FIELD_NPC_FLAGS
@ UNIT_FIELD_NPC_FLAGS
Definition
UpdateFields.h:107
CreatureAI
Definition
CreatureAI.h:54
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
Object::GetEntry
uint32 GetEntry() const
Definition
Object.h:125
Object::ToCreature
Creature * ToCreature()
Definition
Object.h:207
Player
Definition
Player.h:1289
Player::GetQuestStatus
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition
PlayerQuestState.cpp:1375
SpellInfo
Definition
SpellInfo.h:158
SpellInfo::Id
uint32 Id
Definition
SpellInfo.h:160
UnitAI::DoCast
void DoCast(uint32 spellId)
Definition
UnitAI.cpp:110
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::HasAura
bool HasAura(uint32 spellId, uint64 casterGUID=0, uint64 itemCasterGUID=0, uint32 reqEffMask=0) const
Definition
UnitAuraState.cpp:1182
WorldObject::FindNearestCreature
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition
Object.cpp:2801
WorldObject::SummonCreature
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TempSummonType::TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
Definition
Object.cpp:2703
go_demon_portal
Definition
zone_desolace.cpp:115
go_demon_portal::go_demon_portal
go_demon_portal()
Definition
zone_desolace.cpp:117
go_demon_portal::OnGossipHello
bool OnGossipHello(Player *player, GameObject *go)
Definition
zone_desolace.cpp:119
npc_aged_dying_ancient_kodo
Definition
zone_desolace.cpp:44
npc_aged_dying_ancient_kodo::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
zone_desolace.cpp:97
npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodo
npc_aged_dying_ancient_kodo()
Definition
zone_desolace.cpp:46
npc_aged_dying_ancient_kodo::OnGossipHello
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
Definition
zone_desolace.cpp:48
Position::GetPositionZ
float GetPositionZ() const
Definition
Object.h:330
Position::GetPositionX
float GetPositionX() const
Definition
Object.h:328
Position::GetPositionY
float GetPositionY() const
Definition
Object.h:329
ScriptedAI::me
Creature * me
Definition
ScriptedCreature.h:182
ScriptedAI::ScriptedAI
ScriptedAI(Creature *creature)
Definition
ScriptedCreature.cpp:85
npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI
Definition
zone_desolace.cpp:61
npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::MoveInLineOfSight
void MoveInLineOfSight(Unit *who)
Definition
zone_desolace.cpp:64
npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::SpellHit
void SpellHit(Unit *caster, SpellInfo const *spell)
Definition
zone_desolace.cpp:75
npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::npc_aged_dying_ancient_kodoAI
npc_aged_dying_ancient_kodoAI(Creature *creature)
Definition
zone_desolace.cpp:62
DemonPortal
DemonPortal
Definition
zone_desolace.cpp:108
NPC_DEMON_GUARDIAN
@ NPC_DEMON_GUARDIAN
Definition
zone_desolace.cpp:109
QUEST_PORTAL_OF_THE_LEGION
@ QUEST_PORTAL_OF_THE_LEGION
Definition
zone_desolace.cpp:111
AddSC_desolace
void AddSC_desolace()
Definition
zone_desolace.cpp:131
DyingKodo
DyingKodo
Definition
zone_desolace.cpp:26
SAY_SMEED_HOME
@ SAY_SMEED_HOME
Definition
zone_desolace.cpp:27
SPELL_KODO_KOMBO_GOSSIP
@ SPELL_KODO_KOMBO_GOSSIP
Definition
zone_desolace.cpp:40
NPC_ANCIENT_KODO
@ NPC_ANCIENT_KODO
Definition
zone_desolace.cpp:34
NPC_TAMED_KODO
@ NPC_TAMED_KODO
Definition
zone_desolace.cpp:35
NPC_DYING_KODO
@ NPC_DYING_KODO
Definition
zone_desolace.cpp:33
SPELL_KODO_KOMBO_PLAYER_BUFF
@ SPELL_KODO_KOMBO_PLAYER_BUFF
Definition
zone_desolace.cpp:38
QUEST_KODO
@ QUEST_KODO
Definition
zone_desolace.cpp:29
NPC_SMEED
@ NPC_SMEED
Definition
zone_desolace.cpp:31
NPC_AGED_KODO
@ NPC_AGED_KODO
Definition
zone_desolace.cpp:32
SPELL_KODO_KOMBO_DESPAWN_BUFF
@ SPELL_KODO_KOMBO_DESPAWN_BUFF
Definition
zone_desolace.cpp:39
SPELL_KODO_KOMBO_ITEM
@ SPELL_KODO_KOMBO_ITEM
Definition
zone_desolace.cpp:37
src
server
scripts
Kalimdor
zone_desolace.cpp
Generated on
for Project SkyFire Core by
1.17.0