[12067] Use world state enum for adding/ remove a state in bg and various cleanups

Thanks to stfc for additional input

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
Shyax 2012-07-22 01:42:10 +02:00 committed by Schmoozerd
parent 3707b04330
commit 759d7f80db
28 changed files with 308 additions and 309 deletions

View file

@ -52,7 +52,7 @@ void BattleGroundAB::Update(uint32 diff)
{
int team_points[BG_TEAMS_COUNT] = { 0, 0 };
for (int node = 0; node < BG_AB_NODES_MAX; ++node)
for (uint8 node = 0; node < BG_AB_NODES_MAX; ++node)
{
// 3 sec delay to spawn new banner instead previous despawned one
if (m_BannerTimers[node].timer)
@ -97,13 +97,13 @@ void BattleGroundAB::Update(uint32 diff)
}
}
for (int team = 0; team < BG_TEAMS_COUNT; ++team)
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
if (m_Nodes[node] == team + BG_AB_NODE_TYPE_OCCUPIED)
++team_points[team];
}
// Accumulate points
for (int team = 0; team < BG_TEAMS_COUNT; ++team)
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
{
int points = team_points[team];
if (!points)
@ -162,13 +162,13 @@ void BattleGroundAB::Update(uint32 diff)
void BattleGroundAB::StartingEventCloseDoors()
{
// despawn buffs
for (int i = 0; i < BG_AB_NODES_MAX * 3; ++i)
for (uint8 i = 0; i < BG_AB_NODES_MAX * 3; ++i)
SpawnBGObject(m_BgObjects[BG_AB_OBJECT_SPEEDBUFF_STABLES + i], RESPAWN_ONE_DAY);
}
void BattleGroundAB::StartingEventOpenDoors()
{
for (int i = 0; i < BG_AB_NODES_MAX; ++i)
for (uint8 i = 0; i < BG_AB_NODES_MAX; ++i)
{
//randomly select buff to spawn
uint8 buff = urand(0, 2);
@ -194,21 +194,21 @@ void BattleGroundAB::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
}
void BattleGroundAB::HandleAreaTrigger(Player* Source, uint32 Trigger)
void BattleGroundAB::HandleAreaTrigger(Player* source, uint32 trigger)
{
switch (Trigger)
switch (trigger)
{
case 3948: // Arathi Basin Alliance Exit.
if (Source->GetTeam() != ALLIANCE)
Source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_ALLIANCE_USE);
if (source->GetTeam() != ALLIANCE)
source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_ALLIANCE_USE);
else
Source->LeaveBattleground();
source->LeaveBattleground();
break;
case 3949: // Arathi Basin Horde Exit.
if (Source->GetTeam() != HORDE)
Source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_HORDE_USE);
if (source->GetTeam() != HORDE)
source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_HORDE_USE);
else
Source->LeaveBattleground();
source->LeaveBattleground();
break;
case 3866: // Stables
case 3869: // Gold Mine
@ -219,8 +219,8 @@ void BattleGroundAB::HandleAreaTrigger(Player* Source, uint32 Trigger)
case 4021: // Unk2
//break;
default:
//sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
//Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
//sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", trigger);
//source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", trigger);
break;
}
}
@ -301,11 +301,11 @@ void BattleGroundAB::_SendNodeUpdate(uint8 node)
const uint8 plusArray[] = {0, 2, 3, 0, 1};
if (m_prevNodes[node])
UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_prevNodes[node]], 0);
UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_prevNodes[node]], WORLD_STATE_REMOVE);
else
UpdateWorldState(BG_AB_OP_NODEICONS[node], 0);
UpdateWorldState(BG_AB_OP_NODEICONS[node], WORLD_STATE_REMOVE);
UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_Nodes[node]], 1);
UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_Nodes[node]], WORLD_STATE_ADD);
// How many bases each team owns
uint8 ally = 0, horde = 0;
@ -444,7 +444,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target
bool BattleGroundAB::SetupBattleGround()
{
//buffs
for (int i = 0; i < BG_AB_NODES_MAX; ++i)
for (uint8 i = 0; i < BG_AB_NODES_MAX; ++i)
{
if (!AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3] / 2), cos(BG_AB_BuffPositions[i][3] / 2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3] / 2), cos(BG_AB_BuffPositions[i][3] / 2), RESPAWN_ONE_DAY)
@ -541,9 +541,9 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
return good_entry;
}
void BattleGroundAB::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
void BattleGroundAB::UpdatePlayerScore(Player* source, uint32 type, uint32 value)
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid());
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
if (itr == m_PlayerScores.end()) // player not found...
return;
@ -556,15 +556,15 @@ void BattleGroundAB::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
((BattleGroundABScore*)itr->second)->BasesDefended += value;
break;
default:
BattleGround::UpdatePlayerScore(Source, type, value);
BattleGround::UpdatePlayerScore(source, type, value);
break;
}
}
bool BattleGroundAB::IsAllNodesConrolledByTeam(Team team) const
bool BattleGroundAB::IsAllNodesControlledByTeam(Team team) const
{
uint32 count = 0;
for (int i = 0; i < BG_AB_NODES_MAX; ++i)
uint8 count = 0;
for (uint8 i = 0; i < BG_AB_NODES_MAX; ++i)
if ((team == ALLIANCE && m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED) ||
(team == HORDE && m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED))
++count;

View file

@ -187,14 +187,14 @@ class BattleGroundAB : public BattleGround
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
void RemovePlayer(Player* plr, ObjectGuid guid);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
void HandleAreaTrigger(Player* source, uint32 trigger);
virtual bool SetupBattleGround();
virtual void Reset();
void EndBattleGround(Team winner);
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
/* Scorekeeping */
virtual void UpdatePlayerScore(Player* Source, uint32 type, uint32 value);
virtual void UpdatePlayerScore(Player* source, uint32 type, uint32 value);
virtual void FillInitialWorldStates(WorldPacket& data, uint32& count);
@ -202,7 +202,7 @@ class BattleGroundAB : public BattleGround
virtual void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj);
/* achievement req. */
bool IsAllNodesConrolledByTeam(Team team) const; // overwrited
bool IsAllNodesControlledByTeam(Team team) const; // overwrited
bool IsTeamScores500Disadvantage(Team team) const { return m_TeamScores500Disadvantage[GetTeamIndexByTeamId(team)]; }
private:
/* Gameobject spawning/despawning */

View file

