forked from mangosR2/scriptdev2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwintergrasp.cpp
More file actions
165 lines (146 loc) · 5.44 KB
/
Copy pathwintergrasp.cpp
File metadata and controls
165 lines (146 loc) · 5.44 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
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
153
154
155
156
157
158
159
160
161
162
163
164
165
/* Copyright (C) 2006 - 2013 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
*/
#include "precompiled.h"
/*######
## go_wg_def_portal
######*/
static float SpawnLocation[10][3]=
{
{ 5153.41f, 2901.35f, 409.191f },
{ 5268.70f, 2666.42f, 409.099f },
{ 5197.05f, 2944.81f, 409.191f },
{ 5196.67f, 2737.34f, 409.189f },
{ 5314.58f, 3055.85f, 408.862f },
{ 5391.28f, 2828.09f, 418.675f },
{ 5153.93f, 2781.67f, 409.246f },
{ 5311.44f, 2618.93f, 409.092f },
{ 5269.21f, 3013.84f, 408.77f },
{ 5401.63f, 2853.67f, 418.675f },
};
static float TeleLocation[10][3]=
{
{ 5157.1f, 2912.0f, 413.494f },
{ 5270.11f, 2655.62f, 413.403f },
{ 5187.48f, 2942.62f, 413.495f },
{ 5187.25f, 2739.45f, 413.492f },
{ 5304.47f, 3054.62f, 412.147f },
{ 5401.77f, 2853.72f, 418.896f },
{ 5155.76f, 2771.45f, 413.493f },
{ 5302.64f, 2623.39f, 413.403f },
{ 5271.58f, 3023.12f, 412.147f },
{ 5391.28f, 2828.09f, 418.675f },
};
bool GOHello_go_wg_teleport(Player* pPlayer, GameObject* pGo)
{
for (uint32 i=0; i < 10; ++i)
{
if (fabs(pGo->GetDistance2d(SpawnLocation[i][0], SpawnLocation[i][1])) < M_NULL_F)
pPlayer->TeleportTo(pPlayer->GetMapId(),TeleLocation[i][0],TeleLocation[i][1],TeleLocation[i][2],0);
}
return false;
}
/*######
## npc_wg_demolisher_engineer
######*/
#define GOSSIP_HELLO_DEMO1 "Build catapult."
#define GOSSIP_HELLO_DEMO2 "Build demolisher."
#define GOSSIP_HELLO_DEMO3 "Build siege engine."
#define GOSSIP_HELLO_DEMO4 "I cannot build more!"
enum
{
//WG World States
WS_VEHICLE_COUNT_H = 3490,
WS_VEHICLE_COUNT_MAX_H = 3491,
WS_VEHICLE_COUNT_A = 3680,
WS_VEHICLE_COUNT_MAX_A = 3681,
//Spells
SPELL_CORPORAL = 33280,
SPELL_LIEUTENANT = 55629,
//BuildSpellsWG
SPELL_BUILD_CATAPULT = 56664,
SPELL_BUILD_DEMOLISHER = 56659,
SPELL_BUILD_SIEGE_A = 56662,
SPELL_BUILD_SIEGE_H = 61409,
};
bool GossipHello_npc_wg_demolisher_engineer(Player* pPlayer, Creature* pCreature)
{
uint32 team = 0;
uint32 count = 0;
uint32 maxCount = 0;
if (pCreature->GetEntry() == 30499)
{
team = ALLIANCE;
count = pCreature->GetWorldState(WS_VEHICLE_COUNT_A);
maxCount = pCreature->GetWorldState(WS_VEHICLE_COUNT_MAX_A);
}
else if(pCreature->GetEntry() == 30400)
{
team = HORDE;
count = pCreature->GetWorldState(WS_VEHICLE_COUNT_H);
maxCount = pCreature->GetWorldState(WS_VEHICLE_COUNT_MAX_H);
}
if (maxCount > count)
{
if (pPlayer->GetSpellAuraHolder(SPELL_CORPORAL))
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
else if (pPlayer->GetSpellAuraHolder(SPELL_LIEUTENANT))
{
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
}
}
pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetObjectGuid());
return true;
}
// FIXME - Need make over DB
bool GossipSelect_npc_wg_demolisher_engineer(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
{
switch(uiAction)
{
case GOSSIP_ACTION_INFO_DEF:
pPlayer->CastSpell(pPlayer, SPELL_BUILD_CATAPULT, true);
pPlayer->CLOSE_GOSSIP_MENU();
break;
case GOSSIP_ACTION_INFO_DEF + 1:
pPlayer->CastSpell(pPlayer, SPELL_BUILD_DEMOLISHER, true);
pPlayer->CLOSE_GOSSIP_MENU();
break;
case GOSSIP_ACTION_INFO_DEF + 2:
if(pCreature->GetEntry() == 30499)
pPlayer->CastSpell(pPlayer, SPELL_BUILD_SIEGE_A, true);
else if(pCreature->GetEntry() == 30400)
pPlayer->CastSpell(pPlayer, SPELL_BUILD_SIEGE_H, true);
pPlayer->CLOSE_GOSSIP_MENU();
break;
default:
break;
}
return true;
}
void AddSC_wintergrasp()
{
Script *pNewScript;
pNewScript = new Script;
pNewScript->Name = "go_wg_teleport";
pNewScript->pGOUse = &GOHello_go_wg_teleport;
pNewScript->RegisterSelf();
pNewScript = new Script;
pNewScript->Name = "npc_wg_demolisher_engineer";
pNewScript->pGossipHello = &GossipHello_npc_wg_demolisher_engineer;
pNewScript->pGossipSelect = &GossipSelect_npc_wg_demolisher_engineer;
pNewScript->RegisterSelf();
}