Finished work on lower level classes, time to move to MapManager and QueueMgr

This commit is contained in:
Machiavelli
2011-07-06 00:58:40 +02:00
parent c44134e877
commit 7dc2bf6ee3
17 changed files with 590 additions and 567 deletions

View File

@@ -125,7 +125,7 @@ class ArenaTeam
uint8 GetSlot() const { return GetSlotByType(GetType()); }
static uint8 GetSlotByType(uint32 type);
const uint64& GetCaptain() const { return CaptainGuid; }
std::string GetName() const { return TeamName; }
std::string const& GetName() const { return TeamName; }
const ArenaTeamStats& GetStats() const { return Stats; }
uint32 GetRating() const { return Stats.Rating; }

View File

@@ -171,9 +171,9 @@ enum BattlegroundWinner
enum BattlegroundTeamId
{
BG_TEAM_ALLIANCE = 0,
BG_TEAM_HORDE = 1
BG_TEAM_HORDE = 1,
BG_TEAMS_COUNT = 2
};
#define BG_TEAMS_COUNT 2
enum BattlegroundStartingEvents
{

View File

@@ -1022,12 +1022,12 @@ void BattlegroundQueue::Update(BattlegroundTypeId bgTypeId, BattlegroundBracketI
bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{
Player* plr = sObjectMgr->GetPlayer(m_PlayerGuid);
Player* plr = sObjectMgr->GetPlayer(_playerGUID);
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
if (!plr)
return true;
Battleground* bg = sBattlegroundMgr->GetBattleground(m_BgInstanceGUID, m_BgTypeId);
BattlegroundMap* bg = sBattlegroundMgr->GetBattleground(_bgInstanceGUID, _bgTypeId);
//if battleground ended and its instance deleted - do nothing
if (!bg)
return true;
@@ -1038,11 +1038,11 @@ bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{
// check if player is invited to this bg
BattlegroundQueue &bgQueue = sBattlegroundMgr->m_BattlegroundQueues[bgQueueTypeId];
if (bgQueue.IsPlayerInvited(m_PlayerGuid, m_BgInstanceGUID, m_RemoveTime))
if (bgQueue.IsPlayerInvited(_playerGUID, _bgInstanceGUID, _removeTime))
{
WorldPacket data;
//we must send remaining time in queue
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME - INVITATION_REMIND_TIME, 0, m_ArenaType);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME - INVITATION_REMIND_TIME, 0, _arenaType);
plr->GetSession()->SendPacket(&data);
}
}
@@ -1065,29 +1065,29 @@ void BGQueueInviteEvent::Abort(uint64 /*e_time*/)
*/
bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{
Player* plr = sObjectMgr->GetPlayer(m_PlayerGuid);
Player* plr = sObjectMgr->GetPlayer(_playerGUID);
if (!plr)
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
return true;
Battleground* bg = sBattlegroundMgr->GetBattleground(m_BgInstanceGUID, m_BgTypeId);
Battleground* bg = sBattlegroundMgr->GetBattleground(_bgInstanceGUID, _bgTypeId);
//battleground can be deleted already when we are removing queue info
//bg pointer can be NULL! so use it carefully!
uint32 queueSlot = plr->GetBattlegroundQueueIndex(m_BgQueueTypeId);
uint32 queueSlot = plr->GetBattlegroundQueueIndex(_bgQueueTypeId);
if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue, or in Battleground
{
// check if player is in queue for this BG and if we are removing his invite event
BattlegroundQueue &bgQueue = sBattlegroundMgr->m_BattlegroundQueues[m_BgQueueTypeId];
if (bgQueue.IsPlayerInvited(m_PlayerGuid, m_BgInstanceGUID, m_RemoveTime))
BattlegroundQueue &bgQueue = sBattlegroundMgr->m_BattlegroundQueues[_bgQueueTypeId];
if (bgQueue.IsPlayerInvited(_playerGUID, _bgInstanceGUID, _removeTime))
{
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: removing player %u from bg queue for instance %u because of not pressing enter battle in time.", plr->GetGUIDLow(), m_BgInstanceGUID);
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: removing player %u from bg queue for instance %u because of not pressing enter battle in time.", plr->GetGUIDLow(), _bgInstanceGUID);
plr->RemoveBattlegroundQueueId(m_BgQueueTypeId);
bgQueue.RemovePlayer(m_PlayerGuid, true);
plr->RemoveBattlegroundQueueId(_bgQueueTypeId);
bgQueue.RemovePlayer(_playerGUID, true);
//update queues if battleground isn't ended
if (bg && bg->isBattleground() && bg->GetStatus() != STATUS_WAIT_LEAVE)
sBattlegroundMgr->ScheduleQueueUpdate(0, 0, m_BgQueueTypeId, m_BgTypeId, bg->GetBracketId());
sBattlegroundMgr->ScheduleQueueUpdate(0, 0, _bgQueueTypeId, _bgTypeId, bg->GetBracketId());
WorldPacket data;
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0);

View File

@@ -62,7 +62,8 @@ enum BattlegroundQueueGroupTypes
};
#define BG_QUEUE_GROUP_TYPES_COUNT 4
class Battleground;
class BattlegroundMap;
struct BattlegroundTemplate;
class BattlegroundQueue
{
public:
@@ -71,9 +72,9 @@ class BattlegroundQueue
void Update(BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id, uint8 arenaType = 0, bool isRated = false, uint32 minRating = 0);
void FillPlayersToBG(Battleground* bg, BattlegroundBracketId bracket_id);
void FillPlayersToBG(BattlegroundMap* bg, BattlegroundBracketId bracket_id);
bool CheckPremadeMatch(BattlegroundBracketId bracket_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam);
bool CheckNormalMatch(Battleground* bg_template, BattlegroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers);
bool CheckNormalMatch(BattlegroundTemplate* bg_template, BattlegroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers);
bool CheckSkirmishForSameFaction(BattlegroundBracketId bracket_id, uint32 minPlayersPerTeam);
GroupQueueInfo * AddGroup(Player* leader, Group* group, BattlegroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 MatchmakerRating, uint32 ArenaTeamId = 0);
void RemovePlayer(const uint64& guid, bool decreaseInvitedCount);
@@ -118,7 +119,7 @@ class BattlegroundQueue
private:
bool InviteGroupToBG(GroupQueueInfo * ginfo, Battleground* bg, uint32 side);
bool InviteGroupToBG(GroupQueueInfo * ginfo, BattlegroundMap* bg, uint32 side);
uint32 m_WaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME];
uint32 m_WaitTimeLastPlayer[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS];
uint32 m_SumOfWaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS];
@@ -132,7 +133,7 @@ class BGQueueInviteEvent : public BasicEvent
{
public:
BGQueueInviteEvent(const uint64& pl_guid, uint32 BgInstanceGUID, BattlegroundTypeId BgTypeId, uint8 arenaType, uint32 removeTime) :
m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_ArenaType(arenaType), m_RemoveTime(removeTime)
_playerGUID(pl_guid), _bgInstanceGUID(BgInstanceGUID), _bgTypeId(BgTypeId), _arenaType(arenaType), _removeTime(removeTime)
{
};
virtual ~BGQueueInviteEvent() {};
@@ -140,11 +141,11 @@ class BGQueueInviteEvent : public BasicEvent
virtual bool Execute(uint64 e_time, uint32 p_time);
virtual void Abort(uint64 e_time);
private:
uint64 m_PlayerGuid;
uint32 m_BgInstanceGUID;
BattlegroundTypeId m_BgTypeId;
uint8 m_ArenaType;
uint32 m_RemoveTime;
uint64 _playerGUID;
uint32 _bgInstanceGUID;
BattlegroundTypeId _bgTypeId;
uint8 _arenaType;
uint32 _removeTime;
};
/*
@@ -156,7 +157,7 @@ class BGQueueRemoveEvent : public BasicEvent
{
public:
BGQueueRemoveEvent(const uint64& pl_guid, uint32 bgInstanceGUID, BattlegroundTypeId BgTypeId, BattlegroundQueueTypeId bgQueueTypeId, uint32 removeTime)
: m_PlayerGuid(pl_guid), m_BgInstanceGUID(bgInstanceGUID), m_RemoveTime(removeTime), m_BgTypeId(BgTypeId), m_BgQueueTypeId(bgQueueTypeId)
: _playerGUID(pl_guid), _bgInstanceGUID(bgInstanceGUID), _removeTime(removeTime), _bgTypeId(BgTypeId), _bgQueueTypeId(bgQueueTypeId)
{}
virtual ~BGQueueRemoveEvent() {}
@@ -164,11 +165,11 @@ class BGQueueRemoveEvent : public BasicEvent
virtual bool Execute(uint64 e_time, uint32 p_time);
virtual void Abort(uint64 e_time);
private:
uint64 m_PlayerGuid;
uint32 m_BgInstanceGUID;
uint32 m_RemoveTime;
BattlegroundTypeId m_BgTypeId;
BattlegroundQueueTypeId m_BgQueueTypeId;
uint64 _playerGUID;
uint32 _bgInstanceGUID;
uint32 _removeTime;
BattlegroundTypeId _bgTypeId;
BattlegroundQueueTypeId _bgQueueTypeId;
};
#endif

View File

@@ -22,6 +22,8 @@
class BattlegroundScore
{
friend class BattlegroundMap;
friend class ArenaMap;
protected:
BattlegroundScore() : KillingBlows(0), Deaths(0), HonorableKills(0),
BonusHonor(0), DamageDone(0), HealingDone(0) {};

View File

@@ -18,12 +18,7 @@
#ifndef BATTLEGROUND_TEMPLATE_H
#define BATTLEGROUND_TEMPLATE_H
enum BattlegroundTeamId
{
BG_TEAM_ALLIANCE = 0,
BG_TEAM_HORDE = 1
};
#define BG_TEAMS_COUNT 2
#include "BattlegroundMap.h"
struct BattlegroundTemplate
{

View File

@@ -427,7 +427,7 @@ void BattlegroundAB::_NodeDeOccupied(uint8 node)
DeleteCreature(node+7);//NULL checks are in DeleteCreature! 0-6 spirit guides
// Those who are waiting to resurrect at this node are taken to the closest own node's graveyard
std::vector<uint64> ghost_list = m_ReviveQueue[m_BgCreatures[node]];
std::vector<uint64> ghost_list = ReviveQueue[m_BgCreatures[node]];
if (!ghost_list.empty())
{
WorldSafeLocsEntry const *ClosestGrave = NULL;

View File

@@ -36,26 +36,26 @@ void BattlegroundAV::InstallBattleground()
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i) //forloop for both teams (it just make 0 == alliance and 1 == horde also for both mines 0=north 1=south
{
for (uint8 j = 0; j < 9; ++j)
m_Team_QuestStatus[i][j] = 0;
_teamQuestStatus[i][j] = 0;
TeamScores[i] = BG_AV_SCORE_INITIAL_POINTS;
_isInformedNearVictory[i] = false;
_captainAlive[i] = true;
_captainBuffTimer[i] = 120000 + urand(0, 4) * MINUTE; //as far as i could see, the buff is randomly so i make 2minutes (thats the duration of the buff itself) + 0-4minutes TODO get the right times
_mineOwner[i] = AV_NEUTRAL_TEAM;
_mineOwner[i] = BG_TEAMS_COUNT;
_minePreviousOwner[i] = _mineOwner[i];
}
for (AVNodeId i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_STONEHEART_GRAVE; ++i) //alliance graves
InitNode(i, ALLIANCE, false);
InitNode(i, BG_TEAM_ALLIANCE, false);
for (AVNodeId i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) //alliance towers
InitNode(i, ALLIANCE, true);
InitNode(i, BG_TEAM_ALLIANCE, true);
for (AVNodeId i = BG_AV_NODES_ICEBLOOD_GRAVE; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i) //horde graves
InitNode(i, HORDE, false);
InitNode(i, BG_TEAM_HORDE, false);
for (AVNodeId i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) //horde towers
InitNode(i, HORDE, true);
InitNode(i, BG_TEAM_HORDE, true);
InitNode(BG_AV_NODES_SNOWFALL_GRAVE, AV_NEUTRAL_TEAM, false); //give snowfall neutral owner
InitNode(BG_AV_NODES_SNOWFALL_GRAVE, BG_TEAMS_COUNT, false); //give snowfall neutral owner
_mineTimer = AV_MINE_TICK_TIMER;
}
@@ -198,8 +198,8 @@ void BattlegroundAV::InitializeObjects()
AddAVCreature(0, i+AV_CPLACE_MAX);
//mainspiritguides:
AddSpiritGuide(7, BG_AV_CreaturePos[7][0], BG_AV_CreaturePos[7][1], BG_AV_CreaturePos[7][2], BG_AV_CreaturePos[7][3], ALLIANCE);
AddSpiritGuide(8, BG_AV_CreaturePos[8][0], BG_AV_CreaturePos[8][1], BG_AV_CreaturePos[8][2], BG_AV_CreaturePos[8][3], HORDE);
AddSpiritGuide(7, BG_AV_CreaturePos[7][0], BG_AV_CreaturePos[7][1], BG_AV_CreaturePos[7][2], BG_AV_CreaturePos[7][3], BG_TEAM_ALLIANCE);
AddSpiritGuide(8, BG_AV_CreaturePos[8][0], BG_AV_CreaturePos[8][1], BG_AV_CreaturePos[8][2], BG_AV_CreaturePos[8][3], BG_TEAM_HORDE);
//spawn the marshals (those who get deleted, if a tower gets destroyed)
for (i=AV_NPC_A_MARSHAL_SOUTH; i <= AV_NPC_H_MARSHAL_WTOWER; i++)
@@ -217,7 +217,7 @@ void BattlegroundAV::StartBattleground()
for (uint16 i= BG_AV_OBJECT_MINE_SUPPLY_S_MIN; i <= BG_AV_OBJECT_MINE_SUPPLY_S_MAX; i++)
SpawnGameObject(i, RESPAWN_IMMEDIATELY);
for (uint8 mine = AV_NORTH_MINE; mine <= AV_SOUTH_MINE; mine++) //mine population
ChangeMineOwner(mine, AV_NEUTRAL_TEAM, true);
ChangeMineOwner(mine, BG_TEAMS_COUNT, true);
UpdateWorldState(AV_SHOW_H_SCORE, 1);
UpdateWorldState(AV_SHOW_A_SCORE, 1);
@@ -299,8 +299,8 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer)
*/
if (entry == BG_AV_CreatureInfo[AV_NPC_A_BOSS][0])
{
CastSpellOnTeam(23658, HORDE); //this is a spell which finishes a quest where a player has to kill the boss
RewardReputationToTeam(729, BG_AV_REP_BOSS, HORDE);
CastSpellOnTeam(23658, BG_TEAM_HORDE); //this is a spell which finishes a quest where a player has to kill the boss
RewardReputationToTeam(729, BG_AV_REP_BOSS, BG_TEAM_HORDE);
RewardHonorToTeam(GetBonusHonor(BG_AV_KILL_BOSS), BG_TEAM_HORDE);
EndBattleground(WINNER_HORDE);
DeleteCreature(AV_CPLACE_TRIGGER17);
@@ -308,7 +308,7 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer)
else if (entry == BG_AV_CreatureInfo[AV_NPC_H_BOSS][0])
{
CastSpellOnTeam(23658, BG_TEAM_ALLIANCE); //this is a spell which finishes a quest where a player has to kill the boss
RewardReputationToTeam(730, BG_AV_REP_BOSS, ALLIANCE);
RewardReputationToTeam(730, BG_AV_REP_BOSS, BG_TEAM_ALLIANCE);
RewardHonorToTeam(GetBonusHonor(BG_AV_KILL_BOSS), BG_TEAM_ALLIANCE);
EndBattleground(WINNER_ALLIANCE);
DeleteCreature(AV_CPLACE_TRIGGER19);
@@ -362,17 +362,18 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;//maybe we should log this, cause this must be a cheater or a big bug
uint8 team = GetTeamIndexByTeamId(player->GetTeam());
uint8 team = player->GetBGTeam();
//TODO add reputation, events (including quest not available anymore, next quest availabe, go/npc de/spawning)and maybe honor
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed", questid);
switch(questid)
switch (questid)
{
case AV_QUEST_A_SCRAPS1:
case AV_QUEST_A_SCRAPS2:
case AV_QUEST_H_SCRAPS1:
case AV_QUEST_H_SCRAPS2:
m_Team_QuestStatus[team][0]+=20;
if (m_Team_QuestStatus[team][0] == 500 || m_Team_QuestStatus[team][0] == 1000 || m_Team_QuestStatus[team][0] == 1500) //25, 50, 75 turn ins
_teamQuestStatus[team][0]+=20;
if (_teamQuestStatus[team][0] == 500 || _teamQuestStatus[team][0] == 1000 || _teamQuestStatus[team][0] == 1500) //25, 50, 75 turn ins
{
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed starting with unit upgrading..", questid);
for (AVNodeId i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i)
@@ -386,71 +387,71 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
break;
case AV_QUEST_A_COMMANDER1:
case AV_QUEST_H_COMMANDER1:
m_Team_QuestStatus[team][1]++;
_teamQuestStatus[team][1]++;
RewardReputationToTeam(team, 1, BattlegroundTeamId(player->GetBGTeam()));
if (m_Team_QuestStatus[team][1] == 30)
if (_teamQuestStatus[team][1] == 30)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid);
break;
case AV_QUEST_A_COMMANDER2:
case AV_QUEST_H_COMMANDER2:
m_Team_QuestStatus[team][2]++;
_teamQuestStatus[team][2]++;
RewardReputationToTeam(team, 1, BattlegroundTeamId(player->GetBGTeam()));
if (m_Team_QuestStatus[team][2] == 60)
if (_teamQuestStatus[team][2] == 60)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid);
break;
case AV_QUEST_A_COMMANDER3:
case AV_QUEST_H_COMMANDER3:
m_Team_QuestStatus[team][3]++;
_teamQuestStatus[team][3]++;
RewardReputationToTeam(team, 1, BattlegroundTeamId(player->GetBGTeam()));
if (m_Team_QuestStatus[team][1] == 120)
if (_teamQuestStatus[team][1] == 120)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid);
break;
case AV_QUEST_A_BOSS1:
case AV_QUEST_H_BOSS1:
m_Team_QuestStatus[team][4] += 9; //you can turn in 10 or 1 item..
_teamQuestStatus[team][4] += 9; //you can turn in 10 or 1 item..
case AV_QUEST_A_BOSS2:
case AV_QUEST_H_BOSS2:
m_Team_QuestStatus[team][4]++;
if (m_Team_QuestStatus[team][4] >= 200)
_teamQuestStatus[team][4]++;
if (_teamQuestStatus[team][4] >= 200)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid);
break;
case AV_QUEST_A_NEAR_MINE:
case AV_QUEST_H_NEAR_MINE:
m_Team_QuestStatus[team][5]++;
if (m_Team_QuestStatus[team][5] == 28)
_teamQuestStatus[team][5]++;
if (_teamQuestStatus[team][5] == 28)
{
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid);
if (m_Team_QuestStatus[team][6] == 7)
if (_teamQuestStatus[team][6] == 7)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here - ground assault ready", questid);
}
break;
case AV_QUEST_A_OTHER_MINE:
case AV_QUEST_H_OTHER_MINE:
m_Team_QuestStatus[team][6]++;
if (m_Team_QuestStatus[team][6] == 7)
_teamQuestStatus[team][6]++;
if (_teamQuestStatus[team][6] == 7)
{
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid);
if (m_Team_QuestStatus[team][5] == 20)
if (_teamQuestStatus[team][5] == 20)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here - ground assault ready", questid);
}
break;
case AV_QUEST_A_RIDER_HIDE:
case AV_QUEST_H_RIDER_HIDE:
m_Team_QuestStatus[team][7]++;
if (m_Team_QuestStatus[team][7] == 25)
_teamQuestStatus[team][7]++;
if (_teamQuestStatus[team][7] == 25)
{
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid);
if (m_Team_QuestStatus[team][8] == 25)
if (_teamQuestStatus[team][8] == 25)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here - rider assault ready", questid);
}
break;
case AV_QUEST_A_RIDER_TAME:
case AV_QUEST_H_RIDER_TAME:
m_Team_QuestStatus[team][8]++;
if (m_Team_QuestStatus[team][8] == 25)
_teamQuestStatus[team][8]++;
if (_teamQuestStatus[team][8] == 25)
{
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid);
if (m_Team_QuestStatus[team][7] == 25)
if (_teamQuestStatus[team][7] == 25)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here - rider assault ready", questid);
}
break;
@@ -476,7 +477,7 @@ void BattlegroundAV::UpdateScore(uint16 team, int16 points)
}
else if (!_isInformedNearVictory[team] && TeamScores[team] < SEND_MSG_NEAR_LOSE)
{
SendMessageToAll(teamindex == BG_TEAM_HORDE?LANG_BG_AV_H_NEAR_LOSE:LANG_BG_AV_A_NEAR_LOSE, team == BG_TEAM_HORDE ? CHAT_MSG_BG_SYSTEM_HORDE : CHAT_MSG_BG_SYSTEM_ALLIANCE);
SendMessageToAll(team == BG_TEAM_HORDE?LANG_BG_AV_H_NEAR_LOSE:LANG_BG_AV_A_NEAR_LOSE, team == BG_TEAM_HORDE ? CHAT_MSG_BG_SYSTEM_HORDE : CHAT_MSG_BG_SYSTEM_ALLIANCE);
PlaySoundToAll(AV_SOUND_NEAR_VICTORY);
_isInformedNearVictory[team] = true;
}
@@ -563,66 +564,63 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type)
return creature;
}
void BattlegroundAV::Update(uint32 diff)
void BattlegroundAV::ProcessInProgress(uint32 const& diff)
{
Battleground::Update(diff);
BattlegroundMap::ProcessInProgress(diff);
if (GetStatus() == STATUS_IN_PROGRESS)
for (uint8 i=0; i <= 1; i++)//0=alliance, 1=horde
{
for (uint8 i=0; i <= 1; i++)//0=alliance, 1=horde
if (!_captainAlive[i])
continue;
if (_captainBuffTimer[i] > diff)
_captainBuffTimer[i] -= diff;
else
{
if (!_captainAlive[i])
continue;
if (_captainBuffTimer[i] > diff)
_captainBuffTimer[i] -= diff;
if (i == 0)
{
CastSpellOnTeam(AV_BUFF_A_CAPTAIN, BG_TEAM_ALLIANCE);
Creature* creature = GetCreature(AV_CPLACE_MAX + 61);
if (creature)
SendMessageToAll(LANG_BG_AV_A_CAPTAIN_BUFF, CHAT_MSG_MONSTER_YELL, creature, LANG_COMMON);
}
else
{
if (i == 0)
{
CastSpellOnTeam(AV_BUFF_A_CAPTAIN, ALLIANCE);
Creature* creature = GetCreature(AV_CPLACE_MAX + 61);
if (creature)
SendMessageToAll(LANG_BG_AV_A_CAPTAIN_BUFF, CHAT_MSG_MONSTER_YELL, creature, LANG_COMMON);
}
else
{
CastSpellOnTeam(AV_BUFF_H_CAPTAIN, HORDE);
Creature* creature = GetCreature(AV_CPLACE_MAX + 59); //TODO: make the captains a dynamic creature
if (creature)
SendMessageToAll(LANG_BG_AV_H_CAPTAIN_BUFF, CHAT_MSG_MONSTER_YELL, creature, LANG_ORCISH);
}
_captainBuffTimer[i] = 120000 + urand(0, 4)* 60000; //as far as i could see, the buff is randomly so i make 2minutes (thats the duration of the buff itself) + 0-4minutes TODO get the right times
CastSpellOnTeam(AV_BUFF_H_CAPTAIN, BG_TEAM_HORDE);
Creature* creature = GetCreature(AV_CPLACE_MAX + 59); //TODO: make the captains a dynamic creature
if (creature)
SendMessageToAll(LANG_BG_AV_H_CAPTAIN_BUFF, CHAT_MSG_MONSTER_YELL, creature, LANG_ORCISH);
}
_captainBuffTimer[i] = 120000 + urand(0, 4)* 60000; //as far as i could see, the buff is randomly so i make 2minutes (thats the duration of the buff itself) + 0-4minutes TODO get the right times
}
//add points from mine owning, and look if he neutral team wanrts to reclaim the mine
_mineTimer -=diff;
for (uint8 mine=0; mine <2; mine++)
{
if (_mineOwner[mine] == ALLIANCE || _mineOwner[mine] == HORDE)
{
if (_mineTimer <= 0)
UpdateScore(_mineOwner[mine], 1);
if (_mineReclaimTimer[mine] > diff)
_mineReclaimTimer[mine] -= diff;
else{ //we don't need to set this timer to 0 cause this codepart wont get called when this thing is 0
ChangeMineOwner(mine, AV_NEUTRAL_TEAM);
}
}
}
if (_mineTimer <= 0)
_mineTimer=AV_MINE_TICK_TIMER; //this is at the end, cause we need to update both mines
//looks for all timers of the nodes and destroy the building (for graveyards the building wont get destroyed, it goes just to the other team
for (AVNodeId i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
if (m_Nodes[i].State == POINT_ASSAULTED) //maybe remove this
{
if (m_Nodes[i].Timer > diff)
m_Nodes[i].Timer -= diff;
else
EventPlayerDestroyedPoint(i);
}
}
//add points from mine owning, and look if he neutral team wanrts to reclaim the mine
_mineTimer -=diff;
for (uint8 mine=0; mine <2; mine++)
{
if (_mineOwner[mine] == BG_TEAM_ALLIANCE || _mineOwner[mine] == BG_TEAM_HORDE)
{
if (_mineTimer <= 0)
UpdateScore(_mineOwner[mine], 1);
if (_mineReclaimTimer[mine] > diff)
_mineReclaimTimer[mine] -= diff;
else{ //we don't need to set this timer to 0 cause this codepart wont get called when this thing is 0
ChangeMineOwner(mine, BG_TEAMS_COUNT);
}
}
}
if (_mineTimer <= 0)
_mineTimer=AV_MINE_TICK_TIMER; //this is at the end, cause we need to update both mines
//looks for all timers of the nodes and destroy the building (for graveyards the building wont get destroyed, it goes just to the other team
for (AVNodeId i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
if (m_Nodes[i].State == POINT_ASSAULTED) //maybe remove this
{
if (m_Nodes[i].Timer > diff)
m_Nodes[i].Timer -= diff;
else
EventPlayerDestroyedPoint(i);
}
}
void BattlegroundAV::OnPlayerJoin(Player *plr)
@@ -661,13 +659,13 @@ void BattlegroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger)
{
case 95:
case 2608:
if (Source->GetTeam() != ALLIANCE)
if (Source->GetTeam() != BG_TEAM_ALLIANCE)
Source->GetSession()->SendAreaTriggerMessage("Only The Alliance can use that portal");
else
Source->LeaveBattleground();
break;
case 2606:
if (Source->GetTeam() != HORDE)
if (Source->GetTeam() != BG_TEAM_HORDE)
Source->GetSession()->SendAreaTriggerMessage("Only The Horde can use that portal");
else
Source->LeaveBattleground();
@@ -739,46 +737,45 @@ void BattlegroundAV::EventPlayerDestroyedPoint(AVNodeId node)
if (IsTower(node))
{
uint8 tmp = node-BG_AV_NODES_DUNBALDAR_SOUTH;
//despawn marshal
if (m_BgCreatures[AV_CPLACE_A_MARSHAL_SOUTH + tmp])
DeleteCreature(AV_CPLACE_A_MARSHAL_SOUTH + tmp);
else
sLog->outError("BG_AV: playerdestroyedpoint: marshal %i doesn't exist", AV_CPLACE_A_MARSHAL_SOUTH + tmp);
DeleteCreature(AV_CPLACE_A_MARSHAL_SOUTH + tmp);
//spawn destroyed aura
for (uint8 i=0; i <= 9; i++)
SpawnGameObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH + i + (tmp * 10), RESPAWN_IMMEDIATELY);
UpdateScore((owner == ALLIANCE) ? HORDE : ALLIANCE, (-1)*BG_AV_RES_TOWER);
RewardReputationToTeam((owner == ALLIANCE)?730:729, BG_AV_REP_TOWER, owner);
RewardHonorToTeam(GetBonusHonor(BG_AV_KILL_TOWER), owner);
UpdateScore((owner == BG_TEAM_ALLIANCE) ? BG_TEAM_HORDE : BG_TEAM_ALLIANCE, (-1)*BG_AV_RES_TOWER);
RewardReputationToTeam((owner == BG_TEAM_ALLIANCE)?730:729, BG_AV_REP_TOWER, BattlegroundTeamId(owner));
RewardHonorToTeam(GetBonusHonor(BG_AV_KILL_TOWER), BattlegroundTeamId(owner));
SpawnGameObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+GetTeamIndexByTeamId(owner)+(2*tmp), RESPAWN_ONE_DAY);
SpawnGameObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+GetTeamIndexByTeamId(owner)+(2*tmp), RESPAWN_ONE_DAY);
SpawnGameObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+ owner+(2*tmp), RESPAWN_ONE_DAY);
SpawnGameObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+ owner+(2*tmp), RESPAWN_ONE_DAY);
}
else
{
if (owner == ALLIANCE)
if (owner == BG_TEAM_ALLIANCE)
SpawnGameObject(object-11, RESPAWN_IMMEDIATELY);
else
SpawnGameObject(object+11, RESPAWN_IMMEDIATELY);
SpawnGameObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node, RESPAWN_ONE_DAY);
SpawnGameObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+GetTeamIndexByTeamId(owner)+3*node, RESPAWN_IMMEDIATELY);
SpawnGameObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+owner+3*node, RESPAWN_IMMEDIATELY);
PopulateNode(node);
if (node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall eyecandy
{
for (uint8 i = 0; i < 4; i++)
{
SpawnGameObject(((owner == ALLIANCE)?BG_AV_OBJECT_SNOW_EYECANDY_PA : BG_AV_OBJECT_SNOW_EYECANDY_PH)+i, RESPAWN_ONE_DAY);
SpawnGameObject(((owner == ALLIANCE)?BG_AV_OBJECT_SNOW_EYECANDY_A : BG_AV_OBJECT_SNOW_EYECANDY_H)+i, RESPAWN_IMMEDIATELY);
SpawnGameObject(((owner == BG_TEAM_ALLIANCE)?BG_AV_OBJECT_SNOW_EYECANDY_PA : BG_AV_OBJECT_SNOW_EYECANDY_PH)+i, RESPAWN_ONE_DAY);
SpawnGameObject(((owner == BG_TEAM_ALLIANCE)?BG_AV_OBJECT_SNOW_EYECANDY_A : BG_AV_OBJECT_SNOW_EYECANDY_H)+i, RESPAWN_IMMEDIATELY);
}
}
}
//send a nice message to all :)
char buf[256];
if (IsTower(node))
sprintf(buf, sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_TOWER_TAKEN), GetNodeName(node), (owner == ALLIANCE) ? sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_ALLY) : sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_HORDE));
sprintf(buf, sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_TOWER_TAKEN), GetNodeName(node), (owner == BG_TEAM_ALLIANCE) ? sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_ALLY) : sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_HORDE));
else
sprintf(buf, sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_GRAVE_TAKEN), GetNodeName(node), (owner == ALLIANCE) ? sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_ALLY) : sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_HORDE));
sprintf(buf, sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_GRAVE_TAKEN), GetNodeName(node), (owner == BG_TEAM_ALLIANCE) ? sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_ALLY) : sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_HORDE));
Creature* creature = GetCreature(AV_CPLACE_HERALD);
if (creature)
@@ -789,10 +786,10 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
{ //mine=0 northmine mine=1 southmin
//changing the owner results in setting respawntim to infinite for current creatures, spawning new mine owners creatures and changing the chest-objects so that the current owning team can use them
ASSERT(mine == AV_NORTH_MINE || mine == AV_SOUTH_MINE);
if (team != ALLIANCE && team != HORDE)
team = AV_NEUTRAL_TEAM;
if (team != BG_TEAM_ALLIANCE && team != BG_TEAM_HORDE)
team = BG_TEAMS_COUNT;
else
PlaySoundToAll((team == ALLIANCE)?AV_SOUND_ALLIANCE_GOOD:AV_SOUND_HORDE_GOOD);
PlaySoundToAll((team == BG_TEAM_ALLIANCE)?AV_SOUND_ALLIANCE_GOOD:AV_SOUND_HORDE_GOOD);
if (_mineOwner[mine] == team && !initial)
return;
@@ -816,9 +813,9 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
//also neutral team exists.. after a big time, the neutral team tries to conquer the mine
if (mine == AV_NORTH_MINE)
{
if (team == ALLIANCE)
if (team == BG_TEAM_ALLIANCE)
miner = AV_NPC_N_MINE_A_1;
else if (team == HORDE)
else if (team == BG_TEAM_HORDE)
miner = AV_NPC_N_MINE_H_1;
else
miner = AV_NPC_N_MINE_N_1;
@@ -826,17 +823,17 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
else
{
uint16 cinfo;
if (team == ALLIANCE)
if (team == BG_TEAM_ALLIANCE)
miner = AV_NPC_S_MINE_A_1;
else if (team == HORDE)
else if (team == BG_TEAM_HORDE)
miner = AV_NPC_S_MINE_H_1;
else
miner = AV_NPC_S_MINE_N_1;
//vermin
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "spawning vermin");
if (team == ALLIANCE)
if (team == BG_TEAM_ALLIANCE)
cinfo = AV_NPC_S_MINE_A_3;
else if (team == HORDE)
else if (team == BG_TEAM_HORDE)
cinfo = AV_NPC_S_MINE_H_3;
else
cinfo = AV_NPC_S_MINE_N_S;
@@ -854,11 +851,11 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
// {
//TODO: add gameobject-update code
// }
if (team == ALLIANCE || team == HORDE)
if (team == BG_TEAM_ALLIANCE || team == BG_TEAM_HORDE)
{
_mineReclaimTimer[mine]=AV_MINE_RECLAIM_TIMER;
char buf[256];
sprintf(buf, sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_MINE_TAKEN), sObjectMgr->GetTrinityStringForDBCLocale((mine == AV_NORTH_MINE) ? LANG_BG_AV_MINE_NORTH : LANG_BG_AV_MINE_SOUTH), (team == ALLIANCE) ? sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_ALLY) : sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_HORDE));
sprintf(buf, sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_MINE_TAKEN), sObjectMgr->GetTrinityStringForDBCLocale((mine == AV_NORTH_MINE) ? LANG_BG_AV_MINE_NORTH : LANG_BG_AV_MINE_SOUTH), (team == BG_TEAM_ALLIANCE) ? sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_ALLY) : sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_HORDE));
Creature* creature = GetCreature(AV_CPLACE_HERALD);
if (creature)
SendMessageToAll(buf, CHAT_MSG_MONSTER_YELL, creature);
@@ -886,29 +883,27 @@ bool BattlegroundAV::PlayerCanDoMineQuest(int32 GOId, uint32 team)
void BattlegroundAV::PopulateNode(AVNodeId node)
{
uint32 owner = m_Nodes[node].Owner;
ASSERT(owner);
ASSERT(owner == BG_TEAM_ALLIANCE || owner == BG_TEAM_HORDE);
uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + (4 * node);
uint32 creatureid;
if (IsTower(node))
creatureid=(owner == ALLIANCE)?AV_NPC_A_TOWERDEFENSE:AV_NPC_H_TOWERDEFENSE;
creatureid=(owner == BG_TEAM_ALLIANCE)?AV_NPC_A_TOWERDEFENSE:AV_NPC_H_TOWERDEFENSE;
else
{
uint8 team2 = GetTeamIndexByTeamId(owner);
if (m_Team_QuestStatus[team2][0] < 500)
creatureid = (owner == ALLIANCE)? AV_NPC_A_GRAVEDEFENSE0 : AV_NPC_H_GRAVEDEFENSE0;
else if (m_Team_QuestStatus[team2][0] < 1000)
creatureid = (owner == ALLIANCE)? AV_NPC_A_GRAVEDEFENSE1 : AV_NPC_H_GRAVEDEFENSE1;
else if (m_Team_QuestStatus[team2][0] < 1500)
creatureid = (owner == ALLIANCE)? AV_NPC_A_GRAVEDEFENSE2 : AV_NPC_H_GRAVEDEFENSE2;
if (_teamQuestStatus[owner][0] < 500)
creatureid = (owner == BG_TEAM_ALLIANCE) ? AV_NPC_A_GRAVEDEFENSE0 : AV_NPC_H_GRAVEDEFENSE0;
else if (_teamQuestStatus[owner][0] < 1000)
creatureid = (owner == BG_TEAM_ALLIANCE) ? AV_NPC_A_GRAVEDEFENSE1 : AV_NPC_H_GRAVEDEFENSE1;
else if (_teamQuestStatus[owner][0] < 1500)
creatureid = (owner == BG_TEAM_ALLIANCE) ? AV_NPC_A_GRAVEDEFENSE2 : AV_NPC_H_GRAVEDEFENSE2;
else
creatureid = (owner == ALLIANCE)? AV_NPC_A_GRAVEDEFENSE3 : AV_NPC_H_GRAVEDEFENSE3;
creatureid = (owner == BG_TEAM_ALLIANCE) ? AV_NPC_A_GRAVEDEFENSE3 : AV_NPC_H_GRAVEDEFENSE3;
//spiritguide
if (m_BgCreatures[node])
DeleteCreature(node);
if (!AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], owner))
sLog->outError("AV: couldn't spawn spiritguide at node %i", node);
DeleteCreature(node);
AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], owner);
}
for (uint8 i=0; i<4; i++)
AddAVCreature(creatureid, c_place+i);
@@ -924,12 +919,12 @@ void BattlegroundAV::PopulateNode(AVNodeId node)
//aura should only apply to players who have accupied the node, set correct faction for trigger
if (trigger)
{
if (owner != ALLIANCE && owner != HORDE)//node can be neutral, remove trigger
if (owner != BG_TEAM_ALLIANCE && owner != BG_TEAM_HORDE)//node can be neutral, remove trigger
{
DeleteCreature(node + 302);
return;
}
trigger->setFaction(owner == ALLIANCE ? 84 : 83);
trigger->setFaction(owner == BG_TEAM_ALLIANCE ? 84 : 83);
trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false);
}
}
@@ -937,10 +932,10 @@ void BattlegroundAV::DePopulateNode(AVNodeId node)
{
uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + (4 * node);
for (uint8 i=0; i<4; i++)
if (m_BgCreatures[c_place+i])
DeleteCreature(c_place+i);
//spiritguide
if (!IsTower(node) && m_BgCreatures[node])
if (!IsTower(node))
DeleteCreature(node);
//remove bonus honor aura trigger creature when node is lost
@@ -973,7 +968,7 @@ AVNodeId BattlegroundAV::GetNodeThroughObject(uint32 object)
uint32 BattlegroundAV::GetObjectThroughNode(AVNodeId node)
{ //this function is the counterpart to GetNodeThroughObject()
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "bg_AV GetObjectThroughNode %i", node);
if (m_Nodes[node].Owner == ALLIANCE)
if (m_Nodes[node].Owner == BG_TEAM_ALLIANCE)
{
if (m_Nodes[node].State == POINT_ASSAULTED)
{
@@ -986,7 +981,7 @@ uint32 BattlegroundAV::GetObjectThroughNode(AVNodeId node)
if (node <= BG_AV_NODES_STONEHEART_BUNKER)
return node;
}
else if (m_Nodes[node].Owner == HORDE)
else if (m_Nodes[node].Owner == BG_TEAM_HORDE)
{
if (m_Nodes[node].State == POINT_ASSAULTED)
{
@@ -1001,7 +996,7 @@ uint32 BattlegroundAV::GetObjectThroughNode(AVNodeId node)
return node+29;
}
}
else if (m_Nodes[node].Owner == AV_NEUTRAL_TEAM)
else if (m_Nodes[node].Owner == BG_TEAMS_COUNT)
return BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE;
sLog->outError("BattlegroundAV: Error! GetPlaceNode couldn't resolve node %i", node);
ASSERT(false);
@@ -1018,7 +1013,7 @@ void BattlegroundAV::EventPlayerClickedOnFlag(Player *source, GameObject* target
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV using gameobject %i with type %i", target_obj->GetEntry(), object);
if (object < 0)
return;
switch(target_obj->GetEntry())
switch (target_obj->GetEntry())
{
case BG_AV_OBJECTID_BANNER_A:
case BG_AV_OBJECTID_BANNER_A_B:
@@ -1043,12 +1038,13 @@ void BattlegroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
ASSERT(GetStatus() == STATUS_IN_PROGRESS);
AVNodeId node = GetNodeThroughObject(object);
uint32 owner = m_Nodes[node].Owner; //maybe should name it prevowner
uint32 team = player->GetTeam();
BattlegroundTeamId owner = m_Nodes[node].Owner; //maybe should name it prevowner
BattlegroundTeamId team = BattlegroundTeamId(player->GetBGTeam());
if (owner == player->GetTeam() || m_Nodes[node].State != POINT_ASSAULTED)
if (owner == team || m_Nodes[node].State != POINT_ASSAULTED)
return;
if (m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM)
if (m_Nodes[node].TotalOwner == BG_TEAMS_COUNT) // Neutral
{ //until snowfall doesn't belong to anyone it is better handled in assault-code
ASSERT(node == BG_AV_NODES_SNOWFALL_GRAVE); //currently the only neutral grave
EventPlayerAssaultsPoint(player, object);
@@ -1062,7 +1058,7 @@ void BattlegroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
}
//spawn new go :)
if (m_Nodes[node].Owner == ALLIANCE)
if (m_Nodes[node].Owner == BG_TEAM_ALLIANCE)
SpawnGameObject(object+22, RESPAWN_IMMEDIATELY); //spawn horde banner
else
SpawnGameObject(object-22, RESPAWN_IMMEDIATELY); //spawn alliance banner
@@ -1070,7 +1066,7 @@ void BattlegroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
if (!IsTower(node))
{
SpawnGameObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node, RESPAWN_ONE_DAY);
SpawnGameObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+GetTeamIndexByTeamId(team)+3*node, RESPAWN_IMMEDIATELY);
SpawnGameObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+team+3*node, RESPAWN_IMMEDIATELY);
}
// despawn old go
SpawnGameObject(object, RESPAWN_ONE_DAY);
@@ -1082,22 +1078,22 @@ void BattlegroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
if (IsTower(node))
{
//spawn big flag+aura on top of tower
SpawnGameObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)), (team == ALLIANCE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
SpawnGameObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)), (team == HORDE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
SpawnGameObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)), (team == ALLIANCE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
SpawnGameObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)), (team == HORDE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
SpawnGameObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)), (team == BG_TEAM_ALLIANCE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
SpawnGameObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)), (team == BG_TEAM_HORDE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
SpawnGameObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)), (team == BG_TEAM_ALLIANCE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
SpawnGameObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)), (team == BG_TEAM_HORDE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
}
else if (node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall eyecandy
{
for (uint8 i = 0; i < 4; i++)
{
SpawnGameObject(((owner == ALLIANCE)?BG_AV_OBJECT_SNOW_EYECANDY_PA : BG_AV_OBJECT_SNOW_EYECANDY_PH)+i, RESPAWN_ONE_DAY);
SpawnGameObject(((team == ALLIANCE)?BG_AV_OBJECT_SNOW_EYECANDY_A : BG_AV_OBJECT_SNOW_EYECANDY_H)+i, RESPAWN_IMMEDIATELY);
SpawnGameObject(((owner == BG_TEAM_ALLIANCE)?BG_AV_OBJECT_SNOW_EYECANDY_PA : BG_AV_OBJECT_SNOW_EYECANDY_PH)+i, RESPAWN_ONE_DAY);
SpawnGameObject(((team == BG_TEAM_ALLIANCE)?BG_AV_OBJECT_SNOW_EYECANDY_A : BG_AV_OBJECT_SNOW_EYECANDY_H)+i, RESPAWN_IMMEDIATELY);
}
}
//send a nice message to all :)
char buf[256];
sprintf(buf, sObjectMgr->GetTrinityStringForDBCLocale((IsTower(node)) ? LANG_BG_AV_TOWER_DEFENDED : LANG_BG_AV_GRAVE_DEFENDED), GetNodeName(node), (team == ALLIANCE) ? sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_ALLY) : sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_HORDE));
sprintf(buf, sObjectMgr->GetTrinityStringForDBCLocale((IsTower(node)) ? LANG_BG_AV_TOWER_DEFENDED : LANG_BG_AV_GRAVE_DEFENDED), GetNodeName(node), (team == BG_TEAM_ALLIANCE) ? sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_ALLY) : sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_HORDE));
Creature* creature = GetCreature(AV_CPLACE_HERALD);
if (creature)
SendMessageToAll(buf, CHAT_MSG_MONSTER_YELL, creature);
@@ -1106,7 +1102,7 @@ void BattlegroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
if (IsTower(node))
PlaySoundToAll(AV_SOUND_BOTH_TOWER_DEFEND);
else
PlaySoundToAll((team == ALLIANCE)?AV_SOUND_ALLIANCE_GOOD:AV_SOUND_HORDE_GOOD);
PlaySoundToAll((team == BG_TEAM_ALLIANCE)?AV_SOUND_ALLIANCE_GOOD:AV_SOUND_HORDE_GOOD);
}
void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
@@ -1114,8 +1110,8 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
ASSERT(GetStatus() == STATUS_IN_PROGRESS);
AVNodeId node = GetNodeThroughObject(object);
uint32 owner = m_Nodes[node].Owner; //maybe name it prevowner
uint32 team = player->GetTeam();
BattlegroundTeamId owner = m_Nodes[node].Owner; //maybe name it prevowner
BattlegroundTeamId team = BattlegroundTeamId(player->GetBGTeam());
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "bg_av: player assaults point object %i node %i", object, node);
if (owner == team || team == m_Nodes[node].TotalOwner)
return; //surely a gm used this object
@@ -1124,24 +1120,24 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
{
if (object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE) //initial capping
{
ASSERT(owner == AV_NEUTRAL_TEAM && m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM);
if (team == ALLIANCE)
ASSERT(owner == BG_TEAMS_COUNT && m_Nodes[node].TotalOwner == BG_TEAMS_COUNT);
if (team == BG_TEAM_ALLIANCE)
SpawnGameObject(BG_AV_OBJECT_FLAG_C_A_SNOWFALL_GRAVE, RESPAWN_IMMEDIATELY);
else
SpawnGameObject(BG_AV_OBJECT_FLAG_C_H_SNOWFALL_GRAVE, RESPAWN_IMMEDIATELY);
SpawnGameObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node, RESPAWN_IMMEDIATELY); //neutral aura spawn
}
else if (m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM) //recapping, when no team owns this node realy
else if (m_Nodes[node].TotalOwner == BG_TEAMS_COUNT) //recapping, when no team owns this node realy
{
ASSERT(m_Nodes[node].State != POINT_CONTROLED);
if (team == ALLIANCE)
if (team == BG_TEAM_ALLIANCE)
SpawnGameObject(object-11, RESPAWN_IMMEDIATELY);
else
SpawnGameObject(object+11, RESPAWN_IMMEDIATELY);
}
//eyecandy
uint32 spawn, despawn;
if (team == ALLIANCE)
if (team == BG_TEAM_ALLIANCE)
{
despawn = (m_Nodes[node].State == POINT_ASSAULTED)?BG_AV_OBJECT_SNOW_EYECANDY_PH : BG_AV_OBJECT_SNOW_EYECANDY_H;
spawn = BG_AV_OBJECT_SNOW_EYECANDY_PA;
@@ -1159,19 +1155,19 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
}
//if snowfall gots capped it can be handled like all other graveyards
if (m_Nodes[node].TotalOwner != AV_NEUTRAL_TEAM)
if (m_Nodes[node].TotalOwner != BG_TEAMS_COUNT)
{
ASSERT(m_Nodes[node].Owner != AV_NEUTRAL_TEAM);
if (team == ALLIANCE)
ASSERT(m_Nodes[node].Owner != BG_TEAMS_COUNT);
if (team == BG_TEAM_ALLIANCE)
SpawnGameObject(object-22, RESPAWN_IMMEDIATELY);
else
SpawnGameObject(object+22, RESPAWN_IMMEDIATELY);
if (IsTower(node))
{ //spawning/despawning of bigflag+aura
SpawnGameObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)), (team == ALLIANCE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
SpawnGameObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)), (team == HORDE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
SpawnGameObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)), (team == ALLIANCE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
SpawnGameObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)), (team == HORDE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
SpawnGameObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)), (team == BG_TEAM_ALLIANCE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
SpawnGameObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)), (team == BG_TEAM_HORDE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
SpawnGameObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)), (team == BG_TEAM_ALLIANCE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
SpawnGameObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)), (team == BG_TEAM_HORDE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
}
else
{
@@ -1179,7 +1175,7 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
SpawnGameObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node, RESPAWN_IMMEDIATELY); //neutral aura spawn
SpawnGameObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+owner+3*node, RESPAWN_ONE_DAY); //teeamaura despawn
// Those who are waiting to resurrect at this object are taken to the closest own object's graveyard
std::vector<uint64> ghost_list = m_ReviveQueue[m_BgCreatures[node]];
std::vector<uint64> ghost_list = ReviveQueue[ObjectGUIDsByType[node]];
if (!ghost_list.empty())
{
Player *plr;
@@ -1194,9 +1190,11 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
else
plr->TeleportTo(GetId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, plr->GetOrientation());
}
m_ReviveQueue[m_BgCreatures[node]].clear();
ReviveQueue[ObjectGUIDsByType[node]].clear();
}
}
DePopulateNode(node);
}
@@ -1206,13 +1204,13 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
//send a nice message to all :)
char buf[256];
sprintf(buf, (IsTower(node)) ? sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_TOWER_ASSAULTED) : sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_GRAVE_ASSAULTED), GetNodeName(node), (team == ALLIANCE) ? sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_ALLY) : sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_HORDE));
sprintf(buf, (IsTower(node)) ? sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_TOWER_ASSAULTED) : sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_GRAVE_ASSAULTED), GetNodeName(node), (team == BG_TEAM_ALLIANCE) ? sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_ALLY) : sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_AV_HORDE));
Creature* creature = GetCreature(AV_CPLACE_HERALD);
if (creature)
SendMessageToAll(buf, CHAT_MSG_MONSTER_YELL, creature);
//update the statistic for the assaulting player
UpdatePlayerScore(player, (IsTower(node)) ? SCORE_TOWERS_ASSAULTED : SCORE_GRAVEYARDS_ASSAULTED, 1);
PlaySoundToAll((team == ALLIANCE)?AV_SOUND_ALLIANCE_ASSAULTS:AV_SOUND_HORDE_ASSAULTS);
PlaySoundToAll((team == BG_TEAM_ALLIANCE)?AV_SOUND_ALLIANCE_ASSAULTS:AV_SOUND_HORDE_ASSAULTS);
}
void BattlegroundAV::FillInitialWorldStates(WorldPacket& data)
@@ -1224,8 +1222,8 @@ void BattlegroundAV::FillInitialWorldStates(WorldPacket& data)
for (uint8 j =1; j <= 3; j+=2)
{//j=1=assaulted j=3=controled
stateok = (m_Nodes[i].State == j);
data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, ALLIANCE)]) << uint32((m_Nodes[i].Owner == ALLIANCE && stateok)?1:0);
data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, HORDE)]) << uint32((m_Nodes[i].Owner == HORDE && stateok)?1:0);
data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, BG_TEAM_ALLIANCE)]) << uint32((m_Nodes[i].Owner == BG_TEAM_ALLIANCE && stateok)?1:0);
data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, BG_TEAM_HORDE)]) << uint32((m_Nodes[i].Owner == BG_TEAM_HORDE && stateok)?1:0);
}
}
@@ -1234,10 +1232,10 @@ void BattlegroundAV::FillInitialWorldStates(WorldPacket& data)
for (uint8 j =1; j <= 3; j+=2)
{//j=1=assaulted j=3=controled //i dont have j=2=destroyed cause destroyed is the same like enemy-team controll
stateok = (m_Nodes[i].State == j || (m_Nodes[i].State == POINT_DESTROYED && j == 3));
data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, ALLIANCE)]) << uint32((m_Nodes[i].Owner == ALLIANCE && stateok)?1:0);
data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, HORDE)]) << uint32((m_Nodes[i].Owner == HORDE && stateok)?1:0);
data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, BG_TEAM_ALLIANCE)]) << uint32((m_Nodes[i].Owner == BG_TEAM_ALLIANCE && stateok)?1:0);
data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, BG_TEAM_HORDE)]) << uint32((m_Nodes[i].Owner == BG_TEAM_HORDE && stateok)?1:0);
}
if (m_Nodes[BG_AV_NODES_SNOWFALL_GRAVE].Owner == AV_NEUTRAL_TEAM) //cause neutral teams aren't handled generic
if (m_Nodes[BG_AV_NODES_SNOWFALL_GRAVE].Owner == BG_TEAMS_COUNT) //cause neutral teams aren't handled generic
data << uint32(AV_SNOWFALL_N) << uint32(1);
data << uint32(AV_Alliance_Score) << uint32(TeamScores[0]);
data << uint32(AV_Horde_Score) << uint32(TeamScores[1]);
@@ -1257,16 +1255,16 @@ void BattlegroundAV::FillInitialWorldStates(WorldPacket& data)
uint8 BattlegroundAV::GetWorldStateType(uint8 state, uint16 team) //this is used for node worldstates and returns values which fit good into the worldstatesarray
{
//neutral stuff cant get handled (currently its only snowfall)
ASSERT(team != AV_NEUTRAL_TEAM);
ASSERT(team != BG_TEAMS_COUNT);
//a_c a_a h_c h_a the positions in worldstate-array
if (team == ALLIANCE)
if (team == BG_TEAM_ALLIANCE)
{
if (state == POINT_CONTROLED || state == POINT_DESTROYED)
return 0;
if (state == POINT_ASSAULTED)
return 1;
}
if (team == HORDE)
if (team == BG_TEAM_HORDE)
{
if (state == POINT_DESTROYED || state == POINT_CONTROLED)
return 2;
@@ -1280,7 +1278,7 @@ uint8 BattlegroundAV::GetWorldStateType(uint8 state, uint16 team) //this is used
void BattlegroundAV::UpdateNodeWorldState(AVNodeId node)
{
UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].State, m_Nodes[node].Owner)], 1);
if (m_Nodes[node].PrevOwner == AV_NEUTRAL_TEAM) //currently only snowfall is supported as neutral node (i don't want to make an extra row (neutral states) in worldstatesarray just for one node
if (m_Nodes[node].PrevOwner == BG_TEAMS_COUNT) //currently only snowfall is supported as neutral node (i don't want to make an extra row (neutral states) in worldstatesarray just for one node
UpdateWorldState(AV_SNOWFALL_N, 0);
else
UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].PrevState, m_Nodes[node].PrevOwner)], 0);
@@ -1290,20 +1288,20 @@ void BattlegroundAV::SendMineWorldStates(uint32 mine)
{
ASSERT(mine == AV_NORTH_MINE || mine == AV_SOUTH_MINE);
// currently i'm sure, that this works (:
// ASSERT(m_Mine_PrevOwner[mine] == ALLIANCE || m_Mine_PrevOwner[mine] == HORDE || m_Mine_PrevOwner[mine] == AV_NEUTRAL_TEAM);
// ASSERT(m_Mine_Owner[mine] == ALLIANCE || m_Mine_Owner[mine] == HORDE || m_Mine_Owner[mine] == AV_NEUTRAL_TEAM);
// ASSERT(m_Mine_PrevOwner[mine] == BG_TEAM_ALLIANCE || m_Mine_PrevOwner[mine] == BG_TEAM_HORDE || m_Mine_PrevOwner[mine] == BG_TEAMS_COUNT);
// ASSERT(m_Mine_Owner[mine] == BG_TEAM_ALLIANCE || m_Mine_Owner[mine] == BG_TEAM_HORDE || m_Mine_Owner[mine] == BG_TEAMS_COUNT);
uint8 owner, prevowner, mine2; //those variables are needed to access the right worldstate in the BG_AV_MineWorldStates array
mine2 = (mine == AV_NORTH_MINE)?0:1;
if (_minePreviousOwner[mine] == ALLIANCE)
if (_minePreviousOwner[mine] == BG_TEAM_ALLIANCE)
prevowner = 0;
else if (_minePreviousOwner[mine] == HORDE)
else if (_minePreviousOwner[mine] == BG_TEAM_HORDE)
prevowner = 2;
else
prevowner = 1;
if (_mineOwner[mine] == ALLIANCE)
if (_mineOwner[mine] == BG_TEAM_ALLIANCE)
owner = 0;
else if (_mineOwner[mine] == HORDE)
else if (_mineOwner[mine] == BG_TEAM_HORDE)
owner = 2;
else
owner = 1;
@@ -1323,7 +1321,7 @@ WorldSafeLocsEntry const* BattlegroundAV::GetClosestGraveYard(Player* player)
player->GetPosition(x, y);
pGraveyard = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[GetTeamIndexByTeamId(player->GetTeam())+7]);
pGraveyard = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[player->GetBGTeam()+7]);
minDist = (pGraveyard->x - x)*(pGraveyard->x - x)+(pGraveyard->y - y)*(pGraveyard->y - y);
for (uint8 i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i)
@@ -1372,7 +1370,7 @@ const char* BattlegroundAV::GetNodeName(AVNodeId node)
return "Unknown";
}
void BattlegroundAV::AssaultNode(AVNodeId node, uint16 team)
void BattlegroundAV::AssaultNode(AVNodeId node, BattlegroundTeamId team)
{
if (m_Nodes[node].TotalOwner == team)
{
@@ -1413,7 +1411,7 @@ void BattlegroundAV::DestroyNode(AVNodeId node)
m_Nodes[node].Timer = 0;
}
void BattlegroundAV::InitNode(AVNodeId node, uint16 team, bool tower)
void BattlegroundAV::InitNode(AVNodeId node, BattlegroundTeamId team, bool tower)
{
m_Nodes[node].TotalOwner = team;
m_Nodes[node].Owner = team;
@@ -1425,7 +1423,7 @@ void BattlegroundAV::InitNode(AVNodeId node, uint16 team, bool tower)
m_Nodes[node].Tower = tower;
}
void BattlegroundAV::DefendNode(AVNodeId node, uint16 team)
void BattlegroundAV::DefendNode(AVNodeId node, BattlegroundTeamId team)
{
ASSERT(m_Nodes[node].TotalOwner == team);
ASSERT(m_Nodes[node].Owner != team);

View File

@@ -22,8 +22,6 @@
#include "BattlegroundMap.h"
#include "BattlegroundScore.h"
class Battleground;
#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!"
#define LANG_BG_AV_S_MINE_BOSS_CLAIMS "Snivvle is here! Snivvle claims the Coldtooth Mine!"
@@ -1511,7 +1509,7 @@ enum BG_AV_Objectives
struct BG_AV_NodeInfo
{
uint16 TotalOwner;
uint16 Owner;
BattlegroundTeamId Owner;
uint16 PrevOwner;
BG_AV_States State;
BG_AV_States PrevState;
@@ -1555,9 +1553,7 @@ class BattlegroundAV : public BattlegroundMap
friend class BattlegroundMgr;
public:
BattlegroundAV();
~BattlegroundAV();
void Update(uint32 diff);
void ProcessInProgress(uint32 const& diff);
void InitializeTextIds(); // Initializes text IDs that are used in the battleground at any possible phase.
void InitializeObjects();
@@ -1595,10 +1591,10 @@ class BattlegroundAV : public BattlegroundMap
void EventPlayerDefendsPoint(Player* player, uint32 object);
void EventPlayerDestroyedPoint(AVNodeId node);
void AssaultNode(AVNodeId node, uint16 team);
void AssaultNode(AVNodeId node, BattlegroundTeamId team);
void DestroyNode(AVNodeId node);
void InitNode(AVNodeId node, uint16 team, bool tower);
void DefendNode(AVNodeId node, uint16 team);
void InitNode(AVNodeId node, BattlegroundTeamId team, bool tower);
void DefendNode(AVNodeId node, BattlegroundTeamId team);
void PopulateNode(AVNodeId node);
void DePopulateNode(AVNodeId node);
@@ -1622,7 +1618,7 @@ class BattlegroundAV : public BattlegroundMap
uint16 GetBonusHonor(uint8 kills); //TODO remove this when the core handles this right
/*variables */
uint32 m_Team_QuestStatus[BG_TEAMS_COUNT][9]; //[x][y] x=team y=questcounter
uint32 _teamQuestStatus[BG_TEAMS_COUNT][9]; //[x][y] x=team y=questcounter
BG_AV_NodeInfo m_Nodes[BG_AV_NODES_MAX];

View File

@@ -56,23 +56,6 @@ void BattlegroundBE::StartBattleground()
SpawnGameObject(i, 60);
}
void BattlegroundBE::HandleKillPlayer(Player* player, Player* killer)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
if (!killer)
{
sLog->outError("Killer player not found");
return;
}
Battleground::HandleKillPlayer(player, killer);
UpdateArenaWorldState();
CheckArenaWinConditions();
}
bool BattlegroundBE::HandlePlayerUnderMap(Player* player)
{
player->TeleportTo(GetId(), 6238.930176f, 262.963470f, 0.889519f, player->GetOrientation(), false);

View File

@@ -27,33 +27,76 @@
#include "Vehicle.h"
#include "Transport.h"
BattlegroundIC::BattlegroundIC()
void BattlegroundIC::InstallBattleground()
{
m_BgObjects.resize(MAX_NORMAL_GAMEOBJECTS_SPAWNS + MAX_AIRSHIPS_SPAWNS + MAX_HANGAR_TELEPORTERS_SPAWNS + MAX_FORTRESS_TELEPORTERS_SPAWNS);
m_BgCreatures.resize(MAX_NORMAL_NPCS_SPAWNS + MAX_WORKSHOP_SPAWNS + MAX_DOCKS_SPAWNS + MAX_SPIRIT_GUIDES_SPAWNS);
for (uint8 i = 0; i < 2; i++)
factionReinforcements[i] = MAX_REINFORCEMENTS;
_factionReinforcements[i] = MAX_REINFORCEMENTS;
for (uint8 i = 0; i < BG_IC_MAXDOOR; i++)
GateStatus[i] = BG_IC_GATE_OK;
_gateStatus[i] = BG_IC_GATE_OK;
closeFortressDoorsTimer = CLOSE_DOORS_TIME; // the doors are closed again... in a special way
doorsClosed = false;
resourceTimer = IC_RESOURCE_TIME;
_closeFortressDoorsTimer = CLOSE_DOORS_TIME; // the doors are closed again... in a special way
_doorsClosed = false;
_resourceTimer = IC_RESOURCE_TIME;
for (uint8 i = NODE_TYPE_REFINERY; i < MAX_NODE_TYPES; i++)
nodePoint[i] = nodePointInitial[i];
_nodePoint[i] = nodePointInitial[i];
siegeEngineWorkshopTimer = WORKSHOP_UPDATE_TIME;
_siegeEngineWorkshopTimer = WORKSHOP_UPDATE_TIME;
gunshipHorde = NULL;
gunshipAlliance = NULL;
_gunshipHorde = NULL;
_gunshipAlliance = NULL;
}
BattlegroundIC::~BattlegroundIC()
void BattlegroundIC::InitializeObjects()
{
ObjectGUIDsByType.resize(MAX_NORMAL_GAMEOBJECTS_SPAWNS + MAX_AIRSHIPS_SPAWNS + MAX_HANGAR_TELEPORTERS_SPAWNS + MAX_FORTRESS_TELEPORTERS_SPAWNS +
MAX_NORMAL_NPCS_SPAWNS + MAX_WORKSHOP_SPAWNS + MAX_DOCKS_SPAWNS + MAX_SPIRIT_GUIDES_SPAWNS);
for (uint8 i = 0; i < MAX_NORMAL_GAMEOBJECTS_SPAWNS; i++)
{
AddGameObject(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);
}
for (uint8 i = 0; i < MAX_NORMAL_NPCS_SPAWNS; i++)
{
AddCreature(BG_IC_NpcSpawnlocs[i].entry, BG_IC_NpcSpawnlocs[i].type, BG_IC_NpcSpawnlocs[i].team,
BG_IC_NpcSpawnlocs[i].x, BG_IC_NpcSpawnlocs[i].y,
BG_IC_NpcSpawnlocs[i].z, BG_IC_NpcSpawnlocs[i].o,
RESPAWN_ONE_DAY);
}
AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+5, BG_IC_SpiritGuidePos[5][0], BG_IC_SpiritGuidePos[5][1], BG_IC_SpiritGuidePos[5][2], BG_IC_SpiritGuidePos[5][3], BG_TEAM_ALLIANCE);
AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+6, BG_IC_SpiritGuidePos[6][0], BG_IC_SpiritGuidePos[6][1], BG_IC_SpiritGuidePos[6][2], BG_IC_SpiritGuidePos[6][3], BG_TEAM_HORDE);
AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+3, BG_IC_SpiritGuidePos[7][0], BG_IC_SpiritGuidePos[7][1], BG_IC_SpiritGuidePos[7][2], BG_IC_SpiritGuidePos[7][3], BG_TEAM_ALLIANCE);
AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+4, BG_IC_SpiritGuidePos[8][0], BG_IC_SpiritGuidePos[8][1], BG_IC_SpiritGuidePos[8][2], BG_IC_SpiritGuidePos[8][3], BG_TEAM_HORDE);
_gunshipHorde = CreateTransport(GO_HORDE_GUNSHIP, TRANSPORT_PERIOD_TIME);
_gunshipAlliance = CreateTransport(GO_ALLIANCE_GUNSHIP, TRANSPORT_PERIOD_TIME);
//Send transport init packet to all player in map
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
if (Player* player = itr->getSource())
SendTransportInit(player);
// setting correct factions for Keep Cannons
for (uint8 i = BG_IC_NPC_KEEP_CANNON_1; i < BG_IC_NPC_KEEP_CANNON_12; i++)
GetCreature(i)->setFaction(BG_IC_Factions[0]);
for (uint8 i = BG_IC_NPC_KEEP_CANNON_13; i < BG_IC_NPC_KEEP_CANNON_25; i++)
GetCreature(i)->setFaction(BG_IC_Factions[1]);
// correcting spawn time for keeps bombs
for (uint8 i = BG_IC_GO_HUGE_SEAFORIUM_BOMBS_A_1; i < BG_IC_GO_HUGE_SEAFORIUM_BOMBS_H_4; i++)
GetGameObject(i)->SetRespawnTime(10);
// Show Full Gate Displays
GetGameObject(BG_IC_GO_ALLIANCE_GATE_1)->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED); // Alliance door
GetGameObject(BG_IC_GO_ALLIANCE_GATE_2)->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED); // Alliance door
GetGameObject(BG_IC_GO_HORDE_GATE_2)->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED); // Horde door
GetGameObject(BG_IC_GO_HORDE_GATE_3)->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED); // Horde door
}
void BattlegroundIC::StartBattleground()
@@ -74,24 +117,26 @@ void BattlegroundIC::StartBattleground()
}
}
void BattlegroundIC::HandlePlayerResurrect(Player* player)
void BattlegroundIC::OnPlayerResurrect(Player* player)
{
if (nodePoint[NODE_TYPE_QUARRY].nodeState == (player->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H))
BattlegroundMap::OnPlayerResurrect(player);
if (_nodePoint[NODE_TYPE_QUARRY].nodeState == (player->GetBGTeam() == BG_TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H))
player->CastSpell(player, SPELL_QUARRY, true);
if (nodePoint[NODE_TYPE_REFINERY].nodeState == (player->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H))
if (_nodePoint[NODE_TYPE_REFINERY].nodeState == (player->GetBGTeam() == BG_TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H))
player->CastSpell(player, SPELL_OIL_REFINERY, true);
}
void BattlegroundIC::SendTransportInit(Player* player)
{
if (!gunshipAlliance || !gunshipHorde)
if (!_gunshipAlliance || !_gunshipHorde)
return;
UpdateData transData;
gunshipAlliance->BuildCreateUpdateBlockForPlayer(&transData, player);
gunshipHorde->BuildCreateUpdateBlockForPlayer(&transData, player);
_gunshipAlliance->BuildCreateUpdateBlockForPlayer(&transData, player);
_gunshipHorde->BuildCreateUpdateBlockForPlayer(&transData, player);
WorldPacket packet;
@@ -106,32 +151,29 @@ void BattlegroundIC::DoAction(uint32 action, uint64 const& var)
Player* plr = sObjectMgr->GetPlayer(var);
if (!plr || !gunshipAlliance || !gunshipHorde)
if (!plr || !_gunshipAlliance || !_gunshipHorde)
return;
plr->CastSpell(plr, SPELL_PARACHUTE, true); // this must be changed, there is a trigger in each transport that casts the spell.
plr->CastSpell(plr, SPELL_SLOW_FALL, true);
plr->SetTransport(plr->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde);
plr->SetTransport(plr->GetBGTeam() == BG_TEAM_ALLIANCE ? _gunshipAlliance : _gunshipHorde);
plr->m_movementInfo.t_pos.m_positionX = TransportMovementInfo.GetPositionX();
plr->m_movementInfo.t_pos.m_positionY = TransportMovementInfo.GetPositionY();
plr->m_movementInfo.t_pos.m_positionZ = TransportMovementInfo.GetPositionZ();
plr->m_movementInfo.t_guid = (plr->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->GetGUID();
plr->m_movementInfo.t_guid = (plr->GetBGTeam() == BG_TEAM_ALLIANCE ? _gunshipAlliance : _gunshipHorde)->GetGUID();
plr->TeleportTo(GetMapId(), TeleportToTransportPosition.GetPositionX(), TeleportToTransportPosition.GetPositionY(), TeleportToTransportPosition.GetPositionZ(), TeleportToTransportPosition.GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT);
plr->TeleportTo(GetId(), TeleportToTransportPosition.GetPositionX(), TeleportToTransportPosition.GetPositionY(), TeleportToTransportPosition.GetPositionZ(), TeleportToTransportPosition.GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT);
}
void BattlegroundIC::Update(uint32 diff)
void BattlegroundIC::ProcessInProgress(uint32 const& diff)
{
Battleground::Update(diff);
BattlegroundMap::ProcessInProgress(diff);
if (GetStatus() != STATUS_IN_PROGRESS)
return;
if (!doorsClosed)
if (!_doorsClosed)
{
if (closeFortressDoorsTimer <= diff)
if (_closeFortressDoorsTimer <= diff)
{
GetGameObject(BG_IC_GO_DOODAD_ND_HUMAN_GATE_CLOSEDFX_DOOR01)->RemoveFromWorld();
GetGameObject(BG_IC_GO_DOODAD_ND_WINTERORC_WALL_GATEFX_DOOR01)->RemoveFromWorld();
@@ -139,21 +181,23 @@ void BattlegroundIC::Update(uint32 diff)
GetGameObject(BG_IC_GO_ALLIANCE_GATE_3)->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED); // Alliance door
GetGameObject(BG_IC_GO_HORDE_GATE_1)->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED); // Horde door
doorsClosed = true;
} else closeFortressDoorsTimer -= diff;
_doorsClosed = true;
}
else
_closeFortressDoorsTimer -= diff;
}
for (uint8 i = NODE_TYPE_REFINERY; i < MAX_NODE_TYPES; i++)
{
if (nodePoint[i].nodeType == NODE_TYPE_DOCKS)
if (_nodePoint[i].nodeType == NODE_TYPE_DOCKS)
{
if (nodePoint[i].nodeState == NODE_STATE_CONTROLLED_A ||
nodePoint[i].nodeState == NODE_STATE_CONTROLLED_H)
if (_nodePoint[i].nodeState == NODE_STATE_CONTROLLED_A ||
_nodePoint[i].nodeState == NODE_STATE_CONTROLLED_H)
{
if (nodePoint[i].timer <= diff)
if (_nodePoint[i].timer <= diff)
{
// we need to confirm this, i am not sure if this every 3 minutes
for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_A : BG_IC_NPC_CATAPULT_4_H); u++)
for (uint8 u = (_nodePoint[i].faction == BG_TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H); u < (_nodePoint[i].faction == BG_TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_A : BG_IC_NPC_CATAPULT_4_H); u++)
{
if (Creature* catapult = GetCreature(u))
{
@@ -163,7 +207,7 @@ void BattlegroundIC::Update(uint32 diff)
}
// we need to confirm this is blizzlike, not sure if it is every 3 minutes
for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_A : BG_IC_NPC_GLAIVE_THROWER_2_H); u++)
for (uint8 u = (_nodePoint[i].faction == BG_TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H); u < (_nodePoint[i].faction == BG_TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_A : BG_IC_NPC_GLAIVE_THROWER_2_H); u++)
{
if (Creature* glaiveThrower = GetCreature(u))
{
@@ -172,19 +216,21 @@ void BattlegroundIC::Update(uint32 diff)
}
}
docksTimer = DOCKS_UPDATE_TIME;
} else nodePoint[i].timer -= diff;
_docksTimer = DOCKS_UPDATE_TIME;
}
else
_nodePoint[i].timer -= diff;
}
}
if (nodePoint[i].nodeType == NODE_TYPE_WORKSHOP)
if (_nodePoint[i].nodeType == NODE_TYPE_WORKSHOP)
{
if (nodePoint[i].nodeState == NODE_STATE_CONTROLLED_A ||
nodePoint[i].nodeState == NODE_STATE_CONTROLLED_H)
if (_nodePoint[i].nodeState == NODE_STATE_CONTROLLED_A ||
_nodePoint[i].nodeState == NODE_STATE_CONTROLLED_H)
{
if (siegeEngineWorkshopTimer <= diff)
if (_siegeEngineWorkshopTimer <= diff)
{
uint8 siegeType = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_A : BG_IC_NPC_SIEGE_ENGINE_H);
uint8 siegeType = (_nodePoint[i].faction == BG_TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_A : BG_IC_NPC_SIEGE_ENGINE_H);
if (Creature* siege = GetCreature(siegeType)) // this always should be true
{
@@ -201,7 +247,7 @@ void BattlegroundIC::Update(uint32 diff)
}
// we need to confirm if it is every 3 minutes
for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_A : BG_IC_NPC_DEMOLISHER_4_H); u++)
for (uint8 u = (_nodePoint[i].faction == BG_TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H); u < (_nodePoint[i].faction == BG_TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_A : BG_IC_NPC_DEMOLISHER_4_H); u++)
{
if (Creature* demolisher = GetCreature(u))
{
@@ -209,77 +255,72 @@ void BattlegroundIC::Update(uint32 diff)
demolisher->Respawn(true);
}
}
siegeEngineWorkshopTimer = WORKSHOP_UPDATE_TIME;
} else siegeEngineWorkshopTimer -= diff;
_siegeEngineWorkshopTimer = WORKSHOP_UPDATE_TIME;
} else _siegeEngineWorkshopTimer -= diff;
}
}
// the point is waiting for a change on its banner
if (nodePoint[i].needChange)
if (_nodePoint[i].needChange)
{
if (nodePoint[i].timer <= diff)
if (_nodePoint[i].timer <= diff)
{
uint32 nextBanner = GetNextBanner(&nodePoint[i], nodePoint[i].faction, true);
uint32 nextBanner = GetNextBanner(&_nodePoint[i], _nodePoint[i].faction, true);
nodePoint[i].last_entry = nodePoint[i].gameobject_entry;
nodePoint[i].gameobject_entry = nextBanner;
_nodePoint[i].last_entry = _nodePoint[i].gameobject_entry;
_nodePoint[i].gameobject_entry = nextBanner;
// nodePoint[i].faction = the faction should be the same one...
GameObject* banner = GetGameObject(nodePoint[i].gameobject_type);
GameObject* banner = GetGameObject(_nodePoint[i].gameobject_type);
if (!banner) // this should never happen
return;
float cords[4] = {banner->GetPositionX(), banner->GetPositionY(), banner->GetPositionZ(), banner->GetOrientation() };
DeleteGameObject(nodePoint[i].gameobject_type);
AddGameObject(nodePoint[i].gameobject_type, nodePoint[i].gameobject_entry, cords[0], cords[1], cords[2], cords[3], 0, 0, 0, 0, RESPAWN_ONE_DAY);
DeleteGameObject(_nodePoint[i].gameobject_type);
AddGameObject(_nodePoint[i].gameobject_type, _nodePoint[i].gameobject_entry, cords[0], cords[1], cords[2], cords[3], 0, 0, 0, 0, RESPAWN_ONE_DAY);
GetGameObject(nodePoint[i].gameobject_type)->SetUInt32Value(GAMEOBJECT_FACTION, nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_Factions[1] : BG_IC_Factions[0]);
GetGameObject(_nodePoint[i].gameobject_type)->SetUInt32Value(GAMEOBJECT_FACTION, _nodePoint[i].faction == BG_TEAM_ALLIANCE ? BG_IC_Factions[1] : BG_IC_Factions[0]);
UpdateNodeWorldState(&nodePoint[i]);
HandleCapturedNodes(&nodePoint[i], false);
UpdateNodeWorldState(&_nodePoint[i]);
HandleCapturedNodes(&_nodePoint[i], false);
SendMessage2ToAll(LANG_BG_IC_TEAM_HAS_TAKEN_NODE, CHAT_MSG_BG_SYSTEM_NEUTRAL, NULL, (nodePoint[i].faction == TEAM_ALLIANCE ? LANG_BG_IC_ALLIANCE : LANG_BG_IC_HORDE), nodePoint[i].string);
SendMessageToAll(ParseStrings(LANG_BG_IC_TEAM_HAS_TAKEN_NODE, (_nodePoint[i].faction == BG_TEAM_ALLIANCE ? LANG_BG_IC_ALLIANCE : LANG_BG_IC_HORDE), _nodePoint[i].string), CHAT_MSG_BG_SYSTEM_NEUTRAL, NULL);
nodePoint[i].needChange = false;
nodePoint[i].timer = BANNER_STATE_CHANGE_TIME;
} else nodePoint[i].timer -= diff;
_nodePoint[i].needChange = false;
_nodePoint[i].timer = BANNER_STATE_CHANGE_TIME;
}
else
_nodePoint[i].timer -= diff;
}
}
if (resourceTimer <= diff)
if (_resourceTimer <= diff)
{
for (uint8 i = 0; i < NODE_TYPE_DOCKS; i++)
{
if (nodePoint[i].nodeState == NODE_STATE_CONTROLLED_A ||
nodePoint[i].nodeState == NODE_STATE_CONTROLLED_H)
if (_nodePoint[i].nodeState == NODE_STATE_CONTROLLED_A ||
_nodePoint[i].nodeState == NODE_STATE_CONTROLLED_H)
{
factionReinforcements[nodePoint[i].faction] += 1;
RewardHonorToTeam(RESOURCE_HONOR_AMOUNT, nodePoint[i].faction == TEAM_ALLIANCE ? ALLIANCE : HORDE);
UpdateWorldState((nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_ALLIANCE_RENFORT : BG_IC_HORDE_RENFORT), factionReinforcements[nodePoint[i].faction]);
_factionReinforcements[_nodePoint[i].faction] += 1;
RewardHonorToTeam(RESOURCE_HONOR_AMOUNT, _nodePoint[i].faction == BG_TEAM_ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE);
UpdateWorldState((_nodePoint[i].faction == BG_TEAM_ALLIANCE ? BG_IC_ALLIANCE_RENFORT : BG_IC_HORDE_RENFORT), _factionReinforcements[_nodePoint[i].faction]);
}
}
resourceTimer = IC_RESOURCE_TIME;
} else resourceTimer -= diff;
}
void BattlegroundIC::InitializeObjects()
{
// Show Full Gate Displays
GetGameObject(BG_IC_GO_ALLIANCE_GATE_1)->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED); // Alliance door
GetGameObject(BG_IC_GO_ALLIANCE_GATE_2)->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED); // Alliance door
GetGameObject(BG_IC_GO_HORDE_GATE_2)->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED); // Horde door
GetGameObject(BG_IC_GO_HORDE_GATE_3)->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED); // Horde door
_resourceTimer = IC_RESOURCE_TIME;
}
else
_resourceTimer -= diff;
}
bool BattlegroundIC::IsAllNodesConrolledByTeam(uint32 team) const
{
uint32 count = 0;
ICNodeState controlledState = team == ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H;
ICNodeState controlledState = team == BG_TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H;
for (int i = 0; i < NODE_TYPE_WORKSHOP; ++i)
{
if (nodePoint[i].nodeState == controlledState)
if (_nodePoint[i].nodeState == controlledState)
count++;
}
@@ -294,17 +335,19 @@ void BattlegroundIC::OnPlayerJoin(Player *plr)
PlayerScores[plr->GetGUIDLow()] = sc;
if (nodePoint[NODE_TYPE_QUARRY].nodeState == (plr->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H))
if (_nodePoint[NODE_TYPE_QUARRY].nodeState == (plr->GetBGTeam() == BG_TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H))
plr->CastSpell(plr, SPELL_QUARRY, true);
if (nodePoint[NODE_TYPE_REFINERY].nodeState == (plr->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H))
if (_nodePoint[NODE_TYPE_REFINERY].nodeState == (plr->GetBGTeam() == BG_TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H))
plr->CastSpell(plr, SPELL_OIL_REFINERY, true);
SendTransportInit(plr);
}
void BattlegroundIC::RemovePlayer(Player* plr, uint64 /*guid*/, uint32 /*team*/)
void BattlegroundIC::OnPlayerExit(Player* plr)
{
BattlegroundMap::OnPlayerExit(plr);
plr->RemoveAura(SPELL_QUARRY);
plr->RemoveAura(SPELL_OIL_REFINERY);
}
@@ -340,79 +383,17 @@ void BattlegroundIC::FillInitialWorldStates(WorldPacket& data)
{
data << uint32(BG_IC_ALLIANCE_RENFORT_SET) << uint32(1);
data << uint32(BG_IC_HORDE_RENFORT_SET) << uint32(1);
data << uint32(BG_IC_ALLIANCE_RENFORT) << uint32(factionReinforcements[TEAM_ALLIANCE]);
data << uint32(BG_IC_HORDE_RENFORT) << uint32(factionReinforcements[TEAM_HORDE]);
data << uint32(BG_IC_ALLIANCE_RENFORT) << uint32(_factionReinforcements[BG_TEAM_ALLIANCE]);
data << uint32(BG_IC_HORDE_RENFORT) << uint32(_factionReinforcements[BG_TEAM_HORDE]);
for (uint8 i = 0; i < MAX_FORTRESS_GATES_SPAWNS; i++)
{
uint32 uws = GetWorldStateFromGateEntry(BG_IC_ObjSpawnlocs[i].entry, (GateStatus[GetGateIDFromEntry(BG_IC_ObjSpawnlocs[i].entry)] == BG_IC_GATE_DESTROYED ? true : false));
uint32 uws = GetWorldStateFromGateEntry(BG_IC_ObjSpawnlocs[i].entry, (_gateStatus[GetGateIDFromEntry(BG_IC_ObjSpawnlocs[i].entry)] == BG_IC_GATE_DESTROYED ? true : false));
data << uint32(uws) << uint32(1);
}
for (uint8 i = 0 ; i < MAX_NODE_TYPES ; i++)
data << uint32(nodePoint[i].worldStates[nodePoint[i].nodeState]) << uint32(1);
}
bool BattlegroundIC::SetupBattleground()
{
for (uint8 i = 0; i < MAX_NORMAL_GAMEOBJECTS_SPAWNS; i++)
{
if (!AddGameObject(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))
{
sLog->outError("Isle of Conquest: There was an error spawning gameobject %u", BG_IC_ObjSpawnlocs[i].entry);
return false;
}
}
for (uint8 i = 0; i < MAX_NORMAL_NPCS_SPAWNS; i++)
{
if (!AddCreature(BG_IC_NpcSpawnlocs[i].entry, BG_IC_NpcSpawnlocs[i].type, BG_IC_NpcSpawnlocs[i].team,
BG_IC_NpcSpawnlocs[i].x, BG_IC_NpcSpawnlocs[i].y,
BG_IC_NpcSpawnlocs[i].z, BG_IC_NpcSpawnlocs[i].o,
RESPAWN_ONE_DAY))
{
sLog->outError("Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[i].entry);
return false;
}
}
if (!AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+5, BG_IC_SpiritGuidePos[5][0], BG_IC_SpiritGuidePos[5][1], BG_IC_SpiritGuidePos[5][2], BG_IC_SpiritGuidePos[5][3], ALLIANCE)
|| !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+6, BG_IC_SpiritGuidePos[6][0], BG_IC_SpiritGuidePos[6][1], BG_IC_SpiritGuidePos[6][2], BG_IC_SpiritGuidePos[6][3], HORDE)
|| !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+3, BG_IC_SpiritGuidePos[7][0], BG_IC_SpiritGuidePos[7][1], BG_IC_SpiritGuidePos[7][2], BG_IC_SpiritGuidePos[7][3], ALLIANCE)
|| !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+4, BG_IC_SpiritGuidePos[8][0], BG_IC_SpiritGuidePos[8][1], BG_IC_SpiritGuidePos[8][2], BG_IC_SpiritGuidePos[8][3], HORDE))
{
sLog->outError("Isle of Conquest: Failed to spawn initial spirit guide!");
return false;
}
gunshipHorde = CreateTransport(GO_HORDE_GUNSHIP, TRANSPORT_PERIOD_TIME);
gunshipAlliance = CreateTransport(GO_ALLIANCE_GUNSHIP, TRANSPORT_PERIOD_TIME);
if (!gunshipAlliance || !gunshipHorde)
{
sLog->outError("Isle of Conquest: There was an error creating gunships!");
return false;
}
//Send transport init packet to all player in map
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
if (Player* player = itr->getSource())
SendTransportInit(player);
// setting correct factions for Keep Cannons
for (uint8 i = BG_IC_NPC_KEEP_CANNON_1; i < BG_IC_NPC_KEEP_CANNON_12; i++)
GetCreature(i)->setFaction(BG_IC_Factions[0]);
for (uint8 i = BG_IC_NPC_KEEP_CANNON_13; i < BG_IC_NPC_KEEP_CANNON_25; i++)
GetCreature(i)->setFaction(BG_IC_Factions[1]);
// correcting spawn time for keeps bombs
for (uint8 i = BG_IC_GO_HUGE_SEAFORIUM_BOMBS_A_1; i < BG_IC_GO_HUGE_SEAFORIUM_BOMBS_H_4; i++)
GetGameObject(i)->SetRespawnTime(10);
return true;
data << uint32(_nodePoint[i].worldStates[_nodePoint[i].nodeState]) << uint32(1);
}
void BattlegroundIC::OnUnitKill(Creature* unit, Player* killer)
@@ -445,18 +426,18 @@ void BattlegroundIC::OnPlayerKill(Player* player, Player* killer)
BattlegroundMap::OnPlayerKill(player, killer);
factionReinforcements[player->GetTeamId()] -= 1;
_factionReinforcements[player->GetBGTeam()] -= 1;
UpdateWorldState((player->GetTeamId() == TEAM_ALLIANCE ? BG_IC_ALLIANCE_RENFORT : BG_IC_HORDE_RENFORT), factionReinforcements[player->GetTeamId()]);
UpdateWorldState((player->GetBGTeam() == BG_TEAM_ALLIANCE ? BG_IC_ALLIANCE_RENFORT : BG_IC_HORDE_RENFORT), _factionReinforcements[player->GetBGTeam()]);
// we must end the battleground
if (factionReinforcements[player->GetTeamId()] < 1)
if (_factionReinforcements[player->GetBGTeam()] < 1)
EndBattleground( killer->GetBGTeam() == BG_TEAM_ALLIANCE ? WINNER_ALLIANCE : WINNER_HORDE);
}
void BattlegroundIC::EndBattleground(BattlegroundWinner winner)
{
SendMessage2ToAll(LANG_BG_IC_TEAM_WINS, CHAT_MSG_BG_SYSTEM_NEUTRAL, NULL, (winner == WINNER_ALLIANCE ? LANG_BG_IC_ALLIANCE : LANG_BG_IC_HORDE));
SendMessageToAll(ParseStrings(LANG_BG_IC_TEAM_WINS, (winner == WINNER_ALLIANCE ? LANG_BG_IC_ALLIANCE : LANG_BG_IC_HORDE)), CHAT_MSG_BG_SYSTEM_NEUTRAL);
BattlegroundMap::EndBattleground(winner);
}
@@ -464,7 +445,7 @@ void BattlegroundIC::EndBattleground(BattlegroundWinner winner)
void BattlegroundIC::RealocatePlayers(ICNodePointType nodeType)
{
// Those who are waiting to resurrect at this node are taken to the closest own node's graveyard
std::vector<uint64> ghost_list = m_ReviveQueue[m_BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1+nodeType-2]];
std::vector<uint64> ghost_list = ReviveQueue[ObjectGUIDsByType[BG_IC_NPC_SPIRIT_GUIDE_1+nodeType-2]];
if (!ghost_list.empty())
{
WorldSafeLocsEntry const *ClosestGrave = NULL;
@@ -491,69 +472,73 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* target
// 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 == target_obj->GetEntry())
if (_nodePoint[i].gameobject_entry == target_obj->GetEntry())
{
// THIS SHOULD NEEVEER HAPPEN
if (nodePoint[i].faction == player->GetTeamId())
if (_nodePoint[i].faction == player->GetBGTeam())
return;
uint32 nextBanner = GetNextBanner(&nodePoint[i], player->GetTeamId(), false);
uint32 nextBanner = GetNextBanner(&_nodePoint[i], player->GetBGTeam(), 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;
_nodePoint[i].faction = player->GetBGTeam();
_nodePoint[i].last_entry = _nodePoint[i].gameobject_entry;
_nodePoint[i].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 (_nodePoint[i].banners[BANNER_A_CONTESTED] == nextBanner ||
_nodePoint[i].banners[BANNER_H_CONTESTED] == nextBanner)
{
nodePoint[i].timer = BANNER_STATE_CHANGE_TIME; // 1 minute for last change (real faction banner)
nodePoint[i].needChange = true;
_nodePoint[i].timer = BANNER_STATE_CHANGE_TIME; // 1 minute for last change (real faction banner)
_nodePoint[i].needChange = true;
RealocatePlayers(nodePoint[i].nodeType);
RealocatePlayers(_nodePoint[i].nodeType);
// 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 (m_BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1+(nodePoint[i].nodeType)-2])
DeleteCreature(BG_IC_NPC_SPIRIT_GUIDE_1+(nodePoint[i].nodeType)-2);
if (_nodePoint[i].nodeType != NODE_TYPE_REFINERY && _nodePoint[i].nodeType != NODE_TYPE_QUARRY)
DeleteCreature(BG_IC_NPC_SPIRIT_GUIDE_1+(_nodePoint[i].nodeType)-2);
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]);
} else if (nextBanner == nodePoint[i].banners[BANNER_A_CONTROLLED] ||
nextBanner == nodePoint[i].banners[BANNER_H_CONTROLLED])
// if we are going to spawn the definitve faction banner, we dont need the timer anymore
SendMessageToAll(ParseStrings(LANG_BG_IC_TEAM_ASSAULTED_NODE_1, _nodePoint[i].string), CHAT_MSG_BG_SYSTEM_NEUTRAL, player);
char string[512];
snprintf(string, 1024, sObjectMgr->GetTrinityStringForDBCLocale(LANG_BG_IC_TEAM_ASSAULTED_NODE_2),
_nodePoint[i].string, sObjectMgr->GetTrinityStringForDBCLocale(player->GetBGTeam() == BG_TEAM_ALLIANCE ? LANG_BG_IC_ALLIANCE : LANG_BG_IC_HORDE));
SendMessageToAll(string, CHAT_MSG_BG_SYSTEM_NEUTRAL, player);
HandleContestedNodes(&_nodePoint[i]);
}
else if (nextBanner == _nodePoint[i].banners[BANNER_A_CONTROLLED] || nextBanner == _nodePoint[i].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);
_nodePoint[i].timer = BANNER_STATE_CHANGE_TIME;
_nodePoint[i].needChange = false;
SendMessageToAll(ParseStrings(LANG_BG_IC_TEAM_DEFENDED_NODE, _nodePoint[i].string), CHAT_MSG_BG_SYSTEM_NEUTRAL, player);
HandleCapturedNodes(&_nodePoint[i], true);
UpdatePlayerScore(player, SCORE_BASES_DEFENDED, 1);
}
GameObject* banner = GetGameObject(nodePoint[i].gameobject_type);
GameObject* banner = GetGameObject(_nodePoint[i].gameobject_type);
if (!banner) // this should never happen
return;
float cords[4] = {banner->GetPositionX(), banner->GetPositionY(), banner->GetPositionZ(), banner->GetOrientation() };
DeleteGameObject(nodePoint[i].gameobject_type);
AddGameObject(nodePoint[i].gameobject_type, nodePoint[i].gameobject_entry, cords[0], cords[1], cords[2], cords[3], 0, 0, 0, 0, RESPAWN_ONE_DAY);
DeleteGameObject(_nodePoint[i].gameobject_type);
AddGameObject(_nodePoint[i].gameobject_type, _nodePoint[i].gameobject_entry, cords[0], cords[1], cords[2], cords[3], 0, 0, 0, 0, RESPAWN_ONE_DAY);
GetGameObject(nodePoint[i].gameobject_type)->SetUInt32Value(GAMEOBJECT_FACTION, nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_Factions[1] : BG_IC_Factions[0]);
GetGameObject(_nodePoint[i].gameobject_type)->SetUInt32Value(GAMEOBJECT_FACTION, _nodePoint[i].faction == BG_TEAM_ALLIANCE ? BG_IC_Factions[1] : BG_IC_Factions[0]);
if (nodePoint[i].nodeType == NODE_TYPE_WORKSHOP)
if (_nodePoint[i].nodeType == NODE_TYPE_WORKSHOP)
{
DeleteGameObject(BG_IC_GO_SEAFORIUM_BOMBS_1);
DeleteGameObject(BG_IC_GO_SEAFORIUM_BOMBS_2);
}
UpdateNodeWorldState(&nodePoint[i]);
UpdateNodeWorldState(&_nodePoint[i]);
// 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;
@@ -587,16 +572,16 @@ uint32 BattlegroundIC::GetNextBanner(ICNodePoint* nodePoint, uint32 team, bool r
// this is only used in the update map function
if (returnDefinitve)
// here is a special case, here we must return the definitve faction banner after the grey banner was spawned 1 minute
return nodePoint->banners[(team == TEAM_ALLIANCE ? BANNER_A_CONTROLLED : BANNER_H_CONTROLLED)];
return nodePoint->banners[(team == BG_TEAM_ALLIANCE ? BANNER_A_CONTROLLED : BANNER_H_CONTROLLED)];
// there were no changes, this point has never been captured by any faction or at least clicked
if (nodePoint->last_entry == 0)
// 1 returns the CONTESTED ALLIANCE BANNER, 3 returns the HORDE one
return nodePoint->banners[(team == TEAM_ALLIANCE ? BANNER_A_CONTESTED : BANNER_H_CONTESTED)];
// 1 returns the CONTESTED BG_TEAM_ALLIANCE BANNER, 3 returns the BG_TEAM_HORDE one
return nodePoint->banners[(team == BG_TEAM_ALLIANCE ? BANNER_A_CONTESTED : BANNER_H_CONTESTED)];
// If the actual banner is the definitive faction banner, we must return the grey banner of the player's faction
if (nodePoint->gameobject_entry == nodePoint->banners[BANNER_A_CONTROLLED] || nodePoint->gameobject_entry == nodePoint->banners[BANNER_H_CONTROLLED])
return nodePoint->banners[(team == TEAM_ALLIANCE ? BANNER_A_CONTESTED : BANNER_H_CONTESTED)];
return nodePoint->banners[(team == BG_TEAM_ALLIANCE ? BANNER_A_CONTESTED : BANNER_H_CONTESTED)];
// If the actual banner is the grey faction banner, we must return the previous banner
if (nodePoint->gameobject_entry == nodePoint->banners[BANNER_A_CONTESTED] || nodePoint->banners[BANNER_H_CONTESTED])
@@ -611,8 +596,8 @@ void BattlegroundIC::HandleContestedNodes(ICNodePoint* nodePoint)
{
if (nodePoint->nodeType == NODE_TYPE_HANGAR)
{
if (gunshipAlliance && gunshipHorde)
(nodePoint->faction == TEAM_ALLIANCE ? gunshipHorde : gunshipAlliance)->BuildStopMovePacket(GetBgMap());
if (_gunshipAlliance && _gunshipHorde)
(nodePoint->faction == BG_TEAM_ALLIANCE ? _gunshipHorde : _gunshipAlliance)->BuildStopMovePacket(this);
for (uint8 u = BG_IC_GO_HANGAR_TELEPORTER_1; u < BG_IC_GO_HANGAR_TELEPORTER_3; u++)
DeleteGameObject(u);
@@ -623,24 +608,23 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
{
if (nodePoint->nodeType != NODE_TYPE_REFINERY && nodePoint->nodeType != NODE_TYPE_QUARRY)
{
if (!AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+nodePoint->nodeType-2,
AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+nodePoint->nodeType-2,
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 == TEAM_ALLIANCE ? ALLIANCE : HORDE)))
sLog->outError("Isle of Conquest: Failed to spawn spirit guide! point: %u, team: %u, ", nodePoint->nodeType, nodePoint->faction);
(nodePoint->faction == BG_TEAM_ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE));
}
switch(nodePoint->gameobject_type)
{
case BG_IC_GO_HANGAR_BANNER:
// all the players on the stopped transport should be teleported out
if (!gunshipAlliance || !gunshipHorde)
if (!_gunshipAlliance || !_gunshipHorde)
break;
for (uint8 u = 0; u < MAX_HANGAR_TELEPORTERS_SPAWNS; u++)
{
uint8 type = BG_IC_GO_HANGAR_TELEPORTER_1+u;
AddGameObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL : GO_HORDE_GUNSHIP_PORTAL),
AddGameObject(type, (nodePoint->faction == BG_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);
@@ -648,28 +632,28 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
//sLog->outError("BG_IC_GO_HANGAR_BANNER CAPTURED Faction: %u", nodePoint->faction);
(nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->BuildStartMovePacket(GetBgMap());
(nodePoint->faction == TEAM_ALLIANCE ? gunshipHorde : gunshipAlliance)->BuildStopMovePacket(GetBgMap());
(nodePoint->faction == BG_TEAM_ALLIANCE ? _gunshipAlliance : _gunshipHorde)->BuildStartMovePacket(this);
(nodePoint->faction == BG_TEAM_ALLIANCE ? _gunshipHorde : _gunshipAlliance)->BuildStopMovePacket(this);
// we should spawn teleporters
break;
case BG_IC_GO_QUARRY_BANNER:
RemoveAuraOnTeam(SPELL_QUARRY, (nodePoint->faction == TEAM_ALLIANCE ? HORDE : ALLIANCE));
CastSpellOnTeam(SPELL_QUARRY, (nodePoint->faction == TEAM_ALLIANCE ? ALLIANCE : HORDE));
RemoveAuraOnTeam(SPELL_QUARRY, (nodePoint->faction == BG_TEAM_ALLIANCE ? BG_TEAM_HORDE : BG_TEAM_ALLIANCE));
CastSpellOnTeam(SPELL_QUARRY, (nodePoint->faction == BG_TEAM_ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE));
break;
case BG_IC_GO_REFINERY_BANNER:
RemoveAuraOnTeam(SPELL_OIL_REFINERY, (nodePoint->faction == TEAM_ALLIANCE ? HORDE : ALLIANCE));
CastSpellOnTeam(SPELL_OIL_REFINERY, (nodePoint->faction == TEAM_ALLIANCE ? ALLIANCE : HORDE));
RemoveAuraOnTeam(SPELL_OIL_REFINERY, (nodePoint->faction == BG_TEAM_ALLIANCE ? BG_TEAM_HORDE : BG_TEAM_ALLIANCE));
CastSpellOnTeam(SPELL_OIL_REFINERY, (nodePoint->faction == BG_TEAM_ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE));
break;
case BG_IC_GO_DOCKS_BANNER:
if (recapture)
break;
if (docksTimer < DOCKS_UPDATE_TIME)
docksTimer = DOCKS_UPDATE_TIME;
if (_docksTimer < DOCKS_UPDATE_TIME)
_docksTimer = DOCKS_UPDATE_TIME;
// we must del opposing faction vehicles when the node is captured (unused ones)
for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_H : BG_IC_NPC_GLAIVE_THROWER_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_H : BG_IC_NPC_GLAIVE_THROWER_2_A); i++)
for (uint8 i = (nodePoint->faction == BG_TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_H : BG_IC_NPC_GLAIVE_THROWER_1_A); i < (nodePoint->faction == BG_TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_H : BG_IC_NPC_GLAIVE_THROWER_2_A); i++)
{
if (Creature* glaiveThrower = GetCreature(i))
{
@@ -681,7 +665,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
}
}
for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_H : BG_IC_NPC_CATAPULT_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_H : BG_IC_NPC_CATAPULT_4_A); i++)
for (uint8 i = (nodePoint->faction == BG_TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_H : BG_IC_NPC_CATAPULT_1_A); i < (nodePoint->faction == BG_TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_H : BG_IC_NPC_CATAPULT_4_A); i++)
{
if (Creature* catapult = GetCreature(i))
{
@@ -696,22 +680,22 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
// spawning glaive throwers
for (uint8 i = 0; i < MAX_GLAIVE_THROWERS_SPAWNS_PER_FACTION; i++)
{
uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H)+i;
uint8 type = (nodePoint->faction == BG_TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H)+i;
if (GetCreature(type) && GetCreature(type)->isAlive())
continue;
if (AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_GLAIVE_THROWER_A : NPC_GLAIVE_THROWER_H, type, nodePoint->faction,
if (AddCreature(nodePoint->faction == BG_TEAM_ALLIANCE ? NPC_GLAIVE_THROWER_A : NPC_GLAIVE_THROWER_H, type, nodePoint->faction,
BG_IC_DocksVehiclesGlaives[i].GetPositionX(), BG_IC_DocksVehiclesGlaives[i].GetPositionY(),
BG_IC_DocksVehiclesGlaives[i].GetPositionZ(), BG_IC_DocksVehiclesGlaives[i].GetOrientation(),
RESPAWN_ONE_DAY))
GetCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
GetCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == BG_TEAM_ALLIANCE ? 0 : 1)]);
}
// spawning catapults
for (uint8 i = 0; i < MAX_CATAPULTS_SPAWNS_PER_FACTION; i++)
{
uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H)+i;
uint8 type = (nodePoint->faction == BG_TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H)+i;
if (GetCreature(type) && GetCreature(type)->isAlive())
continue;
@@ -720,18 +704,18 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
BG_IC_DocksVehiclesCatapults[i].GetPositionX(), BG_IC_DocksVehiclesCatapults[i].GetPositionY(),
BG_IC_DocksVehiclesCatapults[i].GetPositionZ(), BG_IC_DocksVehiclesCatapults[i].GetOrientation(),
RESPAWN_ONE_DAY))
GetCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
GetCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == BG_TEAM_ALLIANCE ? 0 : 1)]);
}
break;
case BG_IC_GO_WORKSHOP_BANNER:
{
if (siegeEngineWorkshopTimer < WORKSHOP_UPDATE_TIME)
siegeEngineWorkshopTimer = WORKSHOP_UPDATE_TIME;
if (_siegeEngineWorkshopTimer < WORKSHOP_UPDATE_TIME)
_siegeEngineWorkshopTimer = WORKSHOP_UPDATE_TIME;
if (!recapture)
{
// we must del opposing faction vehicles when the node is captured (unused ones)
for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_H : BG_IC_NPC_DEMOLISHER_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_H : BG_IC_NPC_DEMOLISHER_4_A); i++)
for (uint8 i = (nodePoint->faction == BG_TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_H : BG_IC_NPC_DEMOLISHER_1_A); i < (nodePoint->faction == BG_TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_H : BG_IC_NPC_DEMOLISHER_4_A); i++)
{
if (Creature* demolisher = GetCreature(i))
{
@@ -746,7 +730,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
for (uint8 i = 0; i < MAX_DEMOLISHERS_SPAWNS_PER_FACTION; i++)
{
uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H)+i;
uint8 type = (nodePoint->faction == BG_TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H)+i;
if (GetCreature(type) && GetCreature(type)->isAlive())
continue;
@@ -755,11 +739,11 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
BG_IC_WorkshopVehicles[i].GetPositionX(), BG_IC_WorkshopVehicles[i].GetPositionY(),
BG_IC_WorkshopVehicles[i].GetPositionZ(), BG_IC_WorkshopVehicles[i].GetOrientation(),
RESPAWN_ONE_DAY))
GetCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
GetCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == BG_TEAM_ALLIANCE ? 0 : 1)]);
}
// we check if the opossing siege engine is in use
int8 enemySiege = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_H : BG_IC_NPC_SIEGE_ENGINE_A);
int8 enemySiege = (nodePoint->faction == BG_TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_H : BG_IC_NPC_SIEGE_ENGINE_A);
if (Creature* siegeEngine = GetCreature(enemySiege))
{
@@ -771,10 +755,10 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
}
}
uint8 siegeType = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_A : BG_IC_NPC_SIEGE_ENGINE_H);
uint8 siegeType = (nodePoint->faction == BG_TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_A : BG_IC_NPC_SIEGE_ENGINE_H);
if (!GetCreature(siegeType) || !GetCreature(siegeType)->isAlive())
{
AddCreature((nodePoint->faction == TEAM_ALLIANCE ? NPC_SIEGE_ENGINE_A : NPC_SIEGE_ENGINE_H), siegeType, nodePoint->faction,
AddCreature((nodePoint->faction == BG_TEAM_ALLIANCE ? NPC_SIEGE_ENGINE_A : NPC_SIEGE_ENGINE_H), siegeType, nodePoint->faction,
BG_IC_WorkshopVehicles[4].GetPositionX(), BG_IC_WorkshopVehicles[4].GetPositionY(),
BG_IC_WorkshopVehicles[4].GetPositionZ(), BG_IC_WorkshopVehicles[4].GetOrientation(),
RESPAWN_ONE_DAY);
@@ -782,7 +766,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
if (Creature* siegeEngine = GetCreature(siegeType))
{
siegeEngine->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_UNK_14|UNIT_FLAG_OOC_NOT_ATTACKABLE);
siegeEngine->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
siegeEngine->setFaction(BG_IC_Factions[(nodePoint->faction == BG_TEAM_ALLIANCE ? 0 : 1)]);
}
}
}
@@ -797,7 +781,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
if (GameObject* seaforiumBombs = GetGameObject(BG_IC_GO_SEAFORIUM_BOMBS_1+i))
{
seaforiumBombs->SetRespawnTime(10);
seaforiumBombs->SetUInt32Value(GAMEOBJECT_FACTION, BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
seaforiumBombs->SetUInt32Value(GAMEOBJECT_FACTION, BG_IC_Factions[(nodePoint->faction == BG_TEAM_ALLIANCE ? 0 : 1)]);
}
}
break;
@@ -809,7 +793,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
void BattlegroundIC::DestroyGate(Player* pl, GameObject* go, uint32 /*destroyedEvent*/)
{
GateStatus[GetGateIDFromEntry(go->GetEntry())] = BG_IC_GATE_DESTROYED;
_gateStatus[GetGateIDFromEntry(go->GetEntry())] = BG_IC_GATE_DESTROYED;
uint32 uws_open = GetWorldStateFromGateEntry(go->GetEntry(), true);
uint32 uws_close = GetWorldStateFromGateEntry(go->GetEntry(), false);
if (uws_open)
@@ -817,7 +801,7 @@ void BattlegroundIC::DestroyGate(Player* pl, GameObject* go, uint32 /*destroyedE
UpdateWorldState(uws_close, 0);
UpdateWorldState(uws_open, 1);
}
DoorOpen((pl->GetTeamId() == TEAM_ALLIANCE ? BG_IC_GO_HORDE_KEEP_PORTCULLIS : BG_IC_GO_DOODAD_PORTCULLISACTIVE02));
DoorOpen((pl->GetBGTeam() == BG_TEAM_ALLIANCE ? BG_IC_GO_HORDE_KEEP_PORTCULLIS : BG_IC_GO_DOODAD_PORTCULLISACTIVE02));
uint32 lang_entry = 0;
@@ -840,22 +824,17 @@ void BattlegroundIC::DestroyGate(Player* pl, GameObject* go, uint32 /*destroyedE
break;
}
SendMessage2ToAll(lang_entry, CHAT_MSG_BG_SYSTEM_NEUTRAL, NULL, (pl->GetTeamId() == TEAM_ALLIANCE ? LANG_BG_IC_HORDE_KEEP : LANG_BG_IC_ALLIANCE_KEEP));
}
void BattlegroundIC::EventPlayerDamagedGO(Player* /*plr*/, GameObject* /*go*/, uint32 /*eventType*/)
{
SendMessageToAll(ParseStrings(lang_entry, (pl->GetBGTeam() == BG_TEAM_ALLIANCE ? LANG_BG_IC_HORDE_KEEP : LANG_BG_IC_ALLIANCE_KEEP)), CHAT_MSG_BG_SYSTEM_NEUTRAL, NULL);
}
WorldSafeLocsEntry const* BattlegroundIC::GetClosestGraveYard(Player* player)
{
BattlegroundTeamId teamIndex = GetTeamIndexByTeamId(player->GetTeam());
BattlegroundTeamId teamIndex = BattlegroundTeamId(player->GetBGTeam());
// Is there any occupied node for this team?
std::vector<uint8> nodes;
for (uint8 i = 0; i < MAX_NODE_TYPES; ++i)
if (nodePoint[i].faction == player->GetTeamId())
if (_nodePoint[i].faction == player->GetBGTeam())
nodes.push_back(i);
WorldSafeLocsEntry const* good_entry = NULL;
@@ -925,7 +904,7 @@ Transport* BattlegroundIC::CreateTransport(uint32 goEntry, uint32 period)
}
//If we someday decide to use the grid to track transports, here:
t->SetMap(GetBgMap());
t->SetMap(this);
for (uint8 i = 0; i < 5; i++)
t->AddNPCPassenger(0, (goEntry == GO_HORDE_GUNSHIP ? NPC_HORDE_GUNSHIP_CANNON : NPC_ALLIANCE_GUNSHIP_CANNON), (goEntry == GO_HORDE_GUNSHIP ? hordeGunshipPassengers[i].GetPositionX() : allianceGunshipPassengers[i].GetPositionX()) , (goEntry == GO_HORDE_GUNSHIP ? hordeGunshipPassengers[i].GetPositionY() : allianceGunshipPassengers[i].GetPositionY()), (goEntry == GO_HORDE_GUNSHIP ? hordeGunshipPassengers[i].GetPositionZ() : allianceGunshipPassengers[i].GetPositionZ()), (goEntry == GO_HORDE_GUNSHIP ? hordeGunshipPassengers[i].GetOrientation() : allianceGunshipPassengers[i].GetOrientation()));

View File

@@ -872,32 +872,29 @@ class BattlegroundIC : public BattlegroundMap
{
friend class BattlegroundMgr;
public:
BattlegroundIC();
~BattlegroundIC();
void Update(uint32 diff);
protected:
void ProcessInProgress(uint32 const& diff);
void InitializeTextIds(); // Initializes text IDs that are used in the battleground at any possible phase.
/* inherited from BattlegroundClass */
virtual void OnPlayerJoin(Player *plr);
void StartBattleground();
void InitializeObjects();
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
bool SetupBattleground();
void SpawnLeader(uint32 teamid);
void InstallBattleground();
void StartBattleground();
void EndBattleground(BattlegroundWinner winner);
void OnPlayerJoin(Player *plr);
void OnPlayerExit(Player *plr);
void OnUnitKill(Creature* unit, Player* killer);
void OnPlayerKill(Player* player, Player* killer);
void EndBattleground(BattlegroundWinner winner);
void EventPlayerClickedOnFlag(Player *source, GameObject* /*target_obj*/);
void OnPlayerResurrect(Player* player);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
void EventPlayerClickedOnFlag(Player *source, GameObject* /*target_obj*/);
void EventPlayerDamagedGO(Player* /*plr*/, GameObject* go, uint32 eventType);
void DestroyGate(Player* pl, GameObject* /*go*/, uint32 destroyedEvent);
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
/* Scorekeeping */
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
@@ -906,23 +903,20 @@ class BattlegroundIC : public BattlegroundMap
void DoAction(uint32 action, uint64 const& var);
virtual void HandlePlayerResurrect(Player* player);
uint32 GetNodeState(uint8 nodeType) { return (uint8)nodePoint[nodeType].nodeState; }
virtual bool IsAllNodesConrolledByTeam(uint32 team) const; // overwrited
bool IsAllNodesConrolledByTeam(uint32 team) const; // overwrited
private:
uint32 closeFortressDoorsTimer;
bool doorsClosed;
uint32 docksTimer;
uint32 resourceTimer;
uint32 siegeEngineWorkshopTimer;
uint16 factionReinforcements[2];
BG_IC_GateState GateStatus[6];
ICNodePoint nodePoint[7];
uint32 _closeFortressDoorsTimer;
bool _doorsClosed;
uint32 _docksTimer;
uint32 _resourceTimer;
uint32 _siegeEngineWorkshopTimer;
uint16 _factionReinforcements[2];
BG_IC_GateState _gateStatus[6];
ICNodePoint _nodePoint[7];
Transport* gunshipAlliance;
Transport* gunshipHorde;
Transport* _gunshipAlliance;
Transport* _gunshipHorde;
uint32 GetNextBanner(ICNodePoint* nodePoint, uint32 team, bool returnDefinitve);
@@ -975,5 +969,7 @@ class BattlegroundIC : public BattlegroundMap
void HandleContestedNodes(ICNodePoint* nodePoint);
Transport* CreateTransport(uint32 goEntry, uint32 period);
void SendTransportInit(Player* player);
void SpawnLeader(uint32 teamid);
uint32 GetNodeState(uint8 nodeType) { return (uint8)_nodePoint[nodeType].nodeState; }
};
#endif

View File

@@ -29,7 +29,7 @@ void BattlegroundSA::InstallBattleground()
{
_timerEnabled = false;
_attackers = urand(TEAM_ALLIANCE, TEAM_HORDE);
_attackers = urand(BG_TEAM_ALLIANCE, BG_TEAM_HORDE);
_shipsStarted = false;
@@ -84,7 +84,7 @@ void BattlegroundSA::InitializeObjects()
void BattlegroundSA::ResetObjectsAndWorldstates()
{
uint32 atF = BG_SA_Factions[_attackers];
uint32 defF = BG_SA_Factions[_attackers ? TEAM_ALLIANCE : TEAM_HORDE];
uint32 defF = BG_SA_Factions[_attackers ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE];
for (uint8 i = BG_SA_BOAT_ONE; i <= BG_SA_BOAT_TWO; ++i)
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
@@ -100,7 +100,7 @@ void BattlegroundSA::ResetObjectsAndWorldstates()
//Cannons and demolishers - NPCs are spawned
//By capturing GYs.
for (uint8 i = 0; i < BG_SA_NPC_SPARKLIGHT; i++)
AddCreature(BG_SA_NpcEntries[i], i, (_attackers == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE), BG_SA_NpcSpawnlocs[i][0], BG_SA_NpcSpawnlocs[i][1], BG_SA_NpcSpawnlocs[i][2], BG_SA_NpcSpawnlocs[i][3], 600);
AddCreature(BG_SA_NpcEntries[i], i, (_attackers == BG_TEAM_ALLIANCE ? BG_TEAM_HORDE : BG_TEAM_ALLIANCE), BG_SA_NpcSpawnlocs[i][0], BG_SA_NpcSpawnlocs[i][1], BG_SA_NpcSpawnlocs[i][2], BG_SA_NpcSpawnlocs[i][3], 600);
OverrideGunFaction();
DemolisherStartState(true);
@@ -125,20 +125,20 @@ void BattlegroundSA::ResetObjectsAndWorldstates()
if (i == BG_SA_BEACH_GY && sg)
{
_graveyardStatus[i] = _attackers;
AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((_attackers == TEAM_HORDE)? HORDE : ALLIANCE));
AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((_attackers == BG_TEAM_HORDE)? HORDE : ALLIANCE));
}
else if (sg)
{
_graveyardStatus[i] = ((_attackers == TEAM_HORDE)? TEAM_ALLIANCE : TEAM_HORDE);
AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((_attackers == TEAM_HORDE)? ALLIANCE : HORDE));
_graveyardStatus[i] = ((_attackers == BG_TEAM_HORDE)? BG_TEAM_ALLIANCE : BG_TEAM_HORDE);
AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((_attackers == BG_TEAM_HORDE)? ALLIANCE : HORDE));
}
}
//GY capture points
for (uint8 i = BG_SA_CENTRAL_FLAG; i < BG_SA_PORTAL_DEFFENDER_BLUE; i++)
{
AddGameObject(i, (BG_SA_ObjEntries[i] - (_attackers == TEAM_ALLIANCE ? 1:0)),
AddGameObject(i, (BG_SA_ObjEntries[i] - (_attackers == BG_TEAM_ALLIANCE ? 1:0)),
BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1],
BG_SA_ObjSpawnlocs[i][2], BG_SA_ObjSpawnlocs[i][3],
0, 0, 0, 0, RESPAWN_ONE_DAY)->SetUInt32Value(GAMEOBJECT_FACTION, atF);
@@ -161,15 +161,15 @@ void BattlegroundSA::ResetObjectsAndWorldstates()
}
//Player may enter BEFORE we set up bG - lets update his worldstates anyway...
UpdateWorldState(BG_SA_RIGHT_GY_HORDE , _graveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE?1:0);
UpdateWorldState(BG_SA_LEFT_GY_HORDE , _graveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE?1:0);
UpdateWorldState(BG_SA_CENTER_GY_HORDE , _graveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE?1:0);
UpdateWorldState(BG_SA_RIGHT_GY_HORDE , _graveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == BG_TEAM_HORDE?1:0);
UpdateWorldState(BG_SA_LEFT_GY_HORDE , _graveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == BG_TEAM_HORDE?1:0);
UpdateWorldState(BG_SA_CENTER_GY_HORDE , _graveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == BG_TEAM_HORDE?1:0);
UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE , _graveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE , _graveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE , _graveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE , _graveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == BG_TEAM_ALLIANCE?1:0);
UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE , _graveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == BG_TEAM_ALLIANCE?1:0);
UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE , _graveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == BG_TEAM_ALLIANCE?1:0);
if (_attackers == TEAM_ALLIANCE)
if (_attackers == BG_TEAM_ALLIANCE)
{
UpdateWorldState(BG_SA_ALLY_ATTACKS, 1);
UpdateWorldState(BG_SA_HORDE_ATTACKS, 0);
@@ -221,13 +221,16 @@ void BattlegroundSA::StartBattleground()
ToggleTimer();
_timerWorldStateUpdate = 5 * IN_MILLISECONDS;
DemolisherStartState(false);
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, (_attackers == TEAM_ALLIANCE) ? 23748 : 21702);
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, (_attackers == BG_TEAM_ALLIANCE) ? 23748 : 21702);
}
void BattlegroundSA::EndBattleground(BattlegroundWinner winner)
{
//honor reward for winning
RewardHonorToTeam(GetBonusHonorFromKill(1), winner);
if (winner == WINNER_ALLIANCE)
RewardHonorToTeam(GetBonusHonorFromKill(1), BG_TEAM_ALLIANCE);
else if (winner == WINNER_HORDE)
RewardHonorToTeam(GetBonusHonorFromKill(1), BG_TEAM_HORDE);
//complete map_end rewards (even if no team wins)
RewardHonorToTeam(GetBonusHonorFromKill(2), BG_TEAM_ALLIANCE);
@@ -345,8 +348,8 @@ void BattlegroundSA::OnTimeoutReached()
void BattlegroundSA::FillInitialWorldStates(WorldPacket& data)
{
uint32 ally_attacks = uint32(_attackers == TEAM_ALLIANCE ? 1 : 0);
uint32 horde_attacks = uint32(_attackers == TEAM_HORDE ? 1 : 0);
uint32 ally_attacks = uint32(_attackers == BG_TEAM_ALLIANCE ? 1 : 0);
uint32 horde_attacks = uint32(_attackers == BG_TEAM_HORDE ? 1 : 0);
data << uint32(BG_SA_ANCIENT_GATEWS) << uint32(_gateStatus[BG_SA_ANCIENT_GATE]);
data << uint32(BG_SA_YELLOW_GATEWS) << uint32(_gateStatus[BG_SA_YELLOW_GATE]);
@@ -366,13 +369,13 @@ void BattlegroundSA::FillInitialWorldStates(WorldPacket& data)
data << uint32(BG_SA_TIMER_SEC_TENS) << uint32(0);
data << uint32(BG_SA_TIMER_SEC_DECS) << uint32(0);
data << uint32(BG_SA_RIGHT_GY_HORDE) << uint32(_graveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE?1:0);
data << uint32(BG_SA_LEFT_GY_HORDE) << uint32(_graveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE?1:0);
data << uint32(BG_SA_CENTER_GY_HORDE) << uint32(_graveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE?1:0);
data << uint32(BG_SA_RIGHT_GY_HORDE) << uint32(_graveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == BG_TEAM_HORDE?1:0);
data << uint32(BG_SA_LEFT_GY_HORDE) << uint32(_graveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == BG_TEAM_HORDE?1:0);
data << uint32(BG_SA_CENTER_GY_HORDE) << uint32(_graveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == BG_TEAM_HORDE?1:0);
data << uint32(BG_SA_RIGHT_GY_ALLIANCE) << uint32(_graveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
data << uint32(BG_SA_LEFT_GY_ALLIANCE) << uint32(_graveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
data << uint32(BG_SA_CENTER_GY_ALLIANCE) << uint32(_graveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
data << uint32(BG_SA_RIGHT_GY_ALLIANCE) << uint32(_graveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == BG_TEAM_ALLIANCE?1:0);
data << uint32(BG_SA_LEFT_GY_ALLIANCE) << uint32(_graveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == BG_TEAM_ALLIANCE?1:0);
data << uint32(BG_SA_CENTER_GY_ALLIANCE) << uint32(_graveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == BG_TEAM_ALLIANCE?1:0);
data << uint32(BG_SA_HORDE_DEFENCE_TOKEN) << ally_attacks;
data << uint32(BG_SA_ALLIANCE_DEFENCE_TOKEN) << horde_attacks;
@@ -508,7 +511,7 @@ void BattlegroundSA::OverrideGunFaction()
for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10;i++)
{
if (Creature* gun = GetCreature(i))
gun->setFaction(BG_SA_Factions[_attackers ? TEAM_ALLIANCE : TEAM_HORDE]);
gun->setFaction(BG_SA_Factions[_attackers ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE]);
}
for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4;i++)
@@ -651,7 +654,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source)
_graveyardStatus[i] = Source->GetTeamId();
WorldSafeLocsEntry const *sg = NULL;
sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], (_graveyardStatus[i] == TEAM_ALLIANCE? ALLIANCE : HORDE));
AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], (_graveyardStatus[i] == BG_TEAM_ALLIANCE? ALLIANCE : HORDE));
uint32 npc = 0;
uint32 flag = 0;
@@ -660,7 +663,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source)
case BG_SA_LEFT_CAPTURABLE_GY:
flag = BG_SA_LEFT_FLAG;
DeleteGameObject(flag);
AddGameObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0:1)),
AddGameObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == BG_TEAM_ALLIANCE ? 0:1)),
BG_SA_ObjSpawnlocs[flag][0], BG_SA_ObjSpawnlocs[flag][1],
BG_SA_ObjSpawnlocs[flag][2], BG_SA_ObjSpawnlocs[flag][3], 0, 0, 0, 0, RESPAWN_ONE_DAY);
@@ -669,9 +672,9 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source)
BG_SA_NpcSpawnlocs[npc][0], BG_SA_NpcSpawnlocs[npc][1],
BG_SA_NpcSpawnlocs[npc][2], BG_SA_NpcSpawnlocs[npc][3]);
UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE, (_graveyardStatus[i] == TEAM_ALLIANCE? 1:0));
UpdateWorldState(BG_SA_LEFT_GY_HORDE, (_graveyardStatus[i] == TEAM_ALLIANCE? 0:1));
if (Source->GetTeamId() == TEAM_ALLIANCE)
UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE, (_graveyardStatus[i] == BG_TEAM_ALLIANCE? 1:0));
UpdateWorldState(BG_SA_LEFT_GY_HORDE, (_graveyardStatus[i] == BG_TEAM_ALLIANCE? 0:1));
if (Source->GetTeamId() == BG_TEAM_ALLIANCE)
SendMessageToAll(LANG_BG_SA_A_GY_WEST, CHAT_MSG_RAID_BOSS_EMOTE);
else
SendMessageToAll(LANG_BG_SA_H_GY_WEST, CHAT_MSG_RAID_BOSS_EMOTE);
@@ -679,7 +682,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source)
case BG_SA_RIGHT_CAPTURABLE_GY:
flag = BG_SA_RIGHT_FLAG;
DeleteGameObject(flag);
AddGameObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0:1)),
AddGameObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == BG_TEAM_ALLIANCE ? 0:1)),
BG_SA_ObjSpawnlocs[flag][0], BG_SA_ObjSpawnlocs[flag][1],
BG_SA_ObjSpawnlocs[flag][2], BG_SA_ObjSpawnlocs[flag][3], 0, 0, 0, 0, RESPAWN_ONE_DAY);
@@ -688,9 +691,9 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source)
BG_SA_NpcSpawnlocs[npc][0], BG_SA_NpcSpawnlocs[npc][1],
BG_SA_NpcSpawnlocs[npc][2], BG_SA_NpcSpawnlocs[npc][3]);
UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE, (_graveyardStatus[i] == TEAM_ALLIANCE? 1:0));
UpdateWorldState(BG_SA_RIGHT_GY_HORDE, (_graveyardStatus[i] == TEAM_ALLIANCE? 0:1));
if (Source->GetTeamId() == TEAM_ALLIANCE)
UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE, (_graveyardStatus[i] == BG_TEAM_ALLIANCE? 1:0));
UpdateWorldState(BG_SA_RIGHT_GY_HORDE, (_graveyardStatus[i] == BG_TEAM_ALLIANCE? 0:1));
if (Source->GetTeamId() == BG_TEAM_ALLIANCE)
SendMessageToAll(LANG_BG_SA_A_GY_EAST, CHAT_MSG_RAID_BOSS_EMOTE);
else
SendMessageToAll(LANG_BG_SA_H_GY_EAST, CHAT_MSG_RAID_BOSS_EMOTE);
@@ -698,13 +701,13 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source)
case BG_SA_CENTRAL_CAPTURABLE_GY:
flag = BG_SA_CENTRAL_FLAG;
DeleteGameObject(flag);
AddGameObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0:1)),
AddGameObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == BG_TEAM_ALLIANCE ? 0:1)),
BG_SA_ObjSpawnlocs[flag][0], BG_SA_ObjSpawnlocs[flag][1],
BG_SA_ObjSpawnlocs[flag][2], BG_SA_ObjSpawnlocs[flag][3], 0, 0, 0, 0, RESPAWN_ONE_DAY);
UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE, (_graveyardStatus[i] == TEAM_ALLIANCE? 1:0));
UpdateWorldState(BG_SA_CENTER_GY_HORDE, (_graveyardStatus[i] == TEAM_ALLIANCE? 0:1));
if (Source->GetTeamId() == TEAM_ALLIANCE)
UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE, (_graveyardStatus[i] == BG_TEAM_ALLIANCE? 1:0));
UpdateWorldState(BG_SA_CENTER_GY_HORDE, (_graveyardStatus[i] == BG_TEAM_ALLIANCE? 0:1));
if (Source->GetTeamId() == BG_TEAM_ALLIANCE)
SendMessageToAll(LANG_BG_SA_A_GY_SOUTH, CHAT_MSG_RAID_BOSS_EMOTE);
else
SendMessageToAll(LANG_BG_SA_H_GY_SOUTH, CHAT_MSG_RAID_BOSS_EMOTE);
@@ -721,7 +724,7 @@ void BattlegroundSA::EventPlayerUsedGO(Player* source, GameObject* object)
{
if (source->GetBGTeam() == _attackers)
{
if (source->GetBGTeam() == TEAM_ALLIANCE)
if (source->GetBGTeam() == BG_TEAM_ALLIANCE)
SendMessageToAll(LANG_BG_SA_ALLIANCE_CAPTURED_RELIC, CHAT_MSG_BG_SYSTEM_NEUTRAL);
else
SendMessageToAll(LANG_BG_SA_HORDE_CAPTURED_RELIC, CHAT_MSG_BG_SYSTEM_NEUTRAL);
@@ -738,7 +741,7 @@ void BattlegroundSA::EventPlayerUsedGO(Player* source, GameObject* object)
_roundScores[0].winner = _attackers;
_roundScores[0].time = BG_SA_ROUNDLENGTH - EndTimer;
_attackers = (_attackers == TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE;
_attackers = (_attackers == BG_TEAM_ALLIANCE) ? BG_TEAM_HORDE : BG_TEAM_ALLIANCE;
ToggleTimer();
SendMessageToAll(LANG_BG_SA_ROUND_ONE_END, CHAT_MSG_RAID_BOSS_EMOTE);
}

View File

@@ -534,7 +534,7 @@ class BattlegroundSA : public BattlegroundMap
void SendTransportsRemove(Player* player); /// Send packet to player for destroy boats (client part)
uint32 _attackers; /// Id of attacker team (BattlegroundTeamId)
BattlegroundTeamId _attackers; /// Id of attacker team (BattlegroundTeamId)
bool _shipsStarted; /// For know if boats has start moving or not yet
BG_SA_GateState _gateStatus[BG_SA_GATE_COUNT]; /// Status of each gate (Destroy/Damage/Intact)
uint32 _graveyardStatus[BG_SA_MAX_GY]; /// Team witch conntrol each graveyard (BattlegroundTeamId)

View File

@@ -91,7 +91,9 @@ void ArenaMap::EndBattleground(BattlegroundWinner winner)
Group* ArenaMap::GetGroupForTeam(uint32 team) const
{
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
// Teams in arena's are in the same group
PlayerList const& players = GetPlayers();
for (MapRefManager::iterator itr = players.begin(); itr != players.end(); ++itr)
if (Player* player = itr->getSource())
if (player->GetBGTeam() == team)
return player->GetGroup();

View File

@@ -253,7 +253,14 @@ void BattlegroundMap::SendMessageToAll(char const* string, ChatMsg type, Unit* s
SendPacketToAll(&data);
}
inline char const* BattlegroundMap::ParseStrings(int32 mainEntry, int32 args1, int32 args2)
void BattlegroundMap::PlaySoundToAll(uint32 soundId)
{
WorldPacket data(SMSG_PLAY_SOUND, 4);
data << uint32(soundId);
SendPacketToAll(&data);
}
inline char const* BattlegroundMap::ParseStrings(int32 mainEntry, int32 args1, int32 args2 /*=0*/)
{
char const* text = sObjectMgr->GetTrinityStringForDBCLocale(mainEntry);
char const* arg1str = args1 ? sObjectMgr->GetTrinityStringForDBCLocale(args1) : "";
@@ -275,6 +282,27 @@ inline char const* BattlegroundMap::ParseStrings(int32 mainEntry, char const* ar
return &str;
}
inline char const* BattlegroundMap::ParseStrings(char const* mainString, int32 args)
{
char const* text = sObjectMgr->GetTrinityStringForDBCLocale(args);
char str[1024];
snprintf(str, 1024, mainString, text);
return &str;
}
inline char const* BattlegroundMap::ParseStrings(int32 mainEntry, int32 args1, const char* args2 /*= NULL*/)
{
char const* text = sObjectMgr->GetTrinityStringForDBCLocale(mainEntry);
char const* arg1str = args1 ? sObjectMgr->GetTrinityStringForDBCLocale(args1) : "";
char str[1024];
snprintf(str, 1024, text, arg1str, args2);
return &str;
}
void BattlegroundMap::OnPlayerJoin(Player* player)
{
ASSERT(player);
@@ -283,6 +311,7 @@ void BattlegroundMap::OnPlayerJoin(Player* player)
SendPlayerJoinedPacket(player);)
player->InstanceValid = true;
player->SetBGTeam(player->GetTeamId());
++_participantCount[player->GetBGTeam()];
if (AreTeamsInBalance())
@@ -534,6 +563,15 @@ bool BattlegroundMap::DeleteCreature(uint32 type)
return true;
}
int32 BattlegroundMap::GetObjectType(uint64 const& guid) const
{
for (uint32 i = 0; i < ObjectGUIDsByType.size(); ++i)
if (ObjectGUIDsByType[i] == guid)
return i;
return -1;
}
void BattlegroundMap::UpdatePlayerScore(Player* source, uint32 type, uint32 value, bool addHonor /*= true*/)
{
//this procedure is called from virtual function implemented in bg subclass
@@ -661,3 +699,17 @@ void BattlegroundMap::RewardReputationToTeam(uint32 targetFaction, uint32 amount
if (Player* player = itr->getSource() && player->GetBGTeam() == team)
player->GetReputationMgr().ModifyReputation(targetFaction, amount);
}
void BattlegroundMap::CastSpellOnTeam(uint32 spell, BattlegroundTeamId team)
{
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
if (Player* player = itr->getSource() && player->GetBGTeam() == team)
player->CastSpell(player, spell, true);
}
void BattlegroundMap::RemoveAuraOnTeam(uint32 spell, BattlegroundTeamId team)
{
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
if (Player* player = itr->getSource() && player->GetBGTeam() == team)
player->RemoveAura(spell);
}

View File

@@ -18,6 +18,13 @@
#ifndef TRINITY_BATTLEGROUND_MAP_H
#define TRINITY_BATTLEGROUND_MAP_H
enum BattlegroundTeamId
{
BG_TEAM_ALLIANCE = 0,
BG_TEAM_HORDE = 1,
BG_TEAMS_COUNT = 2
};
#include "BattlegroundTemplate.h"
enum BattlegroundStartTimeIntervals
@@ -197,9 +204,11 @@ class BattlegroundMap : public Map
// Achievement related methods
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry);
// Rewarding related methods
// Team event related methods
void RewardHonorToTeam(uint32 amount, BattlegroundTeamId team);
void RewardReputationToTeam(uint32 targetFaction, uint32 amount, BattlegroundTeamId team);
void CastSpellOnTeam(uint32 spell, BattlegroundTeamId team);
void RemoveAuraOnTeam(uint32 spell, BattlegroundTeamId team);
/* Methods and attributes accessed by subclasses */
// Initialization
@@ -218,8 +227,12 @@ class BattlegroundMap : public Map
void UpdateWorldState(uint32 type, uint32 value);
void SendMessageToAll(int32 entry, ChatMsg type, Unit* source = NULL, Language language = LANG_UNIVERSAL);
void SendMessageToAll(char const* string, ChatMsg type, Unit* source = NULL, Language language = LANG_UNIVERSAL);
char const* ParseStrings(int32 mainEntry, int32 args1, int32 args2);
void PlaySoundToAll(uint32 soundId);
char const* ParseStrings(int32 mainEntry, int32 args1, int32 args2 = 0);
char const* ParseStrings(int32 mainEntry, char const* args1, char const* args2 = NULL);
char const* ParseStrings(int32 mainEntry, int32 args1, const char* args2);
char const* ParseStrings(char* const mainString, int32 args);
// Entity management - GameObject
GameObject* AddGameObject(uint32 type, uint32 entry, float x, float y, float z, float o, float r0, float r1, float r2, float r3, uint32 respawnTime = 0); // Adds GO's to the map but doesn't necessarily spawn them
@@ -237,6 +250,7 @@ class BattlegroundMap : public Map
Creature* GetCreature(uint32 type);
bool DeleteCreature(uint32 type);
int32 GetObjectType(uint64 const& guid) const;
std::vector<uint64> ObjectGUIDsByType; // Stores object GUIDs per enum-defined arbitrary type
// Hooks called after Map methods
@@ -246,6 +260,7 @@ class BattlegroundMap : public Map
// Misc. hooks
virtual void OnPlayerKill(Player* victim, Player* killer) {};
virtual void OnUnitKill(Creature* victim, Player* killer) {};
virtual void OnPlayerResurrect(Player* player) {};
virtual void OnTimeoutReached() { EndBattleground(WINNER_NONE); }; // Must be overwritten for subclasses with bg-specific rules on who wins on a draw
// Status and overridable timers
@@ -263,6 +278,7 @@ class BattlegroundMap : public Map
int32 TeamScores[BG_TEAMS_COUNT]; // Team scores - unused for arena's
uint16 ParticipantCount[BG_TEAMS_COUNT]; // Players actually in the battleground
std::map<uint64, std::vector<uint64>> ReviveQueue; // Spirit Guide guid + Player list GUIDS
private:
// Private initializers, non overridable
void InitVisibilityDistance(); // Overwritten from class Map