@ -249,7 +249,7 @@ void BattleGroundAV::Update(uint32 diff)
m_Mine_Timer[mine] -= diff;
if (m_Mine_Timer[mine] <= 0)
{
UpdateScore(BattleGroundTeamIndex(m_Mine_Owner[mine]), 1);
UpdateScore(BattleGroundTeamIndex(m_Mine_Owner[mine]), WORLD_STATE_ADD);
m_Mine_Timer[mine] = BG_AV_MINE_TICK_TIMER;
}
@ -280,8 +280,8 @@ void BattleGroundAV::StartingEventCloseDoors()
void BattleGroundAV::StartingEventOpenDoors()
{
UpdateWorldState(BG_AV_SHOW_H_SCORE, 1);
UpdateWorldState(BG_AV_SHOW_A_SCORE, 1);
UpdateWorldState(BG_AV_SHOW_H_SCORE, WORLD_STATE_ADD);
UpdateWorldState(BG_AV_SHOW_A_SCORE, WORLD_STATE_ADD);
OpenDoorEvent(BG_EVENT_DOOR);
@ -318,14 +318,14 @@ void BattleGroundAV::EndBattleGround(Team winner)
if (m_Nodes[i].State == POINT_CONTROLLED && m_Nodes[i].Owner != BG_AV_TEAM_NEUTRAL)
++graves_owned[m_Nodes[i].Owner];
for (uint32 i = 0; i < BG_AV_MAX_MINES; ++i)
for (uint8 i = 0; i < BG_AV_MAX_MINES; ++i)
if (m_Mine_Owner[i] != BG_AV_TEAM_NEUTRAL)
++mines_owned[m_Mine_Owner[i]];
// now we have the values give the honor/reputation to the teams:
Team team[BG_TEAMS_COUNT] = { ALLIANCE, HORDE };
uint32 faction[BG_TEAMS_COUNT] = { BG_AV_FACTION_A, BG_AV_FACTION_H };
for (uint32 i = 0; i < BG_TEAMS_COUNT; ++i)
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
{
if (tower_survived[i])
{
@ -358,23 +358,23 @@ void BattleGroundAV::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
{
}
void BattleGroundAV::HandleAreaTrigger(Player* Source, uint32 Trigger)
void BattleGroundAV::HandleAreaTrigger(Player* source, uint32 trigger)
{
// this is wrong way to implement these things. On official it done by gameobject spell cast.
switch (Trigger)
switch (trigger)
{
case 95:
case 2608:
if (Source->GetTeam() != ALLIANCE)
Source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_ALLIANCE_USE);
if (source->GetTeam() != ALLIANCE)
source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_ALLIANCE_USE);
else
Source->LeaveBattleground();
source->LeaveBattleground();
break;
case 2606:
if (Source->GetTeam() != HORDE)
Source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_HORDE_USE);
if (source->GetTeam() != HORDE)
source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_HORDE_USE);
else
Source->LeaveBattleground();
source->LeaveBattleground();
break;
case 3326:
case 3327:
@ -382,19 +382,19 @@ void BattleGroundAV::HandleAreaTrigger(Player* Source, uint32 Trigger)
case 3329:
case 3330:
case 3331:
//Source->Unmount();
//source->Unmount();
break;
default:
DEBUG_LOG("BattleGroundAV: WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
// Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
DEBUG_LOG("BattleGroundAV: WARNING: Unhandled AreaTrigger in Battleground: %u", trigger);
// source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", trigger);
break;
}
}
void BattleGroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
void BattleGroundAV::UpdatePlayerScore(Player* source, uint32 type, uint32 value)
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid());
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
if (itr == m_PlayerScores.end()) // player not found...
return;
@ -416,7 +416,7 @@ void BattleGroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
((BattleGroundAVScore*)itr->second)->SecondaryObjectives += value;
break;
default:
BattleGround::UpdatePlayerScore(Source, type, value);
BattleGround::UpdatePlayerScore(source, type, value);
break;
}
}
@ -617,7 +617,7 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, BG_AV_Nodes node)
void BattleGroundAV::FillInitialWorldStates(WorldPacket& data, uint32& count)
{
bool stateok;
for (uint32 i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
for (uint8 i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
{
for (uint8 j = 0; j < BG_AV_MAX_STATES; ++j)
{
@ -630,46 +630,46 @@ void BattleGroundAV::FillInitialWorldStates(WorldPacket& data, uint32& count)
}
if (m_Nodes[BG_AV_NODES_SNOWFALL_GRAVE].Owner == BG_AV_TEAM_NEUTRAL) // cause neutral teams aren't handled generic
FillInitialWorldState(data, count, AV_SNOWFALL_N, 1);
FillInitialWorldState(data, count, AV_SNOWFALL_N, WORLD_STATE_ADD);
FillInitialWorldState(data, count, BG_AV_Alliance_Score, m_TeamScores[BG_TEAM_ALLIANCE]);
FillInitialWorldState(data, count, BG_AV_Horde_Score, m_TeamScores[BG_TEAM_HORDE]);
if (GetStatus() == STATUS_IN_PROGRESS) // only if game is running the teamscores are displayed
{
FillInitialWorldState(data, count, BG_AV_SHOW_A_SCORE, 1);
FillInitialWorldState(data, count, BG_AV_SHOW_H_SCORE, 1);
FillInitialWorldState(data, count, BG_AV_SHOW_A_SCORE, WORLD_STATE_ADD);
FillInitialWorldState(data, count, BG_AV_SHOW_H_SCORE, WORLD_STATE_ADD);
}
else
{
FillInitialWorldState(data, count, BG_AV_SHOW_A_SCORE, 0);
FillInitialWorldState(data, count, BG_AV_SHOW_H_SCORE, 0);
FillInitialWorldState(data, count, BG_AV_SHOW_A_SCORE, WORLD_STATE_REMOVE);
FillInitialWorldState(data, count, BG_AV_SHOW_H_SCORE, WORLD_STATE_REMOVE);
}
FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_NORTH_MINE][m_Mine_Owner[BG_AV_NORTH_MINE]], 1);
FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_NORTH_MINE][m_Mine_Owner[BG_AV_NORTH_MINE]], WORLD_STATE_ADD);
if (m_Mine_Owner[BG_AV_NORTH_MINE] != m_Mine_PrevOwner[BG_AV_NORTH_MINE])
FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_NORTH_MINE][m_Mine_PrevOwner[BG_AV_NORTH_MINE]], 0);
FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_NORTH_MINE][m_Mine_PrevOwner[BG_AV_NORTH_MINE]], WORLD_STATE_REMOVE);
FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_SOUTH_MINE][m_Mine_Owner[BG_AV_SOUTH_MINE]], 1);
FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_SOUTH_MINE][m_Mine_Owner[BG_AV_SOUTH_MINE]], WORLD_STATE_ADD);
if (m_Mine_Owner[BG_AV_SOUTH_MINE] != m_Mine_PrevOwner[BG_AV_SOUTH_MINE])
FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_SOUTH_MINE][m_Mine_PrevOwner[BG_AV_SOUTH_MINE]], 0);
FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_SOUTH_MINE][m_Mine_PrevOwner[BG_AV_SOUTH_MINE]], WORLD_STATE_REMOVE);
}
void BattleGroundAV::UpdateNodeWorldState(BG_AV_Nodes node)
{
UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].State, m_Nodes[node].Owner)], 1);
UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].State, m_Nodes[node].Owner)], WORLD_STATE_ADD);
if (m_Nodes[node].PrevOwner == BG_AV_TEAM_NEUTRAL) // currently only snowfall is supported as neutral node
UpdateWorldState(AV_SNOWFALL_N, 0);
UpdateWorldState(AV_SNOWFALL_N, WORLD_STATE_REMOVE);
else
UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].PrevState, m_Nodes[node].PrevOwner)], 0);
UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].PrevState, m_Nodes[node].PrevOwner)], WORLD_STATE_REMOVE);
}
void BattleGroundAV::SendMineWorldStates(uint32 mine)
{
MANGOS_ASSERT(mine == BG_AV_NORTH_MINE || mine == BG_AV_SOUTH_MINE);
UpdateWorldState(BG_AV_MineWorldStates[mine][m_Mine_Owner[mine]], 1);
UpdateWorldState(BG_AV_MineWorldStates[mine][m_Mine_Owner[mine]], WORLD_STATE_ADD);
if (m_Mine_Owner[mine] != m_Mine_PrevOwner[mine])
UpdateWorldState(BG_AV_MineWorldStates[mine][m_Mine_PrevOwner[mine]], 0);
UpdateWorldState(BG_AV_MineWorldStates[mine][m_Mine_PrevOwner[mine]], WORLD_STATE_REMOVE);
}
WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* plr)

View file

@ -332,12 +332,12 @@ class BattleGroundAV : public BattleGround
virtual void FillInitialWorldStates(WorldPacket& data, uint32& count);
void RemovePlayer(Player* plr, ObjectGuid guid);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
void HandleAreaTrigger(Player* source, uint32 trigger);
virtual void Reset();
/*general stuff*/
void UpdateScore(BattleGroundTeamIndex teamIdx, int32 points);
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value);
void UpdatePlayerScore(Player* source, uint32 type, uint32 value);
/*handle stuff*/ // these are functions which get called from extern scripts
virtual void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj);

View file

@ -108,15 +108,15 @@ bool BattleGroundBE::HandlePlayerUnderMap(Player* player)
return true;
}
void BattleGroundBE::HandleAreaTrigger(Player* Source, uint32 Trigger)
void BattleGroundBE::HandleAreaTrigger(Player* source, uint32 trigger)
{
// this is wrong way to implement these things. On official it done by gameobject spell cast.
if (GetStatus() != STATUS_IN_PROGRESS)
return;
//uint32 SpellId = 0;
//uint32 spellId = 0;
//uint64 buff_guid = 0;
switch (Trigger)
switch (trigger)
{
case 4538: // buff trigger?
//buff_guid = m_BgObjects[BG_BE_OBJECT_BUFF_1];
@ -125,13 +125,13 @@ void BattleGroundBE::HandleAreaTrigger(Player* Source, uint32 Trigger)
//buff_guid = m_BgObjects[BG_BE_OBJECT_BUFF_2];
break;
default:
sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", trigger);
source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", trigger);
break;
}
//if (buff_guid)
// HandleTriggerBuff(buff_guid,Source);
// HandleTriggerBuff(buff_guid, source);
}
void BattleGroundBE::FillInitialWorldStates(WorldPacket& data, uint32& count)
@ -152,15 +152,15 @@ bool BattleGroundBE::SetupBattleGround()
return true;
}
void BattleGroundBE::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
void BattleGroundBE::UpdatePlayerScore(Player* source, uint32 type, uint32 value)
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid());
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
if (itr == m_PlayerScores.end()) // player not found...
return;
//there is nothing special in this score
BattleGround::UpdatePlayerScore(Source, type, value);
BattleGround::UpdatePlayerScore(source, type, value);
}

View file

@ -42,7 +42,7 @@ class BattleGroundBE : public BattleGround
virtual void StartingEventOpenDoors();
void RemovePlayer(Player* plr, ObjectGuid guid);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
void HandleAreaTrigger(Player* source, uint32 trigger);
bool SetupBattleGround();
virtual void Reset();
virtual void FillInitialWorldStates(WorldPacket& d, uint32& count);
@ -50,6 +50,6 @@ class BattleGroundBE : public BattleGround
bool HandlePlayerUnderMap(Player* plr);
/* Scorekeeping */
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value);
void UpdatePlayerScore(Player* source, uint32 type, uint32 value);
};
#endif

View file

@ -71,7 +71,7 @@ void BattleGroundDS::HandleKillPlayer(Player* player, Player* killer)
BattleGround::HandleKillPlayer(player, killer);
}
void BattleGroundDS::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/)
void BattleGroundDS::HandleAreaTrigger(Player* /*source*/, uint32 /*trigger*/)
{
}

View file

@ -43,7 +43,7 @@ class BattleGroundDS : public BattleGround
virtual void StartingEventOpenDoors();
void RemovePlayer(Player* plr, ObjectGuid guid);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
void HandleAreaTrigger(Player* source, uint32 trigger);
bool SetupBattleGround();
void HandleKillPlayer(Player* player, Player* killer);
};

View file

@ -103,7 +103,7 @@ void BattleGroundEY::StartingEventOpenDoors()
// eye-doors are despawned, not opened
SpawnEvent(BG_EVENT_DOOR, 0, false);
for (uint32 i = 0; i < BG_EY_NODES_MAX; ++i)
for (uint8 i = 0; i < BG_EY_NODES_MAX; ++i)
{
//randomly spawn buff
uint8 buff = urand(0, 2);
@ -114,11 +114,11 @@ void BattleGroundEY::StartingEventOpenDoors()
StartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, BG_EY_EVENT_START_BATTLE);
}
void BattleGroundEY::AddPoints(Team team, uint32 Points)
void BattleGroundEY::AddPoints(Team team, uint32 points)
{
BattleGroundTeamIndex team_index = GetTeamIndexByTeamId(team);
m_TeamScores[team_index] += Points;
m_HonorScoreTics[team_index] += Points;
m_TeamScores[team_index] += points;
m_HonorScoreTics[team_index] += points;
if (m_HonorScoreTics[team_index] >= m_HonorTics)
{
RewardHonorToTeam(GetBonusHonorFromKill(1), team);
@ -282,24 +282,24 @@ void BattleGroundEY::UpdatePointsCount(Team team)
UpdateWorldState(EY_HORDE_BASE, m_TeamPointsCount[BG_TEAM_HORDE]);
}
void BattleGroundEY::UpdatePointsIcons(Team team, uint32 Point)
void BattleGroundEY::UpdatePointsIcons(Team team, uint32 point)
{
//we MUST firstly send 0, after that we can send 1!!!
if (m_PointState[Point] == EY_POINT_UNDER_CONTROL)
if (m_PointState[point] == EY_POINT_UNDER_CONTROL)
{
UpdateWorldState(PointsIconStruct[Point].WorldStateControlIndex, 0);
UpdateWorldState(PointsIconStruct[point].WorldStateControlIndex, WORLD_STATE_REMOVE);
if (team == ALLIANCE)
UpdateWorldState(PointsIconStruct[Point].WorldStateAllianceControlledIndex, 1);
UpdateWorldState(PointsIconStruct[point].WorldStateAllianceControlledIndex, WORLD_STATE_ADD);
else
UpdateWorldState(PointsIconStruct[Point].WorldStateHordeControlledIndex, 1);
UpdateWorldState(PointsIconStruct[point].WorldStateHordeControlledIndex, WORLD_STATE_ADD);
}
else
{
if (team == ALLIANCE)
UpdateWorldState(PointsIconStruct[Point].WorldStateAllianceControlledIndex, 0);
UpdateWorldState(PointsIconStruct[point].WorldStateAllianceControlledIndex, WORLD_STATE_REMOVE);
else
UpdateWorldState(PointsIconStruct[Point].WorldStateHordeControlledIndex, 0);
UpdateWorldState(PointsIconStruct[Point].WorldStateControlIndex, 1);
UpdateWorldState(PointsIconStruct[point].WorldStateHordeControlledIndex, WORLD_STATE_REMOVE);
UpdateWorldState(PointsIconStruct[point].WorldStateControlIndex, WORLD_STATE_ADD);
}
}
@ -317,7 +317,7 @@ void BattleGroundEY::AddPlayer(Player* plr)
void BattleGroundEY::RemovePlayer(Player* plr, ObjectGuid guid)
{
// sometimes flag aura not removed :(
for (int j = BG_EY_NODES_MAX; j >= 0; --j)
for (uint8 j = BG_EY_NODES_MAX; j >= 0; --j)
{
for (size_t i = 0; i < m_PlayersNearPoint[j].size(); ++i)
if (m_PlayersNearPoint[j][i] == guid)
@ -338,35 +338,35 @@ void BattleGroundEY::RemovePlayer(Player* plr, ObjectGuid guid)
}
}
void BattleGroundEY::HandleAreaTrigger(Player* Source, uint32 Trigger)
void BattleGroundEY::HandleAreaTrigger(Player* source, uint32 trigger)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
if (!Source->isAlive()) //hack code, must be removed later
if (!source->isAlive()) //hack code, must be removed later
return;
switch (Trigger)
switch (trigger)
{
case TR_BLOOD_ELF_POINT:
if (m_PointState[BG_EY_NODE_BLOOD_ELF] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BG_EY_NODE_BLOOD_ELF] == Source->GetTeam())
if (m_FlagState && GetFlagPickerGuid() == Source->GetObjectGuid())
EventPlayerCapturedFlag(Source, BG_EY_NODE_BLOOD_ELF);
if (m_PointState[BG_EY_NODE_BLOOD_ELF] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BG_EY_NODE_BLOOD_ELF] == source->GetTeam())
if (m_FlagState && GetFlagPickerGuid() == source->GetObjectGuid())
EventPlayerCapturedFlag(source, BG_EY_NODE_BLOOD_ELF);
break;
case TR_FEL_REAVER_POINT:
if (m_PointState[BG_EY_NODE_FEL_REAVER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BG_EY_NODE_FEL_REAVER] == Source->GetTeam())
if (m_FlagState && GetFlagPickerGuid() == Source->GetObjectGuid())
EventPlayerCapturedFlag(Source, BG_EY_NODE_FEL_REAVER);
if (m_PointState[BG_EY_NODE_FEL_REAVER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BG_EY_NODE_FEL_REAVER] == source->GetTeam())
if (m_FlagState && GetFlagPickerGuid() == source->GetObjectGuid())
EventPlayerCapturedFlag(source, BG_EY_NODE_FEL_REAVER);
break;
case TR_MAGE_TOWER_POINT:
if (m_PointState[BG_EY_NODE_MAGE_TOWER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BG_EY_NODE_MAGE_TOWER] == Source->GetTeam())
if (m_FlagState && GetFlagPickerGuid() == Source->GetObjectGuid())
EventPlayerCapturedFlag(Source, BG_EY_NODE_MAGE_TOWER);
if (m_PointState[BG_EY_NODE_MAGE_TOWER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BG_EY_NODE_MAGE_TOWER] == source->GetTeam())
if (m_FlagState && GetFlagPickerGuid() == source->GetObjectGuid())
EventPlayerCapturedFlag(source, BG_EY_NODE_MAGE_TOWER);
break;
case TR_DRAENEI_RUINS_POINT:
if (m_PointState[BG_EY_NODE_DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BG_EY_NODE_DRAENEI_RUINS] == Source->GetTeam())
if (m_FlagState && GetFlagPickerGuid() == Source->GetObjectGuid())
EventPlayerCapturedFlag(Source, BG_EY_NODE_DRAENEI_RUINS);
if (m_PointState[BG_EY_NODE_DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BG_EY_NODE_DRAENEI_RUINS] == source->GetTeam())
if (m_FlagState && GetFlagPickerGuid() == source->GetObjectGuid())
EventPlayerCapturedFlag(source, BG_EY_NODE_DRAENEI_RUINS);
break;
case 4512:
case 4515:
@ -381,8 +381,8 @@ void BattleGroundEY::HandleAreaTrigger(Player* Source, uint32 Trigger)
case 5866:
break;
default:
sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", trigger);
source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", trigger);
break;
}
}
@ -390,7 +390,7 @@ void BattleGroundEY::HandleAreaTrigger(Player* Source, uint32 Trigger)
bool BattleGroundEY::SetupBattleGround()
{
//buffs
for (int i = 0; i < BG_EY_NODES_MAX; ++i)
for (uint8 i = 0; i < BG_EY_NODES_MAX; ++i)
{
AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(m_Points_Trigger[i]);
if (!at)
@ -455,7 +455,7 @@ void BattleGroundEY::RespawnFlag(bool send_message)
PlaySoundToAll(BG_EY_SOUND_FLAG_RESET); // flags respawned sound...
}
UpdateWorldState(NETHERSTORM_FLAG, 1);
UpdateWorldState(NETHERSTORM_FLAG, WORLD_STATE_ADD);
}
void BattleGroundEY::RespawnFlagAfterDrop()
@ -480,16 +480,16 @@ void BattleGroundEY::HandleKillPlayer(Player* player, Player* killer)
EventPlayerDroppedFlag(player);
}
void BattleGroundEY::EventPlayerDroppedFlag(Player* Source)
void BattleGroundEY::EventPlayerDroppedFlag(Player* source)
{
if (GetStatus() != STATUS_IN_PROGRESS)
{
// if not running, do not cast things at the dropper player, neither send unnecessary messages
// just take off the aura
if (IsFlagPickedup() && GetFlagPickerGuid() == Source->GetObjectGuid())
if (IsFlagPickedup() && GetFlagPickerGuid() == source->GetObjectGuid())
{
ClearFlagPicker();
Source->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
source->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
}
return;
}
@ -497,31 +497,31 @@ void BattleGroundEY::EventPlayerDroppedFlag(Player* Source)
if (!IsFlagPickedup())
return;
if (GetFlagPickerGuid() != Source->GetObjectGuid())
if (GetFlagPickerGuid() != source->GetObjectGuid())
return;
ClearFlagPicker();
Source->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
source->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
m_FlagState = BG_EY_FLAG_STATE_ON_GROUND;
m_FlagsTimer = BG_EY_FLAG_RESPAWN_TIME;
Source->CastSpell(Source, SPELL_RECENTLY_DROPPED_FLAG, true);
Source->CastSpell(Source, BG_EY_PLAYER_DROPPED_FLAG_SPELL, true);
source->CastSpell(source, SPELL_RECENTLY_DROPPED_FLAG, true);
source->CastSpell(source, BG_EY_PLAYER_DROPPED_FLAG_SPELL, true);
//this does not work correctly :( (it should remove flag carrier name)
UpdateWorldState(NETHERSTORM_FLAG_STATE_HORDE, BG_EY_FLAG_STATE_WAIT_RESPAWN);
UpdateWorldState(NETHERSTORM_FLAG_STATE_ALLIANCE, BG_EY_FLAG_STATE_WAIT_RESPAWN);
if (Source->GetTeam() == ALLIANCE)
if (source->GetTeam() == ALLIANCE)
SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL);
else
SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL);
}
void BattleGroundEY::EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj)
void BattleGroundEY::EventPlayerClickedOnFlag(Player* source, GameObject* target_obj)
{
if (GetStatus() != STATUS_IN_PROGRESS || IsFlagPickedup() || !Source->IsWithinDistInMap(target_obj, 10))
if (GetStatus() != STATUS_IN_PROGRESS || IsFlagPickedup() || !source->IsWithinDistInMap(target_obj, 10))
return;
if (Source->GetTeam() == ALLIANCE)
if (source->GetTeam() == ALLIANCE)
{
UpdateWorldState(NETHERSTORM_FLAG_STATE_ALLIANCE, BG_EY_FLAG_STATE_ON_PLAYER);
PlaySoundToAll(BG_EY_SOUND_FLAG_PICKED_UP_ALLIANCE);
@ -533,30 +533,30 @@ void BattleGroundEY::EventPlayerClickedOnFlag(Player* Source, GameObject* target
}
if (m_FlagState == BG_EY_FLAG_STATE_ON_BASE)
UpdateWorldState(NETHERSTORM_FLAG, 0);
UpdateWorldState(NETHERSTORM_FLAG, WORLD_STATE_REMOVE);
m_FlagState = BG_EY_FLAG_STATE_ON_PLAYER;
// despawn center-flag
SpawnEvent(BG_EY_EVENT_CAPTURE_FLAG, BG_EY_EVENT2_FLAG_CENTER, false);
SetFlagPicker(Source->GetObjectGuid());
SetFlagPicker(source->GetObjectGuid());
//get flag aura on player
Source->CastSpell(Source, BG_EY_NETHERSTORM_FLAG_SPELL, true);
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
source->CastSpell(source, BG_EY_NETHERSTORM_FLAG_SPELL, true);
source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
if (Source->GetTeam() == ALLIANCE)
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, Source->GetName());
if (source->GetTeam() == ALLIANCE)
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, source->GetName());
else
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL, Source->GetName());
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL, source->GetName());
}
void BattleGroundEY::EventTeamLostPoint(Player* Source, uint32 Point)
void BattleGroundEY::EventTeamLostPoint(Player* source, uint32 point)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
// neutral node
Team team = m_PointOwnedByTeam[Point];
Team team = m_PointOwnedByTeam[point];
if (!team)
return;
@ -568,58 +568,58 @@ void BattleGroundEY::EventTeamLostPoint(Player* Source, uint32 Point)
// it's important to set the OwnedBy before despawning spiritguides, else
// player won't get teleported away
m_PointOwnedByTeam[Point] = TEAM_NONE;
m_PointState[Point] = EY_POINT_NO_OWNER;
m_PointOwnedByTeam[point] = TEAM_NONE;
m_PointState[point] = EY_POINT_NO_OWNER;
SpawnEvent(Point, BG_EYE_NEUTRAL_TEAM, true); // will despawn alliance/horde
SpawnEvent(point, BG_EYE_NEUTRAL_TEAM, true); // will despawn alliance/horde
//buff isn't despawned
if (team == ALLIANCE)
SendMessageToAll(LoosingPointTypes[Point].MessageIdAlliance, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
SendMessageToAll(LoosingPointTypes[point].MessageIdAlliance, CHAT_MSG_BG_SYSTEM_ALLIANCE, source);
else
SendMessageToAll(LoosingPointTypes[Point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE, Source);
SendMessageToAll(LoosingPointTypes[point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE, source);
UpdatePointsIcons(team, Point);
UpdatePointsIcons(team, point);
UpdatePointsCount(team);
}
void BattleGroundEY::EventTeamCapturedPoint(Player* Source, uint32 Point)
void BattleGroundEY::EventTeamCapturedPoint(Player* source, uint32 point)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
Team team = Source->GetTeam();
Team team = source->GetTeam();
++m_TeamPointsCount[GetTeamIndexByTeamId(team)];
SpawnEvent(Point, GetTeamIndexByTeamId(team), true);
SpawnEvent(point, GetTeamIndexByTeamId(team), true);
//buff isn't respawned
m_PointOwnedByTeam[Point] = team;
m_PointState[Point] = EY_POINT_UNDER_CONTROL;
m_PointOwnedByTeam[point] = team;
m_PointState[point] = EY_POINT_UNDER_CONTROL;
if (team == ALLIANCE)
SendMessageToAll(CapturingPointTypes[Point].MessageIdAlliance, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
SendMessageToAll(CapturingPointTypes[point].MessageIdAlliance, CHAT_MSG_BG_SYSTEM_ALLIANCE, source);
else
SendMessageToAll(CapturingPointTypes[Point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE, Source);
SendMessageToAll(CapturingPointTypes[point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE, source);
UpdatePointsIcons(team, Point);
UpdatePointsIcons(team, point);
UpdatePointsCount(team);
}
void BattleGroundEY::EventPlayerCapturedFlag(Player* Source, BG_EY_Nodes node)
void BattleGroundEY::EventPlayerCapturedFlag(Player* source, BG_EY_Nodes node)
{
if (GetStatus() != STATUS_IN_PROGRESS || GetFlagPickerGuid() != Source->GetObjectGuid())
if (GetStatus() != STATUS_IN_PROGRESS || GetFlagPickerGuid() != source->GetObjectGuid())
return;
ClearFlagPicker();
m_FlagState = BG_EY_FLAG_STATE_WAIT_RESPAWN;
Source->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
source->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
if (Source->GetTeam() == ALLIANCE)
if (source->GetTeam() == ALLIANCE)
PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_ALLIANCE);
else
PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_HORDE);
@ -629,26 +629,26 @@ void BattleGroundEY::EventPlayerCapturedFlag(Player* Source, BG_EY_Nodes node)
m_FlagsTimer = BG_EY_FLAG_RESPAWN_TIME;
BattleGroundTeamIndex team_id;
if (Source->GetTeam() == ALLIANCE)
if (source->GetTeam() == ALLIANCE)
{
team_id = BG_TEAM_ALLIANCE;
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_A, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_A, CHAT_MSG_BG_SYSTEM_ALLIANCE, source);
}
else
{
team_id = BG_TEAM_HORDE;
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_H, CHAT_MSG_BG_SYSTEM_HORDE, Source);
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_H, CHAT_MSG_BG_SYSTEM_HORDE, source);
}
if (m_TeamPointsCount[team_id] > 0)
AddPoints(Source->GetTeam(), BG_EY_FlagPoints[m_TeamPointsCount[team_id] - 1]);
AddPoints(source->GetTeam(), BG_EY_FlagPoints[m_TeamPointsCount[team_id] - 1]);
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1);
UpdatePlayerScore(source, SCORE_FLAG_CAPTURES, 1);
}
void BattleGroundEY::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
void BattleGroundEY::UpdatePlayerScore(Player* source, uint32 type, uint32 value)
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid());
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
if (itr == m_PlayerScores.end()) // player not found
return;
@ -658,7 +658,7 @@ void BattleGroundEY::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
((BattleGroundEYScore*)itr->second)->FlagCaptures += value;
break;
default:
BattleGround::UpdatePlayerScore(Source, type, value);
BattleGround::UpdatePlayerScore(source, type, value);
break;
}
}
@ -754,9 +754,9 @@ WorldSafeLocsEntry const* BattleGroundEY::GetClosestGraveYard(Player* player)
return nearestEntry;
}
bool BattleGroundEY::IsAllNodesConrolledByTeam(Team team) const
bool BattleGroundEY::IsAllNodesControlledByTeam(Team team) const
{
for (int i = 0; i < BG_EY_NODES_MAX; ++i)
for (uint8 i = 0; i < BG_EY_NODES_MAX; ++i)
if (m_PointState[i] != EY_POINT_UNDER_CONTROL || m_PointOwnedByTeam[i] != team)
return false;

View file

@ -117,7 +117,7 @@ enum BG_EY_Nodes
};
#define BG_EY_NODES_MAX 4
#define BG_EY_NODES_MAX_WITH_SPEIAL 5
#define BG_EY_NODES_MAX_WITH_SPECIAL 5
// node-events work like this: event1:nodeid, event2:state (0alliance,1horde,2neutral)
#define BG_EYE_NEUTRAL_TEAM 2
@ -265,32 +265,32 @@ class BattleGroundEY : public BattleGround
void RespawnFlagAfterDrop();
void RemovePlayer(Player* plr, ObjectGuid guid);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
void HandleAreaTrigger(Player* source, uint32 trigger);
void HandleKillPlayer(Player* player, Player* killer);
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
virtual bool SetupBattleGround();
virtual void Reset();
void UpdateTeamScore(Team team);
void EndBattleGround(Team winner);
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value);
void UpdatePlayerScore(Player* source, uint32 type, uint32 value);
virtual void FillInitialWorldStates(WorldPacket& data, uint32& count);
void SetDroppedFlagGuid(ObjectGuid guid) { m_DroppedFlagGuid = guid;}
void ClearDroppedFlagGuid() { m_DroppedFlagGuid.Clear();}
ObjectGuid const& GetDroppedFlagGuid() const { return m_DroppedFlagGuid;}
/* Battleground Events */
virtual void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj);
virtual void EventPlayerDroppedFlag(Player* Source);
virtual void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj);
virtual void EventPlayerDroppedFlag(Player* source);
/* achievement req. */
bool IsAllNodesConrolledByTeam(Team team) const;
bool IsAllNodesControlledByTeam(Team team) const;
private:
void EventPlayerCapturedFlag(Player* Source, BG_EY_Nodes node);
void EventTeamCapturedPoint(Player* Source, uint32 Point);
void EventTeamLostPoint(Player* Source, uint32 Point);
void EventPlayerCapturedFlag(Player* source, BG_EY_Nodes node);
void EventTeamCapturedPoint(Player* source, uint32 point);
void EventTeamLostPoint(Player* source, uint32 point);
void UpdatePointsCount(Team team);
void UpdatePointsIcons(Team team, uint32 Point);
void UpdatePointsIcons(Team team, uint32 point);
/* Point status updating procedures */
void CheckSomeoneLeftPoint();
@ -299,10 +299,10 @@ class BattleGroundEY : public BattleGround
/* Scorekeeping */
uint32 GetTeamScore(Team team) const { return m_TeamScores[GetTeamIndexByTeamId(team)]; }
void AddPoints(Team team, uint32 Points);
void AddPoints(Team team, uint32 points);
void RemovePoint(Team team, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(team)] -= Points; }
void SetTeamPoint(Team team, uint32 Points = 0) { m_TeamScores[GetTeamIndexByTeamId(team)] = Points; }
void RemovePoint(Team team, uint32 points = 1) { m_TeamScores[GetTeamIndexByTeamId(team)] -= points; }
void SetTeamPoint(Team team, uint32 points = 0) { m_TeamScores[GetTeamIndexByTeamId(team)] = points; }
uint32 m_HonorScoreTics[2];
uint32 m_TeamPointsCount[BG_TEAMS_COUNT];
@ -318,7 +318,7 @@ class BattleGroundEY : public BattleGround
Team m_PointOwnedByTeam[BG_EY_NODES_MAX];
uint8 m_PointState[BG_EY_NODES_MAX];
int32 m_PointBarStatus[BG_EY_NODES_MAX];
GuidVector m_PlayersNearPoint[BG_EY_NODES_MAX_WITH_SPEIAL];
GuidVector m_PlayersNearPoint[BG_EY_NODES_MAX_WITH_SPECIAL];
uint8 m_CurrentPointPlayersCount[2 * BG_EY_NODES_MAX];
int32 m_PointAddingTimer;

