forked from insider42/scriptdev2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzuldrak.cpp
More file actions
103 lines (85 loc) · 2.92 KB
/
zuldrak.cpp
File metadata and controls
103 lines (85 loc) · 2.92 KB
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
/* Copyright (C) 2006 - 2011 ScriptDev2 <http://www.scriptdev2.com/>
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* ScriptData
SDName: Zuldrak
SD%Complete: 100
SDComment: Quest support: 12934.
SDCategory: Zuldrak
EndScriptData */
/* ContentData
npc_gurgthock
EndContentData */
#include "precompiled.h"
/*######
## npc_gurgthock
######*/
enum
{
QUEST_FROM_BEYOND = 12934,
NPC_AZBARIN = 30026,
NPC_DUKE_SINGEN = 30019,
NPC_ERATHIUS = 30025,
NPC_GARGORAL = 30024
};
static float m_afSpawnLocation[] = {5768.71f, -2969.29f, 273.816f};
static uint32 m_auiBosses[] = {NPC_AZBARIN, NPC_DUKE_SINGEN, NPC_ERATHIUS, NPC_GARGORAL};
struct MANGOS_DLL_DECL npc_gurgthockAI : public ScriptedAI
{
npc_gurgthockAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); }
uint64 m_uiPlayerGUID;
void SetPlayerGUID(uint64 uiPlayerGUID) { m_uiPlayerGUID = uiPlayerGUID; }
void Reset()
{
m_uiPlayerGUID = 0;
}
void SummonedCreatureJustDied(Creature* pSummoned)
{
uint32 uiEntry = pSummoned->GetEntry();
for(uint8 i = 0; i < 4; ++i)
{
if (uiEntry == m_auiBosses[i])
{
if (Player* pPlayer = m_creature->GetMap()->GetPlayer(m_uiPlayerGUID))
pPlayer->GroupEventHappens(QUEST_FROM_BEYOND, m_creature);
m_uiPlayerGUID = 0;
return;
}
}
}
};
bool QuestAccept_npc_gurgthock(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
{
if (pQuest->GetQuestId() == QUEST_FROM_BEYOND)
{
pCreature->SummonCreature(m_auiBosses[urand(0, 3)], m_afSpawnLocation[0], m_afSpawnLocation[1], m_afSpawnLocation[2], 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000);
if (npc_gurgthockAI* pGurthockAI = dynamic_cast<npc_gurgthockAI*>(pCreature->AI()))
pGurthockAI->SetPlayerGUID(pPlayer->GetGUID());
}
return true;
}
CreatureAI* GetAI_npc_gurgthock(Creature* pCreature)
{
return new npc_gurgthockAI(pCreature);
}
void AddSC_zuldrak()
{
Script* pNewScript;
pNewScript = new Script;
pNewScript->Name = "npc_gurgthock";
pNewScript->GetAI = &GetAI_npc_gurgthock;
pNewScript->pQuestAcceptNPC = &QuestAccept_npc_gurgthock;
pNewScript->RegisterSelf();
}