From c63312cc0642a5bdfceca92e25bb832d1d97bef3 Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 21 Dec 2022 21:41:58 +0100 Subject: [PATCH] Core/WorldStates: Migrate battleground worldstates to new system --- .../world/4.3.4/2022_12_21_00_world.sql | 262 +++++++++++++++ src/server/game/Battlegrounds/Arena.cpp | 7 - src/server/game/Battlegrounds/Arena.h | 4 +- .../game/Battlegrounds/Battleground.cpp | 22 +- src/server/game/Battlegrounds/Battleground.h | 27 +- .../Battlegrounds/Zones/BattlegroundAB.cpp | 86 +---- .../game/Battlegrounds/Zones/BattlegroundAB.h | 79 ++--- .../Battlegrounds/Zones/BattlegroundAV.cpp | 121 +------ .../game/Battlegrounds/Zones/BattlegroundAV.h | 225 +++++++------ .../Battlegrounds/Zones/BattlegroundBE.cpp | 7 - .../game/Battlegrounds/Zones/BattlegroundBE.h | 1 - .../Battlegrounds/Zones/BattlegroundBFG.cpp | 58 ---- .../Battlegrounds/Zones/BattlegroundBFG.h | 6 - .../Battlegrounds/Zones/BattlegroundDS.cpp | 7 - .../game/Battlegrounds/Zones/BattlegroundDS.h | 1 - .../Battlegrounds/Zones/BattlegroundEY.cpp | 74 +---- .../game/Battlegrounds/Zones/BattlegroundEY.h | 5 +- .../Battlegrounds/Zones/BattlegroundIC.cpp | 42 +-- .../game/Battlegrounds/Zones/BattlegroundIC.h | 39 +-- .../Battlegrounds/Zones/BattlegroundNA.cpp | 7 - .../game/Battlegrounds/Zones/BattlegroundNA.h | 1 - .../Battlegrounds/Zones/BattlegroundRL.cpp | 7 - .../game/Battlegrounds/Zones/BattlegroundRL.h | 1 - .../Battlegrounds/Zones/BattlegroundRV.cpp | 7 - .../game/Battlegrounds/Zones/BattlegroundRV.h | 5 +- .../Battlegrounds/Zones/BattlegroundSA.cpp | 111 ++----- .../game/Battlegrounds/Zones/BattlegroundSA.h | 38 +-- .../Battlegrounds/Zones/BattlegroundTP.cpp | 64 ---- .../game/Battlegrounds/Zones/BattlegroundTP.h | 5 - .../Battlegrounds/Zones/BattlegroundWS.cpp | 108 ++---- .../game/Battlegrounds/Zones/BattlegroundWS.h | 35 +- src/server/game/Entities/Player/Player.cpp | 309 ------------------ .../scripts/World/achievement_scripts.cpp | 196 +---------- 33 files changed, 575 insertions(+), 1392 deletions(-) create mode 100644 sql/updates/world/4.3.4/2022_12_21_00_world.sql diff --git a/sql/updates/world/4.3.4/2022_12_21_00_world.sql b/sql/updates/world/4.3.4/2022_12_21_00_world.sql new file mode 100644 index 0000000000..1cd93a65d4 --- /dev/null +++ b/sql/updates/world/4.3.4/2022_12_21_00_world.sql @@ -0,0 +1,262 @@ +ALTER TABLE `world_state` MODIFY `MapIDs` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL AFTER `DefaultValue`; + +DELETE FROM `world_state` WHERE `ID` IN (601,602,801,804,922,923,1043,1044,1181,1182,1183,1184,1185,1186,1187,1188,1301,1302,1303,1304,1325,1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,1336,1337,1338,1339,1340,1341,1342,1343,1344,1346,1347,1348,1349,1351, +1352,1355,1356,1357,1358,1359,1360,1361,1362,1363,1364,1365,1366,1367,1368,1370,1371,1372,1373,1374,1375,1376,1377,1378,1379,1380,1381,1382,1383,1384,1385,1387,1388,1389,1390,1392,1393,1394,1395,1545,1546,1547,1581,1582,1601,1664,1767,1768,1769,1770,1772,1773, +1774,1775,1776,1777,1778,1779,1780,1782,1783,1784,1785,1787,1788,1789,1790,1792,1793,1794,1795,1842,1843,1844,1845,1846,1955,1966,2338,2339,2718,2719,2720,2722,2723,2724,2725,2726,2727,2728,2729,2730,2731,2732,2733,2752,2753,3127,3128,3133,3134,3136,3557,3564, +3565,3571,3600,3601,3610,3614,3617,3620,3623,3626,3627,3628,3629,3630,3631,3632,3633,3634,3635,3636,3637,3638,3644,3645,3690,3849,3955,3956,4221,4222,4226,4227,4228,4229,4230,4232,4234,4235,4247,4248,4287,4289,4293,4294,4296,4297,4298,4299,4300,4301,4302,4303, +4304,4305,4306,4307,4308,4309,4310,4311,4312,4313,4314,4315,4317,4318,4319,4320,4321,4322,4323,4324,4325,4326,4327,4328,4339,4340,4341,4342,4343,4344,4345,4346,4347,4348,4352,4353,5834,8524,8529,8799,8805,8808,8809,8863,9808,9809,13401,15480,15481,17303,17322, +17323,17324,17325,17326,17327,17328,17329,17330,17331,17361,17362,17363,17364,17365,17366,17367,17368,17377,17712,17713,21322,21427); +INSERT INTO `world_state` (`ID`,`DefaultValue`,`MapIDs`,`AreaIDs`,`ScriptName`,`Comment`) VALUES +(601,1,'30,2197',NULL,'','Alterac Valley - Drek\'Thar alive'), +(602,1,'30,2197',NULL,'','Alterac Valley - Vandaar alive'), +(801,0,'30,2197',NULL,'','Alterac Valley - Irondeep Mine - owner'), +(804,0,'30,2197',NULL,'','Alterac Valley - Coldtooth Mine - owner'), +(922,200,'30,2197',NULL,'','Alterac Valley - Stormpike Soldier\'s Blood max'), +(923,0,'30,2197',NULL,'','Alterac Valley - Stormpike Soldier\'s Blood count'), +(1043,0,'30,2197',NULL,'','Alterac Valley - Storm Crystals count'), +(1044,200,'30,2197',NULL,'','Alterac Valley - Storm Crystals max'), +(1181,1,'30,2197',NULL,'','Alterac Valley - Dun Baldar South Bunker - Owner'), +(1182,1,'30,2197',NULL,'','Alterac Valley - Dun Baldar North Bunker - Owner'), +(1183,1,'30,2197',NULL,'','Alterac Valley - Icewing Bunker - Owner'), +(1184,1,'30,2197',NULL,'','Alterac Valley - Stonehearth Bunker - Owner'), +(1185,2,'30,2197',NULL,'','Alterac Valley - West Frostwolf Tower - Owner'), +(1186,2,'30,2197',NULL,'','Alterac Valley - East Frostwolf Tower - Owner'), +(1187,2,'30,2197',NULL,'','Alterac Valley - Tower Point - Owner'), +(1188,2,'30,2197',NULL,'','Alterac Valley - Iceblood Tower - Owner'), +(1301,0,'30,2197',NULL,'','Alterac Valley - Stonehearth Graveyard - Horde Controlled'), +(1302,1,'30,2197',NULL,'','Alterac Valley - Stonehearth Graveyard - Alliance Controlled'), +(1303,0,'30,2197',NULL,'','Alterac Valley - Stonehearth Graveyard - In Conflict'), +(1304,0,'30,2197',NULL,'','Alterac Valley - Stonehearth Graveyard - In Conflict'), +(1325,1,'30,2197',NULL,'','Alterac Valley - Stormpike Aid Station - Alliance Controlled'), +(1326,0,'30,2197',NULL,'','Alterac Valley - Stormpike Aid Station - In Conflict'), +(1327,0,'30,2197',NULL,'','Alterac Valley - Stormpike Aid Station - Horde Controlled'), +(1328,0,'30,2197',NULL,'','Alterac Valley - Stormpike Aid Station - In Conflict'), +(1329,0,'30,2197',NULL,'','Alterac Valley - Frostwolf Relief Hut - Alliance Controlled'), +(1330,1,'30,2197',NULL,'','Alterac Valley - Frostwolf Relief Hut - Horde Controlled'), +(1331,0,'30,2197',NULL,'','Alterac Valley - Frostwolf Relief Hut - In Conflict'), +(1332,0,'30,2197',NULL,'','Alterac Valley - Frostwolf Relief Hut - In Conflict'), +(1333,1,'30,2197',NULL,'','Alterac Valley - Stormpike Graveyard - Alliance Controlled'), +(1334,0,'30,2197',NULL,'','Alterac Valley - Stormpike Graveyard - Horde Controlled'), +(1335,0,'30,2197',NULL,'','Alterac Valley - Stormpike Graveyard - In Conflict'), +(1336,0,'30,2197',NULL,'','Alterac Valley - Stormpike Graveyard - In Conflict'), +(1337,0,'30,2197',NULL,'','Alterac Valley - Frostwolf Graveyard - Alliance Controlled'), +(1338,1,'30,2197',NULL,'','Alterac Valley - Frostwolf Graveyard - Horde Controlled'), +(1339,0,'30,2197',NULL,'','Alterac Valley - Frostwolf Graveyard - In Conflict'), +(1340,0,'30,2197',NULL,'','Alterac Valley - Frostwolf Graveyard - In Conflict'), +(1341,0,'30,2197',NULL,'','Alterac Valley - Snowfall Graveyard - Alliance Controlled'), +(1342,0,'30,2197',NULL,'','Alterac Valley - Snowfall Graveyard - Horde Controlled'), +(1343,0,'30,2197',NULL,'','Alterac Valley - Snowfall Graveyard - In Conflict'), +(1344,0,'30,2197',NULL,'','Alterac Valley - Snowfall Graveyard - In Conflict'), +(1346,0,'30,2197',NULL,'','Alterac Valley - Iceblood Graveyard - Alliance Controlled'), +(1347,1,'30,2197',NULL,'','Alterac Valley - Iceblood Graveyard - Horde Controlled'), +(1348,0,'30,2197',NULL,'','Alterac Valley - Iceblood Graveyard - In Conflict'), +(1349,0,'30,2197',NULL,'','Alterac Valley - Iceblood Graveyard - In Conflict'), +(1351,1,'30,2197',NULL,'','Alterac Valley - Balinda alive'), +(1352,1,'30,2197',NULL,'','Alterac Valley - Galvagar alive'), +(1355,0,'30,2197',NULL,'','Alterac Valley - Coldtooth Mine - Alliance Controlled'), +(1356,0,'30,2197',NULL,'','Alterac Valley - Coldtooth Mine - Horde Controlled'), +(1357,1,'30,2197',NULL,'','Alterac Valley - Coldtooth Mine - Kobold Controlled'), +(1358,0,'30,2197',NULL,'','Alterac Valley - Irondeep Mine - Alliance Controlled'), +(1359,0,'30,2197',NULL,'','Alterac Valley - Irondeep Mine - Horde Controlled'), +(1360,1,'30,2197',NULL,'','Alterac Valley - Irondeep Mine - Trogg Controlled'), +(1361,1,'30,2197',NULL,'','Alterac Valley - Dun Baldar South Bunker - Alliance Controlled'), +(1362,1,'30,2197',NULL,'','Alterac Valley - Dun Baldar North Bunker - Alliance Controlled'), +(1363,1,'30,2197',NULL,'','Alterac Valley - Icewing Bunker - Alliance Controlled'), +(1364,1,'30,2197',NULL,'','Alterac Valley - Stonehearth Bunker - Alliance Controlled'), +(1365,0,'30,2197',NULL,'','Alterac Valley - West Frostwolf Tower - Destroyed'), +(1366,0,'30,2197',NULL,'','Alterac Valley - East Frostwolf Tower - Destroyed'), +(1367,0,'30,2197',NULL,'','Alterac Valley - Tower Point - Destroyed'), +(1368,0,'30,2197',NULL,'','Alterac Valley - Iceblood Tower - Destroyed'), +(1370,0,'30,2197',NULL,'','Alterac Valley - Dun Baldar South Bunker - Destroyed'), +(1371,0,'30,2197',NULL,'','Alterac Valley - Dun Baldar North Bunker - Destroyed'), +(1372,0,'30,2197',NULL,'','Alterac Valley - Icewing Bunker - Destroyed'), +(1373,0,'30,2197',NULL,'','Alterac Valley - Stonehearth Bunker - Destroyed'), +(1374,0,'30,2197',NULL,'','Alterac Valley - Dun Baldar South Bunker - In Conflict'), +(1375,0,'30,2197',NULL,'','Alterac Valley - Dun Baldar North Bunker - In Conflict'), +(1376,0,'30,2197',NULL,'','Alterac Valley - Icewing Bunker - In Conflict'), +(1377,0,'30,2197',NULL,'','Alterac Valley - Stonehearth Bunker - In Conflict'), +(1378,0,'30,2197',NULL,'','Alterac Valley - Dun Baldar South Bunker - In Conflict'), +(1379,0,'30,2197',NULL,'','Alterac Valley - Dun Baldar North Bunker - In Conflict'), +(1380,0,'30,2197',NULL,'','Alterac Valley - Icewing Bunker - In Conflict'), +(1381,0,'30,2197',NULL,'','Alterac Valley - Stonehearth Bunker - In Conflict'), +(1382,1,'30,2197',NULL,'','Alterac Valley - West Frostwolf Tower - Horde Controlled'), +(1383,1,'30,2197',NULL,'','Alterac Valley - East Frostwolf Tower - Horde Controlled'), +(1384,1,'30,2197',NULL,'','Alterac Valley - Tower Point - Horde Controlled'), +(1385,1,'30,2197',NULL,'','Alterac Valley - Iceblood Tower - Horde Controlled'), +(1387,0,'30,2197',NULL,'','Alterac Valley - West Frostwolf Tower - In Conflict'), +(1388,0,'30,2197',NULL,'','Alterac Valley - East Frostwolf Tower - In Conflict'), +(1389,0,'30,2197',NULL,'','Alterac Valley - Tower Point - In Conflict'), +(1390,0,'30,2197',NULL,'','Alterac Valley - Iceblood Tower - In Conflict'), +(1392,0,'30,2197',NULL,'','Alterac Valley - West Frostwolf Tower - In Conflict'), +(1393,0,'30,2197',NULL,'','Alterac Valley - East Frostwolf Tower - In Conflict'), +(1394,0,'30,2197',NULL,'','Alterac Valley - Tower Point - In Conflict'), +(1395,0,'30,2197',NULL,'','Alterac Valley - Iceblood Tower - In Conflict'), +(1545,1,'489,726,2106',NULL,'','Warsong Gulch/Twin Peaks - Alliance flag state'), +(1546,1,'489,726,2106',NULL,'','Warsong Gulch/Twin Peaks - Horde flag state'), +(1547,0,'489,726,2106',NULL,'','Warsong Gulch/Twin Peaks - Neutral flag state'), +(1581,0,'489,726,2106',NULL,'','Warsong Gulch/Twin Peaks - Alliance flag captures'), +(1582,0,'489,726,2106',NULL,'','Warsong Gulch/Twin Peaks - Horde flag captures'), +(1601,3,'489,726,2106',NULL,'','Warsong Gulch/Twin Peaks - Max flag captures'), +(1664,1,'489,2106',NULL,'','Warsong Gulch - unknown state, enables Save the Day achievement (not the only requirement)'), +(1767,0,'529',NULL,'','Arathi Basin - Stables Alliance controlled'), +(1768,0,'529',NULL,'','Arathi Basin - Stables Horde controlled'), +(1769,0,'529',NULL,'','Arathi Basin - Stables Alliance - contested'), +(1770,0,'529',NULL,'','Arathi Basin - Stables Horde - contested'), +(1772,0,'529',NULL,'','Arathi Basin - Farm Alliance controlled'), +(1773,0,'529',NULL,'','Arathi Basin - Farm Horde controlled'), +(1774,0,'529',NULL,'','Arathi Basin - Farm Alliance - contested'), +(1775,0,'529',NULL,'','Arathi Basin - Farm Horde - contested'), +(1776,0,'529,566,761,968,1105,1681,2107,2177',NULL,'','Battlegrounds - Alliance resources'), +(1777,0,'529,566,761,968,1105,1681,2107,2177',NULL,'','Battlegrounds - Horde resources'), +(1778,0,'529,761,1681,2107,2177',NULL,'','Battlegrounds - Alliance bases'), +(1779,0,'529,761,1681,2107,2177',NULL,'','Battlegrounds - Horde bases'), +(1780,1500,'529,566,761,968,1105,1681,2107,2177',NULL,'','Battlegrounds - Max resources'), +(1782,0,'529',NULL,'','Arathi Basin - Blacksmith Alliance controlled'), +(1783,0,'529',NULL,'','Arathi Basin - Blacksmith Horde controlled'), +(1784,0,'529',NULL,'','Arathi Basin - Blacksmith Alliance - contested'), +(1785,0,'529',NULL,'','Arathi Basin - Blacksmith Horde - contested'), +(1787,0,'529',NULL,'','Arathi Basin - Gold Mine Alliance controlled'), +(1788,0,'529',NULL,'','Arathi Basin - Gold Mine Horde controlled'), +(1789,0,'529',NULL,'','Arathi Basin - Gold Mine Alliance - contested'), +(1790,0,'529',NULL,'','Arathi Basin - Gold Mine Horde - contested'), +(1792,0,'529',NULL,'','Arathi Basin - Lumber Mill Alliance controlled'), +(1793,0,'529',NULL,'','Arathi Basin - Lumber Mill Horde controlled'), +(1794,0,'529',NULL,'','Arathi Basin - Lumber Mill Alliance - contested'), +(1795,0,'529',NULL,'','Arathi Basin - Lumber Mill Horde - contested'), +(1842,1,'529',NULL,'','Arathi Basin - Stables uncontrolled POI'), +(1843,1,'529',NULL,'','Arathi Basin - Gold Mine uncontrolled POI'), +(1844,1,'529',NULL,'','Arathi Basin - Lumber Mill uncontrolled POI'), +(1845,1,'529',NULL,'','Arathi Basin - Farm uncontrolled POI'), +(1846,1,'529',NULL,'','Arathi Basin - Blacksmith uncontrolled POI'), +(1955,1400,'529,1681,2107,2177',NULL,'','Arathi Basin - Near victory resource level warning'), +(1966,1,'30,2197',NULL,'','Alterac Valley - Snowfall Graveyard - Uncontrolled'), +(2338,1,'489,2106',NULL,'','Warsong Gulch - Horde flag control state'), +(2339,1,'489,2106',NULL,'','Warsong Gulch - Alliance flag control state'), +(2718,0,'566',NULL,'','Eye of the Storm - Show capturing progress bar'), +(2719,50,'566',NULL,'','Eye of the Storm - Capturing progress bar current value'), +(2720,40,'566',NULL,'','Eye of the Storm - Capturing progress bar neutral zone size'), +(2722,1,'566,968',NULL,'','Eye of the Storm - Blood Elf Tower uncontrolled POI'), +(2723,0,'566,968',NULL,'','Eye of the Storm - Blood Elf Tower Alliance control POI'), +(2724,0,'566,968',NULL,'','Eye of the Storm - Blood Elf Tower Horde control POI'), +(2725,1,'566,968',NULL,'','Eye of the Storm - Fel Reaver Ruins uncontrolled POI'), +(2726,0,'566,968',NULL,'','Eye of the Storm - Fel Reaver Ruins Alliance control POI'), +(2727,0,'566,968',NULL,'','Eye of the Storm - Fel Reaver Ruins Horde control POI'), +(2728,1,'566,968',NULL,'','Eye of the Storm - Mage Tower uncontrolled POI'), +(2729,0,'566,968',NULL,'','Eye of the Storm - Mage Tower Horde control POI'), +(2730,0,'566,968',NULL,'','Eye of the Storm - Mage Tower Alliance control POI'), +(2731,1,'566,968',NULL,'','Eye of the Storm - Draenei Ruins uncontrolled POI'), +(2732,0,'566,968',NULL,'','Eye of the Storm - Draenei Ruins Alliance control POI'), +(2733,0,'566,968',NULL,'','Eye of the Storm - Draenei Ruins Horde control POI'), +(2752,0,'566,968',NULL,'','Eye of the Storm - Alliance bases controlled'), +(2753,0,'566,968',NULL,'','Eye of the Storm - Horde bases controlled'), +(3127,700,'30',NULL,'','Alterac Valley - Alliance Reinforcements'), +(3128,700,'30',NULL,'','Alterac Valley - Horde Reinforcements'), +(3133,1,'30',NULL,'','Alterac Valley - Show Horde Reinforcements'), +(3134,1,'30',NULL,'','Alterac Valley - Show Alliance Reinforcements'), +(3136,700,'30',NULL,'','Alterac Valley - Max Reinforcements'), +(3557,0,'607',NULL,'','Strand of the Ancients - Timer'), +(3564,0,'607',NULL,'','Strand of the Ancients - Show timer'), +(3565,0,'607',NULL,'','Strand of the Ancients - Show timer'), +(3571,0,'607',NULL,'','Strand of the Ancients - Show bonus timer'), +(3600,0,'559,562,572,617,618,980,1134,1504,1505,1552,1672,1825,1911,2167,2373,2509,2511,2547',NULL,'','Arenas - Green Team Players remaining'), +(3601,0,'559,562,572,617,618,980,1134,1504,1505,1552,1672,1825,1911,2167,2373,2509,2511,2547',NULL,'','Arenas - Gold Team Players remaining'), +(3610,1,'559,562,572,617,618,980,1134,1504,1505,1552,1672,1825,1911,2167,2373,2509,2511,2547',NULL,'','Arenas - Show players remaining'), +(3614,1,'607',NULL,'','Strand of the Ancients - Gate of the Purple Amethyst'), +(3617,1,'607',NULL,'','Strand of the Ancients - Gate of the Red Sun'), +(3620,1,'607',NULL,'','Strand of the Ancients - Gate of the Blue Sapphire'), +(3623,1,'607',NULL,'','Strand of the Ancients - Gate of the Green Emerald'), +(3626,0,'607',NULL,'','Strand of the Ancients - The Frostbreaker - Alliance Offense'), +(3627,0,'607',NULL,'','Strand of the Ancients - The Graceful Maiden - Alliance Offense'), +(3628,0,'607',NULL,'','Strand of the Ancients - The Blightbringer - Horde Offense'), +(3629,0,'607',NULL,'','Strand of the Ancients - The Casket Carrier - Horde Offense'), +(3630,0,'607',NULL,'','Strand of the Ancients - Alliance Defense'), +(3631,0,'607',NULL,'','Strand of the Ancients - Horde Defense'), +(3632,0,'607',NULL,'','Strand of the Ancients - East Graveyard - Horde Controlled'), +(3633,0,'607',NULL,'','Strand of the Ancients - West Graveyard - Horde Controlled'), +(3634,0,'607',NULL,'','Strand of the Ancients - South Graveyard - Horde Controlled'), +(3635,0,'607',NULL,'','Strand of the Ancients - West Graveyard - Alliance Controlled'), +(3636,0,'607',NULL,'','Strand of the Ancients - East Graveyard - Alliance Controlled'), +(3637,0,'607',NULL,'','Strand of the Ancients - South Graveyard - Alliance Controlled'), +(3638,1,'607',NULL,'','Strand of the Ancients - Gate of the Yellow Moon'), +(3644,0,'529,761,1681,2107,2177',NULL,'','Battlegrounds - Alliance overcame resource disadvantage'), +(3645,0,'529,761,1681,2107,2177',NULL,'','Battlegrounds - Horde overcame resource disadvantage'), +(3690,0,'607',NULL,'','Strand of the Ancients - Attacker team'), +(3849,1,'607',NULL,'','Strand of the Ancients - Chamber of Ancient Relics'), +(3955,0,'607',NULL,'','Strand of the Ancients - Destroyed Alliance vehicles'), +(3956,0,'607',NULL,'','Strand of the Ancients - Destroyed Horde vehicles'), +(4221,1,'628',NULL,'','Isle of Conquest - Show Alliance reinforcements'), +(4222,1,'628',NULL,'','Isle of Conquest - Show Horde reinforcements'), +(4226,400,'628',NULL,'','Isle of Conquest - Alliance reinforcements'), +(4227,400,'628',NULL,'','Isle of Conquest - Horde reinforcements'), +(4228,0,'628',NULL,'','Isle of Conquest - Workshop - In Conflict Alliance'), +(4229,0,'628',NULL,'','Isle of Conquest - Workshop - Alliance Controlled'), +(4230,0,'628',NULL,'','Isle of Conquest - Workshop - Horde Controlled'), +(4232,0,'628',NULL,'','Isle of Conquest - Workshop - Owner'), +(4234,0,'628',NULL,'','Isle of Conquest - Hangar - Owner'), +(4235,0,'628',NULL,'','Isle of Conquest - Docks - Owner'), +(4247,0,'489,726,2106',NULL,'','Warsong Gulch/Twin Peaks - Show timer'), +(4248,0,'489,726,2106',NULL,'','Warsong Gulch/Twin Peaks - Timer'), +(4287,0,'628',NULL,'','Isle of Conquest - Refinery - Owner'), +(4289,0,'628',NULL,'','Isle of Conquest - Quarry - Owner'), +(4293,0,'628',NULL,'','Isle of Conquest - Workshop - In Conflict Horde'), +(4294,1,'628',NULL,'','Isle of Conquest - Workshop - Uncontrolled'), +(4296,1,'628',NULL,'','Isle of Conquest - Hangar - Uncontrolled'), +(4297,0,'628',NULL,'','Isle of Conquest - Hangar - In Conflict Horde'), +(4298,0,'628',NULL,'','Isle of Conquest - Hangar - Horde Controlled'), +(4299,0,'628',NULL,'','Isle of Conquest - Hangar - Alliance Controlled'), +(4300,0,'628',NULL,'','Isle of Conquest - Hangar - In Conflict Alliance'), +(4301,1,'628',NULL,'','Isle of Conquest - Docks - Uncontrolled'), +(4302,0,'628',NULL,'','Isle of Conquest - Docks - In Conflict Horde'), +(4303,0,'628',NULL,'','Isle of Conquest - Docks - Horde Controlled'), +(4304,0,'628',NULL,'','Isle of Conquest - Docks - Alliance Controlled'), +(4305,0,'628',NULL,'','Isle of Conquest - Docks - In Conflict Alliance'), +(4306,1,'628',NULL,'','Isle of Conquest - Quarry - Uncontrolled'), +(4307,0,'628',NULL,'','Isle of Conquest - Quarry - In Conflict Horde'), +(4308,0,'628',NULL,'','Isle of Conquest - Quarry - Horde Controlled'), +(4309,0,'628',NULL,'','Isle of Conquest - Quarry - Alliance Controlled'), +(4310,0,'628',NULL,'','Isle of Conquest - Quarry - In Conflict Alliance'), +(4311,1,'628',NULL,'','Isle of Conquest - Refinery - Uncontrolled'), +(4312,0,'628',NULL,'','Isle of Conquest - Refinery - In Conflict Horde'), +(4313,0,'628',NULL,'','Isle of Conquest - Refinery - Horde Controlled'), +(4314,0,'628',NULL,'','Isle of Conquest - Refinery - Alliance Controlled'), +(4315,0,'628',NULL,'','Isle of Conquest - Refinery - In Conflict Alliance'), +(4317,1,'628',NULL,'','Isle of Conquest - Horde Front Gate'), +(4318,1,'628',NULL,'','Isle of Conquest - Horde West Gate'), +(4319,1,'628',NULL,'','Isle of Conquest - Horde East Gate'), +(4320,0,'628',NULL,'','Isle of Conquest - Horde East Gate - Destroyed'), +(4321,0,'628',NULL,'','Isle of Conquest - Horde West Gate - Destroyed'), +(4322,0,'628',NULL,'','Isle of Conquest - Horde Front Gate - Destroyed'), +(4323,0,'628',NULL,'','Isle of Conquest - Alliance Front Gate - Destroyed'), +(4324,0,'628',NULL,'','Isle of Conquest - Alliance West Gate - Destroyed'), +(4325,0,'628',NULL,'','Isle of Conquest - Alliance East Gate - Destroyed'), +(4326,1,'628',NULL,'','Isle of Conquest - Alliance East Gate'), +(4327,1,'628',NULL,'','Isle of Conquest - Alliance West Gate'), +(4328,1,'628',NULL,'','Isle of Conquest - Alliance Front Gate'), +(4339,1,'628',NULL,'','Isle of Conquest - Alliance Keep - Alliance Controlled'), +(4340,0,'628',NULL,'','Isle of Conquest - Alliance Keep - Horde Controlled'), +(4341,0,'628',NULL,'','Isle of Conquest - Alliance Keep - Uncontrolled'), +(4342,0,'628',NULL,'','Isle of Conquest - Alliance Keep - In Conflict Alliance'), +(4343,0,'628',NULL,'','Isle of Conquest - Alliance Keep - In Conflict Horde'), +(4344,0,'628',NULL,'','Isle of Conquest - Horde Keep - Alliance Controlled'), +(4345,1,'628',NULL,'','Isle of Conquest - Horde Keep - Horde Controlled'), +(4346,0,'628',NULL,'','Isle of Conquest - Horde Keep - Uncontrolled'), +(4347,0,'628',NULL,'','Isle of Conquest - Horde Keep - In Conflict Alliance'), +(4348,0,'628',NULL,'','Isle of Conquest - Horde Keep - In Conflict Horde'), +(4352,0,'607',NULL,'','Strand of the Ancients - Alliance Attacker'), +(4353,0,'607',NULL,'','Strand of the Ancients - Horde Attacker'), +(5834,0,'529,1681,2107,2177',NULL,'','Arathi Basin - Stables control state POI'); + +DELETE FROM `achievement_criteria_data` WHERE `ScriptName` IN ( +'achievement_resilient_victory', +'achievement_bg_control_all_nodes', +'achievement_save_the_day', +'achievement_bg_ic_resource_glut', +'achievement_bg_ic_glaive_grave', +'achievement_bg_ic_mowed_down', +'achievement_bg_sa_artillery', +'achievement_sickly_gazelle', +'achievement_everything_counts', +'achievement_bg_av_perfection', +'achievement_bg_sa_defense_of_ancients', +'achievement_not_even_a_scratch' +); diff --git a/src/server/game/Battlegrounds/Arena.cpp b/src/server/game/Battlegrounds/Arena.cpp index d7c0a1a89a..463b8874b6 100644 --- a/src/server/game/Battlegrounds/Arena.cpp +++ b/src/server/game/Battlegrounds/Arena.cpp @@ -26,7 +26,6 @@ #include "Player.h" #include "World.h" #include "WorldSession.h" -#include "WorldStatePackets.h" void ArenaScore::AppendToPacket(WorldPacket& data, ByteBuffer& content) { @@ -156,12 +155,6 @@ void Arena::RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team* CheckWinConditions(); } -void Arena::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) -{ - data.Worldstates.emplace_back(uint32(ARENA_WORLD_STATE_ALIVE_PLAYERS_GREEN), uint32(GetAlivePlayersCountByTeam(HORDE))); - data.Worldstates.emplace_back(uint32(ARENA_WORLD_STATE_ALIVE_PLAYERS_GOLD), uint32(GetAlivePlayersCountByTeam(ALLIANCE))); -} - void Arena::UpdateArenaWorldState() { UpdateWorldState(ARENA_WORLD_STATE_ALIVE_PLAYERS_GREEN, GetAlivePlayersCountByTeam(HORDE)); diff --git a/src/server/game/Battlegrounds/Arena.h b/src/server/game/Battlegrounds/Arena.h index 4c26ea7d58..c1f3d1c7a1 100644 --- a/src/server/game/Battlegrounds/Arena.h +++ b/src/server/game/Battlegrounds/Arena.h @@ -49,7 +49,8 @@ enum ArenaSpellIds enum ArenaWorldStates { ARENA_WORLD_STATE_ALIVE_PLAYERS_GREEN = 3600, - ARENA_WORLD_STATE_ALIVE_PLAYERS_GOLD = 3601 + ARENA_WORLD_STATE_ALIVE_PLAYERS_GOLD = 3601, + ARENA_WORLD_STATE_SHOW_ALIVE_PLAYERS = 3610 }; class TC_GAME_API Arena : public Battleground @@ -60,7 +61,6 @@ class TC_GAME_API Arena : public Battleground void AddPlayer(Player* player) override; void RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team*/) override; - void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) override; void UpdateArenaWorldState(); void HandleKillPlayer(Player* player, Player* killer) override; diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 6da9d31a5a..2bf43d49eb 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -41,6 +41,7 @@ #include "TemporarySummon.h" #include "Transport.h" #include "Util.h" +#include "WorldStateMgr.h" #include "WorldPacket.h" #include @@ -740,18 +741,9 @@ void Battleground::RewardReputationToTeam(uint32 faction_id, uint32 Reputation, } } -void Battleground::UpdateWorldState(uint32 Field, uint32 Value) +void Battleground::UpdateWorldState(int32 worldStateId, int32 value, bool hidden /*= false*/) { - WorldPacket data; - sBattlegroundMgr->BuildUpdateWorldStatePacket(&data, Field, Value); - SendPacketToAll(&data); -} - -void Battleground::UpdateWorldStateForPlayer(uint32 field, uint32 value, Player* player) -{ - WorldPacket data; - sBattlegroundMgr->BuildUpdateWorldStatePacket(&data, field, value); - player->SendDirectMessage(&data); + sWorldStateMgr->SetValue(worldStateId, value, hidden, GetBgMap()); } void Battleground::EndBattleground(uint32 winner) @@ -1066,8 +1058,6 @@ void Battleground::Reset() for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i) _arenaTeamScores[i].Reset(); - - ResetBGSubclass(); } void Battleground::StartBattleground() @@ -1931,12 +1921,6 @@ void Battleground::HandleAreaTrigger(Player* player, uint32 trigger) trigger, player->GetMapId(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); } -bool Battleground::CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* /*source*/, Unit const* /*target*/, uint32 /*miscvalue1*/) -{ - TC_LOG_ERROR("bg.battleground", "Battleground::CheckAchievementCriteriaMeet: No implementation for criteria %u", criteriaId); - return false; -} - uint8 Battleground::GetUniqueBracketId() const { return uint8(GetMinLevel() / 5) - 1; // 10 - 1, 15 - 2, 20 - 3, etc. diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h index 70639d120a..b7124fad13 100644 --- a/src/server/game/Battlegrounds/Battleground.h +++ b/src/server/game/Battlegrounds/Battleground.h @@ -39,14 +39,6 @@ struct BattlegroundScore; struct PvPDifficultyEntry; struct WorldSafeLocsEntry; -namespace WorldPackets -{ - namespace WorldState - { - class InitWorldStates; - } -} - enum BattlegroundDesertionType { BG_DESERTION_TYPE_LEAVE_BG = 0, // player leaves the BG @@ -56,16 +48,6 @@ enum BattlegroundDesertionType BG_DESERTION_TYPE_INVITE_LOGOUT = 4, // player is invited to join and logs out }; -enum BattlegroundCriteriaId -{ - BG_CRITERIA_CHECK_RESILIENT_VICTORY, - BG_CRITERIA_CHECK_SAVE_THE_DAY, - BG_CRITERIA_CHECK_EVERYTHING_COUNTS, - BG_CRITERIA_CHECK_AV_PERFECTION, - BG_CRITERIA_CHECK_DEFENSE_OF_THE_ANCIENTS, - BG_CRITERIA_CHECK_NOT_EVEN_A_SCRATCH, -}; - enum BattlegroundBroadcastTexts { BG_TEXT_ALLIANCE_WINS = 10633, @@ -258,14 +240,10 @@ class TC_GAME_API Battleground virtual void Reset(); // resets all common properties for battlegrounds, must be implemented and called in BG subclass virtual void StartingEventCloseDoors() { } virtual void StartingEventOpenDoors() { } - virtual void ResetBGSubclass() { } // must be implemented in BG subclass virtual void DestroyGate(Player* /*player*/, GameObject* /*go*/) { } - /* achievement req. */ - virtual bool IsAllNodesControlledByTeam(uint32 /*team*/) const { return false; } void TriggerGameEvent(uint32 gameEventId); - virtual bool CheckAchievementCriteriaMeet(uint32 /*criteriaId*/, Player const* /*player*/, Unit const* /*target*/ = nullptr, uint32 /*miscvalue1*/ = 0); /* Battleground */ // Get methods: @@ -375,7 +353,6 @@ class TC_GAME_API Battleground // Packet Transfer // method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!) - virtual void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& /*data*/) { } void SendPacketToTeam(uint32 TeamID, WorldPacket* packet, Player* sender = nullptr, bool self = true); void SendPacketToAll(WorldPacket const* packet); @@ -391,12 +368,10 @@ class TC_GAME_API Battleground void RemoveAuraOnTeam(uint32 SpellID, uint32 TeamID); void RewardHonorToTeam(uint32 Honor, uint32 TeamID); void RewardReputationToTeam(uint32 faction_id, uint32 Reputation, uint32 TeamID); - void UpdateWorldState(uint32 Field, uint32 Value); - void UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player* player); + void UpdateWorldState(int32 worldStateId, int32 value, bool hidden = false); virtual void EndBattleground(uint32 winner); void BlockMovement(Player* player); - void SendWarningToAll(uint32 entry, ...); void SendMessageToAll(uint32 entry, ChatMsg type, Player const* source = nullptr); void PSendMessageToAll(uint32 entry, ChatMsg type, Player const* source, ...); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index 46a2cf66f1..ee9b65e62d 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp @@ -26,8 +26,6 @@ #include "Random.h" #include "Util.h" #include "WorldPacket.h" -#include "WorldStatePackets.h" -#include "WorldSession.h" void BattlegroundABScore::BuildObjectivesBlock(WorldPacket& data, ByteBuffer& content) { @@ -58,7 +56,6 @@ BattlegroundAB::BattlegroundAB() m_lastTick[i] = 0; m_HonorScoreTics[i] = 0; m_ReputationScoreTics[i] = 0; - m_TeamScores500Disadvantage[i] = false; } m_HonorTics = 0; @@ -167,14 +164,19 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff) m_TeamScores[team] = BG_AB_MAX_TEAM_SCORE; if (team == TEAM_ALLIANCE) - UpdateWorldState(BG_AB_OP_RESOURCES_ALLY, m_TeamScores[team]); + UpdateWorldState(BG_AB_WS_RESOURCES_ALLY, m_TeamScores[team]); else - UpdateWorldState(BG_AB_OP_RESOURCES_HORDE, m_TeamScores[team]); + UpdateWorldState(BG_AB_WS_RESOURCES_HORDE, m_TeamScores[team]); // update achievement flags // we increased m_TeamScores[team] so we just need to check if it is 500 more than other teams resources uint8 otherTeam = (team + 1) % BG_TEAMS_COUNT; if (m_TeamScores[team] > m_TeamScores[otherTeam] + 500) - m_TeamScores500Disadvantage[otherTeam] = true; + { + if (team == TEAM_ALLIANCE) + UpdateWorldState(BG_AB_WS_HAD_500_DISADVANTAGE_HORDE, 1); + else + UpdateWorldState(BG_AB_WS_HAD_500_DISADVANTAGE_ALLIANCE, 1); + } } } @@ -303,51 +305,18 @@ void BattlegroundAB::_DelBanner(uint8 node, uint8 type, uint8 teamIndex) SpawnBGObject(obj, RESPAWN_ONE_DAY); } -void BattlegroundAB::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) -{ - const uint8 plusArray[] = {0, 2, 3, 0, 1}; - - // Node icons - for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node) - data.Worldstates.emplace_back(BG_AB_OP_NODEICONS[node], uint32((m_Nodes[node] == 0) ? 1 : 0)); - - // Node occupied states - for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node) - for (uint8 i = 1; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) - data.Worldstates.emplace_back(uint32(BG_AB_OP_NODESTATES[node] + plusArray[i]), uint32((m_Nodes[node] == i) ? 1 : 0)); - - // How many bases each team owns - uint8 ally = 0, horde = 0; - for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node) - if (m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_OCCUPIED) - ++ally; - else if (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED) - ++horde; - - data.Worldstates.emplace_back(uint32(BG_AB_OP_OCCUPIED_BASES_ALLY), uint32(ally)); - data.Worldstates.emplace_back(uint32(BG_AB_OP_OCCUPIED_BASES_HORDE), uint32(horde)); - - // Team scores - data.Worldstates.emplace_back(uint32(BG_AB_OP_RESOURCES_MAX), uint32(BG_AB_MAX_TEAM_SCORE)); - data.Worldstates.emplace_back(uint32(BG_AB_OP_RESOURCES_WARNING), uint32(BG_AB_WARNING_NEAR_VICTORY_SCORE)); - data.Worldstates.emplace_back(uint32(BG_AB_OP_RESOURCES_ALLY), uint32(m_TeamScores[TEAM_ALLIANCE])); - data.Worldstates.emplace_back(uint32(BG_AB_OP_RESOURCES_HORDE), uint32(m_TeamScores[TEAM_HORDE])); - - // other unknown - data.Worldstates.emplace_back(uint32(0x745), uint32(0x2)); // 37 1861 unk -} - void BattlegroundAB::_SendNodeUpdate(uint8 node) { // Send node owner state update to refresh map icons on client - const uint8 plusArray[] = {0, 2, 3, 0, 1}; + constexpr int32 idPlusArray[] = { 0, 2, 3, 0, 1 }; + constexpr int32 statePlusArray[] = { 0, 2, 0, 2, 0 }; if (m_prevNodes[node]) - UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_prevNodes[node]], 0); + UpdateWorldState(BG_AB_OP_NODESTATES[node] + idPlusArray[m_prevNodes[node]], 0); else UpdateWorldState(BG_AB_OP_NODEICONS[node], 0); - UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_Nodes[node]], 1); + UpdateWorldState(BG_AB_OP_NODESTATES[node] + idPlusArray[m_Nodes[node]], 1); // How many bases each team owns uint8 ally = 0, horde = 0; @@ -357,8 +326,8 @@ void BattlegroundAB::_SendNodeUpdate(uint8 node) else if (m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED) ++horde; - UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_ALLY, ally); - UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_HORDE, horde); + UpdateWorldState(BG_AB_WS_OCCUPIED_BASES_ALLY, ally); + UpdateWorldState(BG_AB_WS_OCCUPIED_BASES_HORDE, horde); } void BattlegroundAB::_NodeOccupied(uint8 node, Team team) @@ -585,6 +554,9 @@ bool BattlegroundAB::SetupBattleground() TC_LOG_ERROR("sql.sql", "BatteGroundAB: Failed to spawn buff object!"); } + UpdateWorldState(BG_AB_WS_RESOURCES_MAX, BG_AB_MAX_TEAM_SCORE); + UpdateWorldState(BG_AB_WS_RESOURCES_WARNING, BG_AB_WARNING_NEAR_VICTORY_SCORE); + return true; } @@ -605,8 +577,6 @@ void BattlegroundAB::Reset() bool isBGWeekend = sBattlegroundMgr->IsBGWeekend(GetTypeID()); m_HonorTics = (isBGWeekend) ? BG_AB_ABBGWeekendHonorTicks : BG_AB_NotABBGWeekendHonorTicks; m_ReputationTics = (isBGWeekend) ? BG_AB_ABBGWeekendReputationTicks : BG_AB_NotABBGWeekendReputationTicks; - m_TeamScores500Disadvantage[TEAM_ALLIANCE] = false; - m_TeamScores500Disadvantage[TEAM_HORDE] = false; for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) { @@ -692,25 +662,3 @@ bool BattlegroundAB::UpdatePlayerScore(Player* player, uint32 type, uint32 value } return true; } - -bool BattlegroundAB::IsAllNodesControlledByTeam(uint32 team) const -{ - uint32 count = 0; - for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) - if ((team == ALLIANCE && m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED) || - (team == HORDE && m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)) - ++count; - - return count == BG_AB_DYNAMIC_NODES_COUNT; -} - -bool BattlegroundAB::CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* player, Unit const* target, uint32 miscvalue) -{ - switch (criteriaId) - { - case BG_CRITERIA_CHECK_RESILIENT_VICTORY: - return m_TeamScores500Disadvantage[GetTeamIndexByTeamId(player->GetTeam())]; - } - - return Battleground::CheckAchievementCriteriaMeet(criteriaId, player, target, miscvalue); -} diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h index 7287cff2fe..5078ae4cce 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h @@ -31,45 +31,46 @@ namespace WorldPackets enum BG_AB_WorldStates { - BG_AB_OP_OCCUPIED_BASES_HORDE = 1778, - BG_AB_OP_OCCUPIED_BASES_ALLY = 1779, - BG_AB_OP_RESOURCES_ALLY = 1776, - BG_AB_OP_RESOURCES_HORDE = 1777, - BG_AB_OP_RESOURCES_MAX = 1780, - BG_AB_OP_RESOURCES_WARNING = 1955 -/* - BG_AB_OP_STABLE_ICON = 1842, //Stable map icon (NONE) - BG_AB_OP_STABLE_STATE_ALIENCE = 1767, //Stable map state (ALIENCE) - BG_AB_OP_STABLE_STATE_HORDE = 1768, //Stable map state (HORDE) - BG_AB_OP_STABLE_STATE_CON_ALI = 1769, //Stable map state (CON ALIENCE) - BG_AB_OP_STABLE_STATE_CON_HOR = 1770, //Stable map state (CON HORDE) - BG_AB_OP_FARM_ICON = 1845, //Farm map icon (NONE) - BG_AB_OP_FARM_STATE_ALIENCE = 1772, //Farm state (ALIENCE) - BG_AB_OP_FARM_STATE_HORDE = 1773, //Farm state (HORDE) - BG_AB_OP_FARM_STATE_CON_ALI = 1774, //Farm state (CON ALIENCE) - BG_AB_OP_FARM_STATE_CON_HOR = 1775, //Farm state (CON HORDE) + BG_AB_WS_OCCUPIED_BASES_HORDE = 1778, + BG_AB_WS_OCCUPIED_BASES_ALLY = 1779, + BG_AB_WS_RESOURCES_ALLY = 1776, + BG_AB_WS_RESOURCES_HORDE = 1777, + BG_AB_WS_RESOURCES_MAX = 1780, + BG_AB_WS_RESOURCES_WARNING = 1955, - BG_AB_OP_BLACKSMITH_ICON = 1846, //Blacksmith map icon (NONE) - BG_AB_OP_BLACKSMITH_STATE_ALIENCE = 1782, //Blacksmith map state (ALIENCE) - BG_AB_OP_BLACKSMITH_STATE_HORDE = 1783, //Blacksmith map state (HORDE) - BG_AB_OP_BLACKSMITH_STATE_CON_ALI = 1784, //Blacksmith map state (CON ALIENCE) - BG_AB_OP_BLACKSMITH_STATE_CON_HOR = 1785, //Blacksmith map state (CON HORDE) - BG_AB_OP_LUMBERMILL_ICON = 1844, //Lumber Mill map icon (NONE) - BG_AB_OP_LUMBERMILL_STATE_ALIENCE = 1792, //Lumber Mill map state (ALIENCE) - BG_AB_OP_LUMBERMILL_STATE_HORDE = 1793, //Lumber Mill map state (HORDE) - BG_AB_OP_LUMBERMILL_STATE_CON_ALI = 1794, //Lumber Mill map state (CON ALIENCE) - BG_AB_OP_LUMBERMILL_STATE_CON_HOR = 1795, //Lumber Mill map state (CON HORDE) - BG_AB_OP_GOLDMINE_ICON = 1843, //Gold Mine map icon (NONE) - BG_AB_OP_GOLDMINE_STATE_ALIENCE = 1787, //Gold Mine map state (ALIENCE) - BG_AB_OP_GOLDMINE_STATE_HORDE = 1788, //Gold Mine map state (HORDE) - BG_AB_OP_GOLDMINE_STATE_CON_ALI = 1789, //Gold Mine map state (CON ALIENCE - BG_AB_OP_GOLDMINE_STATE_CON_HOR = 1790, //Gold Mine map state (CON HORDE) -*/ + BG_AB_WS_STABLE_ICON = 1842, // Stable map icon (NONE) + BG_AB_WS_STABLE_STATE_ALIENCE = 1767, // Stable map state (ALIENCE) + BG_AB_WS_STABLE_STATE_HORDE = 1768, // Stable map state (HORDE) + BG_AB_WS_STABLE_STATE_CON_ALI = 1769, // Stable map state (CON ALIENCE) + BG_AB_WS_STABLE_STATE_CON_HOR = 1770, // Stable map state (CON HORDE) + BG_AB_WS_FARM_ICON = 1845, // Farm map icon (NONE) + BG_AB_WS_FARM_STATE_ALIENCE = 1772, // Farm state (ALIENCE) + BG_AB_WS_FARM_STATE_HORDE = 1773, // Farm state (HORDE) + BG_AB_WS_FARM_STATE_CON_ALI = 1774, // Farm state (CON ALIENCE) + BG_AB_WS_FARM_STATE_CON_HOR = 1775, // Farm state (CON HORDE) + BG_AB_WS_BLACKSMITH_ICON = 1846, // Blacksmith map icon (NONE) + BG_AB_WS_BLACKSMITH_STATE_ALIENCE = 1782, // Blacksmith map state (ALIENCE) + BG_AB_WS_BLACKSMITH_STATE_HORDE = 1783, // Blacksmith map state (HORDE) + BG_AB_WS_BLACKSMITH_STATE_CON_ALI = 1784, // Blacksmith map state (CON ALIENCE) + BG_AB_WS_BLACKSMITH_STATE_CON_HOR = 1785, // Blacksmith map state (CON HORDE) + BG_AB_WS_LUMBERMILL_ICON = 1844, // Lumber Mill map icon (NONE) + BG_AB_WS_LUMBERMILL_STATE_ALIENCE = 1792, // Lumber Mill map state (ALIENCE) + BG_AB_WS_LUMBERMILL_STATE_HORDE = 1793, // Lumber Mill map state (HORDE) + BG_AB_WS_LUMBERMILL_STATE_CON_ALI = 1794, // Lumber Mill map state (CON ALIENCE) + BG_AB_WS_LUMBERMILL_STATE_CON_HOR = 1795, // Lumber Mill map state (CON HORDE) + BG_AB_WS_GOLDMINE_ICON = 1843, // Gold Mine map icon (NONE) + BG_AB_WS_GOLDMINE_STATE_ALIENCE = 1787, // Gold Mine map state (ALIENCE) + BG_AB_WS_GOLDMINE_STATE_HORDE = 1788, // Gold Mine map state (HORDE) + BG_AB_WS_GOLDMINE_STATE_CON_ALI = 1789, // Gold Mine map state (CON ALIENCE + BG_AB_WS_GOLDMINE_STATE_CON_HOR = 1790, // Gold Mine map state (CON HORDE) + + BG_AB_WS_HAD_500_DISADVANTAGE_ALLIANCE = 3644, + BG_AB_WS_HAD_500_DISADVANTAGE_HORDE = 3645, }; -const uint32 BG_AB_OP_NODESTATES[5] = {1767, 1782, 1772, 1792, 1787}; +const int32 BG_AB_OP_NODESTATES[5] = {1767, 1782, 1772, 1792, 1787}; -const uint32 BG_AB_OP_NODEICONS[5] = {1842, 1846, 1845, 1844, 1843}; +const int32 BG_AB_OP_NODEICONS[5] = {1842, 1846, 1845, 1844, 1843}; /* Note: code uses that these IDs follow each other */ enum BG_AB_NodeObjectId @@ -322,15 +323,9 @@ class BattlegroundAB : public Battleground /* Scorekeeping */ bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override; - void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) override; - /* Nodes occupying */ void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj) override; - /* achievement req. */ - bool IsAllNodesControlledByTeam(uint32 team) const override; - bool CheckAchievementCriteriaMeet(uint32 /*criteriaId*/, Player const* /*player*/, Unit const* /*target*/ = nullptr, uint32 /*miscvalue1*/ = 0) override; - uint32 GetPrematureWinner() override; private: void PostUpdateImpl(uint32 diff) override; @@ -360,7 +355,5 @@ class BattlegroundAB : public Battleground bool m_IsInformedNearVictory; uint32 m_HonorTics; uint32 m_ReputationTics; - // need for achievements - bool m_TeamScores500Disadvantage[BG_TEAMS_COUNT]; }; #endif diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index 65e96d2941..844d405c86 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -25,8 +25,6 @@ #include "MotionMaster.h" #include "ObjectMgr.h" #include "Player.h" -#include "WorldSession.h" -#include "WorldStatePackets.h" void BattlegroundAVScore::BuildObjectivesBlock(WorldPacket& data, ByteBuffer& content) { @@ -96,6 +94,7 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer) */ if (entry == BG_AV_CreatureInfo[AV_NPC_A_BOSS]) { + UpdateWorldState(AV_WS_VANDAAR_ALIVE, 0); CastSpellOnTeam(23658, HORDE); //this is a spell which finishes a quest where a player has to kill the boss RewardReputationToTeam(729, BG_AV_REP_BOSS, HORDE); RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_BOSS), HORDE); @@ -104,6 +103,7 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer) } else if (entry == BG_AV_CreatureInfo[AV_NPC_H_BOSS]) { + UpdateWorldState(AV_WS_DREKTHAR_ALIVE, 0); CastSpellOnTeam(23658, ALLIANCE); //this is a spell which finishes a quest where a player has to kill the boss RewardReputationToTeam(730, BG_AV_REP_BOSS, ALLIANCE); RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_BOSS), ALLIANCE); @@ -118,6 +118,7 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer) return; } m_CaptainAlive[0]=false; + UpdateWorldState(AV_WS_BALINDA_ALIVE, 0); RewardReputationToTeam(729, BG_AV_REP_CAPTAIN, HORDE); RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_CAPTAIN), HORDE); UpdateScore(ALLIANCE, (-1)*BG_AV_RES_CAPTAIN); @@ -137,6 +138,7 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer) return; } m_CaptainAlive[1]=false; + UpdateWorldState(AV_WS_GALVAGAR_ALIVE, 0); RewardReputationToTeam(730, BG_AV_REP_CAPTAIN, ALLIANCE); RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_CAPTAIN), ALLIANCE); UpdateScore(HORDE, (-1)*BG_AV_RES_CAPTAIN); @@ -210,6 +212,7 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player) m_Team_QuestStatus[team][4]++; if (m_Team_QuestStatus[team][4] >= 200) TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid); + UpdateWorldState(team == TEAM_ALLIANCE ? AV_WS_IVUS_STORM_CRYSTAL_COUNT : AV_WS_LOKHOLAR_STORMPIKE_SOLDIERS_BLOOD_COUNT, m_Team_QuestStatus[team][4]); break; case AV_QUEST_A_NEAR_MINE: case AV_QUEST_H_NEAR_MINE: @@ -264,13 +267,13 @@ void BattlegroundAV::UpdateScore(uint16 team, int16 points) uint8 teamindex = GetTeamIndexByTeamId(team); //0=ally 1=horde m_Team_Scores[teamindex] += points; - UpdateWorldState(((teamindex == TEAM_HORDE)?AV_Horde_Score:AV_Alliance_Score), m_Team_Scores[teamindex]); + UpdateWorldState(teamindex == TEAM_HORDE ? AV_WS_HORDE_REINFORCEMENTS : AV_WS_ALLIANCE_REINFORCEMENTS, m_Team_Scores[teamindex]); if (points < 0) { if (m_Team_Scores[teamindex] < 1) { - m_Team_Scores[teamindex]=0; - EndBattleground(((teamindex == TEAM_HORDE)?ALLIANCE:HORDE)); + m_Team_Scores[teamindex] = 0; + EndBattleground(teamindex == TEAM_HORDE ? ALLIANCE : HORDE); } else if (!m_IsInformedNearVictory[teamindex] && m_Team_Scores[teamindex] < SEND_MSG_NEAR_LOSE) { @@ -437,8 +440,8 @@ void BattlegroundAV::StartingEventOpenDoors() for (uint8 mine = AV_NORTH_MINE; mine <= AV_SOUTH_MINE; mine++) //mine population ChangeMineOwner(mine, AV_NEUTRAL_TEAM, true); - UpdateWorldState(AV_SHOW_H_SCORE, 1); - UpdateWorldState(AV_SHOW_A_SCORE, 1); + UpdateWorldState(AV_WS_SHOW_HORDE_REINFORCEMENTS, 1); + UpdateWorldState(AV_WS_SHOW_ALLIANCE_REINFORCEMENTS, 1); DoorOpen(BG_AV_OBJECT_DOOR_H); DoorOpen(BG_AV_OBJECT_DOOR_A); @@ -1033,38 +1036,6 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object) UpdatePlayerScore(player, (IsTower(node)) ? SCORE_TOWERS_ASSAULTED : SCORE_GRAVEYARDS_ASSAULTED, 1); } -void BattlegroundAV::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) -{ - for (uint8 i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i) - { - uint16 owner = m_Nodes[i].Owner; - BG_AV_States state = m_Nodes[i].State; - - data.Worldstates.emplace_back(uint32(BGAVNodeInfo[i].WorldStateIds.AllianceAssault), uint32(owner == ALLIANCE && state == POINT_ASSAULTED)); - data.Worldstates.emplace_back(uint32(BGAVNodeInfo[i].WorldStateIds.AllianceControl), uint32(owner == ALLIANCE && state >= POINT_DESTROYED)); - data.Worldstates.emplace_back(uint32(BGAVNodeInfo[i].WorldStateIds.HordeAssault), uint32(owner == HORDE && state == POINT_ASSAULTED)); - data.Worldstates.emplace_back(uint32(BGAVNodeInfo[i].WorldStateIds.HordeControl), uint32(owner == HORDE && state >= POINT_DESTROYED)); - } - - data.Worldstates.emplace_back(uint32(AV_SNOWFALL_N), uint32(m_Nodes[BG_AV_NODES_SNOWFALL_GRAVE].Owner == AV_NEUTRAL_TEAM)); - - data.Worldstates.emplace_back(uint32(AV_Alliance_Score), uint32(m_Team_Scores[0])); - data.Worldstates.emplace_back(uint32(AV_Horde_Score), uint32(m_Team_Scores[1])); - - if (GetStatus() == STATUS_IN_PROGRESS) // only if game started the teamscores are displayed - { - data.Worldstates.emplace_back(uint32(AV_SHOW_A_SCORE), uint32(1)); - data.Worldstates.emplace_back(uint32(AV_SHOW_H_SCORE), uint32(1)); - } - else - { - data.Worldstates.emplace_back(uint32(AV_SHOW_A_SCORE), uint32(0)); - data.Worldstates.emplace_back(uint32(AV_SHOW_H_SCORE), uint32(0)); - } - SendMineWorldStates(AV_NORTH_MINE); - SendMineWorldStates(AV_SOUTH_MINE); -} - void BattlegroundAV::UpdateNodeWorldState(BG_AV_Nodes node) { if (StaticNodeInfo const* nodeInfo = GetStaticNodeInfo(node)) @@ -1076,10 +1047,12 @@ void BattlegroundAV::UpdateNodeWorldState(BG_AV_Nodes node) UpdateWorldState(nodeInfo->WorldStateIds.AllianceControl, owner == ALLIANCE && state >= POINT_DESTROYED); UpdateWorldState(nodeInfo->WorldStateIds.HordeAssault, owner == HORDE && state == POINT_ASSAULTED); UpdateWorldState(nodeInfo->WorldStateIds.HordeControl, owner == HORDE && state >= POINT_DESTROYED); + if (nodeInfo->WorldStateIds.Owner) + UpdateWorldState(nodeInfo->WorldStateIds.Owner, owner == HORDE ? 2 : owner == ALLIANCE ? 1 : 0); } if (node == BG_AV_NODES_SNOWFALL_GRAVE) - UpdateWorldState(AV_SNOWFALL_N, m_Nodes[node].Owner == AV_NEUTRAL_TEAM); + UpdateWorldState(AV_WS_SNOWFALL_GRAVEYARD_UNCONTROLLED, m_Nodes[node].Owner == AV_NEUTRAL_TEAM); } void BattlegroundAV::SendMineWorldStates(uint32 mine) @@ -1107,6 +1080,7 @@ void BattlegroundAV::SendMineWorldStates(uint32 mine) UpdateWorldState(BG_AV_MineWorldStates[mine2][owner], 1); if (prevowner != owner) UpdateWorldState(BG_AV_MineWorldStates[mine2][prevowner], 0); + UpdateWorldState(BG_AV_MineWorldStates[mine2][3], m_Mine_Owner[mine] == HORDE ? 2 : m_Mine_Owner[mine] == ALLIANCE ? 1 : 0); } WorldSafeLocsEntry const* BattlegroundAV::GetClosestGraveyard(Player* player) @@ -1479,8 +1453,10 @@ void BattlegroundAV::DefendNode(BG_AV_Nodes node, uint16 team) m_Nodes[node].Timer = 0; } -void BattlegroundAV::ResetBGSubclass() +void BattlegroundAV::Reset() { + Battleground::Reset(); + for (uint8 i=0; i<2; i++) //forloop for both teams (it just make 0 == alliance and 1 == horde also for both mines 0=north 1=south { for (uint8 j=0; j<9; j++) @@ -1509,69 +1485,6 @@ void BattlegroundAV::ResetBGSubclass() DelCreature(i); } -bool BattlegroundAV::CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target, uint32 miscValue) -{ - uint32 team = source->GetTeam(); - switch (criteriaId) - { - case BG_CRITERIA_CHECK_EVERYTHING_COUNTS: - for (uint8 mine = 0; mine < 2; mine++) - if (m_Mine_Owner[mine] != team) - return false; - - return true; - case BG_CRITERIA_CHECK_AV_PERFECTION: - { - if (team == ALLIANCE) - { - for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) // alliance towers controlled - { - if (m_Nodes[i].State == POINT_CONTROLED) - { - if (m_Nodes[i].Owner != ALLIANCE) - return false; - } - else - return false; - } - - for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) // horde towers destroyed - if (m_Nodes[i].State != POINT_DESTROYED) - return false; - - if (!m_CaptainAlive[0]) - return false; - - return true; - } - else if (team == HORDE) - { - for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) // horde towers controlled - { - if (m_Nodes[i].State == POINT_CONTROLED) - { - if (m_Nodes[i].Owner != HORDE) - return false; - } - else - return false; - } - - for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) // alliance towers destroyed - if (m_Nodes[i].State != POINT_DESTROYED) - return false; - - if (!m_CaptainAlive[1]) - return false; - - return true; - } - } - } - - return Battleground::CheckAchievementCriteriaMeet(criteriaId, source, target, miscValue); -} - uint32 BattlegroundAV::GetPrematureWinner() { uint32 allianceScore = m_Team_Scores[GetTeamIndexByTeamId(ALLIANCE)]; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h index 38c24e4593..8992f82225 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h @@ -1344,122 +1344,136 @@ enum BG_AV_States enum BG_AV_WorldStates { - AV_Alliance_Score = 3127, - AV_Horde_Score = 3128, - AV_SHOW_H_SCORE = 3133, - AV_SHOW_A_SCORE = 3134, - -/* - //the comments behind the state shows which icon overlaps the other.. but is, until now, unused and maybe not a good solution (but give few performance (:) + AV_WS_ALLIANCE_REINFORCEMENTS = 3127, + AV_WS_HORDE_REINFORCEMENTS = 3128, + AV_WS_SHOW_HORDE_REINFORCEMENTS = 3133, + AV_WS_SHOW_ALLIANCE_REINFORCEMENTS = 3134, + AV_WS_MAX_REINFORCEMENTS = 3136, // Graves - // Alliance //Stormpike first aid station - AV_AID_A_C = 1325, - AV_AID_A_A = 1326, - AV_AID_H_C = 1327, - AV_AID_H_A = 1328, + AV_WS_STORMPIKE_AID_STATION_ALLIANCE_CONTROLLED = 1325, + AV_WS_STORMPIKE_AID_STATION_IN_CONFLICT_ALLIANCE_ATTACKING = 1326, + AV_WS_STORMPIKE_AID_STATION_HORDE_CONTROLLED = 1327, + AV_WS_STORMPIKE_AID_STATION_IN_CONFLICT_HORDE_ATTACKING = 1328, //Stormpike Graveyard - AV_PIKEGRAVE_A_C = 1333, - AV_PIKEGRAVE_A_A = 1335, - AV_PIKEGRAVE_H_C = 1334, - AV_PIKEGRAVE_H_A = 1336, + AV_WS_STORMPIKE_GRAVEYARD_ALLIANCE_CONTROLLED = 1333, + AV_WS_STORMPIKE_GRAVEYARD_IN_CONFLICT_ALLIANCE_ATTACKING = 1335, + AV_WS_STORMPIKE_GRAVEYARD_HORDE_CONTROLLED = 1334, + AV_WS_STORMPIKE_GRAVEYARD_IN_CONFLICT_HORDE_ATTACKING = 1336, //Stoneheart Grave - AV_STONEHEART_A_C = 1302, - AV_STONEHEART_A_A = 1304, //over hc - AV_STONEHEART_H_C = 1301, //over ac - AV_STONEHEART_H_A = 1303, //over aa + AV_WS_STONEHEARTH_GRAVEYARD_ALLIANCE_CONTROLLED = 1302, + AV_WS_STONEHEARTH_GRAVEYARD_IN_CONFLICT_ALLIANCE_ATTACKING = 1304, + AV_WS_STONEHEARTH_GRAVEYARD_HORDE_CONTROLLED = 1301, + AV_WS_STONEHEARTH_GRAVEYARD_IN_CONFLICT_HORDE_ATTACKING = 1303, //Neutral //Snowfall Grave -*/ - AV_SNOWFALL_N = 1966 //over aa -/* - AV_SNOWFALL_A_C = 1341, //over hc - AV_SNOWFALL_A_A = 1343, //over ha - AV_SNOWFALL_H_C = 1342, - AV_SNOWFALL_H_A = 1344, //over ac + AV_WS_SNOWFALL_GRAVEYARD_UNCONTROLLED = 1966, + AV_WS_SNOWFALL_GRAVEYARD_ALLIANCE_CONTROLLED = 1341, + AV_WS_SNOWFALL_GRAVEYARD_IN_CONFLICT_ALLIANCE_ATTACKING = 1343, + AV_WS_SNOWFALL_GRAVEYARD_HORDE_CONTROLLED = 1342, + AV_WS_SNOWFALL_GRAVEYARD_IN_CONFLICT_HORDE_ATTACKING = 1344, //Horde //Iceblood grave - AV_ICEBLOOD_A_C = 1346, //over hc - AV_ICEBLOOD_A_A = 1348, //over ac - AV_ICEBLOOD_H_C = 1347, - AV_ICEBLOOD_H_A = 1349, //over aa + AV_WS_ICEBLOOD_GRAVEYARD_ALLIANCE_CONTROLLED = 1346, + AV_WS_ICEBLOOD_GRAVEYARD_IN_CONFLICT_ALLIANCE_ATTACKING = 1348, + AV_WS_ICEBLOOD_GRAVEYARD_HORDE_CONTROLLED = 1347, + AV_WS_ICEBLOOD_GRAVEYARD_IN_CONFLICT_HORDE_ATTACKING = 1349, //Frostwolf Grave - AV_FROSTWOLF_A_C = 1337, //over hc - AV_FROSTWOLF_A_A = 1339, //over ac - AV_FROSTWOLF_H_C = 1338, - AV_FROSTWOLF_H_A = 1340, //over aa + AV_WS_FROSTWOLF_GRAVEYARD_ALLIANCE_CONTROLLED = 1337, + AV_WS_FROSTWOLF_GRAVEYARD_IN_CONFLICT_ALLIANCE_ATTACKING = 1339, + AV_WS_FROSTWOLF_GRAVEYARD_HORDE_CONTROLLED = 1338, + AV_WS_FROSTWOLF_GRAVEYARD_IN_CONFLICT_HORDE_ATTACKING = 1340, //Frostwolf Hut - AV_FROSTWOLFHUT_A_C = 1329, //over hc - AV_FROSTWOLFHUT_A_A = 1331, //over ha - AV_FROSTWOLFHUT_H_C = 1330, - AV_FROSTWOLFHUT_H_A = 1332, //over ac + AV_WS_FROSTWOLF_RELIEF_HUT_ALLIANCE_CONTROLLED = 1329, + AV_WS_FROSTWOLF_RELIEF_HUT_IN_CONFLICT_ALLIANCE_ATTACKING = 1331, + AV_WS_FROSTWOLF_RELIEF_HUT_HORDE_CONTROLLED = 1330, + AV_WS_FROSTWOLF_RELIEF_HUT_IN_CONFLICT_HORDE_ATTACKING = 1332, //Towers //Alliance //Dunbaldar South Bunker - AV_DUNS_CONTROLLED = 1361, - AV_DUNS_DESTROYED = 1370, - AV_DUNS_ASSAULTED = 1378, + AV_WS_DUN_BALDAR_SOUTH_BUNKER_OWNER = 1181, + AV_WS_DUN_BALDAR_SOUTH_BUNKER_ALLIANCE_CONTROLLED = 1361, + AV_WS_DUN_BALDAR_SOUTH_BUNKER_DESTROYED = 1370, + AV_WS_DUN_BALDAR_SOUTH_BUNKER_IN_CONFLICT_HORDE_ATTACKING = 1378, + AV_WS_DUN_BALDAR_SOUTH_BUNKER_IN_CONFLICT_ALLIANCE_ATTACKING = 1374, // unused //Dunbaldar North Bunker - AV_DUNN_CONTROLLED = 1362, - AV_DUNN_DESTROYED = 1371, - AV_DUNN_ASSAULTED = 1379, + AV_WS_DUN_BALDAR_NORTH_BUNKER_OWNER = 1182, + AV_WS_DUN_BALDAR_NORTH_BUNKER_ALLIANCE_CONTROLLED = 1362, + AV_WS_DUN_BALDAR_NORTH_BUNKER_DESTROYED = 1371, + AV_WS_DUN_BALDAR_NORTH_BUNKER_IN_CONFLICT_HORDE_ATTACKING = 1379, + AV_WS_DUN_BALDAR_NORTH_BUNKER_IN_CONFLICT_ALLIANCE_ATTACKING = 1375, // unused //Icewing Bunker - AV_ICEWING_CONTROLLED = 1363, - AV_ICEWING_DESTROYED = 1372, - AV_ICEWING_ASSAULTED = 1380, + AV_WS_ICEWING_BUNKER_OWNER = 1183, + AV_WS_ICEWING_BUNKER_ALLIANCE_CONTROLLED = 1363, + AV_WS_ICEWING_BUNKER_DESTROYED = 1372, + AV_WS_ICEWING_BUNKER_IN_CONFLICT_HORDE_ATTACKING = 1380, + AV_WS_ICEWING_BUNKER_IN_CONFLICT_ALLIANCE_ATTACKING = 1376, // unused //Stoneheart Bunker - AV_STONEH_CONTROLLED = 1364, - AV_STONEH_DESTROYED = 1373, - AV_STONEH_ASSAULTED = 1381, + AV_WS_STONEHEARTH_BUNKER_OWNER = 1184, + AV_WS_STONEHEARTH_BUNKER_ALLIANCE_CONTROLLED = 1364, + AV_WS_STONEHEARTH_BUNKER_DESTROYED = 1373, + AV_WS_STONEHEARTH_BUNKER_IN_CONFLICT_HORDE_ATTACKING = 1381, + AV_WS_STONEHEARTH_BUNKER_IN_CONFLICT_ALLIANCE_ATTACKING = 1377, // unused //Horde //Iceblood Tower - AV_ICEBLOOD_CONTROLLED = 1385, - AV_ICEBLOOD_DESTROYED = 1368, - AV_ICEBLOOD_ASSAULTED = 1390, + AV_WS_ICEBLOOD_TOWER_OWNER = 1187, + AV_WS_ICEBLOOD_TOWER_DESTROYED = 1368, + AV_WS_ICEBLOOD_TOWER_HORDE_CONTROLLED = 1385, + AV_WS_ICEBLOOD_TOWER_IN_CONFLICT_ALLIANCE_ATTACKING = 1390, + AV_WS_ICEBLOOD_TOWER_IN_CONFLICT_HORDE_ATTACKING = 1395, // unused //Tower Point - AV_TOWERPOINT_CONTROLLED = 1384, - AV_TOWERPOINT_DESTROYED = 1367, //goes over controlled - AV_TOWERPOINT_ASSAULTED = 1389, //goes over destroyed + AV_WS_TOWER_POINT_OWNER = 1188, + AV_WS_TOWER_POINT_DESTROYED = 1367, + AV_WS_TOWER_POINT_HORDE_CONTROLLED = 1384, + AV_WS_TOWER_POINT_IN_CONFLICT_ALLIANCE_ATTACKING = 1389, + AV_WS_TOWER_POINT_IN_CONFLICT_HORDE_ATTACKING = 1394, // unused //Frostwolf West - AV_FROSTWOLFW_CONTROLLED = 1382, - AV_FROSTWOLFW_DESTROYED = 1365, //over controlled - AV_FROSTWOLFW_ASSAULTED = 1387, //over destroyed + AV_WS_WEST_FROSTWOLF_TOWER_OWNER = 1185, + AV_WS_WEST_FROSTWOLF_TOWER_DESTROYED = 1365, + AV_WS_WEST_FROSTWOLF_TOWER_HORDE_CONTROLLED = 1382, + AV_WS_WEST_FROSTWOLF_TOWER_IN_CONFLICT_ALLIANCE_ATTACKING = 1387, + AV_WS_WEST_FROSTWOLF_TOWER_IN_CONFLICT_HORDE_ATTACKING = 1392, // unused //Frostwolf East - AV_FROSTWOLFE_CONTROLLED = 1383, - AV_FROSTWOLFE_DESTROYED = 1366, - AV_FROSTWOLFE_ASSAULTED = 1388, + AV_WS_EAST_FROSTWOLF_TOWER_OWNER = 1186, + AV_WS_EAST_FROSTWOLF_TOWER_DESTROYED = 1366, + AV_WS_EAST_FROSTWOLF_TOWER_HORDE_CONTROLLED = 1383, + AV_WS_EAST_FROSTWOLF_TOWER_IN_CONFLICT_ALLIANCE_ATTACKING = 1388, + AV_WS_EAST_FROSTWOLF_TOWER_IN_CONFLICT_HORDE_ATTACKING = 1393, // unused -//mines +//Mines + AV_WS_IRONDEEP_MINE_OWNER = 801, + AV_WS_IRONDEEP_MINE_TROGG_CONTROLLED = 1360, + AV_WS_IRONDEEP_MINE_ALLIANCE_CONTROLLED = 1358, + AV_WS_IRONDEEP_MINE_HORDE_CONTROLLED = 1359, - AV_N_MINE_N = 1360, - AV_N_MINE_A = 1358, - AV_N_MINE_H = 1359, + AV_WS_COLDTOOTH_MINE_OWNER = 804, + AV_WS_COLDTOOTH_MINE_KOBOLD_CONTROLLED = 1357, + AV_WS_COLDTOOTH_MINE_ALLIANCE_CONTROLLED = 1355, + AV_WS_COLDTOOTH_MINE_HORDE_CONTROLLED = 1356, - AV_S_MINE_N = 1357, - AV_S_MINE_A = 1355, - AV_S_MINE_H = 1356, +//Turnins + AV_WS_IVUS_STORM_CRYSTAL_COUNT = 1043, + AV_WS_IVUS_STORM_CRYSTAL_MAX = 1044, + AV_WS_LOKHOLAR_STORMPIKE_SOLDIERS_BLOOD_COUNT = 923, + AV_WS_LOKHOLAR_STORMPIKE_SOLDIERS_BLOOD_MAX = 922, -//towers assaulted by own team (unused) - AV_STONEH_UNUSED = 1377, - AV_ICEWING_UNUSED = 1376, - AV_DUNS_UNUSED = 1375, - AV_DUNN_UNUSED = 1374, +//Bosses + AV_WS_DREKTHAR_ALIVE = 601, + AV_WS_VANDAAR_ALIVE = 602, - AV_ICEBLOOD_UNUSED = 1395, - AV_TOWERPOINT_UNUSED = 1394, - AV_FROSTWOLFE_UNUSED = 1393, - AV_FROSTWOLFW_UNUSED = 1392 -*/ +//Captains + AV_WS_GALVAGAR_ALIVE = 1352, + AV_WS_BALINDA_ALIVE = 1351, }; //alliance_control neutral_control horde_control -const uint32 BG_AV_MineWorldStates[2][3] = +const uint32 BG_AV_MineWorldStates[2][4] = { - {1358, 1360, 1359}, - {1355, 1357, 1356} + { AV_WS_IRONDEEP_MINE_ALLIANCE_CONTROLLED, AV_WS_IRONDEEP_MINE_TROGG_CONTROLLED, AV_WS_IRONDEEP_MINE_HORDE_CONTROLLED, AV_WS_IRONDEEP_MINE_OWNER }, + { AV_WS_COLDTOOTH_MINE_ALLIANCE_CONTROLLED, AV_WS_COLDTOOTH_MINE_KOBOLD_CONTROLLED, AV_WS_COLDTOOTH_MINE_HORDE_CONTROLLED, AV_WS_COLDTOOTH_MINE_OWNER } }; enum BG_AV_QuestIds @@ -1510,30 +1524,31 @@ struct StaticNodeInfo struct { - uint32 AllianceControl; - uint32 AllianceAssault; - uint32 HordeControl; - uint32 HordeAssault; + int32 AllianceControl; + int32 AllianceAssault; + int32 HordeControl; + int32 HordeAssault; + int32 Owner; } WorldStateIds; }; static StaticNodeInfo const BGAVNodeInfo[] = { - { BG_AV_NODES_FIRSTAID_STATION, { 47, 48, 45, 46 }, { 1325, 1326, 1327, 1328 } }, // Stormpike First Aid Station - { BG_AV_NODES_STORMPIKE_GRAVE, { 1, 2, 3, 4 }, { 1333, 1335, 1334, 1336 } }, // Stormpike Graveyard - { BG_AV_NODES_STONEHEART_GRAVE, { 55, 56, 53, 54 }, { 1302, 1304, 1301, 1303 } }, // Stoneheart Graveyard - { BG_AV_NODES_SNOWFALL_GRAVE, { 5, 6, 7, 8 }, { 1341, 1343, 1342, 1344 } }, // Snowfall Graveyard - { BG_AV_NODES_ICEBLOOD_GRAVE, { 59, 60, 57, 58 }, { 1346, 1348, 1347, 1349 } }, // Iceblood Graveyard - { BG_AV_NODES_FROSTWOLF_GRAVE, { 9, 10, 11, 12 }, { 1337, 1339, 1338, 1340 } }, // Frostwolf Graveyard - { BG_AV_NODES_FROSTWOLF_HUT, { 51, 52, 49, 50 }, { 1329, 1331, 1330, 1332 } }, // Frostwolf Hut - { BG_AV_NODES_DUNBALDAR_SOUTH, { 16, 15, 14, 13 }, { 1361, 1375, 1370, 1378 } }, // Dunbaldar South Bunker - { BG_AV_NODES_DUNBALDAR_NORTH, { 20, 19, 18, 17 }, { 1362, 1374, 1371, 1379 } }, // Dunbaldar North Bunker - { BG_AV_NODES_ICEWING_BUNKER, { 24, 23, 22, 21 }, { 1363, 1376, 1372, 1380 } }, // Icewing Bunker - { BG_AV_NODES_STONEHEART_BUNKER, { 28, 27, 26, 25 }, { 1364, 1377, 1373, 1381 } }, // Stoneheart Bunker - { BG_AV_NODES_ICEBLOOD_TOWER, { 44, 43, 42, 41 }, { 1368, 1390, 1385, 1395 } }, // Iceblood Tower - { BG_AV_NODES_TOWER_POINT, { 40, 39, 38, 37 }, { 1367, 1389, 1384, 1394 } }, // Tower Point - { BG_AV_NODES_FROSTWOLF_ETOWER, { 36, 35, 34, 33 }, { 1366, 1388, 1383, 1393 } }, // Frostwolf East Tower - { BG_AV_NODES_FROSTWOLF_WTOWER, { 32, 31, 30, 29 }, { 1365, 1387, 1382, 1392 } }, // Frostwolf West Tower + { BG_AV_NODES_FIRSTAID_STATION, { 47, 48, 45, 46 }, { 1325, 1326, 1327, 1328, 0 } }, // Stormpike First Aid Station + { BG_AV_NODES_STORMPIKE_GRAVE, { 1, 2, 3, 4 }, { 1333, 1335, 1334, 1336, 0 } }, // Stormpike Graveyard + { BG_AV_NODES_STONEHEART_GRAVE, { 55, 56, 53, 54 }, { 1302, 1304, 1301, 1303, 0 } }, // Stoneheart Graveyard + { BG_AV_NODES_SNOWFALL_GRAVE, { 5, 6, 7, 8 }, { 1341, 1343, 1342, 1344, 0 } }, // Snowfall Graveyard + { BG_AV_NODES_ICEBLOOD_GRAVE, { 59, 60, 57, 58 }, { 1346, 1348, 1347, 1349, 0 } }, // Iceblood Graveyard + { BG_AV_NODES_FROSTWOLF_GRAVE, { 9, 10, 11, 12 }, { 1337, 1339, 1338, 1340, 0 } }, // Frostwolf Graveyard + { BG_AV_NODES_FROSTWOLF_HUT, { 51, 52, 49, 50 }, { 1329, 1331, 1330, 1332, 0 } }, // Frostwolf Hut + { BG_AV_NODES_DUNBALDAR_SOUTH, { 16, 15, 14, 13 }, { 1361, 1375, 1370, 1378, 1181 } }, // Dunbaldar South Bunker + { BG_AV_NODES_DUNBALDAR_NORTH, { 20, 19, 18, 17 }, { 1362, 1374, 1371, 1379, 1182 } }, // Dunbaldar North Bunker + { BG_AV_NODES_ICEWING_BUNKER, { 24, 23, 22, 21 }, { 1363, 1376, 1372, 1380, 1183 } }, // Icewing Bunker + { BG_AV_NODES_STONEHEART_BUNKER, { 28, 27, 26, 25 }, { 1364, 1377, 1373, 1381, 1184 } }, // Stoneheart Bunker + { BG_AV_NODES_ICEBLOOD_TOWER, { 44, 43, 42, 41 }, { 1368, 1390, 1385, 1395, 1188 } }, // Iceblood Tower + { BG_AV_NODES_TOWER_POINT, { 40, 39, 38, 37 }, { 1367, 1389, 1384, 1394, 1187 } }, // Tower Point + { BG_AV_NODES_FROSTWOLF_ETOWER, { 36, 35, 34, 33 }, { 1366, 1388, 1383, 1393, 1186 } }, // Frostwolf East Tower + { BG_AV_NODES_FROSTWOLF_WTOWER, { 32, 31, 30, 29 }, { 1365, 1387, 1382, 1392, 1185 } }, // Frostwolf West Tower }; enum Texts @@ -1627,7 +1642,7 @@ class BattlegroundAV : public Battleground void RemovePlayer(Player* player, ObjectGuid guid, uint32 team) override; void HandleAreaTrigger(Player* player, uint32 trigger) override; bool SetupBattleground() override; - void ResetBGSubclass() override; + void Reset() override; /*general stuff*/ void UpdateScore(uint16 team, int16 points); @@ -1644,9 +1659,6 @@ class BattlegroundAV : public Battleground WorldSafeLocsEntry const* GetClosestGraveyard(Player* player) override; - // Achievement: Av perfection and Everything counts - bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target = nullptr, uint32 miscvalue1 = 0) override; - uint32 GetPrematureWinner() override; private: @@ -1681,7 +1693,6 @@ class BattlegroundAV : public Battleground void ChangeMineOwner(uint8 mine, uint32 team, bool initial=false); /*worldstates*/ - void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) override; void SendMineWorldStates(uint32 mine); void UpdateNodeWorldState(BG_AV_Nodes node); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp index 637b5d6c9e..3b7a35c11c 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp @@ -19,7 +19,6 @@ #include "Log.h" #include "Player.h" #include "WorldPacket.h" -#include "WorldStatePackets.h" BattlegroundBE::BattlegroundBE() { @@ -60,12 +59,6 @@ void BattlegroundBE::HandleAreaTrigger(Player* player, uint32 trigger) } } -void BattlegroundBE::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) -{ - data.Worldstates.emplace_back(uint32(0x9f3), uint32(1)); // 9 show - Arena::FillInitialWorldStates(data); -} - bool BattlegroundBE::SetupBattleground() { // gates diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h index db135fedeb..cd2ebca621 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h @@ -60,6 +60,5 @@ class BattlegroundBE : public Arena void HandleAreaTrigger(Player* Source, uint32 Trigger) override; bool SetupBattleground() override; - void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) override; }; #endif diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBFG.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundBFG.cpp index 7491323478..ee2b9069b6 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBFG.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBFG.cpp @@ -27,7 +27,6 @@ #include "Util.h" #include "WorldPacket.h" #include "WorldSession.h" -#include "WorldStatePackets.h" void BattlegroundBFGScore::BuildObjectivesBlock(WorldPacket& data, ByteBuffer& content) { @@ -280,41 +279,6 @@ void BattlegroundBFG::_DelBanner(uint8 node, uint8 type, uint8 teamIndex) SpawnBGObject(obj, RESPAWN_ONE_DAY); } -void BattlegroundBFG::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) -{ - const uint8 plusArray[] = { 0, 1, 2 }; - - // Node icons - for (uint8 node = 0; node < BG_BFG_DYNAMIC_NODES_COUNT; ++node) - data.Worldstates.emplace_back(uint32(BG_BFG_OP_NODEICONS[node]), uint32((m_Nodes[node] == 0) ? 1 : 0)); - - // Node occupied states - for (uint8 node = 0; node < BG_BFG_DYNAMIC_NODES_COUNT; ++node) - for (uint8 i = 1; i < BG_BFG_DYNAMIC_NODES_COUNT; ++i) - data.Worldstates.emplace_back(uint32(BG_BFG_OP_NODESTATES[node] + plusArray[i]), uint32((m_Nodes[node] == i) ? 1 : 0)); - - // How many bases each team owns - uint8 ally = 0, horde = 0; - for (uint8 node = 0; node < BG_BFG_DYNAMIC_NODES_COUNT; ++node) - if (m_Nodes[node] == BG_BFG_NODE_STATUS_ALLY_OCCUPIED) - ++ally; - else if (m_Nodes[node] == BG_BFG_NODE_STATUS_HORDE_OCCUPIED) - ++horde; - - data.Worldstates.emplace_back(uint32(BG_BFG_OP_OCCUPIED_BASES_ALLY), uint32(ally)); - data.Worldstates.emplace_back(uint32(BG_BFG_OP_OCCUPIED_BASES_HORDE), uint32(horde)); - - // Team scores - data.Worldstates.emplace_back(uint32(BG_BFG_OP_RESOURCES_MAX), uint32(BG_BFG_MAX_TEAM_SCORE)); - data.Worldstates.emplace_back(uint32(BG_BFG_OP_RESOURCES_WARNING), uint32(BG_BFG_WARNING_NEAR_VICTORY_SCORE)); - data.Worldstates.emplace_back(uint32(BG_BFG_OP_RESOURCES_ALLY), uint32(m_TeamScores[TEAM_ALLIANCE])); - data.Worldstates.emplace_back(uint32(BG_BFG_OP_RESOURCES_HORDE), uint32(m_TeamScores[TEAM_HORDE])); - - // other unknown - data.Worldstates.emplace_back(uint32(0x745), uint32(0x2)); // 37 1861 unk -} - - void BattlegroundBFG::_SendNodeUpdate(uint8 node) { // Send node owner state update to refresh map icons on client @@ -674,25 +638,3 @@ bool BattlegroundBFG::UpdatePlayerScore(Player* player, uint32 type, uint32 valu } return true; } - -bool BattlegroundBFG::IsAllNodesControlledByTeam(uint32 team) const -{ - uint32 count = 0; - for (int i = 0; i < BG_BFG_DYNAMIC_NODES_COUNT; ++i) - if ((team == ALLIANCE && m_Nodes[i] == BG_BFG_NODE_STATUS_ALLY_OCCUPIED) || - (team == HORDE && m_Nodes[i] == BG_BFG_NODE_STATUS_HORDE_OCCUPIED)) - ++count; - - return count == BG_BFG_DYNAMIC_NODES_COUNT; -} - -bool BattlegroundBFG::CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* player, Unit const* target, uint32 miscvalue) -{ - switch (criteriaId) - { - case BG_CRITERIA_CHECK_RESILIENT_VICTORY: - return m_TeamScores500Disadvantage[GetTeamIndexByTeamId(player->GetTeam())]; - } - - return Battleground::CheckAchievementCriteriaMeet(criteriaId, player, target, miscvalue); -} diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBFG.h b/src/server/game/Battlegrounds/Zones/BattlegroundBFG.h index 0897477ac3..3b681e9128 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBFG.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBFG.h @@ -287,15 +287,9 @@ class BattlegroundBFG : public Battleground /* Scorekeeping */ bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override; - void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) override; - /* Nodes occupying */ void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj) override; - /* achievement req. */ - bool IsAllNodesControlledByTeam(uint32 team) const override; - bool CheckAchievementCriteriaMeet(uint32 /*criteriaId*/, Player const* /*player*/, Unit const* /*target*/ = nullptr, uint32 /*miscvalue1*/ = 0) override; - uint32 GetPrematureWinner() override; private: diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp index a0fea7498b..a7601b2b9b 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp @@ -21,7 +21,6 @@ #include "Player.h" #include "Random.h" #include "WorldPacket.h" -#include "WorldStatePackets.h" BattlegroundDS::BattlegroundDS() { @@ -146,12 +145,6 @@ void BattlegroundDS::HandleAreaTrigger(Player* player, uint32 trigger) } } -void BattlegroundDS::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) -{ - data.Worldstates.emplace_back(uint32(3610), uint32(1)); // 9 show - Arena::FillInitialWorldStates(data); -} - bool BattlegroundDS::SetupBattleground() { // gates diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h index 9dad4b6847..f637f8294c 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h @@ -107,7 +107,6 @@ class BattlegroundDS : public Arena void HandleAreaTrigger(Player* Source, uint32 Trigger) override; bool SetupBattleground() override; - void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) override; private: void PostUpdateImpl(uint32 diff) override; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp index 7f6a178777..d4114f0623 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp @@ -19,7 +19,6 @@ #include "WorldPacket.h" #include "BattlegroundMgr.h" #include "Creature.h" -#include "DBCStores.h" #include "GameObject.h" #include "Log.h" #include "Map.h" @@ -27,7 +26,6 @@ #include "Random.h" #include "Util.h" #include "ObjectAccessor.h" -#include "WorldStatePackets.h" // these variables aren't used outside of this file, so declare them only here uint32 BG_EY_HonorScoreTicks[BG_HONOR_MODE_NUM] = @@ -184,9 +182,9 @@ void BattlegroundEY::CheckSomeoneJoinedPoint() { //player joined point! //show progress bar - UpdateWorldStateForPlayer(PROGRESS_BAR_PERCENT_GREY, BG_EY_PROGRESS_BAR_PERCENT_GREY, player); - UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[i], player); - UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_SHOW, player); + player->SendUpdateWorldState(PROGRESS_BAR_PERCENT_GREY, BG_EY_PROGRESS_BAR_PERCENT_GREY); + player->SendUpdateWorldState(PROGRESS_BAR_STATUS, m_PointBarStatus[i]); + player->SendUpdateWorldState(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_SHOW); //add player to point m_PlayersNearPoint[i].push_back(m_PlayersNearPoint[EY_POINTS_MAX][j]); //remove player from "free space" @@ -228,7 +226,7 @@ void BattlegroundEY::CheckSomeoneLeftPoint() { m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]); m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j); - this->UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW, player); + player->SendUpdateWorldState(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW); } else { @@ -271,7 +269,7 @@ void BattlegroundEY::UpdatePointStatuses() Player* player = ObjectAccessor::FindPlayer(m_PlayersNearPoint[point][i]); if (player) { - this->UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[point], player); + player->SendUpdateWorldState(PROGRESS_BAR_STATUS, m_PointBarStatus[point]); //if point owner changed we must evoke event! if (pointOwnerTeamId != m_PointOwnedByTeam[point]) { @@ -527,6 +525,8 @@ bool BattlegroundEY::SetupBattleground() return false; } + UpdateWorldState(EY_MAX_RESOURCES, BG_EY_MAX_TEAM_SCORE); + return true; } @@ -830,56 +830,6 @@ bool BattlegroundEY::UpdatePlayerScore(Player* player, uint32 type, uint32 value return true; } -void BattlegroundEY::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) -{ - data.Worldstates.emplace_back(uint32(EY_HORDE_BASE), uint32(m_TeamPointsCount[TEAM_HORDE])); - data.Worldstates.emplace_back(uint32(EY_ALLIANCE_BASE), uint32(m_TeamPointsCount[TEAM_ALLIANCE])); - data.Worldstates.emplace_back(uint32(0xab6), uint32(0x0)); - data.Worldstates.emplace_back(uint32(0xab5), uint32(0x0)); - data.Worldstates.emplace_back(uint32(0xab4), uint32(0x0)); - data.Worldstates.emplace_back(uint32(0xab3), uint32(0x0)); - data.Worldstates.emplace_back(uint32(0xab2), uint32(0x0)); - data.Worldstates.emplace_back(uint32(0xab1), uint32(0x0)); - data.Worldstates.emplace_back(uint32(0xab0), uint32(0x0)); - data.Worldstates.emplace_back(uint32(0xaaf), uint32(0x0)); - - data.Worldstates.emplace_back(int32(DRAENEI_RUINS_HORDE_CONTROL), uint32(m_PointOwnedByTeam[DRAENEI_RUINS] == HORDE && m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL)); - - data.Worldstates.emplace_back(uint32(DRAENEI_RUINS_ALLIANCE_CONTROL), uint32(m_PointOwnedByTeam[DRAENEI_RUINS] == ALLIANCE && m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL)); - - data.Worldstates.emplace_back(uint32(DRAENEI_RUINS_UNCONTROL), uint32(m_PointState[DRAENEI_RUINS] != EY_POINT_UNDER_CONTROL)); - - data.Worldstates.emplace_back(uint32(MAGE_TOWER_ALLIANCE_CONTROL), uint32(m_PointOwnedByTeam[MAGE_TOWER] == ALLIANCE && m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL)); - - data.Worldstates.emplace_back(uint32(MAGE_TOWER_HORDE_CONTROL), uint32(m_PointOwnedByTeam[MAGE_TOWER] == HORDE && m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL)); - - data.Worldstates.emplace_back(uint32(MAGE_TOWER_UNCONTROL), uint32(m_PointState[MAGE_TOWER] != EY_POINT_UNDER_CONTROL)); - - data.Worldstates.emplace_back(uint32(FEL_REAVER_HORDE_CONTROL), uint32(m_PointOwnedByTeam[FEL_REAVER] == HORDE && m_PointState[FEL_REAVER] == EY_POINT_UNDER_CONTROL)); - - data.Worldstates.emplace_back(uint32(FEL_REAVER_ALLIANCE_CONTROL), uint32(m_PointOwnedByTeam[FEL_REAVER] == ALLIANCE && m_PointState[FEL_REAVER] == EY_POINT_UNDER_CONTROL)); - - data.Worldstates.emplace_back(uint32(FEL_REAVER_UNCONTROL), uint32(m_PointState[FEL_REAVER] != EY_POINT_UNDER_CONTROL)); - - data.Worldstates.emplace_back(uint32(BLOOD_ELF_HORDE_CONTROL), uint32(m_PointOwnedByTeam[BLOOD_ELF] == HORDE && m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL)); - - data.Worldstates.emplace_back(uint32(BLOOD_ELF_ALLIANCE_CONTROL), uint32(m_PointOwnedByTeam[BLOOD_ELF] == ALLIANCE && m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL)); - - data.Worldstates.emplace_back(uint32(BLOOD_ELF_UNCONTROL), uint32(m_PointState[BLOOD_ELF] != EY_POINT_UNDER_CONTROL)); - - data.Worldstates.emplace_back(uint32(NETHERSTORM_FLAG), uint32(m_FlagState == BG_EY_FLAG_STATE_ON_BASE)); - - data.Worldstates.emplace_back(uint32(0xad2), uint32(0x1)); - data.Worldstates.emplace_back(uint32(0xad1), uint32(0x1)); - data.Worldstates.emplace_back(uint32(0xabe), uint32(GetTeamScore(TEAM_HORDE))); - data.Worldstates.emplace_back(uint32(0xabd), uint32(GetTeamScore(TEAM_ALLIANCE))); - data.Worldstates.emplace_back(uint32(0xa05), uint32(0x8e)); - data.Worldstates.emplace_back(uint32(0xaa0), uint32(0x0)); - data.Worldstates.emplace_back(uint32(0xa9f), uint32(0x0)); - data.Worldstates.emplace_back(uint32(0xa9e), uint32(0x0)); - data.Worldstates.emplace_back(uint32(0xc0d), uint32(0x17b)); -} - WorldSafeLocsEntry const* BattlegroundEY::GetClosestGraveyard(Player* player) { uint32 g_id = 0; @@ -933,16 +883,6 @@ WorldSafeLocsEntry const* BattlegroundEY::GetClosestGraveyard(Player* player) return nearestEntry; } -bool BattlegroundEY::IsAllNodesControlledByTeam(uint32 team) const -{ - uint32 count = 0; - for (int i = 0; i < EY_POINTS_MAX; ++i) - if (m_PointOwnedByTeam[i] == team && m_PointState[i] == EY_POINT_UNDER_CONTROL) - ++count; - - return count == EY_POINTS_MAX; -} - uint32 BattlegroundEY::GetPrematureWinner() { if (GetTeamScore(TEAM_ALLIANCE) > GetTeamScore(TEAM_HORDE)) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h index 382690fad6..dbe5109627 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h @@ -41,6 +41,7 @@ enum BG_EY_WorldStates { EY_ALLIANCE_RESOURCES = 2749, EY_HORDE_RESOURCES = 2750, + EY_MAX_RESOURCES = 1780, EY_ALLIANCE_BASE = 2752, EY_HORDE_BASE = 2753, DRAENEI_RUINS_HORDE_CONTROL = 2733, @@ -413,7 +414,6 @@ class BattlegroundEY : public Battleground void UpdateTeamScore(uint32 Team); void EndBattleground(uint32 winner) override; bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override; - void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) override; void SetDroppedFlagGUID(ObjectGuid guid, int32 /*TeamID*/ = -1) override { m_DroppedFlagGUID = guid; } ObjectGuid GetDroppedFlagGUID() const { return m_DroppedFlagGUID; } @@ -421,9 +421,6 @@ class BattlegroundEY : public Battleground void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj) override; void EventPlayerDroppedFlag(Player* Source) override; - /* achievement req. */ - bool IsAllNodesControlledByTeam(uint32 team) const override; - uint32 GetPrematureWinner() override; private: void PostUpdateImpl(uint32 diff) override; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index 480d4f2f3c..f23c9a34ef 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -27,7 +27,6 @@ #include "Transport.h" #include "Vehicle.h" #include "WorldPacket.h" -#include "WorldStatePackets.h" void BattlegroundICScore::BuildObjectivesBlock(WorldPacket& data, ByteBuffer& content) { @@ -216,7 +215,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff) { factionReinforcements[nodePoint[i].faction] += 1; RewardHonorToTeam(RESOURCE_HONOR_AMOUNT, nodePoint[i].faction == TEAM_ALLIANCE ? ALLIANCE : HORDE); - UpdateWorldState((nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_ALLIANCE_RENFORT : BG_IC_HORDE_RENFORT), factionReinforcements[nodePoint[i].faction]); + UpdateWorldState((nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_ALLIANCE_REINFORCEMENTS : BG_IC_HORDE_REINFORCEMENTS), factionReinforcements[nodePoint[i].faction]); } } resourceTimer = IC_RESOURCE_TIME; @@ -293,23 +292,6 @@ void BattlegroundIC::HandleAreaTrigger(Player* player, uint32 trigger) } } -void BattlegroundIC::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) -{ - data.Worldstates.emplace_back(uint32(BG_IC_ALLIANCE_RENFORT_SET), uint32(1)); - data.Worldstates.emplace_back(uint32(BG_IC_HORDE_RENFORT_SET), uint32(1)); - data.Worldstates.emplace_back(uint32(BG_IC_ALLIANCE_RENFORT), uint32(factionReinforcements[TEAM_ALLIANCE])); - data.Worldstates.emplace_back(uint32(BG_IC_HORDE_RENFORT), uint32(factionReinforcements[TEAM_HORDE])); - - for (uint8 i = 0; i < MAX_FORTRESS_GATES_SPAWNS; ++i) - { - uint32 uws = GetWorldStateFromGateEntry(BG_IC_ObjSpawnlocs[i].entry, (GateStatus[GetGateIDFromEntry(BG_IC_ObjSpawnlocs[i].entry)] == BG_IC_GATE_DESTROYED ? true : false)); - data.Worldstates.emplace_back(uint32(uws), uint32(1)); - } - - for (uint8 i = 0; i < MAX_NODE_TYPES; ++i) - data.Worldstates.emplace_back(uint32(nodePoint[i].worldStates[nodePoint[i].nodeState]), uint32(1)); -} - bool BattlegroundIC::SetupBattleground() { for (uint8 i = 0; i < MAX_NORMAL_GAMEOBJECTS_SPAWNS; ++i) @@ -414,7 +396,7 @@ void BattlegroundIC::HandleKillPlayer(Player* player, Player* killer) factionReinforcements[player->GetTeamId()] -= 1; - UpdateWorldState((player->GetTeamId() == TEAM_ALLIANCE ? BG_IC_ALLIANCE_RENFORT : BG_IC_HORDE_RENFORT), factionReinforcements[player->GetTeamId()]); + UpdateWorldState((GetPlayerTeam(player->GetGUID()) == ALLIANCE ? BG_IC_ALLIANCE_REINFORCEMENTS : BG_IC_HORDE_REINFORCEMENTS), factionReinforcements[player->GetTeamId()]); // we must end the battleground if (factionReinforcements[player->GetTeamId()] < 1) @@ -515,7 +497,7 @@ void BattlegroundIC::UpdateNodeWorldState(ICNodePoint* node) else if (node->gameobject_entry == node->banners[BANNER_H_CONTESTED]) node->nodeState = NODE_STATE_CONFLICT_H; - uint32 worldstate = node->worldStates[node->nodeState]; + int32 worldstate = node->worldStates[node->nodeState]; // with this we are sure we dont bug the client for (uint8 i = 0; i < 5; ++i) @@ -526,6 +508,7 @@ void BattlegroundIC::UpdateNodeWorldState(ICNodePoint* node) } UpdateWorldState(worldstate, 1); + UpdateWorldState(node->worldStates[5], node->nodeState == NODE_STATE_CONTROLLED_H ? 2 : node->nodeState == NODE_STATE_CONTROLLED_A ? 1 : 0); } uint32 BattlegroundIC::GetNextBanner(ICNodePoint* node, uint32 team, bool returnDefinitve) @@ -800,8 +783,8 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* node, bool recapture) void BattlegroundIC::DestroyGate(Player* player, GameObject* go) { GateStatus[GetGateIDFromEntry(go->GetEntry())] = BG_IC_GATE_DESTROYED; - uint32 uws_open = GetWorldStateFromGateEntry(go->GetEntry(), true); - uint32 uws_close = GetWorldStateFromGateEntry(go->GetEntry(), false); + int32 uws_open = GetWorldStateFromGateEntry(go->GetEntry(), true); + int32 uws_close = GetWorldStateFromGateEntry(go->GetEntry(), false); if (uws_open) { UpdateWorldState(uws_close, 0); @@ -903,19 +886,6 @@ WorldSafeLocsEntry const* BattlegroundIC::GetClosestGraveyard(Player* player) return good_entry; } -bool BattlegroundIC::IsAllNodesControlledByTeam(uint32 team) const -{ - uint32 count = 0; - ICNodeState controlledState = team == ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H; - for (int i = 0; i < NODE_TYPE_WORKSHOP; ++i) - { - if (nodePoint[i].nodeState == controlledState) - ++count; - } - - return count == NODE_TYPE_WORKSHOP; -} - bool BattlegroundIC::IsSpellAllowed(uint32 spellId, Player const* player) const { switch (spellId) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h index ea5ad25a4f..afdad3930a 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h @@ -736,10 +736,11 @@ enum BG_IC_Objectives enum ICWorldStates { - BG_IC_ALLIANCE_RENFORT_SET = 4221, - BG_IC_HORDE_RENFORT_SET = 4222, - BG_IC_ALLIANCE_RENFORT = 4226, - BG_IC_HORDE_RENFORT = 4227, + BG_IC_ALLIANCE_REINFORCEMENTS_SET = 4221, + BG_IC_HORDE_REINFORCEMENTS_SET = 4222, + BG_IC_ALLIANCE_REINFORCEMENTS = 4226, + BG_IC_HORDE_REINFORCEMENTS = 4227, + BG_IC_GATE_FRONT_H_WS_CLOSED = 4317, BG_IC_GATE_WEST_H_WS_CLOSED = 4318, BG_IC_GATE_EAST_H_WS_CLOSED = 4319, @@ -753,30 +754,35 @@ enum ICWorldStates BG_IC_GATE_WEST_A_WS_OPEN = 4324, BG_IC_GATE_EAST_A_WS_OPEN = 4325, + BG_IC_DOCKS_OWNER = 4235, BG_IC_DOCKS_UNCONTROLLED = 4301, BG_IC_DOCKS_CONFLICT_A = 4305, BG_IC_DOCKS_CONFLICT_H = 4302, BG_IC_DOCKS_CONTROLLED_A = 4304, BG_IC_DOCKS_CONTROLLED_H = 4303, + BG_IC_HANGAR_OWNER = 4234, BG_IC_HANGAR_UNCONTROLLED = 4296, BG_IC_HANGAR_CONFLICT_A = 4300, BG_IC_HANGAR_CONFLICT_H = 4297, BG_IC_HANGAR_CONTROLLED_A = 4299, BG_IC_HANGAR_CONTROLLED_H = 4298, + BG_IC_QUARRY_OWNER = 4289, BG_IC_QUARRY_UNCONTROLLED = 4306, BG_IC_QUARRY_CONFLICT_A = 4310, BG_IC_QUARRY_CONFLICT_H = 4307, BG_IC_QUARRY_CONTROLLED_A = 4309, BG_IC_QUARRY_CONTROLLED_H = 4308, + BG_IC_REFINERY_OWNER = 4287, BG_IC_REFINERY_UNCONTROLLED = 4311, BG_IC_REFINERY_CONFLICT_A = 4315, BG_IC_REFINERY_CONFLICT_H = 4312, BG_IC_REFINERY_CONTROLLED_A = 4314, BG_IC_REFINERY_CONTROLLED_H = 4313, + BG_IC_WORKSHOP_OWNER = 4232, BG_IC_WORKSHOP_UNCONTROLLED = 4294, BG_IC_WORKSHOP_CONFLICT_A = 4228, BG_IC_WORKSHOP_CONFLICT_H = 4293, @@ -894,19 +900,19 @@ struct ICNodePoint bool needChange; // this is used for the 1 minute time period after the point is captured uint32 timer; // the same use for needChange uint32 last_entry; // the last gameobject_entry - uint32 worldStates[5]; // the worldstates that represent the node in the map + int32 worldStates[6]; // the worldstates that represent the node in the map ICNodeState nodeState; }; const ICNodePoint nodePointInitial[MAX_NODE_TYPES] = { - {BG_IC_GO_REFINERY_BANNER, GO_REFINERY_BANNER, TEAM_NEUTRAL, NODE_TYPE_REFINERY, {GO_ALLIANCE_BANNER_REFINERY, GO_ALLIANCE_BANNER_REFINERY_CONT, GO_HORDE_BANNER_REFINERY, GO_HORDE_BANNER_REFINERY_CONT}, false, 0, 0, {BG_IC_REFINERY_UNCONTROLLED, BG_IC_REFINERY_CONFLICT_A, BG_IC_REFINERY_CONFLICT_H, BG_IC_REFINERY_CONTROLLED_A, BG_IC_REFINERY_CONTROLLED_H}, NODE_STATE_UNCONTROLLED}, - {BG_IC_GO_QUARRY_BANNER, GO_QUARRY_BANNER, TEAM_NEUTRAL, NODE_TYPE_QUARRY, {GO_ALLIANCE_BANNER_QUARRY, GO_ALLIANCE_BANNER_QUARRY_CONT, GO_HORDE_BANNER_QUARRY, GO_HORDE_BANNER_QUARRY_CONT}, false, 0, 0, {BG_IC_QUARRY_UNCONTROLLED, BG_IC_QUARRY_CONFLICT_A, BG_IC_QUARRY_CONFLICT_H, BG_IC_QUARRY_CONTROLLED_A, BG_IC_QUARRY_CONTROLLED_H}, NODE_STATE_UNCONTROLLED}, - {BG_IC_GO_DOCKS_BANNER, GO_DOCKS_BANNER, TEAM_NEUTRAL, NODE_TYPE_DOCKS, {GO_ALLIANCE_BANNER_DOCK, GO_ALLIANCE_BANNER_DOCK_CONT, GO_HORDE_BANNER_DOCK, GO_HORDE_BANNER_DOCK_CONT}, false, 0, 0, {BG_IC_DOCKS_UNCONTROLLED, BG_IC_DOCKS_CONFLICT_A, BG_IC_DOCKS_CONFLICT_H, BG_IC_DOCKS_CONTROLLED_A, BG_IC_DOCKS_CONTROLLED_H}, NODE_STATE_UNCONTROLLED}, - {BG_IC_GO_HANGAR_BANNER, GO_HANGAR_BANNER, TEAM_NEUTRAL, NODE_TYPE_HANGAR, {GO_ALLIANCE_BANNER_HANGAR, GO_ALLIANCE_BANNER_HANGAR_CONT, GO_HORDE_BANNER_HANGAR, GO_HORDE_BANNER_HANGAR_CONT}, false, 0, 0, {BG_IC_HANGAR_UNCONTROLLED, BG_IC_HANGAR_CONFLICT_A, BG_IC_HANGAR_CONFLICT_H, BG_IC_HANGAR_CONTROLLED_A, BG_IC_HANGAR_CONTROLLED_H}, NODE_STATE_UNCONTROLLED}, - {BG_IC_GO_WORKSHOP_BANNER, GO_WORKSHOP_BANNER, TEAM_NEUTRAL, NODE_TYPE_WORKSHOP, {GO_ALLIANCE_BANNER_WORKSHOP, GO_ALLIANCE_BANNER_WORKSHOP_CONT, GO_HORDE_BANNER_WORKSHOP, GO_HORDE_BANNER_WORKSHOP_CONT}, false, 0, 0, {BG_IC_WORKSHOP_UNCONTROLLED, BG_IC_WORKSHOP_CONFLICT_A, BG_IC_WORKSHOP_CONFLICT_H, BG_IC_WORKSHOP_CONTROLLED_A, BG_IC_WORKSHOP_CONTROLLED_H}, NODE_STATE_UNCONTROLLED}, - {BG_IC_GO_ALLIANCE_BANNER, GO_ALLIANCE_BANNER, TEAM_ALLIANCE, NODE_TYPE_GRAVEYARD_A, {GO_ALLIANCE_BANNER_GRAVEYARD_A, GO_ALLIANCE_BANNER_GRAVEYARD_A_CONT, GO_HORDE_BANNER_GRAVEYARD_A, GO_HORDE_BANNER_GRAVEYARD_A_CONT}, false, 0, 0, {BG_IC_ALLIANCE_KEEP_UNCONTROLLED, BG_IC_ALLIANCE_KEEP_CONFLICT_A, BG_IC_ALLIANCE_KEEP_CONFLICT_H, BG_IC_ALLIANCE_KEEP_CONTROLLED_A, BG_IC_ALLIANCE_KEEP_CONTROLLED_H}, NODE_STATE_CONTROLLED_A}, - {BG_IC_GO_HORDE_BANNER, GO_HORDE_BANNER, TEAM_HORDE, NODE_TYPE_GRAVEYARD_H, {GO_ALLIANCE_BANNER_GRAVEYARD_H, GO_ALLIANCE_BANNER_GRAVEYARD_H_CONT, GO_HORDE_BANNER_GRAVEYARD_H, GO_HORDE_BANNER_GRAVEYARD_H_CONT}, false, 0, 0, {BG_IC_HORDE_KEEP_UNCONTROLLED, BG_IC_HORDE_KEEP_CONFLICT_A, BG_IC_HORDE_KEEP_CONFLICT_H, BG_IC_HORDE_KEEP_CONTROLLED_A, BG_IC_HORDE_KEEP_CONTROLLED_H}, NODE_STATE_CONTROLLED_H} + {BG_IC_GO_REFINERY_BANNER, GO_REFINERY_BANNER, TEAM_NEUTRAL, NODE_TYPE_REFINERY, {GO_ALLIANCE_BANNER_REFINERY, GO_ALLIANCE_BANNER_REFINERY_CONT, GO_HORDE_BANNER_REFINERY, GO_HORDE_BANNER_REFINERY_CONT}, false, 0, 0, {BG_IC_REFINERY_UNCONTROLLED, BG_IC_REFINERY_CONFLICT_A, BG_IC_REFINERY_CONFLICT_H, BG_IC_REFINERY_CONTROLLED_A, BG_IC_REFINERY_CONTROLLED_H, BG_IC_REFINERY_OWNER}, NODE_STATE_UNCONTROLLED}, + {BG_IC_GO_QUARRY_BANNER, GO_QUARRY_BANNER, TEAM_NEUTRAL, NODE_TYPE_QUARRY, {GO_ALLIANCE_BANNER_QUARRY, GO_ALLIANCE_BANNER_QUARRY_CONT, GO_HORDE_BANNER_QUARRY, GO_HORDE_BANNER_QUARRY_CONT}, false, 0, 0, {BG_IC_QUARRY_UNCONTROLLED, BG_IC_QUARRY_CONFLICT_A, BG_IC_QUARRY_CONFLICT_H, BG_IC_QUARRY_CONTROLLED_A, BG_IC_QUARRY_CONTROLLED_H, BG_IC_QUARRY_OWNER}, NODE_STATE_UNCONTROLLED}, + {BG_IC_GO_DOCKS_BANNER, GO_DOCKS_BANNER, TEAM_NEUTRAL, NODE_TYPE_DOCKS, {GO_ALLIANCE_BANNER_DOCK, GO_ALLIANCE_BANNER_DOCK_CONT, GO_HORDE_BANNER_DOCK, GO_HORDE_BANNER_DOCK_CONT}, false, 0, 0, {BG_IC_DOCKS_UNCONTROLLED, BG_IC_DOCKS_CONFLICT_A, BG_IC_DOCKS_CONFLICT_H, BG_IC_DOCKS_CONTROLLED_A, BG_IC_DOCKS_CONTROLLED_H, BG_IC_DOCKS_OWNER}, NODE_STATE_UNCONTROLLED}, + {BG_IC_GO_HANGAR_BANNER, GO_HANGAR_BANNER, TEAM_NEUTRAL, NODE_TYPE_HANGAR, {GO_ALLIANCE_BANNER_HANGAR, GO_ALLIANCE_BANNER_HANGAR_CONT, GO_HORDE_BANNER_HANGAR, GO_HORDE_BANNER_HANGAR_CONT}, false, 0, 0, {BG_IC_HANGAR_UNCONTROLLED, BG_IC_HANGAR_CONFLICT_A, BG_IC_HANGAR_CONFLICT_H, BG_IC_HANGAR_CONTROLLED_A, BG_IC_HANGAR_CONTROLLED_H, BG_IC_HANGAR_OWNER}, NODE_STATE_UNCONTROLLED}, + {BG_IC_GO_WORKSHOP_BANNER, GO_WORKSHOP_BANNER, TEAM_NEUTRAL, NODE_TYPE_WORKSHOP, {GO_ALLIANCE_BANNER_WORKSHOP, GO_ALLIANCE_BANNER_WORKSHOP_CONT, GO_HORDE_BANNER_WORKSHOP, GO_HORDE_BANNER_WORKSHOP_CONT}, false, 0, 0, {BG_IC_WORKSHOP_UNCONTROLLED, BG_IC_WORKSHOP_CONFLICT_A, BG_IC_WORKSHOP_CONFLICT_H, BG_IC_WORKSHOP_CONTROLLED_A, BG_IC_WORKSHOP_CONTROLLED_H, BG_IC_WORKSHOP_OWNER}, NODE_STATE_UNCONTROLLED}, + {BG_IC_GO_ALLIANCE_BANNER, GO_ALLIANCE_BANNER, TEAM_ALLIANCE, NODE_TYPE_GRAVEYARD_A, {GO_ALLIANCE_BANNER_GRAVEYARD_A, GO_ALLIANCE_BANNER_GRAVEYARD_A_CONT, GO_HORDE_BANNER_GRAVEYARD_A, GO_HORDE_BANNER_GRAVEYARD_A_CONT}, false, 0, 0, {BG_IC_ALLIANCE_KEEP_UNCONTROLLED, BG_IC_ALLIANCE_KEEP_CONFLICT_A, BG_IC_ALLIANCE_KEEP_CONFLICT_H, BG_IC_ALLIANCE_KEEP_CONTROLLED_A, BG_IC_ALLIANCE_KEEP_CONTROLLED_H, 0}, NODE_STATE_CONTROLLED_A}, + {BG_IC_GO_HORDE_BANNER, GO_HORDE_BANNER, TEAM_HORDE, NODE_TYPE_GRAVEYARD_H, {GO_ALLIANCE_BANNER_GRAVEYARD_H, GO_ALLIANCE_BANNER_GRAVEYARD_H_CONT, GO_HORDE_BANNER_GRAVEYARD_H, GO_HORDE_BANNER_GRAVEYARD_H_CONT}, false, 0, 0, {BG_IC_HORDE_KEEP_UNCONTROLLED, BG_IC_HORDE_KEEP_CONFLICT_A, BG_IC_HORDE_KEEP_CONFLICT_H, BG_IC_HORDE_KEEP_CONTROLLED_A, BG_IC_HORDE_KEEP_CONTROLLED_H, 0}, NODE_STATE_CONTROLLED_H} }; enum HonorRewards @@ -971,15 +977,10 @@ class BattlegroundIC : public Battleground WorldSafeLocsEntry const* GetClosestGraveyard(Player* player) override; - /* Scorekeeping */ - void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) override; - void HandlePlayerResurrect(Player* player) override; uint32 GetNodeState(uint8 nodeType) const { return (uint8)nodePoint[nodeType].nodeState; } - bool IsAllNodesControlledByTeam(uint32 team) const override; - bool IsSpellAllowed(uint32 spellId, Player const* player) const override; private: @@ -1012,9 +1013,9 @@ class BattlegroundIC : public Battleground return i; } - uint32 GetWorldStateFromGateEntry(uint32 id, bool open) + int32 GetWorldStateFromGateEntry(uint32 id, bool open) { - uint32 uws = 0; + int32 uws = 0; switch (id) { diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp index 51f5d014c7..569f5f4f96 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp @@ -19,7 +19,6 @@ #include "Log.h" #include "Player.h" #include "WorldPacket.h" -#include "WorldStatePackets.h" BattlegroundNA::BattlegroundNA() { @@ -57,12 +56,6 @@ void BattlegroundNA::HandleAreaTrigger(Player* player, uint32 trigger) } } -void BattlegroundNA::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) -{ - data.Worldstates.emplace_back(uint32(0xa11), uint32(1)); // 9 show - Arena::FillInitialWorldStates(data); -} - bool BattlegroundNA::SetupBattleground() { // gates diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h index 86ec3f58d7..84c7ba207a 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h @@ -59,6 +59,5 @@ class BattlegroundNA : public Arena void HandleAreaTrigger(Player* Source, uint32 Trigger) override; bool SetupBattleground() override; - void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) override; }; #endif diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp index d2cb482002..0192394e3f 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp @@ -19,7 +19,6 @@ #include "Log.h" #include "Player.h" #include "WorldPacket.h" -#include "WorldStatePackets.h" BattlegroundRL::BattlegroundRL() { @@ -57,12 +56,6 @@ void BattlegroundRL::HandleAreaTrigger(Player* player, uint32 trigger) } } -void BattlegroundRL::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) -{ - data.Worldstates.emplace_back(uint32(0xbba), uint32(1)); // 9 show - Arena::FillInitialWorldStates(data); -} - bool BattlegroundRL::SetupBattleground() { // gates diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h index 4f182a160a..eab801ead0 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h @@ -50,7 +50,6 @@ class BattlegroundRL : public Arena BattlegroundRL(); /* inherited from BattlegroundClass */ - void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& d) override; void StartingEventCloseDoors() override; void StartingEventOpenDoors() override; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp index d4ca18491d..ce8609fdad 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp @@ -21,7 +21,6 @@ #include "ObjectAccessor.h" #include "Player.h" #include "WorldPacket.h" -#include "WorldStatePackets.h" BattlegroundRV::BattlegroundRV() { @@ -101,12 +100,6 @@ void BattlegroundRV::HandleAreaTrigger(Player* player, uint32 trigger) } } -void BattlegroundRV::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) -{ - data.Worldstates.emplace_back(uint32(BG_RV_WORLD_STATE), uint32(1)); - Arena::FillInitialWorldStates(data); -} - bool BattlegroundRV::SetupBattleground() { // elevators diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h index 0e978a8570..48ac2fad4f 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h @@ -92,9 +92,7 @@ enum BattlegroundRVData BG_RV_PILLAR_SWITCH_TIMER = 25000, BG_RV_FIRE_TO_PILLAR_TIMER = 20000, BG_RV_CLOSE_FIRE_TIMER = 5000, - BG_RV_FIRST_TIMER = 20133, - - BG_RV_WORLD_STATE = 0xe1a + BG_RV_FIRST_TIMER = 20133 }; class BattlegroundRV : public Arena @@ -104,7 +102,6 @@ class BattlegroundRV : public Arena /* inherited from BattlegroundClass */ void StartingEventOpenDoors() override; - void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& d) override; void HandleAreaTrigger(Player* Source, uint32 Trigger) override; bool SetupBattleground() override; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index 7f4ebb332c..ef6bcbaf5a 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -27,7 +27,7 @@ #include "ScriptedCreature.h" #include "UpdateData.h" #include "WorldPacket.h" -#include "WorldStatePackets.h" +#include "WorldStateMgr.h" void BattlegroundSAScore::BuildObjectivesBlock(WorldPacket& data, ByteBuffer& content) { @@ -47,7 +47,6 @@ BattlegroundSA::BattlegroundSA() SignaledRoundTwo = false; SignaledRoundTwoHalfMin = false; InitSecondRound = false; - _gateDestroyed = false; Attackers = TEAM_ALLIANCE; TotalTime = 0; EndRoundTimer = 0; @@ -55,13 +54,12 @@ BattlegroundSA::BattlegroundSA() Status = BG_SA_NOT_STARTED; for (uint8 i = 0; i < MAX_GATES; ++i) - GateStatus[i] = BG_SA_GATE_OK; + GateStatus[i] = BG_SA_HORDE_GATE_OK; for (uint8 i = 0; i < 2; i++) { RoundScores[i].winner = TEAM_ALLIANCE; RoundScores[i].time = 0; - _allVehiclesAlive[i] = true; } //! This is here to prevent an uninitialised variable warning @@ -77,11 +75,8 @@ void BattlegroundSA::Reset() TotalTime = 0; Attackers = ((urand(0, 1)) ? TEAM_ALLIANCE : TEAM_HORDE); for (uint8 i = 0; i <= 5; i++) - GateStatus[i] = BG_SA_GATE_OK; + GateStatus[i] = BG_SA_HORDE_GATE_OK; ShipsStarted = false; - _gateDestroyed = false; - _allVehiclesAlive[TEAM_ALLIANCE] = true; - _allVehiclesAlive[TEAM_HORDE] = true; Status = BG_SA_WARMUP; } @@ -109,7 +104,7 @@ bool BattlegroundSA::ResetObjs() DelCreature(i); for (uint8 i = 0; i < MAX_GATES; ++i) - GateStatus[i] = BG_SA_GATE_OK; + GateStatus[i] = Attackers == TEAM_HORDE ? BG_SA_ALLIANCE_GATE_OK : BG_SA_HORDE_GATE_OK; if (!AddCreature(BG_SA_NpcEntries[BG_SA_NPC_KANRETHAD], BG_SA_NPC_KANRETHAD, BG_SA_NpcSpawnlocs[BG_SA_NPC_KANRETHAD])) { @@ -274,6 +269,7 @@ bool BattlegroundSA::ResetObjs() UpdateWorldState(BG_SA_ALLIANCE_DEFENCE_TOKEN, 1); } + UpdateWorldState(BG_SA_ATTACKER_TEAM, Attackers); UpdateWorldState(BG_SA_PURPLE_GATEWS, 1); UpdateWorldState(BG_SA_RED_GATEWS, 1); UpdateWorldState(BG_SA_BLUE_GATEWS, 1); @@ -298,8 +294,8 @@ void BattlegroundSA::StartShips() if (ShipsStarted) return; - DoorOpen(BG_SA_BOAT_ONE); - DoorOpen(BG_SA_BOAT_TWO); + GetBGObject(BG_SA_BOAT_ONE)->SetGoState(GO_STATE_TRANSPORT_STOPPED); + GetBGObject(BG_SA_BOAT_TWO)->SetGoState(GO_STATE_TRANSPORT_STOPPED); for (int i = BG_SA_BOAT_ONE; i <= BG_SA_BOAT_TWO; i++) { @@ -342,6 +338,7 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff) if (Status == BG_SA_WARMUP) { EndRoundTimer = BG_SA_ROUNDLENGTH; + UpdateWorldState(BG_SA_TIMER, GameTime::GetGameTime() + EndRoundTimer); if (TotalTime >= BG_SA_WARMUPLENGTH) { if (Creature* c = GetBGCreature(BG_SA_NPC_KANRETHAD)) @@ -364,6 +361,7 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff) else EndRoundTimer = BG_SA_ROUNDLENGTH; + UpdateWorldState(BG_SA_TIMER, GameTime::GetGameTime() + EndRoundTimer); if (TotalTime >= 60000) { if (Creature* c = GetBGCreature(BG_SA_NPC_KANRETHAD)) @@ -432,57 +430,10 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff) } } if (Status == BG_SA_ROUND_ONE || Status == BG_SA_ROUND_TWO) - { - SendTime(); UpdateDemolisherSpawns(); - } } } -void BattlegroundSA::StartingEventCloseDoors() { } - -void BattlegroundSA::StartingEventOpenDoors() { } - -void BattlegroundSA::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) -{ - bool allyAttacks = Attackers == TEAM_ALLIANCE; - bool hordeAttacks = Attackers == TEAM_HORDE; - - data.Worldstates.emplace_back(uint32(BG_SA_ANCIENT_GATEWS), uint32(GateStatus[BG_SA_ANCIENT_GATE])); - data.Worldstates.emplace_back(uint32(BG_SA_YELLOW_GATEWS), uint32(GateStatus[BG_SA_YELLOW_GATE])); - data.Worldstates.emplace_back(uint32(BG_SA_GREEN_GATEWS), uint32(GateStatus[BG_SA_GREEN_GATE])); - data.Worldstates.emplace_back(uint32(BG_SA_BLUE_GATEWS), uint32(GateStatus[BG_SA_BLUE_GATE])); - data.Worldstates.emplace_back(uint32(BG_SA_RED_GATEWS), uint32(GateStatus[BG_SA_RED_GATE])); - data.Worldstates.emplace_back(uint32(BG_SA_PURPLE_GATEWS), uint32(GateStatus[BG_SA_PURPLE_GATE])); - - data.Worldstates.emplace_back(uint32(BG_SA_BONUS_TIMER), uint32(0)); - - data.Worldstates.emplace_back(uint32(BG_SA_HORDE_ATTACKS), uint32(hordeAttacks)); - data.Worldstates.emplace_back(uint32(BG_SA_ALLY_ATTACKS), uint32(allyAttacks)); - - // Time will be sent on first update... - data.Worldstates.emplace_back(uint32(BG_SA_ENABLE_TIMER), uint32(TimerEnabled)); - data.Worldstates.emplace_back(uint32(BG_SA_TIMER_MINS), uint32(0)); - data.Worldstates.emplace_back(uint32(BG_SA_TIMER_SEC_TENS), uint32(0)); - data.Worldstates.emplace_back(uint32(BG_SA_TIMER_SEC_DECS), uint32(0)); - - data.Worldstates.emplace_back(uint32(BG_SA_RIGHT_GY_HORDE), uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE)); - data.Worldstates.emplace_back(uint32(BG_SA_LEFT_GY_HORDE), uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE)); - data.Worldstates.emplace_back(uint32(BG_SA_CENTER_GY_HORDE), uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE)); - - data.Worldstates.emplace_back(uint32(BG_SA_RIGHT_GY_ALLIANCE), uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE)); - data.Worldstates.emplace_back(uint32(BG_SA_LEFT_GY_ALLIANCE), uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE)); - data.Worldstates.emplace_back(uint32(BG_SA_CENTER_GY_ALLIANCE), uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE)); - - data.Worldstates.emplace_back(uint32(BG_SA_HORDE_DEFENCE_TOKEN), uint32(allyAttacks)); - data.Worldstates.emplace_back(uint32(BG_SA_ALLIANCE_DEFENCE_TOKEN), uint32(hordeAttacks)); - - data.Worldstates.emplace_back(uint32(BG_SA_LEFT_ATT_TOKEN_HRD), uint32(hordeAttacks)); - data.Worldstates.emplace_back(uint32(BG_SA_RIGHT_ATT_TOKEN_HRD), uint32(hordeAttacks)); - data.Worldstates.emplace_back(uint32(BG_SA_RIGHT_ATT_TOKEN_ALL), uint32(allyAttacks)); - data.Worldstates.emplace_back(uint32(BG_SA_LEFT_ATT_TOKEN_ALL), uint32(allyAttacks)); -} - void BattlegroundSA::AddPlayer(Player* player) { Battleground::AddPlayer(player); @@ -568,7 +519,7 @@ void BattlegroundSA::ProcessEvent(WorldObject* obj, uint32 eventId, WorldObject* // damaged if (eventId == go->GetGOInfo()->building.damagedEvent) { - GateStatus[gateId] = BG_SA_GATE_DAMAGED; + GateStatus[gateId] = Attackers == TEAM_HORDE ? BG_SA_ALLIANCE_GATE_DAMAGED : BG_SA_HORDE_GATE_DAMAGED; if (Creature* c = obj->FindNearestCreature(NPC_WORLD_TRIGGER, 500.0f)) SendChatMessage(c, gate->DamagedText, invoker); @@ -578,8 +529,7 @@ void BattlegroundSA::ProcessEvent(WorldObject* obj, uint32 eventId, WorldObject* // destroyed else if (eventId == go->GetGOInfo()->building.destroyedEvent) { - GateStatus[gate->GateId] = BG_SA_GATE_DESTROYED; - _gateDestroyed = true; + GateStatus[gate->GateId] = Attackers == TEAM_HORDE ? BG_SA_ALLIANCE_GATE_DESTROYED : BG_SA_HORDE_GATE_DESTROYED; if (gateId < 5) DelObject(gateId + 14); @@ -593,19 +543,19 @@ void BattlegroundSA::ProcessEvent(WorldObject* obj, uint32 eventId, WorldObject* switch (gateId) { case BG_SA_GREEN_GATE: - if (GateStatus[BG_SA_BLUE_GATE] == BG_SA_GATE_DESTROYED) + if (IsGateDestroyed(BG_SA_BLUE_GATE)) rewardHonor = false; break; case BG_SA_BLUE_GATE: - if (GateStatus[BG_SA_GREEN_GATE] == BG_SA_GATE_DESTROYED) + if (IsGateDestroyed(BG_SA_GREEN_GATE)) rewardHonor = false; break; case BG_SA_RED_GATE: - if (GateStatus[BG_SA_PURPLE_GATE] == BG_SA_GATE_DESTROYED) + if (IsGateDestroyed(BG_SA_PURPLE_GATE)) rewardHonor = false; break; case BG_SA_PURPLE_GATE: - if (GateStatus[BG_SA_RED_GATE] == BG_SA_GATE_DESTROYED) + if (IsGateDestroyed(BG_SA_RED_GATE)) rewardHonor = false; break; default: @@ -645,7 +595,9 @@ void BattlegroundSA::HandleKillUnit(Creature* creature, Player* killer) if (creature->GetEntry() == NPC_DEMOLISHER_SA) { UpdatePlayerScore(killer, SCORE_DESTROYED_DEMOLISHER, 1); - _allVehiclesAlive[Attackers] = false; + int32 worldStateId = Attackers == TEAM_HORDE ? BG_SA_DESTROYED_HORDE_VEHICLES : BG_SA_DESTROYED_ALLIANCE_VEHICLES; + int32 currentDestroyedVehicles = sWorldStateMgr->GetValue(worldStateId, GetBgMap()); + UpdateWorldState(worldStateId, currentDestroyedVehicles + 1); } } @@ -728,29 +680,21 @@ WorldSafeLocsEntry const* BattlegroundSA::GetClosestGraveyard(Player* player) return closest; } -void BattlegroundSA::SendTime() -{ - uint32 end_of_round = (EndRoundTimer - TotalTime); - UpdateWorldState(BG_SA_TIMER_MINS, end_of_round/60000); - UpdateWorldState(BG_SA_TIMER_SEC_TENS, (end_of_round%60000)/10000); - UpdateWorldState(BG_SA_TIMER_SEC_DECS, ((end_of_round%60000)%10000)/1000); -} - bool BattlegroundSA::CanInteractWithObject(uint32 objectId) { switch (objectId) { case BG_SA_TITAN_RELIC: - if (GateStatus[BG_SA_ANCIENT_GATE] != BG_SA_GATE_DESTROYED || GateStatus[BG_SA_YELLOW_GATE] != BG_SA_GATE_DESTROYED) + if (!IsGateDestroyed(BG_SA_ANCIENT_GATE) || !IsGateDestroyed(BG_SA_YELLOW_GATE)) return false; [[fallthrough]]; case BG_SA_CENTRAL_FLAG: - if (GateStatus[BG_SA_RED_GATE] != BG_SA_GATE_DESTROYED && GateStatus[BG_SA_PURPLE_GATE] != BG_SA_GATE_DESTROYED) + if (!IsGateDestroyed(BG_SA_RED_GATE) && !IsGateDestroyed(BG_SA_PURPLE_GATE)) return false; [[fallthrough]]; case BG_SA_LEFT_FLAG: case BG_SA_RIGHT_FLAG: - if (GateStatus[BG_SA_GREEN_GATE] != BG_SA_GATE_DESTROYED && GateStatus[BG_SA_BLUE_GATE] != BG_SA_GATE_DESTROYED) + if (!IsGateDestroyed(BG_SA_GREEN_GATE) && !IsGateDestroyed(BG_SA_BLUE_GATE)) return false; break; default: @@ -1041,17 +985,10 @@ void BattlegroundSA::SendTransportsRemove(Player* player) } } -bool BattlegroundSA::CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target, uint32 miscValue) +bool BattlegroundSA::IsGateDestroyed(BG_SA_Objects gateId) const { - switch (criteriaId) - { - case BG_CRITERIA_CHECK_NOT_EVEN_A_SCRATCH: - return _allVehiclesAlive[GetTeamIndexByTeamId(source->GetTeam())]; - case BG_CRITERIA_CHECK_DEFENSE_OF_THE_ANCIENTS: - return source->GetTeamId() != Attackers && !_gateDestroyed; - } - - return Battleground::CheckAchievementCriteriaMeet(criteriaId, source, target, miscValue); + ASSERT(gateId < MAX_GATES); + return GateStatus[gateId] == BG_SA_ALLIANCE_GATE_DESTROYED || GateStatus[gateId] == BG_SA_HORDE_GATE_DESTROYED; } bool BattlegroundSA::IsSpellAllowed(uint32 spellId, Player const* /*player*/) const diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h index bd039b8ce8..bec2fe1e4f 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h @@ -45,9 +45,14 @@ enum BG_SA_Status enum BG_SA_GateState { - BG_SA_GATE_OK = 1, - BG_SA_GATE_DAMAGED = 2, - BG_SA_GATE_DESTROYED = 3 + // alliance is defender + BG_SA_ALLIANCE_GATE_OK = 1, + BG_SA_ALLIANCE_GATE_DAMAGED = 2, + BG_SA_ALLIANCE_GATE_DESTROYED = 3, + // horde is defender + BG_SA_HORDE_GATE_OK = 4, + BG_SA_HORDE_GATE_DAMAGED = 5, + BG_SA_HORDE_GATE_DESTROYED = 6, }; enum BG_SA_EventIds @@ -159,9 +164,7 @@ enum SATexts enum SAWorldStates { - BG_SA_TIMER_MINS = 3559, - BG_SA_TIMER_SEC_TENS = 3560, - BG_SA_TIMER_SEC_DECS = 3561, + BG_SA_TIMER = 3557, BG_SA_ALLY_ATTACKS = 4352, BG_SA_HORDE_ATTACKS = 4353, BG_SA_PURPLE_GATEWS = 3614, @@ -183,7 +186,10 @@ enum SAWorldStates BG_SA_LEFT_GY_HORDE = 3633, BG_SA_CENTER_GY_HORDE = 3634, BG_SA_BONUS_TIMER = 3571, - BG_SA_ENABLE_TIMER = 3564 + BG_SA_ENABLE_TIMER = 3564, + BG_SA_ATTACKER_TEAM = 3690, + BG_SA_DESTROYED_ALLIANCE_VEHICLES = 3955, + BG_SA_DESTROYED_HORDE_VEHICLES = 3956, }; enum BG_SA_NPCs @@ -573,14 +579,9 @@ class BattlegroundSA : public Battleground /* inherited from BattlegroundClass */ /// Called when a player join battle void AddPlayer(Player* player) override; - /// Called when battle start - void StartingEventCloseDoors() override; - void StartingEventOpenDoors() override; /// Called for ini battleground, after that the first player be entered bool SetupBattleground() override; void Reset() override; - /// Called for generate packet contain worldstate data - void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) override; /// Called when a player kill a unit in bg void HandleKillUnit(Creature* creature, Player* killer) override; /// Return the nearest graveyard where player can respawn @@ -610,9 +611,6 @@ class BattlegroundSA : public Battleground /* Scorekeeping */ - // Achievement: Not Even a Scratch - bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target = nullptr, uint32 miscValue = 0) override; - // Control Phase Shift bool IsSpellAllowed(uint32 spellId, Player const* player) const override; @@ -651,8 +649,6 @@ class BattlegroundSA : public Battleground * -Delete gameobject in front of door (lighting object, with different colours for each door) */ void DestroyGate(Player* player, GameObject* go) override; - /// Update timer worldstate - void SendTime(); /** * \brief Called when a graveyard is capture * -Update spiritguide @@ -674,6 +670,8 @@ class BattlegroundSA : public Battleground /// Send packet to player for destroy boats (client part) void SendTransportsRemove(Player* player); + bool IsGateDestroyed(BG_SA_Objects gateId) const; + /// Id of attacker team TeamId Attackers; @@ -702,11 +700,5 @@ class BattlegroundSA : public Battleground /// for know if second round has been init bool InitSecondRound; std::map DemoliserRespawnList; - - // Achievement: Defense of the Ancients - bool _gateDestroyed; - - // Achievement: Not Even a Scratch - bool _allVehiclesAlive[BG_TEAMS_COUNT]; }; #endif diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundTP.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundTP.cpp index 706ef70a86..0e89216ea7 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundTP.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundTP.cpp @@ -25,7 +25,6 @@ #include "ObjectAccessor.h" #include "Player.h" #include "WorldPacket.h" -#include "WorldStatePackets.h" // these variables aren't used outside of this file, so declare them only here enum BG_TP_Rewards @@ -346,55 +345,6 @@ void BattlegroundTP::Reset() _flagsTimer[TEAM_HORDE] = 0; } -void BattlegroundTP::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) -{ - /// Show how many flags had been captured - data.Worldstates.emplace_back(uint32(BG_TP_FLAG_CAPTURES_ALLIANCE), uint32(GetTeamScore(TEAM_ALLIANCE))); - data.Worldstates.emplace_back(uint32(BG_TP_FLAG_CAPTURES_HORDE), uint32(GetTeamScore(TEAM_HORDE))); - - /// Show MAX number of flags (x/3) - data.Worldstates.emplace_back(uint32(BG_TP_FLAG_CAPTURES_MAX), uint32(BG_TP_MAX_TEAM_SCORE)); - - /// Next Stuff showed only if BG is in progress - if (GetStatus() == STATUS_IN_PROGRESS) - { - /// Show Flag state - if flag is on player / ground / in base - for (uint8 team = TEAM_ALLIANCE; team <= TEAM_HORDE; ++team) - { - switch(_flagState[team]) - { - case BG_TP_FLAG_STATE_ON_GROUND: - data.Worldstates.emplace_back(uint32(BG_TP_FLAG_UNK_ALLIANCE + team), uint32(-1)); - data.Worldstates.emplace_back(uint32(BG_TP_FLAG_STATE_HORDE + team), uint32(3)); ///< Show if team's flag is carried - break; - case BG_TP_FLAG_STATE_ON_PLAYER: - data.Worldstates.emplace_back(uint32(BG_TP_FLAG_UNK_ALLIANCE + team), uint32(1)); - data.Worldstates.emplace_back(uint32(BG_TP_FLAG_STATE_HORDE + team), uint32(2)); ///< Show if team's flag is carried - break; - default: ///< In Base - data.Worldstates.emplace_back(uint32(BG_TP_FLAG_UNK_ALLIANCE + team), uint32(0)); - data.Worldstates.emplace_back(uint32(BG_TP_FLAG_STATE_HORDE + team), uint32(1)); ///< Show if team's flag is carried - break; - } - } - - /// Show Timer - data.Worldstates.emplace_back(uint32(BG_TP_STATE_TIMER_ACTIVE), uint32(1)); - data.Worldstates.emplace_back(uint32(BG_TP_STATE_TIMER), uint32(25 - _minutesElapsed)); - } - else - { - /// No timer for begining - data.Worldstates.emplace_back(uint32(BG_TP_STATE_TIMER_ACTIVE), uint32(0)); - - /// Just show the maxscore and actual score (0) - data.Worldstates.emplace_back(uint32(BG_TP_FLAG_UNK_ALLIANCE), uint32(0)); - data.Worldstates.emplace_back(uint32(BG_TP_FLAG_UNK_HORDE), uint32(0)); - data.Worldstates.emplace_back(uint32(BG_TP_FLAG_STATE_HORDE), uint32(1)); - data.Worldstates.emplace_back(uint32(BG_TP_FLAG_STATE_ALLIANCE), uint32(1)); - } -} - void BattlegroundTP::EndBattleground(uint32 winner) { // Win reward @@ -906,17 +856,3 @@ uint32 BattlegroundTP::GetPrematureWinner() return Battleground::GetPrematureWinner(); } - -bool BattlegroundTP::CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* player, Unit const* target, uint32 miscValue) -{ - switch (criteriaId) - { - case BG_CRITERIA_CHECK_SAVE_THE_DAY: - if (target) - if (Player const* playerTarget = target->ToPlayer()) - return GetFlagState(playerTarget->GetTeam()) == BG_TP_FLAG_STATE_ON_BASE; - return false; - } - - return Battleground::CheckAchievementCriteriaMeet(criteriaId, player, target, miscValue); -} diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundTP.h b/src/server/game/Battlegrounds/Zones/BattlegroundTP.h index 72e42f8881..3a340639bc 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundTP.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundTP.h @@ -272,8 +272,6 @@ class BattlegroundTP : public Battleground } ObjectGuid GetDroppedFlagGUID(uint32 TeamID) { return m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)]; } - void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) override; - /* Scorekeeping */ void AddPoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] += Points; } void SetTeamPoint(uint32 TeamID, uint32 Points = 0) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] = Points; } @@ -281,9 +279,6 @@ class BattlegroundTP : public Battleground uint32 GetPrematureWinner() override; - /* Achievements*/ - bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target = nullptr, uint32 miscvalue1 = 0) override; - private: ObjectGuid m_FlagKeepers[2]; // 0 - alliance, 1 - horde ObjectGuid m_DroppedFlagGUID[2]; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index 43c7b1e133..2cc669e278 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -19,13 +19,13 @@ #include "BattlegroundMgr.h" #include "DBCStores.h" #include "GameObject.h" +#include "GameTime.h" #include "Log.h" #include "Map.h" #include "Object.h" #include "ObjectAccessor.h" #include "Player.h" #include "WorldPacket.h" -#include "WorldStatePackets.h" // these variables aren't used outside of this file, so declare them only here enum BG_WSG_Rewards @@ -68,7 +68,6 @@ BattlegroundWS::BattlegroundWS() m_ReputationCapture = 0; m_HonorWinKills = 0; m_HonorEndKills = 0; - _minutesElapsed = 0; } void BattlegroundWGScore::BuildObjectivesBlock(WorldPacket& data, ByteBuffer& content) @@ -102,12 +101,6 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff) else EndBattleground(ALLIANCE); } - // first update needed after 1 minute of game already in progress - else if (GetElapsedTime() > uint32(_minutesElapsed * MINUTE * IN_MILLISECONDS) + 3 * MINUTE * IN_MILLISECONDS) - { - ++_minutesElapsed; - UpdateWorldState(BG_WS_STATE_TIMER, 25 - _minutesElapsed); - } if (_flagState[TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN) { @@ -209,9 +202,6 @@ void BattlegroundWS::StartingEventCloseDoors() } for (uint32 i = BG_WS_OBJECT_A_FLAG; i <= BG_WS_OBJECT_BERSERKBUFF_2; ++i) SpawnBGObject(i, RESPAWN_ONE_DAY); - - UpdateWorldState(BG_WS_STATE_TIMER_ACTIVE, 1); - UpdateWorldState(BG_WS_STATE_TIMER, 25); } void BattlegroundWS::StartingEventOpenDoors() @@ -229,6 +219,9 @@ void BattlegroundWS::StartingEventOpenDoors() SpawnBGObject(BG_WS_OBJECT_DOOR_H_3, RESPAWN_ONE_DAY); SpawnBGObject(BG_WS_OBJECT_DOOR_H_4, RESPAWN_ONE_DAY); + UpdateWorldState(BG_WS_STATE_TIMER_ACTIVE, 1); + UpdateWorldState(BG_WS_STATE_TIMER, GameTime::GetGameTime() + 15 * MINUTE); + // players joining later are not eligibles TriggerGameEvent(WS_EVENT_START_BATTLE); } @@ -343,7 +336,7 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* player) else SendBroadcastText(BG_WS_TEXT_CAPTURED_ALLIANCE_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, player); - UpdateFlagState(player->GetTeam(), 1); // flag state none + UpdateFlagState(player->GetTeam(), BG_WS_FLAG_STATE_WAIT_RESPAWN); // flag state none UpdateTeamScore(player->GetTeamId()); // only flag capture should be updated UpdatePlayerScore(player, SCORE_FLAG_CAPTURES, 1); // +1 flag captures @@ -359,8 +352,6 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* player) if (winner) { - UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 0); - UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 0); UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, 1); UpdateWorldState(BG_WS_FLAG_STATE_HORDE, 1); UpdateWorldState(BG_WS_STATE_TIMER_ACTIVE, 0); @@ -445,18 +436,12 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* player) if (set) { player->CastSpell(player, SPELL_RECENTLY_DROPPED_FLAG, true); - UpdateFlagState(player->GetTeam(), 1); + UpdateFlagState(player->GetTeam(), BG_WS_FLAG_STATE_ON_GROUND); if (player->GetTeam() == ALLIANCE) - { SendBroadcastText(BG_WS_TEXT_HORDE_FLAG_DROPPED, CHAT_MSG_BG_SYSTEM_HORDE, player); - UpdateWorldState(BG_WS_FLAG_UNK_HORDE, uint32(-1)); - } else - { SendBroadcastText(BG_WS_TEXT_ALLIANCE_FLAG_DROPPED, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); - UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, uint32(-1)); - } _flagsDropTimer[GetTeamIndexByTeamId(player->GetTeam()) ? 0 : 1] = BG_WS_FLAG_DROP_TIME; } @@ -478,7 +463,6 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target _flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER; //update world state to show correct flag carrier UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER); - UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1); player->CastSpell(player, BG_WS_SPELL_SILVERWING_FLAG, true); player->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_SILVERWING_FLAG_PICKED); if (_flagState[1] == BG_WS_FLAG_STATE_ON_PLAYER) @@ -496,7 +480,6 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target _flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER; //update world state to show correct flag carrier UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER); - UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1); player->CastSpell(player, BG_WS_SPELL_WARSONG_FLAG, true); player->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_WARSONG_FLAG_PICKED); if (_flagState[0] == BG_WS_FLAG_STATE_ON_PLAYER) @@ -530,7 +513,6 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target player->CastSpell(player, WS_SPELL_FOCUSED_ASSAULT, true); else if (_flagDebuffState == 2) player->CastSpell(player, WS_SPELL_BRUTAL_ASSAULT, true); - UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1); } //called in HandleGameObjectUseOpcode: //target_obj->Delete(); @@ -563,7 +545,6 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target player->CastSpell(player, WS_SPELL_FOCUSED_ASSAULT, true); else if (_flagDebuffState == 2) player->CastSpell(player, WS_SPELL_BRUTAL_ASSAULT, true); - UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1); } //called in HandleGameObjectUseOpcode: //target_obj->Delete(); @@ -601,10 +582,30 @@ void BattlegroundWS::RemovePlayer(Player* player, ObjectGuid guid, uint32 /*team void BattlegroundWS::UpdateFlagState(uint32 team, uint32 value) { - if (team == ALLIANCE) + auto transformValueToOtherTeamControlWorldState = [](uint32 value) + { + switch (value) + { + case BG_WS_FLAG_STATE_ON_BASE: + case BG_WS_FLAG_STATE_ON_GROUND: + case BG_WS_FLAG_STATE_WAIT_RESPAWN: + return 1; + case BG_WS_FLAG_STATE_ON_PLAYER: + return 2; + default: + return 0; + } + }; + if (team == HORDE) + { UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, value); + UpdateWorldState(BG_WS_FLAG_CONTROL_HORDE, transformValueToOtherTeamControlWorldState(value)); + } else + { UpdateWorldState(BG_WS_FLAG_STATE_HORDE, value); + UpdateWorldState(BG_WS_FLAG_CONTROL_ALLIANCE, transformValueToOtherTeamControlWorldState(value)); + } } void BattlegroundWS::UpdateTeamScore(uint32 team) @@ -741,7 +742,6 @@ void BattlegroundWS::Reset() m_HonorWinKills = 1; m_HonorEndKills = 2; } - _minutesElapsed = 0; _lastFlagCaptureTeam = 0; _bothFlagsKept = false; _flagDebuffState = 0; @@ -818,46 +818,6 @@ WorldSafeLocsEntry const* BattlegroundWS::GetClosestGraveyard(Player* player) } } -void BattlegroundWS::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) -{ - data.Worldstates.emplace_back(uint32(BG_WS_FLAG_CAPTURES_ALLIANCE), uint32(GetTeamScore(TEAM_ALLIANCE))); - data.Worldstates.emplace_back(uint32(BG_WS_FLAG_CAPTURES_HORDE), uint32(GetTeamScore(TEAM_HORDE))); - - if (_flagState[TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND) - data.Worldstates.emplace_back(uint32(BG_WS_FLAG_UNK_ALLIANCE), uint32(-1)); - else if (_flagState[TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER) - data.Worldstates.emplace_back(uint32(BG_WS_FLAG_UNK_ALLIANCE), uint32(1)); - else - data.Worldstates.emplace_back(uint32(BG_WS_FLAG_UNK_ALLIANCE), uint32(0)); - - if (_flagState[TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND) - data.Worldstates.emplace_back(uint32(BG_WS_FLAG_UNK_HORDE), uint32(-1)); - else if (_flagState[TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER) - data.Worldstates.emplace_back(uint32(BG_WS_FLAG_UNK_HORDE), uint32(1)); - else - data.Worldstates.emplace_back(uint32(BG_WS_FLAG_UNK_HORDE), uint32(0)); - - data.Worldstates.emplace_back(uint32(BG_WS_FLAG_CAPTURES_MAX), uint32(BG_WS_MAX_TEAM_SCORE)); - - if (GetStatus() == STATUS_IN_PROGRESS) - { - data.Worldstates.emplace_back(uint32(BG_WS_STATE_TIMER_ACTIVE), uint32(1)); - data.Worldstates.emplace_back(uint32(BG_WS_STATE_TIMER), uint32(25-_minutesElapsed)); - } - else - data.Worldstates.emplace_back(uint32(BG_WS_STATE_TIMER_ACTIVE), uint32(0)); - - if (_flagState[TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER) - data.Worldstates.emplace_back(uint32(BG_WS_FLAG_STATE_HORDE), uint32(2)); - else - data.Worldstates.emplace_back(uint32(BG_WS_FLAG_STATE_HORDE), uint32(1)); - - if (_flagState[TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER) - data.Worldstates.emplace_back(uint32(BG_WS_FLAG_STATE_ALLIANCE), uint32(2)); - else - data.Worldstates.emplace_back(uint32(BG_WS_FLAG_STATE_ALLIANCE), uint32(1)); -} - uint32 BattlegroundWS::GetPrematureWinner() { if (GetTeamScore(TEAM_ALLIANCE) > GetTeamScore(TEAM_HORDE)) @@ -867,17 +827,3 @@ uint32 BattlegroundWS::GetPrematureWinner() return Battleground::GetPrematureWinner(); } - -bool BattlegroundWS::CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* player, Unit const* target, uint32 miscValue) -{ - switch (criteriaId) - { - case BG_CRITERIA_CHECK_SAVE_THE_DAY: - if (target) - if (Player const* playerTarget = target->ToPlayer()) - return GetFlagState(playerTarget->GetTeam()) == BG_WS_FLAG_STATE_ON_BASE; - return false; - } - - return Battleground::CheckAchievementCriteriaMeet(criteriaId, player, target, miscValue); -} diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h index 09c741c1c7..eddd56a2ed 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h @@ -80,18 +80,22 @@ enum BG_WS_SpellId enum BG_WS_WorldStates { - BG_WS_FLAG_UNK_ALLIANCE = 1545, - BG_WS_FLAG_UNK_HORDE = 1546, -// FLAG_UNK = 1547, - BG_WS_FLAG_CAPTURES_ALLIANCE = 1581, - BG_WS_FLAG_CAPTURES_HORDE = 1582, - BG_WS_FLAG_CAPTURES_MAX = 1601, - BG_WS_FLAG_STATE_HORDE = 2338, - BG_WS_FLAG_STATE_ALLIANCE = 2339, - BG_WS_STATE_TIMER = 4248, - BG_WS_STATE_TIMER_ACTIVE = 4247 + BG_WS_FLAG_STATE_ALLIANCE = 1545, + BG_WS_FLAG_STATE_HORDE = 1546, + BG_WS_FLAG_STATE_NEUTRAL = 1547, // unused + BG_WS_FLAG_CAPTURES_ALLIANCE = 1581, + BG_WS_FLAG_CAPTURES_HORDE = 1582, + BG_WS_FLAG_CAPTURES_MAX = 1601, + BG_WS_FLAG_CONTROL_HORDE = 2338, + BG_WS_FLAG_CONTROL_ALLIANCE = 2339, + BG_WS_STATE_TIMER = 4248, + BG_WS_STATE_TIMER_ACTIVE = 4247 }; +// save the day +// alliance criteria: BG_WS_FLAG_STATE_HORDE == 1 && BG_WS_FLAG_STATE_NEUTRAL == 0 && WS(1664) > 0 +// horde criteria: BG_WS_FLAG_STATE_ALLIANCE == 1 && BG_WS_FLAG_STATE_NEUTRAL == 0 && WS(1664) > 0 + enum BG_WS_ObjectTypes { BG_WS_OBJECT_DOOR_A_1 = 0, @@ -135,10 +139,10 @@ enum BG_WS_ObjectEntry enum BG_WS_FlagState { - BG_WS_FLAG_STATE_ON_BASE = 0, - BG_WS_FLAG_STATE_WAIT_RESPAWN = 1, + BG_WS_FLAG_STATE_ON_BASE = 1, BG_WS_FLAG_STATE_ON_PLAYER = 2, - BG_WS_FLAG_STATE_ON_GROUND = 3 + BG_WS_FLAG_STATE_ON_GROUND = 3, + BG_WS_FLAG_STATE_WAIT_RESPAWN = 4, }; enum BG_WS_Graveyards @@ -254,7 +258,6 @@ class BattlegroundWS : public Battleground } ObjectGuid GetDroppedFlagGUID(uint32 TeamID) { return m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)]; } - void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& data) override; /* Scorekeeping */ void AddPoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] += Points; } @@ -263,9 +266,6 @@ class BattlegroundWS : public Battleground uint32 GetPrematureWinner() override; - /* Achievements*/ - bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target = nullptr, uint32 miscvalue1 = 0) override; - private: ObjectGuid m_FlagKeepers[2]; // 0 - alliance, 1 - horde ObjectGuid m_DroppedFlagGUID[2]; @@ -280,7 +280,6 @@ class BattlegroundWS : public Battleground int32 _flagSpellForceTimer; bool _bothFlagsKept; uint8 _flagDebuffState; // 0 - no debuffs, 1 - focused assault, 2 - brutal assault - uint8 _minutesElapsed; void PostUpdateImpl(uint32 diff) override; }; diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index f5b770ca14..c2cc59a572 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -8756,7 +8756,6 @@ void Player::SendUpdateWorldState(uint32 variable, uint32 value, bool hidden /*= void Player::SendInitWorldStates(uint32 zoneId, uint32 areaId) { // data depends on zoneid/mapid... - Battleground* bg = GetBattleground(); uint32 mapid = GetMapId(); OutdoorPvP* pvp = sOutdoorPvPMgr->GetOutdoorPvPToZoneId(zoneId); @@ -8817,182 +8816,6 @@ void Player::SendInitWorldStates(uint32 zoneId, uint32 areaId) packet.Worldstates.emplace_back(2324, 0x0); // 12 sandworm SW packet.Worldstates.emplace_back(2325, 0x0); // 13 sandworm E break; - case 2597: // Alterac Valley - if (bg && bg->GetTypeID(true) == BATTLEGROUND_AV) - bg->FillInitialWorldStates(packet); - else - { - packet.Worldstates.emplace_back(0x7ae, 0x1); // 7 snowfall n - packet.Worldstates.emplace_back(0x532, 0x1); // 8 frostwolfhut hc - packet.Worldstates.emplace_back(0x531, 0x0); // 9 frostwolfhut ac - packet.Worldstates.emplace_back(0x52e, 0x0); // 10 stormpike firstaid a_a - packet.Worldstates.emplace_back(0x571, 0x0); // 11 east frostwolf tower horde assaulted -unused - packet.Worldstates.emplace_back(0x570, 0x0); // 12 west frostwolf tower horde assaulted - unused - packet.Worldstates.emplace_back(0x567, 0x1); // 13 frostwolfe c - packet.Worldstates.emplace_back(0x566, 0x1); // 14 frostwolfw c - packet.Worldstates.emplace_back(0x550, 0x1); // 15 irondeep (N) ally - packet.Worldstates.emplace_back(0x544, 0x0); // 16 ice grave a_a - packet.Worldstates.emplace_back(0x536, 0x0); // 17 stormpike grave h_c - packet.Worldstates.emplace_back(0x535, 0x1); // 18 stormpike grave a_c - packet.Worldstates.emplace_back(0x518, 0x0); // 19 stoneheart grave a_a - packet.Worldstates.emplace_back(0x517, 0x0); // 20 stoneheart grave h_a - packet.Worldstates.emplace_back(0x574, 0x0); // 21 1396 unk - packet.Worldstates.emplace_back(0x573, 0x0); // 22 iceblood tower horde assaulted -unused - packet.Worldstates.emplace_back(0x572, 0x0); // 23 towerpoint horde assaulted - unused - packet.Worldstates.emplace_back(0x56f, 0x0); // 24 1391 unk - packet.Worldstates.emplace_back(0x56e, 0x0); // 25 iceblood a - packet.Worldstates.emplace_back(0x56d, 0x0); // 26 towerp a - packet.Worldstates.emplace_back(0x56c, 0x0); // 27 frostwolfe a - packet.Worldstates.emplace_back(0x56b, 0x0); // 28 froswolfw a - packet.Worldstates.emplace_back(0x56a, 0x1); // 29 1386 unk - packet.Worldstates.emplace_back(0x569, 0x1); // 30 iceblood c - packet.Worldstates.emplace_back(0x568, 0x1); // 31 towerp c - packet.Worldstates.emplace_back(0x565, 0x0); // 32 stoneh tower a - packet.Worldstates.emplace_back(0x564, 0x0); // 33 icewing tower a - packet.Worldstates.emplace_back(0x563, 0x0); // 34 dunn a - packet.Worldstates.emplace_back(0x562, 0x0); // 35 duns a - packet.Worldstates.emplace_back(0x561, 0x0); // 36 stoneheart bunker alliance assaulted - unused - packet.Worldstates.emplace_back(0x560, 0x0); // 37 icewing bunker alliance assaulted - unused - packet.Worldstates.emplace_back(0x55f, 0x0); // 38 dunbaldar south alliance assaulted - unused - packet.Worldstates.emplace_back(0x55e, 0x0); // 39 dunbaldar north alliance assaulted - unused - packet.Worldstates.emplace_back(0x55d, 0x0); // 40 stone tower d - packet.Worldstates.emplace_back(0x3c6, 0x0); // 41 966 unk - packet.Worldstates.emplace_back(0x3c4, 0x0); // 42 964 unk - packet.Worldstates.emplace_back(0x3c2, 0x0); // 43 962 unk - packet.Worldstates.emplace_back(0x516, 0x1); // 44 stoneheart grave a_c - packet.Worldstates.emplace_back(0x515, 0x0); // 45 stonheart grave h_c - packet.Worldstates.emplace_back(0x3b6, 0x0); // 46 950 unk - packet.Worldstates.emplace_back(0x55c, 0x0); // 47 icewing tower d - packet.Worldstates.emplace_back(0x55b, 0x0); // 48 dunn d - packet.Worldstates.emplace_back(0x55a, 0x0); // 49 duns d - packet.Worldstates.emplace_back(0x559, 0x0); // 50 1369 unk - packet.Worldstates.emplace_back(0x558, 0x0); // 51 iceblood d - packet.Worldstates.emplace_back(0x557, 0x0); // 52 towerp d - packet.Worldstates.emplace_back(0x556, 0x0); // 53 frostwolfe d - packet.Worldstates.emplace_back(0x555, 0x0); // 54 frostwolfw d - packet.Worldstates.emplace_back(0x554, 0x1); // 55 stoneh tower c - packet.Worldstates.emplace_back(0x553, 0x1); // 56 icewing tower c - packet.Worldstates.emplace_back(0x552, 0x1); // 57 dunn c - packet.Worldstates.emplace_back(0x551, 0x1); // 58 duns c - packet.Worldstates.emplace_back(0x54f, 0x0); // 59 irondeep (N) horde - packet.Worldstates.emplace_back(0x54e, 0x0); // 60 irondeep (N) ally - packet.Worldstates.emplace_back(0x54d, 0x1); // 61 mine (S) neutral - packet.Worldstates.emplace_back(0x54c, 0x0); // 62 mine (S) horde - packet.Worldstates.emplace_back(0x54b, 0x0); // 63 mine (S) ally - packet.Worldstates.emplace_back(0x545, 0x0); // 64 iceblood h_a - packet.Worldstates.emplace_back(0x543, 0x1); // 65 iceblod h_c - packet.Worldstates.emplace_back(0x542, 0x0); // 66 iceblood a_c - packet.Worldstates.emplace_back(0x540, 0x0); // 67 snowfall h_a - packet.Worldstates.emplace_back(0x53f, 0x0); // 68 snowfall a_a - packet.Worldstates.emplace_back(0x53e, 0x0); // 69 snowfall h_c - packet.Worldstates.emplace_back(0x53d, 0x0); // 70 snowfall a_c - packet.Worldstates.emplace_back(0x53c, 0x0); // 71 frostwolf g h_a - packet.Worldstates.emplace_back(0x53b, 0x0); // 72 frostwolf g a_a - packet.Worldstates.emplace_back(0x53a, 0x1); // 73 frostwolf g h_c - packet.Worldstates.emplace_back(0x539, 0x0); // 74 frostwolf g a_c - packet.Worldstates.emplace_back(0x538, 0x0); // 75 stormpike grave h_a - packet.Worldstates.emplace_back(0x537, 0x0); // 76 stormpike grave a_a - packet.Worldstates.emplace_back(0x534, 0x0); // 77 frostwolf hut h_a - packet.Worldstates.emplace_back(0x533, 0x0); // 78 frostwolf hut a_a - packet.Worldstates.emplace_back(0x530, 0x0); // 79 stormpike first aid h_a - packet.Worldstates.emplace_back(0x52f, 0x0); // 80 stormpike first aid h_c - packet.Worldstates.emplace_back(0x52d, 0x1); // 81 stormpike first aid a_c - } - break; - case 3277: // Warsong Gulch - if (bg && bg->GetTypeID(true) == BATTLEGROUND_WS) - bg->FillInitialWorldStates(packet); - else - { - packet.Worldstates.emplace_back(0x62d, 0x0); // 7 1581 alliance flag captures - packet.Worldstates.emplace_back(0x62e, 0x0); // 8 1582 horde flag captures - packet.Worldstates.emplace_back(0x609, 0x0); // 9 1545 unk, set to 1 on alliance flag pickup... - packet.Worldstates.emplace_back(0x60a, 0x0); // 10 1546 unk, set to 1 on horde flag pickup, after drop it's -1 - packet.Worldstates.emplace_back(0x60b, 0x2); // 11 1547 unk - packet.Worldstates.emplace_back(0x641, 0x3); // 12 1601 unk (max flag captures?) - packet.Worldstates.emplace_back(0x922, 0x1); // 13 2338 horde (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing) - packet.Worldstates.emplace_back(0x923, 0x1); // 14 2339 alliance (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing) - } - break; - case 3358: // Arathi Basin - if (bg && bg->GetTypeID(true) == BATTLEGROUND_AB) - bg->FillInitialWorldStates(packet); - else - { - packet.Worldstates.emplace_back(0x6e7, 0x0); // 7 1767 stables alliance - packet.Worldstates.emplace_back(0x6e8, 0x0); // 8 1768 stables horde - packet.Worldstates.emplace_back(0x6e9, 0x0); // 9 1769 unk, ST? - packet.Worldstates.emplace_back(0x6ea, 0x0); // 10 1770 stables (show/hide) - packet.Worldstates.emplace_back(0x6ec, 0x0); // 11 1772 farm (0 - horde controlled, 1 - alliance controlled) - packet.Worldstates.emplace_back(0x6ed, 0x0); // 12 1773 farm (show/hide) - packet.Worldstates.emplace_back(0x6ee, 0x0); // 13 1774 farm color - packet.Worldstates.emplace_back(0x6ef, 0x0); // 14 1775 gold mine color, may be FM? - packet.Worldstates.emplace_back(0x6f0, 0x0); // 15 1776 alliance resources - packet.Worldstates.emplace_back(0x6f1, 0x0); // 16 1777 horde resources - packet.Worldstates.emplace_back(0x6f2, 0x0); // 17 1778 horde bases - packet.Worldstates.emplace_back(0x6f3, 0x0); // 18 1779 alliance bases - packet.Worldstates.emplace_back(0x6f4, 0x7d0); // 19 1780 max resources (2000) - packet.Worldstates.emplace_back(0x6f6, 0x0); // 20 1782 blacksmith color - packet.Worldstates.emplace_back(0x6f7, 0x0); // 21 1783 blacksmith (show/hide) - packet.Worldstates.emplace_back(0x6f8, 0x0); // 22 1784 unk, bs? - packet.Worldstates.emplace_back(0x6f9, 0x0); // 23 1785 unk, bs? - packet.Worldstates.emplace_back(0x6fb, 0x0); // 24 1787 gold mine (0 - horde contr, 1 - alliance contr) - packet.Worldstates.emplace_back(0x6fc, 0x0); // 25 1788 gold mine (0 - conflict, 1 - horde) - packet.Worldstates.emplace_back(0x6fd, 0x0); // 26 1789 gold mine (1 - show/0 - hide) - packet.Worldstates.emplace_back(0x6fe, 0x0); // 27 1790 gold mine color - packet.Worldstates.emplace_back(0x700, 0x0); // 28 1792 gold mine color, wtf?, may be LM? - packet.Worldstates.emplace_back(0x701, 0x0); // 29 1793 lumber mill color (0 - conflict, 1 - horde contr) - packet.Worldstates.emplace_back(0x702, 0x0); // 30 1794 lumber mill (show/hide) - packet.Worldstates.emplace_back(0x703, 0x0); // 31 1795 lumber mill color color - packet.Worldstates.emplace_back(0x732, 0x1); // 32 1842 stables (1 - uncontrolled) - packet.Worldstates.emplace_back(0x733, 0x1); // 33 1843 gold mine (1 - uncontrolled) - packet.Worldstates.emplace_back(0x734, 0x1); // 34 1844 lumber mill (1 - uncontrolled) - packet.Worldstates.emplace_back(0x735, 0x1); // 35 1845 farm (1 - uncontrolled) - packet.Worldstates.emplace_back(0x736, 0x1); // 36 1846 blacksmith (1 - uncontrolled) - packet.Worldstates.emplace_back(0x745, 0x2); // 37 1861 unk - packet.Worldstates.emplace_back(0x7a3, 0x708); // 38 1955 warning limit (1800) - } - break; - case 3820: // Eye of the Storm - if (bg && bg->GetTypeID(true) == BATTLEGROUND_EY) - bg->FillInitialWorldStates(packet); - else - { - packet.Worldstates.emplace_back(0xac1, 0x0); // 7 2753 Horde Bases - packet.Worldstates.emplace_back(0xac0, 0x0); // 8 2752 Alliance Bases - packet.Worldstates.emplace_back(0xab6, 0x0); // 9 2742 Mage Tower - Horde conflict - packet.Worldstates.emplace_back(0xab5, 0x0); // 10 2741 Mage Tower - Alliance conflict - packet.Worldstates.emplace_back(0xab4, 0x0); // 11 2740 Fel Reaver - Horde conflict - packet.Worldstates.emplace_back(0xab3, 0x0); // 12 2739 Fel Reaver - Alliance conflict - packet.Worldstates.emplace_back(0xab2, 0x0); // 13 2738 Draenei - Alliance conflict - packet.Worldstates.emplace_back(0xab1, 0x0); // 14 2737 Draenei - Horde conflict - packet.Worldstates.emplace_back(0xab0, 0x0); // 15 2736 unk // 0 at start - packet.Worldstates.emplace_back(0xaaf, 0x0); // 16 2735 unk // 0 at start - packet.Worldstates.emplace_back(0xaad, 0x0); // 17 2733 Draenei - Horde control - packet.Worldstates.emplace_back(0xaac, 0x0); // 18 2732 Draenei - Alliance control - packet.Worldstates.emplace_back(0xaab, 0x1); // 19 2731 Draenei uncontrolled (1 - yes, 0 - no) - packet.Worldstates.emplace_back(0xaaa, 0x0); // 20 2730 Mage Tower - Alliance control - packet.Worldstates.emplace_back(0xaa9, 0x0); // 21 2729 Mage Tower - Horde control - packet.Worldstates.emplace_back(0xaa8, 0x1); // 22 2728 Mage Tower uncontrolled (1 - yes, 0 - no) - packet.Worldstates.emplace_back(0xaa7, 0x0); // 23 2727 Fel Reaver - Horde control - packet.Worldstates.emplace_back(0xaa6, 0x0); // 24 2726 Fel Reaver - Alliance control - packet.Worldstates.emplace_back(0xaa5, 0x1); // 25 2725 Fel Reaver uncontrolled (1 - yes, 0 - no) - packet.Worldstates.emplace_back(0xaa4, 0x0); // 26 2724 Boold Elf - Horde control - packet.Worldstates.emplace_back(0xaa3, 0x0); // 27 2723 Boold Elf - Alliance control - packet.Worldstates.emplace_back(0xaa2, 0x1); // 28 2722 Boold Elf uncontrolled (1 - yes, 0 - no) - packet.Worldstates.emplace_back(0xac5, 0x1); // 29 2757 Flag (1 - show, 0 - hide) - doesn't work exactly this way! - packet.Worldstates.emplace_back(0xad2, 0x1); // 30 2770 Horde top-stats (1 - show, 0 - hide) // 02 -> horde picked up the flag - packet.Worldstates.emplace_back(0xad1, 0x1); // 31 2769 Alliance top-stats (1 - show, 0 - hide) // 02 -> alliance picked up the flag - packet.Worldstates.emplace_back(0xabe, 0x0); // 32 2750 Horde resources - packet.Worldstates.emplace_back(0xabd, 0x0); // 33 2749 Alliance resources - packet.Worldstates.emplace_back(0xa05, 0x8e); // 34 2565 unk, constant? - packet.Worldstates.emplace_back(0xaa0, 0x0); // 35 2720 Capturing progress-bar (100 -> empty (only grey), 0 -> blue|red (no grey), default 0) - packet.Worldstates.emplace_back(0xa9f, 0x0); // 36 2719 Capturing progress-bar (0 - left, 100 - right) - packet.Worldstates.emplace_back(0xa9e, 0x0); // 37 2718 Capturing progress-bar (1 - show, 0 - hide) - packet.Worldstates.emplace_back(0xc0d, 0x17b); // 38 3085 unk - // and some more ... unknown - } - break; // any of these needs change! the client remembers the prev setting! // ON EVERY ZONE LEAVE, RESET THE OLD ZONE'S WORLD STATE, BUT AT LEAST THE UI STUFF! case 3483: // Hellfire Peninsula @@ -9126,138 +8949,6 @@ void Player::SendInitWorldStates(uint32 zoneId, uint32 areaId) packet.Worldstates.emplace_back(0xa5f, 0x0); // 35 } break; - case 3698: // Nagrand Arena - if (bg && bg->GetTypeID(true) == BATTLEGROUND_NA) - bg->FillInitialWorldStates(packet); - else - { - packet.Worldstates.emplace_back(0xa0f, 0x0); // 7 - packet.Worldstates.emplace_back(0xa10, 0x0); // 8 - packet.Worldstates.emplace_back(0xa11, 0x0); // 9 show - } - break; - case 3702: // Blade's Edge Arena - if (bg && bg->GetTypeID(true) == BATTLEGROUND_BE) - bg->FillInitialWorldStates(packet); - else - { - packet.Worldstates.emplace_back(0x9f0, 0x0); // 7 gold - packet.Worldstates.emplace_back(0x9f1, 0x0); // 8 green - packet.Worldstates.emplace_back(0x9f3, 0x0); // 9 show - } - break; - case 3968: // Ruins of Lordaeron - if (bg && bg->GetTypeID(true) == BATTLEGROUND_RL) - bg->FillInitialWorldStates(packet); - else - { - packet.Worldstates.emplace_back(0xbb8, 0x0); // 7 gold - packet.Worldstates.emplace_back(0xbb9, 0x0); // 8 green - packet.Worldstates.emplace_back(0xbba, 0x0); // 9 show - } - break; - case 4378: // Dalaran Sewers - if (bg && bg->GetTypeID(true) == BATTLEGROUND_DS) - bg->FillInitialWorldStates(packet); - else - { - packet.Worldstates.emplace_back(3601, 0x0); // 7 gold - packet.Worldstates.emplace_back(3600, 0x0); // 8 green - packet.Worldstates.emplace_back(3610, 0x0); // 9 show - } - break; - case 4384: // Strand of the Ancients - if (bg && bg->GetTypeID(true) == BATTLEGROUND_SA) - bg->FillInitialWorldStates(packet); - else - { - // 1-3 A defend, 4-6 H defend, 7-9 unk defend, 1 - ok, 2 - half destroyed, 3 - destroyed - packet.Worldstates.emplace_back(0xf09, 0x0); // 7 3849 Gate of Temple - packet.Worldstates.emplace_back(0xe36, 0x0); // 8 3638 Gate of Yellow Moon - packet.Worldstates.emplace_back(0xe27, 0x0); // 9 3623 Gate of Green Emerald - packet.Worldstates.emplace_back(0xe24, 0x0); // 10 3620 Gate of Blue Sapphire - packet.Worldstates.emplace_back(0xe21, 0x0); // 11 3617 Gate of Red Sun - packet.Worldstates.emplace_back(0xe1e, 0x0); // 12 3614 Gate of Purple Ametyst - - packet.Worldstates.emplace_back(0xdf3, 0x0); // 13 3571 bonus timer (1 - on, 0 - off) - packet.Worldstates.emplace_back(0xded, 0x0); // 14 3565 Horde Attacker - packet.Worldstates.emplace_back(0xdec, 0x0); // 15 3564 Alliance Attacker - // End Round (timer), better explain this by example, eg. ends in 19:59 -> A:BC - packet.Worldstates.emplace_back(0xde9, 0x0); // 16 3561 C - packet.Worldstates.emplace_back(0xde8, 0x0); // 17 3560 B - packet.Worldstates.emplace_back(0xde7, 0x0); // 18 3559 A - packet.Worldstates.emplace_back(0xe35, 0x0); // 19 3637 East g - Horde control - packet.Worldstates.emplace_back(0xe34, 0x0); // 20 3636 West g - Horde control - packet.Worldstates.emplace_back(0xe33, 0x0); // 21 3635 South g - Horde control - packet.Worldstates.emplace_back(0xe32, 0x0); // 22 3634 East g - Alliance control - packet.Worldstates.emplace_back(0xe31, 0x0); // 23 3633 West g - Alliance control - packet.Worldstates.emplace_back(0xe30, 0x0); // 24 3632 South g - Alliance control - packet.Worldstates.emplace_back(0xe2f, 0x0); // 25 3631 Chamber of Ancients - Horde control - packet.Worldstates.emplace_back(0xe2e, 0x0); // 26 3630 Chamber of Ancients - Alliance control - packet.Worldstates.emplace_back(0xe2d, 0x0); // 27 3629 Beach1 - Horde control - packet.Worldstates.emplace_back(0xe2c, 0x0); // 28 3628 Beach2 - Horde control - packet.Worldstates.emplace_back(0xe2b, 0x0); // 29 3627 Beach1 - Alliance control - packet.Worldstates.emplace_back(0xe2a, 0x0); // 30 3626 Beach2 - Alliance control - // and many unks... - } - break; - case 4406: // Ring of Valor - if (bg && bg->GetTypeID(true) == BATTLEGROUND_RV) - bg->FillInitialWorldStates(packet); - else - { - packet.Worldstates.emplace_back(0xe10, 0x0); // 7 gold - packet.Worldstates.emplace_back(0xe11, 0x0); // 8 green - packet.Worldstates.emplace_back(0xe1a, 0x0); // 9 show - } - break; - case 4710: - if (bg && bg->GetTypeID(true) == BATTLEGROUND_IC) - bg->FillInitialWorldStates(packet); - else - { - packet.Worldstates.emplace_back(4221, 1); // 7 BG_IC_ALLIANCE_RENFORT_SET - packet.Worldstates.emplace_back(4222, 1); // 8 BG_IC_HORDE_RENFORT_SET - packet.Worldstates.emplace_back(4226, 300); // 9 BG_IC_ALLIANCE_RENFORT - packet.Worldstates.emplace_back(4227, 300); // 10 BG_IC_HORDE_RENFORT - packet.Worldstates.emplace_back(4322, 1); // 11 BG_IC_GATE_FRONT_H_WS_OPEN - packet.Worldstates.emplace_back(4321, 1); // 12 BG_IC_GATE_WEST_H_WS_OPEN - packet.Worldstates.emplace_back(4320, 1); // 13 BG_IC_GATE_EAST_H_WS_OPEN - packet.Worldstates.emplace_back(4323, 1); // 14 BG_IC_GATE_FRONT_A_WS_OPEN - packet.Worldstates.emplace_back(4324, 1); // 15 BG_IC_GATE_WEST_A_WS_OPEN - packet.Worldstates.emplace_back(4325, 1); // 16 BG_IC_GATE_EAST_A_WS_OPEN - packet.Worldstates.emplace_back(4317, 1); // 17 unknown - - packet.Worldstates.emplace_back(4301, 1); // 18 BG_IC_DOCKS_UNCONTROLLED - packet.Worldstates.emplace_back(4296, 1); // 19 BG_IC_HANGAR_UNCONTROLLED - packet.Worldstates.emplace_back(4306, 1); // 20 BG_IC_QUARRY_UNCONTROLLED - packet.Worldstates.emplace_back(4311, 1); // 21 BG_IC_REFINERY_UNCONTROLLED - packet.Worldstates.emplace_back(4294, 1); // 22 BG_IC_WORKSHOP_UNCONTROLLED - packet.Worldstates.emplace_back(4243, 1); // 23 unknown - packet.Worldstates.emplace_back(4345, 1); // 24 unknown - } - break; - // Twin Peaks - case 5031: - if (bg && bg->GetTypeID(true) == BATTLEGROUND_TP) - bg->FillInitialWorldStates(packet); - else - { - packet.Worldstates.emplace_back(0x62d, 0x0); // 7 1581 alliance flag captures - packet.Worldstates.emplace_back(0x62e, 0x0); // 8 1582 horde flag captures - packet.Worldstates.emplace_back(0x609, 0x0); // 9 1545 unk - packet.Worldstates.emplace_back(0x60a, 0x0); // 10 1546 unk - packet.Worldstates.emplace_back(0x60b, 0x2); // 11 1547 unk - packet.Worldstates.emplace_back(0x641, 0x3); // 12 1601 unk - packet.Worldstates.emplace_back(0x922, 0x1); // 13 2338 horde (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing) - packet.Worldstates.emplace_back(0x923, 0x1); // 14 2339 alliance (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing) - } - break; - // Battle for Gilneas - case 5449: - if (bg && bg->GetTypeID(true) == BATTLEGROUND_BFG) - bg->FillInitialWorldStates(packet); - break; default: break; } diff --git a/src/server/scripts/World/achievement_scripts.cpp b/src/server/scripts/World/achievement_scripts.cpp index fbd8306d68..1ff40cea71 100644 --- a/src/server/scripts/World/achievement_scripts.cpp +++ b/src/server/scripts/World/achievement_scripts.cpp @@ -16,119 +16,11 @@ */ #include "ScriptMgr.h" -#include "BattlegroundSA.h" -#include "BattlegroundIC.h" +#include "Battleground.h" #include "Vehicle.h" #include "Player.h" #include "Creature.h" -class achievement_resilient_victory : public AchievementCriteriaScript -{ - public: - achievement_resilient_victory() : AchievementCriteriaScript("achievement_resilient_victory") { } - - bool OnCheck(Player* source, Unit* target) override - { - if (Battleground* bg = source->GetBattleground()) - return bg->CheckAchievementCriteriaMeet(BG_CRITERIA_CHECK_RESILIENT_VICTORY, source, target); - - return false; - } -}; - -class achievement_bg_control_all_nodes : public AchievementCriteriaScript -{ - public: - achievement_bg_control_all_nodes() : AchievementCriteriaScript("achievement_bg_control_all_nodes") { } - - bool OnCheck(Player* source, Unit* /*target*/) override - { - if (Battleground* bg = source->GetBattleground()) - return bg->IsAllNodesControlledByTeam(source->GetTeam()); - - return false; - } -}; - -class achievement_save_the_day : public AchievementCriteriaScript -{ - public: - achievement_save_the_day() : AchievementCriteriaScript("achievement_save_the_day") { } - - bool OnCheck(Player* source, Unit* target) override - { - if (Battleground* bg = source->GetBattleground()) - return bg->CheckAchievementCriteriaMeet(BG_CRITERIA_CHECK_SAVE_THE_DAY, source, target); - - return false; - } -}; - -class achievement_bg_ic_resource_glut : public AchievementCriteriaScript -{ - public: - achievement_bg_ic_resource_glut() : AchievementCriteriaScript("achievement_bg_ic_resource_glut") { } - - bool OnCheck(Player* source, Unit* /*target*/) override - { - if (source->HasAura(SPELL_OIL_REFINERY) && source->HasAura(SPELL_QUARRY)) - return true; - - return false; - } -}; - -class achievement_bg_ic_glaive_grave : public AchievementCriteriaScript -{ - public: - achievement_bg_ic_glaive_grave() : AchievementCriteriaScript("achievement_bg_ic_glaive_grave") { } - - bool OnCheck(Player* source, Unit* /*target*/) override - { - if (Creature* vehicle = source->GetVehicleCreatureBase()) - { - if (vehicle->GetEntry() == NPC_GLAIVE_THROWER_H || vehicle->GetEntry() == NPC_GLAIVE_THROWER_A) - return true; - } - - return false; - } -}; - -class achievement_bg_ic_mowed_down : public AchievementCriteriaScript -{ - public: - achievement_bg_ic_mowed_down() : AchievementCriteriaScript("achievement_bg_ic_mowed_down") { } - - bool OnCheck(Player* source, Unit* /*target*/) override - { - if (Creature* vehicle = source->GetVehicleCreatureBase()) - { - if (vehicle->GetEntry() == NPC_KEEP_CANNON) - return true; - } - - return false; - } -}; - -class achievement_bg_sa_artillery : public AchievementCriteriaScript -{ - public: - achievement_bg_sa_artillery() : AchievementCriteriaScript("achievement_bg_sa_artillery") { } - - bool OnCheck(Player* source, Unit* /*target*/) override - { - if (Creature* vehicle = source->GetVehicleCreatureBase()) - { - if (vehicle->GetEntry() == NPC_ANTI_PERSONNAL_CANNON) - return true; - } - - return false; - } -}; - class achievement_arena_kills : public AchievementCriteriaScript { public: @@ -150,66 +42,6 @@ class achievement_arena_kills : public AchievementCriteriaScript uint8 const _arenaType; }; -class achievement_sickly_gazelle : public AchievementCriteriaScript -{ -public: - achievement_sickly_gazelle() : AchievementCriteriaScript("achievement_sickly_gazelle") { } - - bool OnCheck(Player* /*source*/, Unit* target) override - { - if (!target) - return false; - - if (Player* victim = target->ToPlayer()) - if (victim->IsMounted()) - return true; - - return false; - } -}; - -class achievement_everything_counts : public AchievementCriteriaScript -{ - public: - achievement_everything_counts() : AchievementCriteriaScript("achievement_everything_counts") { } - - bool OnCheck(Player* source, Unit* target) override - { - if (Battleground* bg = source->GetBattleground()) - return bg->CheckAchievementCriteriaMeet(BG_CRITERIA_CHECK_EVERYTHING_COUNTS, source, target); - - return false; - } -}; - -class achievement_bg_av_perfection : public AchievementCriteriaScript -{ - public: - achievement_bg_av_perfection() : AchievementCriteriaScript("achievement_bg_av_perfection") { } - - bool OnCheck(Player* source, Unit* target) override - { - if (Battleground* bg = source->GetBattleground()) - return bg->CheckAchievementCriteriaMeet(BG_CRITERIA_CHECK_AV_PERFECTION, source, target); - - return false; - } -}; - -class achievement_bg_sa_defense_of_ancients : public AchievementCriteriaScript -{ - public: - achievement_bg_sa_defense_of_ancients() : AchievementCriteriaScript("achievement_bg_sa_defense_of_ancients") { } - - bool OnCheck(Player* source, Unit* target) override - { - if (Battleground* bg = source->GetBattleground()) - return bg->CheckAchievementCriteriaMeet(BG_CRITERIA_CHECK_DEFENSE_OF_THE_ANCIENTS, source, target); - - return false; - } -}; - enum ArgentTournamentAreas { AREA_ARGENT_TOURNAMENT_FIELDS = 4658, @@ -241,20 +73,6 @@ class achievement_tilted : public AchievementCriteriaScript } }; -class achievement_not_even_a_scratch : public AchievementCriteriaScript -{ - public: - achievement_not_even_a_scratch() : AchievementCriteriaScript("achievement_not_even_a_scratch") { } - - bool OnCheck(Player* source, Unit* target) override - { - if (Battleground* bg = source->GetBattleground()) - return bg->CheckAchievementCriteriaMeet(BG_CRITERIA_CHECK_NOT_EVEN_A_SCRATCH, source, target); - - return false; - } -}; - enum FlirtWithDisaster { AURA_PERFUME_FOREVER = 70235, @@ -292,22 +110,10 @@ class achievement_killed_exp_or_honor_target : public AchievementCriteriaScript void AddSC_achievement_scripts() { - new achievement_resilient_victory(); - new achievement_bg_control_all_nodes(); - new achievement_save_the_day(); - new achievement_bg_ic_resource_glut(); - new achievement_bg_ic_glaive_grave(); - new achievement_bg_ic_mowed_down(); - new achievement_bg_sa_artillery(); - new achievement_sickly_gazelle(); - new achievement_everything_counts(); - new achievement_bg_av_perfection(); new achievement_arena_kills("achievement_arena_2v2_kills", ARENA_TYPE_2v2); new achievement_arena_kills("achievement_arena_3v3_kills", ARENA_TYPE_3v3); new achievement_arena_kills("achievement_arena_5v5_kills", ARENA_TYPE_5v5); - new achievement_bg_sa_defense_of_ancients(); new achievement_tilted(); - new achievement_not_even_a_scratch(); new achievement_flirt_with_disaster_perf_check(); new achievement_killed_exp_or_honor_target(); }