View file

@ -62,20 +62,20 @@ void BattleGroundIC::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
}
void BattleGroundIC::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/)
void BattleGroundIC::HandleAreaTrigger(Player* /*source*/, uint32 /*trigger*/)
{
// this is wrong way to implement these things. On official it done by gameobject spell cast.
if (GetStatus() != STATUS_IN_PROGRESS)
return;
}
void BattleGroundIC::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
void BattleGroundIC::UpdatePlayerScore(Player* source, uint32 type, uint32 value)
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid());
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
if (itr == m_PlayerScores.end()) // player not found...
return;
BattleGround::UpdatePlayerScore(Source, type, value);
BattleGround::UpdatePlayerScore(source, type, value);
}

View file

@ -43,11 +43,11 @@ class BattleGroundIC : public BattleGround
virtual void StartingEventOpenDoors();
void RemovePlayer(Player* plr, ObjectGuid guid);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
void HandleAreaTrigger(Player* source, uint32 trigger);
//bool SetupBattleGround();
/* Scorekeeping */
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value);
void UpdatePlayerScore(Player* source, uint32 type, uint32 value);
private:
};

View file

@ -53,13 +53,13 @@ INSTANTIATE_SINGLETON_1(BattleGroundMgr);
BattleGroundQueue::BattleGroundQueue()
{
for (uint32 i = 0; i < BG_TEAMS_COUNT; ++i)
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
{
for (uint32 j = 0; j < MAX_BATTLEGROUND_BRACKETS; ++j)
for (uint8 j = 0; j < MAX_BATTLEGROUND_BRACKETS; ++j)
{
m_SumOfWaitTimes[i][j] = 0;
m_WaitTimeLastPlayer[i][j] = 0;
for (uint32 k = 0; k < COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME; ++k)
for (uint8 k = 0; k < COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME; ++k)
m_WaitTimes[i][j][k] = 0;
}
}
@ -68,9 +68,9 @@ BattleGroundQueue::BattleGroundQueue()
BattleGroundQueue::~BattleGroundQueue()
{
m_QueuedPlayers.clear();
for (int i = 0; i < MAX_BATTLEGROUND_BRACKETS; ++i)
for (uint8 i = 0; i < MAX_BATTLEGROUND_BRACKETS; ++i)
{
for (uint32 j = 0; j < BG_QUEUE_GROUP_TYPES_COUNT; ++j)
for (uint8 j = 0; j < BG_QUEUE_GROUP_TYPES_COUNT; ++j)
{
for (GroupsQueueType::iterator itr = m_QueuedGroups[i][j].begin(); itr != m_QueuedGroups[i][j].end(); ++itr)
delete(*itr);
@ -324,11 +324,11 @@ void BattleGroundQueue::RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount)
// variable index removes useless searching in other team's queue
uint32 index = BattleGround::GetTeamIndexByTeamId(group->GroupTeam);
for (int32 bracket_id_tmp = MAX_BATTLEGROUND_BRACKETS - 1; bracket_id_tmp >= 0 && bracket_id == -1; --bracket_id_tmp)
for (int8 bracket_id_tmp = MAX_BATTLEGROUND_BRACKETS - 1; bracket_id_tmp >= 0 && bracket_id == -1; --bracket_id_tmp)
{
//we must check premade and normal team's queue - because when players from premade are joining bg,
//they leave groupinfo so we can't use its players size to find out index
for (uint32 j = index; j < BG_QUEUE_GROUP_TYPES_COUNT; j += BG_QUEUE_NORMAL_ALLIANCE)
for (uint8 j = index; j < BG_QUEUE_GROUP_TYPES_COUNT; j += BG_QUEUE_NORMAL_ALLIANCE)
{
for (group_itr_tmp = m_QueuedGroups[bracket_id_tmp][j].begin(); group_itr_tmp != m_QueuedGroups[bracket_id_tmp][j].end(); ++group_itr_tmp)
{
@ -609,7 +609,7 @@ bool BattleGroundQueue::CheckPremadeMatch(BattleGroundBracketId bracket_id, uint
//add groups/players from normal queue to size of bigger group
uint32 maxPlayers = std::max(m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount(), m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount());
GroupsQueueType::const_iterator itr;
for (uint32 i = 0; i < BG_TEAMS_COUNT; ++i)
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
{
for (itr = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].begin(); itr != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].end(); ++itr)
{
@ -627,7 +627,7 @@ bool BattleGroundQueue::CheckPremadeMatch(BattleGroundBracketId bracket_id, uint
// if first is invited to BG and seconds timer expired, but we can ignore it, because players have only 80 seconds to click to enter bg
// and when they click or after 80 seconds the queue info is removed from queue
uint32 time_before = WorldTimer::getMSTime() - sWorld.getConfig(CONFIG_UINT32_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH);
for (uint32 i = 0; i < BG_TEAMS_COUNT; ++i)
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
{
if (!m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE + i].empty())
{
@ -648,7 +648,7 @@ bool BattleGroundQueue::CheckPremadeMatch(BattleGroundBracketId bracket_id, uint
bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BattleGroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers)
{
GroupsQueueType::const_iterator itr_team[BG_TEAMS_COUNT];
for (uint32 i = 0; i < BG_TEAMS_COUNT; ++i)
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
{
itr_team[i] = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].begin();
for (; itr_team[i] != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].end(); ++(itr_team[i]))
@ -863,7 +863,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
return;
}
//invite those selection pools
for (uint32 i = 0; i < BG_TEAMS_COUNT; ++i)
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
for (GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr)
InviteGroupToBG((*citr), bg2, (*citr)->GroupTeam);
//start bg
@ -890,7 +890,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
}
// invite those selection pools
for (uint32 i = 0; i < BG_TEAMS_COUNT; ++i)
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
for (GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr)
InviteGroupToBG((*citr), bg2, (*citr)->GroupTeam);
// start bg
@ -940,7 +940,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
//optimalization : --- we dont need to use selection_pools - each update we select max 2 groups
for (uint32 i = BG_QUEUE_PREMADE_ALLIANCE; i < BG_QUEUE_NORMAL_ALLIANCE; ++i)
for (uint8 i = BG_QUEUE_PREMADE_ALLIANCE; i < BG_QUEUE_NORMAL_ALLIANCE; ++i)
{
// take the group that joined first
itr_team[i] = m_QueuedGroups[bracket_id][i].begin();
@ -1127,7 +1127,7 @@ void BGQueueRemoveEvent::Abort(uint64 /*e_time*/)
BattleGroundMgr::BattleGroundMgr() : m_AutoDistributionTimeChecker(0), m_ArenaTesting(false)
{
for (uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; ++i)
for (uint8 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; ++i)
m_BattleGrounds[i].clear();
m_NextRatingDiscardUpdate = sWorld.getConfig(CONFIG_UINT32_ARENA_RATING_DISCARD_TIMER);
m_Testing = false;
@ -1141,7 +1141,7 @@ BattleGroundMgr::~BattleGroundMgr()
void BattleGroundMgr::DeleteAllBattleGrounds()
{
// will also delete template bgs:
for (uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; ++i)
for (uint8 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; ++i)
{
for (BattleGroundSet::iterator itr = m_BattleGrounds[i].begin(); itr != m_BattleGrounds[i].end();)
{
@ -1187,8 +1187,8 @@ void BattleGroundMgr::Update(uint32 diff)
{
// forced update for rated arenas (scan all, but skipped non rated)
DEBUG_LOG("BattleGroundMgr: UPDATING ARENA QUEUES");
for (int qtype = BATTLEGROUND_QUEUE_2v2; qtype <= BATTLEGROUND_QUEUE_5v5; ++qtype)
for (int bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
for (uint8 qtype = BATTLEGROUND_QUEUE_2v2; qtype <= BATTLEGROUND_QUEUE_5v5; ++qtype)
for (uint8 bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
m_BattleGroundQueues[qtype].Update(
BATTLEGROUND_AA, BattleGroundBracketId(bracket),
BattleGroundMgr::BGArenaType(BattleGroundQueueTypeId(qtype)), true, 0);
@ -1272,7 +1272,7 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket* data, BattleGround* bg)
if (type) // arena
{
// it seems this must be according to BG_WINNER_A/H and _NOT_ BG_TEAM_A/H
for (int i = 1; i >= 0; --i)
for (uint8 i = 1; i >= 0; --i)
{
uint32 pointsLost = bg->m_ArenaTeamRatingChanges[i] < 0 ? abs(bg->m_ArenaTeamRatingChanges[i]) : 0;
uint32 pointsGained = bg->m_ArenaTeamRatingChanges[i] > 0 ? bg->m_ArenaTeamRatingChanges[i] : 0;
@ -1282,7 +1282,7 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket* data, BattleGround* bg)
*data << uint32(0); // Matchmaking Value
DEBUG_LOG("rating change: %d", bg->m_ArenaTeamRatingChanges[i]);
}
for (int i = 1; i >= 0; --i)
for (uint8 i = 1; i >= 0; --i)
{
uint32 at_id = bg->m_ArenaTeamIds[i];
ArenaTeam* at = sObjectMgr.GetArenaTeamById(at_id);
@ -1430,7 +1430,7 @@ BattleGround* BattleGroundMgr::GetBattleGround(uint32 InstanceID, BattleGroundTy
BattleGroundSet::iterator itr;
if (bgTypeId == BATTLEGROUND_TYPE_NONE)
{
for (uint32 i = BATTLEGROUND_AV; i < MAX_BATTLEGROUND_TYPE_ID; ++i)
for (uint8 i = BATTLEGROUND_AV; i < MAX_BATTLEGROUND_TYPE_ID; ++i)
{
itr = m_BattleGrounds[i].find(InstanceID);
if (itr != m_BattleGrounds[i].end())

View file

@ -109,26 +109,26 @@ bool BattleGroundNA::HandlePlayerUnderMap(Player* player)
return true;
}
void BattleGroundNA::HandleAreaTrigger(Player* Source, uint32 Trigger)
void BattleGroundNA::HandleAreaTrigger(Player* source, uint32 trigger)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
//uint32 SpellId = 0;
//uint32 spellId = 0;
//uint64 buff_guid = 0;
switch (Trigger)
switch (trigger)
{
case 4536: // buff trigger?
case 4537: // buff trigger?
break;
default:
sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", trigger);
source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", trigger);
break;
}
//if (buff_guid)
// HandleTriggerBuff(buff_guid,Source);
// HandleTriggerBuff(buff_guid, source);
}
void BattleGroundNA::FillInitialWorldStates(WorldPacket& data, uint32& count)

View file

@ -43,7 +43,7 @@ class BattleGroundNA : public BattleGround
virtual void StartingEventOpenDoors();
void RemovePlayer(Player* plr, ObjectGuid guid);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
void HandleAreaTrigger(Player* source, uint32 trigger);
bool SetupBattleGround();
virtual void Reset();
virtual void FillInitialWorldStates(WorldPacket& d, uint32& count);

View file

@ -62,20 +62,20 @@ void BattleGroundRB::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
}
void BattleGroundRB::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/)
void BattleGroundRB::HandleAreaTrigger(Player* /*source*/, uint32 /*trigger*/)
{
// this is wrong way to implement these things. On official it done by gameobject spell cast.
if (GetStatus() != STATUS_IN_PROGRESS)
return;
}
void BattleGroundRB::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
void BattleGroundRB::UpdatePlayerScore(Player* source, uint32 type, uint32 value)
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid());
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
if (itr == m_PlayerScores.end()) // player not found...
return;
BattleGround::UpdatePlayerScore(Source, type, value);
BattleGround::UpdatePlayerScore(source, type, value);
}

View file

@ -43,11 +43,11 @@ class BattleGroundRB : public BattleGround
virtual void StartingEventOpenDoors();
void RemovePlayer(Player* plr, ObjectGuid guid);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
void HandleAreaTrigger(Player* source, uint32 trigger);
//bool SetupBattleGround();
/* Scorekeeping */
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value);
void UpdatePlayerScore(Player* source, uint32 type, uint32 value);
private:
};

View file

@ -108,27 +108,27 @@ bool BattleGroundRL::HandlePlayerUnderMap(Player* player)
return true;
}
void BattleGroundRL::HandleAreaTrigger(Player* Source, uint32 Trigger)
void BattleGroundRL::HandleAreaTrigger(Player* source, uint32 trigger)
{
// this is wrong way to implement these things. On official it done by gameobject spell cast.
if (GetStatus() != STATUS_IN_PROGRESS)
return;
//uint32 SpellId = 0;
//uint32 spellId = 0;
//uint64 buff_guid = 0;
switch (Trigger)
switch (trigger)
{
case 4696: // buff trigger?
case 4697: // buff trigger?
break;
default:
sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", trigger);
source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", trigger);
break;
}
//if (buff_guid)
// HandleTriggerBuff(buff_guid,Source);
// HandleTriggerBuff(buff_guid, source);
}
void BattleGroundRL::FillInitialWorldStates(WorldPacket& data, uint32& count)

View file

@ -45,7 +45,7 @@ class BattleGroundRL : public BattleGround
virtual void StartingEventOpenDoors();
void RemovePlayer(Player* plr, ObjectGuid guid);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
void HandleAreaTrigger(Player* source, uint32 trigger);
bool SetupBattleGround();
void HandleKillPlayer(Player* player, Player* killer);
bool HandlePlayerUnderMap(Player* plr);

View file

@ -71,7 +71,7 @@ void BattleGroundRV::HandleKillPlayer(Player* player, Player* killer)
BattleGround::HandleKillPlayer(player, killer);
}
void BattleGroundRV::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/)
void BattleGroundRV::HandleAreaTrigger(Player* /*source*/, uint32 /*trigger*/)
{
}

View file

@ -43,7 +43,7 @@ class BattleGroundRV : public BattleGround
virtual void StartingEventOpenDoors();
void RemovePlayer(Player* plr, ObjectGuid guid);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
void HandleAreaTrigger(Player* source, uint32 trigger);
bool SetupBattleGround();
void HandleKillPlayer(Player* player, Player* killer);
};

View file

@ -62,19 +62,19 @@ void BattleGroundSA::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
}
void BattleGroundSA::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/)
void BattleGroundSA::HandleAreaTrigger(Player* /*source*/, uint32 /*trigger*/)
{
// this is wrong way to implement these things. On official it done by gameobject spell cast.
if (GetStatus() != STATUS_IN_PROGRESS)
return;
}
void BattleGroundSA::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
void BattleGroundSA::UpdatePlayerScore(Player* source, uint32 type, uint32 value)
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid());
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
if (itr == m_PlayerScores.end()) // player not found...
return;
BattleGround::UpdatePlayerScore(Source, type, value);
BattleGround::UpdatePlayerScore(source, type, value);
}

View file

@ -46,11 +46,11 @@ class BattleGroundSA : public BattleGround
virtual void StartingEventOpenDoors();
void RemovePlayer(Player* plr, ObjectGuid guid);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
void HandleAreaTrigger(Player* source, uint32 trigger);
//bool SetupBattleGround();
/* Scorekeeping */
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value);
void UpdatePlayerScore(Player* source, uint32 type, uint32 value);
private:
};

