root/trunk/src/game/BattleGroundWS.h @ 40

Revision 2, 6.7 kB (checked in by yumileroy, 17 years ago)

[svn] * Proper SVN structure

Original author: Neo2003
Date: 2008-10-02 16:23:55-05:00

Line 
1/*
2 * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
3 *
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.
8 *
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.
13 *
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
17 */
18
19#ifndef __BATTLEGROUNDWS_H
20#define __BATTLEGROUNDWS_H
21
22#include "BattleGround.h"
23
24#define BG_WS_MAX_TEAM_SCORE      3
25#define BG_WS_FLAG_RESPAWN_TIME   23000
26#define BG_WS_FLAG_DROP_TIME      10000
27
28enum BG_WS_Sound
29{
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
37};
38
39enum BG_WS_SpellId
40{
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
45};
46
47enum BG_WS_WorldStates
48{
49    BG_WS_FLAG_UNK_ALLIANCE       = 1545,
50    BG_WS_FLAG_UNK_HORDE          = 1546,
51//    FLAG_UNK                      = 1547,
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
57};
58
59enum BG_WS_ObjectTypes
60{
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,
79    BG_WS_OBJECT_MAX            = 18
80};
81
82enum BG_WS_ObjectEntry
83{
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
96};
97
98enum BG_WS_FlagState
99{
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
104};
105
106enum BG_WS_Graveyards
107{
108    WS_GRAVEYARD_MAIN_ALLIANCE   = 771,
109    WS_GRAVEYARD_MAIN_HORDE      = 772
110};
111
112enum BG_WS_CreatureTypes
113{
114    WS_SPIRIT_MAIN_ALLIANCE   = 0,
115    WS_SPIRIT_MAIN_HORDE      = 1,
116
117    BG_CREATURES_MAX_WS       = 2
118};
119
120class BattleGroundWGScore : public BattleGroundScore
121{
122    public:
123        BattleGroundWGScore() : FlagCaptures(0), FlagReturns(0) {};
124        virtual ~BattleGroundWGScore() {};
125        uint32 FlagCaptures;
126        uint32 FlagReturns;
127};
128
129class BattleGroundWS : public BattleGround
130{
131    friend class BattleGroundMgr;
132
133    public:
134        /* Construction */
135        BattleGroundWS();
136        ~BattleGroundWS();
137        void Update(time_t diff);
138
139        /* inherited from BattlegroundClass */
140        virtual void AddPlayer(Player *plr);
141
142        /* BG Flags */
143        uint64 GetAllianceFlagPickerGUID() const    { return m_FlagKeepers[BG_TEAM_ALLIANCE]; }
144        uint64 GetHordeFlagPickerGUID() const       { return m_FlagKeepers[BG_TEAM_HORDE]; }
145        void SetAllianceFlagPicker(uint64 guid)     { m_FlagKeepers[BG_TEAM_ALLIANCE] = guid; }
146        void SetHordeFlagPicker(uint64 guid)        { m_FlagKeepers[BG_TEAM_HORDE] = guid; }
147        bool IsAllianceFlagPickedup() const         { return m_FlagKeepers[BG_TEAM_ALLIANCE] != 0; }
148        bool IsHordeFlagPickedup() const            { return m_FlagKeepers[BG_TEAM_HORDE] != 0; }
149        void RespawnFlag(uint32 Team, bool captured);
150        void RespawnFlagAfterDrop(uint32 Team);
151        uint8 GetFlagState(uint32 team)             { return m_FlagState[GetTeamIndexByTeamId(team)]; }
152
153        /* Battleground Events */
154        virtual void EventPlayerDroppedFlag(Player *Source);
155        virtual void EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj);
156        virtual void EventPlayerCapturedFlag(Player *Source);
157
158        void RemovePlayer(Player *plr, uint64 guid);
159        void HandleAreaTrigger(Player *Source, uint32 Trigger);
160        void HandleKillPlayer(Player *player, Player *killer);
161        bool SetupBattleGround();
162        virtual void ResetBGSubclass();
163
164        void UpdateFlagState(uint32 team, uint32 value);
165        void UpdateTeamScore(uint32 team);
166        void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
167        void SetDroppedFlagGUID(uint64 guid, uint32 TeamID)  { m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)] = guid;}
168        uint64 GetDroppedFlagGUID(uint32 TeamID)             { return m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)];}
169        virtual void FillInitialWorldStates(WorldPacket& data);
170
171        /* Scorekeeping */
172        uint32 GetTeamScore(uint32 TeamID) const            { return m_TeamScores[GetTeamIndexByTeamId(TeamID)]; }
173        void AddPoint(uint32 TeamID, uint32 Points = 1)     { m_TeamScores[GetTeamIndexByTeamId(TeamID)] += Points; }
174        void SetTeamPoint(uint32 TeamID, uint32 Points = 0) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] = Points; }
175        void RemovePoint(uint32 TeamID, uint32 Points = 1)  { m_TeamScores[GetTeamIndexByTeamId(TeamID)] -= Points; }
176
177    private:
178        uint64 m_FlagKeepers[2];                            // 0 - alliance, 1 - horde
179        uint64 m_DroppedFlagGUID[2];
180        uint8 m_FlagState[2];                               // for checking flag state
181        uint32 m_TeamScores[2];
182        int32 m_FlagsTimer[2];
183        int32 m_FlagsDropTimer[2];
184};
185#endif
Note: See TracBrowser for help on using the browser.