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 __BATTLEGROUNDWS_H
20 #define __BATTLEGROUNDWS_H
22 #include "BattleGround.h"
24 #define BG_WS_MAX_TEAM_SCORE 3
25 #define BG_WS_FLAG_RESPAWN_TIME (23*IN_MILISECONDS)
26 #define BG_WS_FLAG_DROP_TIME (10*IN_MILISECONDS)
30 BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE
= 8173,
31 BG_WS_SOUND_FLAG_CAPTURED_HORDE
= 8213,
32 BG_WS_SOUND_FLAG_PLACED
= 8232,
33 BG_WS_SOUND_FLAG_RETURNED
= 8192,
34 BG_WS_SOUND_HORDE_FLAG_PICKED_UP
= 8212,
35 BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP
= 8174,
36 BG_WS_SOUND_FLAGS_RESPAWNED
= 8232
41 BG_WS_SPELL_WARSONG_FLAG
= 23333,
42 BG_WS_SPELL_WARSONG_FLAG_DROPPED
= 23334,
43 BG_WS_SPELL_SILVERWING_FLAG
= 23335,
44 BG_WS_SPELL_SILVERWING_FLAG_DROPPED
= 23336
47 enum BG_WS_WorldStates
49 BG_WS_FLAG_UNK_ALLIANCE
= 1545,
50 BG_WS_FLAG_UNK_HORDE
= 1546,
52 BG_WS_FLAG_CAPTURES_ALLIANCE
= 1581,
53 BG_WS_FLAG_CAPTURES_HORDE
= 1582,
54 BG_WS_FLAG_CAPTURES_MAX
= 1601,
55 BG_WS_FLAG_STATE_HORDE
= 2338,
56 BG_WS_FLAG_STATE_ALLIANCE
= 2339
59 enum BG_WS_ObjectTypes
61 BG_WS_OBJECT_DOOR_A_1
= 0,
62 BG_WS_OBJECT_DOOR_A_2
= 1,
63 BG_WS_OBJECT_DOOR_A_3
= 2,
64 BG_WS_OBJECT_DOOR_A_4
= 3,
65 BG_WS_OBJECT_DOOR_A_5
= 4,
66 BG_WS_OBJECT_DOOR_A_6
= 5,
67 BG_WS_OBJECT_DOOR_H_1
= 6,
68 BG_WS_OBJECT_DOOR_H_2
= 7,
69 BG_WS_OBJECT_DOOR_H_3
= 8,
70 BG_WS_OBJECT_DOOR_H_4
= 9,
71 BG_WS_OBJECT_A_FLAG
= 10,
72 BG_WS_OBJECT_H_FLAG
= 11,
73 BG_WS_OBJECT_SPEEDBUFF_1
= 12,
74 BG_WS_OBJECT_SPEEDBUFF_2
= 13,
75 BG_WS_OBJECT_REGENBUFF_1
= 14,
76 BG_WS_OBJECT_REGENBUFF_2
= 15,
77 BG_WS_OBJECT_BERSERKBUFF_1
= 16,
78 BG_WS_OBJECT_BERSERKBUFF_2
= 17,
82 enum BG_WS_ObjectEntry
84 BG_OBJECT_DOOR_A_1_WS_ENTRY
= 179918,
85 BG_OBJECT_DOOR_A_2_WS_ENTRY
= 179919,
86 BG_OBJECT_DOOR_A_3_WS_ENTRY
= 179920,
87 BG_OBJECT_DOOR_A_4_WS_ENTRY
= 179921,
88 BG_OBJECT_DOOR_A_5_WS_ENTRY
= 180322,
89 BG_OBJECT_DOOR_A_6_WS_ENTRY
= 180322,
90 BG_OBJECT_DOOR_H_1_WS_ENTRY
= 179916,
91 BG_OBJECT_DOOR_H_2_WS_ENTRY
= 179917,
92 BG_OBJECT_DOOR_H_3_WS_ENTRY
= 180322,
93 BG_OBJECT_DOOR_H_4_WS_ENTRY
= 180322,
94 BG_OBJECT_A_FLAG_WS_ENTRY
= 179830,
95 BG_OBJECT_H_FLAG_WS_ENTRY
= 179831
100 BG_WS_FLAG_STATE_ON_BASE
= 0,
101 BG_WS_FLAG_STATE_WAIT_RESPAWN
= 1,
102 BG_WS_FLAG_STATE_ON_PLAYER
= 2,
103 BG_WS_FLAG_STATE_ON_GROUND
= 3
106 enum BG_WS_Graveyards
108 WS_GRAVEYARD_FLAGROOM_ALLIANCE
= 769,
109 WS_GRAVEYARD_FLAGROOM_HORDE
= 770,
110 WS_GRAVEYARD_MAIN_ALLIANCE
= 771,
111 WS_GRAVEYARD_MAIN_HORDE
= 772
114 enum BG_WS_CreatureTypes
116 WS_SPIRIT_MAIN_ALLIANCE
= 0,
117 WS_SPIRIT_MAIN_HORDE
= 1,
119 BG_CREATURES_MAX_WS
= 2
122 class BattleGroundWGScore
: public BattleGroundScore
125 BattleGroundWGScore() : FlagCaptures(0), FlagReturns(0) {};
126 virtual ~BattleGroundWGScore() {};
131 class BattleGroundWS
: public BattleGround
133 friend class BattleGroundMgr
;
139 void Update(uint32 diff
);
141 /* inherited from BattlegroundClass */
142 virtual void AddPlayer(Player
*plr
);
143 virtual void StartingEventCloseDoors();
144 virtual void StartingEventOpenDoors();
147 uint64
GetAllianceFlagPickerGUID() const { return m_FlagKeepers
[BG_TEAM_ALLIANCE
]; }
148 uint64
GetHordeFlagPickerGUID() const { return m_FlagKeepers
[BG_TEAM_HORDE
]; }
149 void SetAllianceFlagPicker(uint64 guid
) { m_FlagKeepers
[BG_TEAM_ALLIANCE
] = guid
; }
150 void SetHordeFlagPicker(uint64 guid
) { m_FlagKeepers
[BG_TEAM_HORDE
] = guid
; }
151 bool IsAllianceFlagPickedup() const { return m_FlagKeepers
[BG_TEAM_ALLIANCE
] != 0; }
152 bool IsHordeFlagPickedup() const { return m_FlagKeepers
[BG_TEAM_HORDE
] != 0; }
153 void RespawnFlag(uint32 Team
, bool captured
);
154 void RespawnFlagAfterDrop(uint32 Team
);
155 uint8
GetFlagState(uint32 team
) { return m_FlagState
[GetTeamIndexByTeamId(team
)]; }
157 /* Battleground Events */
158 virtual void EventPlayerDroppedFlag(Player
*Source
);
159 virtual void EventPlayerClickedOnFlag(Player
*Source
, GameObject
* target_obj
);
160 virtual void EventPlayerCapturedFlag(Player
*Source
);
162 void RemovePlayer(Player
*plr
, uint64 guid
);
163 void HandleAreaTrigger(Player
*Source
, uint32 Trigger
);
164 void HandleKillPlayer(Player
*player
, Player
*killer
);
165 bool SetupBattleGround();
166 virtual void Reset();
167 void EndBattleGround(uint32 winner
);
168 virtual WorldSafeLocsEntry
const* GetClosestGraveYard(Player
* player
);
170 void UpdateFlagState(uint32 team
, uint32 value
);
171 void UpdateTeamScore(uint32 team
);
172 void UpdatePlayerScore(Player
*Source
, uint32 type
, uint32 value
);
173 void SetDroppedFlagGUID(uint64 guid
, uint32 TeamID
) { m_DroppedFlagGUID
[GetTeamIndexByTeamId(TeamID
)] = guid
;}
174 uint64
GetDroppedFlagGUID(uint32 TeamID
) { return m_DroppedFlagGUID
[GetTeamIndexByTeamId(TeamID
)];}
175 virtual void FillInitialWorldStates(WorldPacket
& data
);
178 uint32
GetTeamScore(uint32 TeamID
) const { return m_TeamScores
[GetTeamIndexByTeamId(TeamID
)]; }
179 void AddPoint(uint32 TeamID
, uint32 Points
= 1) { m_TeamScores
[GetTeamIndexByTeamId(TeamID
)] += Points
; }
180 void SetTeamPoint(uint32 TeamID
, uint32 Points
= 0) { m_TeamScores
[GetTeamIndexByTeamId(TeamID
)] = Points
; }
181 void RemovePoint(uint32 TeamID
, uint32 Points
= 1) { m_TeamScores
[GetTeamIndexByTeamId(TeamID
)] -= Points
; }
184 uint64 m_FlagKeepers
[2]; // 0 - alliance, 1 - horde
185 uint64 m_DroppedFlagGUID
[2];
186 uint8 m_FlagState
[2]; // for checking flag state
187 uint32 m_TeamScores
[2];
188 int32 m_FlagsTimer
[2];
189 int32 m_FlagsDropTimer
[2];
191 uint32 m_ReputationCapture
;
192 uint32 m_HonorWinKills
;
193 uint32 m_HonorEndKills
;