mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-03-15 13:35:08 +00:00
Big update.
This commit is contained in:
328
src/server/game/Battlegrounds/Arena.cpp
Normal file
328
src/server/game/Battlegrounds/Arena.cpp
Normal file
@@ -0,0 +1,328 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Arena.h"
|
||||
#include "ArenaTeamMgr.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Player.h"
|
||||
#include "World.h"
|
||||
#include "WorldSession.h"
|
||||
#include "Pet.h"
|
||||
#include "ScriptMgr.h"
|
||||
//#include "WorldStatePackets.h"
|
||||
|
||||
void ArenaScore::AppendToPacket(WorldPacket& data)
|
||||
{
|
||||
data << PlayerGuid;
|
||||
|
||||
data << uint32(KillingBlows);
|
||||
data << uint8(PvPTeamId);
|
||||
data << uint32(DamageDone);
|
||||
data << uint32(HealingDone);
|
||||
|
||||
BuildObjectivesBlock(data);
|
||||
}
|
||||
|
||||
void ArenaScore::BuildObjectivesBlock(WorldPacket& data)
|
||||
{
|
||||
data << uint32(0); // Objectives Count
|
||||
}
|
||||
|
||||
void ArenaTeamScore::BuildRatingInfoBlock(WorldPacket& data)
|
||||
{
|
||||
uint32 ratingLost = std::abs(std::min(RatingChange, 0));
|
||||
uint32 ratingWon = std::max(RatingChange, 0);
|
||||
|
||||
// should be old rating, new rating, and client will calculate rating change itself
|
||||
data << uint32(ratingLost);
|
||||
data << uint32(ratingWon);
|
||||
data << uint32(MatchmakerRating);
|
||||
}
|
||||
|
||||
void ArenaTeamScore::BuildTeamInfoBlock(WorldPacket& data)
|
||||
{
|
||||
data << TeamName;
|
||||
}
|
||||
|
||||
Arena::Arena()
|
||||
{
|
||||
StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M;
|
||||
StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
|
||||
StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
|
||||
StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
|
||||
|
||||
StartMessageIds[BG_STARTING_EVENT_FIRST] = ARENA_TEXT_START_ONE_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_SECOND] = ARENA_TEXT_START_THIRTY_SECONDS;
|
||||
StartMessageIds[BG_STARTING_EVENT_THIRD] = ARENA_TEXT_START_FIFTEEN_SECONDS;
|
||||
StartMessageIds[BG_STARTING_EVENT_FOURTH] = ARENA_TEXT_START_BATTLE_HAS_BEGUN;
|
||||
}
|
||||
|
||||
void Arena::AddPlayer(Player* player)
|
||||
{
|
||||
Battleground::AddPlayer(player);
|
||||
PlayerScores.emplace(player->GetGUID().GetCounter(), new ArenaScore(player->GetGUID(), player->GetBgTeamId()));
|
||||
|
||||
if (player->GetBgTeamId() == TEAM_ALLIANCE) // gold
|
||||
{
|
||||
if (player->GetTeamId() == TEAM_HORDE)
|
||||
player->CastSpell(player, SPELL_HORDE_GOLD_FLAG, true);
|
||||
else
|
||||
player->CastSpell(player, SPELL_ALLIANCE_GOLD_FLAG, true);
|
||||
}
|
||||
else // green
|
||||
{
|
||||
if (player->GetTeamId() == TEAM_HORDE)
|
||||
player->CastSpell(player, SPELL_HORDE_GREEN_FLAG, true);
|
||||
else
|
||||
player->CastSpell(player, SPELL_ALLIANCE_GREEN_FLAG, true);
|
||||
}
|
||||
|
||||
UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void Arena::RemovePlayer(Player* /*player*/)
|
||||
{
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
UpdateArenaWorldState();
|
||||
CheckWinConditions();
|
||||
}
|
||||
|
||||
void Arena::FillInitialWorldStates(WorldPacket& data)
|
||||
{
|
||||
data << uint32(ARENA_WORLD_STATE_ALIVE_PLAYERS_GREEN) << uint32(GetAlivePlayersCountByTeam(TEAM_HORDE));
|
||||
data << uint32(ARENA_WORLD_STATE_ALIVE_PLAYERS_GOLD) << uint32(GetAlivePlayersCountByTeam(TEAM_ALLIANCE));
|
||||
}
|
||||
|
||||
void Arena::UpdateArenaWorldState()
|
||||
{
|
||||
UpdateWorldState(ARENA_WORLD_STATE_ALIVE_PLAYERS_GREEN, GetAlivePlayersCountByTeam(TEAM_HORDE));
|
||||
UpdateWorldState(ARENA_WORLD_STATE_ALIVE_PLAYERS_GOLD, GetAlivePlayersCountByTeam(TEAM_ALLIANCE));
|
||||
}
|
||||
|
||||
void Arena::HandleKillPlayer(Player* player, Player* killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
Battleground::HandleKillPlayer(player, killer);
|
||||
|
||||
UpdateArenaWorldState();
|
||||
CheckWinConditions();
|
||||
}
|
||||
|
||||
void Arena::RemovePlayerAtLeave(Player* player)
|
||||
{
|
||||
if (isRated() && GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
if (auto const& member = Acore::Containers::MapGetValuePtr(m_Players, player->GetGUID()))
|
||||
{
|
||||
// if the player was a match participant, calculate rating
|
||||
auto teamId = member->GetBgTeamId();
|
||||
|
||||
ArenaTeam* winnerArenaTeam = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeamId(teamId)));
|
||||
ArenaTeam* loserArenaTeam = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(teamId));
|
||||
|
||||
if (winnerArenaTeam && loserArenaTeam && winnerArenaTeam != loserArenaTeam)
|
||||
loserArenaTeam->MemberLost(player, GetArenaMatchmakerRating(GetOtherTeamId(teamId)));
|
||||
}
|
||||
}
|
||||
|
||||
// remove player
|
||||
Battleground::RemovePlayerAtLeave(player);
|
||||
}
|
||||
|
||||
void Arena::CheckWinConditions()
|
||||
{
|
||||
if (!GetAlivePlayersCountByTeam(TEAM_ALLIANCE) && GetPlayersCountByTeam(TEAM_HORDE))
|
||||
EndBattleground(TEAM_HORDE);
|
||||
else if (GetPlayersCountByTeam(TEAM_ALLIANCE) && !GetAlivePlayersCountByTeam(TEAM_HORDE))
|
||||
EndBattleground(TEAM_ALLIANCE);
|
||||
}
|
||||
|
||||
void Arena::EndBattleground(TeamId winnerTeamId)
|
||||
{
|
||||
if (isRated())
|
||||
{
|
||||
uint32 startDelay = GetStartDelayTime();
|
||||
bool bValidArena = GetStatus() == STATUS_IN_PROGRESS && GetStartTime() >= startDelay + 15000; // pussywizard: only if arena lasted at least 15 secs
|
||||
|
||||
uint32 loserTeamRating = 0;
|
||||
uint32 loserMatchmakerRating = 0;
|
||||
int32 loserChange = 0;
|
||||
int32 loserMatchmakerChange = 0;
|
||||
uint32 winnerTeamRating = 0;
|
||||
uint32 winnerMatchmakerRating = 0;
|
||||
int32 winnerChange = 0;
|
||||
int32 winnerMatchmakerChange = 0;
|
||||
|
||||
ArenaTeam* winnerArenaTeam = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(winnerTeamId == TEAM_NEUTRAL ? TEAM_HORDE : winnerTeamId));
|
||||
ArenaTeam* loserArenaTeam = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(winnerTeamId == TEAM_NEUTRAL ? TEAM_ALLIANCE : GetOtherTeamId(winnerTeamId)));
|
||||
|
||||
auto SaveArenaLogs = [&]()
|
||||
{
|
||||
// pussywizard: arena logs in database
|
||||
uint32 fightId = sArenaTeamMgr->GetNextArenaLogId();
|
||||
uint32 currOnline = sWorld->GetActiveSessionCount();
|
||||
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
CharacterDatabasePreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_FIGHT);
|
||||
stmt2->SetData(0, fightId);
|
||||
stmt2->SetData(1, GetArenaType());
|
||||
stmt2->SetData(2, ((GetStartTime() <= startDelay ? 0 : GetStartTime() - startDelay) / 1000));
|
||||
stmt2->SetData(3, winnerArenaTeam->GetId());
|
||||
stmt2->SetData(4, loserArenaTeam->GetId());
|
||||
stmt2->SetData(5, (uint16)winnerTeamRating);
|
||||
stmt2->SetData(6, (uint16)winnerMatchmakerRating);
|
||||
stmt2->SetData(7, (int16)winnerChange);
|
||||
stmt2->SetData(8, (uint16)loserTeamRating);
|
||||
stmt2->SetData(9, (uint16)loserMatchmakerRating);
|
||||
stmt2->SetData(10, (int16)loserChange);
|
||||
stmt2->SetData(11, currOnline);
|
||||
trans->Append(stmt2);
|
||||
|
||||
uint8 memberId = 0;
|
||||
for (auto const& [playerGuid, arenaLogEntryData] : ArenaLogEntries)
|
||||
{
|
||||
stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_MEMBERSTATS);
|
||||
stmt2->SetData(0, fightId);
|
||||
stmt2->SetData(1, ++memberId);
|
||||
stmt2->SetData(2, arenaLogEntryData.Name);
|
||||
stmt2->SetData(3, arenaLogEntryData.Guid);
|
||||
stmt2->SetData(4, arenaLogEntryData.ArenaTeamId);
|
||||
stmt2->SetData(5, arenaLogEntryData.Acc);
|
||||
stmt2->SetData(6, arenaLogEntryData.IP);
|
||||
stmt2->SetData(7, arenaLogEntryData.DamageDone);
|
||||
stmt2->SetData(8, arenaLogEntryData.HealingDone);
|
||||
stmt2->SetData(9, arenaLogEntryData.KillingBlows);
|
||||
trans->Append(stmt2);
|
||||
}
|
||||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
};
|
||||
|
||||
if (winnerArenaTeam && loserArenaTeam && winnerArenaTeam != loserArenaTeam)
|
||||
{
|
||||
loserTeamRating = loserArenaTeam->GetRating();
|
||||
loserMatchmakerRating = GetArenaMatchmakerRating(GetOtherTeamId(winnerTeamId));
|
||||
winnerTeamRating = winnerArenaTeam->GetRating();
|
||||
winnerMatchmakerRating = GetArenaMatchmakerRating(winnerTeamId);
|
||||
|
||||
if (winnerTeamId != TEAM_NEUTRAL)
|
||||
{
|
||||
winnerMatchmakerChange = bValidArena ? winnerArenaTeam->WonAgainst(winnerMatchmakerRating, loserMatchmakerRating, winnerChange, GetBgMap()) : 0;
|
||||
loserMatchmakerChange = loserArenaTeam->LostAgainst(loserMatchmakerRating, winnerMatchmakerRating, loserChange, GetBgMap());
|
||||
|
||||
sScriptMgr->OnAfterArenaRatingCalculation(this, winnerMatchmakerChange, loserMatchmakerChange, winnerChange, loserChange);
|
||||
|
||||
LOG_DEBUG("bg.arena", "match Type: {} --- Winner: old rating: {}, rating gain: {}, old MMR: {}, MMR gain: {} --- Loser: old rating: {}, rating loss: {}, old MMR: {}, MMR loss: {} ---",
|
||||
GetArenaType(), winnerTeamRating, winnerChange, winnerMatchmakerRating, winnerMatchmakerChange,
|
||||
loserTeamRating, loserChange, loserMatchmakerRating, loserMatchmakerChange);
|
||||
|
||||
SetArenaMatchmakerRating(winnerTeamId, winnerMatchmakerRating + winnerMatchmakerChange);
|
||||
SetArenaMatchmakerRating(GetOtherTeamId(winnerTeamId), loserMatchmakerRating + loserMatchmakerChange);
|
||||
|
||||
// bg team that the client expects is different to TeamId
|
||||
// alliance 1, horde 0
|
||||
uint8 winnerTeam = winnerTeamId == TEAM_ALLIANCE ? PVP_TEAM_ALLIANCE : PVP_TEAM_HORDE;
|
||||
uint8 loserTeam = winnerTeamId == TEAM_ALLIANCE ? PVP_TEAM_HORDE : PVP_TEAM_ALLIANCE;
|
||||
|
||||
_arenaTeamScores[winnerTeam].Assign(winnerChange, winnerMatchmakerRating, winnerArenaTeam->GetName());
|
||||
_arenaTeamScores[loserTeam].Assign(loserChange, loserMatchmakerRating, loserArenaTeam->GetName());
|
||||
|
||||
LOG_DEBUG("bg.arena", "Arena match Type: {} for Team1Id: {} - Team2Id: {} ended. WinnerTeamId: {}. Winner rating: +{}, Loser rating: {}",
|
||||
GetArenaType(), GetArenaTeamIdForTeam(TEAM_ALLIANCE), GetArenaTeamIdForTeam(TEAM_HORDE), winnerArenaTeam->GetId(), winnerChange, loserChange);
|
||||
}
|
||||
else // Deduct 16 points from each teams arena-rating if there are no winners after 45+2 minutes
|
||||
{
|
||||
// pussywizard: in case of a draw, the following is always true:
|
||||
// winnerArenaTeam => TEAM_HORDE, loserArenaTeam => TEAM_ALLIANCE
|
||||
|
||||
winnerTeamRating = winnerArenaTeam->GetRating();
|
||||
winnerMatchmakerRating = GetArenaMatchmakerRating(TEAM_HORDE);
|
||||
loserTeamRating = loserArenaTeam->GetRating();
|
||||
loserMatchmakerRating = GetArenaMatchmakerRating(TEAM_ALLIANCE);
|
||||
winnerMatchmakerChange = 0;
|
||||
loserMatchmakerChange = 0;
|
||||
winnerChange = ARENA_TIMELIMIT_POINTS_LOSS;
|
||||
loserChange = ARENA_TIMELIMIT_POINTS_LOSS;
|
||||
|
||||
_arenaTeamScores[PVP_TEAM_ALLIANCE].Assign(ARENA_TIMELIMIT_POINTS_LOSS, winnerMatchmakerRating, winnerArenaTeam->GetName());
|
||||
_arenaTeamScores[PVP_TEAM_HORDE].Assign(ARENA_TIMELIMIT_POINTS_LOSS, loserMatchmakerRating, loserArenaTeam->GetName());
|
||||
|
||||
winnerArenaTeam->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS, GetBgMap());
|
||||
loserArenaTeam->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS, GetBgMap());
|
||||
}
|
||||
}
|
||||
|
||||
SaveArenaLogs();
|
||||
|
||||
uint8 aliveWinners = GetAlivePlayersCountByTeam(winnerTeamId);
|
||||
|
||||
for (auto const& [playerGuid, player] : GetPlayers())
|
||||
{
|
||||
auto const& bgTeamId = player->GetBgTeamId();
|
||||
|
||||
// per player calculation
|
||||
if (winnerArenaTeam && loserArenaTeam && winnerArenaTeam != loserArenaTeam)
|
||||
{
|
||||
if (bgTeamId == winnerTeamId)
|
||||
{
|
||||
if (bValidArena)
|
||||
{
|
||||
// update achievement BEFORE personal rating update
|
||||
uint32 rating = player->GetArenaPersonalRating(winnerArenaTeam->GetSlot());
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, rating ? rating : 1);
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA, GetMapId());
|
||||
|
||||
// Last standing - Rated 5v5 arena & be solely alive player
|
||||
if (GetArenaType() == ARENA_TYPE_5v5 && aliveWinners == 1 && player->IsAlive())
|
||||
{
|
||||
player->CastSpell(player, SPELL_LAST_MAN_STANDING, true);
|
||||
}
|
||||
|
||||
winnerArenaTeam->MemberWon(player, loserMatchmakerRating, winnerMatchmakerChange);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
loserArenaTeam->MemberLost(player, winnerMatchmakerRating, loserMatchmakerChange);
|
||||
|
||||
// Arena lost => reset the win_rated_arena having the "no_lose" condition
|
||||
player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_CONDITION_NO_LOSE, 0);
|
||||
}
|
||||
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_PLAY_ARENA, GetMapId());
|
||||
}
|
||||
}
|
||||
|
||||
// save the stat changes
|
||||
if (bValidArena)
|
||||
{
|
||||
winnerArenaTeam->SaveToDB();
|
||||
winnerArenaTeam->NotifyStatsChanged();
|
||||
}
|
||||
|
||||
loserArenaTeam->SaveToDB();
|
||||
loserArenaTeam->NotifyStatsChanged();
|
||||
}
|
||||
|
||||
// end battleground
|
||||
Battleground::EndBattleground(winnerTeamId);
|
||||
}
|
||||
66
src/server/game/Battlegrounds/Arena.h
Normal file
66
src/server/game/Battlegrounds/Arena.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _ARENA_H
|
||||
#define _ARENA_H
|
||||
|
||||
#include "Battleground.h"
|
||||
|
||||
enum ArenaBroadcastTexts
|
||||
{
|
||||
ARENA_TEXT_START_ONE_MINUTE = 15740,
|
||||
ARENA_TEXT_START_THIRTY_SECONDS = 15741,
|
||||
ARENA_TEXT_START_FIFTEEN_SECONDS = 15739,
|
||||
ARENA_TEXT_START_BATTLE_HAS_BEGUN = 15742,
|
||||
};
|
||||
|
||||
enum ArenaSpellIds
|
||||
{
|
||||
SPELL_ALLIANCE_GOLD_FLAG = 32724,
|
||||
SPELL_ALLIANCE_GREEN_FLAG = 32725,
|
||||
SPELL_HORDE_GOLD_FLAG = 35774,
|
||||
SPELL_HORDE_GREEN_FLAG = 35775,
|
||||
|
||||
SPELL_LAST_MAN_STANDING = 26549 // Achievement Credit
|
||||
};
|
||||
|
||||
enum ArenaWorldStates
|
||||
{
|
||||
ARENA_WORLD_STATE_ALIVE_PLAYERS_GREEN = 3600,
|
||||
ARENA_WORLD_STATE_ALIVE_PLAYERS_GOLD = 3601
|
||||
};
|
||||
|
||||
class AC_GAME_API Arena : public Battleground
|
||||
{
|
||||
protected:
|
||||
Arena();
|
||||
|
||||
void AddPlayer(Player* player) override;
|
||||
void RemovePlayer(Player* /*player*/) override;
|
||||
|
||||
void FillInitialWorldStates(WorldPacket& data) override;
|
||||
void UpdateArenaWorldState();
|
||||
|
||||
void HandleKillPlayer(Player* player, Player* killer) override;
|
||||
|
||||
private:
|
||||
void RemovePlayerAtLeave(Player* player) override;
|
||||
void CheckWinConditions() override;
|
||||
void EndBattleground(TeamId winnerTeamId) override;
|
||||
};
|
||||
|
||||
#endif // WARHEAD_ARENA_H
|
||||
75
src/server/game/Battlegrounds/ArenaScore.h
Normal file
75
src/server/game/Battlegrounds/ArenaScore.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _ARENA_SCORE_H
|
||||
#define _ARENA_SCORE_H
|
||||
|
||||
#include "BattlegroundScore.h"
|
||||
#include "StringFormat.h"
|
||||
|
||||
struct AC_GAME_API ArenaScore : public BattlegroundScore
|
||||
{
|
||||
friend class Arena;
|
||||
|
||||
protected:
|
||||
ArenaScore(ObjectGuid playerGuid, TeamId team) :
|
||||
BattlegroundScore(playerGuid), PvPTeamId(team == TEAM_ALLIANCE ? PVP_TEAM_ALLIANCE : PVP_TEAM_HORDE) { }
|
||||
|
||||
void AppendToPacket(WorldPacket& data) final;
|
||||
void BuildObjectivesBlock(WorldPacket& data) final;
|
||||
|
||||
// For Logging purpose
|
||||
std::string ToString() const override
|
||||
{
|
||||
return Acore::StringFormatFmt("Damage done: {}, Healing done: {}, Killing blows: {}", DamageDone, HealingDone, KillingBlows);
|
||||
}
|
||||
|
||||
uint8 PvPTeamId;
|
||||
};
|
||||
|
||||
struct AC_GAME_API ArenaTeamScore
|
||||
{
|
||||
friend class Arena;
|
||||
friend class Battleground;
|
||||
|
||||
protected:
|
||||
ArenaTeamScore() = default;
|
||||
virtual ~ArenaTeamScore() = default;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
RatingChange = 0;
|
||||
MatchmakerRating = 0;
|
||||
TeamName = {};
|
||||
}
|
||||
|
||||
void Assign(int32 ratingChange, uint32 matchMakerRating, std::string_view teamName)
|
||||
{
|
||||
RatingChange = ratingChange;
|
||||
MatchmakerRating = matchMakerRating;
|
||||
TeamName = teamName;
|
||||
}
|
||||
|
||||
void BuildRatingInfoBlock(WorldPacket& data);
|
||||
void BuildTeamInfoBlock(WorldPacket& data);
|
||||
|
||||
int32 RatingChange = 0;
|
||||
uint32 MatchmakerRating = 0;
|
||||
std::string TeamName{};
|
||||
};
|
||||
|
||||
#endif // WARHEAD_ARENA_SCORE_H
|
||||
@@ -69,16 +69,16 @@ bool ArenaTeam::Create(ObjectGuid captainGuid, uint8 type, std::string const& te
|
||||
|
||||
// Save arena team to db
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_TEAM);
|
||||
stmt->setUInt32(0, TeamId);
|
||||
stmt->setString(1, TeamName);
|
||||
stmt->setUInt32(2, captainGuid.GetCounter());
|
||||
stmt->setUInt8(3, Type);
|
||||
stmt->setUInt16(4, Stats.Rating);
|
||||
stmt->setUInt32(5, BackgroundColor);
|
||||
stmt->setUInt8(6, EmblemStyle);
|
||||
stmt->setUInt32(7, EmblemColor);
|
||||
stmt->setUInt8(8, BorderStyle);
|
||||
stmt->setUInt32(9, BorderColor);
|
||||
stmt->SetData(0, TeamId);
|
||||
stmt->SetData(1, TeamName);
|
||||
stmt->SetData(2, captainGuid.GetCounter());
|
||||
stmt->SetData(3, Type);
|
||||
stmt->SetData(4, Stats.Rating);
|
||||
stmt->SetData(5, BackgroundColor);
|
||||
stmt->SetData(6, EmblemStyle);
|
||||
stmt->SetData(7, EmblemColor);
|
||||
stmt->SetData(8, BorderStyle);
|
||||
stmt->SetData(9, BorderColor);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
// Add captain as member
|
||||
@@ -120,7 +120,7 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
|
||||
// Check if player is already in a similar arena team
|
||||
if ((player && player->GetArenaTeamId(GetSlot())) || sCharacterCache->GetCharacterArenaTeamIdByGuid(playerGuid, GetSlot()) != 0)
|
||||
{
|
||||
LOG_ERROR("bg.arena", "Arena: Player %s (%s) already has an arena team of type %u", playerName.c_str(), playerGuid.ToString().c_str(), GetType());
|
||||
LOG_ERROR("bg.arena", "Arena: Player {} ({}) already has an arena team of type {}", playerName, playerGuid.ToString(), GetType());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -135,16 +135,16 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
|
||||
// xinef: sync query
|
||||
// Try to get player's match maker rating from db and fall back to config setting if not found
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MATCH_MAKER_RATING);
|
||||
stmt->setUInt32(0, playerGuid.GetCounter());
|
||||
stmt->setUInt8(1, GetSlot());
|
||||
stmt->SetData(0, playerGuid.GetCounter());
|
||||
stmt->SetData(1, GetSlot());
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
|
||||
uint16 matchMakerRating;
|
||||
uint16 maxMMR;
|
||||
if (result)
|
||||
{
|
||||
matchMakerRating = (*result)[0].GetUInt16();
|
||||
uint16 Max = (*result)[1].GetUInt16();
|
||||
matchMakerRating = (*result)[0].Get<uint16>();
|
||||
uint16 Max = (*result)[1].Get<uint16>();
|
||||
maxMMR = std::max(Max, matchMakerRating);
|
||||
}
|
||||
else
|
||||
@@ -175,8 +175,8 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
|
||||
|
||||
// Save player's arena team membership to db
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_TEAM_MEMBER);
|
||||
stmt->setUInt32(0, TeamId);
|
||||
stmt->setUInt32(1, playerGuid.GetCounter());
|
||||
stmt->SetData(0, TeamId);
|
||||
stmt->SetData(1, playerGuid.GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
// Inform player if online
|
||||
@@ -200,21 +200,21 @@ bool ArenaTeam::LoadArenaTeamFromDB(QueryResult result)
|
||||
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
TeamId = fields[0].GetUInt32();
|
||||
TeamName = fields[1].GetString();
|
||||
CaptainGuid = ObjectGuid::Create<HighGuid::Player>(fields[2].GetUInt32());
|
||||
Type = fields[3].GetUInt8();
|
||||
BackgroundColor = fields[4].GetUInt32();
|
||||
EmblemStyle = fields[5].GetUInt8();
|
||||
EmblemColor = fields[6].GetUInt32();
|
||||
BorderStyle = fields[7].GetUInt8();
|
||||
BorderColor = fields[8].GetUInt32();
|
||||
Stats.Rating = fields[9].GetUInt16();
|
||||
Stats.WeekGames = fields[10].GetUInt16();
|
||||
Stats.WeekWins = fields[11].GetUInt16();
|
||||
Stats.SeasonGames = fields[12].GetUInt16();
|
||||
Stats.SeasonWins = fields[13].GetUInt16();
|
||||
Stats.Rank = fields[14].GetUInt32();
|
||||
TeamId = fields[0].Get<uint32>();
|
||||
TeamName = fields[1].Get<std::string>();
|
||||
CaptainGuid = ObjectGuid::Create<HighGuid::Player>(fields[2].Get<uint32>());
|
||||
Type = fields[3].Get<uint8>();
|
||||
BackgroundColor = fields[4].Get<uint32>();
|
||||
EmblemStyle = fields[5].Get<uint8>();
|
||||
EmblemColor = fields[6].Get<uint32>();
|
||||
BorderStyle = fields[7].Get<uint8>();
|
||||
BorderColor = fields[8].Get<uint32>();
|
||||
Stats.Rating = fields[9].Get<uint16>();
|
||||
Stats.WeekGames = fields[10].Get<uint16>();
|
||||
Stats.WeekWins = fields[11].Get<uint16>();
|
||||
Stats.SeasonGames = fields[12].Get<uint16>();
|
||||
Stats.SeasonWins = fields[13].Get<uint16>();
|
||||
Stats.Rank = fields[14].Get<uint32>();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -234,28 +234,28 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
|
||||
if (!fields)
|
||||
break;
|
||||
|
||||
uint32 arenaTeamId = fields[0].GetUInt32();
|
||||
uint32 arenaTeamId = fields[0].Get<uint32>();
|
||||
|
||||
// We loaded all members for this arena_team already, break cycle
|
||||
if (arenaTeamId > TeamId)
|
||||
break;
|
||||
|
||||
ArenaTeamMember newMember;
|
||||
newMember.Guid = ObjectGuid::Create<HighGuid::Player>(fields[1].GetUInt32());
|
||||
newMember.WeekGames = fields[2].GetUInt16();
|
||||
newMember.WeekWins = fields[3].GetUInt16();
|
||||
newMember.SeasonGames = fields[4].GetUInt16();
|
||||
newMember.SeasonWins = fields[5].GetUInt16();
|
||||
//newMember.Name = fields[6].GetString();
|
||||
newMember.Class = fields[7].GetUInt8();
|
||||
newMember.PersonalRating = fields[8].GetUInt16();
|
||||
newMember.MatchMakerRating = fields[9].GetUInt16() > 0 ? fields[9].GetUInt16() : sWorld->getIntConfig(CONFIG_ARENA_START_MATCHMAKER_RATING);
|
||||
newMember.MaxMMR = std::max(fields[10].GetUInt16(), newMember.MatchMakerRating);
|
||||
newMember.Guid = ObjectGuid::Create<HighGuid::Player>(fields[1].Get<uint32>());
|
||||
newMember.WeekGames = fields[2].Get<uint16>();
|
||||
newMember.WeekWins = fields[3].Get<uint16>();
|
||||
newMember.SeasonGames = fields[4].Get<uint16>();
|
||||
newMember.SeasonWins = fields[5].Get<uint16>();
|
||||
//newMember.Name = fields[6].Get<std::string>();
|
||||
newMember.Class = fields[7].Get<uint8>();
|
||||
newMember.PersonalRating = fields[8].Get<uint16>();
|
||||
newMember.MatchMakerRating = fields[9].Get<uint16>() > 0 ? fields[9].Get<uint16>() : sWorld->getIntConfig(CONFIG_ARENA_START_MATCHMAKER_RATING);
|
||||
newMember.MaxMMR = std::max(fields[10].Get<uint16>(), newMember.MatchMakerRating);
|
||||
|
||||
// Delete member if character information is missing
|
||||
if (fields[6].GetString().empty())
|
||||
if (fields[6].Get<std::string>().empty())
|
||||
{
|
||||
LOG_ERROR("sql.sql", "ArenaTeam %u has member with empty name - probably player %s doesn't exist, deleting him from memberlist!", arenaTeamId, newMember.Guid.ToString().c_str());
|
||||
LOG_ERROR("sql.sql", "ArenaTeam {} has member with empty name - probably player {} doesn't exist, deleting him from memberlist!", arenaTeamId, newMember.Guid.ToString());
|
||||
this->DelMember(newMember.Guid, true);
|
||||
continue;
|
||||
}
|
||||
@@ -272,7 +272,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
|
||||
if (Empty() || !captainPresentInTeam)
|
||||
{
|
||||
// Arena team is empty or captain is not in team, delete from db
|
||||
LOG_DEBUG("bg.battleground", "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId);
|
||||
LOG_DEBUG("bg.battleground", "ArenaTeam {} does not have any members or its captain is not in team, disbanding it...", TeamId);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -286,8 +286,8 @@ bool ArenaTeam::SetName(std::string const& name)
|
||||
|
||||
TeamName = name;
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ARENA_TEAM_NAME);
|
||||
stmt->setString(0, TeamName);
|
||||
stmt->setUInt32(1, GetId());
|
||||
stmt->SetData(0, TeamName);
|
||||
stmt->SetData(1, GetId());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
return true;
|
||||
}
|
||||
@@ -304,8 +304,8 @@ void ArenaTeam::SetCaptain(ObjectGuid guid)
|
||||
|
||||
// Update database
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ARENA_TEAM_CAPTAIN);
|
||||
stmt->setUInt32(0, guid.GetCounter());
|
||||
stmt->setUInt32(1, GetId());
|
||||
stmt->SetData(0, guid.GetCounter());
|
||||
stmt->SetData(1, GetId());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
// Enable remove/promote buttons
|
||||
@@ -314,9 +314,9 @@ void ArenaTeam::SetCaptain(ObjectGuid guid)
|
||||
newCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0);
|
||||
/*if (oldCaptain)
|
||||
{
|
||||
LOG_DEBUG("bg.battleground", "Player: %s [%s] promoted player: %s [%s] to leader of arena team [Id: %u] [Type: %u].",
|
||||
oldCaptain->GetName().c_str(), oldCaptain->GetGUID().ToString().c_str(), newCaptain->GetName().c_str(),
|
||||
newCaptain->GetGUID().ToString().c_str(), GetId(), GetType());
|
||||
LOG_DEBUG("bg.battleground", "Player: {} [{}] promoted player: {} [{}] to leader of arena team [Id: {}] [Type: {}].",
|
||||
oldCaptain->GetName(), oldCaptain->GetGUID().ToString(), newCaptain->GetName(),
|
||||
newCaptain->GetGUID().ToString(), GetId(), GetType());
|
||||
}*/
|
||||
}
|
||||
}
|
||||
@@ -374,8 +374,8 @@ void ArenaTeam::DelMember(ObjectGuid guid, bool cleanDb)
|
||||
if (cleanDb)
|
||||
{
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ARENA_TEAM_MEMBER);
|
||||
stmt->setUInt32(0, GetId());
|
||||
stmt->setUInt32(1, guid.GetCounter());
|
||||
stmt->SetData(0, GetId());
|
||||
stmt->SetData(1, guid.GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
}
|
||||
@@ -396,11 +396,11 @@ void ArenaTeam::Disband(WorldSession* session)
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ARENA_TEAM);
|
||||
stmt->setUInt32(0, TeamId);
|
||||
stmt->SetData(0, TeamId);
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ARENA_TEAM_MEMBERS);
|
||||
stmt->setUInt32(0, TeamId);
|
||||
stmt->SetData(0, TeamId);
|
||||
trans->Append(stmt);
|
||||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
@@ -419,11 +419,11 @@ void ArenaTeam::Disband()
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ARENA_TEAM);
|
||||
stmt->setUInt32(0, TeamId);
|
||||
stmt->SetData(0, TeamId);
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ARENA_TEAM_MEMBERS);
|
||||
stmt->setUInt32(0, TeamId);
|
||||
stmt->SetData(0, TeamId);
|
||||
trans->Append(stmt);
|
||||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
@@ -586,7 +586,7 @@ void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, ObjectGuid guid, uint8 str
|
||||
data << str1 << str2 << str3;
|
||||
break;
|
||||
default:
|
||||
LOG_ERROR("bg.arena", "Unhandled strCount %u in ArenaTeam::BroadcastEvent", strCount);
|
||||
LOG_ERROR("bg.arena", "Unhandled strCount {} in ArenaTeam::BroadcastEvent", strCount);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -622,7 +622,7 @@ uint8 ArenaTeam::GetSlotByType(uint32 type)
|
||||
auto const& itr = ArenaSlotByType.find(type);
|
||||
if (itr == ArenaSlotByType.end())
|
||||
{
|
||||
sLog->outError("FATAL: Unknown arena team type %u for some arena team", type);
|
||||
LOG_ERROR("bg.arena", "Unknown arena team type {} for some arena team", type);
|
||||
return slot;
|
||||
}
|
||||
|
||||
@@ -636,7 +636,7 @@ uint8 ArenaTeam::GetSlotByType(uint32 type)
|
||||
return slot;
|
||||
}
|
||||
|
||||
LOG_ERROR("bg.arena", "FATAL: Unknown arena team type %u for some arena team", type);
|
||||
LOG_ERROR("bg.arena", "Unknown arena team type {} for some arena team", type);
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
@@ -664,7 +664,7 @@ uint32 ArenaTeam::GetPoints(uint32 memberRating)
|
||||
points = 344;
|
||||
}
|
||||
else
|
||||
points = 1511.26f / (1.0f + 1639.28f * exp(-0.00412f * (float)rating));
|
||||
points = 1511.26f / (1.0f + 1639.28f * std::exp(-0.00412f * (float)rating));
|
||||
|
||||
// Type penalties for teams < 5v5
|
||||
if (Type == ARENA_TEAM_2v2)
|
||||
@@ -713,7 +713,7 @@ float ArenaTeam::GetChanceAgainst(uint32 ownRating, uint32 opponentRating)
|
||||
{
|
||||
// Returns the chance to win against a team with the given rating, used in the rating adjustment calculation
|
||||
// ELO system
|
||||
return 1.0f / (1.0f + exp(log(10.0f) * (float)((float)opponentRating - (float)ownRating) / 650.0f));
|
||||
return 1.0f / (1.0f + (std::exp(std::log(10.0f) * (float)((float)opponentRating - (float)ownRating) / 650.0f)));
|
||||
}
|
||||
|
||||
int32 ArenaTeam::GetMatchmakerRatingMod(uint32 ownRating, uint32 opponentRating, bool won /*, float& confidence_factor*/)
|
||||
@@ -727,7 +727,7 @@ int32 ArenaTeam::GetMatchmakerRatingMod(uint32 ownRating, uint32 opponentRating,
|
||||
// Work in progress:
|
||||
/*
|
||||
// This is a simulation, as there is not much info on how it really works
|
||||
float confidence_mod = min(1.0f - fabs(mod), 0.5f);
|
||||
float confidence_mod = min(1.0f - std::fabs(mod), 0.5f);
|
||||
|
||||
// Apply confidence factor to the mod:
|
||||
mod *= confidence_factor
|
||||
@@ -938,32 +938,32 @@ void ArenaTeam::SaveToDB()
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ARENA_TEAM_STATS);
|
||||
stmt->setUInt16(0, Stats.Rating);
|
||||
stmt->setUInt16(1, Stats.WeekGames);
|
||||
stmt->setUInt16(2, Stats.WeekWins);
|
||||
stmt->setUInt16(3, Stats.SeasonGames);
|
||||
stmt->setUInt16(4, Stats.SeasonWins);
|
||||
stmt->setUInt32(5, Stats.Rank);
|
||||
stmt->setUInt32(6, GetId());
|
||||
stmt->SetData(0, Stats.Rating);
|
||||
stmt->SetData(1, Stats.WeekGames);
|
||||
stmt->SetData(2, Stats.WeekWins);
|
||||
stmt->SetData(3, Stats.SeasonGames);
|
||||
stmt->SetData(4, Stats.SeasonWins);
|
||||
stmt->SetData(5, Stats.Rank);
|
||||
stmt->SetData(6, GetId());
|
||||
trans->Append(stmt);
|
||||
|
||||
for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr)
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ARENA_TEAM_MEMBER);
|
||||
stmt->setUInt16(0, itr->PersonalRating);
|
||||
stmt->setUInt16(1, itr->WeekGames);
|
||||
stmt->setUInt16(2, itr->WeekWins);
|
||||
stmt->setUInt16(3, itr->SeasonGames);
|
||||
stmt->setUInt16(4, itr->SeasonWins);
|
||||
stmt->setUInt32(5, GetId());
|
||||
stmt->setUInt32(6, itr->Guid.GetCounter());
|
||||
stmt->SetData(0, itr->PersonalRating);
|
||||
stmt->SetData(1, itr->WeekGames);
|
||||
stmt->SetData(2, itr->WeekWins);
|
||||
stmt->SetData(3, itr->SeasonGames);
|
||||
stmt->SetData(4, itr->SeasonWins);
|
||||
stmt->SetData(5, GetId());
|
||||
stmt->SetData(6, itr->Guid.GetCounter());
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CHARACTER_ARENA_STATS);
|
||||
stmt->setUInt32(0, itr->Guid.GetCounter());
|
||||
stmt->setUInt8(1, GetSlot());
|
||||
stmt->setUInt16(2, itr->MatchMakerRating);
|
||||
stmt->setUInt16(3, itr->MaxMMR);
|
||||
stmt->SetData(0, itr->Guid.GetCounter());
|
||||
stmt->SetData(1, GetSlot());
|
||||
stmt->SetData(2, itr->MatchMakerRating);
|
||||
stmt->SetData(3, itr->MaxMMR);
|
||||
trans->Append(stmt);
|
||||
}
|
||||
|
||||
@@ -1013,7 +1013,7 @@ uint8 ArenaTeam::GetReqPlayersForType(uint32 type)
|
||||
auto const& itr = ArenaReqPlayersForType.find(type);
|
||||
if (itr == ArenaReqPlayersForType.end())
|
||||
{
|
||||
sLog->outError("FATAL: Unknown arena type %u!", type);
|
||||
LOG_ERROR("bg.arena", "FATAL: Unknown arena type {}!", type);
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
@@ -1087,3 +1087,22 @@ std::unordered_map<uint8, uint8> ArenaTeam::ArenaReqPlayersForType =
|
||||
{ ARENA_TYPE_3v3, 6},
|
||||
{ ARENA_TYPE_5v5, 10}
|
||||
};
|
||||
|
||||
void ArenaTeam::SetEmblem(uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor)
|
||||
{
|
||||
BackgroundColor = backgroundColor;
|
||||
EmblemStyle = emblemStyle;
|
||||
EmblemColor = emblemColor;
|
||||
BorderStyle = borderStyle;
|
||||
BorderColor = borderColor;
|
||||
}
|
||||
|
||||
void ArenaTeam::SetRatingForAll(uint32 rating)
|
||||
{
|
||||
Stats.Rating = rating;
|
||||
|
||||
for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
|
||||
{
|
||||
itr->PersonalRating = rating;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,6 +215,10 @@ public:
|
||||
static std::unordered_map<uint32, uint8> ArenaSlotByType; // Slot -> Type
|
||||
static std::unordered_map<uint8, uint8> ArenaReqPlayersForType; // Type -> Players count
|
||||
|
||||
void SetEmblem(uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor);
|
||||
void SetRatingForAll(uint32 rating);
|
||||
|
||||
|
||||
protected:
|
||||
uint32 TeamId;
|
||||
uint8 Type;
|
||||
|
||||
@@ -187,7 +187,7 @@ void ArenaTeamMgr::LoadArenaTeams()
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
LOG_INFO("server.loading", ">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server.loading", ">> Loaded {} arena teams in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server.loading", " ");
|
||||
}
|
||||
|
||||
@@ -222,8 +222,8 @@ void ArenaTeamMgr::DistributeArenaPoints()
|
||||
else // Update database
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_ARENA_POINTS);
|
||||
stmt->setUInt32(0, playerItr->second);
|
||||
stmt->setUInt32(1, playerItr->first.GetCounter());
|
||||
stmt->SetData(0, playerItr->second);
|
||||
stmt->SetData(1, playerItr->first.GetCounter());
|
||||
trans->Append(stmt);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -18,6 +18,7 @@
|
||||
#ifndef __BATTLEGROUND_H
|
||||
#define __BATTLEGROUND_H
|
||||
|
||||
#include "ArenaScore.h"
|
||||
#include "Common.h"
|
||||
#include "DBCEnums.h"
|
||||
#include "GameObject.h"
|
||||
@@ -53,6 +54,27 @@ enum BattlegroundDesertionType
|
||||
BG_DESERTION_TYPE_INVITE_LOGOUT = 4, // player is invited to join and logs out
|
||||
};
|
||||
|
||||
enum BattlegroundMaps
|
||||
{
|
||||
MAP_BG_ALTERAC_VALLEY = 30,
|
||||
MAP_BG_WARSONG_GULCH = 489,
|
||||
MAP_BG_ARATHI_BASIN = 529,
|
||||
MAP_BG_EYE_OF_THE_STORM = 566,
|
||||
MAP_BG_STRAND_OF_THE_ANCIENTS = 607,
|
||||
MAP_BG_ISLE_OF_CONQUEST = 628
|
||||
};
|
||||
|
||||
enum BattlegroundBroadcastTexts
|
||||
{
|
||||
BG_TEXT_ALLIANCE_WINS = 10633,
|
||||
BG_TEXT_HORDE_WINS = 10634,
|
||||
|
||||
BG_TEXT_START_TWO_MINUTES = 18193,
|
||||
BG_TEXT_START_ONE_MINUTE = 18194,
|
||||
BG_TEXT_START_HALF_MINUTE = 18195,
|
||||
BG_TEXT_BATTLE_HAS_BEGUN = 18196,
|
||||
};
|
||||
|
||||
enum BattlegroundSounds
|
||||
{
|
||||
SOUND_HORDE_WINS = 8454,
|
||||
@@ -111,17 +133,12 @@ enum BattlegroundSpells
|
||||
SPELL_SPIRIT_HEAL = 22012, // Spirit Heal
|
||||
SPELL_RESURRECTION_VISUAL = 24171, // Resurrection Impact Visual
|
||||
SPELL_ARENA_PREPARATION = 32727, // use this one, 32728 not correct
|
||||
SPELL_ALLIANCE_GOLD_FLAG = 32724,
|
||||
SPELL_ALLIANCE_GREEN_FLAG = 32725,
|
||||
SPELL_HORDE_GOLD_FLAG = 35774,
|
||||
SPELL_HORDE_GREEN_FLAG = 35775,
|
||||
SPELL_PREPARATION = 44521, // Preparation
|
||||
SPELL_SPIRIT_HEAL_MANA = 44535, // Spirit Heal
|
||||
SPELL_RECENTLY_DROPPED_FLAG = 42792, // Recently Dropped Flag
|
||||
SPELL_AURA_PLAYER_INACTIVE = 43681, // Inactive
|
||||
SPELL_HONORABLE_DEFENDER_25Y = 68652, // +50% honor when standing at a capture point that you control, 25yards radius (added in 3.2)
|
||||
SPELL_HONORABLE_DEFENDER_60Y = 66157, // +50% honor when standing at a capture point that you control, 60yards radius (added in 3.2), probably for 40+ player battlegrounds
|
||||
SPELL_THE_LAST_STANDING = 26549, // Arena achievement related
|
||||
SPELL_HONORABLE_DEFENDER_60Y = 66157 // +50% honor when standing at a capture point that you control, 60yards radius (added in 3.2), probably for 40+ player battlegrounds
|
||||
};
|
||||
|
||||
enum BattlegroundReputations
|
||||
@@ -180,50 +197,18 @@ enum BattlegroundStatus
|
||||
STATUS_WAIT_LEAVE = 4 // means some faction has won BG and it is ending
|
||||
};
|
||||
|
||||
enum BattlegroundTeams
|
||||
{
|
||||
BG_TEAMS_COUNT = 2
|
||||
};
|
||||
|
||||
struct BattlegroundObjectInfo
|
||||
{
|
||||
BattlegroundObjectInfo() {}
|
||||
BattlegroundObjectInfo() = default;
|
||||
|
||||
GameObject* object{nullptr};
|
||||
int32 timer{0};
|
||||
uint32 spellid{0};
|
||||
};
|
||||
|
||||
enum ScoreType
|
||||
{
|
||||
SCORE_KILLING_BLOWS = 1,
|
||||
SCORE_DEATHS = 2,
|
||||
SCORE_HONORABLE_KILLS = 3,
|
||||
SCORE_BONUS_HONOR = 4,
|
||||
//EY, but in MSG_PVP_LOG_DATA opcode!
|
||||
SCORE_DAMAGE_DONE = 5,
|
||||
SCORE_HEALING_DONE = 6,
|
||||
//WS
|
||||
SCORE_FLAG_CAPTURES = 7,
|
||||
SCORE_FLAG_RETURNS = 8,
|
||||
//AB and IC
|
||||
SCORE_BASES_ASSAULTED = 9,
|
||||
SCORE_BASES_DEFENDED = 10,
|
||||
//AV
|
||||
SCORE_GRAVEYARDS_ASSAULTED = 11,
|
||||
SCORE_GRAVEYARDS_DEFENDED = 12,
|
||||
SCORE_TOWERS_ASSAULTED = 13,
|
||||
SCORE_TOWERS_DEFENDED = 14,
|
||||
SCORE_MINES_CAPTURED = 15,
|
||||
SCORE_LEADERS_KILLED = 16,
|
||||
SCORE_SECONDARY_OBJECTIVES = 17,
|
||||
//SOTA
|
||||
SCORE_DESTROYED_DEMOLISHER = 18,
|
||||
SCORE_DESTROYED_WALL = 19,
|
||||
};
|
||||
|
||||
enum ArenaType : uint8
|
||||
{
|
||||
ARENA_TYPE_NONE = 0,
|
||||
ARENA_TYPE_2v2 = 2,
|
||||
ARENA_TYPE_3v3 = 3,
|
||||
ARENA_TYPE_5v5 = 5
|
||||
@@ -251,43 +236,15 @@ enum BattlegroundStartingEventsIds
|
||||
BG_STARTING_EVENT_THIRD = 2,
|
||||
BG_STARTING_EVENT_FOURTH = 3
|
||||
};
|
||||
#define BG_STARTING_EVENT_COUNT 4
|
||||
|
||||
struct BattlegroundScore
|
||||
{
|
||||
BattlegroundScore(Player* player) : KillingBlows(0), Deaths(0), HonorableKills(0), BonusHonor(0),
|
||||
DamageDone(0), HealingDone(0), player(player)
|
||||
{ }
|
||||
|
||||
virtual ~BattlegroundScore() = default; //virtual destructor is used when deleting score from scores map
|
||||
|
||||
uint32 KillingBlows;
|
||||
uint32 Deaths;
|
||||
uint32 HonorableKills;
|
||||
uint32 BonusHonor;
|
||||
uint32 DamageDone;
|
||||
uint32 HealingDone;
|
||||
Player* player;
|
||||
|
||||
[[nodiscard]] uint32 GetKillingBlows() const { return KillingBlows; }
|
||||
[[nodiscard]] uint32 GetDeaths() const { return Deaths; }
|
||||
[[nodiscard]] uint32 GetHonorableKills() const { return HonorableKills; }
|
||||
[[nodiscard]] uint32 GetBonusHonor() const { return BonusHonor; }
|
||||
[[nodiscard]] uint32 GetDamageDone() const { return DamageDone; }
|
||||
[[nodiscard]] uint32 GetHealingDone() const { return HealingDone; }
|
||||
|
||||
[[nodiscard]] virtual uint32 GetAttr1() const { return 0; }
|
||||
[[nodiscard]] virtual uint32 GetAttr2() const { return 0; }
|
||||
[[nodiscard]] virtual uint32 GetAttr3() const { return 0; }
|
||||
[[nodiscard]] virtual uint32 GetAttr4() const { return 0; }
|
||||
[[nodiscard]] virtual uint32 GetAttr5() const { return 0; }
|
||||
};
|
||||
constexpr auto BG_STARTING_EVENT_COUNT = 4;
|
||||
|
||||
class ArenaLogEntryData
|
||||
{
|
||||
public:
|
||||
ArenaLogEntryData() {}
|
||||
void Fill(const char* name, ObjectGuid::LowType guid, uint32 acc, uint32 arenaTeamId, std::string ip)
|
||||
ArenaLogEntryData() = default;
|
||||
|
||||
void Fill(std::string_view name, ObjectGuid::LowType guid, uint32 acc, uint32 arenaTeamId, std::string ip)
|
||||
{
|
||||
Name = std::string(name);
|
||||
Guid = guid;
|
||||
@@ -296,11 +253,11 @@ public:
|
||||
IP = ip;
|
||||
}
|
||||
|
||||
std::string Name;
|
||||
std::string Name{};
|
||||
ObjectGuid::LowType Guid{0};
|
||||
uint32 Acc;
|
||||
uint32 Acc{0};
|
||||
uint32 ArenaTeamId{0};
|
||||
std::string IP;
|
||||
std::string IP{};
|
||||
uint32 DamageDone{0};
|
||||
uint32 HealingDone{0};
|
||||
uint32 KillingBlows{0};
|
||||
@@ -318,11 +275,11 @@ enum BGHonorMode
|
||||
#define ARENA_READY_MARKER_ENTRY 301337
|
||||
|
||||
/*
|
||||
This class is used to:
|
||||
1. Add player to battleground
|
||||
2. Remove player from battleground
|
||||
3. some certain cases, same for all battlegrounds
|
||||
4. It has properties same for all battlegrounds
|
||||
This class is used to:
|
||||
1. Add player to battleground
|
||||
2. Remove player from battleground
|
||||
3. some certain cases, same for all battlegrounds
|
||||
4. It has properties same for all battlegrounds
|
||||
*/
|
||||
|
||||
enum BattlegroundQueueInvitationType
|
||||
@@ -344,6 +301,7 @@ public:
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void Init();
|
||||
virtual void StartingEventCloseDoors() { }
|
||||
virtual void StartingEventOpenDoors() { }
|
||||
@@ -357,7 +315,7 @@ public:
|
||||
|
||||
/* Battleground */
|
||||
// Get methods:
|
||||
[[nodiscard]] char const* GetName() const { return m_Name; }
|
||||
[[nodiscard]] std::string GetName() const { return m_Name; }
|
||||
[[nodiscard]] BattlegroundTypeId GetBgTypeID(bool GetRandom = false) const { return GetRandom ? m_RandomTypeID : m_RealTypeID; }
|
||||
[[nodiscard]] uint32 GetInstanceID() const { return m_InstanceID; }
|
||||
[[nodiscard]] BattlegroundStatus GetStatus() const { return m_Status; }
|
||||
@@ -374,29 +332,29 @@ public:
|
||||
|
||||
[[nodiscard]] int32 GetStartDelayTime() const { return m_StartDelayTime; }
|
||||
[[nodiscard]] uint8 GetArenaType() const { return m_ArenaType; }
|
||||
[[nodiscard]] TeamId GetWinner() const { return m_WinnerId; }
|
||||
[[nodiscard]] PvPTeamId GetWinner() const { return m_WinnerId; }
|
||||
[[nodiscard]] uint32 GetScriptId() const { return ScriptId; }
|
||||
[[nodiscard]] uint32 GetBonusHonorFromKill(uint32 kills) const;
|
||||
|
||||
bool IsRandom() { return m_IsRandom; }
|
||||
bool IsRandom() { return m_IsRandom; }
|
||||
|
||||
// Set methods:
|
||||
void SetName(char const* Name) { m_Name = Name; }
|
||||
void SetName(std::string_view name) { m_Name = std::string(name); }
|
||||
void SetBgTypeID(BattlegroundTypeId TypeID) { m_RealTypeID = TypeID; }
|
||||
void SetRandomTypeID(BattlegroundTypeId TypeID) { m_RandomTypeID = TypeID; }
|
||||
void SetInstanceID(uint32 InstanceID) { m_InstanceID = InstanceID; }
|
||||
void SetStatus(BattlegroundStatus Status) { m_Status = Status; }
|
||||
void SetClientInstanceID(uint32 InstanceID) { m_ClientInstanceID = InstanceID; }
|
||||
void SetStartTime(uint32 Time) { m_StartTime = Time; }
|
||||
void SetEndTime(uint32 Time) { m_EndTime = Time; }
|
||||
void SetStartTime(uint32 Time) { m_StartTime = Time; }
|
||||
void SetEndTime(uint32 Time) { m_EndTime = Time; }
|
||||
void SetLastResurrectTime(uint32 Time) { m_LastResurrectTime = Time; }
|
||||
void SetLevelRange(uint32 min, uint32 max) { m_LevelMin = min; m_LevelMax = max; }
|
||||
void SetRated(bool state) { m_IsRated = state; }
|
||||
void SetArenaType(uint8 type) { m_ArenaType = type; }
|
||||
void SetRated(bool state) { m_IsRated = state; }
|
||||
void SetArenaType(uint8 type) { m_ArenaType = type; }
|
||||
void SetArenaorBGType(bool _isArena) { m_IsArena = _isArena; }
|
||||
void SetWinner(TeamId winner) { m_WinnerId = winner; }
|
||||
void SetScriptId(uint32 scriptId) { ScriptId = scriptId; }
|
||||
void SetRandom(bool isRandom) { m_IsRandom = isRandom; }
|
||||
void SetWinner(PvPTeamId winner) { m_WinnerId = winner; }
|
||||
void SetScriptId(uint32 scriptId) { ScriptId = scriptId; }
|
||||
void SetRandom(bool isRandom) { m_IsRandom = isRandom; }
|
||||
|
||||
void ModifyStartDelayTime(int32 diff) { m_StartDelayTime -= diff; }
|
||||
void SetStartDelayTime(int32 Time) { m_StartDelayTime = Time; }
|
||||
@@ -433,12 +391,11 @@ public:
|
||||
void ReadyMarkerClicked(Player* p); // pussywizard
|
||||
GuidSet readyMarkerClickedSet; // pussywizard
|
||||
|
||||
typedef std::map<ObjectGuid, BattlegroundScore*> BattlegroundScoreMap;
|
||||
typedef std::map<ObjectGuid, ArenaLogEntryData> ArenaLogEntryDataMap;// pussywizard
|
||||
typedef std::unordered_map<ObjectGuid::LowType, BattlegroundScore*> BattlegroundScoreMap;
|
||||
typedef std::unordered_map<ObjectGuid, ArenaLogEntryData> ArenaLogEntryDataMap; // pussywizard
|
||||
ArenaLogEntryDataMap ArenaLogEntries; // pussywizard
|
||||
[[nodiscard]] BattlegroundScoreMap::const_iterator GetPlayerScoresBegin() const { return PlayerScores.begin(); }
|
||||
[[nodiscard]] BattlegroundScoreMap::const_iterator GetPlayerScoresEnd() const { return PlayerScores.end(); }
|
||||
[[nodiscard]] uint32 GetPlayerScoresSize() const { return PlayerScores.size(); }
|
||||
[[nodiscard]] BattlegroundScoreMap const* GetPlayerScores() const { return &PlayerScores; }
|
||||
[[nodiscard]] std::size_t GetPlayerScoresSize() const { return PlayerScores.size(); }
|
||||
|
||||
[[nodiscard]] uint32 GetReviveQueueSize() const { return m_ReviveQueue.size(); }
|
||||
|
||||
@@ -462,25 +419,22 @@ public:
|
||||
[[nodiscard]] BattlegroundMap* GetBgMap() const { ASSERT(m_Map); return m_Map; }
|
||||
[[nodiscard]] BattlegroundMap* FindBgMap() const { return m_Map; }
|
||||
|
||||
void SetTeamStartLoc(TeamId teamId, float X, float Y, float Z, float O);
|
||||
void GetTeamStartLoc(TeamId teamId, float& X, float& Y, float& Z, float& O) const
|
||||
{
|
||||
X = m_TeamStartLocX[teamId];
|
||||
Y = m_TeamStartLocY[teamId];
|
||||
Z = m_TeamStartLocZ[teamId];
|
||||
O = m_TeamStartLocO[teamId];
|
||||
}
|
||||
void SetTeamStartPosition(TeamId teamId, Position const& pos);
|
||||
Position const* GetTeamStartPosition(TeamId teamId) const;
|
||||
|
||||
void SetStartMaxDist(float startMaxDist) { m_StartMaxDist = startMaxDist; }
|
||||
[[nodiscard]] float GetStartMaxDist() const { return m_StartMaxDist; }
|
||||
|
||||
// Packet Transfer
|
||||
// method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!)
|
||||
virtual void FillInitialWorldStates(WorldPacket& /*data*/) {}
|
||||
void SendPacketToTeam(TeamId teamId, WorldPacket* packet, Player* sender = nullptr, bool self = true);
|
||||
void SendPacketToAll(WorldPacket* packet);
|
||||
virtual void FillInitialWorldStates(WorldPacket& /*data*/) { }
|
||||
void SendPacketToTeam(TeamId teamId, WorldPacket const* packet, Player* sender = nullptr, bool self = true);
|
||||
void SendPacketToAll(WorldPacket const* packet);
|
||||
void YellToAll(Creature* creature, const char* text, uint32 language);
|
||||
|
||||
void SendChatMessage(Creature* source, uint8 textId, WorldObject* target = nullptr);
|
||||
void SendBroadcastText(uint32 id, ChatMsg msgType, WorldObject const* target = nullptr);
|
||||
|
||||
template<class Do>
|
||||
void BroadcastWorker(Do& _do);
|
||||
|
||||
@@ -491,10 +445,16 @@ public:
|
||||
void RewardReputationToTeam(uint32 factionId, uint32 reputation, TeamId teamId);
|
||||
uint32 GetRealRepFactionForPlayer(uint32 factionId, Player* player);
|
||||
|
||||
void UpdateWorldState(uint32 Field, uint32 Value);
|
||||
void UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player* player);
|
||||
void UpdateWorldState(uint32 variable, uint32 value);
|
||||
|
||||
void EndBattleground(PvPTeamId winnerTeamId);
|
||||
|
||||
// deprecated, need delete
|
||||
virtual void EndBattleground(TeamId winnerTeamId)
|
||||
{
|
||||
EndBattleground(GetPvPTeamId(winnerTeamId));
|
||||
}
|
||||
|
||||
virtual void EndBattleground(TeamId winnerTeamId);
|
||||
void BlockMovement(Player* player);
|
||||
|
||||
void SendWarningToAll(uint32 entry, ...);
|
||||
@@ -508,7 +468,8 @@ public:
|
||||
[[nodiscard]] Group* GetBgRaid(TeamId teamId) const { return m_BgRaids[teamId]; }
|
||||
void SetBgRaid(TeamId teamId, Group* bg_raid);
|
||||
|
||||
virtual void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
void BuildPvPLogDataPacket(WorldPacket& data);
|
||||
virtual bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
|
||||
[[nodiscard]] uint32 GetPlayersCountByTeam(TeamId teamId) const { return m_PlayersCount[teamId]; }
|
||||
[[nodiscard]] uint32 GetAlivePlayersCountByTeam(TeamId teamId) const; // used in arenas to correctly handle death in spirit of redemption / last stand etc. (killer = killed) cases
|
||||
@@ -520,23 +481,20 @@ public:
|
||||
++m_PlayersCount[teamId];
|
||||
}
|
||||
|
||||
virtual void CheckWinConditions() { }
|
||||
|
||||
// used for rated arena battles
|
||||
void SetArenaTeamIdForTeam(TeamId teamId, uint32 ArenaTeamId) { m_ArenaTeamIds[teamId] = ArenaTeamId; }
|
||||
[[nodiscard]] uint32 GetArenaTeamIdForTeam(TeamId teamId) const { return m_ArenaTeamIds[teamId]; }
|
||||
void SetArenaTeamRatingChangeForTeam(TeamId teamId, int32 RatingChange) { m_ArenaTeamRatingChanges[teamId] = RatingChange; }
|
||||
[[nodiscard]] int32 GetArenaTeamRatingChangeForTeam(TeamId teamId) const { return m_ArenaTeamRatingChanges[teamId]; }
|
||||
void SetArenaMatchmakerRating(TeamId teamId, uint32 MMR) { m_ArenaTeamMMR[teamId] = MMR; }
|
||||
[[nodiscard]] uint32 GetArenaMatchmakerRating(TeamId teamId) const { return m_ArenaTeamMMR[teamId]; }
|
||||
void CheckArenaAfterTimerConditions();
|
||||
void CheckArenaWinConditions();
|
||||
virtual void UpdateArenaWorldState();
|
||||
[[nodiscard]] uint32 GetArenaTeamIdForTeam(TeamId teamId) const { return m_ArenaTeamIds[teamId]; }
|
||||
void SetArenaMatchmakerRating(TeamId teamId, uint32 MMR) { m_ArenaTeamMMR[teamId] = MMR; }
|
||||
[[nodiscard]] uint32 GetArenaMatchmakerRating(TeamId teamId) const { return m_ArenaTeamMMR[teamId]; }
|
||||
|
||||
// Triggers handle
|
||||
// must be implemented in BG subclass
|
||||
virtual void HandleAreaTrigger(Player* /*player*/, uint32 /*trigger*/) {}
|
||||
// must be implemented in BG subclass if need AND call base class generic code
|
||||
virtual void HandleKillPlayer(Player* player, Player* killer);
|
||||
virtual void HandleKillUnit(Creature* /*unit*/, Player* /*killer*/);
|
||||
virtual void HandleKillUnit(Creature* /*unit*/, Player* /*killer*/) { }
|
||||
|
||||
// Battleground events
|
||||
virtual void EventPlayerDroppedFlag(Player* /*player*/) {}
|
||||
@@ -556,7 +514,7 @@ public:
|
||||
|
||||
void AddOrSetPlayerToCorrectBgGroup(Player* player, TeamId teamId);
|
||||
|
||||
void RemovePlayerAtLeave(Player* player);
|
||||
virtual void RemovePlayerAtLeave(Player* player);
|
||||
// can be extended in in BG subclass
|
||||
|
||||
void HandleTriggerBuff(GameObject* gameObject);
|
||||
@@ -660,14 +618,19 @@ protected:
|
||||
// this must be filled in constructors!
|
||||
uint32 StartMessageIds[BG_STARTING_EVENT_COUNT];
|
||||
|
||||
bool m_BuffChange;
|
||||
bool m_IsRandom;
|
||||
bool m_BuffChange;
|
||||
bool m_IsRandom;
|
||||
|
||||
BGHonorMode m_HonorMode;
|
||||
int32 m_TeamScores[BG_TEAMS_COUNT];
|
||||
int32 m_TeamScores[PVP_TEAMS_COUNT];
|
||||
|
||||
ArenaTeamScore _arenaTeamScores[PVP_TEAMS_COUNT];
|
||||
|
||||
// pussywizard:
|
||||
uint32 m_UpdateTimer;
|
||||
|
||||
EventProcessor _reviveEvents;
|
||||
|
||||
private:
|
||||
// Battleground
|
||||
BattlegroundTypeId m_RealTypeID;
|
||||
@@ -683,12 +646,12 @@ private:
|
||||
uint8 m_ArenaType; // 2=2v2, 3=3v3, 5=5v5
|
||||
bool m_SetDeleteThis; // used for safe deletion of the bg after end / all players leave
|
||||
bool m_IsArena;
|
||||
TeamId m_WinnerId;
|
||||
PvPTeamId m_WinnerId;
|
||||
int32 m_StartDelayTime;
|
||||
bool m_IsRated; // is this battle rated?
|
||||
bool m_PrematureCountDown;
|
||||
uint32 m_PrematureCountDownTimer;
|
||||
char const* m_Name;
|
||||
std::string m_Name{};
|
||||
|
||||
/* Pre- and post-update hooks */
|
||||
|
||||
@@ -727,22 +690,20 @@ private:
|
||||
// Invited counters are useful for player invitation to BG - do not allow, if BG is started to one faction to have 2 more players than another faction
|
||||
// Invited counters will be changed only when removing already invited player from queue, removing player from battleground and inviting player to BG
|
||||
// Invited players counters
|
||||
uint32 m_BgInvitedPlayers[BG_TEAMS_COUNT];
|
||||
uint32 m_BgInvitedPlayers[PVP_TEAMS_COUNT];
|
||||
|
||||
// Raid Group
|
||||
Group* m_BgRaids[BG_TEAMS_COUNT]; // 0 - alliance, 1 - horde
|
||||
Group* m_BgRaids[PVP_TEAMS_COUNT]; // 0 - alliance, 1 - horde
|
||||
|
||||
SpectatorList m_Spectators;
|
||||
ToBeTeleportedMap m_ToBeTeleported;
|
||||
|
||||
// Players count by team
|
||||
uint32 m_PlayersCount[BG_TEAMS_COUNT];
|
||||
uint32 m_PlayersCount[PVP_TEAMS_COUNT];
|
||||
|
||||
// Arena team ids by team
|
||||
uint32 m_ArenaTeamIds[BG_TEAMS_COUNT];
|
||||
|
||||
int32 m_ArenaTeamRatingChanges[BG_TEAMS_COUNT];
|
||||
uint32 m_ArenaTeamMMR[BG_TEAMS_COUNT];
|
||||
uint32 m_ArenaTeamIds[PVP_TEAMS_COUNT];
|
||||
uint32 m_ArenaTeamMMR[PVP_TEAMS_COUNT];
|
||||
|
||||
// Limits
|
||||
uint32 m_LevelMin;
|
||||
@@ -753,11 +714,8 @@ private:
|
||||
// Start location
|
||||
uint32 m_MapId;
|
||||
BattlegroundMap* m_Map;
|
||||
float m_TeamStartLocX[BG_TEAMS_COUNT];
|
||||
float m_TeamStartLocY[BG_TEAMS_COUNT];
|
||||
float m_TeamStartLocZ[BG_TEAMS_COUNT];
|
||||
float m_TeamStartLocO[BG_TEAMS_COUNT];
|
||||
float m_StartMaxDist;
|
||||
std::array<Position, PVP_TEAMS_COUNT> _startPosition;
|
||||
uint32 ScriptId;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -36,16 +36,16 @@
|
||||
#include "Formulas.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "GameGraveyard.h"
|
||||
#include "GameTime.h"
|
||||
#include "Map.h"
|
||||
#include "MapInstanced.h"
|
||||
#include "MapMgr.h"
|
||||
#include "MiscPackets.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Player.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
#include <random>
|
||||
#include <unordered_map>
|
||||
|
||||
/*********************************************************/
|
||||
@@ -140,11 +140,11 @@ void BattlegroundMgr::Update(uint32 diff)
|
||||
{
|
||||
if (m_AutoDistributionTimeChecker < diff)
|
||||
{
|
||||
if (time(nullptr) > m_NextAutoDistributionTime)
|
||||
if (GameTime::GetGameTime() > m_NextAutoDistributionTime)
|
||||
{
|
||||
sArenaTeamMgr->DistributeArenaPoints();
|
||||
m_NextAutoDistributionTime = m_NextAutoDistributionTime + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld->getIntConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS);
|
||||
sWorld->setWorldState(WS_ARENA_DISTRIBUTION_TIME, uint64(m_NextAutoDistributionTime));
|
||||
m_NextAutoDistributionTime = m_NextAutoDistributionTime + 1_days * sWorld->getIntConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS);
|
||||
sWorld->setWorldState(WS_ARENA_DISTRIBUTION_TIME, m_NextAutoDistributionTime.count());
|
||||
}
|
||||
m_AutoDistributionTimeChecker = 600000; // 10 minutes check
|
||||
}
|
||||
@@ -205,179 +205,6 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket* data, Battlegro
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
|
||||
{
|
||||
uint8 type = (bg->isArena() ? 1 : 0);
|
||||
|
||||
data->Initialize(MSG_PVP_LOG_DATA, (1 + 1 + 4 + 40 * bg->GetPlayerScoresSize()));
|
||||
*data << uint8(type); // type (battleground=0/arena=1)
|
||||
|
||||
if (type) // arena
|
||||
{
|
||||
// it seems this must be according to BG_WINNER_A/H and _NOT_ TEAM_A/H
|
||||
for (TeamId iTeamId = TEAM_ALLIANCE; iTeamId <= TEAM_HORDE; iTeamId = TeamId(iTeamId + 1))
|
||||
{
|
||||
// Xinef: oryginally this was looping in reverse order, loop order was changed so we have to change checked teamId
|
||||
int32 rating_change = bg->GetArenaTeamRatingChangeForTeam(Battleground::GetOtherTeamId(iTeamId));
|
||||
|
||||
uint32 pointsLost = rating_change < 0 ? -rating_change : 0;
|
||||
uint32 pointsGained = rating_change > 0 ? rating_change : 0;
|
||||
uint32 MatchmakerRating = bg->GetArenaMatchmakerRating(Battleground::GetOtherTeamId(iTeamId));
|
||||
|
||||
*data << uint32(pointsLost); // Rating Lost
|
||||
*data << uint32(pointsGained); // Rating gained
|
||||
*data << uint32(MatchmakerRating); // Matchmaking Value
|
||||
}
|
||||
for (TeamId iTeamId = TEAM_ALLIANCE; iTeamId <= TEAM_HORDE; iTeamId = TeamId(iTeamId + 1))
|
||||
{
|
||||
if (ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(bg->GetArenaTeamIdForTeam(Battleground::GetOtherTeamId(iTeamId))))
|
||||
* data << at->GetName();
|
||||
else
|
||||
*data << uint8(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (bg->GetStatus() != STATUS_WAIT_LEAVE)
|
||||
*data << uint8(0); // bg not ended
|
||||
else
|
||||
{
|
||||
*data << uint8(1); // bg ended
|
||||
*data << uint8(bg->GetWinner() == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE); // who win
|
||||
}
|
||||
|
||||
size_t wpos = data->wpos();
|
||||
uint32 scoreCount = 0;
|
||||
*data << uint32(scoreCount); // placeholder
|
||||
|
||||
Battleground::BattlegroundScoreMap::const_iterator itr2 = bg->GetPlayerScoresBegin();
|
||||
for (Battleground::BattlegroundScoreMap::const_iterator itr = itr2; itr != bg->GetPlayerScoresEnd();)
|
||||
{
|
||||
itr2 = itr++;
|
||||
if (!bg->IsPlayerInBattleground(itr2->first))
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "Player %s has scoreboard entry for battleground %u but is not in battleground!", itr->first.ToString().c_str(), bg->GetBgTypeID());
|
||||
continue;
|
||||
}
|
||||
|
||||
*data << itr2->first;
|
||||
*data << uint32(itr2->second->KillingBlows);
|
||||
if (type == 0)
|
||||
{
|
||||
*data << uint32(itr2->second->HonorableKills);
|
||||
*data << uint32(itr2->second->Deaths);
|
||||
*data << uint32(itr2->second->BonusHonor);
|
||||
}
|
||||
else
|
||||
{
|
||||
*data << uint8(itr2->second->player->GetBgTeamId() == TEAM_ALLIANCE ? 1 : 0); // green or yellow
|
||||
}
|
||||
*data << uint32(itr2->second->DamageDone); // damage done
|
||||
*data << uint32(itr2->second->HealingDone); // healing done
|
||||
|
||||
BattlegroundTypeId bgTypeId = bg->GetBgTypeID();
|
||||
switch (bgTypeId) // battleground specific things
|
||||
{
|
||||
case BATTLEGROUND_RB:
|
||||
switch (bg->GetMapId())
|
||||
{
|
||||
case 489:
|
||||
*data << uint32(0x00000002); // count of next fields
|
||||
*data << uint32(((BattlegroundWGScore*)itr2->second)->FlagCaptures); // flag captures
|
||||
*data << uint32(((BattlegroundWGScore*)itr2->second)->FlagReturns); // flag returns
|
||||
break;
|
||||
case 566:
|
||||
*data << uint32(0x00000001); // count of next fields
|
||||
*data << uint32(((BattlegroundEYScore*)itr2->second)->FlagCaptures); // flag captures
|
||||
break;
|
||||
case 529:
|
||||
*data << uint32(0x00000002); // count of next fields
|
||||
*data << uint32(((BattlegroundABScore*)itr2->second)->BasesAssaulted); // bases asssulted
|
||||
*data << uint32(((BattlegroundABScore*)itr2->second)->BasesDefended); // bases defended
|
||||
break;
|
||||
case 30:
|
||||
*data << uint32(0x00000005); // count of next fields
|
||||
*data << uint32(((BattlegroundAVScore*)itr2->second)->GraveyardsAssaulted); // GraveyardsAssaulted
|
||||
*data << uint32(((BattlegroundAVScore*)itr2->second)->GraveyardsDefended); // GraveyardsDefended
|
||||
*data << uint32(((BattlegroundAVScore*)itr2->second)->TowersAssaulted); // TowersAssaulted
|
||||
*data << uint32(((BattlegroundAVScore*)itr2->second)->TowersDefended); // TowersDefended
|
||||
*data << uint32(((BattlegroundAVScore*)itr2->second)->MinesCaptured); // MinesCaptured
|
||||
break;
|
||||
case 607:
|
||||
*data << uint32(0x00000002); // count of next fields
|
||||
*data << uint32(((BattlegroundSAScore*)itr2->second)->demolishers_destroyed);
|
||||
*data << uint32(((BattlegroundSAScore*)itr2->second)->gates_destroyed);
|
||||
break;
|
||||
case 628: // IC
|
||||
*data << uint32(0x00000002); // count of next fields
|
||||
*data << uint32(((BattlegroundICScore*)itr2->second)->BasesAssaulted); // bases asssulted
|
||||
*data << uint32(((BattlegroundICScore*)itr2->second)->BasesDefended); // bases defended
|
||||
[[fallthrough]]; // TODO: Not sure whether the fallthrough was a mistake (forgetting a break) or intended. This should be double-checked.
|
||||
default:
|
||||
if (BattlegroundMgr::getBgFromMap.find(bg->GetMapId()) != BattlegroundMgr::getBgFromMap.end())
|
||||
BattlegroundMgr::getBgFromMap[bg->GetMapId()](data, itr2);
|
||||
else
|
||||
*data << uint32(0);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case BATTLEGROUND_AV:
|
||||
*data << uint32(0x00000005); // count of next fields
|
||||
*data << uint32(((BattlegroundAVScore*)itr2->second)->GraveyardsAssaulted); // GraveyardsAssaulted
|
||||
*data << uint32(((BattlegroundAVScore*)itr2->second)->GraveyardsDefended); // GraveyardsDefended
|
||||
*data << uint32(((BattlegroundAVScore*)itr2->second)->TowersAssaulted); // TowersAssaulted
|
||||
*data << uint32(((BattlegroundAVScore*)itr2->second)->TowersDefended); // TowersDefended
|
||||
*data << uint32(((BattlegroundAVScore*)itr2->second)->MinesCaptured); // MinesCaptured
|
||||
break;
|
||||
case BATTLEGROUND_WS:
|
||||
*data << uint32(0x00000002); // count of next fields
|
||||
*data << uint32(((BattlegroundWGScore*)itr2->second)->FlagCaptures); // flag captures
|
||||
*data << uint32(((BattlegroundWGScore*)itr2->second)->FlagReturns); // flag returns
|
||||
break;
|
||||
case BATTLEGROUND_AB:
|
||||
*data << uint32(0x00000002); // count of next fields
|
||||
*data << uint32(((BattlegroundABScore*)itr2->second)->BasesAssaulted); // bases asssulted
|
||||
*data << uint32(((BattlegroundABScore*)itr2->second)->BasesDefended); // bases defended
|
||||
break;
|
||||
case BATTLEGROUND_EY:
|
||||
*data << uint32(0x00000001); // count of next fields
|
||||
*data << uint32(((BattlegroundEYScore*)itr2->second)->FlagCaptures); // flag captures
|
||||
break;
|
||||
case BATTLEGROUND_SA:
|
||||
*data << uint32(0x00000002); // count of next fields
|
||||
*data << uint32(((BattlegroundSAScore*)itr2->second)->demolishers_destroyed);
|
||||
*data << uint32(((BattlegroundSAScore*)itr2->second)->gates_destroyed);
|
||||
break;
|
||||
case BATTLEGROUND_IC:
|
||||
*data << uint32(0x00000002); // count of next fields
|
||||
*data << uint32(((BattlegroundICScore*)itr2->second)->BasesAssaulted); // bases assaulted
|
||||
*data << uint32(((BattlegroundICScore*)itr2->second)->BasesDefended); // bases defended
|
||||
break;
|
||||
case BATTLEGROUND_NA:
|
||||
case BATTLEGROUND_BE:
|
||||
case BATTLEGROUND_AA:
|
||||
case BATTLEGROUND_RL:
|
||||
case BATTLEGROUND_DS:
|
||||
case BATTLEGROUND_RV:
|
||||
*data << uint32(0);
|
||||
break;
|
||||
default:
|
||||
if (BattlegroundMgr::getBgFromTypeID.find(bgTypeId) != BattlegroundMgr::getBgFromTypeID.end())
|
||||
BattlegroundMgr::getBgFromTypeID[bgTypeId](data, itr2, bg);
|
||||
else
|
||||
*data << uint32(0);
|
||||
break;
|
||||
}
|
||||
// should never happen
|
||||
if (++scoreCount >= bg->GetMaxPlayersPerTeam() * 2 && itr != bg->GetPlayerScoresEnd())
|
||||
{
|
||||
LOG_INFO("misc", "Battleground %u scoreboard has more entries (%u) than allowed players in this bg (%u)", bgTypeId, bg->GetPlayerScoresSize(), bg->GetMaxPlayersPerTeam() * 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
data->put(wpos, scoreCount);
|
||||
}
|
||||
|
||||
void BattlegroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket* data, GroupJoinBattlegroundResult result)
|
||||
{
|
||||
data->Initialize(SMSG_GROUP_JOINED_BATTLEGROUND, 4);
|
||||
@@ -386,19 +213,6 @@ void BattlegroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket* data, Grou
|
||||
*data << uint64(0); // player guid
|
||||
}
|
||||
|
||||
void BattlegroundMgr::BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value)
|
||||
{
|
||||
data->Initialize(SMSG_UPDATE_WORLD_STATE, 4 + 4);
|
||||
*data << uint32(field);
|
||||
*data << uint32(value);
|
||||
}
|
||||
|
||||
void BattlegroundMgr::BuildPlaySoundPacket(WorldPacket* data, uint32 soundid)
|
||||
{
|
||||
data->Initialize(SMSG_PLAY_SOUND, 4);
|
||||
*data << uint32(soundid);
|
||||
}
|
||||
|
||||
void BattlegroundMgr::BuildPlayerLeftBattlegroundPacket(WorldPacket* data, ObjectGuid guid)
|
||||
{
|
||||
data->Initialize(SMSG_BATTLEGROUND_PLAYER_LEFT, 8);
|
||||
@@ -440,7 +254,7 @@ uint32 BattlegroundMgr::GetNextClientVisibleInstanceId()
|
||||
// create a new battleground that will really be used to play
|
||||
Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId originalBgTypeId, uint32 minLevel, uint32 maxLevel, uint8 arenaType, bool isRated)
|
||||
{
|
||||
BattlegroundTypeId bgTypeId = GetRandomBG(originalBgTypeId);
|
||||
BattlegroundTypeId bgTypeId = GetRandomBG(originalBgTypeId, minLevel);
|
||||
|
||||
if (originalBgTypeId == BATTLEGROUND_AA)
|
||||
originalBgTypeId = bgTypeId;
|
||||
@@ -503,8 +317,8 @@ bool BattlegroundMgr::CreateBattleground(CreateBattlegroundData& data)
|
||||
bg->SetMinPlayersPerTeam(data.MinPlayersPerTeam);
|
||||
bg->SetMaxPlayersPerTeam(data.MaxPlayersPerTeam);
|
||||
bg->SetName(data.BattlegroundName);
|
||||
bg->SetTeamStartLoc(TEAM_ALLIANCE, data.Team1StartLocX, data.Team1StartLocY, data.Team1StartLocZ, data.Team1StartLocO);
|
||||
bg->SetTeamStartLoc(TEAM_HORDE, data.Team2StartLocX, data.Team2StartLocY, data.Team2StartLocZ, data.Team2StartLocO);
|
||||
bg->SetTeamStartPosition(TEAM_ALLIANCE, data.StartLocation[TEAM_ALLIANCE]);
|
||||
bg->SetTeamStartPosition(TEAM_HORDE, data.StartLocation[TEAM_HORDE]);
|
||||
bg->SetStartMaxDist(data.StartMaxDist);
|
||||
bg->SetLevelRange(data.LevelMin, data.LevelMax);
|
||||
bg->SetScriptId(data.scriptId);
|
||||
@@ -536,7 +350,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 bgTypeId = fields[0].GetUInt32();
|
||||
uint32 bgTypeId = fields[0].Get<uint32>();
|
||||
|
||||
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, bgTypeId, nullptr))
|
||||
continue;
|
||||
@@ -545,77 +359,60 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
|
||||
BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId);
|
||||
if (!bl)
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.", bgTypeId);
|
||||
LOG_ERROR("bg.battleground", "Battleground ID {} not found in BattlemasterList.dbc. Battleground not created.", bgTypeId);
|
||||
continue;
|
||||
}
|
||||
|
||||
CreateBattlegroundData data;
|
||||
data.bgTypeId = BattlegroundTypeId(bgTypeId);
|
||||
data.IsArena = (bl->type == TYPE_ARENA);
|
||||
data.MinPlayersPerTeam = fields[1].GetUInt16();
|
||||
data.MaxPlayersPerTeam = fields[2].GetUInt16();
|
||||
data.LevelMin = fields[3].GetUInt8();
|
||||
data.LevelMax = fields[4].GetUInt8();
|
||||
float dist = fields[9].GetFloat();
|
||||
data.MinPlayersPerTeam = fields[1].Get<uint16>();
|
||||
data.MaxPlayersPerTeam = fields[2].Get<uint16>();
|
||||
data.LevelMin = fields[3].Get<uint8>();
|
||||
data.LevelMax = fields[4].Get<uint8>();
|
||||
float dist = fields[9].Get<float>();
|
||||
data.StartMaxDist = dist * dist;
|
||||
data.Weight = fields[10].GetUInt8();
|
||||
data.Weight = fields[10].Get<uint8>();
|
||||
|
||||
data.scriptId = sObjectMgr->GetScriptId(fields[11].GetCString());
|
||||
data.scriptId = sObjectMgr->GetScriptId(fields[11].Get<std::string>());
|
||||
data.BattlegroundName = bl->name[sWorld->GetDefaultDbcLocale()];
|
||||
data.MapID = bl->mapid[0];
|
||||
|
||||
if (data.MaxPlayersPerTeam == 0 || data.MinPlayersPerTeam > data.MaxPlayersPerTeam)
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "Table `battleground_template` for id %u has bad values for MinPlayersPerTeam (%u) and MaxPlayersPerTeam(%u)",
|
||||
data.bgTypeId, data.MinPlayersPerTeam, data.MaxPlayersPerTeam);
|
||||
LOG_ERROR("bg.battleground", "Table `battleground_template` for id {} has bad values for MinPlayersPerTeam ({}) and MaxPlayersPerTeam({})",
|
||||
data.bgTypeId, data.MinPlayersPerTeam, data.MaxPlayersPerTeam);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (data.LevelMin == 0 || data.LevelMax == 0 || data.LevelMin > data.LevelMax)
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "Table `battleground_template` for id %u has bad values for LevelMin (%u) and LevelMax(%u)",
|
||||
data.bgTypeId, data.LevelMin, data.LevelMax);
|
||||
LOG_ERROR("bg.battleground", "Table `battleground_template` for id {} has bad values for LevelMin ({}) and LevelMax({})",
|
||||
data.bgTypeId, data.LevelMin, data.LevelMax);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (data.bgTypeId == BATTLEGROUND_AA || data.bgTypeId == BATTLEGROUND_RB)
|
||||
if (data.bgTypeId != BATTLEGROUND_AA && data.bgTypeId != BATTLEGROUND_RB)
|
||||
{
|
||||
data.Team1StartLocX = 0;
|
||||
data.Team1StartLocY = 0;
|
||||
data.Team1StartLocZ = 0;
|
||||
data.Team1StartLocO = fields[6].GetFloat();
|
||||
data.Team2StartLocX = 0;
|
||||
data.Team2StartLocY = 0;
|
||||
data.Team2StartLocZ = 0;
|
||||
data.Team2StartLocO = fields[8].GetFloat();
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32 startId = fields[5].GetUInt32();
|
||||
uint32 startId = fields[5].Get<uint32>();
|
||||
if (GraveyardStruct const* start = sGraveyard->GetGraveyard(startId))
|
||||
{
|
||||
data.Team1StartLocX = start->x;
|
||||
data.Team1StartLocY = start->y;
|
||||
data.Team1StartLocZ = start->z;
|
||||
data.Team1StartLocO = fields[6].GetFloat();
|
||||
data.StartLocation[TEAM_ALLIANCE].Relocate(start->x, start->y, start->z, fields[6].Get<float>());
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "Table `battleground_template` for id %u have non-existed `game_graveyard` table id %u in field `AllianceStartLoc`. BG not created.", data.bgTypeId, startId);
|
||||
LOG_ERROR("sql.sql", "Table `battleground_template` for id %u contains a non-existing WorldSafeLocs.dbc id %u in field `AllianceStartLoc`. BG not created.", data.bgTypeId, startId);
|
||||
continue;
|
||||
}
|
||||
|
||||
startId = fields[7].GetUInt32();
|
||||
startId = fields[7].Get<uint32>();
|
||||
if (GraveyardStruct const* start = sGraveyard->GetGraveyard(startId))
|
||||
{
|
||||
data.Team2StartLocX = start->x;
|
||||
data.Team2StartLocY = start->y;
|
||||
data.Team2StartLocZ = start->z;
|
||||
data.Team2StartLocO = fields[8].GetFloat();
|
||||
data.StartLocation[TEAM_HORDE].Relocate(start->x, start->y, start->z, fields[8].Get<float>());
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "Table `battleground_template` for id %u have non-existed `game_graveyard` table id %u in field `HordeStartLoc`. BG not created.", data.bgTypeId, startId);
|
||||
LOG_ERROR("sql.sql", "Table `battleground_template` for id %u contains a non-existing WorldSafeLocs.dbc id %u in field `HordeStartLoc`. BG not created.", data.bgTypeId, startId);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -631,7 +428,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
LOG_INFO("server.loading", ">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server.loading", ">> Loaded {} battlegrounds in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server.loading", " ");
|
||||
}
|
||||
|
||||
@@ -640,16 +437,21 @@ void BattlegroundMgr::InitAutomaticArenaPointDistribution()
|
||||
if (!sWorld->getBoolConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
|
||||
return;
|
||||
|
||||
time_t wstime = time_t(sWorld->getWorldState(WS_ARENA_DISTRIBUTION_TIME));
|
||||
time_t curtime = time(nullptr);
|
||||
Seconds wstime = Seconds(sWorld->getWorldState(WS_ARENA_DISTRIBUTION_TIME));
|
||||
Seconds curtime = GameTime::GetGameTime();
|
||||
|
||||
LOG_INFO("server.loading", "Initializing Automatic Arena Point Distribution");
|
||||
|
||||
if (wstime < curtime)
|
||||
{
|
||||
m_NextAutoDistributionTime = curtime; // reset will be called in the next update
|
||||
m_NextAutoDistributionTime = curtime; // reset will be called in the next update
|
||||
LOG_INFO("server.loading", "Next arena point distribution time in the past, reseting it now.");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_NextAutoDistributionTime = wstime;
|
||||
}
|
||||
|
||||
LOG_INFO("server.loading", "Automatic Arena Point Distribution initialized.");
|
||||
}
|
||||
|
||||
@@ -711,13 +513,19 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, ObjectGuid
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundMgr::SendToBattleground(Player* player, uint32 instanceId, BattlegroundTypeId /*bgTypeId*/)
|
||||
void BattlegroundMgr::SendToBattleground(Player* player, uint32 instanceId, BattlegroundTypeId bgTypeId)
|
||||
{
|
||||
if (Battleground* bg = GetBattleground(instanceId))
|
||||
{
|
||||
float x, y, z, o;
|
||||
bg->GetTeamStartLoc(player->GetBgTeamId(), x, y, z, o);
|
||||
player->TeleportTo(bg->GetMapId(), x, y, z, o);
|
||||
uint32 mapid = bg->GetMapId();
|
||||
Position const* pos = bg->GetTeamStartPosition(player->GetBgTeamId());
|
||||
|
||||
LOG_DEBUG("bg.battleground", "BattlegroundMgr::SendToBattleground: Sending {} to map {}, {} (bgType {})", player->GetName(), mapid, pos->ToString(), bgTypeId);
|
||||
player->TeleportTo(mapid, pos->GetPositionX(), pos->GetPositionY(), pos->GetPositionZ(), pos->GetOrientation());
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "BattlegroundMgr::SendToBattleground: Instance {} (bgType {}) not found while trying to teleport player {}", instanceId, bgTypeId, player->GetName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -868,22 +676,22 @@ void BattlegroundMgr::LoadBattleMastersEntry()
|
||||
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 entry = fields[0].GetUInt32();
|
||||
uint32 entry = fields[0].Get<uint32>();
|
||||
if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(entry))
|
||||
{
|
||||
if ((cInfo->npcflag & UNIT_NPC_FLAG_BATTLEMASTER) == 0)
|
||||
LOG_ERROR("sql.sql", "Creature (Entry: %u) listed in `battlemaster_entry` is not a battlemaster.", entry);
|
||||
LOG_ERROR("sql.sql", "Creature (Entry: {}) listed in `battlemaster_entry` is not a battlemaster.", entry);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Creature (Entry: %u) listed in `battlemaster_entry` does not exist.", entry);
|
||||
LOG_ERROR("sql.sql", "Creature (Entry: {}) listed in `battlemaster_entry` does not exist.", entry);
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32 bgTypeId = fields[1].GetUInt32();
|
||||
uint32 bgTypeId = fields[1].Get<uint32>();
|
||||
if (!sBattlemasterListStore.LookupEntry(bgTypeId))
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Table `battlemaster_entry` contain entry %u for not existed battleground type %u, ignored.", entry, bgTypeId);
|
||||
LOG_ERROR("sql.sql", "Table `battlemaster_entry` contain entry {} for not existed battleground type {}, ignored.", entry, bgTypeId);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -892,7 +700,7 @@ void BattlegroundMgr::LoadBattleMastersEntry()
|
||||
|
||||
CheckBattleMasters();
|
||||
|
||||
LOG_INFO("server.loading", ">> Loaded %u battlemaster entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server.loading", ">> Loaded {} battlemaster entries in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server.loading", " ");
|
||||
}
|
||||
|
||||
@@ -903,7 +711,7 @@ void BattlegroundMgr::CheckBattleMasters()
|
||||
{
|
||||
if ((itr->second.npcflag & UNIT_NPC_FLAG_BATTLEMASTER) && mBattleMastersMap.find(itr->second.Entry) == mBattleMastersMap.end())
|
||||
{
|
||||
LOG_ERROR("sql.sql", "CreatureTemplate (Entry: %u) has UNIT_NPC_FLAG_BATTLEMASTER but no data in `battlemaster_entry` table. Removing flag!", itr->second.Entry);
|
||||
LOG_ERROR("sql.sql", "CreatureTemplate (Entry: {}) has UNIT_NPC_FLAG_BATTLEMASTER but no data in `battlemaster_entry` table. Removing flag!", itr->second.Entry);
|
||||
const_cast<CreatureTemplate*>(&itr->second)->npcflag &= ~UNIT_NPC_FLAG_BATTLEMASTER;
|
||||
}
|
||||
}
|
||||
@@ -956,7 +764,7 @@ bool BattlegroundMgr::IsBGWeekend(BattlegroundTypeId bgTypeId)
|
||||
return IsHolidayActive(BGTypeToWeekendHolidayId(bgTypeId));
|
||||
}
|
||||
|
||||
BattlegroundTypeId BattlegroundMgr::GetRandomBG(BattlegroundTypeId bgTypeId)
|
||||
BattlegroundTypeId BattlegroundMgr::GetRandomBG(BattlegroundTypeId bgTypeId, uint32 minLevel)
|
||||
{
|
||||
if (GetBattlegroundTemplateByTypeId(bgTypeId))
|
||||
{
|
||||
@@ -973,8 +781,11 @@ BattlegroundTypeId BattlegroundMgr::GetRandomBG(BattlegroundTypeId bgTypeId)
|
||||
|
||||
if (CreateBattlegroundData const* bg = GetBattlegroundTemplateByMapId(mapId))
|
||||
{
|
||||
ids.push_back(bg->bgTypeId);
|
||||
weights.push_back(bg->Weight);
|
||||
if (bg->LevelMin <= minLevel)
|
||||
{
|
||||
ids.push_back(bg->bgTypeId);
|
||||
weights.push_back(bg->Weight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1002,60 +813,11 @@ void BattlegroundMgr::RemoveBattleground(BattlegroundTypeId bgTypeId, uint32 ins
|
||||
m_Battlegrounds.erase(instanceId);
|
||||
}
|
||||
|
||||
void BattlegroundMgr::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, TeamId teamId)
|
||||
void BattlegroundMgr::DoForAllBattlegrounds(std::function<void(Battleground*)> const& worker)
|
||||
{
|
||||
if (ginfo->IsInvitedToBGInstanceGUID)
|
||||
return;
|
||||
|
||||
// set side if needed
|
||||
if (teamId != TEAM_NEUTRAL)
|
||||
ginfo->teamId = teamId;
|
||||
|
||||
// set invitation
|
||||
ginfo->IsInvitedToBGInstanceGUID = bg->GetInstanceID();
|
||||
|
||||
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(ginfo->BgTypeId, ginfo->ArenaType);
|
||||
BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
|
||||
|
||||
// set ArenaTeamId for rated matches
|
||||
if (bg->isArena() && bg->isRated())
|
||||
bg->SetArenaTeamIdForTeam(ginfo->teamId, ginfo->ArenaTeamId);
|
||||
|
||||
ginfo->RemoveInviteTime = World::GetGameTimeMS() + INVITE_ACCEPT_WAIT_TIME;
|
||||
|
||||
// loop through the players
|
||||
for (auto itr : ginfo->Players)
|
||||
for (auto const& [_, bg] : m_Battlegrounds)
|
||||
{
|
||||
// get the player
|
||||
Player* player = ObjectAccessor::FindConnectedPlayer(itr);
|
||||
if (!player)
|
||||
continue;
|
||||
|
||||
// update average wait time
|
||||
bgQueue.PlayerInvitedToBGUpdateAverageWaitTime(ginfo);
|
||||
|
||||
// increase invited counter for each invited player
|
||||
bg->IncreaseInvitedCount(ginfo->teamId);
|
||||
|
||||
// create remind invite events
|
||||
BGQueueInviteEvent* inviteEvent = new BGQueueInviteEvent(player->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, ginfo->BgTypeId, ginfo->ArenaType, ginfo->RemoveInviteTime);
|
||||
bgQueue.AddEvent(inviteEvent, INVITATION_REMIND_TIME);
|
||||
// create automatic remove events
|
||||
BGQueueRemoveEvent* removeEvent = new BGQueueRemoveEvent(player->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgQueueTypeId, ginfo->RemoveInviteTime);
|
||||
bgQueue.AddEvent(removeEvent, INVITE_ACCEPT_WAIT_TIME);
|
||||
|
||||
// Check queueSlot
|
||||
uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId);
|
||||
ASSERT(queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES);
|
||||
|
||||
// send status packet
|
||||
WorldPacket data;
|
||||
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType, TEAM_NEUTRAL, bg->isRated(), ginfo->BgTypeId);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
|
||||
// pussywizard:
|
||||
if (bg->isArena() && bg->isRated())
|
||||
bg->ArenaLogEntries[player->GetGUID()].Fill(player->GetName().c_str(), player->GetGUID().GetCounter(), player->GetSession()->GetAccountId(), ginfo->ArenaTeamId, player->GetSession()->GetRemoteAddress());
|
||||
worker(bg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "CreatureAIImpl.h"
|
||||
#include "DBCEnums.h"
|
||||
#include <unordered_map>
|
||||
#include <functional>
|
||||
|
||||
typedef std::map<uint32, Battleground*> BattlegroundContainer;
|
||||
typedef std::unordered_map<uint32, BattlegroundTypeId> BattleMastersMap;
|
||||
@@ -32,8 +33,6 @@ typedef Battleground* (*bgRef)(Battleground*);
|
||||
typedef void(*bgMapRef)(WorldPacket*, Battleground::BattlegroundScoreMap::const_iterator);
|
||||
typedef void(*bgTypeRef)(WorldPacket*, Battleground::BattlegroundScoreMap::const_iterator, Battleground*);
|
||||
|
||||
#define BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY 86400 // how many seconds in day
|
||||
|
||||
struct CreateBattlegroundData
|
||||
{
|
||||
BattlegroundTypeId bgTypeId;
|
||||
@@ -44,15 +43,8 @@ struct CreateBattlegroundData
|
||||
uint32 LevelMax;
|
||||
char const* BattlegroundName;
|
||||
uint32 MapID;
|
||||
float Team1StartLocX;
|
||||
float Team1StartLocY;
|
||||
float Team1StartLocZ;
|
||||
float Team1StartLocO;
|
||||
float Team2StartLocX;
|
||||
float Team2StartLocY;
|
||||
float Team2StartLocZ;
|
||||
float Team2StartLocO;
|
||||
float StartMaxDist;
|
||||
std::array<Position, PVP_TEAMS_COUNT> StartLocation;
|
||||
uint32 scriptId;
|
||||
uint8 Weight;
|
||||
};
|
||||
@@ -75,10 +67,7 @@ public:
|
||||
void BuildPlayerLeftBattlegroundPacket(WorldPacket* data, ObjectGuid guid);
|
||||
void BuildBattlegroundListPacket(WorldPacket* data, ObjectGuid guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere);
|
||||
void BuildGroupJoinedBattlegroundPacket(WorldPacket* data, GroupJoinBattlegroundResult result);
|
||||
void BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value);
|
||||
void BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg);
|
||||
void BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, uint8 queueSlot, uint8 statusId, uint32 time1, uint32 time2, uint8 arenaType, TeamId teamId, bool isRated = false, BattlegroundTypeId forceBgTypeId = BATTLEGROUND_TYPE_NONE);
|
||||
void BuildPlaySoundPacket(WorldPacket* data, uint32 soundid);
|
||||
void SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, ObjectGuid guid);
|
||||
|
||||
/* Battlegrounds */
|
||||
@@ -99,8 +88,6 @@ public:
|
||||
void ScheduleArenaQueueUpdate(uint32 arenaRatedTeamId, BattlegroundQueueTypeId bgQueueTypeId, BattlegroundBracketId bracket_id);
|
||||
uint32 GetPrematureFinishTime() const;
|
||||
|
||||
static void InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, TeamId teamId);
|
||||
|
||||
void ToggleArenaTesting();
|
||||
void ToggleTesting();
|
||||
|
||||
@@ -141,10 +128,12 @@ public:
|
||||
static std::unordered_map<uint32, BattlegroundQueueTypeId> ArenaTypeToQueue; // ArenaType -> BattlegroundQueueTypeId
|
||||
static std::unordered_map<uint32, ArenaType> QueueToArenaType; // BattlegroundQueueTypeId -> ArenaType
|
||||
|
||||
void DoForAllBattlegrounds(std::function<void(Battleground*)> const& worker);
|
||||
|
||||
private:
|
||||
bool CreateBattleground(CreateBattlegroundData& data);
|
||||
uint32 GetNextClientVisibleInstanceId();
|
||||
BattlegroundTypeId GetRandomBG(BattlegroundTypeId id);
|
||||
BattlegroundTypeId GetRandomBG(BattlegroundTypeId id, uint32 minLevel);
|
||||
|
||||
typedef std::map<BattlegroundTypeId, Battleground*> BattlegroundTemplateContainer;
|
||||
BattlegroundTemplateContainer m_BattlegroundTemplates;
|
||||
@@ -156,7 +145,7 @@ private:
|
||||
bool m_ArenaTesting;
|
||||
bool m_Testing;
|
||||
uint32 m_lastClientVisibleInstanceId;
|
||||
time_t m_NextAutoDistributionTime;
|
||||
Seconds m_NextAutoDistributionTime;
|
||||
uint32 m_AutoDistributionTimeChecker;
|
||||
uint32 m_NextPeriodicQueueUpdateTime;
|
||||
BattleMastersMap mBattleMastersMap;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "BattlegroundSpamProtect.h"
|
||||
#include "Channel.h"
|
||||
#include "Chat.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
@@ -36,7 +37,7 @@
|
||||
|
||||
BattlegroundQueue::BattlegroundQueue() : m_bgTypeId(BATTLEGROUND_TYPE_NONE), m_arenaType(ArenaType(0))
|
||||
{
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; ++i)
|
||||
for (uint32 i = 0; i < PVP_TEAMS_COUNT; ++i)
|
||||
{
|
||||
for (uint32 j = 0; j < MAX_BATTLEGROUND_BRACKETS; ++j)
|
||||
{
|
||||
@@ -86,10 +87,10 @@ bool BattlegroundQueue::SelectionPool::KickGroup(const uint32 size)
|
||||
// find last group with proper size or largest
|
||||
bool foundProper = false;
|
||||
auto groupToKick = SelectedGroups.begin();
|
||||
for (auto itr = groupToKick; itr != SelectedGroups.end(); ++itr)
|
||||
for (auto& itr = groupToKick; itr != SelectedGroups.end(); ++itr)
|
||||
{
|
||||
// if proper size - overwrite to kick last one
|
||||
if (abs(int32((*itr)->Players.size()) - (int32)size) <= 1)
|
||||
if (std::abs(int32((*itr)->Players.size()) - (int32)size) <= 1)
|
||||
{
|
||||
groupToKick = itr;
|
||||
foundProper = true;
|
||||
@@ -138,7 +139,7 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, PvPDiffi
|
||||
ginfo->ArenaTeamId = arenateamid;
|
||||
ginfo->IsRated = isRated;
|
||||
ginfo->IsInvitedToBGInstanceGUID = 0;
|
||||
ginfo->JoinTime = World::GetGameTimeMS();
|
||||
ginfo->JoinTime = GameTime::GetGameTimeMS().count();
|
||||
ginfo->RemoveInviteTime = 0;
|
||||
ginfo->teamId = leader->GetTeamId();
|
||||
ginfo->RealTeamID = leader->GetTeamId(true);
|
||||
@@ -153,14 +154,14 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, PvPDiffi
|
||||
uint32 index = 0;
|
||||
|
||||
if (!isRated && !isPremade)
|
||||
index += BG_TEAMS_COUNT;
|
||||
index += PVP_TEAMS_COUNT;
|
||||
|
||||
if (ginfo->teamId == TEAM_HORDE)
|
||||
index++;
|
||||
|
||||
sScriptMgr->OnAddGroup(this, ginfo, index, leader, grp, bracketEntry, isPremade);
|
||||
|
||||
LOG_DEBUG("bg.battleground", "Adding Group to BattlegroundQueue bgTypeId: %u, bracket_id: %u, index: %u", m_bgTypeId, bracketId, index);
|
||||
LOG_DEBUG("bg.battleground", "Adding Group to BattlegroundQueue bgTypeId: {}, bracket_id: {}, index: {}", m_bgTypeId, bracketId, index);
|
||||
|
||||
// pussywizard: store indices at which GroupQueueInfo is in m_QueuedGroups
|
||||
ginfo->_bracketId = bracketId;
|
||||
@@ -205,7 +206,7 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, PvPDiffi
|
||||
|
||||
void BattlegroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo)
|
||||
{
|
||||
uint32 timeInQueue = std::max<uint32>(1, getMSTimeDiff(ginfo->JoinTime, World::GetGameTimeMS()));
|
||||
uint32 timeInQueue = std::max<uint32>(1, getMSTimeDiff(ginfo->JoinTime, GameTime::GetGameTimeMS().count()));
|
||||
|
||||
// team_index: bg alliance - TEAM_ALLIANCE, bg horde - TEAM_HORDE, arena skirmish - TEAM_ALLIANCE, arena rated - TEAM_HORDE
|
||||
uint8 team_index;
|
||||
@@ -421,7 +422,7 @@ void BattlegroundQueue::FillPlayersToBG(Battleground* bg, const int32 aliFree, c
|
||||
}
|
||||
|
||||
// balance the teams based on the difference allowed
|
||||
while (abs(aliDiff - hordeDiff) > invDiff && (m_SelectionPools[TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() > 0))
|
||||
while (std::abs(aliDiff - hordeDiff) > invDiff && (m_SelectionPools[TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() > 0))
|
||||
{
|
||||
// if results in more alliance players than horde:
|
||||
if (aliDiff < hordeDiff)
|
||||
@@ -452,88 +453,6 @@ void BattlegroundQueue::FillPlayersToBG(Battleground* bg, const int32 aliFree, c
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundQueue::FillPlayersToBGWithSpecific(Battleground* bg, const int32 aliFree, const int32 hordeFree, BattlegroundBracketId thisBracketId, BattlegroundQueue* specificQueue, BattlegroundBracketId specificBracketId)
|
||||
{
|
||||
if (!sScriptMgr->CanFillPlayersToBGWithSpecific(this, bg, aliFree, hordeFree, thisBracketId, specificQueue, specificBracketId))
|
||||
return;
|
||||
|
||||
// clear selection pools
|
||||
m_SelectionPools[TEAM_ALLIANCE].Init();
|
||||
m_SelectionPools[TEAM_HORDE].Init();
|
||||
|
||||
// quick check if nothing we can do:
|
||||
if (!sBattlegroundMgr->isTesting())
|
||||
if ((m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_ALLIANCE].empty() && specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_ALLIANCE].empty()) ||
|
||||
(m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_HORDE].empty() && specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_HORDE].empty()))
|
||||
return;
|
||||
|
||||
// copy groups from both queues to new joined container
|
||||
GroupsQueueType m_QueuedBoth[BG_TEAMS_COUNT];
|
||||
m_QueuedBoth[TEAM_ALLIANCE].insert(m_QueuedBoth[TEAM_ALLIANCE].end(), specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_ALLIANCE].begin(), specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_ALLIANCE].end());
|
||||
m_QueuedBoth[TEAM_ALLIANCE].insert(m_QueuedBoth[TEAM_ALLIANCE].end(), m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_ALLIANCE].begin(), m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_ALLIANCE].end());
|
||||
m_QueuedBoth[TEAM_HORDE].insert(m_QueuedBoth[TEAM_HORDE].end(), specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_HORDE].begin(), specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_HORDE].end());
|
||||
m_QueuedBoth[TEAM_HORDE].insert(m_QueuedBoth[TEAM_HORDE].end(), m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_HORDE].begin(), m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_HORDE].end());
|
||||
|
||||
// ally: at first fill as much as possible
|
||||
auto Ali_itr = m_QueuedBoth[TEAM_ALLIANCE].begin();
|
||||
for (; Ali_itr != m_QueuedBoth[TEAM_ALLIANCE].end() && m_SelectionPools[TEAM_ALLIANCE].AddGroup((*Ali_itr), aliFree); ++Ali_itr);
|
||||
|
||||
// horde: at first fill as much as possible
|
||||
auto Horde_itr = m_QueuedBoth[TEAM_HORDE].begin();
|
||||
for (; Horde_itr != m_QueuedBoth[TEAM_HORDE].end() && m_SelectionPools[TEAM_HORDE].AddGroup((*Horde_itr), hordeFree); ++Horde_itr);
|
||||
|
||||
// calculate free space after adding
|
||||
int32 aliDiff = aliFree - int32(m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount());
|
||||
int32 hordeDiff = hordeFree - int32(m_SelectionPools[TEAM_HORDE].GetPlayerCount());
|
||||
|
||||
int32 invType = sWorld->getIntConfig(CONFIG_BATTLEGROUND_INVITATION_TYPE);
|
||||
int32 invDiff = 0;
|
||||
|
||||
// check balance configuration and set the max difference between teams
|
||||
switch (invType)
|
||||
{
|
||||
case BG_QUEUE_INVITATION_TYPE_NO_BALANCE:
|
||||
return;
|
||||
case BG_QUEUE_INVITATION_TYPE_BALANCED:
|
||||
invDiff = 1;
|
||||
break;
|
||||
case BG_QUEUE_INVITATION_TYPE_EVEN:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
// if free space differs too much, ballance
|
||||
while (abs(aliDiff - hordeDiff) > invDiff && (m_SelectionPools[TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() > 0))
|
||||
{
|
||||
// if results in more alliance players than horde:
|
||||
if (aliDiff < hordeDiff)
|
||||
{
|
||||
// no more alliance in pool, invite whatever we can from horde
|
||||
if (!m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount())
|
||||
break;
|
||||
|
||||
// kick alliance, returns true if kicked more than needed, so then try to fill up
|
||||
if (m_SelectionPools[TEAM_ALLIANCE].KickGroup(hordeDiff - aliDiff))
|
||||
for (; Ali_itr != m_QueuedBoth[TEAM_ALLIANCE].end() && m_SelectionPools[TEAM_ALLIANCE].AddGroup((*Ali_itr), aliFree >= hordeDiff ? aliFree - hordeDiff : 0); ++Ali_itr);
|
||||
}
|
||||
else // if results in more horde players than alliance:
|
||||
{
|
||||
// no more horde in pool, invite whatever we can from alliance
|
||||
if (!m_SelectionPools[TEAM_HORDE].GetPlayerCount())
|
||||
break;
|
||||
|
||||
// kick horde, returns true if kicked more than needed, so then try to fill up
|
||||
if (m_SelectionPools[TEAM_HORDE].KickGroup(aliDiff - hordeDiff))
|
||||
for (; Horde_itr != m_QueuedBoth[TEAM_HORDE].end() && m_SelectionPools[TEAM_HORDE].AddGroup((*Horde_itr), hordeFree >= aliDiff ? hordeFree - aliDiff : 0); ++Horde_itr);
|
||||
}
|
||||
|
||||
// recalculate free space after adding
|
||||
aliDiff = aliFree - static_cast<int32>(m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount());
|
||||
hordeDiff = hordeFree - static_cast<int32>(m_SelectionPools[TEAM_HORDE].GetPlayerCount());
|
||||
}
|
||||
}
|
||||
|
||||
// this method checks if premade versus premade battleground is possible
|
||||
// then after 30 mins (default) in queue it moves premade group to normal queue
|
||||
bool BattlegroundQueue::CheckPremadeMatch(BattlegroundBracketId bracket_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam)
|
||||
@@ -570,9 +489,9 @@ bool BattlegroundQueue::CheckPremadeMatch(BattlegroundBracketId bracket_id, uint
|
||||
// this happens if timer has expired or group size lowered
|
||||
|
||||
uint32 premade_time = sWorld->getIntConfig(CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH);
|
||||
uint32 time_before = World::GetGameTimeMS() >= premade_time ? World::GetGameTimeMS() - premade_time : 0;
|
||||
uint32 time_before = GameTime::GetGameTimeMS().count() >= premade_time ? GameTime::GetGameTimeMS().count() - premade_time : 0;
|
||||
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
for (uint32 i = 0; i < PVP_TEAMS_COUNT; i++)
|
||||
if (!m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE + i].empty())
|
||||
for (auto itr = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE + i].begin(); itr != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE + i].end(); )
|
||||
{
|
||||
@@ -610,7 +529,7 @@ bool BattlegroundQueue::CheckNormalMatch(Battleground* bgTemplate, BattlegroundB
|
||||
return m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= minPlayers;
|
||||
|
||||
case BG_QUEUE_INVITATION_TYPE_BALANCED: // check difference between selection pools - if = 1 or less start.
|
||||
return abs(static_cast<int32>(m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount()) - static_cast<int32>(m_SelectionPools[TEAM_HORDE].GetPlayerCount())) <= 1 && m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= minPlayers;
|
||||
return std::abs(static_cast<int32>(m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount()) - static_cast<int32>(m_SelectionPools[TEAM_HORDE].GetPlayerCount())) <= 1 && m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= minPlayers;
|
||||
|
||||
case BG_QUEUE_INVITATION_TYPE_EVEN: // if both counts are same then it's an even match
|
||||
return (m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() == m_SelectionPools[TEAM_HORDE].GetPlayerCount()) && m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= minPlayers;
|
||||
@@ -623,7 +542,7 @@ bool BattlegroundQueue::CheckNormalMatch(Battleground* bgTemplate, BattlegroundB
|
||||
// this method will check if we can invite players to same faction skirmish match
|
||||
bool BattlegroundQueue::CheckSkirmishForSameFaction(BattlegroundBracketId bracket_id, uint32 minPlayersPerTeam)
|
||||
{
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
for (uint32 i = 0; i < PVP_TEAMS_COUNT; i++)
|
||||
if (!m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].empty())
|
||||
{
|
||||
// clear selection pools
|
||||
@@ -632,7 +551,7 @@ bool BattlegroundQueue::CheckSkirmishForSameFaction(BattlegroundBracketId bracke
|
||||
|
||||
// fill one queue to both selection pools
|
||||
for (auto itr = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].begin(); itr != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].end(); ++itr)
|
||||
for (uint32 j = 0; j < BG_TEAMS_COUNT; j++) // try to add this group to both pools
|
||||
for (uint32 j = 0; j < PVP_TEAMS_COUNT; j++) // try to add this group to both pools
|
||||
if (m_SelectionPools[TEAM_ALLIANCE + j].GetPlayerCount() < minPlayersPerTeam) // if this pool is not full
|
||||
if (m_SelectionPools[TEAM_ALLIANCE + j].AddGroup((*itr), minPlayersPerTeam)) // successfully added
|
||||
{
|
||||
@@ -675,9 +594,6 @@ void BattlegroundQueue::UpdateEvents(uint32 diff)
|
||||
m_events.Update(diff);
|
||||
}
|
||||
|
||||
struct BgEmptinessComp { bool operator()(Battleground* const& bg1, Battleground* const& bg2) const { return ((float)bg1->GetMaxFreeSlots() / (float)bg1->GetMaxPlayersPerTeam()) > ((float)bg2->GetMaxFreeSlots() / (float)bg2->GetMaxPlayersPerTeam()); } };
|
||||
typedef std::set<Battleground*, BgEmptinessComp> BattlegroundNeedSet;
|
||||
|
||||
void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundBracketId bracket_id, bool isRated, uint32 arenaRatedTeamId)
|
||||
{
|
||||
// if no players in queue - do nothing
|
||||
@@ -695,28 +611,35 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundBracket
|
||||
// battlegrounds with free slots should be populated first using players in queue
|
||||
if (!BattlegroundMgr::IsArenaType(m_bgTypeId))
|
||||
{
|
||||
const BattlegroundContainer& bgList = sBattlegroundMgr->GetBattlegroundList();
|
||||
BattlegroundNeedSet bgsToCheck;
|
||||
std::vector<Battleground*> bgsToCheck;
|
||||
|
||||
// sort from most needing (most empty) to least needing using a std::set with functor
|
||||
for (auto itr : bgList)
|
||||
sBattlegroundMgr->DoForAllBattlegrounds([&](Battleground* bg)
|
||||
{
|
||||
Battleground* bg = itr.second;
|
||||
if (!BattlegroundMgr::IsArenaType(bg->GetBgTypeID()) && (bg->GetBgTypeID(true) == m_bgTypeId || m_bgTypeId == BATTLEGROUND_RB) &&
|
||||
bg->HasFreeSlots() && bg->GetMinLevel() <= bracketEntry->minLevel && bg->GetMaxLevel() >= bracketEntry->maxLevel)
|
||||
bgsToCheck.insert(bg);
|
||||
}
|
||||
if (!BattlegroundMgr::IsArenaType(bg->GetBgTypeID()) &&
|
||||
(bg->GetBgTypeID(true) == m_bgTypeId || m_bgTypeId == BATTLEGROUND_RB) &&
|
||||
bg->HasFreeSlots() && bg->GetMinLevel() <= bracketEntry->minLevel &&
|
||||
bg->GetMaxLevel() >= bracketEntry->maxLevel)
|
||||
{
|
||||
bgsToCheck.emplace_back(bg);
|
||||
}
|
||||
});
|
||||
|
||||
std::sort(bgsToCheck.begin(), bgsToCheck.end(), [](Battleground* const& bg1, Battleground* const& bg2)
|
||||
{
|
||||
return ((float)bg1->GetMaxFreeSlots() / (float)bg1->GetMaxPlayersPerTeam()) > ((float)bg2->GetMaxFreeSlots() / (float)bg2->GetMaxPlayersPerTeam());
|
||||
});
|
||||
|
||||
// now iterate needing battlegrounds
|
||||
for (auto bg : bgsToCheck)
|
||||
for (auto const& bg : bgsToCheck)
|
||||
{
|
||||
// call a function that fills whatever we can from normal queues
|
||||
FillPlayersToBG(bg, bg->GetFreeSlotsForTeam(TEAM_ALLIANCE), bg->GetFreeSlotsForTeam(TEAM_HORDE), bracket_id);
|
||||
|
||||
// invite players
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
for (uint32 i = 0; i < PVP_TEAMS_COUNT; i++)
|
||||
for (auto itr : m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups)
|
||||
BattlegroundMgr::InviteGroupToBG(itr, bg, itr->RealTeamID);
|
||||
InviteGroupToBG(itr, bg, itr->RealTeamID);
|
||||
}
|
||||
|
||||
// prevent new BGs to be created if there are some non-empty BGs running
|
||||
@@ -750,9 +673,9 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundBracket
|
||||
return;
|
||||
|
||||
// invite players
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
for (uint32 i = 0; i < PVP_TEAMS_COUNT; i++)
|
||||
for (auto& SelectedGroup : m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups)
|
||||
BattlegroundMgr::InviteGroupToBG(SelectedGroup, bg, SelectedGroup->teamId);
|
||||
InviteGroupToBG(SelectedGroup, bg, SelectedGroup->teamId);
|
||||
|
||||
bg->StartBattleground();
|
||||
|
||||
@@ -763,9 +686,9 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundBracket
|
||||
FillPlayersToBG(bg, bg->GetFreeSlotsForTeam(TEAM_ALLIANCE), bg->GetFreeSlotsForTeam(TEAM_HORDE), bracket_id);
|
||||
|
||||
// invite players
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
for (uint32 i = 0; i < PVP_TEAMS_COUNT; i++)
|
||||
for (auto& SelectedGroup : m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups)
|
||||
BattlegroundMgr::InviteGroupToBG(SelectedGroup, bg, SelectedGroup->teamId);
|
||||
InviteGroupToBG(SelectedGroup, bg, SelectedGroup->teamId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -785,9 +708,9 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundBracket
|
||||
return;
|
||||
|
||||
// invite players
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
for (uint32 i = 0; i < PVP_TEAMS_COUNT; i++)
|
||||
for (auto& SelectedGroup : m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups)
|
||||
BattlegroundMgr::InviteGroupToBG(SelectedGroup, bg, SelectedGroup->teamId);
|
||||
InviteGroupToBG(SelectedGroup, bg, SelectedGroup->teamId);
|
||||
|
||||
bg->StartBattleground();
|
||||
}
|
||||
@@ -797,13 +720,13 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundBracket
|
||||
{
|
||||
// pussywizard: everything inside this section is mine, do NOT destroy!
|
||||
|
||||
const uint32 currMSTime = World::GetGameTimeMS();
|
||||
const uint32 currMSTime = GameTime::GetGameTimeMS().count();
|
||||
const uint32 discardTime = sBattlegroundMgr->GetRatingDiscardTimer();
|
||||
const uint32 maxDefaultRatingDifference = (MaxPlayersPerTeam > 2 ? 300 : 200);
|
||||
const uint32 maxCountedMMR = 2500;
|
||||
|
||||
// we need to find 2 teams which will play next game
|
||||
GroupsQueueType::iterator itr_teams[BG_TEAMS_COUNT];
|
||||
GroupsQueueType::iterator itr_teams[PVP_TEAMS_COUNT];
|
||||
|
||||
bool increaseItr = true;
|
||||
bool reverse1 = urand(0, 1) != 0;
|
||||
@@ -936,8 +859,8 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundBracket
|
||||
|
||||
arena->SetArenaMatchmakerRating(TEAM_ALLIANCE, aTeam->ArenaMatchmakerRating);
|
||||
arena->SetArenaMatchmakerRating(TEAM_HORDE, hTeam->ArenaMatchmakerRating);
|
||||
BattlegroundMgr::InviteGroupToBG(aTeam, arena, TEAM_ALLIANCE);
|
||||
BattlegroundMgr::InviteGroupToBG(hTeam, arena, TEAM_HORDE);
|
||||
InviteGroupToBG(aTeam, arena, TEAM_ALLIANCE);
|
||||
InviteGroupToBG(hTeam, arena, TEAM_HORDE);
|
||||
|
||||
arena->StartBattleground();
|
||||
}
|
||||
@@ -979,12 +902,12 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundBracket
|
||||
{
|
||||
_queueAnnouncementTimer[bracket_id] = -1;
|
||||
|
||||
char const* bgName = bg_template->GetName();
|
||||
auto bgName = bg_template->GetName();
|
||||
uint32 MaxPlayers = bg_template->GetMinPlayersPerTeam() * 2;
|
||||
uint32 q_min_level = std::min(bracketEntry->minLevel, (uint32) 80);
|
||||
uint32 q_max_level = std::min(bracketEntry->maxLevel, (uint32) 80);
|
||||
|
||||
sWorld->SendWorldText(LANG_BG_QUEUE_ANNOUNCE_WORLD, bgName, q_min_level, q_max_level, qPlayers, MaxPlayers);
|
||||
sWorld->SendWorldTextOptional(LANG_BG_QUEUE_ANNOUNCE_WORLD, ANNOUNCER_FLAG_DISABLE_BG_QUEUE, bgName.c_str(), q_min_level, q_max_level, qPlayers, MaxPlayers);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1030,7 +953,7 @@ void BattlegroundQueue::SendMessageBGQueue(Player* leader, Battleground* bg, PvP
|
||||
}
|
||||
|
||||
BattlegroundBracketId bracketId = bracketEntry->GetBracketId();
|
||||
char const* bgName = bg->GetName();
|
||||
auto bgName = bg->GetName();
|
||||
uint32 MinPlayers = bg->GetMinPlayersPerTeam();
|
||||
uint32 MaxPlayers = MinPlayers * 2;
|
||||
uint32 q_min_level = std::min(bracketEntry->minLevel, (uint32)80);
|
||||
@@ -1039,18 +962,15 @@ void BattlegroundQueue::SendMessageBGQueue(Player* leader, Battleground* bg, PvP
|
||||
uint32 qAlliance = GetPlayersCountInGroupsQueue(bracketId, BG_QUEUE_NORMAL_ALLIANCE);
|
||||
auto qTotal = qHorde + qAlliance;
|
||||
|
||||
LOG_DEBUG("bg.battleground", "> Queue status for %s (Lvl: %u to %u) Queued: %u (Need at least %u more)",
|
||||
LOG_DEBUG("bg.battleground", "> Queue status for {} (Lvl: {} to {}) Queued: {} (Need at least {} more)",
|
||||
bgName, q_min_level, q_max_level, qAlliance + qHorde, MaxPlayers - qTotal);
|
||||
|
||||
// Show queue status to player only (when joining battleground queue or Arena and arena world announcer is disabled)
|
||||
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY))
|
||||
{
|
||||
ChatHandler(leader->GetSession()).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_SELF, bgName, q_min_level, q_max_level,
|
||||
qAlliance,
|
||||
(MinPlayers > qAlliance) ? MinPlayers - qAlliance : (uint32)0,
|
||||
qHorde,
|
||||
(MinPlayers > qHorde) ? MinPlayers - qHorde : (uint32)0
|
||||
);
|
||||
ChatHandler(leader->GetSession()).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_SELF, bgName.c_str(), q_min_level, q_max_level,
|
||||
qAlliance, (MinPlayers > qAlliance) ? MinPlayers - qAlliance : (uint32)0,
|
||||
qHorde, (MinPlayers > qHorde) ? MinPlayers - qHorde : (uint32)0);
|
||||
}
|
||||
else // Show queue status to server (when joining battleground queue)
|
||||
{
|
||||
@@ -1068,7 +988,7 @@ void BattlegroundQueue::SendMessageBGQueue(Player* leader, Battleground* bg, PvP
|
||||
return;
|
||||
}
|
||||
|
||||
sWorld->SendWorldText(LANG_BG_QUEUE_ANNOUNCE_WORLD, bgName, q_min_level, q_max_level, qAlliance + qHorde, MaxPlayers);
|
||||
sWorld->SendWorldTextOptional(LANG_BG_QUEUE_ANNOUNCE_WORLD, ANNOUNCER_FLAG_DISABLE_BG_QUEUE, bgName.c_str(), q_min_level, q_max_level, qAlliance + qHorde, MaxPlayers);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1086,7 +1006,7 @@ void BattlegroundQueue::SendJoinMessageArenaQueue(Player* leader, GroupQueueInfo
|
||||
Battleground* bg = sBattlegroundMgr->GetBattlegroundTemplate(ginfo->BgTypeId);
|
||||
if (!bg)
|
||||
{
|
||||
LOG_ERROR("bg.arena", "> Not found bg template for bgtype id %u", uint32(ginfo->BgTypeId));
|
||||
LOG_ERROR("bg.arena", "> Not found bg template for bgtype id {}", uint32(ginfo->BgTypeId));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1104,8 +1024,8 @@ void BattlegroundQueue::SendJoinMessageArenaQueue(Player* leader, GroupQueueInfo
|
||||
uint32 q_max_level = std::min(bracketEntry->maxLevel, (uint32)80);
|
||||
uint32 qPlayers = GetPlayersCountInGroupsQueue(bracketId, BG_QUEUE_NORMAL_HORDE) + GetPlayersCountInGroupsQueue(bracketId, BG_QUEUE_NORMAL_ALLIANCE);
|
||||
|
||||
LOG_DEBUG("bg.arena", "> Queue status for %s (skirmish %s) (Lvl: %u to %u) Queued: %u (Need at least %u more)",
|
||||
bgName, arenatype.c_str(), q_min_level, q_max_level, qPlayers, playersNeed - qPlayers);
|
||||
LOG_DEBUG("bg.arena", "> Queue status for {} (skirmish {}) (Lvl: {} to {}) Queued: {} (Need at least {} more)",
|
||||
bgName, arenatype, q_min_level, q_max_level, qPlayers, playersNeed - qPlayers);
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_PLAYERONLY))
|
||||
{
|
||||
@@ -1119,7 +1039,7 @@ void BattlegroundQueue::SendJoinMessageArenaQueue(Player* leader, GroupQueueInfo
|
||||
return;
|
||||
}
|
||||
|
||||
sWorld->SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD, bgName, arenatype.c_str(), q_min_level, q_max_level, qPlayers, playersNeed);
|
||||
sWorld->SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, bgName.c_str(), arenatype.c_str(), q_min_level, q_max_level, qPlayers, playersNeed);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1134,7 +1054,7 @@ void BattlegroundQueue::SendJoinMessageArenaQueue(Player* leader, GroupQueueInfo
|
||||
uint32 ArenaTeamRating = ginfo->ArenaTeamRating;
|
||||
std::string TeamName = team->GetName();
|
||||
|
||||
sWorld->SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN, TeamName.c_str(), ArenaType, ArenaType, ArenaTeamRating);
|
||||
sWorld->SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, TeamName.c_str(), ArenaType, ArenaType, ArenaTeamRating);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1158,7 +1078,9 @@ void BattlegroundQueue::SendExitMessageArenaQueue(GroupQueueInfo* ginfo)
|
||||
std::string TeamName = team->GetName();
|
||||
|
||||
if (ArenaType && ginfo->Players.empty())
|
||||
sWorld->SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT, TeamName.c_str(), ArenaType, ArenaType, ArenaTeamRating);
|
||||
{
|
||||
sWorld->SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, TeamName.c_str(), ArenaType, ArenaType, ArenaTeamRating);
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundQueue::SetQueueAnnouncementTimer(uint32 bracketId, int32 timer, bool isCrossFactionBG /*= true*/)
|
||||
@@ -1172,6 +1094,63 @@ int32 BattlegroundQueue::GetQueueAnnouncementTimer(uint32 bracketId) const
|
||||
return _queueAnnouncementTimer[bracketId];
|
||||
}
|
||||
|
||||
void BattlegroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, TeamId teamId)
|
||||
{
|
||||
if (ginfo->IsInvitedToBGInstanceGUID)
|
||||
return;
|
||||
|
||||
// set side if needed
|
||||
if (teamId != TEAM_NEUTRAL)
|
||||
ginfo->teamId = teamId;
|
||||
|
||||
// set invitation
|
||||
ginfo->IsInvitedToBGInstanceGUID = bg->GetInstanceID();
|
||||
|
||||
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(ginfo->BgTypeId, ginfo->ArenaType);
|
||||
BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
|
||||
|
||||
// set ArenaTeamId for rated matches
|
||||
if (bg->isArena() && bg->isRated())
|
||||
bg->SetArenaTeamIdForTeam(ginfo->teamId, ginfo->ArenaTeamId);
|
||||
|
||||
ginfo->RemoveInviteTime = GameTime::GetGameTimeMS().count() + INVITE_ACCEPT_WAIT_TIME;
|
||||
|
||||
// loop through the players
|
||||
for (auto const& itr : ginfo->Players)
|
||||
{
|
||||
// get the player
|
||||
Player* player = ObjectAccessor::FindConnectedPlayer(itr);
|
||||
if (!player)
|
||||
continue;
|
||||
|
||||
// update average wait time
|
||||
bgQueue.PlayerInvitedToBGUpdateAverageWaitTime(ginfo);
|
||||
|
||||
// increase invited counter for each invited player
|
||||
bg->IncreaseInvitedCount(ginfo->teamId);
|
||||
|
||||
// create remind invite events
|
||||
BGQueueInviteEvent* inviteEvent = new BGQueueInviteEvent(player->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, ginfo->BgTypeId, ginfo->ArenaType, ginfo->RemoveInviteTime);
|
||||
bgQueue.AddEvent(inviteEvent, INVITATION_REMIND_TIME);
|
||||
// create automatic remove events
|
||||
BGQueueRemoveEvent* removeEvent = new BGQueueRemoveEvent(player->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgQueueTypeId, ginfo->RemoveInviteTime);
|
||||
bgQueue.AddEvent(removeEvent, INVITE_ACCEPT_WAIT_TIME);
|
||||
|
||||
// Check queueSlot
|
||||
uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId);
|
||||
ASSERT(queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES);
|
||||
|
||||
// send status packet
|
||||
WorldPacket data;
|
||||
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType, TEAM_NEUTRAL, bg->isRated(), ginfo->BgTypeId);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
|
||||
// pussywizard:
|
||||
if (bg->isArena() && bg->isRated())
|
||||
bg->ArenaLogEntries[player->GetGUID()].Fill(player->GetName().c_str(), player->GetGUID().GetCounter(), player->GetSession()->GetAccountId(), ginfo->ArenaTeamId, player->GetSession()->GetRemoteAddress());
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************/
|
||||
/*** BATTLEGROUND QUEUE EVENTS ***/
|
||||
/*********************************************************/
|
||||
@@ -1240,8 +1219,8 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_TRACK_DESERTERS))
|
||||
{
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_DESERTER_TRACK);
|
||||
stmt->setUInt32(0, player->GetGUID().GetCounter());
|
||||
stmt->setUInt8(1, BG_DESERTION_TYPE_NO_ENTER_BUTTON);
|
||||
stmt->SetData(0, player->GetGUID().GetCounter());
|
||||
stmt->SetData(1, BG_DESERTION_TYPE_NO_ENTER_BUTTON);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,6 @@ public:
|
||||
void UpdateEvents(uint32 diff);
|
||||
|
||||
void FillPlayersToBG(Battleground* bg, int32 aliFree, int32 hordeFree, BattlegroundBracketId bracket_id);
|
||||
void FillPlayersToBGWithSpecific(Battleground* bg, int32 aliFree, int32 hordeFree, BattlegroundBracketId thisBracketId, BattlegroundQueue* specificQueue, BattlegroundBracketId specificBracketId);
|
||||
bool CheckPremadeMatch(BattlegroundBracketId bracket_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam);
|
||||
bool CheckNormalMatch(Battleground* bgTemplate, BattlegroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers);
|
||||
bool CheckSkirmishForSameFaction(BattlegroundBracketId bracket_id, uint32 minPlayersPerTeam);
|
||||
@@ -83,6 +82,7 @@ public:
|
||||
bool GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo* ginfo);
|
||||
void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo);
|
||||
uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo) const;
|
||||
void InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, TeamId teamId);
|
||||
[[nodiscard]] uint32 GetPlayersCountInGroupsQueue(BattlegroundBracketId bracketId, BattlegroundQueueGroupTypes bgqueue);
|
||||
[[nodiscard]] bool IsAllQueuesEmpty(BattlegroundBracketId bracket_id);
|
||||
void SendMessageBGQueue(Player* leader, Battleground* bg, PvPDifficultyEntry const* bracketEntry);
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
};
|
||||
|
||||
//one selection pool for horde, other one for alliance
|
||||
SelectionPool m_SelectionPools[BG_TEAMS_COUNT];
|
||||
SelectionPool m_SelectionPools[PVP_TEAMS_COUNT];
|
||||
|
||||
ArenaType GetArenaType() { return m_arenaType; }
|
||||
BattlegroundTypeId GetBGTypeID() { return m_bgTypeId; }
|
||||
@@ -136,8 +136,8 @@ public:
|
||||
private:
|
||||
BattlegroundTypeId m_bgTypeId;
|
||||
ArenaType m_arenaType;
|
||||
uint32 m_WaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME];
|
||||
uint32 m_WaitTimeLastIndex[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS];
|
||||
uint32 m_WaitTimes[PVP_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME];
|
||||
uint32 m_WaitTimeLastIndex[PVP_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS];
|
||||
|
||||
// Event handler
|
||||
EventProcessor m_events;
|
||||
|
||||
125
src/server/game/Battlegrounds/BattlegroundScore.h
Normal file
125
src/server/game/Battlegrounds/BattlegroundScore.h
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _BATTLEGROUND_SCORE_H
|
||||
#define _BATTLEGROUND_SCORE_H
|
||||
|
||||
#include "Errors.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "SharedDefines.h"
|
||||
|
||||
class WorldPacket;
|
||||
|
||||
enum ScoreType
|
||||
{
|
||||
SCORE_KILLING_BLOWS = 1,
|
||||
SCORE_DEATHS,
|
||||
SCORE_HONORABLE_KILLS,
|
||||
SCORE_BONUS_HONOR,
|
||||
SCORE_DAMAGE_DONE,
|
||||
SCORE_HEALING_DONE,
|
||||
|
||||
// WS and EY
|
||||
SCORE_FLAG_CAPTURES,
|
||||
SCORE_FLAG_RETURNS,
|
||||
|
||||
// AB and IC
|
||||
SCORE_BASES_ASSAULTED,
|
||||
SCORE_BASES_DEFENDED,
|
||||
|
||||
// AV
|
||||
SCORE_GRAVEYARDS_ASSAULTED,
|
||||
SCORE_GRAVEYARDS_DEFENDED,
|
||||
SCORE_TOWERS_ASSAULTED,
|
||||
SCORE_TOWERS_DEFENDED,
|
||||
SCORE_MINES_CAPTURED,
|
||||
//SCORE_LEADERS_KILLED,
|
||||
//SCORE_SECONDARY_OBJECTIVES,
|
||||
|
||||
// SOTA
|
||||
SCORE_DESTROYED_DEMOLISHER,
|
||||
SCORE_DESTROYED_WALL
|
||||
};
|
||||
|
||||
struct AC_GAME_API BattlegroundScore
|
||||
{
|
||||
friend class Arena;
|
||||
friend class Battleground;
|
||||
|
||||
protected:
|
||||
BattlegroundScore(ObjectGuid playerGuid) : PlayerGuid(playerGuid) { }
|
||||
virtual ~BattlegroundScore() = default;
|
||||
|
||||
virtual void UpdateScore(uint32 type, uint32 value)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_KILLING_BLOWS: // Killing blows
|
||||
KillingBlows += value;
|
||||
break;
|
||||
case SCORE_DEATHS: // Deaths
|
||||
Deaths += value;
|
||||
break;
|
||||
case SCORE_HONORABLE_KILLS: // Honorable kills
|
||||
HonorableKills += value;
|
||||
break;
|
||||
case SCORE_BONUS_HONOR: // Honor bonus
|
||||
BonusHonor += value;
|
||||
break;
|
||||
case SCORE_DAMAGE_DONE: // Damage Done
|
||||
DamageDone += value;
|
||||
break;
|
||||
case SCORE_HEALING_DONE: // Healing Done
|
||||
HealingDone += value;
|
||||
break;
|
||||
default:
|
||||
ABORT("Not implemented Battleground score type!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void AppendToPacket(WorldPacket& data);
|
||||
virtual void BuildObjectivesBlock(WorldPacket& /*data*/) = 0;
|
||||
|
||||
// For Logging purpose
|
||||
virtual std::string ToString() const { return ""; }
|
||||
|
||||
[[nodiscard]] uint32 GetKillingBlows() const { return KillingBlows; }
|
||||
[[nodiscard]] uint32 GetDeaths() const { return Deaths; }
|
||||
[[nodiscard]] uint32 GetHonorableKills() const { return HonorableKills; }
|
||||
[[nodiscard]] uint32 GetBonusHonor() const { return BonusHonor; }
|
||||
[[nodiscard]] uint32 GetDamageDone() const { return DamageDone; }
|
||||
[[nodiscard]] uint32 GetHealingDone() const { return HealingDone; }
|
||||
|
||||
[[nodiscard]] virtual uint32 GetAttr1() const { return 0; }
|
||||
[[nodiscard]] virtual uint32 GetAttr2() const { return 0; }
|
||||
[[nodiscard]] virtual uint32 GetAttr3() const { return 0; }
|
||||
[[nodiscard]] virtual uint32 GetAttr4() const { return 0; }
|
||||
[[nodiscard]] virtual uint32 GetAttr5() const { return 0; }
|
||||
|
||||
ObjectGuid PlayerGuid;
|
||||
|
||||
// Default score, present in every type
|
||||
uint32 KillingBlows = 0;
|
||||
uint32 Deaths = 0;
|
||||
uint32 HonorableKills = 0;
|
||||
uint32 BonusHonor = 0;
|
||||
uint32 DamageDone = 0;
|
||||
uint32 HealingDone = 0;
|
||||
};
|
||||
|
||||
#endif // TRINITY_BATTLEGROUND_SCORE_H
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include "BattlegroundSpamProtect.h"
|
||||
#include "Battleground.h"
|
||||
#include "GameTime.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "Player.h"
|
||||
#include "World.h"
|
||||
@@ -27,7 +28,7 @@ namespace
|
||||
|
||||
void AddTime(ObjectGuid guid)
|
||||
{
|
||||
_players.insert_or_assign(guid, sWorld->GetGameTime());
|
||||
_players.insert_or_assign(guid, GameTime::GetGameTime().count());
|
||||
}
|
||||
|
||||
uint32 GetTime(ObjectGuid guid)
|
||||
@@ -44,7 +45,7 @@ namespace
|
||||
bool IsCorrectDelay(ObjectGuid guid)
|
||||
{
|
||||
// Skip if spam time < 30 secs (default)
|
||||
return sWorld->GetGameTime() - GetTime(guid) >= sWorld->getIntConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_SPAM_DELAY);
|
||||
return GameTime::GetGameTime().count() - GetTime(guid) >= sWorld->getIntConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_SPAM_DELAY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,13 @@
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
void BattlegroundABScore::BuildObjectivesBlock(WorldPacket& data)
|
||||
{
|
||||
data << uint32(2);
|
||||
data << uint32(BasesAssaulted);
|
||||
data << uint32(BasesDefended);
|
||||
}
|
||||
|
||||
BattlegroundAB::BattlegroundAB()
|
||||
{
|
||||
m_BuffChange = true;
|
||||
@@ -37,11 +44,6 @@ BattlegroundAB::BattlegroundAB()
|
||||
_teamScores500Disadvantage[TEAM_HORDE] = false;
|
||||
_honorTics = 0;
|
||||
_reputationTics = 0;
|
||||
|
||||
StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AB_START_TWO_MINUTES;
|
||||
StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AB_START_ONE_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AB_START_HALF_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AB_HAS_BEGUN;
|
||||
}
|
||||
|
||||
BattlegroundAB::~BattlegroundAB() = default;
|
||||
@@ -78,8 +80,17 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff)
|
||||
NodeOccupied(node);
|
||||
SendNodeUpdate(node);
|
||||
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, teamId == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, nullptr, teamId == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE, LANG_BG_AB_NODE_STABLES + node);
|
||||
PlaySoundToAll(teamId == TEAM_ALLIANCE ? BG_AB_SOUND_NODE_CAPTURED_ALLIANCE : BG_AB_SOUND_NODE_CAPTURED_HORDE);
|
||||
if (teamId == TEAM_ALLIANCE)
|
||||
{
|
||||
SendBroadcastText(ABNodes[node].TextAllianceTaken, CHAT_MSG_BG_SYSTEM_ALLIANCE);
|
||||
PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_ALLIANCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendBroadcastText(ABNodes[node].TextHordeTaken, CHAT_MSG_BG_SYSTEM_HORDE);
|
||||
PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_HORDE);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case BG_AB_EVENT_ALLIANCE_TICK:
|
||||
@@ -108,12 +119,12 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff)
|
||||
{
|
||||
if (teamId == TEAM_ALLIANCE)
|
||||
{
|
||||
SendMessageToAll(LANG_BG_AB_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
SendBroadcastText(BG_AB_TEXT_ALLIANCE_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY_ALLIANCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
SendBroadcastText(BG_AB_TEXT_HORDE_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY_HORDE);
|
||||
}
|
||||
}
|
||||
@@ -165,7 +176,7 @@ void BattlegroundAB::StartingEventOpenDoors()
|
||||
void BattlegroundAB::AddPlayer(Player* player)
|
||||
{
|
||||
Battleground::AddPlayer(player);
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundABScore(player);
|
||||
PlayerScores.emplace(player->GetGUID().GetCounter(), new BattlegroundABScore(player->GetGUID()));
|
||||
}
|
||||
|
||||
void BattlegroundAB::RemovePlayer(Player* player)
|
||||
@@ -281,9 +292,13 @@ void BattlegroundAB::NodeDeoccupied(uint8 node)
|
||||
--_controlledPoints[_capturePointInfo[node]._ownerTeamId];
|
||||
|
||||
_capturePointInfo[node]._ownerTeamId = TEAM_NEUTRAL;
|
||||
RelocateDeadPlayers(BgCreatures[node]);
|
||||
|
||||
DelCreature(node); // Delete spirit healer
|
||||
_reviveEvents.AddEventAtOffset([this, node]()
|
||||
{
|
||||
RelocateDeadPlayers(BgCreatures[node]);
|
||||
DelCreature(node); // Delete spirit healer
|
||||
}, 500ms);
|
||||
|
||||
DelCreature(BG_AB_ALL_NODES_COUNT + node); // Delete aura trigger
|
||||
}
|
||||
|
||||
@@ -305,8 +320,8 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
||||
player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
|
||||
uint32 sound = 0;
|
||||
uint32 message = 0;
|
||||
uint32 message2 = 0;
|
||||
TeamId teamid = player->GetTeamId();
|
||||
|
||||
DeleteBanner(node);
|
||||
CreateBanner(node, true);
|
||||
|
||||
@@ -318,8 +333,15 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
||||
_capturePointInfo[node]._ownerTeamId = TEAM_NEUTRAL;
|
||||
_bgEvents.RescheduleEvent(BG_AB_EVENT_CAPTURE_STABLE + node, BG_AB_FLAG_CAPTURING_TIME);
|
||||
sound = BG_AB_SOUND_NODE_CLAIMED;
|
||||
message = LANG_BG_AB_NODE_CLAIMED;
|
||||
message2 = player->GetTeamId() == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE;
|
||||
|
||||
if (teamid == TEAM_ALLIANCE)
|
||||
{
|
||||
SendBroadcastText(ABNodes[node].TextAllianceClaims, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendBroadcastText(ABNodes[node].TextHordeClaims, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
}
|
||||
}
|
||||
else if (_capturePointInfo[node]._state == BG_AB_NODE_STATE_ALLY_CONTESTED || _capturePointInfo[node]._state == BG_AB_NODE_STATE_HORDE_CONTESTED)
|
||||
{
|
||||
@@ -330,7 +352,15 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
||||
_capturePointInfo[node]._state = static_cast<uint8>(BG_AB_NODE_STATE_ALLY_CONTESTED) + player->GetTeamId();
|
||||
_capturePointInfo[node]._ownerTeamId = TEAM_NEUTRAL;
|
||||
_bgEvents.RescheduleEvent(BG_AB_EVENT_CAPTURE_STABLE + node, BG_AB_FLAG_CAPTURING_TIME);
|
||||
message = LANG_BG_AB_NODE_ASSAULTED;
|
||||
|
||||
if (teamid == TEAM_ALLIANCE)
|
||||
{
|
||||
SendBroadcastText(ABNodes[node].TextAllianceAssaulted, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendBroadcastText(ABNodes[node].TextHordeAssaulted, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -339,8 +369,17 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
||||
_capturePointInfo[node]._ownerTeamId = player->GetTeamId();
|
||||
_bgEvents.CancelEvent(BG_AB_EVENT_CAPTURE_STABLE + node);
|
||||
NodeOccupied(node); // after setting team owner
|
||||
message = LANG_BG_AB_NODE_DEFENDED;
|
||||
|
||||
if (teamid == TEAM_ALLIANCE)
|
||||
{
|
||||
SendBroadcastText(ABNodes[node].TextAllianceDefended, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendBroadcastText(ABNodes[node].TextHordeDefended, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
}
|
||||
}
|
||||
|
||||
sound = player->GetTeamId() == TEAM_ALLIANCE ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
|
||||
}
|
||||
else
|
||||
@@ -353,13 +392,20 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
||||
|
||||
ApplyPhaseMask();
|
||||
_bgEvents.RescheduleEvent(BG_AB_EVENT_CAPTURE_STABLE + node, BG_AB_FLAG_CAPTURING_TIME);
|
||||
message = LANG_BG_AB_NODE_ASSAULTED;
|
||||
sound = player->GetTeamId() == TEAM_ALLIANCE ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
|
||||
|
||||
if (teamid == TEAM_ALLIANCE)
|
||||
{
|
||||
SendBroadcastText(ABNodes[node].TextAllianceAssaulted, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendBroadcastText(ABNodes[node].TextHordeAssaulted, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
}
|
||||
}
|
||||
|
||||
SendNodeUpdate(node);
|
||||
PlaySoundToAll(sound);
|
||||
SendMessage2ToAll(message, player->GetTeamId() == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, player, LANG_BG_AB_NODE_STABLES + node, message2);
|
||||
}
|
||||
|
||||
TeamId BattlegroundAB::GetPrematureWinner()
|
||||
@@ -373,14 +419,14 @@ bool BattlegroundAB::SetupBattleground()
|
||||
{
|
||||
for (uint32 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
{
|
||||
AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + BG_AB_OBJECTS_PER_NODE * i, BG_AB_OBJECTID_NODE_BANNER_0 + i, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3] / 2), cos(BG_AB_NodePositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_BANNER_ALLY + BG_AB_OBJECTS_PER_NODE * i, BG_AB_OBJECTID_BANNER_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3] / 2), cos(BG_AB_NodePositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_BANNER_HORDE + BG_AB_OBJECTS_PER_NODE * i, BG_AB_OBJECTID_BANNER_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3] / 2), cos(BG_AB_NodePositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_BANNER_CONT_A + BG_AB_OBJECTS_PER_NODE * i, BG_AB_OBJECTID_BANNER_CONT_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3] / 2), cos(BG_AB_NodePositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_BANNER_CONT_H + BG_AB_OBJECTS_PER_NODE * i, BG_AB_OBJECTID_BANNER_CONT_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3] / 2), cos(BG_AB_NodePositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_AURA_ALLY + BG_AB_OBJECTS_PER_NODE * i, BG_AB_OBJECTID_AURA_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3] / 2), cos(BG_AB_NodePositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_AURA_HORDE + BG_AB_OBJECTS_PER_NODE * i, BG_AB_OBJECTID_AURA_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3] / 2), cos(BG_AB_NodePositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_AURA_CONTESTED + BG_AB_OBJECTS_PER_NODE * i, BG_AB_OBJECTID_AURA_C, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3] / 2), cos(BG_AB_NodePositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + BG_AB_OBJECTS_PER_NODE * i, BG_AB_OBJECTID_NODE_BANNER_0 + i, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3] / 2), cos(BG_AB_NodePositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_BANNER_ALLY + BG_AB_OBJECTS_PER_NODE * i, BG_AB_OBJECTID_BANNER_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3] / 2), cos(BG_AB_NodePositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_BANNER_HORDE + BG_AB_OBJECTS_PER_NODE * i, BG_AB_OBJECTID_BANNER_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3] / 2), cos(BG_AB_NodePositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_BANNER_CONT_A + BG_AB_OBJECTS_PER_NODE * i, BG_AB_OBJECTID_BANNER_CONT_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3] / 2), cos(BG_AB_NodePositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_BANNER_CONT_H + BG_AB_OBJECTS_PER_NODE * i, BG_AB_OBJECTID_BANNER_CONT_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3] / 2), cos(BG_AB_NodePositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_AURA_ALLY + BG_AB_OBJECTS_PER_NODE * i, BG_AB_OBJECTID_AURA_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3] / 2), cos(BG_AB_NodePositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_AURA_HORDE + BG_AB_OBJECTS_PER_NODE * i, BG_AB_OBJECTID_AURA_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3] / 2), cos(BG_AB_NodePositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_AURA_CONTESTED + BG_AB_OBJECTS_PER_NODE * i, BG_AB_OBJECTID_AURA_C, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3] / 2), cos(BG_AB_NodePositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
}
|
||||
|
||||
AddObject(BG_AB_OBJECT_GATE_A, BG_AB_OBJECTID_GATE_A, BG_AB_DoorPositions[0][0], BG_AB_DoorPositions[0][1], BG_AB_DoorPositions[0][2], BG_AB_DoorPositions[0][3], BG_AB_DoorPositions[0][4], BG_AB_DoorPositions[0][5], BG_AB_DoorPositions[0][6], BG_AB_DoorPositions[0][7], RESPAWN_IMMEDIATELY);
|
||||
@@ -388,9 +434,9 @@ bool BattlegroundAB::SetupBattleground()
|
||||
|
||||
for (uint32 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
{
|
||||
AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3] / 2), cos(BG_AB_BuffPositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3] / 2), cos(BG_AB_BuffPositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3] / 2), cos(BG_AB_BuffPositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, std::sin(BG_AB_BuffPositions[i][3] / 2), cos(BG_AB_BuffPositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, std::sin(BG_AB_BuffPositions[i][3] / 2), cos(BG_AB_BuffPositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, std::sin(BG_AB_BuffPositions[i][3] / 2), cos(BG_AB_BuffPositions[i][3] / 2), RESPAWN_ONE_DAY);
|
||||
}
|
||||
|
||||
AddSpiritGuide(BG_AB_SPIRIT_ALIANCE, BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][0], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][1], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][2], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][3], TEAM_ALLIANCE);
|
||||
@@ -469,26 +515,24 @@ GraveyardStruct const* BattlegroundAB::GetClosestGraveyard(Player* player)
|
||||
return nearestEntry;
|
||||
}
|
||||
|
||||
void BattlegroundAB::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
|
||||
bool BattlegroundAB::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
auto itr = PlayerScores.find(player->GetGUID());
|
||||
if (itr == PlayerScores.end())
|
||||
return;
|
||||
if (!Battleground::UpdatePlayerScore(player, type, value, doAddHonor))
|
||||
return false;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_BASES_ASSAULTED:
|
||||
((BattlegroundABScore*)itr->second)->BasesAssaulted += value;
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, BG_AB_OBJECTIVE_ASSAULT_BASE);
|
||||
break;
|
||||
case SCORE_BASES_DEFENDED:
|
||||
((BattlegroundABScore*)itr->second)->BasesDefended += value;
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, BG_AB_OBJECTIVE_DEFEND_BASE);
|
||||
break;
|
||||
default:
|
||||
Battleground::UpdatePlayerScore(player, type, value, doAddHonor);
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BattlegroundAB::AllNodesConrolledByTeam(TeamId teamId) const
|
||||
@@ -504,7 +548,8 @@ void BattlegroundAB::ApplyPhaseMask()
|
||||
phaseMask |= 1 << (i * 2 + 1 + _capturePointInfo[i]._ownerTeamId);
|
||||
|
||||
const BattlegroundPlayerMap& bgPlayerMap = GetPlayers();
|
||||
for (auto itr : bgPlayerMap)
|
||||
|
||||
for (auto const& itr : bgPlayerMap)
|
||||
{
|
||||
itr.second->SetPhaseMask(phaseMask, false);
|
||||
itr.second->UpdateObjectVisibility(true, false);
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#define __BATTLEGROUNDAB_H
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundScore.h"
|
||||
#include "EventMap.h"
|
||||
|
||||
enum BG_AB_Events
|
||||
{
|
||||
@@ -146,6 +148,34 @@ enum BG_AB_BattlegroundNodes
|
||||
BG_AB_ALL_NODES_COUNT = 7, // all nodes (dynamic and static)
|
||||
};
|
||||
|
||||
enum BG_AB_BroadcastTexts
|
||||
{
|
||||
BG_AB_TEXT_ALLIANCE_NEAR_VICTORY = 10598,
|
||||
BG_AB_TEXT_HORDE_NEAR_VICTORY = 10599,
|
||||
};
|
||||
|
||||
struct ABNodeInfo
|
||||
{
|
||||
uint32 NodeId;
|
||||
uint32 TextAllianceAssaulted;
|
||||
uint32 TextHordeAssaulted;
|
||||
uint32 TextAllianceTaken;
|
||||
uint32 TextHordeTaken;
|
||||
uint32 TextAllianceDefended;
|
||||
uint32 TextHordeDefended;
|
||||
uint32 TextAllianceClaims;
|
||||
uint32 TextHordeClaims;
|
||||
};
|
||||
|
||||
ABNodeInfo const ABNodes[BG_AB_DYNAMIC_NODES_COUNT] =
|
||||
{
|
||||
{ BG_AB_NODE_STABLES, 10199, 10200, 10203, 10204, 10201, 10202, 10286, 10287 },
|
||||
{ BG_AB_NODE_BLACKSMITH, 10211, 10212, 10213, 10214, 10215, 10216, 10290, 10291 },
|
||||
{ BG_AB_NODE_FARM, 10217, 10218, 10219, 10220, 10221, 10222, 10288, 10289 },
|
||||
{ BG_AB_NODE_LUMBER_MILL, 10224, 10225, 10226, 10227, 10228, 10229, 10284, 10285 },
|
||||
{ BG_AB_NODE_GOLD_MINE, 10230, 10231, 10232, 10233, 10234, 10235, 10282, 10283 }
|
||||
};
|
||||
|
||||
enum BG_AB_NodeStatus
|
||||
{
|
||||
BG_AB_NODE_STATE_NEUTRAL = 0,
|
||||
@@ -224,18 +254,52 @@ const float BG_AB_SpiritGuidePos[BG_AB_ALL_NODES_COUNT][4] =
|
||||
{714.61f, 646.15f, -10.87f, 4.34f} // horde starting base
|
||||
};
|
||||
|
||||
struct BattlegroundABScore : public BattlegroundScore
|
||||
struct BattlegroundABScore final : public BattlegroundScore
|
||||
{
|
||||
explicit BattlegroundABScore(Player* player) : BattlegroundScore(player), BasesAssaulted(0), BasesDefended(0) { }
|
||||
~BattlegroundABScore() override = default;
|
||||
uint32 BasesAssaulted;
|
||||
uint32 BasesDefended;
|
||||
friend class BattlegroundAB;
|
||||
|
||||
uint32 GetAttr1() const final { return BasesAssaulted; }
|
||||
uint32 GetAttr2() const final { return BasesDefended; }
|
||||
protected:
|
||||
|
||||
explicit BattlegroundABScore(ObjectGuid playerGuid) : BattlegroundScore(playerGuid) { }
|
||||
|
||||
void UpdateScore(uint32 type, uint32 value) override
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_BASES_ASSAULTED:
|
||||
BasesAssaulted += value;
|
||||
break;
|
||||
case SCORE_BASES_DEFENDED:
|
||||
BasesDefended += value;
|
||||
break;
|
||||
default:
|
||||
BattlegroundScore::UpdateScore(type, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BuildObjectivesBlock(WorldPacket& data) final;
|
||||
|
||||
uint32 GetAttr1() const override { return BasesAssaulted; }
|
||||
uint32 GetAttr2() const override { return BasesDefended; }
|
||||
|
||||
uint32 BasesAssaulted = 0;
|
||||
uint32 BasesDefended = 0;
|
||||
};
|
||||
|
||||
class BattlegroundAB : public Battleground
|
||||
struct CaptureABPointInfo
|
||||
{
|
||||
CaptureABPointInfo() : _ownerTeamId(TEAM_NEUTRAL), _iconNone(0), _iconCapture(0), _state(BG_AB_NODE_STATE_NEUTRAL), _captured(false) {}
|
||||
|
||||
TeamId _ownerTeamId;
|
||||
uint32 _iconNone;
|
||||
uint32 _iconCapture;
|
||||
uint8 _state;
|
||||
|
||||
bool _captured;
|
||||
};
|
||||
|
||||
class AC_GAME_API BattlegroundAB : public Battleground
|
||||
{
|
||||
public:
|
||||
BattlegroundAB();
|
||||
@@ -251,7 +315,7 @@ public:
|
||||
void EndBattleground(TeamId winnerTeamId) override;
|
||||
GraveyardStruct const* GetClosestGraveyard(Player* player) override;
|
||||
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
|
||||
bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
|
||||
void FillInitialWorldStates(WorldPacket& data) override;
|
||||
void EventPlayerClickedOnFlag(Player* source, GameObject* gameObject) override;
|
||||
|
||||
@@ -259,7 +323,10 @@ public:
|
||||
bool IsTeamScores500Disadvantage(TeamId teamId) const { return _teamScores500Disadvantage[teamId]; }
|
||||
|
||||
TeamId GetPrematureWinner() override;
|
||||
private:
|
||||
|
||||
[[nodiscard]] CaptureABPointInfo const& GetCapturePointInfo(uint32 node) const { return _capturePointInfo[node]; }
|
||||
|
||||
private :
|
||||
void PostUpdateImpl(uint32 diff) override;
|
||||
|
||||
void DeleteBanner(uint8 node);
|
||||
@@ -269,25 +336,11 @@ private:
|
||||
void NodeDeoccupied(uint8 node);
|
||||
void ApplyPhaseMask();
|
||||
|
||||
struct CapturePointInfo
|
||||
{
|
||||
CapturePointInfo() : _ownerTeamId(TEAM_NEUTRAL), _iconNone(0), _iconCapture(0), _state(BG_AB_NODE_STATE_NEUTRAL), _captured(false)
|
||||
{
|
||||
}
|
||||
|
||||
TeamId _ownerTeamId;
|
||||
uint32 _iconNone;
|
||||
uint32 _iconCapture;
|
||||
uint8 _state;
|
||||
|
||||
bool _captured;
|
||||
};
|
||||
|
||||
CapturePointInfo _capturePointInfo[BG_AB_DYNAMIC_NODES_COUNT];
|
||||
CaptureABPointInfo _capturePointInfo[BG_AB_DYNAMIC_NODES_COUNT];
|
||||
EventMap _bgEvents;
|
||||
uint32 _honorTics;
|
||||
uint32 _reputationTics;
|
||||
uint8 _controlledPoints[BG_TEAMS_COUNT] {};
|
||||
bool _teamScores500Disadvantage[BG_TEAMS_COUNT] {};
|
||||
uint8 _controlledPoints[PVP_TEAMS_COUNT] {};
|
||||
bool _teamScores500Disadvantage[PVP_TEAMS_COUNT] {};
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -27,6 +27,16 @@
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
void BattlegroundAVScore::BuildObjectivesBlock(WorldPacket& data)
|
||||
{
|
||||
data << uint32(5); // Objectives Count
|
||||
data << uint32(GraveyardsAssaulted);
|
||||
data << uint32(GraveyardsDefended);
|
||||
data << uint32(TowersAssaulted);
|
||||
data << uint32(TowersDefended);
|
||||
data << uint32(MinesCaptured);
|
||||
}
|
||||
|
||||
BattlegroundAV::BattlegroundAV()
|
||||
{
|
||||
BgObjects.resize(BG_AV_OBJECT_MAX);
|
||||
@@ -49,14 +59,9 @@ BattlegroundAV::BattlegroundAV()
|
||||
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
|
||||
InitNode(i, TEAM_NEUTRAL, false);
|
||||
|
||||
StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AV_START_TWO_MINUTES;
|
||||
StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AV_START_ONE_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AV_START_HALF_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AV_HAS_BEGUN;
|
||||
}
|
||||
|
||||
BattlegroundAV::~BattlegroundAV()
|
||||
{
|
||||
StartMessageIds[BG_STARTING_EVENT_SECOND] = BG_AV_TEXT_START_ONE_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_THIRD] = BG_AV_TEXT_START_HALF_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_FOURTH] = BG_AV_TEXT_BATTLE_HAS_BEGUN;
|
||||
}
|
||||
|
||||
void BattlegroundAV::HandleKillPlayer(Player* player, Player* killer)
|
||||
@@ -70,7 +75,7 @@ void BattlegroundAV::HandleKillPlayer(Player* player, Player* killer)
|
||||
|
||||
void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer)
|
||||
{
|
||||
LOG_DEBUG("bg.battleground", "bg_av HandleKillUnit %i", unit->GetEntry());
|
||||
LOG_DEBUG("bg.battleground", "bg_av HandleKillUnit {}", unit->GetEntry());
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
uint32 entry = unit->GetEntry();
|
||||
@@ -140,9 +145,17 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer)
|
||||
DelCreature(AV_CPLACE_TRIGGER18);
|
||||
}
|
||||
else if (entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_N_4] || entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_A_4] || entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_H_4])
|
||||
{
|
||||
ChangeMineOwner(AV_NORTH_MINE, killer->GetTeamId());
|
||||
UpdatePlayerScore(killer, SCORE_MINES_CAPTURED, 1);
|
||||
killer->KilledMonsterCredit(BG_AV_QUEST_CREDIT_MINE);
|
||||
}
|
||||
else if (entry == BG_AV_CreatureInfo[AV_NPC_S_MINE_N_4] || entry == BG_AV_CreatureInfo[AV_NPC_S_MINE_A_4] || entry == BG_AV_CreatureInfo[AV_NPC_S_MINE_H_4])
|
||||
{
|
||||
ChangeMineOwner(AV_SOUTH_MINE, killer->GetTeamId());
|
||||
UpdatePlayerScore(killer, SCORE_MINES_CAPTURED, 1);
|
||||
killer->KilledMonsterCredit(BG_AV_QUEST_CREDIT_MINE);
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
||||
@@ -151,7 +164,7 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
||||
return;//maybe we should log this, cause this must be a cheater or a big bug
|
||||
TeamId teamId = player->GetTeamId();
|
||||
//TODO add reputation, events (including quest not available anymore, next quest availabe, go/npc de/spawning)and maybe honor
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed", questid);
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed", questid);
|
||||
switch (questid)
|
||||
{
|
||||
case AV_QUEST_A_SCRAPS1:
|
||||
@@ -161,7 +174,7 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
||||
m_Team_QuestStatus[teamId][0] += 20;
|
||||
if (m_Team_QuestStatus[teamId][0] == 500 || m_Team_QuestStatus[teamId][0] == 1000 || m_Team_QuestStatus[teamId][0] == 1500) //25, 50, 75 turn ins
|
||||
{
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed starting with unit upgrading..", questid);
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed starting with unit upgrading..", questid);
|
||||
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i)
|
||||
if (m_Nodes[i].OwnerId == player->GetTeamId() && m_Nodes[i].State == POINT_CONTROLED)
|
||||
{
|
||||
@@ -176,21 +189,21 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
||||
m_Team_QuestStatus[teamId][1]++;
|
||||
RewardReputationToTeam(teamId, 1, teamId);
|
||||
if (m_Team_QuestStatus[teamId][1] == 30)
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid);
|
||||
break;
|
||||
case AV_QUEST_A_COMMANDER2:
|
||||
case AV_QUEST_H_COMMANDER2:
|
||||
m_Team_QuestStatus[teamId][2]++;
|
||||
RewardReputationToTeam(teamId, 1, teamId);
|
||||
if (m_Team_QuestStatus[teamId][2] == 60)
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid);
|
||||
break;
|
||||
case AV_QUEST_A_COMMANDER3:
|
||||
case AV_QUEST_H_COMMANDER3:
|
||||
m_Team_QuestStatus[teamId][3]++;
|
||||
RewardReputationToTeam(teamId, 1, teamId);
|
||||
if (m_Team_QuestStatus[teamId][3] == 120)
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid);
|
||||
break;
|
||||
case AV_QUEST_A_BOSS1:
|
||||
case AV_QUEST_H_BOSS1:
|
||||
@@ -200,17 +213,17 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
||||
case AV_QUEST_H_BOSS2:
|
||||
m_Team_QuestStatus[teamId][4]++;
|
||||
if (m_Team_QuestStatus[teamId][4] >= 200)
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid);
|
||||
break;
|
||||
case AV_QUEST_A_NEAR_MINE:
|
||||
case AV_QUEST_H_NEAR_MINE:
|
||||
m_Team_QuestStatus[teamId][5]++;
|
||||
if (m_Team_QuestStatus[teamId][5] == 28)
|
||||
{
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid);
|
||||
|
||||
if (m_Team_QuestStatus[teamId][6] == 7)
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here - ground assault ready", questid);
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here - ground assault ready", questid);
|
||||
}
|
||||
break;
|
||||
case AV_QUEST_A_OTHER_MINE:
|
||||
@@ -218,10 +231,10 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
||||
m_Team_QuestStatus[teamId][6]++;
|
||||
if (m_Team_QuestStatus[teamId][6] == 7)
|
||||
{
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid);
|
||||
|
||||
if (m_Team_QuestStatus[teamId][5] == 20)
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here - ground assault ready", questid);
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here - ground assault ready", questid);
|
||||
}
|
||||
break;
|
||||
case AV_QUEST_A_RIDER_HIDE:
|
||||
@@ -229,10 +242,10 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
||||
m_Team_QuestStatus[teamId][7]++;
|
||||
if (m_Team_QuestStatus[teamId][7] == 25)
|
||||
{
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid);
|
||||
|
||||
if (m_Team_QuestStatus[teamId][8] == 25)
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here - rider assault ready", questid);
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here - rider assault ready", questid);
|
||||
}
|
||||
break;
|
||||
case AV_QUEST_A_RIDER_TAME:
|
||||
@@ -240,14 +253,14 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
||||
m_Team_QuestStatus[teamId][8]++;
|
||||
if (m_Team_QuestStatus[teamId][8] == 25)
|
||||
{
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid);
|
||||
|
||||
if (m_Team_QuestStatus[teamId][7] == 25)
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here - rider assault ready", questid);
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here - rider assault ready", questid);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed but is not interesting at all", questid);
|
||||
LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed but is not interesting at all", questid);
|
||||
return; //was no interesting quest at all
|
||||
break;
|
||||
}
|
||||
@@ -268,7 +281,15 @@ void BattlegroundAV::UpdateScore(TeamId teamId, int16 points)
|
||||
}
|
||||
else if (!m_IsInformedNearVictory[teamId] && m_Team_Scores[teamId] < SEND_MSG_NEAR_LOSE)
|
||||
{
|
||||
SendMessageToAll(teamId == TEAM_HORDE ? LANG_BG_AV_H_NEAR_LOSE : LANG_BG_AV_A_NEAR_LOSE, teamId == TEAM_HORDE ? CHAT_MSG_BG_SYSTEM_HORDE : CHAT_MSG_BG_SYSTEM_ALLIANCE);
|
||||
if (teamId == TEAM_ALLIANCE)
|
||||
{
|
||||
SendBroadcastText(BG_AV_TEXT_ALLIANCE_NEAR_LOSE, CHAT_MSG_BG_SYSTEM_ALLIANCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendBroadcastText(BG_AV_TEXT_HORDE_NEAR_LOSE, CHAT_MSG_BG_SYSTEM_HORDE);
|
||||
}
|
||||
|
||||
PlaySoundToAll(AV_SOUND_NEAR_VICTORY);
|
||||
m_IsInformedNearVictory[teamId] = true;
|
||||
}
|
||||
@@ -456,8 +477,7 @@ void BattlegroundAV::StartingEventOpenDoors()
|
||||
void BattlegroundAV::AddPlayer(Player* player)
|
||||
{
|
||||
Battleground::AddPlayer(player);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundAVScore(player);
|
||||
PlayerScores.emplace(player->GetGUID().GetCounter(), new BattlegroundAVScore(player->GetGUID()));
|
||||
}
|
||||
|
||||
void BattlegroundAV::EndBattleground(TeamId winnerTeamId)
|
||||
@@ -542,49 +562,36 @@ void BattlegroundAV::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundAV::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
|
||||
bool BattlegroundAV::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
auto itr = PlayerScores.find(player->GetGUID());
|
||||
if (itr == PlayerScores.end())
|
||||
return;
|
||||
if (!Battleground::UpdatePlayerScore(player, type, value, doAddHonor))
|
||||
return false;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_GRAVEYARDS_ASSAULTED:
|
||||
((BattlegroundAVScore*)itr->second)->GraveyardsAssaulted += value;
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AV_OBJECTIVE_ASSAULT_GRAVEYARD);
|
||||
break;
|
||||
case SCORE_GRAVEYARDS_DEFENDED:
|
||||
((BattlegroundAVScore*)itr->second)->GraveyardsDefended += value;
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AV_OBJECTIVE_DEFEND_GRAVEYARD);
|
||||
break;
|
||||
case SCORE_TOWERS_ASSAULTED:
|
||||
((BattlegroundAVScore*)itr->second)->TowersAssaulted += value;
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AV_OBJECTIVE_ASSAULT_TOWER);
|
||||
break;
|
||||
case SCORE_TOWERS_DEFENDED:
|
||||
((BattlegroundAVScore*)itr->second)->TowersDefended += value;
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AV_OBJECTIVE_DEFEND_TOWER);
|
||||
break;
|
||||
case SCORE_MINES_CAPTURED:
|
||||
((BattlegroundAVScore*)itr->second)->MinesCaptured += value;
|
||||
break;
|
||||
case SCORE_LEADERS_KILLED:
|
||||
((BattlegroundAVScore*)itr->second)->LeadersKilled += value;
|
||||
break;
|
||||
case SCORE_SECONDARY_OBJECTIVES:
|
||||
((BattlegroundAVScore*)itr->second)->SecondaryObjectives += value;
|
||||
break;
|
||||
default:
|
||||
Battleground::UpdatePlayerScore(player, type, value, doAddHonor);
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
|
||||
{
|
||||
uint32 object = GetObjectThroughNode(node);
|
||||
LOG_DEBUG("bg.battleground", "bg_av: player destroyed point node %i object %i", node, object);
|
||||
LOG_DEBUG("bg.battleground", "bg_av: player destroyed point node {} object {}", node, object);
|
||||
|
||||
//despawn banner
|
||||
SpawnBGObject(object, RESPAWN_ONE_DAY);
|
||||
@@ -599,7 +606,7 @@ void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
|
||||
if (BgCreatures[AV_CPLACE_A_MARSHAL_SOUTH + tmp])
|
||||
DelCreature(AV_CPLACE_A_MARSHAL_SOUTH + tmp);
|
||||
else
|
||||
LOG_ERROR("bg.battleground", "BG_AV: playerdestroyedpoint: marshal %i doesn't exist", AV_CPLACE_A_MARSHAL_SOUTH + tmp);
|
||||
LOG_ERROR("bg.battleground", "BG_AV: playerdestroyedpoint: marshal {} doesn't exist", AV_CPLACE_A_MARSHAL_SOUTH + tmp);
|
||||
//spawn destroyed aura
|
||||
for (uint8 i = 0; i <= 9; i++)
|
||||
SpawnBGObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH + i + (tmp * 10), RESPAWN_IMMEDIATELY);
|
||||
@@ -657,7 +664,7 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, TeamId teamId, bool initial)
|
||||
|
||||
if (!initial)
|
||||
{
|
||||
LOG_DEBUG("bg.battleground", "bg_av depopulating mine %i (0=north, 1=south)", mine);
|
||||
LOG_DEBUG("bg.battleground", "bg_av depopulating mine {} (0=north, 1=south)", mine);
|
||||
if (mine == AV_SOUTH_MINE)
|
||||
for (uint16 i = AV_CPLACE_MINE_S_S_MIN; i <= AV_CPLACE_MINE_S_S_MAX; i++)
|
||||
if (BgCreatures[i])
|
||||
@@ -668,7 +675,7 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, TeamId teamId, bool initial)
|
||||
}
|
||||
SendMineWorldStates(mine);
|
||||
|
||||
LOG_DEBUG("bg.battleground", "bg_av populating mine %i (0=north, 1=south)", mine);
|
||||
LOG_DEBUG("bg.battleground", "bg_av populating mine {} (0=north, 1=south)", mine);
|
||||
uint16 miner;
|
||||
//also neutral team exists.. after a big time, the neutral team tries to conquer the mine
|
||||
if (mine == AV_NORTH_MINE)
|
||||
@@ -758,7 +765,7 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node)
|
||||
if (BgCreatures[node])
|
||||
DelCreature(node);
|
||||
if (!AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], ownerId))
|
||||
LOG_ERROR("bg.battleground", "AV: couldn't spawn spiritguide at node %i", node);
|
||||
LOG_ERROR("bg.battleground", "AV: couldn't spawn spiritguide at node {}", node);
|
||||
}
|
||||
for (uint8 i = 0; i < 4; i++)
|
||||
AddAVCreature(creatureid, c_place + i);
|
||||
@@ -790,15 +797,22 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node)
|
||||
trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false);
|
||||
}
|
||||
}
|
||||
void BattlegroundAV::DePopulateNode(BG_AV_Nodes node)
|
||||
void BattlegroundAV::DePopulateNode(BG_AV_Nodes node, bool ignoreSpiritGuide)
|
||||
{
|
||||
uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + (4 * node);
|
||||
for (uint8 i = 0; i < 4; i++)
|
||||
{
|
||||
if (BgCreatures[c_place + i])
|
||||
{
|
||||
DelCreature(c_place + i);
|
||||
}
|
||||
}
|
||||
|
||||
//spiritguide
|
||||
if (!IsTower(node) && BgCreatures[node])
|
||||
if (!ignoreSpiritGuide && !IsTower(node))
|
||||
{
|
||||
DelCreature(node);
|
||||
}
|
||||
|
||||
//remove bonus honor aura trigger creature when node is lost
|
||||
if (node < BG_AV_NODES_MAX)//fail safe
|
||||
@@ -807,7 +821,7 @@ void BattlegroundAV::DePopulateNode(BG_AV_Nodes node)
|
||||
|
||||
BG_AV_Nodes BattlegroundAV::GetNodeThroughObject(uint32 object)
|
||||
{
|
||||
LOG_DEBUG("bg.battleground", "bg_AV getnodethroughobject %i", object);
|
||||
LOG_DEBUG("bg.battleground", "bg_AV getnodethroughobject {}", object);
|
||||
if (object <= BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER)
|
||||
return BG_AV_Nodes(object);
|
||||
if (object <= BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_HUT)
|
||||
@@ -830,7 +844,7 @@ BG_AV_Nodes BattlegroundAV::GetNodeThroughObject(uint32 object)
|
||||
uint32 BattlegroundAV::GetObjectThroughNode(BG_AV_Nodes node)
|
||||
{
|
||||
//this function is the counterpart to GetNodeThroughObject()
|
||||
LOG_DEBUG("bg.battleground", "bg_AV GetObjectThroughNode %i", node);
|
||||
LOG_DEBUG("bg.battleground", "bg_AV GetObjectThroughNode {}", node);
|
||||
if (m_Nodes[node].OwnerId == TEAM_ALLIANCE)
|
||||
{
|
||||
if (m_Nodes[node].State == POINT_ASSAULTED)
|
||||
@@ -861,7 +875,7 @@ uint32 BattlegroundAV::GetObjectThroughNode(BG_AV_Nodes node)
|
||||
}
|
||||
else if (m_Nodes[node].OwnerId == TEAM_NEUTRAL)
|
||||
return BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE;
|
||||
LOG_ERROR("bg.battleground", "BattlegroundAV: Error! GetPlaceNode couldn't resolve node %i", node);
|
||||
LOG_ERROR("bg.battleground", "BattlegroundAV: Error! GetPlaceNode couldn't resolve node {}", node);
|
||||
ABORT();
|
||||
return 0;
|
||||
}
|
||||
@@ -912,10 +926,10 @@ void BattlegroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
|
||||
EventPlayerAssaultsPoint(player, object);
|
||||
return;
|
||||
}
|
||||
LOG_DEBUG("bg.battleground", "player defends point object: %i node: %i", object, node);
|
||||
LOG_DEBUG("bg.battleground", "player defends point object: {} node: {}", object, node);
|
||||
if (m_Nodes[node].PrevOwnerId != teamId)
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "BG_AV: player defends point which doesn't belong to his team %i", node);
|
||||
LOG_ERROR("bg.battleground", "BG_AV: player defends point which doesn't belong to his team {}", node);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -974,7 +988,7 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
|
||||
BG_AV_Nodes node = GetNodeThroughObject(object);
|
||||
TeamId prevOwnerId = m_Nodes[node].OwnerId;
|
||||
TeamId teamId = player->GetTeamId();
|
||||
LOG_DEBUG("bg.battleground", "bg_av: player assaults point object %i node %i", object, node);
|
||||
LOG_DEBUG("bg.battleground", "bg_av: player assaults point object {} node {}", object, node);
|
||||
if (prevOwnerId == teamId || teamId == m_Nodes[node].TotalOwnerId)
|
||||
return; //surely a gm used this object
|
||||
|
||||
@@ -1031,6 +1045,8 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
|
||||
SpawnBGObject(object - 22, RESPAWN_IMMEDIATELY);
|
||||
else
|
||||
SpawnBGObject(object + 22, RESPAWN_IMMEDIATELY);
|
||||
|
||||
bool ignoreSpiritGuide = false;
|
||||
if (IsTower(node))
|
||||
{
|
||||
//spawning/despawning of bigflag+aura
|
||||
@@ -1045,9 +1061,18 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
|
||||
SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION + 3 * node, RESPAWN_IMMEDIATELY); //neutral aura spawn
|
||||
SpawnBGObject(static_cast<uint8>(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION) + prevOwnerId + 3 * node, RESPAWN_ONE_DAY); //teeamaura despawn
|
||||
|
||||
RelocateDeadPlayers(BgCreatures[node]);
|
||||
ignoreSpiritGuide = true;
|
||||
|
||||
_reviveEvents.AddEventAtOffset([this, node]()
|
||||
{
|
||||
RelocateDeadPlayers(BgCreatures[node]);
|
||||
|
||||
if (!IsTower(node))
|
||||
DelCreature(node); // Delete spirit healer
|
||||
}, 500ms);
|
||||
}
|
||||
DePopulateNode(node);
|
||||
|
||||
DePopulateNode(node, ignoreSpiritGuide);
|
||||
}
|
||||
|
||||
SpawnBGObject(object, RESPAWN_ONE_DAY); //delete old banner
|
||||
@@ -1063,6 +1088,8 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
|
||||
//update the statistic for the assaulting player
|
||||
UpdatePlayerScore(player, (IsTower(node)) ? SCORE_TOWERS_ASSAULTED : SCORE_GRAVEYARDS_ASSAULTED, 1);
|
||||
PlaySoundToAll((teamId == TEAM_ALLIANCE) ? AV_SOUND_ALLIANCE_ASSAULTS : AV_SOUND_HORDE_ASSAULTS);
|
||||
|
||||
player->KilledMonsterCredit((IsTower(node)) ? BG_AV_QUEST_CREDIT_TOWER : BG_AV_QUEST_CREDIT_GRAVEYARD);
|
||||
}
|
||||
|
||||
void BattlegroundAV::FillInitialWorldStates(WorldPacket& data)
|
||||
@@ -1126,7 +1153,7 @@ uint8 BattlegroundAV::GetWorldStateType(uint8 state, TeamId teamId) //this is us
|
||||
if (state == POINT_ASSAULTED)
|
||||
return 3;
|
||||
}
|
||||
LOG_ERROR("bg.battleground", "BG_AV: should update a strange worldstate state:%i team:%i", state, teamId);
|
||||
LOG_ERROR("bg.battleground", "BG_AV: should update a strange worldstate state:{} team:{}", state, teamId);
|
||||
return 5; //this will crash the game, but i want to know if something is wrong here
|
||||
}
|
||||
|
||||
@@ -1194,14 +1221,14 @@ bool BattlegroundAV::SetupBattleground()
|
||||
{
|
||||
if (i <= BG_AV_NODES_FROSTWOLF_HUT)
|
||||
{
|
||||
if (!AddObject(i, BG_AV_OBJECTID_BANNER_A_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i + 11, BG_AV_OBJECTID_BANNER_CONT_A_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i + 33, BG_AV_OBJECTID_BANNER_H_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i + 22, BG_AV_OBJECTID_BANNER_CONT_H_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
if (!AddObject(i, BG_AV_OBJECTID_BANNER_A_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i + 11, BG_AV_OBJECTID_BANNER_CONT_A_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i + 33, BG_AV_OBJECTID_BANNER_H_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i + 22, BG_AV_OBJECTID_BANNER_CONT_H_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
//aura
|
||||
|| !AddObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION + i * 3, BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION + i * 3, BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION + i * 3, BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY))
|
||||
|| !AddObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION + i * 3, BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION + i * 3, BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION + i * 3, BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!2");
|
||||
return false;
|
||||
@@ -1211,12 +1238,12 @@ bool BattlegroundAV::SetupBattleground()
|
||||
{
|
||||
if (i <= BG_AV_NODES_STONEHEART_BUNKER) //alliance towers
|
||||
{
|
||||
if (!AddObject(i, BG_AV_OBJECTID_BANNER_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i + 22, BG_AV_OBJECTID_BANNER_CONT_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_A, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PH, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(i, BG_AV_OBJECTID_BANNER_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i + 22, BG_AV_OBJECTID_BANNER_CONT_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, std::sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, std::sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_A, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, std::sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PH, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, std::sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!3");
|
||||
return false;
|
||||
@@ -1224,12 +1251,12 @@ bool BattlegroundAV::SetupBattleground()
|
||||
}
|
||||
else //horde towers
|
||||
{
|
||||
if (!AddObject(i + 7, BG_AV_OBJECTID_BANNER_CONT_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i + 29, BG_AV_OBJECTID_BANNER_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PA, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_H, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(i + 7, BG_AV_OBJECTID_BANNER_CONT_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i + 29, BG_AV_OBJECTID_BANNER_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, std::sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, std::sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PA, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, std::sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_H, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, std::sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!4");
|
||||
return false;
|
||||
@@ -1237,9 +1264,9 @@ bool BattlegroundAV::SetupBattleground()
|
||||
}
|
||||
for (uint8 j = 0; j <= 9; j++) //burning aura
|
||||
{
|
||||
if (!AddObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j][3] / 2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j][3] / 2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!5.%i", i);
|
||||
LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!5.{}", i);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1251,17 +1278,17 @@ bool BattlegroundAV::SetupBattleground()
|
||||
{
|
||||
if (j < 5)
|
||||
{
|
||||
if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE + (i * 10) + j, BG_AV_OBJECTID_SMOKE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3] / 2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE + (i * 10) + j, BG_AV_OBJECTID_SMOKE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3] / 2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!6.%i", i);
|
||||
LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!6.{}", i);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE + (i * 10) + j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3] / 2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE + (i * 10) + j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3] / 2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!7.%i", i);
|
||||
LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!7.{}", i);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1269,34 +1296,34 @@ bool BattlegroundAV::SetupBattleground()
|
||||
}
|
||||
for (uint16 i = 0; i <= (BG_AV_OBJECT_MINE_SUPPLY_N_MAX - BG_AV_OBJECT_MINE_SUPPLY_N_MIN); i++)
|
||||
{
|
||||
if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_N_MIN + i, BG_AV_OBJECTID_MINE_N, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][3] / 2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_N_MIN + i, BG_AV_OBJECTID_MINE_N, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][3] / 2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.5.%i", i);
|
||||
LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.5.{}", i);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (uint16 i = 0; i <= (BG_AV_OBJECT_MINE_SUPPLY_S_MAX - BG_AV_OBJECT_MINE_SUPPLY_S_MIN); i++)
|
||||
{
|
||||
if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN + i, BG_AV_OBJECTID_MINE_S, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][3] / 2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN + i, BG_AV_OBJECTID_MINE_S, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][3] / 2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.6.%i", i);
|
||||
LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.6.{}", i);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECTID_BANNER_SNOWFALL_N, BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3], 0, 0, sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3] / 2), cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3] / 2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECTID_BANNER_SNOWFALL_N, BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3], 0, 0, std::sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3] / 2), cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3] / 2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!8");
|
||||
return false;
|
||||
}
|
||||
for (uint8 i = 0; i < 4; i++)
|
||||
{
|
||||
if (!AddObject(BG_AV_OBJECT_SNOW_EYECANDY_A + i, BG_AV_OBJECTID_SNOWFALL_CANDY_A, BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PA + i, BG_AV_OBJECTID_SNOWFALL_CANDY_PA, BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_H + i, BG_AV_OBJECTID_SNOWFALL_CANDY_H, BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PH + i, BG_AV_OBJECTID_SNOWFALL_CANDY_PH, BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_SNOW_EYECANDY_A + i, BG_AV_OBJECTID_SNOWFALL_CANDY_A, BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PA + i, BG_AV_OBJECTID_SNOWFALL_CANDY_PA, BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_H + i, BG_AV_OBJECTID_SNOWFALL_CANDY_H, BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PH + i, BG_AV_OBJECTID_SNOWFALL_CANDY_PH, BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!9.%i", i);
|
||||
LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!9.{}", i);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1305,17 +1332,17 @@ bool BattlegroundAV::SetupBattleground()
|
||||
if (IsHolidayActive(HOLIDAY_FEAST_OF_WINTER_VEIL))
|
||||
for (uint16 i = 0 ; i <= (BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MAX - BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN); i++)
|
||||
{
|
||||
if (!AddObject(BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN + i, BG_AV_OBJECTID_HARDPACKED_SNOWDRIFT, BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN + i][0], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN + i][1], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN + i][2], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN + i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN + i][3] / 2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN + i, BG_AV_OBJECTID_HARDPACKED_SNOWDRIFT, BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN + i][0], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN + i][1], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN + i][2], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN + i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN + i][3] / 2), RESPAWN_ONE_DAY))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Quest banners
|
||||
if (!AddObject(BG_AV_OBJECT_FROSTWOLF_BANNER, BG_AV_OBJECTID_FROSTWOLF_BANNER, BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][0], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][1], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][2], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3] / 2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_FROSTWOLF_BANNER, BG_AV_OBJECTID_FROSTWOLF_BANNER, BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][0], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][1], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][2], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3] / 2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!8");
|
||||
return false;
|
||||
}
|
||||
if (!AddObject(BG_AV_OBJECT_STORMPIKE_BANNER, BG_AV_OBJECTID_STORMPIKE_BANNER, BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][0], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][1], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][2], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3] / 2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_STORMPIKE_BANNER, BG_AV_OBJECTID_STORMPIKE_BANNER, BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][0], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][1], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][2], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3] / 2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!8");
|
||||
return false;
|
||||
@@ -1391,9 +1418,9 @@ bool BattlegroundAV::SetupBattleground()
|
||||
|
||||
if (
|
||||
// alliance gates
|
||||
!AddObject(BG_AV_OBJECT_DOOR_A, BG_AV_OBJECTID_GATE_A, BG_AV_DoorPositons[0][0], BG_AV_DoorPositons[0][1], BG_AV_DoorPositons[0][2], BG_AV_DoorPositons[0][3], 0, 0, sin(BG_AV_DoorPositons[0][3] / 2), cos(BG_AV_DoorPositons[0][3] / 2), RESPAWN_IMMEDIATELY)
|
||||
!AddObject(BG_AV_OBJECT_DOOR_A, BG_AV_OBJECTID_GATE_A, BG_AV_DoorPositons[0][0], BG_AV_DoorPositons[0][1], BG_AV_DoorPositons[0][2], BG_AV_DoorPositons[0][3], 0, 0, std::sin(BG_AV_DoorPositons[0][3] / 2), cos(BG_AV_DoorPositons[0][3] / 2), RESPAWN_IMMEDIATELY)
|
||||
// horde gates
|
||||
|| !AddObject(BG_AV_OBJECT_DOOR_H, BG_AV_OBJECTID_GATE_H, BG_AV_DoorPositons[1][0], BG_AV_DoorPositons[1][1], BG_AV_DoorPositons[1][2], BG_AV_DoorPositons[1][3], 0, 0, sin(BG_AV_DoorPositons[1][3] / 2), cos(BG_AV_DoorPositons[1][3] / 2), RESPAWN_IMMEDIATELY))
|
||||
|| !AddObject(BG_AV_OBJECT_DOOR_H, BG_AV_OBJECTID_GATE_H, BG_AV_DoorPositons[1][0], BG_AV_DoorPositons[1][1], BG_AV_DoorPositons[1][2], BG_AV_DoorPositons[1][3], 0, 0, std::sin(BG_AV_DoorPositons[1][3] / 2), cos(BG_AV_DoorPositons[1][3] / 2), RESPAWN_IMMEDIATELY))
|
||||
{
|
||||
LOG_ERROR("sql.sql", "BatteGroundAV: Failed to spawn some object Battleground not created!1");
|
||||
return false;
|
||||
@@ -1437,7 +1464,7 @@ char const* BattlegroundAV::GetNodeName(BG_AV_Nodes node)
|
||||
case BG_AV_NODES_FROSTWOLF_HUT:
|
||||
return GetAcoreString(LANG_BG_AV_NODE_GRAVE_FROST_HUT);
|
||||
default:
|
||||
LOG_ERROR("bg.battleground", "tried to get name for node %u", node);
|
||||
LOG_ERROR("bg.battleground", "tried to get name for node {}", node);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#define __BATTLEGROUNDAV_H
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundScore.h"
|
||||
|
||||
#define LANG_BG_AV_A_CAPTAIN_BUFF "Begone. Uncouth scum! The Alliance shall prevail in Alterac Valley!"
|
||||
#define LANG_BG_AV_H_CAPTAIN_BUFF "Now is the time to attack! For the Horde!"
|
||||
@@ -51,6 +52,16 @@
|
||||
|
||||
#define AV_EVENT_START_BATTLE 9166 // Achievement: The Alterac Blitz
|
||||
|
||||
enum BG_AV_BroadcastTexts
|
||||
{
|
||||
BG_AV_TEXT_START_ONE_MINUTE = 10638,
|
||||
BG_AV_TEXT_START_HALF_MINUTE = 10639,
|
||||
BG_AV_TEXT_BATTLE_HAS_BEGUN = 10640,
|
||||
|
||||
BG_AV_TEXT_ALLIANCE_NEAR_LOSE = 23210,
|
||||
BG_AV_TEXT_HORDE_NEAR_LOSE = 23211
|
||||
};
|
||||
|
||||
enum BG_AV_Sounds
|
||||
{
|
||||
//TODO: get out if there comes a sound when neutral team captures mine
|
||||
@@ -100,11 +111,14 @@ enum BG_AV_Sounds
|
||||
|
||||
enum BG_AV_OTHER_VALUES
|
||||
{
|
||||
AV_STATICCPLACE_MAX = 123,
|
||||
AV_NORTH_MINE = 0,
|
||||
AV_SOUTH_MINE = 1,
|
||||
AV_MINE_TICK_TIMER = 45000,
|
||||
AV_MINE_RECLAIM_TIMER = 1200000 //TODO: get the right value.. this is currently 20 minutes
|
||||
AV_STATICCPLACE_MAX = 123,
|
||||
AV_NORTH_MINE = 0,
|
||||
AV_SOUTH_MINE = 1,
|
||||
AV_MINE_TICK_TIMER = 45000,
|
||||
AV_MINE_RECLAIM_TIMER = 1200000, //TODO: get the right value.. this is currently 20 minutes
|
||||
BG_AV_QUEST_CREDIT_MINE = 13796,
|
||||
BG_AV_QUEST_CREDIT_TOWER = 13778,
|
||||
BG_AV_QUEST_CREDIT_GRAVEYARD = 13756
|
||||
};
|
||||
|
||||
enum BG_AV_ObjectIds
|
||||
@@ -1341,6 +1355,7 @@ enum BG_AV_BUFF
|
||||
AV_BUFF_A_CAPTAIN = 23693, //the buff which the alliance captain does
|
||||
AV_BUFF_H_CAPTAIN = 22751 //the buff which the horde captain does
|
||||
};
|
||||
|
||||
enum BG_AV_States
|
||||
{
|
||||
POINT_NEUTRAL = 0,
|
||||
@@ -1551,17 +1566,47 @@ struct BG_AV_NodeInfo
|
||||
|
||||
inline BG_AV_Nodes& operator++(BG_AV_Nodes& i) { return i = BG_AV_Nodes(i + 1); }
|
||||
|
||||
struct BattlegroundAVScore : public BattlegroundScore
|
||||
struct BattlegroundAVScore final : public BattlegroundScore
|
||||
{
|
||||
explicit BattlegroundAVScore(Player* player) : BattlegroundScore(player), GraveyardsAssaulted(0), GraveyardsDefended(0), TowersAssaulted(0), TowersDefended(0), MinesCaptured(0), LeadersKilled(0), SecondaryObjectives(0) { }
|
||||
~BattlegroundAVScore() override { }
|
||||
uint32 GraveyardsAssaulted;
|
||||
uint32 GraveyardsDefended;
|
||||
uint32 TowersAssaulted;
|
||||
uint32 TowersDefended;
|
||||
uint32 MinesCaptured;
|
||||
uint32 LeadersKilled;
|
||||
uint32 SecondaryObjectives;
|
||||
friend class BattlegroundAV;
|
||||
|
||||
protected:
|
||||
explicit BattlegroundAVScore(ObjectGuid playerGuid) : BattlegroundScore(playerGuid) { }
|
||||
|
||||
void UpdateScore(uint32 type, uint32 value) override
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_GRAVEYARDS_ASSAULTED:
|
||||
GraveyardsAssaulted += value;
|
||||
break;
|
||||
case SCORE_GRAVEYARDS_DEFENDED:
|
||||
GraveyardsDefended += value;
|
||||
break;
|
||||
case SCORE_TOWERS_ASSAULTED:
|
||||
TowersAssaulted += value;
|
||||
break;
|
||||
case SCORE_TOWERS_DEFENDED:
|
||||
TowersDefended += value;
|
||||
break;
|
||||
case SCORE_MINES_CAPTURED:
|
||||
MinesCaptured += value;
|
||||
break;
|
||||
default:
|
||||
BattlegroundScore::UpdateScore(type, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BuildObjectivesBlock(WorldPacket& data) final;
|
||||
|
||||
uint32 GraveyardsAssaulted = 0;
|
||||
uint32 GraveyardsDefended = 0;
|
||||
uint32 TowersAssaulted = 0;
|
||||
uint32 TowersDefended = 0;
|
||||
uint32 MinesCaptured = 0;
|
||||
//uint32 LeadersKilled;
|
||||
//uint32 SecondaryObjectives;
|
||||
|
||||
uint32 GetAttr1() const final { return GraveyardsAssaulted; }
|
||||
uint32 GetAttr2() const final { return GraveyardsDefended; }
|
||||
@@ -1570,11 +1615,11 @@ struct BattlegroundAVScore : public BattlegroundScore
|
||||
uint32 GetAttr5() const final { return MinesCaptured; }
|
||||
};
|
||||
|
||||
class BattlegroundAV : public Battleground
|
||||
class AC_GAME_API BattlegroundAV : public Battleground
|
||||
{
|
||||
public:
|
||||
BattlegroundAV();
|
||||
~BattlegroundAV() override;
|
||||
~BattlegroundAV() override = default;
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player) override;
|
||||
@@ -1588,7 +1633,7 @@ public:
|
||||
|
||||
/*general stuff*/
|
||||
void UpdateScore(TeamId teamId, int16 points);
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
|
||||
bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
|
||||
|
||||
/*handlestuff*/ //these are functions which get called from extern
|
||||
void EventPlayerClickedOnFlag(Player* source, GameObject* gameObject) override;
|
||||
@@ -1607,6 +1652,10 @@ public:
|
||||
|
||||
TeamId GetPrematureWinner() override;
|
||||
|
||||
[[nodiscard]] BG_AV_NodeInfo const& GetAVNodeInfo(uint32 node) const { return m_Nodes[node]; }
|
||||
[[nodiscard]] bool IsCaptainAlive(uint8 index) const { return m_CaptainAlive[index]; }
|
||||
[[nodiscard]] TeamId GetMineOwner(uint8 index) const { return m_Mine_Owner[index]; }
|
||||
|
||||
private:
|
||||
void PostUpdateImpl(uint32 diff) override;
|
||||
|
||||
@@ -1621,7 +1670,7 @@ private:
|
||||
void DefendNode(BG_AV_Nodes node, TeamId teamId);
|
||||
|
||||
void PopulateNode(BG_AV_Nodes node);
|
||||
void DePopulateNode(BG_AV_Nodes node);
|
||||
void DePopulateNode(BG_AV_Nodes node, bool ignoreSpiritGuid = false);
|
||||
|
||||
BG_AV_Nodes GetNodeThroughObject(uint32 object);
|
||||
uint32 GetObjectThroughNode(BG_AV_Nodes node);
|
||||
|
||||
@@ -16,31 +16,13 @@
|
||||
*/
|
||||
|
||||
#include "BattlegroundBE.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "Object.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
BattlegroundBE::BattlegroundBE()
|
||||
{
|
||||
BgObjects.resize(BG_BE_OBJECT_MAX);
|
||||
|
||||
StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M;
|
||||
StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
|
||||
StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
|
||||
StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
|
||||
//we must set messageIds
|
||||
StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS;
|
||||
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS;
|
||||
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
|
||||
}
|
||||
|
||||
BattlegroundBE::~BattlegroundBE()
|
||||
{
|
||||
}
|
||||
|
||||
void BattlegroundBE::StartingEventCloseDoors()
|
||||
@@ -61,39 +43,6 @@ void BattlegroundBE::StartingEventOpenDoors()
|
||||
SpawnBGObject(i, 60);
|
||||
}
|
||||
|
||||
void BattlegroundBE::AddPlayer(Player* player)
|
||||
{
|
||||
Battleground::AddPlayer(player);
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundScore(player);
|
||||
Battleground::UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattlegroundBE::RemovePlayer(Player* /*player*/)
|
||||
{
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
Battleground::UpdateArenaWorldState();
|
||||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
void BattlegroundBE::HandleKillPlayer(Player* player, Player* killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
if (!killer)
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "Killer player not found");
|
||||
return;
|
||||
}
|
||||
|
||||
Battleground::HandleKillPlayer(player, killer);
|
||||
|
||||
Battleground::UpdateArenaWorldState();
|
||||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
bool BattlegroundBE::HandlePlayerUnderMap(Player* player)
|
||||
{
|
||||
player->NearTeleportTo(6238.930176f, 262.963470f, 0.889519f, player->GetOrientation());
|
||||
@@ -140,14 +89,8 @@ void BattlegroundBE::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
|
||||
void BattlegroundBE::FillInitialWorldStates(WorldPacket& data)
|
||||
{
|
||||
data << uint32(0x9f3) << uint32(1); // 9
|
||||
Battleground::UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattlegroundBE::Init()
|
||||
{
|
||||
//call parent's class reset
|
||||
Battleground::Init();
|
||||
data << uint32(0x9f3) << uint32(1); // 9
|
||||
Arena::FillInitialWorldStates(data);
|
||||
}
|
||||
|
||||
bool BattlegroundBE::SetupBattleground()
|
||||
@@ -170,8 +113,3 @@ bool BattlegroundBE::SetupBattleground()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BattlegroundBE::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
Battleground::UpdatePlayerScore(player, type, value, doAddHonor);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#ifndef __BATTLEGROUNDBE_H
|
||||
#define __BATTLEGROUNDBE_H
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "Arena.h"
|
||||
|
||||
enum BattlegroundBEObjectTypes
|
||||
{
|
||||
@@ -33,7 +33,7 @@ enum BattlegroundBEObjectTypes
|
||||
BG_BE_OBJECT_MAX = 8
|
||||
};
|
||||
|
||||
enum BattlegroundBEObjects
|
||||
enum BattlegroundBEGameObjects
|
||||
{
|
||||
BG_BE_OBJECT_TYPE_DOOR_1 = 183971,
|
||||
BG_BE_OBJECT_TYPE_DOOR_2 = 183973,
|
||||
@@ -43,26 +43,19 @@ enum BattlegroundBEObjects
|
||||
BG_BE_OBJECT_TYPE_BUFF_2 = 184664
|
||||
};
|
||||
|
||||
class BattlegroundBE : public Battleground
|
||||
class AC_GAME_API BattlegroundBE : public Arena
|
||||
{
|
||||
public:
|
||||
BattlegroundBE();
|
||||
~BattlegroundBE() override;
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player) override;
|
||||
void StartingEventCloseDoors() override;
|
||||
void StartingEventOpenDoors() override;
|
||||
|
||||
void RemovePlayer(Player* player) override;
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger) override;
|
||||
bool SetupBattleground() override;
|
||||
void Init() override;
|
||||
void FillInitialWorldStates(WorldPacket& d) override;
|
||||
void HandleKillPlayer(Player* player, Player* killer) override;
|
||||
bool HandlePlayerUnderMap(Player* player) override;
|
||||
|
||||
/* Scorekeeping */
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "BattlegroundDS.h"
|
||||
#include "ArenaScore.h"
|
||||
#include "Creature.h"
|
||||
#include "GameObject.h"
|
||||
#include "Language.h"
|
||||
@@ -30,25 +31,8 @@ BattlegroundDS::BattlegroundDS()
|
||||
BgObjects.resize(BG_DS_OBJECT_MAX);
|
||||
BgCreatures.resize(BG_DS_NPC_MAX);
|
||||
|
||||
_waterfallTimer = 0;
|
||||
_waterfallStatus = 0;
|
||||
_waterfallKnockbackTimer = 0;
|
||||
_pipeKnockBackTimer = 0;
|
||||
_pipeKnockBackCount = 0;
|
||||
|
||||
StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M;
|
||||
StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
|
||||
StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
|
||||
StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
|
||||
//we must set messageIds
|
||||
StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS;
|
||||
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS;
|
||||
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
|
||||
}
|
||||
|
||||
BattlegroundDS::~BattlegroundDS()
|
||||
{
|
||||
}
|
||||
|
||||
void BattlegroundDS::PostUpdateImpl(uint32 diff)
|
||||
@@ -56,64 +40,58 @@ void BattlegroundDS::PostUpdateImpl(uint32 diff)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
if (getPipeKnockBackCount() < BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT)
|
||||
_events.Update(diff);
|
||||
|
||||
while (uint32 eventId = _events.ExecuteEvent())
|
||||
{
|
||||
if (getPipeKnockBackTimer() < diff)
|
||||
switch (eventId)
|
||||
{
|
||||
case BG_DS_EVENT_WATERFALL_WARNING:
|
||||
// Add the water
|
||||
DoorClose(BG_DS_OBJECT_WATER_2);
|
||||
_events.ScheduleEvent(BG_DS_EVENT_WATERFALL_ON, BG_DS_WATERFALL_WARNING_DURATION);
|
||||
break;
|
||||
case BG_DS_EVENT_WATERFALL_ON:
|
||||
// Active collision and start knockback timer
|
||||
DoorClose(BG_DS_OBJECT_WATER_1);
|
||||
_events.ScheduleEvent(BG_DS_EVENT_WATERFALL_OFF, BG_DS_WATERFALL_DURATION);
|
||||
_events.ScheduleEvent(BG_DS_EVENT_WATERFALL_KNOCKBACK, BG_DS_WATERFALL_KNOCKBACK_TIMER);
|
||||
break;
|
||||
case BG_DS_EVENT_WATERFALL_OFF:
|
||||
// Remove collision and water
|
||||
DoorOpen(BG_DS_OBJECT_WATER_1);
|
||||
DoorOpen(BG_DS_OBJECT_WATER_2);
|
||||
_events.CancelEvent(BG_DS_EVENT_WATERFALL_KNOCKBACK);
|
||||
_events.ScheduleEvent(BG_DS_EVENT_WATERFALL_WARNING, BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX);
|
||||
break;
|
||||
case BG_DS_EVENT_WATERFALL_KNOCKBACK:
|
||||
// Repeat knockback while the waterfall still active
|
||||
if (Creature* waterSpout = GetBGCreature(BG_DS_NPC_WATERFALL_KNOCKBACK))
|
||||
waterSpout->CastSpell(waterSpout, BG_DS_SPELL_WATER_SPOUT, true);
|
||||
_events.ScheduleEvent(eventId, BG_DS_WATERFALL_KNOCKBACK_TIMER);
|
||||
break;
|
||||
case BG_DS_EVENT_PIPE_KNOCKBACK:
|
||||
for (uint32 i = BG_DS_NPC_PIPE_KNOCKBACK_1; i <= BG_DS_NPC_PIPE_KNOCKBACK_2; ++i)
|
||||
if (Creature* waterSpout = GetBGCreature(i))
|
||||
waterSpout->CastSpell(waterSpout, BG_DS_SPELL_FLUSH, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (_pipeKnockBackCount < BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT)
|
||||
{
|
||||
if (_pipeKnockBackTimer < diff)
|
||||
{
|
||||
for (uint32 i = BG_DS_NPC_PIPE_KNOCKBACK_1; i <= BG_DS_NPC_PIPE_KNOCKBACK_2; ++i)
|
||||
if (Creature* waterSpout = GetBgMap()->GetCreature(BgCreatures[i]))
|
||||
if (Creature* waterSpout = GetBGCreature(i))
|
||||
waterSpout->CastSpell(waterSpout, BG_DS_SPELL_FLUSH, true);
|
||||
|
||||
setPipeKnockBackCount(getPipeKnockBackCount() + 1);
|
||||
setPipeKnockBackTimer(BG_DS_PIPE_KNOCKBACK_DELAY);
|
||||
++_pipeKnockBackCount;
|
||||
_pipeKnockBackTimer = BG_DS_PIPE_KNOCKBACK_DELAY;
|
||||
}
|
||||
else
|
||||
setPipeKnockBackTimer(getPipeKnockBackTimer() - diff);
|
||||
_pipeKnockBackTimer -= diff;
|
||||
}
|
||||
|
||||
if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_ON) // Repeat knockback while the waterfall still active
|
||||
{
|
||||
if (getWaterFallKnockbackTimer() < diff)
|
||||
{
|
||||
if (Creature* waterSpout = GetBgMap()->GetCreature(BgCreatures[BG_DS_NPC_WATERFALL_KNOCKBACK]))
|
||||
waterSpout->CastSpell(waterSpout, BG_DS_SPELL_WATER_SPOUT, true);
|
||||
|
||||
setWaterFallKnockbackTimer(BG_DS_WATERFALL_KNOCKBACK_TIMER);
|
||||
}
|
||||
else
|
||||
setWaterFallKnockbackTimer(getWaterFallKnockbackTimer() - diff);
|
||||
}
|
||||
|
||||
if (getWaterFallTimer() < diff)
|
||||
{
|
||||
if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_OFF) // Add the water
|
||||
{
|
||||
DoorClose(BG_DS_OBJECT_WATER_2);
|
||||
setWaterFallTimer(BG_DS_WATERFALL_WARNING_DURATION);
|
||||
setWaterFallStatus(BG_DS_WATERFALL_STATUS_WARNING);
|
||||
}
|
||||
else if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_WARNING) // Active collision and perform knockback
|
||||
{
|
||||
if (GameObject* gob = GetBgMap()->GetGameObject(BgObjects[BG_DS_OBJECT_WATER_1]))
|
||||
gob->SetGoState(GO_STATE_READY);
|
||||
|
||||
setWaterFallTimer(BG_DS_WATERFALL_DURATION);
|
||||
setWaterFallStatus(BG_DS_WATERFALL_STATUS_ON);
|
||||
setWaterFallKnockbackTimer(BG_DS_WATERFALL_KNOCKBACK_TIMER);
|
||||
}
|
||||
else //if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_ON) // Remove collision and water
|
||||
{
|
||||
// turn off collision
|
||||
if (GameObject* gob = GetBgMap()->GetGameObject(BgObjects[BG_DS_OBJECT_WATER_1]))
|
||||
gob->SetGoState(GO_STATE_ACTIVE);
|
||||
|
||||
DoorOpen(BG_DS_OBJECT_WATER_2);
|
||||
setWaterFallTimer(urand(BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX));
|
||||
setWaterFallStatus(BG_DS_WATERFALL_STATUS_OFF);
|
||||
}
|
||||
}
|
||||
else
|
||||
setWaterFallTimer(getWaterFallTimer() - diff);
|
||||
}
|
||||
|
||||
void BattlegroundDS::StartingEventCloseDoors()
|
||||
@@ -130,11 +108,12 @@ void BattlegroundDS::StartingEventOpenDoors()
|
||||
for (uint32 i = BG_DS_OBJECT_BUFF_1; i <= BG_DS_OBJECT_BUFF_2; ++i)
|
||||
SpawnBGObject(i, 60);
|
||||
|
||||
setWaterFallTimer(urand(BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX));
|
||||
setWaterFallStatus(BG_DS_WATERFALL_STATUS_OFF);
|
||||
_events.ScheduleEvent(BG_DS_EVENT_WATERFALL_WARNING, BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX);
|
||||
//for (uint8 i = 0; i < BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT; ++i)
|
||||
// _events.ScheduleEvent(BG_DS_EVENT_PIPE_KNOCKBACK, BG_DS_PIPE_KNOCKBACK_FIRST_DELAY + i * BG_DS_PIPE_KNOCKBACK_DELAY);
|
||||
|
||||
setPipeKnockBackTimer(BG_DS_PIPE_KNOCKBACK_FIRST_DELAY);
|
||||
setPipeKnockBackCount(0);
|
||||
_pipeKnockBackCount = 0;
|
||||
_pipeKnockBackTimer = BG_DS_PIPE_KNOCKBACK_FIRST_DELAY;
|
||||
|
||||
SpawnBGObject(BG_DS_OBJECT_WATER_2, RESPAWN_IMMEDIATELY);
|
||||
DoorOpen(BG_DS_OBJECT_WATER_2);
|
||||
@@ -149,39 +128,6 @@ void BattlegroundDS::StartingEventOpenDoors()
|
||||
itr->second->RemoveAurasDueToSpell(48018);
|
||||
}
|
||||
|
||||
void BattlegroundDS::AddPlayer(Player* player)
|
||||
{
|
||||
Battleground::AddPlayer(player);
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundScore(player);
|
||||
Battleground::UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattlegroundDS::RemovePlayer(Player* /*player*/)
|
||||
{
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
Battleground::UpdateArenaWorldState();
|
||||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
void BattlegroundDS::HandleKillPlayer(Player* player, Player* killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
if (!killer)
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "BattlegroundDS: Killer player not found");
|
||||
return;
|
||||
}
|
||||
|
||||
Battleground::HandleKillPlayer(player, killer);
|
||||
|
||||
Battleground::UpdateArenaWorldState();
|
||||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
void BattlegroundDS::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
@@ -192,13 +138,13 @@ void BattlegroundDS::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
case 5347:
|
||||
case 5348:
|
||||
// Remove effects of Demonic Circle Summon
|
||||
if (player->HasAura(48018))
|
||||
player->RemoveAurasDueToSpell(48018);
|
||||
if (player->HasAura(SPELL_WARL_DEMONIC_CIRCLE))
|
||||
player->RemoveAurasDueToSpell(SPELL_WARL_DEMONIC_CIRCLE);
|
||||
|
||||
// Someone has get back into the pipes and the knockback has already been performed,
|
||||
// so we reset the knockback count for kicking the player again into the arena.
|
||||
if (getPipeKnockBackCount() >= BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT)
|
||||
setPipeKnockBackCount(0);
|
||||
if (_pipeKnockBackCount >= BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT)
|
||||
_pipeKnockBackCount = 0;
|
||||
break;
|
||||
// OUTSIDE OF ARENA, TELEPORT!
|
||||
case 5328:
|
||||
@@ -218,6 +164,9 @@ void BattlegroundDS::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
case 5344: // -60
|
||||
player->NearTeleportTo(1330.0f, 800.0f, 3.16f, player->GetOrientation());
|
||||
break;
|
||||
/*default:
|
||||
Battleground::HandleAreaTrigger(player, trigger);
|
||||
break;*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,13 +179,7 @@ bool BattlegroundDS::HandlePlayerUnderMap(Player* player)
|
||||
void BattlegroundDS::FillInitialWorldStates(WorldPacket& data)
|
||||
{
|
||||
data << uint32(3610) << uint32(1); // 9 show
|
||||
Battleground::UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattlegroundDS::Init()
|
||||
{
|
||||
//call parent's class reset
|
||||
Battleground::Init();
|
||||
Arena::FillInitialWorldStates(data);
|
||||
}
|
||||
|
||||
bool BattlegroundDS::SetupBattleground()
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
#ifndef __BATTLEGROUNDDS_H
|
||||
#define __BATTLEGROUNDDS_H
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "Arena.h"
|
||||
#include "Duration.h"
|
||||
#include "EventMap.h"
|
||||
|
||||
enum BattlegroundDSObjectTypes
|
||||
{
|
||||
@@ -33,7 +35,7 @@ enum BattlegroundDSObjectTypes
|
||||
BG_DS_OBJECT_MAX = 8
|
||||
};
|
||||
|
||||
enum BattlegroundDSObjects
|
||||
enum BattlegroundDSGameObjects
|
||||
{
|
||||
BG_DS_OBJECT_TYPE_DOOR_1 = 192642,
|
||||
BG_DS_OBJECT_TYPE_DOOR_2 = 192643,
|
||||
@@ -61,62 +63,54 @@ enum BattlegroundDSSpells
|
||||
BG_DS_SPELL_FLUSH = 57405, // Visual and target selector for the starting knockback from the pipe
|
||||
BG_DS_SPELL_FLUSH_KNOCKBACK = 61698, // Knockback effect for previous spell (triggered, not need to be casted)
|
||||
BG_DS_SPELL_WATER_SPOUT = 58873, // Knockback effect of the central waterfall
|
||||
SPELL_WARL_DEMONIC_CIRCLE = 48018 // Demonic Circle Summon
|
||||
};
|
||||
|
||||
enum BattlegroundDSData
|
||||
{
|
||||
// These values are NOT blizzlike... need the correct data!
|
||||
BG_DS_WATERFALL_TIMER_MIN = 30000,
|
||||
BG_DS_WATERFALL_TIMER_MAX = 60000,
|
||||
BG_DS_WATERFALL_WARNING_DURATION = 5000,
|
||||
BG_DS_WATERFALL_DURATION = 30000,
|
||||
BG_DS_WATERFALL_KNOCKBACK_TIMER = 1500,
|
||||
|
||||
BG_DS_PIPE_KNOCKBACK_FIRST_DELAY = 5000,
|
||||
BG_DS_PIPE_KNOCKBACK_DELAY = 3000,
|
||||
BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT = 2,
|
||||
|
||||
BG_DS_WATERFALL_STATUS_WARNING = 1, // Water starting to fall, but no LoS Blocking nor movement blocking
|
||||
BG_DS_WATERFALL_STATUS_ON = 2, // LoS and Movement blocking active
|
||||
BG_DS_WATERFALL_STATUS_OFF = 3,
|
||||
BG_DS_PIPE_KNOCKBACK_FIRST_DELAY = 5000,
|
||||
BG_DS_PIPE_KNOCKBACK_DELAY = 3000,
|
||||
BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT = 2,
|
||||
};
|
||||
|
||||
class BattlegroundDS : public Battleground
|
||||
// These values are NOT blizzlike... need the correct data!
|
||||
constexpr Seconds BG_DS_WATERFALL_TIMER_MIN = 30s;
|
||||
constexpr Seconds BG_DS_WATERFALL_TIMER_MAX = 60s;
|
||||
constexpr Seconds BG_DS_WATERFALL_WARNING_DURATION = 5s;
|
||||
constexpr Seconds BG_DS_WATERFALL_DURATION = 30s;
|
||||
constexpr Milliseconds BG_DS_WATERFALL_KNOCKBACK_TIMER = 1500ms;
|
||||
|
||||
enum BattlegroundDSEvents
|
||||
{
|
||||
BG_DS_EVENT_WATERFALL_WARNING = 1, // Water starting to fall, but no LoS Blocking nor movement blocking
|
||||
BG_DS_EVENT_WATERFALL_ON = 2, // LoS and Movement blocking active
|
||||
BG_DS_EVENT_WATERFALL_OFF = 3,
|
||||
BG_DS_EVENT_WATERFALL_KNOCKBACK = 4,
|
||||
|
||||
BG_DS_EVENT_PIPE_KNOCKBACK = 5
|
||||
};
|
||||
|
||||
class AC_GAME_API BattlegroundDS : public Arena
|
||||
{
|
||||
public:
|
||||
BattlegroundDS();
|
||||
~BattlegroundDS() override;
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player) override;
|
||||
void StartingEventCloseDoors() override;
|
||||
void StartingEventOpenDoors() override;
|
||||
|
||||
void RemovePlayer(Player* player) override;
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger) override;
|
||||
bool SetupBattleground() override;
|
||||
void Init() override;
|
||||
void FillInitialWorldStates(WorldPacket& d) override;
|
||||
void HandleKillPlayer(Player* player, Player* killer) override;
|
||||
bool HandlePlayerUnderMap(Player* player) override;
|
||||
|
||||
private:
|
||||
uint32 _waterfallTimer;
|
||||
uint8 _waterfallStatus;
|
||||
uint32 _waterfallKnockbackTimer;
|
||||
void PostUpdateImpl(uint32 diff) override;
|
||||
|
||||
uint32 _pipeKnockBackTimer;
|
||||
uint8 _pipeKnockBackCount;
|
||||
|
||||
void PostUpdateImpl(uint32 diff) override;
|
||||
protected:
|
||||
uint32 getWaterFallStatus() { return _waterfallStatus; };
|
||||
void setWaterFallStatus(uint8 status) { _waterfallStatus = status; };
|
||||
uint32 getWaterFallTimer() { return _waterfallTimer; };
|
||||
void setWaterFallTimer(uint32 timer) { _waterfallTimer = timer; };
|
||||
uint32 getWaterFallKnockbackTimer() { return _waterfallKnockbackTimer; };
|
||||
void setWaterFallKnockbackTimer(uint32 timer) { _waterfallKnockbackTimer = timer; };
|
||||
uint8 getPipeKnockBackCount() { return _pipeKnockBackCount; };
|
||||
void setPipeKnockBackCount(uint8 count) { _pipeKnockBackCount = count; };
|
||||
uint32 getPipeKnockBackTimer() { return _pipeKnockBackTimer; };
|
||||
void setPipeKnockBackTimer(uint32 timer) { _pipeKnockBackTimer = timer; };
|
||||
EventMap _events;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "Creature.h"
|
||||
#include "GameGraveyard.h"
|
||||
#include "GameTime.h"
|
||||
#include "Language.h"
|
||||
#include "Object.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "Util.h"
|
||||
@@ -28,6 +28,12 @@
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
void BattlegroundEYScore::BuildObjectivesBlock(WorldPacket& data)
|
||||
{
|
||||
data << uint32(1); // Objectives Count
|
||||
data << uint32(FlagCaptures);
|
||||
}
|
||||
|
||||
BattlegroundEY::BattlegroundEY()
|
||||
{
|
||||
m_BuffChange = true;
|
||||
@@ -43,11 +49,6 @@ BattlegroundEY::BattlegroundEY()
|
||||
_ownedPointsCount[TEAM_HORDE] = 0;
|
||||
_flagState = BG_EY_FLAG_STATE_ON_BASE;
|
||||
_flagCapturedObject = 0;
|
||||
|
||||
StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_EY_START_TWO_MINUTES;
|
||||
StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_EY_START_ONE_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_EY_START_HALF_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_EY_HAS_BEGUN;
|
||||
}
|
||||
|
||||
BattlegroundEY::~BattlegroundEY()
|
||||
@@ -67,7 +68,7 @@ void BattlegroundEY::PostUpdateImpl(uint32 diff)
|
||||
AddPoints(TEAM_ALLIANCE, BG_EY_TickPoints[_ownedPointsCount[TEAM_ALLIANCE] - 1]);
|
||||
if (_ownedPointsCount[TEAM_HORDE] > 0)
|
||||
AddPoints(TEAM_HORDE, BG_EY_TickPoints[_ownedPointsCount[TEAM_HORDE] - 1]);
|
||||
_bgEvents.ScheduleEvent(BG_EY_EVENT_ADD_POINTS, BG_EY_FPOINTS_TICK_TIME - (World::GetGameTimeMS() % BG_EY_FPOINTS_TICK_TIME));
|
||||
_bgEvents.ScheduleEvent(BG_EY_EVENT_ADD_POINTS, BG_EY_FPOINTS_TICK_TIME - (GameTime::GetGameTimeMS().count() % BG_EY_FPOINTS_TICK_TIME));
|
||||
break;
|
||||
case BG_EY_EVENT_FLAG_ON_GROUND:
|
||||
RespawnFlagAfterDrop();
|
||||
@@ -77,7 +78,7 @@ void BattlegroundEY::PostUpdateImpl(uint32 diff)
|
||||
break;
|
||||
case BG_EY_EVENT_CHECK_CPOINTS:
|
||||
UpdatePointsState();
|
||||
_bgEvents.ScheduleEvent(BG_EY_EVENT_CHECK_CPOINTS, BG_EY_FPOINTS_CHECK_TIME - (World::GetGameTimeMS() % BG_EY_FPOINTS_CHECK_TIME));
|
||||
_bgEvents.ScheduleEvent(BG_EY_EVENT_CHECK_CPOINTS, BG_EY_FPOINTS_CHECK_TIME - (GameTime::GetGameTimeMS().count() % BG_EY_FPOINTS_CHECK_TIME));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -135,15 +136,16 @@ void BattlegroundEY::UpdatePointsState()
|
||||
const BattlegroundPlayerMap& bgPlayerMap = GetPlayers();
|
||||
for (BattlegroundPlayerMap::const_iterator itr = bgPlayerMap.begin(); itr != bgPlayerMap.end(); ++itr)
|
||||
{
|
||||
UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW, itr->second);
|
||||
itr->second->SendUpdateWorldState(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW);
|
||||
for (uint8 point = 0; point < EY_POINTS_MAX; ++point)
|
||||
if (GameObject* pointObject = pointsVec[point])
|
||||
if (itr->second->CanCaptureTowerPoint() && itr->second->IsWithinDistInMap(pointObject, BG_EY_POINT_RADIUS))
|
||||
{
|
||||
UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_SHOW, itr->second);
|
||||
UpdateWorldStateForPlayer(PROGRESS_BAR_PERCENT_GREY, BG_EY_PROGRESS_BAR_PERCENT_GREY, itr->second);
|
||||
UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, _capturePointInfo[point]._barStatus, itr->second);
|
||||
itr->second->SendUpdateWorldState(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_SHOW);
|
||||
itr->second->SendUpdateWorldState(PROGRESS_BAR_PERCENT_GREY, BG_EY_PROGRESS_BAR_PERCENT_GREY);
|
||||
itr->second->SendUpdateWorldState(PROGRESS_BAR_STATUS, _capturePointInfo[point]._barStatus);
|
||||
++_capturePointInfo[point]._playersCount[itr->second->GetTeamId()];
|
||||
_capturePointInfo[point].player = itr->second;
|
||||
|
||||
// Xinef: ugly hax... area trigger is no longer called by client...
|
||||
if (pointObject->GetEntry() == BG_OBJECT_FR_TOWER_CAP_EY_ENTRY && itr->second->GetDistance2d(2043.96f, 1729.68f) < 3.0f)
|
||||
@@ -165,10 +167,10 @@ void BattlegroundEY::UpdatePointsState()
|
||||
if (pointOwnerTeamId != _capturePointInfo[point]._ownerTeamId)
|
||||
{
|
||||
if (_capturePointInfo[point].IsUncontrolled())
|
||||
EventTeamCapturedPoint(pointOwnerTeamId, point);
|
||||
EventTeamCapturedPoint(_capturePointInfo[point].player, pointOwnerTeamId, point);
|
||||
|
||||
if (pointOwnerTeamId == TEAM_NEUTRAL && _capturePointInfo[point].IsUnderControl())
|
||||
EventTeamLostPoint(pointOwnerTeamId, point);
|
||||
EventTeamLostPoint(_capturePointInfo[point].player, point);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -206,7 +208,7 @@ void BattlegroundEY::UpdatePointsIcons(uint32 point)
|
||||
void BattlegroundEY::AddPlayer(Player* player)
|
||||
{
|
||||
Battleground::AddPlayer(player);
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundEYScore(player);
|
||||
PlayerScores.emplace(player->GetGUID().GetCounter(), new BattlegroundEYScore(player->GetGUID()));
|
||||
}
|
||||
|
||||
void BattlegroundEY::RemovePlayer(Player* player)
|
||||
@@ -371,7 +373,7 @@ void BattlegroundEY::RespawnFlag()
|
||||
_flagCapturedObject = 0;
|
||||
SpawnBGObject(BG_EY_OBJECT_FLAG_NETHERSTORM, RESPAWN_IMMEDIATELY);
|
||||
|
||||
SendMessageToAll(LANG_BG_EY_RESETED_FLAG, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
SendBroadcastText(BG_EY_TEXT_FLAG_RESET, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
PlaySoundToAll(BG_EY_SOUND_FLAG_RESET);
|
||||
UpdateWorldState(NETHERSTORM_FLAG, 1);
|
||||
}
|
||||
@@ -413,7 +415,10 @@ void BattlegroundEY::EventPlayerDroppedFlag(Player* player)
|
||||
player->CastSpell(player, SPELL_RECENTLY_DROPPED_FLAG, true);
|
||||
player->CastSpell(player, BG_EY_PLAYER_DROPPED_FLAG_SPELL, true);
|
||||
|
||||
SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, player->GetTeamId() == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE);
|
||||
if (player->GetTeamId() == TEAM_ALLIANCE)
|
||||
SendBroadcastText(BG_EY_TEXT_FLAG_DROPPED, CHAT_MSG_BG_SYSTEM_ALLIANCE);
|
||||
else
|
||||
SendBroadcastText(BG_EY_TEXT_FLAG_DROPPED, CHAT_MSG_BG_SYSTEM_HORDE);
|
||||
}
|
||||
|
||||
void BattlegroundEY::EventPlayerClickedOnFlag(Player* player, GameObject* gameObject)
|
||||
@@ -429,12 +434,16 @@ void BattlegroundEY::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
||||
player->CastSpell(player, BG_EY_NETHERSTORM_FLAG_SPELL, true);
|
||||
player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
|
||||
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, player->GetTeamId() == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, nullptr, player->GetName().c_str());
|
||||
PlaySoundToAll(player->GetTeamId() == TEAM_ALLIANCE ? BG_EY_SOUND_FLAG_PICKED_UP_ALLIANCE : BG_EY_SOUND_FLAG_PICKED_UP_HORDE);
|
||||
UpdateWorldState(NETHERSTORM_FLAG, 0);
|
||||
|
||||
if (player->GetTeamId() == TEAM_ALLIANCE)
|
||||
SendBroadcastText(BG_EY_TEXT_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
else
|
||||
SendBroadcastText(BG_EY_TEXT_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
}
|
||||
|
||||
void BattlegroundEY::EventTeamLostPoint(TeamId /*teamId*/, uint32 point)
|
||||
void BattlegroundEY::EventTeamLostPoint(Player* player, uint32 point)
|
||||
{
|
||||
TeamId oldTeamId = _capturePointInfo[point]._ownerTeamId;
|
||||
if (oldTeamId == TEAM_ALLIANCE)
|
||||
@@ -443,7 +452,7 @@ void BattlegroundEY::EventTeamLostPoint(TeamId /*teamId*/, uint32 point)
|
||||
SpawnBGObject(m_LosingPointTypes[point].DespawnObjectTypeAlliance, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(m_LosingPointTypes[point].DespawnObjectTypeAlliance + 1, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(m_LosingPointTypes[point].DespawnObjectTypeAlliance + 2, RESPAWN_ONE_DAY);
|
||||
SendMessageToAll(m_LosingPointTypes[point].MessageIdAlliance, CHAT_MSG_BG_SYSTEM_ALLIANCE);
|
||||
SendBroadcastText(m_LosingPointTypes[point].MessageIdAlliance, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -451,7 +460,7 @@ void BattlegroundEY::EventTeamLostPoint(TeamId /*teamId*/, uint32 point)
|
||||
SpawnBGObject(m_LosingPointTypes[point].DespawnObjectTypeHorde, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(m_LosingPointTypes[point].DespawnObjectTypeHorde + 1, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(m_LosingPointTypes[point].DespawnObjectTypeHorde + 2, RESPAWN_ONE_DAY);
|
||||
SendMessageToAll(m_LosingPointTypes[point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE);
|
||||
SendBroadcastText(m_LosingPointTypes[point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
}
|
||||
|
||||
SpawnBGObject(m_LosingPointTypes[point].SpawnNeutralObjectType, RESPAWN_IMMEDIATELY);
|
||||
@@ -465,7 +474,7 @@ void BattlegroundEY::EventTeamLostPoint(TeamId /*teamId*/, uint32 point)
|
||||
DelCreature(BG_EY_TRIGGER_FEL_REAVER + point);
|
||||
}
|
||||
|
||||
void BattlegroundEY::EventTeamCapturedPoint(TeamId teamId, uint32 point)
|
||||
void BattlegroundEY::EventTeamCapturedPoint(Player* player, TeamId teamId, uint32 point)
|
||||
{
|
||||
SpawnBGObject(m_CapturingPointTypes[point].DespawnNeutralObjectType, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(m_CapturingPointTypes[point].DespawnNeutralObjectType + 1, RESPAWN_ONE_DAY);
|
||||
@@ -477,7 +486,7 @@ void BattlegroundEY::EventTeamCapturedPoint(TeamId teamId, uint32 point)
|
||||
SpawnBGObject(m_CapturingPointTypes[point].SpawnObjectTypeAlliance, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(m_CapturingPointTypes[point].SpawnObjectTypeAlliance + 1, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(m_CapturingPointTypes[point].SpawnObjectTypeAlliance + 2, RESPAWN_IMMEDIATELY);
|
||||
SendMessageToAll(m_CapturingPointTypes[point].MessageIdAlliance, CHAT_MSG_BG_SYSTEM_ALLIANCE);
|
||||
SendBroadcastText(m_CapturingPointTypes[point].MessageIdAlliance, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -485,7 +494,7 @@ void BattlegroundEY::EventTeamCapturedPoint(TeamId teamId, uint32 point)
|
||||
SpawnBGObject(m_CapturingPointTypes[point].SpawnObjectTypeHorde, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(m_CapturingPointTypes[point].SpawnObjectTypeHorde + 1, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(m_CapturingPointTypes[point].SpawnObjectTypeHorde + 2, RESPAWN_IMMEDIATELY);
|
||||
SendMessageToAll(m_CapturingPointTypes[point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE);
|
||||
SendBroadcastText(m_CapturingPointTypes[point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
}
|
||||
|
||||
_capturePointInfo[point]._ownerTeamId = teamId;
|
||||
@@ -524,12 +533,12 @@ void BattlegroundEY::EventPlayerCapturedFlag(Player* player, uint32 BgObjectType
|
||||
if (player->GetTeamId() == TEAM_ALLIANCE)
|
||||
{
|
||||
PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_ALLIANCE);
|
||||
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_A, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
SendBroadcastText(BG_EY_TEXT_ALLIANCE_CAPTURED_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_HORDE);
|
||||
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_H, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
SendBroadcastText(BG_EY_TEXT_HORDE_CAPTURED_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
}
|
||||
|
||||
UpdatePlayerScore(player, SCORE_FLAG_CAPTURES, 1);
|
||||
@@ -537,18 +546,21 @@ void BattlegroundEY::EventPlayerCapturedFlag(Player* player, uint32 BgObjectType
|
||||
AddPoints(player->GetTeamId(), BG_EY_FlagPoints[_ownedPointsCount[player->GetTeamId()] - 1]);
|
||||
}
|
||||
|
||||
void BattlegroundEY::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
|
||||
bool BattlegroundEY::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
if (type == SCORE_FLAG_CAPTURES)
|
||||
if (!Battleground::UpdatePlayerScore(player, type, value, doAddHonor))
|
||||
return false;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
BattlegroundScoreMap::iterator itr = PlayerScores.find(player->GetGUID());
|
||||
if (itr != PlayerScores.end())
|
||||
((BattlegroundEYScore*)itr->second)->FlagCaptures += value;
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, BG_EY_OBJECTIVE_CAPTURE_FLAG);
|
||||
return;
|
||||
case SCORE_FLAG_CAPTURES:
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, BG_EY_OBJECTIVE_CAPTURE_FLAG);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Battleground::UpdatePlayerScore(player, type, value, doAddHonor);
|
||||
return true;
|
||||
}
|
||||
|
||||
void BattlegroundEY::FillInitialWorldStates(WorldPacket& data)
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
#define __BATTLEGROUNDEY_H
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundScore.h"
|
||||
#include "Language.h"
|
||||
#include "EventMap.h"
|
||||
|
||||
enum BG_EY_Events
|
||||
{
|
||||
@@ -241,6 +243,35 @@ enum BG_EY_FlagState
|
||||
BG_EY_FLAG_STATE_ON_GROUND = 3
|
||||
};
|
||||
|
||||
enum BG_EY_BroadcastTexts
|
||||
{
|
||||
BG_EY_TEXT_ALLIANCE_TAKEN_FEL_REAVER_RUINS = 17828,
|
||||
BG_EY_TEXT_HORDE_TAKEN_FEL_REAVER_RUINS = 17829,
|
||||
BG_EY_TEXT_ALLIANCE_LOST_FEL_REAVER_RUINS = 17835,
|
||||
BG_EY_TEXT_HORDE_LOST_FEL_REAVER_RUINS = 17836,
|
||||
|
||||
BG_EY_TEXT_ALLIANCE_TAKEN_BLOOD_ELF_TOWER = 17819,
|
||||
BG_EY_TEXT_HORDE_TAKEN_BLOOD_ELF_TOWER = 17823,
|
||||
BG_EY_TEXT_ALLIANCE_LOST_BLOOD_ELF_TOWER = 17831,
|
||||
BG_EY_TEXT_HORDE_LOST_BLOOD_ELF_TOWER = 17832,
|
||||
|
||||
BG_EY_TEXT_ALLIANCE_TAKEN_DRAENEI_RUINS = 17827,
|
||||
BG_EY_TEXT_HORDE_TAKEN_DRAENEI_RUINS = 17826,
|
||||
BG_EY_TEXT_ALLIANCE_LOST_DRAENEI_RUINS = 17833,
|
||||
BG_EY_TEXT_HORDE_LOST_DRAENEI_RUINS = 17834,
|
||||
|
||||
BG_EY_TEXT_ALLIANCE_TAKEN_MAGE_TOWER = 17824,
|
||||
BG_EY_TEXT_HORDE_TAKEN_MAGE_TOWER = 17825,
|
||||
BG_EY_TEXT_ALLIANCE_LOST_MAGE_TOWER = 17837,
|
||||
BG_EY_TEXT_HORDE_LOST_MAGE_TOWER = 17838,
|
||||
|
||||
BG_EY_TEXT_TAKEN_FLAG = 18359,
|
||||
BG_EY_TEXT_FLAG_DROPPED = 18361,
|
||||
BG_EY_TEXT_FLAG_RESET = 18364,
|
||||
BG_EY_TEXT_ALLIANCE_CAPTURED_FLAG = 18375,
|
||||
BG_EY_TEXT_HORDE_CAPTURED_FLAG = 18384,
|
||||
};
|
||||
|
||||
struct BattlegroundEYPointIconsStruct
|
||||
{
|
||||
BattlegroundEYPointIconsStruct(uint32 _WorldStateControlIndex, uint32 _WorldStateAllianceControlledIndex, uint32 _WorldStateHordeControlledIndex)
|
||||
@@ -304,30 +335,67 @@ const BattlegroundEYPointIconsStruct m_PointsIconStruct[EY_POINTS_MAX] =
|
||||
|
||||
const BattlegroundEYLosingPointStruct m_LosingPointTypes[EY_POINTS_MAX] =
|
||||
{
|
||||
BattlegroundEYLosingPointStruct(BG_EY_OBJECT_N_BANNER_FEL_REAVER_CENTER, BG_EY_OBJECT_A_BANNER_FEL_REAVER_CENTER, LANG_BG_EY_HAS_LOST_A_F_RUINS, BG_EY_OBJECT_H_BANNER_FEL_REAVER_CENTER, LANG_BG_EY_HAS_LOST_H_F_RUINS),
|
||||
BattlegroundEYLosingPointStruct(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_CENTER, BG_EY_OBJECT_A_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_LOST_A_B_TOWER, BG_EY_OBJECT_H_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_LOST_H_B_TOWER),
|
||||
BattlegroundEYLosingPointStruct(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER, BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_LOST_A_D_RUINS, BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_LOST_H_D_RUINS),
|
||||
BattlegroundEYLosingPointStruct(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_LOST_A_M_TOWER, BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_LOST_H_M_TOWER)
|
||||
BattlegroundEYLosingPointStruct(BG_EY_OBJECT_N_BANNER_FEL_REAVER_CENTER, BG_EY_OBJECT_A_BANNER_FEL_REAVER_CENTER, BG_EY_TEXT_ALLIANCE_LOST_FEL_REAVER_RUINS, BG_EY_OBJECT_H_BANNER_FEL_REAVER_CENTER, BG_EY_TEXT_HORDE_LOST_FEL_REAVER_RUINS),
|
||||
BattlegroundEYLosingPointStruct(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_CENTER, BG_EY_OBJECT_A_BANNER_BLOOD_ELF_CENTER, BG_EY_TEXT_ALLIANCE_LOST_BLOOD_ELF_TOWER, BG_EY_OBJECT_H_BANNER_BLOOD_ELF_CENTER, BG_EY_TEXT_HORDE_LOST_BLOOD_ELF_TOWER),
|
||||
BattlegroundEYLosingPointStruct(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER, BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER, BG_EY_TEXT_ALLIANCE_LOST_DRAENEI_RUINS, BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER, BG_EY_TEXT_HORDE_LOST_DRAENEI_RUINS),
|
||||
BattlegroundEYLosingPointStruct(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, BG_EY_TEXT_ALLIANCE_LOST_MAGE_TOWER, BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, BG_EY_TEXT_HORDE_LOST_MAGE_TOWER)
|
||||
};
|
||||
|
||||
const BattlegroundEYCapturingPointStruct m_CapturingPointTypes[EY_POINTS_MAX] =
|
||||
{
|
||||
BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_FEL_REAVER_CENTER, BG_EY_OBJECT_A_BANNER_FEL_REAVER_CENTER, LANG_BG_EY_HAS_TAKEN_A_F_RUINS, BG_EY_OBJECT_H_BANNER_FEL_REAVER_CENTER, LANG_BG_EY_HAS_TAKEN_H_F_RUINS, BG_EY_GRAVEYARD_FEL_REAVER),
|
||||
BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_CENTER, BG_EY_OBJECT_A_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_TAKEN_A_B_TOWER, BG_EY_OBJECT_H_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_TAKEN_H_B_TOWER, BG_EY_GRAVEYARD_BLOOD_ELF),
|
||||
BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER, BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_TAKEN_A_D_RUINS, BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_TAKEN_H_D_RUINS, BG_EY_GRAVEYARD_DRAENEI_RUINS),
|
||||
BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_TAKEN_A_M_TOWER, BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_TAKEN_H_M_TOWER, BG_EY_GRAVEYARD_MAGE_TOWER)
|
||||
BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_FEL_REAVER_CENTER, BG_EY_OBJECT_A_BANNER_FEL_REAVER_CENTER, BG_EY_TEXT_ALLIANCE_TAKEN_FEL_REAVER_RUINS, BG_EY_OBJECT_H_BANNER_FEL_REAVER_CENTER, BG_EY_TEXT_HORDE_TAKEN_FEL_REAVER_RUINS, BG_EY_GRAVEYARD_FEL_REAVER),
|
||||
BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_CENTER, BG_EY_OBJECT_A_BANNER_BLOOD_ELF_CENTER, BG_EY_TEXT_ALLIANCE_TAKEN_BLOOD_ELF_TOWER, BG_EY_OBJECT_H_BANNER_BLOOD_ELF_CENTER, BG_EY_TEXT_HORDE_TAKEN_BLOOD_ELF_TOWER, BG_EY_GRAVEYARD_BLOOD_ELF),
|
||||
BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER, BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER, BG_EY_TEXT_ALLIANCE_TAKEN_DRAENEI_RUINS, BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER, BG_EY_TEXT_HORDE_TAKEN_DRAENEI_RUINS, BG_EY_GRAVEYARD_DRAENEI_RUINS),
|
||||
BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, BG_EY_TEXT_ALLIANCE_TAKEN_MAGE_TOWER, BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, BG_EY_TEXT_HORDE_TAKEN_MAGE_TOWER, BG_EY_GRAVEYARD_MAGE_TOWER)
|
||||
};
|
||||
|
||||
struct BattlegroundEYScore : public BattlegroundScore
|
||||
struct BattlegroundEYScore final : public BattlegroundScore
|
||||
{
|
||||
BattlegroundEYScore(Player* player) : BattlegroundScore(player), FlagCaptures(0) { }
|
||||
~BattlegroundEYScore() override { }
|
||||
uint32 FlagCaptures;
|
||||
friend class BattlegroundEY;
|
||||
|
||||
uint32 GetAttr1() const final { return FlagCaptures; }
|
||||
protected:
|
||||
BattlegroundEYScore(ObjectGuid playerGuid) : BattlegroundScore(playerGuid) { }
|
||||
|
||||
void UpdateScore(uint32 type, uint32 value) override
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_FLAG_CAPTURES: // Flags captured
|
||||
FlagCaptures += value;
|
||||
break;
|
||||
default:
|
||||
BattlegroundScore::UpdateScore(type, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BuildObjectivesBlock(WorldPacket& data) final;
|
||||
|
||||
uint32 GetAttr1() const override { return FlagCaptures; }
|
||||
|
||||
uint32 FlagCaptures = 0;
|
||||
};
|
||||
|
||||
class BattlegroundEY : public Battleground
|
||||
struct CaptureEYPointInfo
|
||||
{
|
||||
CaptureEYPointInfo() : _ownerTeamId(TEAM_NEUTRAL), _barStatus(BG_EY_PROGRESS_BAR_STATE_MIDDLE), _areaTrigger(0)
|
||||
{
|
||||
_playersCount[TEAM_ALLIANCE] = 0;
|
||||
_playersCount[TEAM_HORDE] = 0;
|
||||
}
|
||||
|
||||
Player* player = nullptr;
|
||||
TeamId _ownerTeamId;
|
||||
int8 _barStatus;
|
||||
uint32 _areaTrigger;
|
||||
int8 _playersCount[PVP_TEAMS_COUNT];
|
||||
|
||||
bool IsUnderControl(TeamId teamId) const { return _ownerTeamId == teamId; }
|
||||
bool IsUnderControl() const { return _ownerTeamId != TEAM_NEUTRAL; }
|
||||
bool IsUncontrolled() const { return _ownerTeamId == TEAM_NEUTRAL; }
|
||||
};
|
||||
|
||||
class AC_GAME_API BattlegroundEY : public Battleground
|
||||
{
|
||||
public:
|
||||
BattlegroundEY();
|
||||
@@ -353,7 +421,7 @@ public:
|
||||
bool SetupBattleground() override;
|
||||
void Init() override;
|
||||
void EndBattleground(TeamId winnerTeamId) override;
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
|
||||
bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
|
||||
void FillInitialWorldStates(WorldPacket& data) override;
|
||||
void SetDroppedFlagGUID(ObjectGuid guid, TeamId /*teamId*/ = TEAM_NEUTRAL) override { _droppedFlagGUID = guid; }
|
||||
ObjectGuid GetDroppedFlagGUID() const { return _droppedFlagGUID; }
|
||||
@@ -366,12 +434,14 @@ public:
|
||||
bool AllNodesConrolledByTeam(TeamId teamId) const override;
|
||||
TeamId GetPrematureWinner() override;
|
||||
|
||||
[[nodiscard]] CaptureEYPointInfo const& GetCapturePointInfo(uint32 node) const { return _capturePointInfo[node]; }
|
||||
|
||||
private:
|
||||
void PostUpdateImpl(uint32 diff) override;
|
||||
|
||||
void EventPlayerCapturedFlag(Player* Source, uint32 BgObjectType);
|
||||
void EventTeamLostPoint(TeamId teamId, uint32 point);
|
||||
void EventTeamCapturedPoint(TeamId teamId, uint32 point);
|
||||
void EventTeamLostPoint(Player* player, uint32 point);
|
||||
void EventTeamCapturedPoint(Player* player, TeamId teamId, uint32 point);
|
||||
void UpdatePointsCount();
|
||||
void UpdatePointsIcons(uint32 point);
|
||||
|
||||
@@ -381,28 +451,10 @@ private:
|
||||
/* Scorekeeping */
|
||||
void AddPoints(TeamId teamId, uint32 points);
|
||||
|
||||
struct CapturePointInfo
|
||||
{
|
||||
CapturePointInfo() : _ownerTeamId(TEAM_NEUTRAL), _barStatus(BG_EY_PROGRESS_BAR_STATE_MIDDLE), _areaTrigger(0)
|
||||
{
|
||||
_playersCount[TEAM_ALLIANCE] = 0;
|
||||
_playersCount[TEAM_HORDE] = 0;
|
||||
}
|
||||
|
||||
TeamId _ownerTeamId;
|
||||
int8 _barStatus;
|
||||
uint32 _areaTrigger;
|
||||
int8 _playersCount[BG_TEAMS_COUNT];
|
||||
|
||||
bool IsUnderControl(TeamId teamId) const { return _ownerTeamId == teamId; }
|
||||
bool IsUnderControl() const { return _ownerTeamId != TEAM_NEUTRAL; }
|
||||
bool IsUncontrolled() const { return _ownerTeamId == TEAM_NEUTRAL; }
|
||||
};
|
||||
|
||||
CapturePointInfo _capturePointInfo[EY_POINTS_MAX];
|
||||
CaptureEYPointInfo _capturePointInfo[EY_POINTS_MAX];
|
||||
EventMap _bgEvents;
|
||||
uint32 _honorTics;
|
||||
uint8 _ownedPointsCount[BG_TEAMS_COUNT];
|
||||
uint8 _ownedPointsCount[PVP_TEAMS_COUNT];
|
||||
ObjectGuid _flagKeeperGUID;
|
||||
ObjectGuid _droppedFlagGUID;
|
||||
uint8 _flagState;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "Battleground.h"
|
||||
#include "GameGraveyard.h"
|
||||
#include "GameObject.h"
|
||||
#include "GameTime.h"
|
||||
#include "Language.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
@@ -28,16 +29,18 @@
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
void BattlegroundICScore::BuildObjectivesBlock(WorldPacket& data)
|
||||
{
|
||||
data << uint32(2); // Objectives Count
|
||||
data << uint32(BasesAssaulted);
|
||||
data << uint32(BasesDefended);
|
||||
}
|
||||
|
||||
BattlegroundIC::BattlegroundIC()
|
||||
{
|
||||
BgObjects.resize(MAX_NORMAL_GAMEOBJECTS_SPAWNS + MAX_AIRSHIPS_SPAWNS + MAX_HANGAR_TELEPORTERS_SPAWNS + MAX_FORTRESS_TELEPORTERS_SPAWNS + MAX_HANGAR_TELEPORTER_EFFECTS_SPAWNS + MAX_FORTRESS_TELEPORTER_EFFECTS_SPAWNS);
|
||||
BgCreatures.resize(MAX_NORMAL_NPCS_SPAWNS + MAX_WORKSHOP_SPAWNS + MAX_DOCKS_SPAWNS + MAX_SPIRIT_GUIDES_SPAWNS + MAX_HANGAR_NPCS_SPAWNS);
|
||||
|
||||
StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_IC_START_TWO_MINUTES;
|
||||
StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_IC_START_ONE_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_IC_START_HALF_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_IC_HAS_BEGUN;
|
||||
|
||||
for (uint8 i = 0; i < 2; ++i)
|
||||
factionReinforcements[i] = MAX_REINFORCEMENTS;
|
||||
|
||||
@@ -59,10 +62,6 @@ BattlegroundIC::BattlegroundIC()
|
||||
respawnMap.clear();
|
||||
}
|
||||
|
||||
BattlegroundIC::~BattlegroundIC()
|
||||
{
|
||||
}
|
||||
|
||||
void BattlegroundIC::DoAction(uint32 action, ObjectGuid guid)
|
||||
{
|
||||
if (action != ACTION_TELEPORT_PLAYER_TO_TRANSPORT)
|
||||
@@ -139,7 +138,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
||||
{
|
||||
// Check if creature respawn time is properly saved
|
||||
RespawnMap::iterator itr = respawnMap.find(catapult->GetGUID());
|
||||
if (itr == respawnMap.end() || time(nullptr) < itr->second)
|
||||
if (itr == respawnMap.end() || GameTime::GetGameTime().count() < itr->second)
|
||||
continue;
|
||||
|
||||
catapult->Relocate(BG_IC_DocksVehiclesCatapults[j].GetPositionX(), BG_IC_DocksVehiclesCatapults[j].GetPositionY(), BG_IC_DocksVehiclesCatapults[j].GetPositionZ(), BG_IC_DocksVehiclesCatapults[j].GetOrientation());
|
||||
@@ -157,7 +156,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
||||
{
|
||||
// Check if creature respawn time is properly saved
|
||||
RespawnMap::iterator itr = respawnMap.find(glaiveThrower->GetGUID());
|
||||
if (itr == respawnMap.end() || time(nullptr) < itr->second)
|
||||
if (itr == respawnMap.end() || GameTime::GetGameTime().count() < itr->second)
|
||||
continue;
|
||||
|
||||
glaiveThrower->Relocate(BG_IC_DocksVehiclesGlaives[j].GetPositionX(), BG_IC_DocksVehiclesGlaives[j].GetPositionY(), BG_IC_DocksVehiclesGlaives[j].GetPositionZ(), BG_IC_DocksVehiclesGlaives[j].GetOrientation());
|
||||
@@ -186,7 +185,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
||||
{
|
||||
// Check if creature respawn time is properly saved
|
||||
RespawnMap::iterator itr = respawnMap.find(siege->GetGUID());
|
||||
if (itr == respawnMap.end() || time(nullptr) < itr->second)
|
||||
if (itr == respawnMap.end() || GameTime::GetGameTime().count() < itr->second)
|
||||
continue;
|
||||
|
||||
siege->Relocate(BG_IC_WorkshopVehicles[4].GetPositionX(), BG_IC_WorkshopVehicles[4].GetPositionY(), BG_IC_WorkshopVehicles[4].GetPositionZ(), BG_IC_WorkshopVehicles[4].GetOrientation());
|
||||
@@ -203,7 +202,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
||||
{
|
||||
// Check if creature respawn time is properly saved
|
||||
RespawnMap::iterator itr = respawnMap.find(demolisher->GetGUID());
|
||||
if (itr == respawnMap.end() || time(nullptr) < itr->second)
|
||||
if (itr == respawnMap.end() || GameTime::GetGameTime().count() < itr->second)
|
||||
continue;
|
||||
|
||||
demolisher->Relocate(BG_IC_WorkshopVehicles[u].GetPositionX(), BG_IC_WorkshopVehicles[u].GetPositionY(), BG_IC_WorkshopVehicles[u].GetPositionZ(), BG_IC_WorkshopVehicles[u].GetOrientation());
|
||||
@@ -245,7 +244,14 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
||||
UpdateNodeWorldState(&nodePoint[i]);
|
||||
HandleCapturedNodes(&nodePoint[i], false);
|
||||
|
||||
SendMessage2ToAll(LANG_BG_IC_TEAM_HAS_TAKEN_NODE, CHAT_MSG_BG_SYSTEM_NEUTRAL, nullptr, (nodePoint[i].faction == TEAM_ALLIANCE ? LANG_BG_IC_ALLIANCE : LANG_BG_IC_HORDE), nodePoint[i].string);
|
||||
if (nodePoint[i].faction == TEAM_ALLIANCE)
|
||||
{
|
||||
SendBroadcastText(ICNodes[i].TextAllianceTaken, CHAT_MSG_BG_SYSTEM_ALLIANCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendBroadcastText(ICNodes[i].TextHordeTaken, CHAT_MSG_BG_SYSTEM_HORDE);
|
||||
}
|
||||
|
||||
nodePoint[i].needChange = false;
|
||||
nodePoint[i].timer = BANNER_STATE_CHANGE_TIME;
|
||||
@@ -271,10 +277,6 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
||||
else resourceTimer -= diff;
|
||||
}
|
||||
|
||||
void BattlegroundIC::StartingEventCloseDoors()
|
||||
{
|
||||
}
|
||||
|
||||
void BattlegroundIC::StartingEventOpenDoors()
|
||||
{
|
||||
//after 20 seconds they should be despawned
|
||||
@@ -319,7 +321,7 @@ bool BattlegroundIC::IsResourceGlutAllowed(TeamId teamId) const
|
||||
void BattlegroundIC::AddPlayer(Player* player)
|
||||
{
|
||||
Battleground::AddPlayer(player);
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundICScore(player);
|
||||
PlayerScores.emplace(player->GetGUID().GetCounter(), new BattlegroundICScore(player->GetGUID()));
|
||||
|
||||
if (nodePoint[NODE_TYPE_QUARRY].nodeState == (player->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H))
|
||||
player->CastSpell(player, SPELL_QUARRY, true);
|
||||
@@ -363,26 +365,22 @@ void BattlegroundIC::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundIC::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
|
||||
bool BattlegroundIC::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
BattlegroundScoreMap::iterator itr = PlayerScores.find(player->GetGUID());
|
||||
if (itr == PlayerScores.end())
|
||||
return;
|
||||
if (!Battleground::UpdatePlayerScore(player, type, value, doAddHonor))
|
||||
return false;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_BASES_ASSAULTED:
|
||||
((BattlegroundICScore*)itr->second)->BasesAssaulted += value;
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, IC_OBJECTIVE_ASSAULT_BASE);
|
||||
break;
|
||||
case SCORE_BASES_DEFENDED:
|
||||
((BattlegroundICScore*)itr->second)->BasesDefended += value;
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, IC_OBJECTIVE_DEFEND_BASE);
|
||||
break;
|
||||
default:
|
||||
Battleground::UpdatePlayerScore(player, type, value, doAddHonor);
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BattlegroundIC::FillInitialWorldStates(WorldPacket& data)
|
||||
@@ -408,7 +406,7 @@ bool BattlegroundIC::SetupBattleground()
|
||||
{
|
||||
if (!AddObject(BG_IC_ObjSpawnlocs[i].type, BG_IC_ObjSpawnlocs[i].entry, BG_IC_ObjSpawnlocs[i].x, BG_IC_ObjSpawnlocs[i].y, BG_IC_ObjSpawnlocs[i].z, BG_IC_ObjSpawnlocs[i].o, 0, 0, 0, 0, RESPAWN_ONE_DAY))
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning gameobject %u", BG_IC_ObjSpawnlocs[i].entry);
|
||||
LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning gameobject {}", BG_IC_ObjSpawnlocs[i].entry);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -421,7 +419,7 @@ bool BattlegroundIC::SetupBattleground()
|
||||
{
|
||||
if (!AddObject(BG_IC_Teleporters[i].type, BG_IC_Teleporters[i].entry, BG_IC_Teleporters[i].x, BG_IC_Teleporters[i].y, BG_IC_Teleporters[i].z, BG_IC_Teleporters[i].o, 0, 0, 0, 0, RESPAWN_ONE_DAY))
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "Isle of Conquest | Starting Event Open Doors: There was an error spawning gameobject %u", BG_IC_Teleporters[i].entry);
|
||||
LOG_ERROR("bg.battleground", "Isle of Conquest | Starting Event Open Doors: There was an error spawning gameobject {}", BG_IC_Teleporters[i].entry);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -430,7 +428,7 @@ bool BattlegroundIC::SetupBattleground()
|
||||
{
|
||||
if (!AddObject(BG_IC_TeleporterEffects[i].type, BG_IC_TeleporterEffects[i].entry, BG_IC_TeleporterEffects[i].x, BG_IC_TeleporterEffects[i].y, BG_IC_TeleporterEffects[i].z, BG_IC_TeleporterEffects[i].o, 0, 0, 0, 0, RESPAWN_ONE_DAY))
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "Isle of Conquest | Starting Event Open Doors: There was an error spawning gameobject %u", BG_IC_Teleporters[i].entry);
|
||||
LOG_ERROR("bg.battleground", "Isle of Conquest | Starting Event Open Doors: There was an error spawning gameobject {}", BG_IC_Teleporters[i].entry);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -439,7 +437,7 @@ bool BattlegroundIC::SetupBattleground()
|
||||
{
|
||||
if (!AddCreature(BG_IC_NpcSpawnlocs[i].entry, BG_IC_NpcSpawnlocs[i].type, BG_IC_NpcSpawnlocs[i].x, BG_IC_NpcSpawnlocs[i].y, BG_IC_NpcSpawnlocs[i].z, BG_IC_NpcSpawnlocs[i].o, RESPAWN_ONE_DAY))
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[i].entry);
|
||||
LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning creature {}", BG_IC_NpcSpawnlocs[i].entry);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -532,7 +530,7 @@ void BattlegroundIC::HandleKillUnit(Creature* unit, Player* killer)
|
||||
// Xinef: Add to respawn list
|
||||
if (entry == NPC_DEMOLISHER || entry == NPC_SIEGE_ENGINE_H || entry == NPC_SIEGE_ENGINE_A ||
|
||||
entry == NPC_GLAIVE_THROWER_A || entry == NPC_GLAIVE_THROWER_H || entry == NPC_CATAPULT)
|
||||
respawnMap[unit->GetGUID()] = time(nullptr) + VEHICLE_RESPAWN_TIME;
|
||||
respawnMap[unit->GetGUID()] = GameTime::GetGameTime().count() + VEHICLE_RESPAWN_TIME;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -552,12 +550,6 @@ void BattlegroundIC::HandleKillPlayer(Player* player, Player* killer)
|
||||
EndBattleground(killer->GetTeamId());
|
||||
}
|
||||
|
||||
void BattlegroundIC::EndBattleground(TeamId winnerTeamId)
|
||||
{
|
||||
SendMessage2ToAll(LANG_BG_IC_TEAM_WINS, CHAT_MSG_BG_SYSTEM_NEUTRAL, nullptr, (winnerTeamId == TEAM_ALLIANCE ? LANG_BG_IC_ALLIANCE : LANG_BG_IC_HORDE));
|
||||
Battleground::EndBattleground(winnerTeamId);
|
||||
}
|
||||
|
||||
void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* gameObject)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
@@ -566,78 +558,105 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
||||
// All the node points are iterated to find the clicked one
|
||||
for (uint8 i = 0; i < MAX_NODE_TYPES; ++i)
|
||||
{
|
||||
if (nodePoint[i].gameobject_entry == gameObject->GetEntry())
|
||||
ICNodePoint& point = nodePoint[i];
|
||||
if (point.gameobject_entry == gameObject->GetEntry())
|
||||
{
|
||||
// THIS SHOULD NEEVEER HAPPEN
|
||||
if (nodePoint[i].faction == player->GetTeamId())
|
||||
if (point.faction == player->GetTeamId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Prevent capturing of keep if none of gates was destroyed
|
||||
if (nodePoint[i].gameobject_entry == GO_ALLIANCE_BANNER)
|
||||
if (point.gameobject_entry == GO_ALLIANCE_BANNER)
|
||||
{
|
||||
if (GateStatus[BG_IC_A_FRONT] != BG_IC_GATE_DESTROYED &&
|
||||
GateStatus[BG_IC_A_WEST] != BG_IC_GATE_DESTROYED &&
|
||||
GateStatus[BG_IC_A_EAST] != BG_IC_GATE_DESTROYED)
|
||||
if (GateStatus[BG_IC_A_FRONT] != BG_IC_GATE_DESTROYED && GateStatus[BG_IC_A_WEST] != BG_IC_GATE_DESTROYED && GateStatus[BG_IC_A_EAST] != BG_IC_GATE_DESTROYED)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (nodePoint[i].gameobject_entry == GO_HORDE_BANNER)
|
||||
else if (point.gameobject_entry == GO_HORDE_BANNER)
|
||||
{
|
||||
if (GateStatus[BG_IC_H_FRONT] != BG_IC_GATE_DESTROYED &&
|
||||
GateStatus[BG_IC_H_WEST] != BG_IC_GATE_DESTROYED &&
|
||||
GateStatus[BG_IC_H_EAST] != BG_IC_GATE_DESTROYED)
|
||||
if (GateStatus[BG_IC_H_FRONT] != BG_IC_GATE_DESTROYED && GateStatus[BG_IC_H_WEST] != BG_IC_GATE_DESTROYED && GateStatus[BG_IC_H_EAST] != BG_IC_GATE_DESTROYED)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 nextBanner = GetNextBanner(&nodePoint[i], player->GetTeamId(), false);
|
||||
uint32 nextBanner = GetNextBanner(&point, player->GetTeamId(), false);
|
||||
|
||||
// we set the new settings of the nodePoint
|
||||
nodePoint[i].faction = player->GetTeamId();
|
||||
nodePoint[i].last_entry = nodePoint[i].gameobject_entry;
|
||||
nodePoint[i].gameobject_entry = nextBanner;
|
||||
point.faction = player->GetTeamId();
|
||||
point.last_entry = point.gameobject_entry;
|
||||
point.gameobject_entry = nextBanner;
|
||||
|
||||
// this is just needed if the next banner is grey
|
||||
if (nodePoint[i].banners[BANNER_A_CONTESTED] == nextBanner || nodePoint[i].banners[BANNER_H_CONTESTED] == nextBanner)
|
||||
if (point.banners[BANNER_A_CONTESTED] == nextBanner || point.banners[BANNER_H_CONTESTED] == nextBanner)
|
||||
{
|
||||
nodePoint[i].timer = BANNER_STATE_CHANGE_TIME; // 1 minute for last change (real faction banner)
|
||||
nodePoint[i].needChange = true;
|
||||
point.timer = BANNER_STATE_CHANGE_TIME; // 1 minute for last change (real faction banner)
|
||||
point.needChange = true;
|
||||
|
||||
RelocateDeadPlayers(BgCreatures[static_cast<uint16>(BG_IC_NPC_SPIRIT_GUIDE_1) + nodePoint[i].nodeType - 2]);
|
||||
_reviveEvents.AddEventAtOffset([this, point]()
|
||||
{
|
||||
RelocateDeadPlayers(BgCreatures[static_cast<uint16>(BG_IC_NPC_SPIRIT_GUIDE_1) + point.nodeType - 2]);
|
||||
|
||||
// if we are here means that the point has been lost, or it is the first capture
|
||||
|
||||
if (nodePoint[i].nodeType != NODE_TYPE_REFINERY && nodePoint[i].nodeType != NODE_TYPE_QUARRY)
|
||||
if (BgCreatures[static_cast<uint16>(BG_IC_NPC_SPIRIT_GUIDE_1) + (nodePoint[i].nodeType) - 2])
|
||||
DelCreature(static_cast<uint16>(BG_IC_NPC_SPIRIT_GUIDE_1) + (nodePoint[i].nodeType) - 2);
|
||||
// if we are here means that the point has been lost, or it is the first capture
|
||||
if (point.nodeType != NODE_TYPE_REFINERY && point.nodeType != NODE_TYPE_QUARRY)
|
||||
{
|
||||
if (BgCreatures[static_cast<uint16>(BG_IC_NPC_SPIRIT_GUIDE_1) + (point.nodeType) - 2])
|
||||
{
|
||||
DelCreature(static_cast<uint16>(BG_IC_NPC_SPIRIT_GUIDE_1) + (point.nodeType) - 2);
|
||||
}
|
||||
}
|
||||
}, 500ms);
|
||||
|
||||
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
|
||||
|
||||
SendMessage2ToAll(LANG_BG_IC_TEAM_ASSAULTED_NODE_1, CHAT_MSG_BG_SYSTEM_NEUTRAL, player, nodePoint[i].string);
|
||||
SendMessage2ToAll(LANG_BG_IC_TEAM_ASSAULTED_NODE_2, CHAT_MSG_BG_SYSTEM_NEUTRAL, player, nodePoint[i].string, (player->GetTeamId() == TEAM_ALLIANCE ? LANG_BG_IC_ALLIANCE : LANG_BG_IC_HORDE));
|
||||
HandleContestedNodes(&nodePoint[i]);
|
||||
if (nodePoint[i].faction == TEAM_ALLIANCE)
|
||||
{
|
||||
SendBroadcastText(ICNodes[i].TextAssaulted, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendBroadcastText(ICNodes[i].TextAssaulted, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
}
|
||||
|
||||
HandleContestedNodes(&point);
|
||||
}
|
||||
else if (nextBanner == nodePoint[i].banners[BANNER_A_CONTROLLED] || nextBanner == nodePoint[i].banners[BANNER_H_CONTROLLED])
|
||||
else if (nextBanner == point.banners[BANNER_A_CONTROLLED] || nextBanner == point.banners[BANNER_H_CONTROLLED])
|
||||
// if we are going to spawn the definitve faction banner, we dont need the timer anymore
|
||||
{
|
||||
nodePoint[i].timer = BANNER_STATE_CHANGE_TIME;
|
||||
nodePoint[i].needChange = false;
|
||||
SendMessage2ToAll(LANG_BG_IC_TEAM_DEFENDED_NODE, CHAT_MSG_BG_SYSTEM_NEUTRAL, player, nodePoint[i].string);
|
||||
HandleCapturedNodes(&nodePoint[i], true);
|
||||
point.timer = BANNER_STATE_CHANGE_TIME;
|
||||
point.needChange = false;
|
||||
|
||||
if (nodePoint[i].faction == TEAM_ALLIANCE)
|
||||
{
|
||||
SendBroadcastText(ICNodes[i].TextDefended, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendBroadcastText(ICNodes[i].TextDefended, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
}
|
||||
|
||||
HandleCapturedNodes(&point, true);
|
||||
UpdatePlayerScore(player, SCORE_BASES_DEFENDED, 1);
|
||||
}
|
||||
|
||||
GameObject* banner = GetBGObject(nodePoint[i].gameobject_type);
|
||||
GameObject* banner = GetBGObject(point.gameobject_type);
|
||||
|
||||
if (!banner) // this should never happen
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float cords[4] = {banner->GetPositionX(), banner->GetPositionY(), banner->GetPositionZ(), banner->GetOrientation() };
|
||||
|
||||
DelObject(nodePoint[i].gameobject_type);
|
||||
AddObject(nodePoint[i].gameobject_type, nodePoint[i].gameobject_entry, cords[0], cords[1], cords[2], cords[3], 0, 0, 0, 0, RESPAWN_ONE_DAY);
|
||||
DelObject(point.gameobject_type);
|
||||
AddObject(point.gameobject_type, point.gameobject_entry, cords[0], cords[1], cords[2], cords[3], 0, 0, 0, 0, RESPAWN_ONE_DAY);
|
||||
|
||||
GetBGObject(nodePoint[i].gameobject_type)->SetUInt32Value(GAMEOBJECT_FACTION, nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_Factions[1] : BG_IC_Factions[0]);
|
||||
GetBGObject(point.gameobject_type)->SetUInt32Value(GAMEOBJECT_FACTION, point.faction == TEAM_ALLIANCE ? BG_IC_Factions[1] : BG_IC_Factions[0]);
|
||||
|
||||
UpdateNodeWorldState(&nodePoint[i]);
|
||||
UpdateNodeWorldState(&point);
|
||||
// we dont need iterating if we are here
|
||||
// If the needChange bool was set true, we will handle the rest in the Update Map function.
|
||||
return;
|
||||
@@ -739,7 +758,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
|
||||
BG_IC_SpiritGuidePos[nodePoint->nodeType][0], BG_IC_SpiritGuidePos[nodePoint->nodeType][1],
|
||||
BG_IC_SpiritGuidePos[nodePoint->nodeType][2], BG_IC_SpiritGuidePos[nodePoint->nodeType][3],
|
||||
nodePoint->faction))
|
||||
LOG_ERROR("bg.battleground", "Isle of Conquest: Failed to spawn spirit guide! point: %u, team: %u, ", nodePoint->nodeType, nodePoint->faction);
|
||||
LOG_ERROR("bg.battleground", "Isle of Conquest: Failed to spawn spirit guide! point: {}, team: {}, ", nodePoint->nodeType, nodePoint->faction);
|
||||
}
|
||||
|
||||
switch (nodePoint->gameobject_type)
|
||||
@@ -762,20 +781,20 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
|
||||
{
|
||||
uint8 type = BG_IC_GO_HANGAR_TELEPORTER_1 + u;
|
||||
if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL : GO_HORDE_GUNSHIP_PORTAL), BG_IC_HangarTeleporters[u].GetPositionX(), BG_IC_HangarTeleporters[u].GetPositionY(), BG_IC_HangarTeleporters[u].GetPositionZ(), BG_IC_HangarTeleporters[u].GetOrientation(), 0, 0, 0, 0, RESPAWN_ONE_DAY))
|
||||
LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning a gunship portal. Type: %u", BG_IC_GO_HANGAR_TELEPORTER_1 + u);
|
||||
LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning a gunship portal. Type: {}", BG_IC_GO_HANGAR_TELEPORTER_1 + u);
|
||||
}
|
||||
|
||||
for (uint8 u = 0; u < MAX_HANGAR_TELEPORTER_EFFECTS_SPAWNS; ++u)
|
||||
{
|
||||
uint8 type = BG_IC_GO_HANGAR_TELEPORTER_EFFECT_1 + u;
|
||||
if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL_EFFECTS : GO_HORDE_GUNSHIP_PORTAL_EFFECTS), BG_IC_HangarTeleporterEffects[u].GetPositionX(), BG_IC_HangarTeleporterEffects[u].GetPositionY(), BG_IC_HangarTeleporterEffects[u].GetPositionZ(), BG_IC_HangarTeleporterEffects[u].GetOrientation(), 0, 0, 0, 0, RESPAWN_ONE_DAY, GO_STATE_ACTIVE))
|
||||
LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning a gunship portal effects. Type: %u", BG_IC_GO_HANGAR_TELEPORTER_1 + u);
|
||||
LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning a gunship portal effects. Type: {}", BG_IC_GO_HANGAR_TELEPORTER_1 + u);
|
||||
}
|
||||
|
||||
for (uint8 u = 0; u < MAX_TRIGGER_SPAWNS_PER_FACTION; ++u)
|
||||
{
|
||||
if (!AddCreature(NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_HangarTrigger[nodePoint->faction].GetPositionX(), BG_IC_HangarTrigger[nodePoint->faction].GetPositionY(), BG_IC_HangarTrigger[nodePoint->faction].GetPositionZ(), BG_IC_HangarTrigger[nodePoint->faction].GetOrientation(), RESPAWN_ONE_DAY, nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde))
|
||||
LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning a world trigger. Type: %u", BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING);
|
||||
LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning a world trigger. Type: {}", BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING);
|
||||
}
|
||||
|
||||
for (uint8 u = 0; u < MAX_CAPTAIN_SPAWNS_PER_FACTION; ++u)
|
||||
@@ -788,7 +807,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
|
||||
|
||||
if (type == BG_IC_NPC_GUNSHIP_CAPTAIN_2)
|
||||
if (!AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionX(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionY(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionZ(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetOrientation(), RESPAWN_ONE_DAY, nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde))
|
||||
LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning a world trigger. Type: %u", BG_IC_NPC_GUNSHIP_CAPTAIN_2);
|
||||
LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning a world trigger. Type: {}", BG_IC_NPC_GUNSHIP_CAPTAIN_2);
|
||||
}
|
||||
|
||||
(nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->EnableMovement(true);
|
||||
@@ -879,7 +898,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
|
||||
if (!siegeVehicle->IsVehicleInUse())
|
||||
Unit::Kill(siegeEngine, siegeEngine);
|
||||
|
||||
respawnMap[siegeEngine->GetGUID()] = time(nullptr) + VEHICLE_RESPAWN_TIME;
|
||||
respawnMap[siegeEngine->GetGUID()] = GameTime::GetGameTime().count() + VEHICLE_RESPAWN_TIME;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -914,33 +933,41 @@ void BattlegroundIC::DestroyGate(Player* /*player*/, GameObject* go)
|
||||
UpdateWorldState(uws_open, 1);
|
||||
}
|
||||
|
||||
uint32 textId;
|
||||
ChatMsg msgType;
|
||||
TeamId teamId = TEAM_ALLIANCE;
|
||||
uint32 lang_entry = 0;
|
||||
|
||||
switch (go->GetEntry())
|
||||
{
|
||||
case GO_HORDE_GATE_1:
|
||||
lang_entry = LANG_BG_IC_NORTH_GATE_DESTROYED;
|
||||
textId = BG_IC_TEXT_FRONT_GATE_HORDE_DESTROYED;
|
||||
msgType = CHAT_MSG_BG_SYSTEM_ALLIANCE;
|
||||
break;
|
||||
case GO_HORDE_GATE_2:
|
||||
lang_entry = LANG_BG_IC_EAST_GATE_DESTROYED;
|
||||
textId = BG_IC_TEXT_WEST_GATE_HORDE_DESTROYED;
|
||||
msgType = CHAT_MSG_BG_SYSTEM_ALLIANCE;
|
||||
break;
|
||||
case GO_HORDE_GATE_3:
|
||||
lang_entry = LANG_BG_IC_WEST_GATE_DESTROYED;
|
||||
textId = BG_IC_TEXT_EAST_GATE_HORDE_DESTROYED;
|
||||
msgType = CHAT_MSG_BG_SYSTEM_ALLIANCE;
|
||||
break;
|
||||
case GO_ALLIANCE_GATE_1:
|
||||
textId = BG_IC_TEXT_WEST_GATE_ALLIANCE_DESTROYED;
|
||||
msgType = CHAT_MSG_BG_SYSTEM_HORDE;
|
||||
teamId = TEAM_HORDE;
|
||||
lang_entry = LANG_BG_IC_WEST_GATE_DESTROYED;
|
||||
break;
|
||||
case GO_ALLIANCE_GATE_2:
|
||||
textId = BG_IC_TEXT_EAST_GATE_ALLIANCE_DESTROYED;
|
||||
msgType = CHAT_MSG_BG_SYSTEM_HORDE;
|
||||
teamId = TEAM_HORDE;
|
||||
lang_entry = LANG_BG_IC_EAST_GATE_DESTROYED;
|
||||
break;
|
||||
case GO_ALLIANCE_GATE_3:
|
||||
textId = BG_IC_TEXT_FRONT_GATE_ALLIANCE_DESTROYED;
|
||||
msgType = CHAT_MSG_BG_SYSTEM_HORDE;
|
||||
teamId = TEAM_HORDE;
|
||||
lang_entry = LANG_BG_IC_SOUTH_GATE_DESTROYED;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
if (teamId == TEAM_ALLIANCE)
|
||||
@@ -955,11 +982,7 @@ void BattlegroundIC::DestroyGate(Player* /*player*/, GameObject* go)
|
||||
}
|
||||
|
||||
TurnBosses(true);
|
||||
SendMessage2ToAll(lang_entry, CHAT_MSG_BG_SYSTEM_NEUTRAL, nullptr, (teamId == TEAM_ALLIANCE ? LANG_BG_IC_HORDE_KEEP : LANG_BG_IC_ALLIANCE_KEEP));
|
||||
}
|
||||
|
||||
void BattlegroundIC::EventPlayerDamagedGO(Player* /*player*/, GameObject* /*go*/, uint32 /*eventType*/)
|
||||
{
|
||||
SendBroadcastText(textId, msgType);
|
||||
}
|
||||
|
||||
GraveyardStruct const* BattlegroundIC::GetClosestGraveyard(Player* player)
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
#define __BATTLEGROUNDIC_H
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "Language.h"
|
||||
#include "BattlegroundScore.h"
|
||||
#include "Object.h"
|
||||
|
||||
const uint32 BG_IC_Factions[BG_TEAMS_COUNT] =
|
||||
const uint32 BG_IC_Factions[PVP_TEAMS_COUNT] =
|
||||
{
|
||||
1732, // Alliance
|
||||
1735 // Horde
|
||||
@@ -854,6 +854,36 @@ const float BG_IC_SpiritGuidePos[MAX_NODE_TYPES + 2][4] =
|
||||
{1148.65f, -1250.98f, 16.60f, 1.74f}, // last resort horde
|
||||
};
|
||||
|
||||
enum ICBroadcastTexts
|
||||
{
|
||||
BG_IC_TEXT_FRONT_GATE_HORDE_DESTROYED = 35409,
|
||||
BG_IC_TEXT_FRONT_GATE_ALLIANCE_DESTROYED = 35410,
|
||||
BG_IC_TEXT_WEST_GATE_HORDE_DESTROYED = 35411,
|
||||
BG_IC_TEXT_WEST_GATE_ALLIANCE_DESTROYED = 35412,
|
||||
BG_IC_TEXT_EAST_GATE_HORDE_DESTROYED = 35413,
|
||||
BG_IC_TEXT_EAST_GATE_ALLIANCE_DESTROYED = 35414
|
||||
};
|
||||
|
||||
struct ICNodeInfo
|
||||
{
|
||||
uint32 NodeId;
|
||||
uint32 TextAssaulted;
|
||||
uint32 TextDefended;
|
||||
uint32 TextAllianceTaken;
|
||||
uint32 TextHordeTaken;
|
||||
};
|
||||
|
||||
ICNodeInfo const ICNodes[MAX_NODE_TYPES] =
|
||||
{
|
||||
{ NODE_TYPE_REFINERY, 35377, 35378, 35379, 35380 },
|
||||
{ NODE_TYPE_QUARRY, 35373, 35374, 35375, 35376 },
|
||||
{ NODE_TYPE_DOCKS, 35365, 35366, 35367, 35368 },
|
||||
{ NODE_TYPE_HANGAR, 35369, 35370, 35371, 35372 },
|
||||
{ NODE_TYPE_WORKSHOP, 35278, 35286, 35279, 35280 },
|
||||
{ NODE_TYPE_GRAVEYARD_A, 35461, 35459, 35463, 35466 },
|
||||
{ NODE_TYPE_GRAVEYARD_H, 35462, 35460, 35464, 35465 }
|
||||
};
|
||||
|
||||
// I.E: Hangar, Quarry, Graveyards .. etc
|
||||
struct ICNodePoint
|
||||
{
|
||||
@@ -867,18 +897,17 @@ struct ICNodePoint
|
||||
uint32 last_entry; // the last gameobject_entry
|
||||
uint32 worldStates[5]; // the worldstates that represent the node in the map
|
||||
ICNodeState nodeState;
|
||||
uint32 string;
|
||||
};
|
||||
|
||||
const ICNodePoint nodePointInitial[7] =
|
||||
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, LANG_BG_IC_REFINERY},
|
||||
{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, LANG_BG_IC_QUARRY},
|
||||
{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, LANG_BG_IC_DOCKS},
|
||||
{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, LANG_BG_IC_HANGAR},
|
||||
{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, LANG_BG_IC_WORKSHOP},
|
||||
{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, LANG_BG_IC_ALLIANCE_KEEP},
|
||||
{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, LANG_BG_IC_HORDE_KEEP}
|
||||
{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}
|
||||
};
|
||||
|
||||
enum HonorRewards
|
||||
@@ -887,45 +916,63 @@ enum HonorRewards
|
||||
WINNER_HONOR_AMOUNT = 500
|
||||
};
|
||||
|
||||
struct BattlegroundICScore : public BattlegroundScore
|
||||
struct BattlegroundICScore final : public BattlegroundScore
|
||||
{
|
||||
BattlegroundICScore(Player* player) : BattlegroundScore(player), BasesAssaulted(0), BasesDefended(0) { }
|
||||
~BattlegroundICScore() override { }
|
||||
uint32 BasesAssaulted;
|
||||
uint32 BasesDefended;
|
||||
friend class BattlegroundIC;
|
||||
|
||||
uint32 GetAttr1() const final { return BasesAssaulted; }
|
||||
uint32 GetAttr2() const final { return BasesDefended; }
|
||||
protected:
|
||||
BattlegroundICScore(ObjectGuid playerGuid) : BattlegroundScore(playerGuid) { }
|
||||
|
||||
void UpdateScore(uint32 type, uint32 value) override
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_BASES_ASSAULTED:
|
||||
BasesAssaulted += value;
|
||||
break;
|
||||
case SCORE_BASES_DEFENDED:
|
||||
BasesDefended += value;
|
||||
break;
|
||||
default:
|
||||
BattlegroundScore::UpdateScore(type, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BuildObjectivesBlock(WorldPacket& data) final;
|
||||
|
||||
uint32 GetAttr1() const override { return BasesAssaulted; }
|
||||
uint32 GetAttr2() const override { return BasesDefended; }
|
||||
|
||||
uint32 BasesAssaulted = 0;
|
||||
uint32 BasesDefended = 0;
|
||||
};
|
||||
|
||||
class BattlegroundIC : public Battleground
|
||||
class AC_GAME_API BattlegroundIC : public Battleground
|
||||
{
|
||||
public:
|
||||
BattlegroundIC();
|
||||
~BattlegroundIC() override;
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player) override;
|
||||
void StartingEventCloseDoors() override;
|
||||
void StartingEventCloseDoors() override { }
|
||||
void StartingEventOpenDoors() override;
|
||||
void PostUpdateImpl(uint32 diff) override;
|
||||
|
||||
void RemovePlayer(Player* player) override;
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger) override;
|
||||
bool SetupBattleground() override;
|
||||
void SpawnLeader(uint32 teamid);
|
||||
void HandleKillUnit(Creature* unit, Player* killer) override;
|
||||
void HandleKillPlayer(Player* player, Player* killer) override;
|
||||
void EndBattleground(TeamId winnerTeamId) override;
|
||||
void EventPlayerClickedOnFlag(Player* source, GameObject* /*gameObject*/) override;
|
||||
|
||||
void EventPlayerDamagedGO(Player* /*player*/, GameObject* go, uint32 eventType) override;
|
||||
void EventPlayerDamagedGO(Player* /*player*/, GameObject* /*go*/, uint32 /*eventType*/) override { }
|
||||
void DestroyGate(Player* player, GameObject* go) override;
|
||||
|
||||
GraveyardStruct const* GetClosestGraveyard(Player* player) override;
|
||||
|
||||
/* Scorekeeping */
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
|
||||
bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
|
||||
|
||||
void FillInitialWorldStates(WorldPacket& data) override;
|
||||
|
||||
@@ -936,6 +983,9 @@ public:
|
||||
bool AllNodesConrolledByTeam(TeamId teamId) const override; // overwrited
|
||||
bool IsResourceGlutAllowed(TeamId teamId) const;
|
||||
void DoAction(uint32 action, ObjectGuid guid) override;
|
||||
|
||||
[[nodiscard]] ICNodePoint const& GetICNodePoint(uint8 index) { return nodePoint[index]; }
|
||||
|
||||
private:
|
||||
uint32 closeFortressDoorsTimer;
|
||||
bool doorsClosed;
|
||||
|
||||
@@ -16,30 +16,12 @@
|
||||
*/
|
||||
|
||||
#include "BattlegroundNA.h"
|
||||
#include "Language.h"
|
||||
#include "Object.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
BattlegroundNA::BattlegroundNA()
|
||||
{
|
||||
BgObjects.resize(BG_NA_OBJECT_MAX);
|
||||
|
||||
StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M;
|
||||
StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
|
||||
StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
|
||||
StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
|
||||
//we must set messageIds
|
||||
StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS;
|
||||
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS;
|
||||
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
|
||||
}
|
||||
|
||||
BattlegroundNA::~BattlegroundNA()
|
||||
{
|
||||
}
|
||||
|
||||
void BattlegroundNA::StartingEventCloseDoors()
|
||||
@@ -57,39 +39,6 @@ void BattlegroundNA::StartingEventOpenDoors()
|
||||
SpawnBGObject(i, 60);
|
||||
}
|
||||
|
||||
void BattlegroundNA::AddPlayer(Player* player)
|
||||
{
|
||||
Battleground::AddPlayer(player);
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundScore(player);
|
||||
Battleground::UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattlegroundNA::RemovePlayer(Player* /*player*/)
|
||||
{
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
Battleground::UpdateArenaWorldState();
|
||||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
void BattlegroundNA::HandleKillPlayer(Player* player, Player* killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
if (!killer)
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "BattlegroundNA: Killer player not found");
|
||||
return;
|
||||
}
|
||||
|
||||
Battleground::HandleKillPlayer(player, killer);
|
||||
|
||||
Battleground::UpdateArenaWorldState();
|
||||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
bool BattlegroundNA::HandlePlayerUnderMap(Player* player)
|
||||
{
|
||||
player->NearTeleportTo(4055.504395f, 2919.660645f, 13.611241f, player->GetOrientation());
|
||||
@@ -118,13 +67,7 @@ void BattlegroundNA::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
void BattlegroundNA::FillInitialWorldStates(WorldPacket& data)
|
||||
{
|
||||
data << uint32(0xa11) << uint32(1); // 9
|
||||
Battleground::UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattlegroundNA::Init()
|
||||
{
|
||||
//call parent's class reset
|
||||
Battleground::Init();
|
||||
Arena::FillInitialWorldStates(data);
|
||||
}
|
||||
|
||||
bool BattlegroundNA::SetupBattleground()
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#ifndef __BATTLEGROUNDNA_H
|
||||
#define __BATTLEGROUNDNA_H
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "Arena.h"
|
||||
|
||||
enum BattlegroundNAObjectTypes
|
||||
{
|
||||
@@ -33,7 +33,7 @@ enum BattlegroundNAObjectTypes
|
||||
BG_NA_OBJECT_MAX = 8
|
||||
};
|
||||
|
||||
enum BattlegroundNAObjects
|
||||
enum BattlegroundNAGameObjects
|
||||
{
|
||||
BG_NA_OBJECT_TYPE_DOOR_1 = 183978,
|
||||
BG_NA_OBJECT_TYPE_DOOR_2 = 183980,
|
||||
@@ -43,23 +43,19 @@ enum BattlegroundNAObjects
|
||||
BG_NA_OBJECT_TYPE_BUFF_2 = 184664
|
||||
};
|
||||
|
||||
class BattlegroundNA : public Battleground
|
||||
class AC_GAME_API BattlegroundNA : public Arena
|
||||
{
|
||||
public:
|
||||
BattlegroundNA();
|
||||
~BattlegroundNA() override;
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player) override;
|
||||
void StartingEventCloseDoors() override;
|
||||
void StartingEventOpenDoors() override;
|
||||
|
||||
void RemovePlayer(Player* player) override;
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger) override;
|
||||
bool SetupBattleground() override;
|
||||
void Init() override;
|
||||
void FillInitialWorldStates(WorldPacket& d) override;
|
||||
void HandleKillPlayer(Player* player, Player* killer) override;
|
||||
bool HandlePlayerUnderMap(Player* player) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,29 +16,15 @@
|
||||
*/
|
||||
|
||||
#include "BattlegroundRL.h"
|
||||
#include "ArenaScore.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "Player.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
BattlegroundRL::BattlegroundRL()
|
||||
{
|
||||
BgObjects.resize(BG_RL_OBJECT_MAX);
|
||||
|
||||
StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M;
|
||||
StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
|
||||
StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
|
||||
StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
|
||||
//we must set messageIds
|
||||
StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS;
|
||||
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS;
|
||||
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
|
||||
}
|
||||
|
||||
BattlegroundRL::~BattlegroundRL()
|
||||
{
|
||||
}
|
||||
|
||||
void BattlegroundRL::StartingEventCloseDoors()
|
||||
@@ -56,39 +42,6 @@ void BattlegroundRL::StartingEventOpenDoors()
|
||||
SpawnBGObject(i, 60);
|
||||
}
|
||||
|
||||
void BattlegroundRL::AddPlayer(Player* player)
|
||||
{
|
||||
Battleground::AddPlayer(player);
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundScore(player);
|
||||
Battleground::UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattlegroundRL::RemovePlayer(Player* /*player*/)
|
||||
{
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
UpdateArenaWorldState();
|
||||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
void BattlegroundRL::HandleKillPlayer(Player* player, Player* killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
if (!killer)
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "Killer player not found");
|
||||
return;
|
||||
}
|
||||
|
||||
Battleground::HandleKillPlayer(player, killer);
|
||||
|
||||
Battleground::UpdateArenaWorldState();
|
||||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
bool BattlegroundRL::HandlePlayerUnderMap(Player* player)
|
||||
{
|
||||
player->NearTeleportTo(1285.810547f, 1667.896851f, 39.957642f, player->GetOrientation());
|
||||
@@ -143,13 +96,7 @@ void BattlegroundRL::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
void BattlegroundRL::FillInitialWorldStates(WorldPacket& data)
|
||||
{
|
||||
data << uint32(0xbba) << uint32(1); // 9
|
||||
Battleground::UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattlegroundRL::Init()
|
||||
{
|
||||
//call parent's reset
|
||||
Battleground::Init();
|
||||
Arena::FillInitialWorldStates(data);
|
||||
}
|
||||
|
||||
bool BattlegroundRL::SetupBattleground()
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#ifndef __BATTLEGROUNDRL_H
|
||||
#define __BATTLEGROUNDRL_H
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "Arena.h"
|
||||
|
||||
enum BattlegroundRLObjectTypes
|
||||
{
|
||||
@@ -39,23 +39,19 @@ enum BattlegroundRLObjects
|
||||
BG_RL_OBJECT_TYPE_BUFF_2 = 184664
|
||||
};
|
||||
|
||||
class BattlegroundRL : public Battleground
|
||||
class AC_GAME_API BattlegroundRL : public Arena
|
||||
{
|
||||
public:
|
||||
BattlegroundRL();
|
||||
~BattlegroundRL() override;
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player) override;
|
||||
void Init() override;
|
||||
void FillInitialWorldStates(WorldPacket& d) override;
|
||||
void StartingEventCloseDoors() override;
|
||||
void StartingEventOpenDoors() override;
|
||||
|
||||
void RemovePlayer(Player* player) override;
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger) override;
|
||||
bool SetupBattleground() override;
|
||||
void HandleKillPlayer(Player* player, Player* killer) override;
|
||||
bool HandlePlayerUnderMap(Player* player) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "BattlegroundRV.h"
|
||||
#include "ArenaScore.h"
|
||||
#include "Battleground.h"
|
||||
#include "GameObject.h"
|
||||
#include "Language.h"
|
||||
@@ -35,24 +36,16 @@ BattlegroundRV::BattlegroundRV()
|
||||
{
|
||||
BgObjects.resize(BG_RV_OBJECT_MAX);
|
||||
|
||||
StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M;
|
||||
StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
|
||||
StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
|
||||
StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
|
||||
StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS;
|
||||
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS;
|
||||
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
|
||||
|
||||
CheckPlayersTimer = 0;
|
||||
_checkPlayersTimer = 0;
|
||||
_timer = 0s;
|
||||
_state = 0;
|
||||
}
|
||||
|
||||
BattlegroundRV::~BattlegroundRV() { }
|
||||
|
||||
void BattlegroundRV::TeleportUnitToNewZ(Unit* unit, float newZ, bool casting)
|
||||
{
|
||||
if (!unit->IsAlive())
|
||||
return;
|
||||
|
||||
unit->NearTeleportTo(unit->GetPositionX(), unit->GetPositionY(), newZ, unit->GetOrientation(), casting);
|
||||
unit->m_positionZ = newZ;
|
||||
}
|
||||
@@ -64,6 +57,7 @@ void BattlegroundRV::CheckPositionForUnit(Unit* unit)
|
||||
{
|
||||
float groundZ_vmap = unit->GetMap()->GetHeight(unit->GetPositionX(), unit->GetPositionY(), 37.0f, true, 50.0f);
|
||||
float groundZ_dyntree = unit->GetMap()->GetDynamicMapTree().getHeight(unit->GetPositionX(), unit->GetPositionY(), 37.0f, 50.0f, unit->GetPhaseMask());
|
||||
|
||||
if ((groundZ_vmap > 28.0f && groundZ_vmap < 29.0f) || (groundZ_dyntree > 28.0f && groundZ_dyntree < 37.0f))
|
||||
{
|
||||
float groundZ = std::max<float>(groundZ_vmap, groundZ_dyntree);
|
||||
@@ -78,97 +72,99 @@ void BattlegroundRV::PostUpdateImpl(uint32 diff)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
if (GetTimer() < Milliseconds(diff))
|
||||
if (_timer < Milliseconds(diff))
|
||||
{
|
||||
switch (getState())
|
||||
switch (_state)
|
||||
{
|
||||
case BG_RV_STATE_OPEN_FENCES:
|
||||
{
|
||||
for (uint8 i = BG_RV_OBJECT_FIRE_1; i <= BG_RV_OBJECT_FIREDOOR_2; ++i)
|
||||
DoorOpen(i);
|
||||
SetTimer(BG_RV_CLOSE_FIRE_TIMER);
|
||||
setState(BG_RV_STATE_CLOSE_FIRE);
|
||||
|
||||
for (auto itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
if (Player* player = itr->second)
|
||||
_timer = BG_RV_CLOSE_FIRE_TIMER;
|
||||
_state = BG_RV_STATE_CLOSE_FIRE;
|
||||
|
||||
for (auto const& [playerGuid, player] : m_Players)
|
||||
{
|
||||
if (!player)
|
||||
continue;
|
||||
|
||||
// Demonic Circle Summon
|
||||
if (GameObject* gObj = player->GetGameObject(48018))
|
||||
{
|
||||
// Demonic Circle Summon
|
||||
if (GameObject* gObj = player->GetGameObject(48018))
|
||||
{
|
||||
gObj->Relocate(gObj->GetPositionX(), gObj->GetPositionY(), 28.28f);
|
||||
gObj->UpdateObjectVisibility(true);
|
||||
}
|
||||
|
||||
if (player->GetPositionZ() < 27.0f)
|
||||
TeleportUnitToNewZ(player, 28.28f, true);
|
||||
|
||||
for (uint8 i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i)
|
||||
if (player->m_SummonSlot[i])
|
||||
if (Creature* totem = GetBgMap()->GetCreature(player->m_SummonSlot[i]))
|
||||
if (totem->GetPositionZ() < 28.0f)
|
||||
TeleportUnitToNewZ(totem, 28.28f, true);
|
||||
|
||||
for (auto itr2 = player->m_Controlled.begin(); itr2 != player->m_Controlled.end(); ++itr2)
|
||||
{
|
||||
if ((*itr2)->GetPositionZ() < 28.0f)
|
||||
TeleportUnitToNewZ((*itr2), 28.28f, true);
|
||||
|
||||
// Xinef: override stay position
|
||||
if (CharmInfo* charmInfo = (*itr2)->GetCharmInfo())
|
||||
if (charmInfo->IsAtStay())
|
||||
{
|
||||
(*itr2)->StopMovingOnCurrentPos();
|
||||
charmInfo->SaveStayPosition(false);
|
||||
}
|
||||
}
|
||||
gObj->Relocate(gObj->GetPositionX(), gObj->GetPositionY(), 28.28f);
|
||||
gObj->UpdateObjectVisibility(true);
|
||||
}
|
||||
|
||||
if (player->GetPositionZ() < 27.0f)
|
||||
TeleportUnitToNewZ(player, 28.28f, true);
|
||||
|
||||
for (uint8 i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i)
|
||||
if (player->m_SummonSlot[i])
|
||||
if (Creature* totem = GetBgMap()->GetCreature(player->m_SummonSlot[i]))
|
||||
if (totem->GetPositionZ() < 28.0f)
|
||||
TeleportUnitToNewZ(totem, 28.28f, true);
|
||||
|
||||
for (auto itr2 = player->m_Controlled.begin(); itr2 != player->m_Controlled.end(); ++itr2)
|
||||
{
|
||||
if ((*itr2)->GetPositionZ() < 28.0f)
|
||||
TeleportUnitToNewZ((*itr2), 28.28f, true);
|
||||
|
||||
// Xinef: override stay position
|
||||
if (CharmInfo* charmInfo = (*itr2)->GetCharmInfo())
|
||||
if (charmInfo->IsAtStay())
|
||||
{
|
||||
(*itr2)->StopMovingOnCurrentPos();
|
||||
charmInfo->SaveStayPosition(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fix ground on elevators (so aoe spells can be casted there)
|
||||
{
|
||||
uint32 objects[2] = {BG_RV_OBJECT_ELEVATOR_1, BG_RV_OBJECT_ELEVATOR_2};
|
||||
uint32 objects[2] = { BG_RV_OBJECT_ELEVATOR_1, BG_RV_OBJECT_ELEVATOR_2 };
|
||||
for (uint8 i = 0; i < 2; ++i)
|
||||
if (GameObject* go = GetBGObject(objects[i]))
|
||||
go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_TRANSPORT);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BG_RV_STATE_CLOSE_FIRE:
|
||||
for (uint8 i = BG_RV_OBJECT_FIRE_1; i <= BG_RV_OBJECT_FIREDOOR_2; ++i)
|
||||
DoorClose(i);
|
||||
// Fire got closed after five seconds, leaves twenty seconds before toggling pillars
|
||||
SetTimer(BG_RV_FIRE_TO_PILLAR_TIMER);
|
||||
setState(BG_RV_STATE_SWITCH_PILLARS);
|
||||
_timer = BG_RV_FIRE_TO_PILLAR_TIMER;
|
||||
_state = BG_RV_STATE_SWITCH_PILLARS;
|
||||
break;
|
||||
case BG_RV_STATE_SWITCH_PILLARS:
|
||||
UpdatePillars();
|
||||
SetTimer(BG_RV_PILLAR_SWITCH_TIMER);
|
||||
_timer = BG_RV_PILLAR_SWITCH_TIMER;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
SetTimer(GetTimer() - Milliseconds(diff));
|
||||
_timer -= Milliseconds(diff);
|
||||
|
||||
if (getState() == BG_RV_STATE_OPEN_FENCES)
|
||||
if (_state == BG_RV_STATE_OPEN_FENCES)
|
||||
return;
|
||||
|
||||
if (CheckPlayersTimer <= diff)
|
||||
if (_checkPlayersTimer <= diff)
|
||||
{
|
||||
CheckPlayersTimer = 0;
|
||||
for (BattlegroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
CheckPositionForUnit(itr->second);
|
||||
_checkPlayersTimer = 0;
|
||||
|
||||
for (auto const& itr : m_Players)
|
||||
CheckPositionForUnit(itr.second);
|
||||
|
||||
// maybe for pets and m_Controlled also, but not really necessary
|
||||
}
|
||||
else
|
||||
CheckPlayersTimer -= diff;
|
||||
}
|
||||
|
||||
void BattlegroundRV::StartingEventCloseDoors()
|
||||
{
|
||||
_checkPlayersTimer -= diff;
|
||||
}
|
||||
|
||||
void BattlegroundRV::StartingEventOpenDoors()
|
||||
{
|
||||
for (BattlegroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
itr->second->SetPhaseMask(1, true);
|
||||
for (auto const& itr : m_Players)
|
||||
itr.second->SetPhaseMask(1, true);
|
||||
|
||||
// Buff respawn
|
||||
SpawnBGObject(BG_RV_OBJECT_BUFF_1, 90);
|
||||
@@ -178,44 +174,8 @@ void BattlegroundRV::StartingEventOpenDoors()
|
||||
DoorOpen(BG_RV_OBJECT_ELEVATOR_1);
|
||||
DoorOpen(BG_RV_OBJECT_ELEVATOR_2);
|
||||
|
||||
setState(BG_RV_STATE_OPEN_FENCES);
|
||||
SetTimer(BG_RV_FIRST_TIMER);
|
||||
}
|
||||
|
||||
void BattlegroundRV::AddPlayer(Player* player)
|
||||
{
|
||||
if (GetStatus() == STATUS_WAIT_JOIN && player->GetBgTeamId() == TEAM_HORDE)
|
||||
player->SetPhaseMask(2, true);
|
||||
|
||||
Battleground::AddPlayer(player);
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundScore(player);
|
||||
BattlegroundRV::UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattlegroundRV::RemovePlayer(Player* player)
|
||||
{
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
if (GetStatus() == STATUS_WAIT_JOIN)
|
||||
player->SetPhaseMask(1, true);
|
||||
|
||||
BattlegroundRV::UpdateArenaWorldState();
|
||||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
void BattlegroundRV::HandleKillPlayer(Player* player, Player* killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
if (!killer)
|
||||
return;
|
||||
|
||||
Battleground::HandleKillPlayer(player, killer);
|
||||
BattlegroundRV::UpdateArenaWorldState();
|
||||
|
||||
CheckArenaWinConditions();
|
||||
_state = BG_RV_STATE_OPEN_FENCES;
|
||||
_timer = BG_RV_FIRST_TIMER;
|
||||
}
|
||||
|
||||
bool BattlegroundRV::HandlePlayerUnderMap(Player* player)
|
||||
@@ -226,7 +186,7 @@ bool BattlegroundRV::HandlePlayerUnderMap(Player* player)
|
||||
|
||||
void BattlegroundRV::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS || getState() == BG_RV_STATE_OPEN_FENCES /*during elevator rising it's possible to jump and cause areatrigger*/)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS || _state == BG_RV_STATE_OPEN_FENCES /*during elevator rising it's possible to jump and cause areatrigger*/)
|
||||
return;
|
||||
|
||||
switch (trigger)
|
||||
@@ -251,13 +211,7 @@ void BattlegroundRV::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
void BattlegroundRV::FillInitialWorldStates(WorldPacket& data)
|
||||
{
|
||||
data << uint32(BG_RV_WORLD_STATE) << uint32(1);
|
||||
BattlegroundRV::UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattlegroundRV::UpdateArenaWorldState()
|
||||
{
|
||||
UpdateWorldState(BG_RV_WORLD_STATE_A, GetAlivePlayersCountByTeam(TEAM_ALLIANCE));
|
||||
UpdateWorldState(BG_RV_WORLD_STATE_H, GetAlivePlayersCountByTeam(TEAM_HORDE));
|
||||
Arena::FillInitialWorldStates(data);
|
||||
}
|
||||
|
||||
void BattlegroundRV::Init()
|
||||
@@ -352,5 +306,6 @@ GameObject* BattlegroundRV::GetPillarAtPosition(Position* p)
|
||||
uint32 pillar = GetPillarIdForPos(p);
|
||||
if (!pillar)
|
||||
return nullptr;
|
||||
|
||||
return GetBgMap()->GetGameObject(BgObjects[pillar]);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#ifndef __BATTLEGROUNDRV_H
|
||||
#define __BATTLEGROUNDRV_H
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "Arena.h"
|
||||
|
||||
enum BattlegroundRVObjectTypes
|
||||
{
|
||||
@@ -48,7 +48,7 @@ enum BattlegroundRVObjectTypes
|
||||
BG_RV_OBJECT_MAX,
|
||||
};
|
||||
|
||||
enum BattlegroundRVObjects
|
||||
enum BattlegroundRVGameObjects
|
||||
{
|
||||
BG_RV_OBJECT_TYPE_BUFF_1 = 184663,
|
||||
BG_RV_OBJECT_TYPE_BUFF_2 = 184664,
|
||||
@@ -82,43 +82,33 @@ enum BattlegroundRVData
|
||||
BG_RV_WORLD_STATE = 0xe1a,
|
||||
};
|
||||
|
||||
class BattlegroundRV : public Battleground
|
||||
class AC_GAME_API BattlegroundRV : public Arena
|
||||
{
|
||||
public:
|
||||
BattlegroundRV();
|
||||
~BattlegroundRV() override;
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player) override;
|
||||
void RemovePlayer(Player* player) override;
|
||||
void StartingEventCloseDoors() override;
|
||||
void StartingEventOpenDoors() override;
|
||||
void Init() override;
|
||||
void FillInitialWorldStates(WorldPacket& d) override;
|
||||
void UpdateArenaWorldState() override;
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger) override;
|
||||
bool SetupBattleground() override;
|
||||
void HandleKillPlayer(Player* player, Player* killer) override;
|
||||
bool HandlePlayerUnderMap(Player* player) override;
|
||||
|
||||
GameObject* GetPillarAtPosition(Position* p);
|
||||
|
||||
private:
|
||||
Milliseconds Timer;
|
||||
uint32 State;
|
||||
uint16 CheckPlayersTimer;
|
||||
Milliseconds _timer;
|
||||
uint32 _state;
|
||||
uint16 _checkPlayersTimer;
|
||||
|
||||
void PostUpdateImpl(uint32 diff) override;
|
||||
|
||||
protected:
|
||||
Milliseconds GetTimer() { return Timer; }
|
||||
void SetTimer(Milliseconds timer) { Timer = timer; }
|
||||
uint32 getState() { return State; };
|
||||
void setState(uint32 state) { State = state; }
|
||||
|
||||
void TeleportUnitToNewZ(Unit* unit, float newZ, bool casting);
|
||||
void CheckPositionForUnit(Unit* unit);
|
||||
void UpdatePillars();
|
||||
uint32 GetPillarIdForPos(Position* p);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -19,17 +19,7 @@
|
||||
#define __BATTLEGROUNDSA_H
|
||||
|
||||
#include "Battleground.h"
|
||||
|
||||
struct BattlegroundSAScore : public BattlegroundScore
|
||||
{
|
||||
BattlegroundSAScore(Player* player) : BattlegroundScore(player), demolishers_destroyed(0), gates_destroyed(0) { }
|
||||
~BattlegroundSAScore() override { }
|
||||
uint8 demolishers_destroyed;
|
||||
uint8 gates_destroyed;
|
||||
|
||||
uint32 GetAttr1() const final { return demolishers_destroyed; }
|
||||
uint32 GetAttr2() const final { return gates_destroyed; }
|
||||
};
|
||||
#include "BattlegroundScore.h"
|
||||
|
||||
#define BG_SA_FLAG_AMOUNT 3
|
||||
#define BG_SA_DEMOLISHER_AMOUNT 4
|
||||
@@ -405,6 +395,15 @@ float const BG_SA_GYOrientation[BG_SA_MAX_GY] =
|
||||
6.148f, // defender last GY
|
||||
};
|
||||
|
||||
enum BG_SA_BroadcastTexts
|
||||
{
|
||||
BG_SA_TEXT_ALLIANCE_CAPTURED_TITAN_PORTAL = 28944,
|
||||
BG_SA_TEXT_HORDE_CAPTURED_TITAN_PORTAL = 28945,
|
||||
|
||||
BG_SA_TEXT_ROUND_TWO_START_ONE_MINUTE = 29448,
|
||||
BG_SA_TEXT_ROUND_TWO_START_HALF_MINUTE = 29449
|
||||
};
|
||||
|
||||
struct BG_SA_RoundScore
|
||||
{
|
||||
TeamId winner;
|
||||
@@ -420,8 +419,40 @@ const float SOTADefPortalDest[5][4] =
|
||||
{ 1193.857f, 69.9f, 58.046f, 5.7245f },
|
||||
};
|
||||
|
||||
struct BattlegroundSAScore final : public BattlegroundScore
|
||||
{
|
||||
friend class BattlegroundSA;
|
||||
|
||||
protected:
|
||||
BattlegroundSAScore(ObjectGuid playerGuid) : BattlegroundScore(playerGuid) { }
|
||||
|
||||
void UpdateScore(uint32 type, uint32 value) override
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_DESTROYED_DEMOLISHER:
|
||||
DemolishersDestroyed += value;
|
||||
break;
|
||||
case SCORE_DESTROYED_WALL:
|
||||
GatesDestroyed += value;
|
||||
break;
|
||||
default:
|
||||
BattlegroundScore::UpdateScore(type, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BuildObjectivesBlock(WorldPacket& data) final;
|
||||
|
||||
uint32 GetAttr1() const override { return DemolishersDestroyed; }
|
||||
uint32 GetAttr2() const override { return GatesDestroyed; }
|
||||
|
||||
uint32 DemolishersDestroyed = 0;
|
||||
uint32 GatesDestroyed = 0;
|
||||
};
|
||||
|
||||
/// Class for manage Strand of Ancient battleground
|
||||
class BattlegroundSA : public Battleground
|
||||
class AC_GAME_API BattlegroundSA : public Battleground
|
||||
{
|
||||
public:
|
||||
BattlegroundSA();
|
||||
@@ -491,10 +522,6 @@ public:
|
||||
void RemovePlayer(Player* player) override;
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger) override;
|
||||
|
||||
/* Scorekeeping */
|
||||
/// Update score board
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
|
||||
|
||||
// Teleporters
|
||||
void DefendersPortalTeleport(GameObject* portal, Player* plr);
|
||||
|
||||
@@ -620,6 +647,6 @@ private:
|
||||
bool _relicClicked;
|
||||
|
||||
// Achievement: Not Even a Scratch
|
||||
bool _notEvenAScratch[BG_TEAMS_COUNT];
|
||||
bool _notEvenAScratch[PVP_TEAMS_COUNT];
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -26,15 +26,21 @@
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
void BattlegroundWGScore::BuildObjectivesBlock(WorldPacket& data)
|
||||
{
|
||||
data << uint32(2); // Objectives Count
|
||||
data << uint32(FlagCaptures);
|
||||
data << uint32(FlagReturns);
|
||||
}
|
||||
|
||||
BattlegroundWS::BattlegroundWS()
|
||||
{
|
||||
BgObjects.resize(BG_WS_OBJECT_MAX);
|
||||
BgCreatures.resize(BG_CREATURES_MAX_WS);
|
||||
|
||||
StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES;
|
||||
StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN;
|
||||
StartMessageIds[BG_STARTING_EVENT_SECOND] = BG_WS_TEXT_START_ONE_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_THIRD] = BG_WS_TEXT_START_HALF_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_FOURTH] = BG_WS_TEXT_BATTLE_HAS_BEGUN;
|
||||
|
||||
_flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
_flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
@@ -68,7 +74,7 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff)
|
||||
case BG_WS_EVENT_RESPAWN_BOTH_FLAGS:
|
||||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY);
|
||||
SendMessageToAll(LANG_BG_WS_F_PLACED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
SendBroadcastText(BG_WS_TEXT_FLAGS_PLACED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED);
|
||||
break;
|
||||
case BG_WS_EVENT_ALLIANCE_DROP_FLAG:
|
||||
@@ -134,7 +140,7 @@ void BattlegroundWS::StartingEventOpenDoors()
|
||||
void BattlegroundWS::AddPlayer(Player* player)
|
||||
{
|
||||
Battleground::AddPlayer(player);
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundWGScore(player);
|
||||
PlayerScores.emplace(player->GetGUID().GetCounter(), new BattlegroundWGScore(player->GetGUID()));
|
||||
}
|
||||
|
||||
void BattlegroundWS::RespawnFlagAfterDrop(TeamId teamId)
|
||||
@@ -144,7 +150,7 @@ void BattlegroundWS::RespawnFlagAfterDrop(TeamId teamId)
|
||||
|
||||
UpdateFlagState(teamId, BG_WS_FLAG_STATE_ON_BASE);
|
||||
SpawnBGObject(teamId == TEAM_ALLIANCE ? BG_WS_OBJECT_A_FLAG : BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY);
|
||||
SendMessageToAll(teamId == TEAM_ALLIANCE ? LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED : LANG_BG_WS_HORDE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
SendBroadcastText(BG_WS_TEXT_FLAGS_PLACED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED);
|
||||
|
||||
if (GameObject* flag = GetBgMap()->GetGameObject(GetDroppedFlagGUID(teamId)))
|
||||
@@ -187,18 +193,19 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* player)
|
||||
AddPoints(player->GetTeamId(), 1);
|
||||
SetFlagPicker(ObjectGuid::Empty, GetOtherTeamId(player->GetTeamId()));
|
||||
UpdateFlagState(GetOtherTeamId(player->GetTeamId()), BG_WS_FLAG_STATE_ON_BASE);
|
||||
|
||||
if (player->GetTeamId() == TEAM_ALLIANCE)
|
||||
{
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE);
|
||||
SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
SendBroadcastText(BG_WS_TEXT_CAPTURED_HORDE_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
RewardReputationToTeam(890, _reputationCapture, TEAM_ALLIANCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE);
|
||||
SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
SendBroadcastText(BG_WS_TEXT_CAPTURED_ALLIANCE_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
RewardReputationToTeam(889, _reputationCapture, TEAM_HORDE);
|
||||
}
|
||||
|
||||
@@ -241,14 +248,14 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* player)
|
||||
{
|
||||
UpdateFlagState(TEAM_HORDE, BG_WS_FLAG_STATE_ON_GROUND);
|
||||
player->CastSpell(player, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true);
|
||||
SendMessageToAll(LANG_BG_WS_DROPPED_HF, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
SendBroadcastText(BG_WS_TEXT_HORDE_FLAG_DROPPED, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
_bgEvents.RescheduleEvent(BG_WS_EVENT_HORDE_DROP_FLAG, BG_WS_FLAG_DROP_TIME);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateFlagState(TEAM_ALLIANCE, BG_WS_FLAG_STATE_ON_GROUND);
|
||||
player->CastSpell(player, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true);
|
||||
SendMessageToAll(LANG_BG_WS_DROPPED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
SendBroadcastText(BG_WS_TEXT_ALLIANCE_FLAG_DROPPED, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
_bgEvents.RescheduleEvent(BG_WS_EVENT_ALLIANCE_DROP_FLAG, BG_WS_FLAG_DROP_TIME);
|
||||
}
|
||||
}
|
||||
@@ -270,7 +277,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
||||
player->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_SILVERWING_FLAG_PICKED);
|
||||
|
||||
PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP);
|
||||
SendMessageToAll(LANG_BG_WS_PICKEDUP_AF, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
SendBroadcastText(BG_WS_TEXT_ALLIANCE_FLAG_PICKED_UP, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
|
||||
if (GetFlagState(TEAM_HORDE) != BG_WS_FLAG_STATE_ON_BASE)
|
||||
{
|
||||
@@ -290,7 +297,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
||||
player->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_WARSONG_FLAG_PICKED);
|
||||
|
||||
PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP);
|
||||
SendMessageToAll(LANG_BG_WS_PICKEDUP_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
SendBroadcastText(BG_WS_TEXT_HORDE_FLAG_PICKED_UP, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
|
||||
if (GetFlagState(TEAM_ALLIANCE) != BG_WS_FLAG_STATE_ON_BASE)
|
||||
{
|
||||
@@ -315,7 +322,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
||||
UpdatePlayerScore(player, SCORE_FLAG_RETURNS, 1);
|
||||
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
|
||||
SendMessageToAll(LANG_BG_WS_RETURNED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
SendBroadcastText(BG_WS_TEXT_ALLIANCE_FLAG_RETURNED, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10);
|
||||
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15);
|
||||
RemoveAssaultAuras();
|
||||
@@ -332,7 +339,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
||||
player->CastSpell(player, assaultSpellId, true);
|
||||
|
||||
PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP);
|
||||
SendMessageToAll(LANG_BG_WS_PICKEDUP_AF, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
SendBroadcastText(BG_WS_TEXT_ALLIANCE_FLAG_PICKED_UP, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -348,7 +355,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
||||
UpdatePlayerScore(player, SCORE_FLAG_RETURNS, 1);
|
||||
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
|
||||
SendMessageToAll(LANG_BG_WS_RETURNED_HF, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
SendBroadcastText(BG_WS_TEXT_HORDE_FLAG_RETURNED, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10);
|
||||
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15);
|
||||
RemoveAssaultAuras();
|
||||
@@ -365,7 +372,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
||||
player->CastSpell(player, assaultSpellId, true);
|
||||
|
||||
PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP);
|
||||
SendMessageToAll(LANG_BG_WS_PICKEDUP_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
SendBroadcastText(BG_WS_TEXT_HORDE_FLAG_PICKED_UP, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -509,26 +516,22 @@ void BattlegroundWS::HandleKillPlayer(Player* player, Player* killer)
|
||||
Battleground::HandleKillPlayer(player, killer);
|
||||
}
|
||||
|
||||
void BattlegroundWS::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
|
||||
bool BattlegroundWS::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
BattlegroundScoreMap::iterator itr = PlayerScores.find(player->GetGUID());
|
||||
if (itr == PlayerScores.end())
|
||||
return;
|
||||
if (!Battleground::UpdatePlayerScore(player, type, value, doAddHonor))
|
||||
return false;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_FLAG_CAPTURES:
|
||||
((BattlegroundWGScore*)itr->second)->FlagCaptures += value;
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, WS_OBJECTIVE_CAPTURE_FLAG);
|
||||
break;
|
||||
case SCORE_FLAG_RETURNS:
|
||||
((BattlegroundWGScore*)itr->second)->FlagReturns += value;
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, WS_OBJECTIVE_RETURN_FLAG);
|
||||
break;
|
||||
default:
|
||||
Battleground::UpdatePlayerScore(player, type, value, doAddHonor);
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
GraveyardStruct const* BattlegroundWS::GetClosestGraveyard(Player* player)
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#define __BATTLEGROUNDWS_H
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundScore.h"
|
||||
#include "EventMap.h"
|
||||
|
||||
enum BG_WS_Events
|
||||
{
|
||||
@@ -42,6 +44,23 @@ enum BG_WS_TimerOrScore
|
||||
BG_WS_SPELL_BRUTAL_TIME = 15 * MINUTE * IN_MILLISECONDS
|
||||
};
|
||||
|
||||
enum BG_WS_BroadcastTexts
|
||||
{
|
||||
BG_WS_TEXT_START_ONE_MINUTE = 10015,
|
||||
BG_WS_TEXT_START_HALF_MINUTE = 10016,
|
||||
BG_WS_TEXT_BATTLE_HAS_BEGUN = 10014,
|
||||
|
||||
BG_WS_TEXT_CAPTURED_HORDE_FLAG = 9801,
|
||||
BG_WS_TEXT_CAPTURED_ALLIANCE_FLAG = 9802,
|
||||
BG_WS_TEXT_FLAGS_PLACED = 9803,
|
||||
BG_WS_TEXT_ALLIANCE_FLAG_PICKED_UP = 9804,
|
||||
BG_WS_TEXT_ALLIANCE_FLAG_DROPPED = 9805,
|
||||
BG_WS_TEXT_HORDE_FLAG_PICKED_UP = 9807,
|
||||
BG_WS_TEXT_HORDE_FLAG_DROPPED = 9806,
|
||||
BG_WS_TEXT_ALLIANCE_FLAG_RETURNED = 9808,
|
||||
BG_WS_TEXT_HORDE_FLAG_RETURNED = 9809,
|
||||
};
|
||||
|
||||
enum BG_WS_Sound
|
||||
{
|
||||
BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE = 8173,
|
||||
@@ -163,18 +182,39 @@ enum BG_WS_Trigger
|
||||
BG_WS_TRIGGER_HORDE_ELIXIR_BERSERK_SPAWN = 3709,
|
||||
};
|
||||
|
||||
struct BattlegroundWGScore : public BattlegroundScore
|
||||
struct BattlegroundWGScore final : public BattlegroundScore
|
||||
{
|
||||
BattlegroundWGScore(Player* player): BattlegroundScore(player), FlagCaptures(0), FlagReturns(0) { }
|
||||
~BattlegroundWGScore() override { }
|
||||
uint32 FlagCaptures;
|
||||
uint32 FlagReturns;
|
||||
friend class BattlegroundWS;
|
||||
|
||||
uint32 GetAttr1() const final { return FlagCaptures; }
|
||||
uint32 GetAttr2() const final { return FlagReturns; }
|
||||
protected:
|
||||
BattlegroundWGScore(ObjectGuid playerGuid) : BattlegroundScore(playerGuid) { }
|
||||
|
||||
void UpdateScore(uint32 type, uint32 value) override
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_FLAG_CAPTURES: // Flags captured
|
||||
FlagCaptures += value;
|
||||
break;
|
||||
case SCORE_FLAG_RETURNS: // Flags returned
|
||||
FlagReturns += value;
|
||||
break;
|
||||
default:
|
||||
BattlegroundScore::UpdateScore(type, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BuildObjectivesBlock(WorldPacket& data) final;
|
||||
|
||||
uint32 GetAttr1() const override { return FlagCaptures; }
|
||||
uint32 GetAttr2() const override { return FlagReturns; }
|
||||
|
||||
uint32 FlagCaptures = 0;
|
||||
uint32 FlagReturns = 0;
|
||||
};
|
||||
|
||||
class BattlegroundWS : public Battleground
|
||||
class AC_GAME_API BattlegroundWS : public Battleground
|
||||
{
|
||||
public:
|
||||
/* Construction */
|
||||
@@ -207,7 +247,7 @@ public:
|
||||
GraveyardStruct const* GetClosestGraveyard(Player* player) override;
|
||||
|
||||
void UpdateFlagState(TeamId teamId, uint32 value);
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
|
||||
bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
|
||||
void SetDroppedFlagGUID(ObjectGuid guid, TeamId teamId) override { _droppedFlagGUID[teamId] = guid; }
|
||||
ObjectGuid GetDroppedFlagGUID(TeamId teamId) const { return _droppedFlagGUID[teamId];}
|
||||
void FillInitialWorldStates(WorldPacket& data) override;
|
||||
@@ -233,4 +273,5 @@ private:
|
||||
|
||||
void PostUpdateImpl(uint32 diff) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user