2 * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef __BATTLEGROUNDAV_H
20 #define __BATTLEGROUNDAV_H
24 #define BG_AV_MAX_NODE_DISTANCE 25 // distance in which players are still counted in range of a banner (for alliance towers this is calculated from the center of the tower)
26 #define BG_AV_BOSS_KILL_QUEST_SPELL 23658
28 #define BG_AV_CAPTIME 240000 // 4 minutes
29 #define BG_AV_SNOWFALL_FIRSTCAP 300000 // 5 minutes but i also have seen 4:05
31 #define BG_AV_SCORE_INITIAL_POINTS 600
32 #define BG_AV_SCORE_NEAR_LOSE 120
34 // description: KILL = bonushonor kill one kill is 21honor worth at 0
35 // REP reputation, RES = ressources a team will lose
36 #define BG_AV_KILL_BOSS 4
37 #define BG_AV_REP_BOSS 350
38 #define BG_AV_REP_BOSS_HOLIDAY 525
40 #define BG_AV_KILL_CAPTAIN 3
41 #define BG_AV_REP_CAPTAIN 125
42 #define BG_AV_REP_CAPTAIN_HOLIDAY 185
43 #define BG_AV_RES_CAPTAIN 100
45 #define BG_AV_KILL_TOWER 3
46 #define BG_AV_REP_TOWER 12
47 #define BG_AV_REP_TOWER_HOLIDAY 18
48 #define BG_AV_RES_TOWER 75
50 #define BG_AV_KILL_GET_COMMANDER 1 // for a safely returned wingcommander TODO implement it
52 // bonushonor at the end
53 #define BG_AV_KILL_SURVIVING_TOWER 2
54 #define BG_AV_REP_SURVIVING_TOWER 12
55 #define BG_AV_REP_SURVIVING_TOWER_HOLIDAY 18
57 #define BG_AV_KILL_SURVIVING_CAPTAIN 2
58 #define BG_AV_REP_SURVIVING_CAPTAIN 125
59 #define BG_AV_REP_SURVIVING_CAPTAIN_HOLIDAY 175
61 #define BG_AV_KILL_MAP_COMPLETE 0
62 #define BG_AV_KILL_MAP_COMPLETE_HOLIDAY 4
64 #define BG_AV_REP_OWNED_GRAVE 12
65 #define BG_AV_REP_OWNED_GRAVE_HOLIDAY 18
67 #define BG_AV_REP_OWNED_MINE 24
68 #define BG_AV_REP_OWNED_MINE_HOLIDAY 36
72 BG_AV_SOUND_NEAR_LOSE
= 8456, // not confirmed yet
74 BG_AV_SOUND_ALLIANCE_ASSAULTS
= 8212, // tower,grave + enemy boss if someone tries to attack him
75 BG_AV_SOUND_HORDE_ASSAULTS
= 8174,
76 BG_AV_SOUND_ALLIANCE_GOOD
= 8173, // if something good happens for the team: wins(maybe only through killing the boss), captures mine or grave, destroys tower and defends grave
77 BG_AV_SOUND_HORDE_GOOD
= 8213,
78 BG_AV_SOUND_BOTH_TOWER_DEFEND
= 8192,
80 BG_AV_SOUND_ALLIANCE_CAPTAIN
= 8232, // gets called when someone attacks them and at the beginning after 3min + rand(x) * 10sec (maybe buff)
81 BG_AV_SOUND_HORDE_CAPTAIN
= 8333,
84 enum BG_AV_OTHER_VALUES
88 BG_AV_MINE_TICK_TIMER
= 45000,
89 BG_AV_MINE_RECLAIM_TIMER
= 1200000, // TODO: get the right value.. this is currently 20 minutes
90 BG_AV_NEUTRAL_TEAM
= 2, // this is the neutral owner of snowfall
91 BG_AV_FACTION_A
= 730,
92 BG_AV_FACTION_H
= 729,
94 #define BG_AV_MAX_MINES 2
99 BG_AV_OBJECTID_MINE_N
= 178785,
100 BG_AV_OBJECTID_MINE_S
= 178784,
105 BG_AV_NODES_FIRSTAID_STATION
= 0,
106 BG_AV_NODES_STORMPIKE_GRAVE
= 1,
107 BG_AV_NODES_STONEHEART_GRAVE
= 2,
108 BG_AV_NODES_SNOWFALL_GRAVE
= 3,
109 BG_AV_NODES_ICEBLOOD_GRAVE
= 4,
110 BG_AV_NODES_FROSTWOLF_GRAVE
= 5,
111 BG_AV_NODES_FROSTWOLF_HUT
= 6,
112 BG_AV_NODES_DUNBALDAR_SOUTH
= 7,
113 BG_AV_NODES_DUNBALDAR_NORTH
= 8,
114 BG_AV_NODES_ICEWING_BUNKER
= 9,
115 BG_AV_NODES_STONEHEART_BUNKER
= 10,
116 BG_AV_NODES_ICEBLOOD_TOWER
= 11,
117 BG_AV_NODES_TOWER_POINT
= 12,
118 BG_AV_NODES_FROSTWOLF_ETOWER
= 13,
119 BG_AV_NODES_FROSTWOLF_WTOWER
= 14,
120 BG_AV_NODES_ERROR
= 255,
122 #define BG_AV_NODES_MAX 15
125 // for nodeevents we will use event1=node
126 // event2 is related to BG_AV_States
127 // 0 = alliance assaulted
128 // 1 = alliance control
129 // 2 = horde assaulted
131 // 4 = neutral assaulted
132 // 5 = neutral control
134 // graves have special creatures - their defenders can be in 4 different states
135 // through some quests with armor scraps
136 // so i use event1=BG_AV_NODES_MAX+node (15-21)
139 #define BG_AV_MINE_BOSSES 46 // + mineid will be exact event
140 #define BG_AV_MINE_BOSSES_NORTH 46
141 #define BG_AV_MINE_BOSSES_SOUTH 47
142 #define BG_AV_CAPTAIN_A 48
143 #define BG_AV_CAPTAIN_H 49
144 #define BG_AV_MINE_EVENT 50 // + mineid will be exact event
145 #define BG_AV_MINE_EVENT_NORTH 50
146 #define BG_AV_MINE_EVENT_SOUTH 51
148 #define BG_AV_MARSHAL_A_SOUTH 52
149 #define BG_AV_MARSHAL_A_NORTH 53
150 #define BG_AV_MARSHAL_A_ICE 54
151 #define BG_AV_MARSHAL_A_STONE 55
152 #define BG_AV_MARSHAL_H_ICE 56
153 #define BG_AV_MARSHAL_H_TOWER 57
154 #define BG_AV_MARSHAL_H_ETOWER 58
155 #define BG_AV_MARSHAL_H_WTOWER 59
157 #define BG_AV_HERALD 60
158 #define BG_AV_BOSS_A 61
159 #define BG_AV_BOSS_H 62
160 #define BG_AV_NodeEventCaptainDead_A 63
161 #define BG_AV_NodeEventCaptainDead_H 64
163 enum BG_AV_Graveyards
165 BG_AV_GRAVE_STORM_AID
= 751,
166 BG_AV_GRAVE_STORM_GRAVE
= 689,
167 BG_AV_GRAVE_STONE_GRAVE
= 729,
168 BG_AV_GRAVE_SNOWFALL
= 169,
169 BG_AV_GRAVE_ICE_GRAVE
= 749,
170 BG_AV_GRAVE_FROSTWOLF
= 690,
171 BG_AV_GRAVE_FROST_HUT
= 750,
172 BG_AV_GRAVE_MAIN_ALLIANCE
= 611,
173 BG_AV_GRAVE_MAIN_HORDE
= 610
176 const uint32 BG_AV_GraveyardIds
[9]= {
177 BG_AV_GRAVE_STORM_AID
,
178 BG_AV_GRAVE_STORM_GRAVE
,
179 BG_AV_GRAVE_STONE_GRAVE
,
180 BG_AV_GRAVE_SNOWFALL
,
181 BG_AV_GRAVE_ICE_GRAVE
,
182 BG_AV_GRAVE_FROSTWOLF
,
183 BG_AV_GRAVE_FROST_HUT
,
184 BG_AV_GRAVE_MAIN_ALLIANCE
,
185 BG_AV_GRAVE_MAIN_HORDE
193 #define BG_AV_MAX_STATES 2
195 enum BG_AV_WorldStates
197 BG_AV_Alliance_Score
= 3127,
198 BG_AV_Horde_Score
= 3128,
199 BG_AV_SHOW_H_SCORE
= 3133,
200 BG_AV_SHOW_A_SCORE
= 3134,
201 AV_SNOWFALL_N
= 1966,
204 // alliance_control horde_control neutral_control
205 const uint32 BG_AV_MineWorldStates
[2][3] = {
210 // alliance_control alliance_assault h_control h_assault
211 const uint32 BG_AV_NodeWorldStates
[BG_AV_NODES_MAX
][4] = {
212 // Stormpike first aid station
213 {1326,1325,1328,1327},
214 // Stormpike Graveyard
215 {1335,1333,1336,1334},
217 {1304,1302,1303,1301},
219 {1343,1341,1344,1342},
221 {1348,1346,1349,1347},
223 {1339,1337,1340,1338},
225 {1331,1329,1332,1330},
226 // Dunbaldar South Bunker
227 {1375,1361,1378,1370},
228 // Dunbaldar North Bunker
229 {1374,1362,1379,1371},
231 {1376,1363,1380,1372},
233 {1377,1364,1381,1373},
235 {1390,1368,1395,1385},
237 {1389,1367,1394,1384},
239 {1388,1366,1393,1383},
241 {1387,1365,1392,1382},
244 // through the armorscap-quest 4 different gravedefender exist
245 #define BG_AV_MAX_GRAVETYPES 4
248 BG_AV_QUEST_A_SCRAPS1
= 7223, // first quest
249 BG_AV_QUEST_A_SCRAPS2
= 6781, // repeatable
250 BG_AV_QUEST_H_SCRAPS1
= 7224,
251 BG_AV_QUEST_H_SCRAPS2
= 6741,
252 BG_AV_QUEST_A_COMMANDER1
= 6942, // soldier
253 BG_AV_QUEST_H_COMMANDER1
= 6825,
254 BG_AV_QUEST_A_COMMANDER2
= 6941, // leutnant
255 BG_AV_QUEST_H_COMMANDER2
= 6826,
256 BG_AV_QUEST_A_COMMANDER3
= 6943, // commander
257 BG_AV_QUEST_H_COMMANDER3
= 6827,
258 BG_AV_QUEST_A_BOSS1
= 7386, // 5 cristal/blood
259 BG_AV_QUEST_H_BOSS1
= 7385,
260 BG_AV_QUEST_A_BOSS2
= 6881, // 1
261 BG_AV_QUEST_H_BOSS2
= 6801,
262 BG_AV_QUEST_A_NEAR_MINE
= 5892, // the mine near start location of team
263 BG_AV_QUEST_H_NEAR_MINE
= 5893,
264 BG_AV_QUEST_A_OTHER_MINE
= 6982, // the other mine ;)
265 BG_AV_QUEST_H_OTHER_MINE
= 6985,
266 BG_AV_QUEST_A_RIDER_HIDE
= 7026,
267 BG_AV_QUEST_H_RIDER_HIDE
= 7002,
268 BG_AV_QUEST_A_RIDER_TAME
= 7027,
269 BG_AV_QUEST_H_RIDER_TAME
= 7001
272 struct BG_AV_NodeInfo
278 BG_AV_States PrevState
;
283 inline BG_AV_Nodes
&operator++(BG_AV_Nodes
&i
)
285 return i
= BG_AV_Nodes(i
+ 1);
288 class BattleGroundAVScore
: public BattleGroundScore
291 BattleGroundAVScore() : GraveyardsAssaulted(0), GraveyardsDefended(0), TowersAssaulted(0), TowersDefended(0), SecondaryObjectives(0) {};
292 virtual ~BattleGroundAVScore() {};
293 uint32 GraveyardsAssaulted
;
294 uint32 GraveyardsDefended
;
295 uint32 TowersAssaulted
;
296 uint32 TowersDefended
;
297 uint32 SecondaryObjectives
;
300 class BattleGroundAV
: public BattleGround
302 friend class BattleGroundMgr
;
307 void Update(uint32 diff
);
309 /* inherited from BattlegroundClass */
310 virtual void AddPlayer(Player
*plr
);
312 virtual void StartingEventCloseDoors();
313 virtual void StartingEventOpenDoors();
315 virtual void FillInitialWorldStates(WorldPacket
& data
);
317 void RemovePlayer(Player
*plr
,uint64 guid
);
318 void HandleAreaTrigger(Player
*Source
, uint32 Trigger
);
319 virtual void Reset();
322 void UpdateScore(BattleGroundTeamId team
, int32 points
);
323 void UpdatePlayerScore(Player
*Source
, uint32 type
, uint32 value
);
325 /*handle stuff*/ // these are functions which get called from extern scripts
326 virtual void EventPlayerClickedOnFlag(Player
*source
, GameObject
* target_obj
);
327 void HandleKillPlayer(Player
* player
, Player
*killer
);
328 void HandleKillUnit(Creature
*creature
, Player
*killer
);
329 void HandleQuestComplete(uint32 questid
, Player
*player
);
330 bool PlayerCanDoMineQuest(int32 GOId
,uint32 team
);
332 void EndBattleGround(uint32 winner
);
334 virtual WorldSafeLocsEntry
const* GetClosestGraveYard(Player
*plr
);
337 /* Nodes occupying */
338 void EventPlayerAssaultsPoint(Player
* player
, BG_AV_Nodes node
);
339 void EventPlayerDefendsPoint(Player
* player
, BG_AV_Nodes node
);
340 void EventPlayerDestroyedPoint(BG_AV_Nodes node
);
342 void AssaultNode(BG_AV_Nodes node
, uint32 team
);
343 void DestroyNode(BG_AV_Nodes node
);
344 void InitNode(BG_AV_Nodes node
, uint32 team
, bool tower
);
345 void DefendNode(BG_AV_Nodes node
, uint32 team
);
347 void PopulateNode(BG_AV_Nodes node
);
349 uint32
GetNodeName(BG_AV_Nodes node
);
350 const bool IsTower(BG_AV_Nodes node
) { return (node
== BG_AV_NODES_ERROR
)? false : m_Nodes
[node
].Tower
; }
351 const bool IsGrave(BG_AV_Nodes node
) { return (node
== BG_AV_NODES_ERROR
)? false : !m_Nodes
[node
].Tower
; }
354 void ChangeMineOwner(uint8 mine
, uint32 team
);
357 uint8
GetWorldStateType(uint8 state
, uint32 team
) const { return team
* BG_AV_MAX_STATES
+ state
; }
358 void SendMineWorldStates(uint32 mine
);
359 void UpdateNodeWorldState(BG_AV_Nodes node
);
362 uint32 m_Team_QuestStatus
[BG_TEAMS_COUNT
][9]; // [x][y] x=team y=questcounter
364 BG_AV_NodeInfo m_Nodes
[BG_AV_NODES_MAX
];
366 int8 m_Mine_Owner
[BG_AV_MAX_MINES
];
367 int8 m_Mine_PrevOwner
[BG_AV_MAX_MINES
]; // only for worldstates needed
368 int32 m_Mine_Timer
[BG_AV_MAX_MINES
];
369 uint32 m_Mine_Reclaim_Timer
[BG_AV_MAX_MINES
];
371 bool m_IsInformedNearLose
[BG_TEAMS_COUNT
];
372 bool m_captainAlive
[BG_TEAMS_COUNT
];
374 uint32 m_HonorMapComplete
;
375 uint32 m_RepTowerDestruction
;
378 uint32 m_RepOwnedGrave
;
379 uint32 m_RepOwnedMine
;
380 uint32 m_RepSurviveCaptain
;
381 uint32 m_RepSurviveTower
;