2 * Copyright (C) 2005-2009 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 __BATTLEGROUNDEY_H
20 #define __BATTLEGROUNDEY_H
26 #define BG_EY_FLAG_RESPAWN_TIME (10*IN_MILISECONDS) //10 seconds
27 #define BG_EY_FPOINTS_TICK_TIME (2*IN_MILISECONDS) //2 seconds
29 enum BG_EY_WorldStates
31 EY_ALLIANCE_RESOURCES
= 2749,
32 EY_HORDE_RESOURCES
= 2750,
33 EY_ALLIANCE_BASE
= 2752,
35 DRAENEI_RUINS_HORDE_CONTROL
= 2733,
36 DRAENEI_RUINS_ALLIANCE_CONTROL
= 2732,
37 DRAENEI_RUINS_UNCONTROL
= 2731,
38 MAGE_TOWER_ALLIANCE_CONTROL
= 2730,
39 MAGE_TOWER_HORDE_CONTROL
= 2729,
40 MAGE_TOWER_UNCONTROL
= 2728,
41 FEL_REAVER_HORDE_CONTROL
= 2727,
42 FEL_REAVER_ALLIANCE_CONTROL
= 2726,
43 FEL_REAVER_UNCONTROL
= 2725,
44 BLOOD_ELF_HORDE_CONTROL
= 2724,
45 BLOOD_ELF_ALLIANCE_CONTROL
= 2723,
46 BLOOD_ELF_UNCONTROL
= 2722,
47 PROGRESS_BAR_PERCENT_GREY
= 2720, //100 = empty (only grey), 0 = blue|red (no grey)
48 PROGRESS_BAR_STATUS
= 2719, //50 init!, 48 ... hordak bere .. 33 .. 0 = full 100% hordacky , 100 = full alliance
49 PROGRESS_BAR_SHOW
= 2718, //1 init, 0 druhy send - bez messagu, 1 = controlled aliance
50 NETHERSTORM_FLAG
= 2757,
51 //set to 2 when flag is picked up, and to 1 if it is dropped
52 NETHERSTORM_FLAG_STATE_ALLIANCE
= 2769,
53 NETHERSTORM_FLAG_STATE_HORDE
= 2770
56 enum BG_EY_ProgressBarConsts
58 BG_EY_POINT_MAX_CAPTURERS_COUNT
= 5,
59 BG_EY_POINT_RADIUS
= 70,
60 BG_EY_PROGRESS_BAR_DONT_SHOW
= 0,
61 BG_EY_PROGRESS_BAR_SHOW
= 1,
62 BG_EY_PROGRESS_BAR_PERCENT_GREY
= 40,
63 BG_EY_PROGRESS_BAR_STATE_MIDDLE
= 50,
64 BG_EY_PROGRESS_BAR_HORDE_CONTROLLED
= 0,
65 BG_EY_PROGRESS_BAR_NEUTRAL_LOW
= 30,
66 BG_EY_PROGRESS_BAR_NEUTRAL_HIGH
= 70,
67 BG_EY_PROGRESS_BAR_ALI_CONTROLLED
= 100
72 //strange ids, but sure about them
73 BG_EY_SOUND_FLAG_PICKED_UP_ALLIANCE
= 8212,
74 BG_EY_SOUND_FLAG_CAPTURED_HORDE
= 8213,
75 BG_EY_SOUND_FLAG_PICKED_UP_HORDE
= 8174,
76 BG_EY_SOUND_FLAG_CAPTURED_ALLIANCE
= 8173,
77 BG_EY_SOUND_FLAG_RESET
= 8192
82 BG_EY_NETHERSTORM_FLAG_SPELL
= 34976,
83 BG_EY_PLAYER_DROPPED_FLAG_SPELL
= 34991
86 enum EYBattleGroundPointsTrigger
88 TR_BLOOD_ELF_POINT
= 4476,
89 TR_FEL_REALVER_POINT
= 4514,
90 TR_MAGE_TOWER_POINT
= 4516,
91 TR_DRAENEI_RUINS_POINT
= 4518,
92 TR_BLOOD_ELF_BUFF
= 4568,
93 TR_FEL_REALVER_BUFF
= 4569,
94 TR_MAGE_TOWER_BUFF
= 4570,
95 TR_DRAENEI_RUINS_BUFF
= 4571
98 enum EYBattleGroundGaveyards
100 EY_GRAVEYARD_MAIN_ALLIANCE
= 1103,
101 EY_GRAVEYARD_MAIN_HORDE
= 1104,
102 EY_GRAVEYARD_FEL_REALVER
= 1105,
103 EY_GRAVEYARD_BLOOD_ELF
= 1106,
104 EY_GRAVEYARD_DRAENEI_RUINS
= 1107,
105 EY_GRAVEYARD_MAGE_TOWER
= 1108
109 enum EYBattleGroundPoints
116 EY_PLAYERS_OUT_OF_POINTS
= 4,
121 BG_EY_NODE_FEL_REALVER
= 0,
122 BG_EY_NODE_BLOOD_ELF
= 1,
123 BG_EY_NODE_DRAENEI_RUINS
= 2,
124 BG_EY_NODE_MAGE_TOWER
= 3,
125 BG_EY_NODES_ERROR
= 255
127 #define BG_EY_NODES_MAX 4
129 // node-events work like this: event1:nodeid, event2:state (0alliance,1horde,2neutral)
130 #define BG_EYE_NEUTRAL_TEAM 2
131 #define BG_EY_EVENT_CAPTURE_FLAG 4 // event1=4, event2=nodeid or 4 for the default center spawn
132 #define BG_EY_EVENT2_FLAG_CENTER 4 // maximum node is 3 so 4 for center is ok
133 // all other event2 are just nodeids, i won't define something here
136 // used to check, when player is in range of a node
137 const float BG_EY_NodePositions
[BG_EY_NODES_MAX
][4] = {
138 {2024.600708f
, 1742.819580f
, 1195.157715f
}, // FEL_REALVER
139 {2050.493164f
, 1372.235962f
, 1194.563477f
}, // BLOOD_ELF
140 {2301.010498f
, 1386.931641f
, 1197.183472f
}, // DRAENEI_RUINS
141 {2282.121582f
, 1760.006958f
, 1189.707153f
} // MAGE_TOWER
144 enum EYBattleGroundObjectTypes
147 BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER
= 1,
148 BG_EY_OBJECT_REGENBUFF_FEL_REALVER
= 2,
149 BG_EY_OBJECT_BERSERKBUFF_FEL_REALVER
= 3,
150 BG_EY_OBJECT_SPEEDBUFF_BLOOD_ELF
= 4,
151 BG_EY_OBJECT_REGENBUFF_BLOOD_ELF
= 5,
152 BG_EY_OBJECT_BERSERKBUFF_BLOOD_ELF
= 6,
153 BG_EY_OBJECT_SPEEDBUFF_DRAENEI_RUINS
= 7,
154 BG_EY_OBJECT_REGENBUFF_DRAENEI_RUINS
= 8,
155 BG_EY_OBJECT_BERSERKBUFF_DRAENEI_RUINS
= 9,
156 BG_EY_OBJECT_SPEEDBUFF_MAGE_TOWER
= 10,
157 BG_EY_OBJECT_REGENBUFF_MAGE_TOWER
= 11,
158 BG_EY_OBJECT_BERSERKBUFF_MAGE_TOWER
= 12,
159 BG_EY_OBJECT_MAX
= 13
162 #define BG_EY_NotEYWeekendHonorTicks 330
163 #define BG_EY_EYWeekendHonorTicks 200
167 BG_EY_WARNING_NEAR_VICTORY_SCORE
= 1400,
168 BG_EY_MAX_TEAM_SCORE
= 1600
173 BG_EY_FLAG_STATE_ON_BASE
= 0,
174 BG_EY_FLAG_STATE_WAIT_RESPAWN
= 1,
175 BG_EY_FLAG_STATE_ON_PLAYER
= 2,
176 BG_EY_FLAG_STATE_ON_GROUND
= 3
179 enum EYBattleGroundPointState
181 EY_POINT_NO_OWNER
= 0,
182 EY_POINT_STATE_UNCONTROLLED
= 0,
183 EY_POINT_UNDER_CONTROL
= 3
186 struct BattleGroundEYPointIconsStruct
188 BattleGroundEYPointIconsStruct(uint32 _WorldStateControlIndex
, uint32 _WorldStateAllianceControlledIndex
, uint32 _WorldStateHordeControlledIndex
)
189 : WorldStateControlIndex(_WorldStateControlIndex
), WorldStateAllianceControlledIndex(_WorldStateAllianceControlledIndex
), WorldStateHordeControlledIndex(_WorldStateHordeControlledIndex
) {}
190 uint32 WorldStateControlIndex
;
191 uint32 WorldStateAllianceControlledIndex
;
192 uint32 WorldStateHordeControlledIndex
;
195 struct BattleGroundEYLoosingPointStruct
197 BattleGroundEYLoosingPointStruct(uint32 _MessageIdAlliance
, uint32 _MessageIdHorde
)
198 : MessageIdAlliance(_MessageIdAlliance
), MessageIdHorde(_MessageIdHorde
)
201 uint32 MessageIdAlliance
;
202 uint32 MessageIdHorde
;
205 struct BattleGroundEYCapturingPointStruct
207 BattleGroundEYCapturingPointStruct(uint32 _MessageIdAlliance
, uint32 _MessageIdHorde
, uint32 _GraveYardId
)
208 : MessageIdAlliance(_MessageIdAlliance
), MessageIdHorde(_MessageIdHorde
), GraveYardId(_GraveYardId
)
210 uint32 MessageIdAlliance
;
211 uint32 MessageIdHorde
;
215 const uint8 BG_EY_TickPoints
[BG_EY_NODES_MAX
] = {1, 2, 5, 10};
216 const uint32 BG_EY_FlagPoints
[BG_EY_NODES_MAX
] = {75, 85, 100, 500};
219 const BattleGroundEYPointIconsStruct PointsIconStruct
[BG_EY_NODES_MAX
] =
221 BattleGroundEYPointIconsStruct(FEL_REAVER_UNCONTROL
, FEL_REAVER_ALLIANCE_CONTROL
, FEL_REAVER_HORDE_CONTROL
),
222 BattleGroundEYPointIconsStruct(BLOOD_ELF_UNCONTROL
, BLOOD_ELF_ALLIANCE_CONTROL
, BLOOD_ELF_HORDE_CONTROL
),
223 BattleGroundEYPointIconsStruct(DRAENEI_RUINS_UNCONTROL
, DRAENEI_RUINS_ALLIANCE_CONTROL
, DRAENEI_RUINS_HORDE_CONTROL
),
224 BattleGroundEYPointIconsStruct(MAGE_TOWER_UNCONTROL
, MAGE_TOWER_ALLIANCE_CONTROL
, MAGE_TOWER_HORDE_CONTROL
)
226 const BattleGroundEYLoosingPointStruct LoosingPointTypes
[BG_EY_NODES_MAX
] =
228 BattleGroundEYLoosingPointStruct(LANG_BG_EY_HAS_LOST_A_F_RUINS
, LANG_BG_EY_HAS_LOST_H_F_RUINS
),
229 BattleGroundEYLoosingPointStruct(LANG_BG_EY_HAS_LOST_A_B_TOWER
, LANG_BG_EY_HAS_LOST_H_B_TOWER
),
230 BattleGroundEYLoosingPointStruct(LANG_BG_EY_HAS_LOST_A_D_RUINS
, LANG_BG_EY_HAS_LOST_H_D_RUINS
),
231 BattleGroundEYLoosingPointStruct(LANG_BG_EY_HAS_LOST_A_M_TOWER
, LANG_BG_EY_HAS_LOST_H_M_TOWER
)
233 const BattleGroundEYCapturingPointStruct CapturingPointTypes
[BG_EY_NODES_MAX
] =
235 BattleGroundEYCapturingPointStruct(LANG_BG_EY_HAS_TAKEN_A_F_RUINS
, LANG_BG_EY_HAS_TAKEN_H_F_RUINS
, EY_GRAVEYARD_FEL_REALVER
),
236 BattleGroundEYCapturingPointStruct(LANG_BG_EY_HAS_TAKEN_A_B_TOWER
, LANG_BG_EY_HAS_TAKEN_H_B_TOWER
, EY_GRAVEYARD_BLOOD_ELF
),
237 BattleGroundEYCapturingPointStruct(LANG_BG_EY_HAS_TAKEN_A_D_RUINS
, LANG_BG_EY_HAS_TAKEN_H_D_RUINS
, EY_GRAVEYARD_DRAENEI_RUINS
),
238 BattleGroundEYCapturingPointStruct(LANG_BG_EY_HAS_TAKEN_A_M_TOWER
, LANG_BG_EY_HAS_TAKEN_H_M_TOWER
, EY_GRAVEYARD_MAGE_TOWER
)
241 class BattleGroundEYScore
: public BattleGroundScore
244 BattleGroundEYScore () : FlagCaptures(0) {};
245 virtual ~BattleGroundEYScore() {};
249 class BattleGroundEY
: public BattleGround
251 friend class BattleGroundMgr
;
256 void Update(uint32 diff
);
258 /* inherited from BattlegroundClass */
259 virtual void AddPlayer(Player
*plr
);
260 virtual void StartingEventCloseDoors();
261 virtual void StartingEventOpenDoors();
264 uint64
GetFlagPickerGUID() const { return m_FlagKeeper
; }
265 void SetFlagPicker(uint64 guid
) { m_FlagKeeper
= guid
; }
266 bool IsFlagPickedup() const { return m_FlagKeeper
!= 0; }
267 uint8
GetFlagState() const { return m_FlagState
; }
268 void RespawnFlag(bool send_message
);
269 void RespawnFlagAfterDrop();
271 void RemovePlayer(Player
*plr
,uint64 guid
);
272 void HandleBuffUse(uint64
const& buff_guid
);
273 void HandleAreaTrigger(Player
*Source
, uint32 Trigger
);
274 void HandleKillPlayer(Player
*player
, Player
*killer
);
275 virtual WorldSafeLocsEntry
const* GetClosestGraveYard(Player
* player
);
276 virtual bool SetupBattleGround();
277 virtual void Reset();
278 void UpdateTeamScore(uint32 Team
);
279 void EndBattleGround(uint32 winner
);
280 void UpdatePlayerScore(Player
*Source
, uint32 type
, uint32 value
);
281 virtual void FillInitialWorldStates(WorldPacket
& data
);
282 void SetDroppedFlagGUID(uint64 guid
) { m_DroppedFlagGUID
= guid
;}
283 uint64
GetDroppedFlagGUID() const { return m_DroppedFlagGUID
;}
285 /* Battleground Events */
286 virtual void EventPlayerClickedOnFlag(Player
*Source
, GameObject
* target_obj
);
287 virtual void EventPlayerDroppedFlag(Player
*Source
);
289 /* achievement req. */
290 bool IsAllNodesConrolledByTeam(uint32 team
) const;
293 void EventPlayerCapturedFlag(Player
*Source
, BG_EY_Nodes node
);
294 void EventTeamCapturedPoint(Player
*Source
, uint32 Point
);
295 void EventTeamLostPoint(Player
*Source
, uint32 Point
);
296 void UpdatePointsCount(uint32 Team
);
297 void UpdatePointsIcons(uint32 Team
, uint32 Point
);
299 /* Point status updating procedures */
300 void CheckSomeoneLeftPoint();
301 void CheckSomeoneJoinedPoint();
302 void UpdatePointStatuses();
305 uint32
GetTeamScore(uint32 Team
) const { return m_TeamScores
[GetTeamIndexByTeamId(Team
)]; }
306 void AddPoints(uint32 Team
, uint32 Points
);
308 void RemovePoint(uint32 TeamID
, uint32 Points
= 1) { m_TeamScores
[GetTeamIndexByTeamId(TeamID
)] -= Points
; }
309 void SetTeamPoint(uint32 TeamID
, uint32 Points
= 0) { m_TeamScores
[GetTeamIndexByTeamId(TeamID
)] = Points
; }
311 uint32 m_HonorScoreTics
[2];
312 uint32 m_TeamPointsCount
[2];
314 uint32 m_Points_Trigger
[BG_EY_NODES_MAX
];
316 uint64 m_FlagKeeper
; // keepers guid
317 uint64 m_DroppedFlagGUID
;
318 uint8 m_FlagState
; // for checking flag state
320 int32 m_TowerCapCheckTimer
;
322 uint32 m_PointOwnedByTeam
[BG_EY_NODES_MAX
];
323 uint8 m_PointState
[BG_EY_NODES_MAX
];
324 int32 m_PointBarStatus
[BG_EY_NODES_MAX
];
325 typedef std::vector
<uint64
> PlayersNearPointType
;
326 PlayersNearPointType m_PlayersNearPoint
[BG_EY_NODES_MAX
+ 1];
327 uint8 m_CurrentPointPlayersCount
[2*BG_EY_NODES_MAX
];
329 int32 m_PointAddingTimer
;