mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +00:00
[7276] Rewrited fix for same faction arena matches
Added better Object-oriented calls to BattleGround::Reset() Added more checks to CreateBattleGround() method This commit doesn't fix anything
This commit is contained in:
parent
bd89568993
commit
1eadd9b7b4
19 changed files with 107 additions and 115 deletions
|
|
@ -177,6 +177,7 @@ void BattleGround::Update(uint32 diff)
|
|||
}
|
||||
}
|
||||
|
||||
//this should be handled by spell system:
|
||||
m_LastResurrectTime += diff;
|
||||
if (m_LastResurrectTime >= RESURRECTION_INTERVAL)
|
||||
{
|
||||
|
|
@ -304,7 +305,7 @@ void BattleGround::SendPacketToTeam(uint32 TeamID, WorldPacket *packet, Player *
|
|||
if(!self && sender == plr)
|
||||
continue;
|
||||
|
||||
uint32 team = itr->second.Team;//GetPlayerTeam(plr->GetGUID());
|
||||
uint32 team = itr->second.Team;
|
||||
if(!team) team = plr->GetTeam();
|
||||
|
||||
if(team == TeamID)
|
||||
|
|
@ -333,7 +334,7 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, uint32 TeamID)
|
|||
continue;
|
||||
}
|
||||
|
||||
uint32 team = itr->second.Team;//GetPlayerTeam(plr->GetGUID());
|
||||
uint32 team = itr->second.Team;
|
||||
if(!team) team = plr->GetTeam();
|
||||
|
||||
if(team == TeamID)
|
||||
|
|
@ -356,7 +357,7 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, uint32 TeamID)
|
|||
continue;
|
||||
}
|
||||
|
||||
uint32 team = itr->second.Team;//GetPlayerTeam(plr->GetGUID());
|
||||
uint32 team = itr->second.Team;
|
||||
if(!team) team = plr->GetTeam();
|
||||
|
||||
if(team == TeamID)
|
||||
|
|
@ -376,7 +377,7 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, uint32 TeamID)
|
|||
continue;
|
||||
}
|
||||
|
||||
uint32 team = itr->second.Team;//GetPlayerTeam(plr->GetGUID());
|
||||
uint32 team = itr->second.Team;
|
||||
if(!team) team = plr->GetTeam();
|
||||
|
||||
if(team == TeamID)
|
||||
|
|
@ -401,7 +402,7 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
|
|||
continue;
|
||||
}
|
||||
|
||||
uint32 team = itr->second.Team;//GetPlayerTeam(plr->GetGUID());
|
||||
uint32 team = itr->second.Team;
|
||||
if(!team) team = plr->GetTeam();
|
||||
|
||||
if(team == TeamID)
|
||||
|
|
@ -889,9 +890,6 @@ void BattleGround::Reset()
|
|||
|
||||
m_Players.clear();
|
||||
m_PlayerScores.clear();
|
||||
|
||||
// reset BGSubclass
|
||||
ResetBGSubclass();
|
||||
}
|
||||
|
||||
void BattleGround::StartBattleGround()
|
||||
|
|
@ -972,10 +970,37 @@ void BattleGround::AddPlayer(Player *plr)
|
|||
plr->CastSpell(plr, SPELL_PREPARATION, true); // reduces all mana cost of spells.
|
||||
}
|
||||
|
||||
// setup BG group membership
|
||||
PlayerRelogin(plr);
|
||||
AddOrSetPlayerToCorrectBgGroup(plr, guid, team);
|
||||
|
||||
// Log
|
||||
sLog.outDetail("BATTLEGROUND: Player %s joined the battle.", plr->GetName());
|
||||
}
|
||||
|
||||
/* this method adds player to his team's bg group, or sets his correct group if player is already in bg group */
|
||||
void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid, uint32 team)
|
||||
{
|
||||
Group* group = GetBgRaid(team);
|
||||
if(!group) // first player joined
|
||||
{
|
||||
group = new Group;
|
||||
SetBgRaid(team, group);
|
||||
group->Create(plr_guid, plr->GetName());
|
||||
}
|
||||
else // raid already exist
|
||||
{
|
||||
if(group->IsMember(plr_guid))
|
||||
{
|
||||
uint8 subgroup = group->GetMemberGroup(plr_guid);
|
||||
plr->SetGroup(group, subgroup);
|
||||
}
|
||||
else
|
||||
GetBgRaid(team)->AddMember(plr_guid, plr->GetName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* This method should be called only once ... it adds pointer to queue */
|
||||
void BattleGround::AddToBGFreeSlotQueue()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue