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

Revision 44, 6.8 kB (checked in by yumileroy, 17 years ago)

[svn] * Merge Temp dev SVN with Assembla.
* Changes include:

  • Implementation of w12x's Outdoor PvP and Game Event Systems.
  • Temporary removal of IRC Chat Bot (until infinite loop when disabled is fixed).
  • All mangos -> trinity (to convert your mangos_string table, please run mangos_string_to_trinity_string.sql).
  • Improved Config cleanup.
  • And many more changes.

Original author: Seline
Date: 2008-10-14 11:57:03-05:00

Line 
1/*
2 * Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
3 *
4 * Thanks to the original authors: MaNGOS <http://www.mangosproject.org/>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef __BATTLEGROUNDWS_H
22#define __BATTLEGROUNDWS_H
23
24#include "BattleGround.h"
25
26#define BG_WS_MAX_TEAM_SCORE      3
27#define BG_WS_FLAG_RESPAWN_TIME   23000
28#define BG_WS_FLAG_DROP_TIME      10000
29
30enum BG_WS_Sound
31{
32    BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE  = 8173,
33    BG_WS_SOUND_FLAG_CAPTURED_HORDE     = 8213,
34    BG_WS_SOUND_FLAG_PLACED             = 8232,
35    BG_WS_SOUND_FLAG_RETURNED           = 8192,
36    BG_WS_SOUND_HORDE_FLAG_PICKED_UP    = 8212,
37    BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP = 8174,
38    BG_WS_SOUND_FLAGS_RESPAWNED         = 8232
39};
40
41enum BG_WS_SpellId
42{
43    BG_WS_SPELL_WARSONG_FLAG            = 23333,
44    BG_WS_SPELL_WARSONG_FLAG_DROPPED    = 23334,
45    BG_WS_SPELL_SILVERWING_FLAG         = 23335,
46    BG_WS_SPELL_SILVERWING_FLAG_DROPPED = 23336
47};
48
49enum BG_WS_WorldStates
50{
51    BG_WS_FLAG_UNK_ALLIANCE       = 1545,
52    BG_WS_FLAG_UNK_HORDE          = 1546,
53//    FLAG_UNK                      = 1547,
54    BG_WS_FLAG_CAPTURES_ALLIANCE  = 1581,
55    BG_WS_FLAG_CAPTURES_HORDE     = 1582,
56    BG_WS_FLAG_CAPTURES_MAX       = 1601,
57    BG_WS_FLAG_STATE_HORDE        = 2338,
58    BG_WS_FLAG_STATE_ALLIANCE     = 2339
59};
60
61enum BG_WS_ObjectTypes
62{
63    BG_WS_OBJECT_DOOR_A_1       = 0,
64    BG_WS_OBJECT_DOOR_A_2       = 1,
65    BG_WS_OBJECT_DOOR_A_3       = 2,
66    BG_WS_OBJECT_DOOR_A_4       = 3,
67    BG_WS_OBJECT_DOOR_A_5       = 4,
68    BG_WS_OBJECT_DOOR_A_6       = 5,
69    BG_WS_OBJECT_DOOR_H_1       = 6,
70    BG_WS_OBJECT_DOOR_H_2       = 7,
71    BG_WS_OBJECT_DOOR_H_3       = 8,
72    BG_WS_OBJECT_DOOR_H_4       = 9,
73    BG_WS_OBJECT_A_FLAG         = 10,
74    BG_WS_OBJECT_H_FLAG         = 11,
75    BG_WS_OBJECT_SPEEDBUFF_1    = 12,
76    BG_WS_OBJECT_SPEEDBUFF_2    = 13,
77    BG_WS_OBJECT_REGENBUFF_1    = 14,
78    BG_WS_OBJECT_REGENBUFF_2    = 15,
79    BG_WS_OBJECT_BERSERKBUFF_1  = 16,
80    BG_WS_OBJECT_BERSERKBUFF_2  = 17,
81    BG_WS_OBJECT_MAX            = 18
82};
83
84enum BG_WS_ObjectEntry
85{
86    BG_OBJECT_DOOR_A_1_WS_ENTRY          = 179918,
87    BG_OBJECT_DOOR_A_2_WS_ENTRY          = 179919,
88    BG_OBJECT_DOOR_A_3_WS_ENTRY          = 179920,
89    BG_OBJECT_DOOR_A_4_WS_ENTRY          = 179921,
90    BG_OBJECT_DOOR_A_5_WS_ENTRY          = 180322,
91    BG_OBJECT_DOOR_A_6_WS_ENTRY          = 180322,
92    BG_OBJECT_DOOR_H_1_WS_ENTRY          = 179916,
93    BG_OBJECT_DOOR_H_2_WS_ENTRY          = 179917,
94    BG_OBJECT_DOOR_H_3_WS_ENTRY          = 180322,
95    BG_OBJECT_DOOR_H_4_WS_ENTRY          = 180322,
96    BG_OBJECT_A_FLAG_WS_ENTRY            = 179830,
97    BG_OBJECT_H_FLAG_WS_ENTRY            = 179831
98};
99
100enum BG_WS_FlagState
101{
102    BG_WS_FLAG_STATE_ON_BASE      = 0,
103    BG_WS_FLAG_STATE_WAIT_RESPAWN = 1,
104    BG_WS_FLAG_STATE_ON_PLAYER    = 2,
105    BG_WS_FLAG_STATE_ON_GROUND    = 3
106};
107
108enum BG_WS_Graveyards
109{
110    WS_GRAVEYARD_MAIN_ALLIANCE   = 771,
111    WS_GRAVEYARD_MAIN_HORDE      = 772
112};
113
114enum BG_WS_CreatureTypes
115{
116    WS_SPIRIT_MAIN_ALLIANCE   = 0,
117    WS_SPIRIT_MAIN_HORDE      = 1,
118
119    BG_CREATURES_MAX_WS       = 2
120};
121
122class BattleGroundWGScore : public BattleGroundScore
123{
124    public:
125        BattleGroundWGScore() : FlagCaptures(0), FlagReturns(0) {};
126        virtual ~BattleGroundWGScore() {};
127        uint32 FlagCaptures;
128        uint32 FlagReturns;
129};
130
131class BattleGroundWS : public BattleGround
132{
133    friend class BattleGroundMgr;
134
135    public:
136        /* Construction */
137        BattleGroundWS();
138        ~BattleGroundWS();
139        void Update(time_t diff);
140
141        /* inherited from BattlegroundClass */
142        virtual void AddPlayer(Player *plr);
143
144        /* BG Flags */
145        uint64 GetAllianceFlagPickerGUID() const    { return m_FlagKeepers[BG_TEAM_ALLIANCE]; }
146        uint64 GetHordeFlagPickerGUID() const       { return m_FlagKeepers[BG_TEAM_HORDE]; }
147        void SetAllianceFlagPicker(uint64 guid)     { m_FlagKeepers[BG_TEAM_ALLIANCE] = guid; }
148        void SetHordeFlagPicker(uint64 guid)        { m_FlagKeepers[BG_TEAM_HORDE] = guid; }
149        bool IsAllianceFlagPickedup() const         { return m_FlagKeepers[BG_TEAM_ALLIANCE] != 0; }
150        bool IsHordeFlagPickedup() const            { return m_FlagKeepers[BG_TEAM_HORDE] != 0; }
151        void RespawnFlag(uint32 Team, bool captured);
152        void RespawnFlagAfterDrop(uint32 Team);
153        uint8 GetFlagState(uint32 team)             { return m_FlagState[GetTeamIndexByTeamId(team)]; }
154
155        /* Battleground Events */
156        virtual void EventPlayerDroppedFlag(Player *Source);
157        virtual void EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj);
158        virtual void EventPlayerCapturedFlag(Player *Source);
159
160        void RemovePlayer(Player *plr, uint64 guid);
161        void HandleAreaTrigger(Player *Source, uint32 Trigger);
162        void HandleKillPlayer(Player *player, Player *killer);
163        bool SetupBattleGround();
164        virtual void ResetBGSubclass();
165
166        void UpdateFlagState(uint32 team, uint32 value);
167        void UpdateTeamScore(uint32 team);
168        void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
169        void SetDroppedFlagGUID(uint64 guid, uint32 TeamID)  { m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)] = guid;}
170        uint64 GetDroppedFlagGUID(uint32 TeamID)             { return m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)];}
171        virtual void FillInitialWorldStates(WorldPacket& data);
172
173        /* Scorekeeping */
174        uint32 GetTeamScore(uint32 TeamID) const            { return m_TeamScores[GetTeamIndexByTeamId(TeamID)]; }
175        void AddPoint(uint32 TeamID, uint32 Points = 1)     { m_TeamScores[GetTeamIndexByTeamId(TeamID)] += Points; }
176        void SetTeamPoint(uint32 TeamID, uint32 Points = 0) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] = Points; }
177        void RemovePoint(uint32 TeamID, uint32 Points = 1)  { m_TeamScores[GetTeamIndexByTeamId(TeamID)] -= Points; }
178
179    private:
180        uint64 m_FlagKeepers[2];                            // 0 - alliance, 1 - horde
181        uint64 m_DroppedFlagGUID[2];
182        uint8 m_FlagState[2];                               // for checking flag state
183        uint32 m_TeamScores[2];
184        int32 m_FlagsTimer[2];
185        int32 m_FlagsDropTimer[2];
186};
187#endif
Note: See TracBrowser for help on using the browser.