mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[6910] Implemented rewritten arenas. Original author w12x@getmangos.com
Many thanks also to: Balrok@github.com for long time updating. Triply@github.com for great work in rewriting process. All who I forget to name. Signed-off-by: ApoC <apoc@nymfe.net>
This commit is contained in:
parent
c51a6bc59e
commit
a5331ab517
47 changed files with 3406 additions and 924 deletions
|
|
@ -1308,6 +1308,54 @@ void Group::UpdateLooterGuid( Creature* creature, bool ifneed )
|
|||
SendUpdate();
|
||||
}
|
||||
|
||||
uint32 Group::CanJoinBattleGroundQueue(uint32 bgTypeId, uint32 bgQueueType, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot)
|
||||
{
|
||||
// check for min / max count
|
||||
uint32 memberscount = GetMembersCount();
|
||||
if(memberscount < MinPlayerCount)
|
||||
return BG_JOIN_ERR_GROUP_NOT_ENOUGH;
|
||||
if(memberscount > MaxPlayerCount)
|
||||
return BG_JOIN_ERR_GROUP_TOO_MANY;
|
||||
|
||||
// get a player as reference, to compare other players' stats to (arena team id, queue id based on level, etc.)
|
||||
Player * reference = GetFirstMember()->getSource();
|
||||
// no reference found, can't join this way
|
||||
if(!reference)
|
||||
return BG_JOIN_ERR_OFFLINE_MEMBER;
|
||||
|
||||
uint32 bgQueueId = reference->GetBattleGroundQueueIdFromLevel();
|
||||
uint32 arenaTeamId = reference->GetArenaTeamId(arenaSlot);
|
||||
uint32 team = reference->GetTeam();
|
||||
|
||||
// check every member of the group to be able to join
|
||||
for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
Player *member = itr->getSource();
|
||||
// offline member? don't let join
|
||||
if(!member)
|
||||
return BG_JOIN_ERR_OFFLINE_MEMBER;
|
||||
// don't allow cross-faction join as group
|
||||
if(member->GetTeam() != team)
|
||||
return BG_JOIN_ERR_MIXED_FACTION;
|
||||
// not in the same battleground level braket, don't let join
|
||||
if(member->GetBattleGroundQueueIdFromLevel() != bgQueueId)
|
||||
return BG_JOIN_ERR_MIXED_LEVELS;
|
||||
// don't let join rated matches if the arena team id doesn't match
|
||||
if(isRated && member->GetArenaTeamId(arenaSlot) != arenaTeamId)
|
||||
return BG_JOIN_ERR_MIXED_ARENATEAM;
|
||||
// don't let join if someone from the group is already in that bg queue
|
||||
if(member->InBattleGroundQueueForBattleGroundQueueType(bgQueueType))
|
||||
return BG_JOIN_ERR_GROUP_MEMBER_ALREADY_IN_QUEUE;
|
||||
// check for deserter debuff in case not arena queue
|
||||
if(bgTypeId != BATTLEGROUND_AA && !member->CanJoinToBattleground())
|
||||
return BG_JOIN_ERR_GROUP_DESERTER;
|
||||
// check if member can join any more battleground queues
|
||||
if(!member->HasFreeBattleGroundQueueId())
|
||||
return BG_JOIN_ERR_ALL_QUEUES_USED;
|
||||
}
|
||||
return BG_JOIN_ERR_OK;
|
||||
}
|
||||
|
||||
//===================================================
|
||||
//============== Roll ===============================
|
||||
//===================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue