[10800] Use ObjectGuid in some battleground structures.

Also fix some catches bugs in code in result.
This commit is contained in:
VladimirMangos 2010-12-01 11:20:17 +03:00
parent ce7b98c45e
commit 6d13cd6553
33 changed files with 146 additions and 139 deletions

View file

@ -135,7 +135,7 @@ void BattleGroundWS::AddPlayer(Player *plr)
//create score and add it to map, default values are set in constructor
BattleGroundWGScore* sc = new BattleGroundWGScore;
m_PlayerScores[plr->GetGUID()] = sc;
m_PlayerScores[plr->GetObjectGuid()] = sc;
}
void BattleGroundWS::RespawnFlag(Team team, bool captured)
@ -199,7 +199,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
{
if (!IsHordeFlagPickedup())
return;
SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
ClearHordeFlagPicker(); // 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;
// Drop Horde Flag from Player
@ -213,7 +213,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
{
if (!IsAllianceFlagPickedup())
return;
SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
ClearAllianceFlagPicker(); // 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;
// Drop Alliance Flag from Player
@ -269,21 +269,21 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
// just take off the aura
if (Source->GetTeam() == ALLIANCE)
{
if (!this->IsHordeFlagPickedup())
if (!IsHordeFlagPickedup())
return;
if (GetHordeFlagPickerGUID() == Source->GetGUID())
if (GetHordeFlagPickerGuid() == Source->GetObjectGuid())
{
SetHordeFlagPicker(0);
ClearHordeFlagPicker();
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
}
}
else
{
if (!this->IsAllianceFlagPickedup())
if (!IsAllianceFlagPickedup())
return;
if (GetAllianceFlagPickerGUID() == Source->GetGUID())
if (GetAllianceFlagPickerGuid() == Source->GetObjectGuid())
{
SetAllianceFlagPicker(0);
ClearAllianceFlagPicker();
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
}
}
@ -296,9 +296,9 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
{
if (!IsHordeFlagPickedup())
return;
if (GetHordeFlagPickerGUID() == Source->GetGUID())
if (GetHordeFlagPickerGuid() == Source->GetObjectGuid())
{
SetHordeFlagPicker(0);
ClearHordeFlagPicker();
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);
@ -309,9 +309,9 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
{
if (!IsAllianceFlagPickedup())
return;
if (GetAllianceFlagPickerGUID() == Source->GetGUID())
if (GetAllianceFlagPickerGuid() == Source->GetObjectGuid())
{
SetAllianceFlagPicker(0);
ClearAllianceFlagPicker();
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);
@ -444,7 +444,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
}
void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid)
void BattleGroundWS::RemovePlayer(Player *plr, ObjectGuid guid)
{
// sometimes flag aura not removed :(
if (IsAllianceFlagPickedup() && m_FlagKeepers[BG_TEAM_ALLIANCE] == guid)
@ -452,7 +452,7 @@ void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid)
if (!plr)
{
sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!");
SetAllianceFlagPicker(0);
ClearAllianceFlagPicker();
RespawnFlag(ALLIANCE, false);
}
else
@ -463,7 +463,7 @@ void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid)
if (!plr)
{
sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!");
SetHordeFlagPicker(0);
ClearHordeFlagPicker();
RespawnFlag(HORDE, false);
}
else
@ -506,12 +506,12 @@ 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->GetGUID())
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->GetGUID())
if (GetAllianceFlagPickerGuid() == Source->GetObjectGuid())
EventPlayerCapturedFlag(Source);
break;
case 3649: // unk1
@ -544,7 +544,7 @@ void BattleGroundWS::Reset()
for(uint32 i = 0; i < BG_TEAMS_COUNT; ++i)
{
m_DroppedFlagGUID[i] = 0;
m_FlagKeepers[i] = 0;
m_FlagKeepers[i].Clear();
m_FlagState[i] = BG_WS_FLAG_STATE_ON_BASE;
m_TeamScores[i] = 0;
}
@ -584,7 +584,7 @@ void BattleGroundWS::HandleKillPlayer(Player *player, Player *killer)
void BattleGroundWS::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid());
if(itr == m_PlayerScores.end()) // player not found
return;