View file

@ -188,17 +188,17 @@ void BattleGroundWS::RespawnFlagAfterDrop(Team team)
ClearDroppedFlagGuid(team);
}
void BattleGroundWS::EventPlayerCapturedFlag(Player* Source)
void BattleGroundWS::EventPlayerCapturedFlag(Player* source)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
m_LastCapturedFlagTeam = Source->GetTeam();
m_LastCapturedFlagTeam = source->GetTeam();
Team winner = TEAM_NONE;
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
if (Source->GetTeam() == ALLIANCE)
source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
if (source->GetTeam() == ALLIANCE)
{
if (!IsHordeFlagPickedup())
return;
@ -206,7 +206,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player* Source)
// horde flag in base (but not respawned yet)
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Horde Flag from Player
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
AddPoint(ALLIANCE, 1);
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE);
@ -220,28 +220,28 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player* Source)
// alliance flag in base (but not respawned yet)
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Alliance Flag from Player
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
AddPoint(HORDE, 1);
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE);
RewardReputationToTeam(889, m_ReputationCapture, HORDE);
}
//for flag capture is reward 2 honorable kills
RewardHonorToTeam(GetBonusHonorFromKill(2), Source->GetTeam());
RewardHonorToTeam(GetBonusHonorFromKill(2), source->GetTeam());
// despawn flags
SpawnEvent(WS_EVENT_FLAG_A, 0, false);
SpawnEvent(WS_EVENT_FLAG_H, 0, false);
if (Source->GetTeam() == ALLIANCE)
SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
if (source->GetTeam() == ALLIANCE)
SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, source);
else
SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, Source);
SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, source);
UpdateFlagState(Source->GetTeam(), 1); // flag state none
UpdateTeamScore(Source->GetTeam());
UpdateFlagState(source->GetTeam(), 1); // flag state none
UpdateTeamScore(source->GetTeam());
// only flag capture should be updated
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
UpdatePlayerScore(source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
winner = ALLIANCE;
@ -260,34 +260,34 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player* Source)
}
else
{
m_FlagsTimer[GetOtherTeamIndex(GetTeamIndexByTeamId(Source->GetTeam()))] = BG_WS_FLAG_RESPAWN_TIME;
m_FlagsTimer[GetOtherTeamIndex(GetTeamIndexByTeamId(source->GetTeam()))] = BG_WS_FLAG_RESPAWN_TIME;
}
}
void BattleGroundWS::EventPlayerDroppedFlag(Player* Source)
void BattleGroundWS::EventPlayerDroppedFlag(Player* source)
{
if (GetStatus() != STATUS_IN_PROGRESS)
{
// if not running, do not cast things at the dropper player (prevent spawning the "dropped" flag), neither send unnecessary messages
// just take off the aura
if (Source->GetTeam() == ALLIANCE)
if (source->GetTeam() == ALLIANCE)
{
if (!IsHordeFlagPickedup())
return;
if (GetHordeFlagPickerGuid() == Source->GetObjectGuid())
if (GetHordeFlagPickerGuid() == source->GetObjectGuid())
{
ClearHordeFlagPicker();
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
}
}
else
{
if (!IsAllianceFlagPickedup())
return;
if (GetAllianceFlagPickerGuid() == Source->GetObjectGuid())
if (GetAllianceFlagPickerGuid() == source->GetObjectGuid())
{
ClearAllianceFlagPicker();
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
}
}
return;
@ -295,16 +295,16 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player* Source)
bool set = false;
if (Source->GetTeam() == ALLIANCE)
if (source->GetTeam() == ALLIANCE)
{
if (!IsHordeFlagPickedup())
return;
if (GetHordeFlagPickerGuid() == Source->GetObjectGuid())
if (GetHordeFlagPickerGuid() == source->GetObjectGuid())
{
ClearHordeFlagPicker();
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_GROUND;
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true);
source->CastSpell(source, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true);
set = true;
}
}
@ -312,37 +312,37 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player* Source)
{
if (!IsAllianceFlagPickedup())
return;
if (GetAllianceFlagPickerGuid() == Source->GetObjectGuid())
if (GetAllianceFlagPickerGuid() == source->GetObjectGuid())
{
ClearAllianceFlagPicker();
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_GROUND;
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true);
source->CastSpell(source, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true);
set = true;
}
}
if (set)
{
Source->CastSpell(Source, SPELL_RECENTLY_DROPPED_FLAG, true);
UpdateFlagState(Source->GetTeam(), 1);
source->CastSpell(source, SPELL_RECENTLY_DROPPED_FLAG, true);
UpdateFlagState(source->GetTeam(), 1);
if (Source->GetTeam() == ALLIANCE)
if (source->GetTeam() == ALLIANCE)
{
SendMessageToAll(LANG_BG_WS_DROPPED_HF, CHAT_MSG_BG_SYSTEM_HORDE, Source);
SendMessageToAll(LANG_BG_WS_DROPPED_HF, CHAT_MSG_BG_SYSTEM_HORDE, source);
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, uint32(-1));
}
else
{
SendMessageToAll(LANG_BG_WS_DROPPED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
SendMessageToAll(LANG_BG_WS_DROPPED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, source);
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, uint32(-1));
}
m_FlagsDropTimer[GetOtherTeamIndex(GetTeamIndexByTeamId(Source->GetTeam()))] = BG_WS_FLAG_DROP_TIME;
m_FlagsDropTimer[GetOtherTeamIndex(GetTeamIndexByTeamId(source->GetTeam()))] = BG_WS_FLAG_DROP_TIME;
}
}
void BattleGroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj)
void BattleGroundWS::EventPlayerClickedOnFlag(Player* source, GameObject* target_obj)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
@ -353,48 +353,48 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
uint8 event = (sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetGUIDLow())).event1;
//alliance flag picked up from base
if (Source->GetTeam() == HORDE && GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE
if (source->GetTeam() == HORDE && GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE
&& event == WS_EVENT_FLAG_A)
{
message_id = LANG_BG_WS_PICKEDUP_AF;
type = CHAT_MSG_BG_SYSTEM_HORDE;
PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP);
SpawnEvent(WS_EVENT_FLAG_A, 0, false);
SetAllianceFlagPicker(Source->GetObjectGuid());
SetAllianceFlagPicker(source->GetObjectGuid());
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
//update world state to show correct flag carrier
UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1);
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG, true);
source->CastSpell(source, BG_WS_SPELL_SILVERWING_FLAG, true);
}
//horde flag picked up from base
if (Source->GetTeam() == ALLIANCE && GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE
if (source->GetTeam() == ALLIANCE && GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE
&& event == WS_EVENT_FLAG_H)
{
message_id = LANG_BG_WS_PICKEDUP_HF;
type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP);
SpawnEvent(WS_EVENT_FLAG_H, 0, false);
SetHordeFlagPicker(Source->GetObjectGuid());
SetHordeFlagPicker(source->GetObjectGuid());
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER;
//update world state to show correct flag carrier
UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER);
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1);
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG, true);
source->CastSpell(source, BG_WS_SPELL_WARSONG_FLAG, true);
}
//Alliance flag on ground(not in base) (returned or picked up again from ground!)
if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10))
if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && source->IsWithinDistInMap(target_obj, 10))
{
if (Source->GetTeam() == ALLIANCE)
if (source->GetTeam() == ALLIANCE)
{
message_id = LANG_BG_WS_RETURNED_AF;
type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
UpdateFlagState(HORDE, BG_WS_FLAG_STATE_WAIT_RESPAWN);
RespawnFlag(ALLIANCE, false);
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
UpdatePlayerScore(Source, SCORE_FLAG_RETURNS, 1);
UpdatePlayerScore(source, SCORE_FLAG_RETURNS, 1);
}
else
{
@ -402,8 +402,8 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
type = CHAT_MSG_BG_SYSTEM_HORDE;
PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP);
SpawnEvent(WS_EVENT_FLAG_A, 0, false);
SetAllianceFlagPicker(Source->GetObjectGuid());
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG, true);
SetAllianceFlagPicker(source->GetObjectGuid());
source->CastSpell(source, BG_WS_SPELL_SILVERWING_FLAG, true);
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1);
@ -413,16 +413,16 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
}
//Horde flag on ground(not in base) (returned or picked up again)
if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10))
if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && source->IsWithinDistInMap(target_obj, 10))
{
if (Source->GetTeam() == HORDE)
if (source->GetTeam() == HORDE)
{
message_id = LANG_BG_WS_RETURNED_HF;
type = CHAT_MSG_BG_SYSTEM_HORDE;
UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_WAIT_RESPAWN);
RespawnFlag(HORDE, false);
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
UpdatePlayerScore(Source, SCORE_FLAG_RETURNS, 1);
UpdatePlayerScore(source, SCORE_FLAG_RETURNS, 1);
}
else
{
@ -430,8 +430,8 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP);
SpawnEvent(WS_EVENT_FLAG_H, 0, false);
SetHordeFlagPicker(Source->GetObjectGuid());
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG, true);
SetHordeFlagPicker(source->GetObjectGuid());
source->CastSpell(source, BG_WS_SPELL_WARSONG_FLAG, true);
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER;
UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER);
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1);
@ -443,8 +443,8 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
if (!message_id)
return;
SendMessageToAll(message_id, type, Source);
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
SendMessageToAll(message_id, type, source);
source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
}
void BattleGroundWS::RemovePlayer(Player* plr, ObjectGuid guid)
@ -490,7 +490,7 @@ void BattleGroundWS::UpdateTeamScore(Team team)
UpdateWorldState(BG_WS_FLAG_CAPTURES_HORDE, GetTeamScore(team));
}
void BattleGroundWS::HandleAreaTrigger(Player* Source, uint32 Trigger)
void BattleGroundWS::HandleAreaTrigger(Player* source, uint32 trigger)
{
// this is wrong way to implement these things. On official it done by gameobject spell cast.
if (GetStatus() != STATUS_IN_PROGRESS)
@ -498,7 +498,7 @@ void BattleGroundWS::HandleAreaTrigger(Player* Source, uint32 Trigger)
//uint32 SpellId = 0;
//uint64 buff_guid = 0;
switch (Trigger)
switch (trigger)
{
case 3686: // Alliance elixir of speed spawn. Trigger not working, because located inside other areatrigger, can be replaced by IsWithinDist(object, dist) in BattleGround::Update().
case 3687: // Horde elixir of speed spawn. Trigger not working, because located inside other areatrigger, can be replaced by IsWithinDist(object, dist) in BattleGround::Update().
@ -509,13 +509,13 @@ void BattleGroundWS::HandleAreaTrigger(Player* Source, uint32 Trigger)
break;
case 3646: // Alliance Flag spawn
if (m_FlagState[BG_TEAM_HORDE] && !m_FlagState[BG_TEAM_ALLIANCE])
if (GetHordeFlagPickerGuid() == Source->GetObjectGuid())
EventPlayerCapturedFlag(Source);
if (GetHordeFlagPickerGuid() == source->GetObjectGuid())
EventPlayerCapturedFlag(source);
break;
case 3647: // Horde Flag spawn
if (m_FlagState[BG_TEAM_ALLIANCE] && !m_FlagState[BG_TEAM_HORDE])
if (GetAllianceFlagPickerGuid() == Source->GetObjectGuid())
EventPlayerCapturedFlag(Source);
if (GetAllianceFlagPickerGuid() == source->GetObjectGuid())
EventPlayerCapturedFlag(source);
break;
case 3649: // unk1
case 3688: // unk2
@ -523,8 +523,8 @@ void BattleGroundWS::HandleAreaTrigger(Player* Source, uint32 Trigger)
case 4629: // unk4
break;
default:
sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", trigger);
source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", trigger);
break;
}
}
@ -544,7 +544,7 @@ void BattleGroundWS::Reset()
m_ActiveEvents[WS_EVENT_FLAG_A] = BG_EVENT_NONE;
m_ActiveEvents[WS_EVENT_FLAG_H] = BG_EVENT_NONE;
for (uint32 i = 0; i < BG_TEAMS_COUNT; ++i)
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
{
m_DroppedFlagGuid[i].Clear();
m_FlagKeepers[i].Clear();
@ -584,10 +584,10 @@ void BattleGroundWS::HandleKillPlayer(Player* player, Player* killer)
BattleGround::HandleKillPlayer(player, killer);
}
void BattleGroundWS::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
void BattleGroundWS::UpdatePlayerScore(Player* source, uint32 type, uint32 value)
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid());
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
if (itr == m_PlayerScores.end()) // player not found
return;
@ -600,7 +600,7 @@ void BattleGroundWS::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
((BattleGroundWGScore*)itr->second)->FlagReturns += value;
break;
default:
BattleGround::UpdatePlayerScore(Source, type, value);
BattleGround::UpdatePlayerScore(source, type, value);
break;
}
}
@ -659,6 +659,6 @@ void BattleGroundWS::FillInitialWorldStates(WorldPacket& data, uint32& count)
else
FillInitialWorldState(data, count, BG_WS_FLAG_STATE_ALLIANCE, 1);
FillInitialWorldState(data, count, BG_WS_TIME_ENABLED, 1);
FillInitialWorldState(data, count, BG_WS_TIME_ENABLED, WORLD_STATE_ADD);
FillInitialWorldState(data, count, BG_WS_TIME_REMAINING, GetRemainingTimeInMinutes());
}

