1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
/*
* Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* ScriptData
SDName: Hinterlands
SD%Complete: 100
SDComment: Quest support: 836
SDCategory: The Hinterlands
EndScriptData */
/* ContentData
npc_00x09hl
EndContentData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "Player.h"
/*######
## npc_00x09hl
######*/
enum eOOX
{
SAY_OOX_START = 0,
SAY_OOX_AGGRO = 1,
SAY_OOX_AMBUSH = 3,
SAY_OOX_AMBUSH_REPLY = 4,
SAY_OOX_END = 5,
QUEST_RESQUE_OOX_09 = 836,
NPC_MARAUDING_OWL = 7808,
NPC_VILE_AMBUSHER = 7809,
FACTION_ESCORTEE_A = 774,
FACTION_ESCORTEE_H = 775
};
class npc_00x09hl : public CreatureScript
{
public:
npc_00x09hl() : CreatureScript("npc_00x09hl") { }
bool OnQuestAccept(Player* player, Creature* creature, const Quest* quest)
{
if (quest->GetQuestId() == QUEST_RESQUE_OOX_09)
{
creature->SetStandState(UNIT_STAND_STATE_STAND);
if (player->GetTeam() == ALLIANCE)
creature->setFaction(FACTION_ESCORTEE_A);
else if (player->GetTeam() == HORDE)
creature->setFaction(FACTION_ESCORTEE_H);
creature->AI()->Talk(SAY_OOX_START, player->GetGUID());
if (npc_00x09hlAI* pEscortAI = CAST_AI(npc_00x09hl::npc_00x09hlAI, creature->AI()))
pEscortAI->Start(false, false, player->GetGUID(), quest);
}
return true;
}
CreatureAI* GetAI(Creature* creature) const
{
return new npc_00x09hlAI(creature);
}
struct npc_00x09hlAI : public npc_escortAI
{
npc_00x09hlAI(Creature* creature) : npc_escortAI(creature) { }
void Reset() { }
void WaypointReached(uint32 waypointId)
{
switch (waypointId)
{
case 26:
Talk(SAY_OOX_AMBUSH);
break;
case 43:
Talk(SAY_OOX_AMBUSH);
break;
case 64:
Talk(SAY_OOX_END);
if (Player* player = GetPlayerForEscort())
player->GroupEventHappens(QUEST_RESQUE_OOX_09, me);
break;
}
}
void WaypointStart(uint32 uiPointId)
{
switch (uiPointId)
{
case 27:
for (uint8 i = 0; i < 3; ++i)
{
const Position src = {147.927444f, -3851.513428f, 130.893f, 0};
Position dst;
me->GetRandomPoint(src, 7.0f, dst);
DoSummon(NPC_MARAUDING_OWL, dst, 25000, TEMPSUMMON_CORPSE_TIMED_DESPAWN);
}
break;
case 44:
for (uint8 i = 0; i < 3; ++i)
{
const Position src = {-141.151581f, -4291.213867f, 120.130f, 0};
Position dst;
me->GetRandomPoint(src, 7.0f, dst);
me->SummonCreature(NPC_VILE_AMBUSHER, dst, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 25000);
}
break;
}
}
void EnterCombat(Unit* who)
{
if (who->GetEntry() == NPC_MARAUDING_OWL || who->GetEntry() == NPC_VILE_AMBUSHER)
return;
Talk(SAY_OOX_AGGRO);
}
void JustSummoned(Creature* summoned)
{
summoned->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
}
};
};
void AddSC_hinterlands()
{
new npc_00x09hl();
}
|