TrinityCore
Loading...
Searching...
No Matches
zone_darkshore.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/* ScriptData
19SDName: Darkshore
20SD%Complete: 100
21SDComment: Quest support: 731, 5321
22SDCategory: Darkshore
23EndScriptData */
24
25/* ContentData
26npc_kerlonian
27npc_prospector_remtravel
28EndContentData */
29
30#include "ScriptMgr.h"
31#include "ScriptedCreature.h"
32#include "ScriptedGossip.h"
33#include "ScriptedEscortAI.h"
34#include "ScriptedFollowerAI.h"
35#include "Player.h"
36#include "SpellInfo.h"
37
38/*####
39# npc_kerlonian
40####*/
41
56
59{
60public:
61 npc_kerlonian() : CreatureScript("npc_kerlonian") { }
62
64 {
65 npc_kerlonianAI(Creature* creature) : FollowerAI(creature)
66 {
67 Initialize();
68 }
69
71 {
72 FallAsleepTimer = urand(10000, 45000);
73 }
74
76
77 void Reset() override
78 {
79 Initialize();
80 }
81
82 void MoveInLineOfSight(Unit* who) override
83
84 {
86
88 {
90 {
91 if (Player* player = GetLeaderForFollower())
92 {
93 if (player->GetQuestStatus(QUEST_SLEEPER_AWAKENED) == QUEST_STATUS_INCOMPLETE)
94 player->GroupEventHappens(QUEST_SLEEPER_AWAKENED, me);
95
97 }
98
100 }
101 }
102 }
103
104 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
105 {
108 }
109
111 {
112 SetFollowPaused(true);
113
115
117
120 }
121
131
132 void UpdateFollowerAI(uint32 diff) override
133 {
134 if (!UpdateVictim())
135 {
137 return;
138
140 {
141 if (FallAsleepTimer <= diff)
142 {
143 SetSleeping();
144 FallAsleepTimer = urand(25000, 90000);
145 }
146 else
147 FallAsleepTimer -= diff;
148 }
149
150 return;
151 }
152
154 }
155
156 void OnQuestAccept(Player* player, Quest const* quest) override
157 {
158 if (quest->GetQuestId() == QUEST_SLEEPER_AWAKENED)
159 {
161 Talk(SAY_KER_START, player);
163 }
164 }
165 };
166
167 CreatureAI* GetAI(Creature* creature) const override
168 {
169 return new npc_kerlonianAI(creature);
170 }
171};
172
173/*####
174# npc_prospector_remtravel
175####*/
176
198
200
202{
203public:
204 npc_prospector_remtravel() : CreatureScript("npc_prospector_remtravel") { }
205
207 {
209
210 void Reset() override { }
211
212 void JustEngagedWith(Unit* who) override
213 {
214 if (urand(0, 1))
215 Talk(SAY_REM_AGGRO, who);
216 }
217
218 void JustSummoned(Creature* /*pSummoned*/) override
219 {
220 //unsure if it should be any
221 //pSummoned->AI()->AttackStart(me);
222 }
223
224 void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
225 {
226 if (Player* player = GetPlayerForEscort())
227 {
228 switch (waypointId)
229 {
230 case 0:
231 Talk(SAY_REM_START, player);
232 break;
233 case 5:
234 Talk(SAY_REM_RAMP1_1, player);
235 break;
236 case 6:
239 break;
240 case 9:
241 Talk(SAY_REM_RAMP1_2, player);
242 break;
243 case 14:
244 //depend quest rewarded?
245 Talk(SAY_REM_BOOK, player);
246 break;
247 case 15:
248 Talk(SAY_REM_TENT1_1, player);
249 break;
250 case 16:
253 break;
254 case 17:
255 Talk(SAY_REM_TENT1_2, player);
256 break;
257 case 26:
258 Talk(SAY_REM_MOSS, player);
259 break;
260 case 27:
261 Talk(EMOTE_REM_MOSS, player);
262 break;
263 case 28:
265 break;
266 case 29:
270 break;
271 case 31:
272 Talk(SAY_REM_PROGRESS, player);
273 break;
274 case 41:
275 Talk(SAY_REM_REMEMBER, player);
276 break;
277 case 42:
278 Talk(EMOTE_REM_END, player);
279 player->GroupEventHappens(QUEST_ABSENT_MINDED_PT2, me);
280 break;
281 }
282 }
283 }
284
285 void OnQuestAccept(Player* player, Quest const* quest) override
286 {
287 if (quest->GetQuestId() == QUEST_ABSENT_MINDED_PT2)
288 {
290 Start(false, player->GetGUID());
292 }
293 }
294
295 void JustDied(Unit* /*killer*/) override
296 {
297 if (Player* player = GetPlayerForEscort())
298 player->FailQuest(QUEST_ABSENT_MINDED_PT2);
299 }
300 };
301
302 CreatureAI* GetAI(Creature* creature) const override
303 {
304 return new npc_prospector_remtravelAI(creature);
305 }
306};
307
309{
310 new npc_kerlonian();
312}
uint32_t uint32
Definition Define.h:133
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
#define INTERACTION_DISTANCE
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:107
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
@ STATE_FOLLOW_COMPLETE
@ STATE_FOLLOW_INPROGRESS
@ STATE_FOLLOW_PAUSED
@ FACTION_ESCORTEE_N_NEUTRAL_PASSIVE
@ FACTION_ESCORTEE_A_NEUTRAL_PASSIVE
@ UNIT_STAND_STATE_SLEEP
Definition UnitDefines.h:37
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:34
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void StartFollow(Player *player, uint32 factionForFollower=0, uint32 quest=0)
void MoveInLineOfSight(Unit *) override
Player * GetLeaderForFollower()
void SetFollowComplete(bool withEndEvent=false)
bool HasFollowState(uint32 uiFollowState) const
void SetFollowPaused(bool paused)
uint32 GetEntry() const
Definition Object.h:81
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
uint32 GetQuestId() const
Definition QuestDef.h:229
uint32 Id
Definition SpellInfo.h:289
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
void SetFaction(uint32 faction) override
Definition Unit.h:974
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
Unit * GetVictim() const
Definition Unit.h:859
void SetStandState(UnitStandStateType state)
Definition Unit.cpp:10363
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1192
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
void Start(bool isActiveAttacker=true, ObjectGuid playerGUID=ObjectGuid::Empty, Quest const *quest=nullptr, bool instantRespawn=false, bool canLoopPath=false)
void LoadPath(uint32 pathId)
Player * GetPlayerForEscort()
Creature * DoSpawnCreature(uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, Milliseconds despawntime)
npc_kerlonianAI(Creature *creature)
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
void OnQuestAccept(Player *player, Quest const *quest) override
void MoveInLineOfSight(Unit *who) override
void UpdateFollowerAI(uint32 diff) override
void OnQuestAccept(Player *player, Quest const *quest) override
void WaypointReached(uint32 waypointId, uint32) override
Kerlonian
@ SPELL_SLEEP_VISUAL
@ SAY_KER_ALERT_1
@ QUEST_SLEEPER_AWAKENED
@ SPELL_AWAKEN
@ NPC_LILADRIS
@ SAY_KER_SLEEP
@ SAY_KER_START
@ EMOTE_KER_AWAKEN
@ EMOTE_KER_SLEEP
@ SAY_KER_END
static constexpr uint32 PATH_ESCORT_PROSPECTOR_REMTRAVEL
@ SAY_REM_MOSS_PROGRESS
@ EMOTE_REM_MOSS
@ NPC_GRAVEL_GEO
@ EMOTE_REM_END
@ SAY_REM_RAMP1_2
@ SAY_REM_MOSS
@ SAY_REM_RAMP1_1
@ SAY_REM_START
@ NPC_GRAVEL_BONE
@ SAY_REM_BOOK
@ SAY_REM_TENT1_2
@ SAY_REM_REMEMBER
@ SAY_REM_TENT1_1
@ SAY_REM_AGGRO
@ NPC_GRAVEL_SCOUT
@ QUEST_ABSENT_MINDED_PT2
@ SAY_REM_PROGRESS
void AddSC_darkshore()