View file

@ -123,12 +123,12 @@ class BattleGroundWS : public BattleGround
uint8 GetFlagState(Team team) { return m_FlagState[GetTeamIndexByTeamId(team)]; }
/* Battleground Events */
virtual void EventPlayerDroppedFlag(Player* Source);
virtual void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj);
virtual void EventPlayerCapturedFlag(Player* Source);
virtual void EventPlayerDroppedFlag(Player* source);
virtual void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj);
virtual void EventPlayerCapturedFlag(Player* source);
void RemovePlayer(Player* plr, ObjectGuid guid);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
void HandleAreaTrigger(Player* source, uint32 trigger);
void HandleKillPlayer(Player* player, Player* killer);
bool SetupBattleGround();
virtual void Reset();
@ -138,7 +138,7 @@ class BattleGroundWS : public BattleGround
void UpdateFlagState(Team team, uint32 value);
void UpdateTeamScore(Team team);
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value);
void UpdatePlayerScore(Player* source, uint32 type, uint32 value);
void SetDroppedFlagGuid(ObjectGuid guid, Team team) { m_DroppedFlagGuid[GetTeamIndexByTeamId(team)] = guid;}
void ClearDroppedFlagGuid(Team team) { m_DroppedFlagGuid[GetTeamIndexByTeamId(team)].Clear();}
ObjectGuid const& GetDroppedFlagGuid(Team team) const { return m_DroppedFlagGuid[GetTeamIndexByTeamId(team)];}
@ -146,9 +146,9 @@ class BattleGroundWS : public BattleGround
/* Scorekeeping */
uint32 GetTeamScore(Team team) const { return m_TeamScores[GetTeamIndexByTeamId(team)]; }
void AddPoint(Team team, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(team)] += Points; }
void SetTeamPoint(Team team, uint32 Points = 0) { m_TeamScores[GetTeamIndexByTeamId(team)] = Points; }
void RemovePoint(Team team, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(team)] -= Points; }
void AddPoint(Team team, uint32 points = 1) { m_TeamScores[GetTeamIndexByTeamId(team)] += points; }
void SetTeamPoint(Team team, uint32 points = 0) { m_TeamScores[GetTeamIndexByTeamId(team)] = points; }
void RemovePoint(Team team, uint32 points = 1) { m_TeamScores[GetTeamIndexByTeamId(team)] -= points; }
private:
ObjectGuid m_FlagKeepers[BG_TEAMS_COUNT];

View file

@ -595,13 +595,6 @@ enum LootState
GO_JUST_DEACTIVATED
};
// TODO: Move this somewhere else
enum WorldStateType
{
WORLD_STATE_REMOVE = 0,
WORLD_STATE_ADD = 1
};
enum CapturePointState
{
CAPTURE_STATE_NEUTRAL = 0,

View file

@ -2941,6 +2941,12 @@ enum EncounterCreditType
ENCOUNTER_CREDIT_CAST_SPELL = 1
};
enum WorldStateType
{
WORLD_STATE_REMOVE = 0,
WORLD_STATE_ADD = 1
};
// we need to stick to 1 version or half of the stuff will work for someone
// others will not and opposite
// will only support WoW, WoW:TBC and WoW:WotLK 3.3.5a client build 12340...

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12066"
#define REVISION_NR "12067"
#endif // __REVISION_NR_H__