Codestyle: Renamed some battleground variables and changed some other things to fit codestyle
This commit is contained in:
@@ -42,20 +42,15 @@ uint32 BG_WSG_Honor[BG_HONOR_MODE_NUM][BG_WSG_REWARD_NUM] = {
|
||||
{60, 40, 80} // holiday
|
||||
};
|
||||
|
||||
uint32 BG_WSG_Reputation[BG_HONOR_MODE_NUM][BG_WSG_REWARD_NUM] = {
|
||||
{0, 35, 0}, // normal honor
|
||||
{0, 45, 0} // holiday
|
||||
};
|
||||
|
||||
BattlegroundWS::BattlegroundWS()
|
||||
{
|
||||
m_BgObjects.resize(BG_WS_OBJECT_MAX);
|
||||
m_BgCreatures.resize(BG_CREATURES_MAX_WS);
|
||||
BgObjects.resize(BG_WS_OBJECT_MAX);
|
||||
BgCreatures.resize(BG_CREATURES_MAX_WS);
|
||||
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN;
|
||||
StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES;
|
||||
StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN;
|
||||
}
|
||||
|
||||
BattlegroundWS::~BattlegroundWS()
|
||||
@@ -75,96 +70,93 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff)
|
||||
else // Horde has more points and thus wins
|
||||
EndBattleground(HORDE);
|
||||
}
|
||||
|
||||
else if (GetTeamScore(HORDE) == 0)
|
||||
EndBattleground(ALLIANCE); // Alliance has > 0, Horde has 0, alliance wins
|
||||
|
||||
else if (GetTeamScore(HORDE) == GetTeamScore(ALLIANCE)) // Team score equal, winner is team that scored the last flag
|
||||
EndBattleground(m_LastFlagCaptureTeam);
|
||||
|
||||
EndBattleground(_lastFlagCaptureTeam);
|
||||
else if (GetTeamScore(HORDE) > GetTeamScore(ALLIANCE)) // Last but not least, check who has the higher score
|
||||
EndBattleground(HORDE);
|
||||
else
|
||||
EndBattleground(ALLIANCE);
|
||||
}
|
||||
else if (GetStartTime() > uint32(m_minutesElapsed * MINUTE * IN_MILLISECONDS))
|
||||
else if (GetStartTime() > uint32(_minutesElapsed * MINUTE * IN_MILLISECONDS))
|
||||
{
|
||||
++m_minutesElapsed;
|
||||
UpdateWorldState(BG_WS_STATE_TIMER, 25 - m_minutesElapsed);
|
||||
++_minutesElapsed;
|
||||
UpdateWorldState(BG_WS_STATE_TIMER, 25 - _minutesElapsed);
|
||||
}
|
||||
|
||||
if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
|
||||
if (_flagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
|
||||
{
|
||||
m_FlagsTimer[BG_TEAM_ALLIANCE] -= diff;
|
||||
_flagsTimer[BG_TEAM_ALLIANCE] -= diff;
|
||||
|
||||
if (m_FlagsTimer[BG_TEAM_ALLIANCE] < 0)
|
||||
if (_flagsTimer[BG_TEAM_ALLIANCE] < 0)
|
||||
{
|
||||
m_FlagsTimer[BG_TEAM_ALLIANCE] = 0;
|
||||
_flagsTimer[BG_TEAM_ALLIANCE] = 0;
|
||||
RespawnFlag(ALLIANCE, true);
|
||||
}
|
||||
}
|
||||
if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
if (_flagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
{
|
||||
m_FlagsDropTimer[BG_TEAM_ALLIANCE] -= diff;
|
||||
_flagsDropTimer[BG_TEAM_ALLIANCE] -= diff;
|
||||
|
||||
if (m_FlagsDropTimer[BG_TEAM_ALLIANCE] < 0)
|
||||
if (_flagsDropTimer[BG_TEAM_ALLIANCE] < 0)
|
||||
{
|
||||
m_FlagsDropTimer[BG_TEAM_ALLIANCE] = 0;
|
||||
_flagsDropTimer[BG_TEAM_ALLIANCE] = 0;
|
||||
RespawnFlagAfterDrop(ALLIANCE);
|
||||
m_BothFlagsKept = false;
|
||||
_bothFlagsKept = false;
|
||||
}
|
||||
}
|
||||
if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
|
||||
if (_flagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
|
||||
{
|
||||
m_FlagsTimer[BG_TEAM_HORDE] -= diff;
|
||||
_flagsTimer[BG_TEAM_HORDE] -= diff;
|
||||
|
||||
if (m_FlagsTimer[BG_TEAM_HORDE] < 0)
|
||||
if (_flagsTimer[BG_TEAM_HORDE] < 0)
|
||||
{
|
||||
m_FlagsTimer[BG_TEAM_HORDE] = 0;
|
||||
_flagsTimer[BG_TEAM_HORDE] = 0;
|
||||
RespawnFlag(HORDE, true);
|
||||
}
|
||||
}
|
||||
if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
if (_flagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
{
|
||||
m_FlagsDropTimer[BG_TEAM_HORDE] -= diff;
|
||||
_flagsDropTimer[BG_TEAM_HORDE] -= diff;
|
||||
|
||||
if (m_FlagsDropTimer[BG_TEAM_HORDE] < 0)
|
||||
if (_flagsDropTimer[BG_TEAM_HORDE] < 0)
|
||||
{
|
||||
m_FlagsDropTimer[BG_TEAM_HORDE] = 0;
|
||||
_flagsDropTimer[BG_TEAM_HORDE] = 0;
|
||||
RespawnFlagAfterDrop(HORDE);
|
||||
m_BothFlagsKept = false;
|
||||
_bothFlagsKept = false;
|
||||
}
|
||||
}
|
||||
if (m_BothFlagsKept)
|
||||
if (_bothFlagsKept)
|
||||
{
|
||||
m_FlagSpellForceTimer += diff;
|
||||
if (m_FlagDebuffState == 0 && m_FlagSpellForceTimer >= 600000) //10 minutes
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[0]))
|
||||
player->CastSpell(player, WS_SPELL_FOCUSED_ASSAULT, true);
|
||||
if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[1]))
|
||||
player->CastSpell(player, WS_SPELL_FOCUSED_ASSAULT, true);
|
||||
m_FlagDebuffState = 1;
|
||||
}
|
||||
else if (m_FlagDebuffState == 1 && m_FlagSpellForceTimer >= 900000) //15 minutes
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[0]))
|
||||
_flagSpellForceTimer += diff;
|
||||
if (_flagDebuffState == 0 && _flagSpellForceTimer >= 10*MINUTE*IN_MILLISECONDS) //10 minutes
|
||||
{
|
||||
player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
player->CastSpell(player, WS_SPELL_BRUTAL_ASSAULT, true);
|
||||
if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[0]))
|
||||
player->CastSpell(player, WS_SPELL_FOCUSED_ASSAULT, true);
|
||||
if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[1]))
|
||||
player->CastSpell(player, WS_SPELL_FOCUSED_ASSAULT, true);
|
||||
_flagDebuffState = 1;
|
||||
}
|
||||
if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[1]))
|
||||
else if (_flagDebuffState == 1 && _flagSpellForceTimer >= 900000) //15 minutes
|
||||
{
|
||||
player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
player->CastSpell(player, WS_SPELL_BRUTAL_ASSAULT, true);
|
||||
if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[0]))
|
||||
{
|
||||
player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
player->CastSpell(player, WS_SPELL_BRUTAL_ASSAULT, true);
|
||||
}
|
||||
if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[1]))
|
||||
{
|
||||
player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
player->CastSpell(player, WS_SPELL_BRUTAL_ASSAULT, true);
|
||||
}
|
||||
_flagDebuffState = 2;
|
||||
}
|
||||
m_FlagDebuffState = 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_FlagSpellForceTimer = 0; //reset timer.
|
||||
m_FlagDebuffState = 0;
|
||||
_flagSpellForceTimer = 0; //reset timer.
|
||||
_flagDebuffState = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -208,7 +200,7 @@ void BattlegroundWS::AddPlayer(Player* player)
|
||||
//create score and add it to map, default values are set in constructor
|
||||
BattlegroundWGScore* sc = new BattlegroundWGScore;
|
||||
|
||||
m_PlayerScores[player->GetGUID()] = sc;
|
||||
PlayerScores[player->GetGUID()] = sc;
|
||||
}
|
||||
|
||||
void BattlegroundWS::RespawnFlag(uint32 Team, bool captured)
|
||||
@@ -216,12 +208,12 @@ void BattlegroundWS::RespawnFlag(uint32 Team, bool captured)
|
||||
if (Team == ALLIANCE)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Respawn Alliance flag");
|
||||
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
_flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Respawn Horde flag");
|
||||
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
_flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
}
|
||||
|
||||
if (captured)
|
||||
@@ -232,7 +224,7 @@ void BattlegroundWS::RespawnFlag(uint32 Team, bool captured)
|
||||
SendMessageToAll(LANG_BG_WS_F_PLACED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED); // flag respawned sound...
|
||||
}
|
||||
m_BothFlagsKept = false;
|
||||
_bothFlagsKept = false;
|
||||
}
|
||||
|
||||
void BattlegroundWS::RespawnFlagAfterDrop(uint32 team)
|
||||
@@ -260,7 +252,7 @@ void BattlegroundWS::RespawnFlagAfterDrop(uint32 team)
|
||||
sLog->outError("unknown droped flag bg, guid: %u", GUID_LOPART(GetDroppedFlagGUID(team)));
|
||||
|
||||
SetDroppedFlagGUID(0, team);
|
||||
m_BothFlagsKept = false;
|
||||
_bothFlagsKept = false;
|
||||
}
|
||||
|
||||
void BattlegroundWS::EventPlayerCapturedFlag(Player* Source)
|
||||
@@ -277,12 +269,12 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* Source)
|
||||
return;
|
||||
SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
|
||||
// horde flag in base (but not respawned yet)
|
||||
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
||||
_flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
||||
// Drop Horde Flag from Player
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
if (m_FlagDebuffState == 1)
|
||||
if (_flagDebuffState == 1)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
if (m_FlagDebuffState == 2)
|
||||
if (_flagDebuffState == 2)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
|
||||
if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
|
||||
AddPoint(ALLIANCE, 1);
|
||||
@@ -295,12 +287,12 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* Source)
|
||||
return;
|
||||
SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
|
||||
// alliance flag in base (but not respawned yet)
|
||||
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
||||
_flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
||||
// Drop Alliance Flag from Player
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
||||
if (m_FlagDebuffState == 1)
|
||||
if (_flagDebuffState == 1)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
if (m_FlagDebuffState == 2)
|
||||
if (_flagDebuffState == 2)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
|
||||
if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
|
||||
AddPoint(HORDE, 1);
|
||||
@@ -345,7 +337,7 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* Source)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_FlagsTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_RESPAWN_TIME;
|
||||
_flagsTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_RESPAWN_TIME;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,11 +380,11 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
|
||||
{
|
||||
SetHordeFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
if (m_FlagDebuffState == 1)
|
||||
if (_flagDebuffState == 1)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
if (m_FlagDebuffState == 2)
|
||||
if (_flagDebuffState == 2)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
|
||||
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_GROUND;
|
||||
_flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_GROUND;
|
||||
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true);
|
||||
set = true;
|
||||
}
|
||||
@@ -405,11 +397,11 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
|
||||
{
|
||||
SetAllianceFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
||||
if (m_FlagDebuffState == 1)
|
||||
if (_flagDebuffState == 1)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
if (m_FlagDebuffState == 2)
|
||||
if (_flagDebuffState == 2)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
|
||||
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_GROUND;
|
||||
_flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_GROUND;
|
||||
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true);
|
||||
set = true;
|
||||
}
|
||||
@@ -431,7 +423,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, uint32(-1));
|
||||
}
|
||||
|
||||
m_FlagsDropTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_DROP_TIME;
|
||||
_flagsDropTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_DROP_TIME;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,40 +437,40 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
|
||||
|
||||
//alliance flag picked up from base
|
||||
if (Source->GetTeam() == HORDE && this->GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE
|
||||
&& this->m_BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID())
|
||||
&& this->BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID())
|
||||
{
|
||||
message_id = LANG_BG_WS_PICKEDUP_AF;
|
||||
type = CHAT_MSG_BG_SYSTEM_HORDE;
|
||||
PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP);
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_ONE_DAY);
|
||||
SetAllianceFlagPicker(Source->GetGUID());
|
||||
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
|
||||
_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->GetAchievementMgr().StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_SILVERWING_FLAG_PICKED);
|
||||
if (m_FlagState[1] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
m_BothFlagsKept = true;
|
||||
if (_flagState[1] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
_bothFlagsKept = true;
|
||||
}
|
||||
|
||||
//horde flag picked up from base
|
||||
if (Source->GetTeam() == ALLIANCE && this->GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE
|
||||
&& this->m_BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID())
|
||||
&& this->BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID())
|
||||
{
|
||||
message_id = LANG_BG_WS_PICKEDUP_HF;
|
||||
type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
|
||||
PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP);
|
||||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_ONE_DAY);
|
||||
SetHordeFlagPicker(Source->GetGUID());
|
||||
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER;
|
||||
_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->GetAchievementMgr().StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_WARSONG_FLAG_PICKED);
|
||||
if (m_FlagState[0] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
m_BothFlagsKept = true;
|
||||
if (_flagState[0] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
_bothFlagsKept = true;
|
||||
}
|
||||
|
||||
//Alliance flag on ground(not in base) (returned or picked up again from ground!)
|
||||
@@ -493,7 +485,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
|
||||
UpdatePlayerScore(Source, SCORE_FLAG_RETURNS, 1);
|
||||
m_BothFlagsKept = false;
|
||||
_bothFlagsKept = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -503,11 +495,11 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_ONE_DAY);
|
||||
SetAllianceFlagPicker(Source->GetGUID());
|
||||
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG, true);
|
||||
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
|
||||
_flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
|
||||
UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
|
||||
if (m_FlagDebuffState == 1)
|
||||
if (_flagDebuffState == 1)
|
||||
Source->CastSpell(Source, WS_SPELL_FOCUSED_ASSAULT, true);
|
||||
if (m_FlagDebuffState == 2)
|
||||
if (_flagDebuffState == 2)
|
||||
Source->CastSpell(Source, WS_SPELL_BRUTAL_ASSAULT, true);
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1);
|
||||
}
|
||||
@@ -527,7 +519,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
|
||||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
|
||||
UpdatePlayerScore(Source, SCORE_FLAG_RETURNS, 1);
|
||||
m_BothFlagsKept = false;
|
||||
_bothFlagsKept = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -537,11 +529,11 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
|
||||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_ONE_DAY);
|
||||
SetHordeFlagPicker(Source->GetGUID());
|
||||
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG, true);
|
||||
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER;
|
||||
_flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER;
|
||||
UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER);
|
||||
if (m_FlagDebuffState == 1)
|
||||
if (_flagDebuffState == 1)
|
||||
Source->CastSpell(Source, WS_SPELL_FOCUSED_ASSAULT, true);
|
||||
if (m_FlagDebuffState == 2)
|
||||
if (_flagDebuffState == 2)
|
||||
Source->CastSpell(Source, WS_SPELL_BRUTAL_ASSAULT, true);
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1);
|
||||
}
|
||||
@@ -610,30 +602,30 @@ void BattlegroundWS::HandleAreaTrigger(Player* Source, uint32 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().
|
||||
//buff_guid = m_BgObjects[BG_WS_OBJECT_SPEEDBUFF_1];
|
||||
//buff_guid = BgObjects[BG_WS_OBJECT_SPEEDBUFF_1];
|
||||
break;
|
||||
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().
|
||||
//buff_guid = m_BgObjects[BG_WS_OBJECT_SPEEDBUFF_2];
|
||||
//buff_guid = BgObjects[BG_WS_OBJECT_SPEEDBUFF_2];
|
||||
break;
|
||||
case 3706: // Alliance elixir of regeneration spawn
|
||||
//buff_guid = m_BgObjects[BG_WS_OBJECT_REGENBUFF_1];
|
||||
//buff_guid = BgObjects[BG_WS_OBJECT_REGENBUFF_1];
|
||||
break;
|
||||
case 3708: // Horde elixir of regeneration spawn
|
||||
//buff_guid = m_BgObjects[BG_WS_OBJECT_REGENBUFF_2];
|
||||
//buff_guid = BgObjects[BG_WS_OBJECT_REGENBUFF_2];
|
||||
break;
|
||||
case 3707: // Alliance elixir of berserk spawn
|
||||
//buff_guid = m_BgObjects[BG_WS_OBJECT_BERSERKBUFF_1];
|
||||
//buff_guid = BgObjects[BG_WS_OBJECT_BERSERKBUFF_1];
|
||||
break;
|
||||
case 3709: // Horde elixir of berserk spawn
|
||||
//buff_guid = m_BgObjects[BG_WS_OBJECT_BERSERKBUFF_2];
|
||||
//buff_guid = BgObjects[BG_WS_OBJECT_BERSERKBUFF_2];
|
||||
break;
|
||||
case 3646: // Alliance Flag spawn
|
||||
if (m_FlagState[BG_TEAM_HORDE] && !m_FlagState[BG_TEAM_ALLIANCE])
|
||||
if (_flagState[BG_TEAM_HORDE] && !_flagState[BG_TEAM_ALLIANCE])
|
||||
if (GetFlagPickerGUID(BG_TEAM_HORDE) == Source->GetGUID())
|
||||
EventPlayerCapturedFlag(Source);
|
||||
break;
|
||||
case 3647: // Horde Flag spawn
|
||||
if (m_FlagState[BG_TEAM_ALLIANCE] && !m_FlagState[BG_TEAM_HORDE])
|
||||
if (_flagState[BG_TEAM_ALLIANCE] && !_flagState[BG_TEAM_HORDE])
|
||||
if (GetFlagPickerGUID(BG_TEAM_ALLIANCE) == Source->GetGUID())
|
||||
EventPlayerCapturedFlag(Source);
|
||||
break;
|
||||
@@ -710,8 +702,8 @@ void BattlegroundWS::Reset()
|
||||
m_FlagKeepers[BG_TEAM_HORDE] = 0;
|
||||
m_DroppedFlagGUID[BG_TEAM_ALLIANCE] = 0;
|
||||
m_DroppedFlagGUID[BG_TEAM_HORDE] = 0;
|
||||
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
_flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
_flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
m_TeamScores[BG_TEAM_ALLIANCE] = 0;
|
||||
m_TeamScores[BG_TEAM_HORDE] = 0;
|
||||
bool isBGWeekend = sBattlegroundMgr->IsBGWeekend(GetTypeID());
|
||||
@@ -719,13 +711,13 @@ void BattlegroundWS::Reset()
|
||||
m_HonorWinKills = (isBGWeekend) ? 3 : 1;
|
||||
m_HonorEndKills = (isBGWeekend) ? 4 : 2;
|
||||
// For WorldState
|
||||
m_minutesElapsed = 0;
|
||||
m_LastFlagCaptureTeam = 0;
|
||||
_minutesElapsed = 0;
|
||||
_lastFlagCaptureTeam = 0;
|
||||
|
||||
/* Spirit nodes is static at this BG and then not required deleting at BG reset.
|
||||
if (m_BgCreatures[WS_SPIRIT_MAIN_ALLIANCE])
|
||||
if (BgCreatures[WS_SPIRIT_MAIN_ALLIANCE])
|
||||
DelCreature(WS_SPIRIT_MAIN_ALLIANCE);
|
||||
if (m_BgCreatures[WS_SPIRIT_MAIN_HORDE])
|
||||
if (BgCreatures[WS_SPIRIT_MAIN_HORDE])
|
||||
DelCreature(WS_SPIRIT_MAIN_HORDE);
|
||||
*/
|
||||
}
|
||||
@@ -757,8 +749,8 @@ void BattlegroundWS::HandleKillPlayer(Player* player, Player* killer)
|
||||
void BattlegroundWS::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
|
||||
BattlegroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
|
||||
if (itr == m_PlayerScores.end()) // player not found
|
||||
BattlegroundScoreMap::iterator itr = PlayerScores.find(Source->GetGUID());
|
||||
if (itr == PlayerScores.end()) // player not found
|
||||
return;
|
||||
|
||||
switch (type)
|
||||
@@ -805,16 +797,16 @@ void BattlegroundWS::FillInitialWorldStates(WorldPacket& data)
|
||||
data << uint32(BG_WS_FLAG_CAPTURES_ALLIANCE) << uint32(GetTeamScore(ALLIANCE));
|
||||
data << uint32(BG_WS_FLAG_CAPTURES_HORDE) << uint32(GetTeamScore(HORDE));
|
||||
|
||||
if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
if (_flagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(-1);
|
||||
else if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
else if (_flagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(1);
|
||||
else
|
||||
data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(0);
|
||||
|
||||
if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
if (_flagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(-1);
|
||||
else if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
else if (_flagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(1);
|
||||
else
|
||||
data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(0);
|
||||
@@ -824,17 +816,17 @@ void BattlegroundWS::FillInitialWorldStates(WorldPacket& data)
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
data << uint32(BG_WS_STATE_TIMER_ACTIVE) << uint32(1);
|
||||
data << uint32(BG_WS_STATE_TIMER) << uint32(25-m_minutesElapsed);
|
||||
data << uint32(BG_WS_STATE_TIMER) << uint32(25-_minutesElapsed);
|
||||
}
|
||||
else
|
||||
data << uint32(BG_WS_STATE_TIMER_ACTIVE) << uint32(0);
|
||||
|
||||
if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
if (_flagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(2);
|
||||
else
|
||||
data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(1);
|
||||
|
||||
if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
if (_flagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
data << uint32(BG_WS_FLAG_STATE_HORDE) << uint32(2);
|
||||
else
|
||||
data << uint32(BG_WS_FLAG_STATE_HORDE) << uint32(1);
|
||||
|
||||
Reference in New Issue
Block a user