root/trunk/src/game/BattleGroundAB.h @ 2

Revision 2, 11.4 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#ifndef __BATTLEGROUNDAB_H
19#define __BATTLEGROUNDAB_H
20
21class BattleGround;
22
23enum BG_AB_WorldStates
24{
25    BG_AB_OP_OCCUPIED_BASES_HORDE       = 1778,
26    BG_AB_OP_OCCUPIED_BASES_ALLY        = 1779,
27    BG_AB_OP_RESOURCES_ALLY             = 1776,
28    BG_AB_OP_RESOURCES_HORDE            = 1777,
29    BG_AB_OP_RESOURCES_MAX              = 1780,
30    BG_AB_OP_RESOURCES_WARNING          = 1955
31/*
32    BG_AB_OP_STABLE_ICON                = 1842,             //Stable map icon (NONE)
33    BG_AB_OP_STABLE_STATE_ALIENCE       = 1767,             //Stable map state (ALIENCE)
34    BG_AB_OP_STABLE_STATE_HORDE         = 1768,             //Stable map state (HORDE)
35    BG_AB_OP_STABLE_STATE_CON_ALI       = 1769,             //Stable map state (CON ALIENCE)
36    BG_AB_OP_STABLE_STATE_CON_HOR       = 1770,             //Stable map state (CON HORDE)
37    BG_AB_OP_FARM_ICON                  = 1845,             //Farm map icon (NONE)
38    BG_AB_OP_FARM_STATE_ALIENCE         = 1772,             //Farm state (ALIENCE)
39    BG_AB_OP_FARM_STATE_HORDE           = 1773,             //Farm state (HORDE)
40    BG_AB_OP_FARM_STATE_CON_ALI         = 1774,             //Farm state (CON ALIENCE)
41    BG_AB_OP_FARM_STATE_CON_HOR         = 1775,             //Farm state (CON HORDE)
42
43    BG_AB_OP_BLACKSMITH_ICON            = 1846,             //Blacksmith map icon (NONE)
44    BG_AB_OP_BLACKSMITH_STATE_ALIENCE   = 1782,             //Blacksmith map state (ALIENCE)
45    BG_AB_OP_BLACKSMITH_STATE_HORDE     = 1783,             //Blacksmith map state (HORDE)
46    BG_AB_OP_BLACKSMITH_STATE_CON_ALI   = 1784,             //Blacksmith map state (CON ALIENCE)
47    BG_AB_OP_BLACKSMITH_STATE_CON_HOR   = 1785,             //Blacksmith map state (CON HORDE)
48    BG_AB_OP_LUMBERMILL_ICON            = 1844,             //Lumber Mill map icon (NONE)
49    BG_AB_OP_LUMBERMILL_STATE_ALIENCE   = 1792,             //Lumber Mill map state (ALIENCE)
50    BG_AB_OP_LUMBERMILL_STATE_HORDE     = 1793,             //Lumber Mill map state (HORDE)
51    BG_AB_OP_LUMBERMILL_STATE_CON_ALI   = 1794,             //Lumber Mill map state (CON ALIENCE)
52    BG_AB_OP_LUMBERMILL_STATE_CON_HOR   = 1795,             //Lumber Mill map state (CON HORDE)
53    BG_AB_OP_GOLDMINE_ICON              = 1843,             //Gold Mine map icon (NONE)
54    BG_AB_OP_GOLDMINE_STATE_ALIENCE     = 1787,             //Gold Mine map state (ALIENCE)
55    BG_AB_OP_GOLDMINE_STATE_HORDE       = 1788,             //Gold Mine map state (HORDE)
56    BG_AB_OP_GOLDMINE_STATE_CON_ALI     = 1789,             //Gold Mine map state (CON ALIENCE
57    BG_AB_OP_GOLDMINE_STATE_CON_HOR     = 1790,             //Gold Mine map state (CON HORDE)
58*/
59};
60
61const uint32 BG_AB_OP_NODESTATES[5] =    {1767, 1782, 1772, 1792, 1787};
62
63const uint32 BG_AB_OP_NODEICONS[5]  =    {1842, 1846, 1845, 1844, 1843};
64
65/* Note: code uses that these IDs follow each other */
66enum BG_AB_NodeObjectId
67{
68    BG_AB_OBJECTID_NODE_BANNER_0    = 180087,       // Stables banner
69    BG_AB_OBJECTID_NODE_BANNER_1    = 180088,       // Blacksmith banner
70    BG_AB_OBJECTID_NODE_BANNER_2    = 180089,       // Farm banner
71    BG_AB_OBJECTID_NODE_BANNER_3    = 180090,       // Lumber mill banner
72    BG_AB_OBJECTID_NODE_BANNER_4    = 180091        // Gold mine banner
73};
74
75enum BG_AB_ObjectType
76{
77    // for all 5 node points 8*5=40 objects
78    BG_AB_OBJECT_BANNER_NEUTRAL     = 0,
79    BG_AB_OBJECT_BANNER_CONT_A      = 1,
80    BG_AB_OBJECT_BANNER_CONT_H      = 2,
81    BG_AB_OBJECT_BANNER_ALLY        = 3,
82    BG_AB_OBJECT_BANNER_HORDE       = 4,
83    BG_AB_OBJECT_AURA_ALLY          = 5,
84    BG_AB_OBJECT_AURA_HORDE         = 6,
85    BG_AB_OBJECT_AURA_CONTESTED     = 7,
86    //gates
87    BG_AB_OBJECT_GATE_A             = 40,
88    BG_AB_OBJECT_GATE_H             = 41,
89    //buffs
90    BG_AB_OBJECT_SPEEDBUFF_STABLES       = 42,
91    BG_AB_OBJECT_REGENBUFF_STABLES       = 43,
92    BG_AB_OBJECT_BERSERKBUFF_STABLES     = 44,
93    BG_AB_OBJECT_SPEEDBUFF_BLACKSMITH    = 45,
94    BG_AB_OBJECT_REGENBUFF_BLACKSMITH    = 46,
95    BG_AB_OBJECT_BERSERKBUFF_BLACKSMITH  = 47,
96    BG_AB_OBJECT_SPEEDBUFF_FARM          = 48,
97    BG_AB_OBJECT_REGENBUFF_FARM          = 49,
98    BG_AB_OBJECT_BERSERKBUFF_FARM        = 50,
99    BG_AB_OBJECT_SPEEDBUFF_LUMBER_MILL   = 51,
100    BG_AB_OBJECT_REGENBUFF_LUMBER_MILL   = 52,
101    BG_AB_OBJECT_BERSERKBUFF_LUMBER_MILL = 53,
102    BG_AB_OBJECT_SPEEDBUFF_GOLD_MINE     = 54,
103    BG_AB_OBJECT_REGENBUFF_GOLD_MINE     = 55,
104    BG_AB_OBJECT_BERSERKBUFF_GOLD_MINE   = 56,
105    BG_AB_OBJECT_MAX                     = 57,
106};
107
108/* Object id templates from DB */
109enum BG_AB_ObjectTypes
110{
111    BG_AB_OBJECTID_BANNER_A             = 180058,
112    BG_AB_OBJECTID_BANNER_CONT_A        = 180059,
113    BG_AB_OBJECTID_BANNER_H             = 180060,
114    BG_AB_OBJECTID_BANNER_CONT_H        = 180061,
115
116    BG_AB_OBJECTID_AURA_A               = 180100,
117    BG_AB_OBJECTID_AURA_H               = 180101,
118    BG_AB_OBJECTID_AURA_C               = 180102,
119
120    BG_AB_OBJECTID_GATE_A               = 180255,
121    BG_AB_OBJECTID_GATE_H               = 180256
122};
123
124enum BG_AB_Timers
125{
126    BG_AB_FLAG_CAPTURING_TIME           = 60000,
127};
128
129enum BG_AB_Score
130{
131    BG_AB_MAX_TEAM_SCORE                = 2000,
132    BG_AB_WARNING_SCORE                 = 1800
133};
134
135/* do NOT change the order, else wrong behaviour */
136enum BG_AB_BattleGroundNodes
137{
138    BG_AB_NODE_STABLES          = 0,
139    BG_AB_NODE_BLACKSMITH       = 1,
140    BG_AB_NODE_FARM             = 2,
141    BG_AB_NODE_LUMBER_MILL      = 3,
142    BG_AB_NODE_GOLD_MINE        = 4,
143
144    BG_AB_DYNAMIC_NODES_COUNT   = 5,                        // dynamic nodes that can be captured
145
146    BG_AB_SPIRIT_ALIANCE        = 5,
147    BG_AB_SPIRIT_HORDE          = 6,
148
149    BG_AB_ALL_NODES_COUNT       = 7,                        // all nodes (dynamic and static)
150};
151
152enum BG_AB_NodeStatus
153{
154    BG_AB_NODE_TYPE_NEUTRAL             = 0,
155    BG_AB_NODE_TYPE_CONTESTED           = 1,
156    BG_AB_NODE_STATUS_ALLY_CONTESTED    = 1,
157    BG_AB_NODE_STATUS_HORDE_CONTESTED   = 2,
158    BG_AB_NODE_TYPE_OCCUPIED            = 3,
159    BG_AB_NODE_STATUS_ALLY_OCCUPIED     = 3,
160    BG_AB_NODE_STATUS_HORDE_OCCUPIED    = 4
161};
162
163enum BG_AB_Sounds
164{
165    SOUND_NODE_CLAIMED                  = 8192,
166    SOUND_NODE_CAPTURED_ALLIANCE        = 8173,
167    SOUND_NODE_CAPTURED_HORDE           = 8213,
168    SOUND_NODE_ASSAULTED_ALLIANCE       = 8174,
169    SOUND_NODE_ASSAULTED_HORDE          = 8212,
170    SOUND_NEAR_VICTORY                  = 8456
171};
172
173// x, y, z, o
174const float BG_AB_NodePositions[BG_AB_DYNAMIC_NODES_COUNT][4] = {
175    {1166.785f, 1200.132f, -56.70859f, 0.9075713f},         // stables
176    {977.0156f, 1046.616f, -44.80923f, -2.600541f},         // blacksmith
177    {806.1821f, 874.2723f, -55.99371f, -2.303835f},         // farm
178    {856.1419f, 1148.902f, 11.18469f, -2.303835f},          // lumber mill
179    {1146.923f, 848.1782f, -110.917f, -0.7330382f}          // gold mine
180};
181
182// x, y, z, o, rot0, rot1, rot2, rot3
183const float BG_AB_DoorPositions[2][8] = {
184    {1284.597f, 1281.167f, -15.97792f, 0.7068594f, 0.012957f, -0.060288f, 0.344959f, 0.93659f},
185    {708.0903f, 708.4479f, -17.8342f, -2.391099f, 0.050291f, 0.015127f, 0.929217f, -0.365784f}
186};
187
188// Tick intervals and given points: case 0,1,2,3,4,5 captured nodes
189const uint32 BG_AB_TickIntervals[6] = {0, 12000, 9000, 6000, 3000, 1000};
190const uint32 BG_AB_TickPoints[6] = {0, 10, 10, 10, 10, 30};
191
192// WorldSafeLocs ids for 5 nodes, and for ally, and horde starting location
193const uint32 BG_AB_GraveyardIds[BG_AB_ALL_NODES_COUNT] = {895, 894, 893, 897, 896, 898, 899};
194
195// x, y, z, o
196const float BG_AB_BuffPositions[BG_AB_DYNAMIC_NODES_COUNT][4] = {
197    {1185.71f, 1185.24f, -56.36f, 2.56f},                   // stables
198    {990.75f, 1008.18f, -42.60f, 2.43f},                    // blacksmith
199    {817.66f, 843.34f, -56.54f, 3.01f},                     // farm
200    {807.46f, 1189.16f, 11.92f, 5.44f},                     // lumber mill
201    {1146.62f, 816.94f, -98.49f, 6.14f}                     // gold mine
202};
203
204// x, y, z, o
205const float BG_AB_SpiritGuidePos[BG_AB_ALL_NODES_COUNT][4] = {
206    {1200.03f, 1171.09f, -56.47f, 5.15f},                   // stables
207    {1017.43f, 960.61f, -42.95f, 4.88f},                    // blacksmith
208    {833.00f, 793.00f, -57.25f, 5.27f},                     // farm
209    {775.17f, 1206.40f, 15.79f, 1.90f},                     // lumber mill
210    {1207.48f, 787.00f, -83.36f, 5.51f},                    // gold mine
211    {1354.05f, 1275.48f, -11.30f, 4.77f},                   // alliance starting base
212    {714.61f, 646.15f, -10.87f, 4.34f}                      // horde starting base
213};
214
215struct BG_AB_BannerTimer
216{
217    uint32      timer;
218    uint8       type;
219    uint8       teamIndex;
220};
221
222class BattleGroundABScore : public BattleGroundScore
223{
224    public:
225        BattleGroundABScore(): BasesAssaulted(0), BasesDefended(0) {};
226        virtual ~BattleGroundABScore() {};
227        uint32 BasesAssaulted;
228        uint32 BasesDefended;
229};
230
231class BattleGroundAB : public BattleGround
232{
233    friend class BattleGroundMgr;
234
235    public:
236        BattleGroundAB();
237        ~BattleGroundAB();
238
239        void Update(time_t diff);
240        void AddPlayer(Player *plr);
241        void RemovePlayer(Player *plr,uint64 guid);
242        void HandleAreaTrigger(Player *Source, uint32 Trigger);
243        virtual bool SetupBattleGround();
244        virtual void ResetBGSubclass();
245        virtual WorldSafeLocsEntry const* GetClosestGraveYard(float x, float y, float z, uint32 team);
246
247        /* Scorekeeping */
248        virtual void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
249
250        virtual void FillInitialWorldStates(WorldPacket& data);
251
252        /* Nodes occupying */
253        virtual void EventPlayerClickedOnFlag(Player *source, GameObject* target_obj);
254
255    private:
256        /* Gameobject spawning/despawning */
257        void _CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay);
258        void _DelBanner(uint8 node, uint8 type, uint8 teamIndex);
259        void _SendNodeUpdate(uint8 node);
260
261        /* Creature spawning/despawning */
262        // TODO: working, scripted peons spawning
263        void _NodeOccupied(uint8 node,Team team);
264        void _NodeDeOccupied(uint8 node);
265
266        const char* _GetNodeName(uint8 node);
267
268        /* Nodes info:
269            0: neutral
270            1: ally contested
271            2: horde contested
272            3: ally occupied
273            4: horde occupied     */
274        uint8             m_Nodes[BG_AB_DYNAMIC_NODES_COUNT];
275        uint8             m_prevNodes[BG_AB_DYNAMIC_NODES_COUNT];
276        BG_AB_BannerTimer m_BannerTimers[BG_AB_DYNAMIC_NODES_COUNT];
277        int32             m_NodeTimers[BG_AB_DYNAMIC_NODES_COUNT];
278        uint32            m_TeamScores[2];
279        uint32            m_lastTick[2];
280        uint32            m_HonorScoreTics[2];
281        uint32            m_ReputationScoreTics[2];
282        bool              m_IsInformedNearVictory;
283};
284#endif
Note: See TracBrowser for help on using the browser.