TrinityCore
Loading...
Searching...
No Matches
BattlegroundAB.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __BATTLEGROUNDAB_H
19#define __BATTLEGROUNDAB_H
20
21#include "Battleground.h"
22#include "BattlegroundScore.h"
23#include "Object.h"
24
26{
33/*
34 BG_AB_OP_STABLE_ICON = 1842, //Stable map icon (NONE)
35 BG_AB_OP_STABLE_STATE_ALIENCE = 1767, //Stable map state (ALIENCE)
36 BG_AB_OP_STABLE_STATE_HORDE = 1768, //Stable map state (HORDE)
37 BG_AB_OP_STABLE_STATE_CON_ALI = 1769, //Stable map state (CON ALIENCE)
38 BG_AB_OP_STABLE_STATE_CON_HOR = 1770, //Stable map state (CON HORDE)
39 BG_AB_OP_FARM_ICON = 1845, //Farm map icon (NONE)
40 BG_AB_OP_FARM_STATE_ALIENCE = 1772, //Farm state (ALIENCE)
41 BG_AB_OP_FARM_STATE_HORDE = 1773, //Farm state (HORDE)
42 BG_AB_OP_FARM_STATE_CON_ALI = 1774, //Farm state (CON ALIENCE)
43 BG_AB_OP_FARM_STATE_CON_HOR = 1775, //Farm state (CON HORDE)
44
45 BG_AB_OP_BLACKSMITH_ICON = 1846, //Blacksmith map icon (NONE)
46 BG_AB_OP_BLACKSMITH_STATE_ALIENCE = 1782, //Blacksmith map state (ALIENCE)
47 BG_AB_OP_BLACKSMITH_STATE_HORDE = 1783, //Blacksmith map state (HORDE)
48 BG_AB_OP_BLACKSMITH_STATE_CON_ALI = 1784, //Blacksmith map state (CON ALIENCE)
49 BG_AB_OP_BLACKSMITH_STATE_CON_HOR = 1785, //Blacksmith map state (CON HORDE)
50 BG_AB_OP_LUMBERMILL_ICON = 1844, //Lumber Mill map icon (NONE)
51 BG_AB_OP_LUMBERMILL_STATE_ALIENCE = 1792, //Lumber Mill map state (ALIENCE)
52 BG_AB_OP_LUMBERMILL_STATE_HORDE = 1793, //Lumber Mill map state (HORDE)
53 BG_AB_OP_LUMBERMILL_STATE_CON_ALI = 1794, //Lumber Mill map state (CON ALIENCE)
54 BG_AB_OP_LUMBERMILL_STATE_CON_HOR = 1795, //Lumber Mill map state (CON HORDE)
55 BG_AB_OP_GOLDMINE_ICON = 1843, //Gold Mine map icon (NONE)
56 BG_AB_OP_GOLDMINE_STATE_ALIENCE = 1787, //Gold Mine map state (ALIENCE)
57 BG_AB_OP_GOLDMINE_STATE_HORDE = 1788, //Gold Mine map state (HORDE)
58 BG_AB_OP_GOLDMINE_STATE_CON_ALI = 1789, //Gold Mine map state (CON ALIENCE
59 BG_AB_OP_GOLDMINE_STATE_CON_HOR = 1790, //Gold Mine map state (CON HORDE)
60*/
61};
62
63const uint32 BG_AB_OP_NODESTATES[5] = {1767, 1782, 1772, 1792, 1787};
64
65const uint32 BG_AB_OP_NODEICONS[5] = {1842, 1846, 1845, 1844, 1843};
66
67/* Note: code uses that these IDs follow each other */
69{
70 BG_AB_OBJECTID_NODE_BANNER_0 = 180087, // Stables banner
71 BG_AB_OBJECTID_NODE_BANNER_1 = 180088, // Blacksmith banner
72 BG_AB_OBJECTID_NODE_BANNER_2 = 180089, // Farm banner
73 BG_AB_OBJECTID_NODE_BANNER_3 = 180090, // Lumber mill banner
74 BG_AB_OBJECTID_NODE_BANNER_4 = 180091 // Gold mine banner
75};
76
109
110/* Object id templates from DB */
125
130
136
137/* do NOT change the order, else wrong behaviour */
153
159
172
174{
175 { BG_AB_NODE_STABLES, 10199, 10200, 10203, 10204, 10201, 10202, 10286, 10287 },
176 { BG_AB_NODE_BLACKSMITH, 10211, 10212, 10213, 10214, 10215, 10216, 10290, 10291 },
177 { BG_AB_NODE_FARM, 10217, 10218, 10219, 10220, 10221, 10222, 10288, 10289 },
178 { BG_AB_NODE_LUMBER_MILL, 10224, 10225, 10226, 10227, 10228, 10229, 10284, 10285 },
179 { BG_AB_NODE_GOLD_MINE, 10230, 10231, 10232, 10233, 10234, 10235, 10282, 10283 }
180};
181
192
203
209
210#define BG_AB_NotABBGWeekendHonorTicks 260
211#define BG_AB_ABBGWeekendHonorTicks 160
212#define BG_AB_NotABBGWeekendReputationTicks 160
213#define BG_AB_ABBGWeekendReputationTicks 120
214
215#define AB_EVENT_START_BATTLE 9158 // Achievement: Let's Get This Done
216
218{
219 {1166.785f, 1200.132f, -56.70859f, 0.9075713f}, // stables
220 {977.0156f, 1046.616f, -44.80923f, -2.600541f}, // blacksmith
221 {806.1821f, 874.2723f, -55.99371f, -2.303835f}, // farm
222 {856.1419f, 1148.902f, 11.18469f, -2.303835f}, // lumber mill
223 {1146.923f, 848.1782f, -110.917f, -0.7330382f} // gold mine
224};
225
226// x, y, z, o, rot0, rot1, rot2, rot3
227const float BG_AB_DoorPositions[2][8] =
228{
229 {1284.597f, 1281.167f, -15.97792f, 0.7068594f, 0.012957f, -0.060288f, 0.344959f, 0.93659f},
230 {708.0903f, 708.4479f, -17.8342f, -2.391099f, 0.050291f, 0.015127f, 0.929217f, -0.365784f}
231};
232
233// Tick intervals and given points: case 0, 1, 2, 3, 4, 5 captured nodes
234const uint32 BG_AB_TickIntervals[6] = {0, 12000, 9000, 6000, 3000, 1000};
235const uint32 BG_AB_TickPoints[6] = {0, 10, 10, 10, 10, 30};
236
237// WorldSafeLocs ids for 5 nodes, and for ally, and horde starting location
238const uint32 BG_AB_GraveyardIds[BG_AB_ALL_NODES_COUNT] = {895, 894, 893, 897, 896, 898, 899};
239
240// x, y, z, o
242{
243 {1185.566f, 1184.629f, -56.36329f, 2.303831f}, // stables
244 {990.1131f, 1008.73f, -42.60328f, 0.8203033f}, // blacksmith
245 {818.0089f, 842.3543f, -56.54062f, 3.176533f}, // farm
246 {808.8463f, 1185.417f, 11.92161f, 5.619962f}, // lumber mill
247 {1147.091f, 816.8362f, -98.39896f, 6.056293f} // gold mine
248};
249
251{
252 {1200.03f, 1171.09f, -56.47f, 5.15f}, // stables
253 {1017.43f, 960.61f, -42.95f, 4.88f}, // blacksmith
254 {833.00f, 793.00f, -57.25f, 5.27f}, // farm
255 {775.17f, 1206.40f, 15.79f, 1.90f}, // lumber mill
256 {1207.48f, 787.00f, -83.36f, 5.51f}, // gold mine
257 {1354.05f, 1275.48f, -11.30f, 4.77f}, // alliance starting base
258 {714.61f, 646.15f, -10.87f, 4.34f} // horde starting base
259};
260
267
269{
270 friend class BattlegroundAB;
271
272 protected:
274
275 void UpdateScore(uint32 type, uint32 value) override
276 {
277 switch (type)
278 {
280 BasesAssaulted += value;
281 break;
283 BasesDefended += value;
284 break;
285 default:
287 break;
288 }
289 }
290
292
293 uint32 GetAttr1() const override { return BasesAssaulted; }
294 uint32 GetAttr2() const override { return BasesDefended; }
295
298};
299
301{
302 public:
305
306 void AddPlayer(Player* player) override;
307 void StartingEventCloseDoors() override;
308 void StartingEventOpenDoors() override;
309 void RemovePlayer(Player* player, ObjectGuid guid, uint32 team) override;
310 void HandleAreaTrigger(Player* Source, uint32 Trigger) override;
311 bool SetupBattleground() override;
312 void Reset() override;
313 void EndBattleground(uint32 winner) override;
314 WorldSafeLocsEntry const* GetClosestGraveyard(Player* player) override;
315
316 /* Scorekeeping */
317 bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
318
320
321 /* Nodes occupying */
322 void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj) override;
323
324 /* achievement req. */
325 bool IsAllNodesControlledByTeam(uint32 team) const override;
326 bool CheckAchievementCriteriaMeet(uint32 /*criteriaId*/, Player const* /*player*/, Unit const* /*target*/ = nullptr, uint32 /*miscvalue1*/ = 0) override;
327
328 uint32 GetPrematureWinner() override;
329 private:
330 void PostUpdateImpl(uint32 diff) override;
331 /* Gameobject spawning/despawning */
332 void _CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay);
333 void _DelBanner(uint8 node, uint8 type, uint8 teamIndex);
334 void _SendNodeUpdate(uint8 node);
335
336 /* Creature spawning/despawning */
338 void _NodeOccupied(uint8 node, Team team);
339 void _NodeDeOccupied(uint8 node);
340
341 /* Nodes info:
342 0: neutral
343 1: ally contested
344 2: horde contested
345 3: ally occupied
346 4: horde occupied */
357 // need for achievements
359};
360#endif
Position const BG_AB_NodePositions[BG_AB_DYNAMIC_NODES_COUNT]
const uint32 BG_AB_TickPoints[6]
Position const BG_AB_SpiritGuidePos[BG_AB_ALL_NODES_COUNT]
BG_AB_ObjectType
@ BG_AB_OBJECT_REGENBUFF_BLACKSMITH
@ BG_AB_OBJECT_REGENBUFF_FARM
@ BG_AB_OBJECT_BANNER_HORDE
@ BG_AB_OBJECT_SPEEDBUFF_GOLD_MINE
@ BG_AB_OBJECT_REGENBUFF_LUMBER_MILL
@ BG_AB_OBJECT_BANNER_ALLY
@ BG_AB_OBJECT_GATE_A
@ BG_AB_OBJECT_AURA_HORDE
@ BG_AB_OBJECT_SPEEDBUFF_FARM
@ BG_AB_OBJECT_BERSERKBUFF_BLACKSMITH
@ BG_AB_OBJECT_MAX
@ BG_AB_OBJECT_SPEEDBUFF_BLACKSMITH
@ BG_AB_OBJECT_GATE_H
@ BG_AB_OBJECT_BERSERKBUFF_FARM
@ BG_AB_OBJECT_REGENBUFF_GOLD_MINE
@ BG_AB_OBJECT_BANNER_NEUTRAL
@ BG_AB_OBJECT_SPEEDBUFF_LUMBER_MILL
@ BG_AB_OBJECT_BANNER_CONT_H
@ BG_AB_OBJECT_BERSERKBUFF_STABLES
@ BG_AB_OBJECT_BERSERKBUFF_GOLD_MINE
@ BG_AB_OBJECT_SPEEDBUFF_STABLES
@ BG_AB_OBJECT_BANNER_CONT_A
@ BG_AB_OBJECT_AURA_ALLY
@ BG_AB_OBJECT_BERSERKBUFF_LUMBER_MILL
@ BG_AB_OBJECT_REGENBUFF_STABLES
@ BG_AB_OBJECT_AURA_CONTESTED
const float BG_AB_BuffPositions[BG_AB_DYNAMIC_NODES_COUNT][4]
BG_AB_BroadcastTexts
@ BG_AB_TEXT_ALLIANCE_NEAR_VICTORY
@ BG_AB_TEXT_HORDE_NEAR_VICTORY
BG_AB_NodeStatus
@ BG_AB_NODE_TYPE_OCCUPIED
@ BG_AB_NODE_STATUS_ALLY_CONTESTED
@ BG_AB_NODE_STATUS_ALLY_OCCUPIED
@ BG_AB_NODE_STATUS_HORDE_OCCUPIED
@ BG_AB_NODE_STATUS_HORDE_CONTESTED
@ BG_AB_NODE_TYPE_NEUTRAL
@ BG_AB_NODE_TYPE_CONTESTED
const uint32 BG_AB_TickIntervals[6]
ABNodeInfo const ABNodes[BG_AB_DYNAMIC_NODES_COUNT]
const float BG_AB_DoorPositions[2][8]
const uint32 BG_AB_GraveyardIds[BG_AB_ALL_NODES_COUNT]
BG_AB_ObjectTypes
@ BG_AB_OBJECTID_BANNER_CONT_A
@ BG_AB_OBJECTID_BANNER_A
@ BG_AB_OBJECTID_AURA_A
@ BG_AB_OBJECTID_BANNER_H
@ BG_AB_OBJECTID_AURA_C
@ BG_AB_OBJECTID_AURA_H
@ BG_AB_OBJECTID_GATE_A
@ BG_AB_OBJECTID_BANNER_CONT_H
@ BG_AB_OBJECTID_GATE_H
BG_AB_BattlegroundNodes
@ BG_AB_NODE_BLACKSMITH
@ BG_AB_NODE_STABLES
@ BG_AB_ALL_NODES_COUNT
@ BG_AB_NODE_LUMBER_MILL
@ BG_AB_DYNAMIC_NODES_COUNT
@ BG_AB_NODE_FARM
@ BG_AB_SPIRIT_HORDE
@ BG_AB_NODE_GOLD_MINE
@ BG_AB_SPIRIT_ALIANCE
const uint32 BG_AB_OP_NODEICONS[5]
BG_AB_NodeObjectId
@ BG_AB_OBJECTID_NODE_BANNER_3
@ BG_AB_OBJECTID_NODE_BANNER_4
@ BG_AB_OBJECTID_NODE_BANNER_2
@ BG_AB_OBJECTID_NODE_BANNER_1
@ BG_AB_OBJECTID_NODE_BANNER_0
BG_AB_Timers
@ BG_AB_FLAG_CAPTURING_TIME
BG_AB_Objectives
@ AB_OBJECTIVE_ASSAULT_BASE
@ AB_OBJECTIVE_DEFEND_BASE
const uint32 BG_AB_OP_NODESTATES[5]
BG_AB_WorldStates
@ BG_AB_OP_RESOURCES_ALLY
@ BG_AB_OP_RESOURCES_MAX
@ BG_AB_OP_OCCUPIED_BASES_HORDE
@ BG_AB_OP_RESOURCES_HORDE
@ BG_AB_OP_RESOURCES_WARNING
@ BG_AB_OP_OCCUPIED_BASES_ALLY
BG_AB_Score
@ BG_AB_WARNING_NEAR_VICTORY_SCORE
@ BG_AB_MAX_TEAM_SCORE
BG_AB_Sounds
@ BG_AB_SOUND_NEAR_VICTORY_ALLIANCE
@ BG_AB_SOUND_NODE_CAPTURED_HORDE
@ BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE
@ BG_AB_SOUND_NODE_ASSAULTED_HORDE
@ BG_AB_SOUND_NEAR_VICTORY_HORDE
@ BG_AB_SOUND_NODE_CLAIMED
@ BG_AB_SOUND_NODE_CAPTURED_ALLIANCE
@ SCORE_BASES_ASSAULTED
@ SCORE_BASES_DEFENDED
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
uint8 constexpr PVP_TEAMS_COUNT
void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates &packet) override
WorldSafeLocsEntry const * GetClosestGraveyard(Player *player) override
void _NodeOccupied(uint8 node, Team team)
bool m_TeamScores500Disadvantage[PVP_TEAMS_COUNT]
bool IsAllNodesControlledByTeam(uint32 team) const override
void StartingEventOpenDoors() override
void StartingEventCloseDoors() override
void EventPlayerClickedOnFlag(Player *source, GameObject *target_obj) override
uint32 GetPrematureWinner() override
bool SetupBattleground() override
void RemovePlayer(Player *player, ObjectGuid guid, uint32 team) override
void Reset() override
void _SendNodeUpdate(uint8 node)
uint32 m_NodeTimers[BG_AB_DYNAMIC_NODES_COUNT]
uint8 m_Nodes[BG_AB_DYNAMIC_NODES_COUNT]
uint32 m_HonorScoreTics[PVP_TEAMS_COUNT]
bool CheckAchievementCriteriaMeet(uint32, Player const *, Unit const *=nullptr, uint32=0) override
void HandleAreaTrigger(Player *Source, uint32 Trigger) override
void _CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay)
void _DelBanner(uint8 node, uint8 type, uint8 teamIndex)
uint32 m_ReputationScoreTics[PVP_TEAMS_COUNT]
void PostUpdateImpl(uint32 diff) override
Post-update hook.
uint8 m_prevNodes[BG_AB_DYNAMIC_NODES_COUNT]
bool UpdatePlayerScore(Player *player, uint32 type, uint32 value, bool doAddHonor=true) override
uint32 m_lastTick[PVP_TEAMS_COUNT]
void _NodeDeOccupied(uint8 node)
void AddPlayer(Player *player) override
BG_AB_BannerTimer m_BannerTimers[BG_AB_DYNAMIC_NODES_COUNT]
void EndBattleground(uint32 winner) override
Definition Unit.h:769
uint32 TextHordeDefended
uint32 TextAllianceClaims
uint32 TextAllianceTaken
uint32 TextHordeTaken
uint32 TextAllianceAssaulted
uint32 TextHordeAssaulted
uint32 TextAllianceDefended
uint32 TextHordeClaims
void UpdateScore(uint32 type, uint32 value) override
uint32 GetAttr2() const override
void BuildObjectivesBlock(WorldPackets::Battleground::PVPLogData_Player &playerData) override
BattlegroundABScore(ObjectGuid playerGuid)
uint32 GetAttr1() const override
virtual void UpdateScore(uint32 type, uint32 value)