mirror of
https://gitcode.com/GitHub_Trending/az/azerothcore-wotlk.git
synced 2026-07-11 03:13:10 +00:00
[DEV-OP] Remove actual crossfaction BG system
This commit is contained in:
@@ -388,14 +388,11 @@ void BattlegroundQueue::FillPlayersToBG(const int32 aliFree, const int32 hordeFr
|
||||
m_SelectionPools[TEAM_ALLIANCE].Init();
|
||||
m_SelectionPools[TEAM_HORDE].Init();
|
||||
|
||||
// [AZTH] quick check if nothing we can do:
|
||||
// quick check if nothing we can do:
|
||||
if (!sBattlegroundMgr->isTesting())
|
||||
if(m_bgTypeId != BATTLEGROUND_RB)
|
||||
{
|
||||
if (aliFree > hordeFree && m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].empty() ||
|
||||
hordeFree > aliFree && m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty())
|
||||
return;
|
||||
}
|
||||
if (aliFree > hordeFree && m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].empty() ||
|
||||
hordeFree > aliFree && m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty())
|
||||
return;
|
||||
|
||||
// ally: at first fill as much as possible
|
||||
GroupsQueueType::const_iterator Ali_itr = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].begin();
|
||||
@@ -409,63 +406,53 @@ void BattlegroundQueue::FillPlayersToBG(const int32 aliFree, const int32 hordeFr
|
||||
int32 aliDiff = aliFree - int32(m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount());
|
||||
int32 hordeDiff = hordeFree - int32(m_SelectionPools[TEAM_HORDE].GetPlayerCount());
|
||||
|
||||
// [AZTH] Mik1893: Battleground Balance system 2.0
|
||||
// Mik1893: Battleground Balance system 2.0
|
||||
int32 invType = sWorld->getIntConfig(CONFIG_BATTLEGROUND_INVITATION_TYPE);
|
||||
int32 invDiff = 0;
|
||||
|
||||
if (m_bgTypeId != BATTLEGROUND_RB) // if not RANDOM BATTLEGROUND, use the balance system
|
||||
// check balance configuration and set the max difference between teams
|
||||
switch (invType)
|
||||
{
|
||||
// check balance configuration and set the max difference between teams
|
||||
switch (invType)
|
||||
case BG_QUEUE_INVITATION_TYPE_NO_BALANCE:
|
||||
return;
|
||||
case BG_QUEUE_INVITATION_TYPE_BALANCED:
|
||||
invDiff = 1;
|
||||
case BG_QUEUE_INVITATION_TYPE_EVEN:
|
||||
invDiff = 0;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
// balance the teams based on the difference allowed
|
||||
while (abs(aliDiff - hordeDiff) > invDiff && (m_SelectionPools[TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() > 0))
|
||||
{
|
||||
// if results in more alliance players than horde:
|
||||
if (aliDiff < hordeDiff)
|
||||
{
|
||||
case BG_QUEUE_INVITATION_TYPE_NO_BALANCE:
|
||||
return;
|
||||
case BG_QUEUE_INVITATION_TYPE_BALANCED:
|
||||
invDiff = 1;
|
||||
case BG_QUEUE_INVITATION_TYPE_EVEN:
|
||||
invDiff = 0;
|
||||
default:
|
||||
return;
|
||||
// no more alliance in pool, invite whatever we can from horde
|
||||
if (!m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount())
|
||||
break;
|
||||
|
||||
// kick alliance, returns true if kicked more than needed, so then try to fill up
|
||||
if (m_SelectionPools[TEAM_ALLIANCE].KickGroup(hordeDiff - aliDiff))
|
||||
for (; Ali_itr != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].end() && m_SelectionPools[TEAM_ALLIANCE].AddGroup((*Ali_itr), aliFree >= hordeDiff ? aliFree - hordeDiff : 0); ++Ali_itr);
|
||||
}
|
||||
// if results in more horde players than alliance:
|
||||
else
|
||||
{
|
||||
// no more horde in pool, invite whatever we can from alliance
|
||||
if (!m_SelectionPools[TEAM_HORDE].GetPlayerCount())
|
||||
break;
|
||||
|
||||
// kick horde, returns true if kicked more than needed, so then try to fill up
|
||||
if (m_SelectionPools[TEAM_HORDE].KickGroup(aliDiff - hordeDiff))
|
||||
for (; Horde_itr != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].end() && m_SelectionPools[TEAM_HORDE].AddGroup((*Horde_itr), hordeFree >= aliDiff ? hordeFree - aliDiff : 0); ++Horde_itr);
|
||||
}
|
||||
|
||||
// balance the teams based on the difference allowed
|
||||
while (abs(aliDiff - hordeDiff) > invDiff && (m_SelectionPools[TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() > 0))
|
||||
{
|
||||
// if results in more alliance players than horde:
|
||||
if (aliDiff < hordeDiff)
|
||||
{
|
||||
// no more alliance in pool, invite whatever we can from horde
|
||||
if (!m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount())
|
||||
break;
|
||||
|
||||
// kick alliance, returns true if kicked more than needed, so then try to fill up
|
||||
if (m_SelectionPools[TEAM_ALLIANCE].KickGroup(hordeDiff - aliDiff))
|
||||
for (; Ali_itr != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].end() && m_SelectionPools[TEAM_ALLIANCE].AddGroup((*Ali_itr), aliFree >= hordeDiff ? aliFree - hordeDiff : 0); ++Ali_itr);
|
||||
}
|
||||
// if results in more horde players than alliance:
|
||||
else
|
||||
{
|
||||
// no more horde in pool, invite whatever we can from alliance
|
||||
if (!m_SelectionPools[TEAM_HORDE].GetPlayerCount())
|
||||
break;
|
||||
|
||||
// kick horde, returns true if kicked more than needed, so then try to fill up
|
||||
if (m_SelectionPools[TEAM_HORDE].KickGroup(aliDiff - hordeDiff))
|
||||
for (; Horde_itr != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].end() && m_SelectionPools[TEAM_HORDE].AddGroup((*Horde_itr), hordeFree >= aliDiff ? hordeFree - aliDiff : 0); ++Horde_itr);
|
||||
}
|
||||
|
||||
// recalculate free space after adding
|
||||
aliDiff = aliFree - int32(m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount());
|
||||
hordeDiff = hordeFree - int32(m_SelectionPools[TEAM_HORDE].GetPlayerCount());
|
||||
}
|
||||
// recalculate free space after adding
|
||||
aliDiff = aliFree - int32(m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount());
|
||||
hordeDiff = hordeFree - int32(m_SelectionPools[TEAM_HORDE].GetPlayerCount());
|
||||
}
|
||||
else // unified queues, basically
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND,"check min count for players - unified queue... - FILL PLAYERS TO BG ");
|
||||
for (; Ali_itr != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].end() && m_SelectionPools[TEAM_ALLIANCE].AddGroup((*Ali_itr), 100); ++Ali_itr);
|
||||
for (; Horde_itr != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].end() && m_SelectionPools[TEAM_HORDE].AddGroup((*Horde_itr), 100); ++Horde_itr);
|
||||
}
|
||||
// [/AZTH]
|
||||
}
|
||||
|
||||
void BattlegroundQueue::FillPlayersToBGWithSpecific(const int32 aliFree, const int32 hordeFree, BattlegroundBracketId thisBracketId, BattlegroundQueue* specificQueue, BattlegroundBracketId specificBracketId)
|
||||
@@ -474,14 +461,11 @@ void BattlegroundQueue::FillPlayersToBGWithSpecific(const int32 aliFree, const i
|
||||
m_SelectionPools[TEAM_ALLIANCE].Init();
|
||||
m_SelectionPools[TEAM_HORDE].Init();
|
||||
|
||||
// [AZTH] quick check if nothing we can do:
|
||||
// quick check if nothing we can do:
|
||||
if (!sBattlegroundMgr->isTesting())
|
||||
if (m_bgTypeId != BATTLEGROUND_RB)
|
||||
{
|
||||
if (m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_ALLIANCE].empty() && specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_ALLIANCE].empty() ||
|
||||
m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_HORDE].empty() && specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_HORDE].empty())
|
||||
return;
|
||||
}
|
||||
if (m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_ALLIANCE].empty() && specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_ALLIANCE].empty() ||
|
||||
m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_HORDE].empty() && specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_HORDE].empty())
|
||||
return;
|
||||
|
||||
// copy groups from both queues to new joined container
|
||||
GroupsQueueType m_QueuedBoth[BG_TEAMS_COUNT];
|
||||
@@ -506,57 +490,48 @@ void BattlegroundQueue::FillPlayersToBGWithSpecific(const int32 aliFree, const i
|
||||
int32 invType = sWorld->getIntConfig(CONFIG_BATTLEGROUND_INVITATION_TYPE);
|
||||
int32 invDiff = 0;
|
||||
|
||||
if (m_bgTypeId != BATTLEGROUND_RB) // if not RANDOM BATTLEGROUND, use the balance system
|
||||
// check balance configuration and set the max difference between teams
|
||||
switch (invType)
|
||||
{
|
||||
// check balance configuration and set the max difference between teams
|
||||
switch (invType)
|
||||
{
|
||||
case BG_QUEUE_INVITATION_TYPE_NO_BALANCE:
|
||||
return;
|
||||
case BG_QUEUE_INVITATION_TYPE_BALANCED:
|
||||
invDiff = 1;
|
||||
case BG_QUEUE_INVITATION_TYPE_EVEN:
|
||||
invDiff = 0;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
// if free space differs too much, ballance
|
||||
while (abs(aliDiff - hordeDiff) > invDiff && (m_SelectionPools[TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() > 0))
|
||||
{
|
||||
// if results in more alliance players than horde:
|
||||
if (aliDiff < hordeDiff)
|
||||
{
|
||||
// no more alliance in pool, invite whatever we can from horde
|
||||
if (!m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount())
|
||||
break;
|
||||
|
||||
// kick alliance, returns true if kicked more than needed, so then try to fill up
|
||||
if (m_SelectionPools[TEAM_ALLIANCE].KickGroup(hordeDiff - aliDiff))
|
||||
for (; Ali_itr != m_QueuedBoth[TEAM_ALLIANCE].end() && m_SelectionPools[TEAM_ALLIANCE].AddGroup((*Ali_itr), aliFree >= hordeDiff ? aliFree - hordeDiff : 0); ++Ali_itr);
|
||||
}
|
||||
// if results in more horde players than alliance:
|
||||
else
|
||||
{
|
||||
// no more horde in pool, invite whatever we can from alliance
|
||||
if (!m_SelectionPools[TEAM_HORDE].GetPlayerCount())
|
||||
break;
|
||||
|
||||
// kick horde, returns true if kicked more than needed, so then try to fill up
|
||||
if (m_SelectionPools[TEAM_HORDE].KickGroup(aliDiff - hordeDiff))
|
||||
for (; Horde_itr != m_QueuedBoth[TEAM_HORDE].end() && m_SelectionPools[TEAM_HORDE].AddGroup((*Horde_itr), hordeFree >= aliDiff ? hordeFree - aliDiff : 0); ++Horde_itr);
|
||||
}
|
||||
|
||||
// recalculate free space after adding
|
||||
aliDiff = aliFree - int32(m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount());
|
||||
hordeDiff = hordeFree - int32(m_SelectionPools[TEAM_HORDE].GetPlayerCount());
|
||||
}
|
||||
case BG_QUEUE_INVITATION_TYPE_NO_BALANCE:
|
||||
return;
|
||||
case BG_QUEUE_INVITATION_TYPE_BALANCED:
|
||||
invDiff = 1;
|
||||
case BG_QUEUE_INVITATION_TYPE_EVEN:
|
||||
invDiff = 0;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
else // unified queues, basically - let everyone in and we handle it later
|
||||
|
||||
// if free space differs too much, ballance
|
||||
while (abs(aliDiff - hordeDiff) > invDiff && (m_SelectionPools[TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() > 0))
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "check min count for players - unified queue... - FILL PLAYERS TO BG WITH SPECIFIC ");
|
||||
for (; Ali_itr != m_QueuedBoth[TEAM_ALLIANCE].end() && m_SelectionPools[TEAM_ALLIANCE].AddGroup((*Ali_itr), 100); ++Ali_itr);
|
||||
for (; Horde_itr != m_QueuedBoth[TEAM_HORDE].end() && m_SelectionPools[TEAM_HORDE].AddGroup((*Horde_itr), 100);++Horde_itr);
|
||||
// if results in more alliance players than horde:
|
||||
if (aliDiff < hordeDiff)
|
||||
{
|
||||
// no more alliance in pool, invite whatever we can from horde
|
||||
if (!m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount())
|
||||
break;
|
||||
|
||||
// kick alliance, returns true if kicked more than needed, so then try to fill up
|
||||
if (m_SelectionPools[TEAM_ALLIANCE].KickGroup(hordeDiff - aliDiff))
|
||||
for (; Ali_itr != m_QueuedBoth[TEAM_ALLIANCE].end() && m_SelectionPools[TEAM_ALLIANCE].AddGroup((*Ali_itr), aliFree >= hordeDiff ? aliFree - hordeDiff : 0); ++Ali_itr);
|
||||
}
|
||||
// if results in more horde players than alliance:
|
||||
else
|
||||
{
|
||||
// no more horde in pool, invite whatever we can from alliance
|
||||
if (!m_SelectionPools[TEAM_HORDE].GetPlayerCount())
|
||||
break;
|
||||
|
||||
// kick horde, returns true if kicked more than needed, so then try to fill up
|
||||
if (m_SelectionPools[TEAM_HORDE].KickGroup(aliDiff - hordeDiff))
|
||||
for (; Horde_itr != m_QueuedBoth[TEAM_HORDE].end() && m_SelectionPools[TEAM_HORDE].AddGroup((*Horde_itr), hordeFree >= aliDiff ? hordeFree - aliDiff : 0); ++Horde_itr);
|
||||
}
|
||||
|
||||
// recalculate free space after adding
|
||||
aliDiff = aliFree - int32(m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount());
|
||||
hordeDiff = hordeFree - int32(m_SelectionPools[TEAM_HORDE].GetPlayerCount());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -640,10 +615,7 @@ bool BattlegroundQueue::CheckNormalMatch(Battleground* bgTemplate, BattlegroundB
|
||||
if (sBattlegroundMgr->isTesting() && bgTemplate->isBattleground() && (m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() || m_SelectionPools[TEAM_HORDE].GetPlayerCount()))
|
||||
return true;
|
||||
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "check min count for players - unified queue...");
|
||||
|
||||
//[AZTH] - Check for sum of queues >= 2* minplayerperteam
|
||||
return (m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() + m_SelectionPools[TEAM_HORDE].GetPlayerCount()) >= 2 * (std::min<uint32>(specificTemplate->GetMinPlayersPerTeam(), 15));
|
||||
return m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= std::min<uint32>(specificTemplate->GetMinPlayersPerTeam(), 15) && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= std::min<uint32>(specificTemplate->GetMinPlayersPerTeam(), 15);
|
||||
}
|
||||
// if this is not random bg queue - use players only from this queue
|
||||
else
|
||||
@@ -732,14 +704,11 @@ typedef std::set<Battleground*, BgEmptinessComp> BattlegroundNeedSet;
|
||||
|
||||
void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id, uint8 actionMask, bool isRated, uint32 arenaRatedTeamId)
|
||||
{
|
||||
bool validRandomQueue = !(m_bgTypeId == BATTLEGROUND_RB && (!m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].empty() || !m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty()));
|
||||
// [AZTH] on random bg you want to check sum of both queues - if no players in queue - do nothing
|
||||
if (
|
||||
m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].empty() &&
|
||||
// if no players in queue - do nothing
|
||||
if (m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].empty() &&
|
||||
m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].empty() &&
|
||||
m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].empty() &&
|
||||
m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty() &&
|
||||
!validRandomQueue)
|
||||
m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty())
|
||||
return;
|
||||
|
||||
Battleground* bg_template = sBattlegroundMgr->GetBattlegroundTemplate(m_bgTypeId);
|
||||
|
||||
@@ -435,27 +435,6 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData)
|
||||
|
||||
TeamId teamId = ginfo.teamId;
|
||||
|
||||
// [AZTH] Random Battleground Randomizer - by Yehonal & Mik1893
|
||||
if (bgQueueTypeId == BATTLEGROUND_QUEUE_RB && bg->isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_RANDOM_CROSSFACTION))
|
||||
{
|
||||
uint32 allyCount = bg->GetPlayersCountByTeam(TEAM_ALLIANCE);
|
||||
uint32 hordeCount = bg->GetPlayersCountByTeam(TEAM_HORDE);
|
||||
|
||||
if (allyCount == hordeCount)
|
||||
{
|
||||
if (roll_chance_i(50))
|
||||
teamId = _player->GetTeamId(true) == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE;
|
||||
}
|
||||
else if (allyCount < hordeCount)
|
||||
teamId = TEAM_ALLIANCE;
|
||||
else
|
||||
teamId = TEAM_HORDE;
|
||||
|
||||
_player->setTeamId(teamId);
|
||||
_player->setFaction(teamId == TEAM_ALLIANCE ? 1 : 2);
|
||||
}
|
||||
// [/AZTH]
|
||||
|
||||
// remove player from all bg queues
|
||||
for (uint32 qslot = 0; qslot < PLAYER_MAX_BATTLEGROUND_QUEUES; ++qslot)
|
||||
if (BattlegroundQueueTypeId q = _player->GetBattlegroundQueueTypeId(qslot))
|
||||
|
||||
Reference in New Issue
Block a user