Big update.

This commit is contained in:
UltraNix
2022-03-12 22:28:00 +01:00
parent 6006eeeb01
commit 12d41d1314
2064 changed files with 427245 additions and 268481 deletions

View File

@@ -18,6 +18,7 @@
#include "BattlegroundSA.h"
#include "GameGraveyard.h"
#include "GameObject.h"
#include "GameTime.h"
#include "Language.h"
#include "ObjectMgr.h"
#include "Player.h"
@@ -28,12 +29,16 @@ constexpr Milliseconds BG_SA_BOAT_START = 1min;
constexpr Milliseconds BG_SA_WARMUPLENGTH = 2min;
constexpr Milliseconds BG_SA_ROUNDLENGTH = 10min;
void BattlegroundSAScore::BuildObjectivesBlock(WorldPacket& data)
{
data << uint32(2); // Objectives Count
data << uint32(DemolishersDestroyed);
data << uint32(GatesDestroyed);
}
BattlegroundSA::BattlegroundSA()
{
StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_SA_START_TWO_MINUTES;
StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_SA_START_ONE_MINUTE;
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_SA_START_HALF_MINUTE;
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_SA_HAS_BEGUN;
StartMessageIds[BG_STARTING_EVENT_FOURTH] = 0;
BgObjects.resize(BG_SA_MAXOBJ);
BgCreatures.resize(static_cast<uint16>(BG_SA_MAXNPC) + BG_SA_MAX_GY);
TimerEnabled = false;
@@ -184,7 +189,7 @@ bool BattlegroundSA::ResetObjs()
if (!sg)
{
LOG_ERROR("bg.battleground", "SOTA: Can't find GY entry %u", BG_SA_GYEntries[i]);
LOG_ERROR("bg.battleground", "SOTA: Can't find GY entry {}", BG_SA_GYEntries[i]);
return false;
}
@@ -197,7 +202,7 @@ bool BattlegroundSA::ResetObjs()
{
GraveyardStatus[i] = GetOtherTeamId(Attackers);
if (!AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], GetOtherTeamId(Attackers)))
LOG_ERROR("bg.battleground", "SOTA: couldn't spawn GY: %u", i);
LOG_ERROR("bg.battleground", "SOTA: couldn't spawn GY: {}", i);
}
}
@@ -317,7 +322,7 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff)
{
SignaledRoundTwo = true;
InitSecondRound = false;
SendMessageToAll(LANG_BG_SA_ROUND_TWO_ONE_MINUTE, CHAT_MSG_BG_SYSTEM_NEUTRAL);
SendBroadcastText(BG_SA_TEXT_ROUND_TWO_START_ONE_MINUTE, CHAT_MSG_BG_SYSTEM_NEUTRAL);
}
}
else
@@ -369,7 +374,7 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff)
if (!SignaledRoundTwoHalfMin)
{
SignaledRoundTwoHalfMin = true;
SendMessageToAll(LANG_BG_SA_ROUND_TWO_START_HALF_MINUTE, CHAT_MSG_BG_SYSTEM_NEUTRAL);
SendBroadcastText(BG_SA_TEXT_ROUND_TWO_START_HALF_MINUTE, CHAT_MSG_BG_SYSTEM_NEUTRAL);
}
}
StartShips();
@@ -495,11 +500,9 @@ void BattlegroundSA::FillInitialWorldStates(WorldPacket& data)
void BattlegroundSA::AddPlayer(Player* player)
{
Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor
BattlegroundSAScore* sc = new BattlegroundSAScore(player);
PlayerScores.emplace(player->GetGUID().GetCounter(), new BattlegroundSAScore(player->GetGUID()));
SendTransportInit(player);
PlayerScores[player->GetGUID()] = sc;
TeleportToEntrancePosition(player);
}
@@ -514,20 +517,6 @@ void BattlegroundSA::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/)
return;
}
void BattlegroundSA::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
{
BattlegroundScoreMap::iterator itr = PlayerScores.find(player->GetGUID());
if (itr == PlayerScores.end())
return;
if (type == SCORE_DESTROYED_DEMOLISHER)
((BattlegroundSAScore*)itr->second)->demolishers_destroyed += value;
else if (type == SCORE_DESTROYED_WALL)
((BattlegroundSAScore*)itr->second)->gates_destroyed += value;
else
Battleground::UpdatePlayerScore(player, type, value, doAddHonor);
}
void BattlegroundSA::TeleportPlayers()
{
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
@@ -807,7 +796,7 @@ GraveyardStruct const* BattlegroundSA::GetClosestGraveyard(Player* player)
continue;
}
float dist = sqrt(pow(ret->x - x, 2) * pow(ret->y - y, 2));
float dist = std::sqrt(pow(ret->x - x, 2) * pow(ret->y - y, 2));
if (dist < mindist)
{
mindist = dist;
@@ -934,7 +923,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
GraveyardStruct const* sg = sGraveyard->GetGraveyard(BG_SA_GYEntries[i]);
if (!sg)
{
LOG_ERROR("bg.battleground", "BattlegroundSA::CaptureGraveyard: non-existant GY entry: %u", BG_SA_GYEntries[i]);
LOG_ERROR("bg.battleground", "BattlegroundSA::CaptureGraveyard: non-existant GY entry: {}", BG_SA_GYEntries[i]);
return;
}
@@ -1087,11 +1076,11 @@ void BattlegroundSA::UpdateDemolisherSpawns()
// Demolisher is not in list
if (DemoliserRespawnList.find(i) == DemoliserRespawnList.end())
{
DemoliserRespawnList[i] = World::GetGameTimeMS() + 30000;
DemoliserRespawnList[i] = GameTime::GetGameTimeMS().count() + 30000;
}
else
{
if (DemoliserRespawnList[i] < World::GetGameTimeMS())
if (DemoliserRespawnList[i] < GameTime::GetGameTimeMS().count())
{
Demolisher->Relocate(BG_SA_NpcSpawnlocs[i][0], BG_SA_NpcSpawnlocs[i][1],
BG_SA_NpcSpawnlocs[i][2], BG_SA_NpcSpawnlocs[i][3]);