Added enum for SMSG_GROUP_JOINED_BATTLEGROUND opcode.

Use this enum where possible.
Some misc fixes.
This commit is contained in:
tomrus88 2010-04-03 22:22:30 +04:00
parent 4f6006b9db
commit 9836bcbbaa
9 changed files with 135 additions and 137 deletions

View file

@ -235,18 +235,25 @@ enum BattleGroundStartingEventsIds
};
#define BG_STARTING_EVENT_COUNT 4
enum BattleGroundJoinError
enum GroupJoinBattlegroundResult
{
BG_JOIN_ERR_OK = 0,
BG_JOIN_ERR_OFFLINE_MEMBER = 1,
BG_JOIN_ERR_GROUP_TOO_MANY = 2,
BG_JOIN_ERR_MIXED_FACTION = 3,
BG_JOIN_ERR_MIXED_LEVELS = 4,
BG_JOIN_ERR_MIXED_ARENATEAM = 5,
BG_JOIN_ERR_GROUP_MEMBER_ALREADY_IN_QUEUE = 6,
BG_JOIN_ERR_GROUP_DESERTER = 7,
BG_JOIN_ERR_ALL_QUEUES_USED = 8,
BG_JOIN_ERR_GROUP_NOT_ENOUGH = 9
// positive values are indexes in BattlemasterList.dbc
ERR_GROUP_JOIN_BATTLEGROUND_FAIL = 0, // Your group has joined a battleground queue, but you are not eligible (showed for non existing BattlemasterList.dbc indexes)
ERR_BATTLEGROUND_NONE = -1, // not show anything
ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS = -2, // You cannot join the battleground yet because you or one of your party members is flagged as a Deserter.
ERR_ARENA_TEAM_PARTY_SIZE = -3, // Incorrect party size for this arena.
ERR_BATTLEGROUND_TOO_MANY_QUEUES = -4, // You can only be queued for 2 battles at once
ERR_BATTLEGROUND_CANNOT_QUEUE_FOR_RATED = -5, // You cannot queue for a rated match while queued for other battles
ERR_BATTLEDGROUND_QUEUED_FOR_RATED = -6, // You cannot queue for another battle while queued for a rated arena match
ERR_BATTLEGROUND_TEAM_LEFT_QUEUE = -7, // Your team has left the arena queue
ERR_BATTLEGROUND_NOT_IN_BATTLEGROUND = -8, // You can't do that in a battleground.
ERR_BATTLEGROUND_JOIN_XP_GAIN = -9, // wtf, doesn't exist in client...
ERR_BATTLEGROUND_JOIN_RANGE_INDEX = -10, // Cannot join the queue unless all members of your party are in the same battleground level range.
ERR_BATTLEGROUND_JOIN_TIMED_OUT = -11, // %s was unavailable to join the queue. (uint64 guid exist in client cache)
ERR_BATTLEGROUND_JOIN_FAILED = -12, // Join as a group failed (uint64 guid doesn't exist in client cache)
ERR_LFG_CANT_USE_BATTLEGROUND = -13, // You cannot queue for a battleground or arena while using the dungeon system.
ERR_IN_RANDOM_BG = -14, // Can't do that while in a Random Battleground queue.
ERR_IN_NON_RANDOM_BG = -15, // Can't queue for Random Battleground while in another Battleground queue.
};
class BattleGroundScore

View file

@ -120,14 +120,16 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data )
if (!bracketEntry)
return;
// check queueing conditions
GroupJoinBattlegroundResult err;
// check queue conditions
if (!joinAsGroup)
{
// check Deserter debuff
if (!_player->CanJoinToBattleground())
{
WorldPacket data(SMSG_GROUP_JOINED_BATTLEGROUND, 4);
data << uint32(0xFFFFFFFE);
WorldPacket data;
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS);
_player->GetSession()->SendPacket(&data);
return;
}
@ -145,35 +147,49 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data )
// no group found, error
if (!grp)
return;
uint32 err = grp->CanJoinBattleGroundQueue(bg, bgQueueTypeId, 0, bg->GetMaxPlayersPerTeam(), false, 0);
isPremade = (grp->GetMembersCount() >= bg->GetMinPlayersPerTeam());
if (err != BG_JOIN_ERR_OK)
{
SendBattleGroundOrArenaJoinError(err);
if(grp->GetLeaderGUID() != _player->GetGUID())
return;
}
err = grp->CanJoinBattleGroundQueue(bg, bgQueueTypeId, 0, bg->GetMaxPlayersPerTeam(), false, 0);
isPremade = (grp->GetMembersCount() >= bg->GetMinPlayersPerTeam());
}
// if we're here, then the conditions to join a bg are met. We can proceed in joining.
// _player->GetGroup() was already checked, grp is already initialized
BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
if (joinAsGroup /* && _player->GetGroup()*/)
if (joinAsGroup)
{
sLog.outDebug("Battleground: the following players are joining as group:");
GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, grp, bgTypeId, bracketEntry, 0, false, isPremade, 0);
uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId());
GroupQueueInfo * ginfo;
uint32 avgTime;
if(err > 0)
{
sLog.outDebug("Battleground: the following players are joining as group:");
ginfo = bgQueue.AddGroup(_player, grp, bgTypeId, bracketEntry, 0, false, isPremade, 0);
avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId());
}
for(GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *member = itr->getSource();
if(!member) continue; // this should never happen
uint32 queueSlot = member->AddBattleGroundQueueId(bgQueueTypeId); // add to queue
if(!member)
continue; // this should never happen
WorldPacket data;
// send status packet (in queue)
if(err <= 0)
{
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, err);
member->GetSession()->SendPacket(&data);
continue;
}
// add to queue
uint32 queueSlot = member->AddBattleGroundQueueId(bgQueueTypeId);
// send status packet (in queue)
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->ArenaType);
member->GetSession()->SendPacket(&data);
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, bgTypeId);
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, err);
member->GetSession()->SendPacket(&data);
sLog.outDebug("Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,member->GetGUIDLow(), member->GetName());
}
@ -208,8 +224,8 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv
{
case BATTLEGROUND_WS:
{
uint32 count1 = 0; //always constant zero?
uint32 count2 = 0; //count of next fields
uint32 count1 = 0; // always constant zero?
uint32 count2 = 0; // count of next fields
Player *ali_plr = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagPickerGUID());
if (ali_plr)
@ -367,8 +383,8 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data )
if (!_player->CanJoinToBattleground())
{
//send bg command result to show nice message
WorldPacket data2(SMSG_GROUP_JOINED_BATTLEGROUND, 4);
data2 << uint32(0xFFFFFFFE);
WorldPacket data2;
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data2, ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS);
_player->GetSession()->SendPacket(&data2);
action = 0;
sLog.outDebug("Battleground: player %s (%u) has a deserter debuff, do not port him to battleground!", _player->GetName(), _player->GetGUIDLow());
@ -621,7 +637,7 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
return;
}
//check existance
// check existence
BattleGround* bg = sBattleGroundMgr.GetBattleGroundTemplate(BATTLEGROUND_AA);
if (!bg)
{
@ -635,7 +651,9 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
if (!bracketEntry)
return;
// check queueing conditions
GroupJoinBattlegroundResult err;
// check queue conditions
if (!asGroup)
{
// check if already in queue
@ -652,12 +670,10 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
// no group found, error
if (!grp)
return;
uint32 err = grp->CanJoinBattleGroundQueue(bg, bgQueueTypeId, arenatype, arenatype, (bool)isRated, arenaslot);
if (err != BG_JOIN_ERR_OK)
{
SendBattleGroundOrArenaJoinError(err);
if(grp->GetLeaderGUID() != _player->GetGUID())
return;
}
// may be Group::CanJoinBattleGroundQueue should be moved to player class...
err = grp->CanJoinBattleGroundQueue(bg, bgQueueTypeId, arenatype, arenatype, (bool)isRated, arenaslot);
}
uint32 ateamId = 0;
@ -665,17 +681,17 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
if (isRated)
{
ateamId = _player->GetArenaTeamId(arenaslot);
// check real arenateam existence only here (if it was moved to group->CanJoin .. () then we would ahve to get it twice)
// check real arena team existence only here (if it was moved to group->CanJoin .. () then we would have to get it twice)
ArenaTeam * at = sObjectMgr.GetArenaTeamById(ateamId);
if (!at)
{
_player->GetSession()->SendNotInArenaTeamPacket(arenatype);
return;
}
// get the team rating for queueing
// get the team rating for queue
arenaRating = at->GetRating();
// the arenateam id must match for everyone in the group
// get the personal ratings for queueing
// the arena team id must match for everyone in the group
// get the personal ratings for queue
uint32 avg_pers_rating = 0;
for(GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
{
@ -696,29 +712,44 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
BattleGroundQueue &bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
if (asGroup)
{
sLog.outDebug("Battleground: arena join as group start");
if (isRated)
sLog.outDebug("Battleground: arena team id %u, leader %s queued with rating %u for type %u",_player->GetArenaTeamId(arenaslot),_player->GetName(),arenaRating,arenatype);
uint32 avgTime;
if(err > 0)
{
sLog.outDebug("Battleground: arena join as group start");
if (isRated)
sLog.outDebug("Battleground: arena team id %u, leader %s queued with rating %u for type %u",_player->GetArenaTeamId(arenaslot),_player->GetName(),arenaRating,arenatype);
GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, grp, bgTypeId, bracketEntry, arenatype, isRated, false, arenaRating, ateamId);
avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId());
}
GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, grp, bgTypeId, bracketEntry, arenatype, isRated, false, arenaRating, ateamId);
uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId());
for(GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *member = itr->getSource();
if(!member) continue;
uint32 queueSlot = member->AddBattleGroundQueueId(bgQueueTypeId);// add to queue
if(!member)
continue;
WorldPacket data;
if(err <= 0)
{
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, err);
member->GetSession()->SendPacket(&data);
continue;
}
// add to queue
uint32 queueSlot = member->AddBattleGroundQueueId(bgQueueTypeId);
// send status packet (in queue)
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype);
member->GetSession()->SendPacket(&data);
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, bgTypeId);
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, err);
member->GetSession()->SendPacket(&data);
sLog.outDebug("Battleground: player joined queue for arena as group bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,member->GetGUIDLow(), member->GetName());
sLog.outDebug("Battleground: player joined queue for arena as group bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, member->GetGUIDLow(), member->GetName());
}
sLog.outDebug("Battleground: arena join as group end");
//announce to world ... removed
}
else
{
@ -751,41 +782,3 @@ void WorldSession::HandleReportPvPAFK( WorldPacket & recv_data )
reportedPlayer->ReportedAfkBy(_player);
}
void WorldSession::SendBattleGroundOrArenaJoinError(uint8 err)
{
WorldPacket data;
int32 msg;
switch (err)
{
case BG_JOIN_ERR_OFFLINE_MEMBER:
msg = LANG_BG_GROUP_OFFLINE_MEMBER;
break;
case BG_JOIN_ERR_GROUP_TOO_MANY:
msg = LANG_BG_GROUP_TOO_LARGE;
break;
case BG_JOIN_ERR_MIXED_FACTION:
msg = LANG_BG_GROUP_MIXED_FACTION;
break;
case BG_JOIN_ERR_MIXED_LEVELS:
msg = LANG_BG_GROUP_MIXED_LEVELS;
break;
case BG_JOIN_ERR_GROUP_MEMBER_ALREADY_IN_QUEUE:
msg = LANG_BG_GROUP_MEMBER_ALREADY_IN_QUEUE;
break;
case BG_JOIN_ERR_GROUP_DESERTER:
msg = LANG_BG_GROUP_MEMBER_DESERTER;
break;
case BG_JOIN_ERR_ALL_QUEUES_USED:
msg = LANG_BG_GROUP_MEMBER_NO_FREE_QUEUE_SLOTS;
break;
case BG_JOIN_ERR_GROUP_NOT_ENOUGH:
case BG_JOIN_ERR_MIXED_ARENATEAM:
default:
return;
break;
}
ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetMangosString(msg), NULL);
SendPacket(&data);
return;
}

View file

@ -1364,19 +1364,12 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
}
}
void BattleGroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket *data, BattleGroundTypeId bgTypeId)
void BattleGroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket *data, GroupJoinBattlegroundResult result)
{
/*bgTypeId is:
0 - Your group has joined a battleground queue, but you are not eligible
1 - Your group has joined the queue for AV
2 - Your group has joined the queue for WS
3 - Your group has joined the queue for AB
4 - Your group has joined the queue for NA
5 - Your group has joined the queue for BE Arena
6 - Your group has joined the queue for All Arenas
7 - Your group has joined the queue for EotS*/
data->Initialize(SMSG_GROUP_JOINED_BATTLEGROUND, 4);
*data << uint32(bgTypeId);
*data << int32(result);
if(result == ERR_BATTLEGROUND_JOIN_TIMED_OUT || result == ERR_BATTLEGROUND_JOIN_FAILED)
*data << uint64(0); // player guid
}
void BattleGroundMgr::BuildUpdateWorldStatePacket(WorldPacket *data, uint32 field, uint32 value)

View file

@ -193,7 +193,7 @@ class BattleGroundMgr
void BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Player *plr);
void BuildPlayerLeftBattleGroundPacket(WorldPacket *data, const uint64& guid);
void BuildBattleGroundListPacket(WorldPacket *data, const uint64& guid, Player *plr, BattleGroundTypeId bgTypeId, uint8 fromWhere);
void BuildGroupJoinedBattlegroundPacket(WorldPacket *data, BattleGroundTypeId bgTypeId);
void BuildGroupJoinedBattlegroundPacket(WorldPacket *data, GroupJoinBattlegroundResult result);
void BuildUpdateWorldStatePacket(WorldPacket *data, uint32 field, uint32 value);
void BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg);
void BuildBattleGroundStatusPacket(WorldPacket *data, BattleGround *bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype);

View file

@ -571,7 +571,7 @@ struct BattlemasterListEntry
//uint32 canJoinAsGroup; // 10 (0 or 1)
char* name[16]; // 11-26
//uint32 nameFlags // 27 string flag, unused
//uint32 maxGroupSize // 28 maxGroupSize, used for checking if queue as group
uint32 maxGroupSize; // 28 maxGroupSize, used for checking if queue as group
//uint32 HolidayWorldStateId; // 29 new 3.1
//uint32 MinLevel; // 30
//uint32 SomeLevel; // 31, may be max level

View file

@ -27,7 +27,7 @@ const char AreaTriggerEntryfmt[]="niffffffff";
const char AuctionHouseEntryfmt[]="niiixxxxxxxxxxxxxxxxx";
const char BankBagSlotPricesEntryfmt[]="ni";
const char BarberShopStyleEntryfmt[]="nixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiii";
const char BattlemasterListEntryfmt[]="niiiiiiiiixssssssssssssssssxxxxx";
const char BattlemasterListEntryfmt[]="niiiiiiiiixssssssssssssssssxixxx";
const char CharStartOutfitEntryfmt[]="diiiiiiiiiiiiiiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const char CharTitlesEntryfmt[]="nxssssssssssssssssxxxxxxxxxxxxxxxxxxi";
const char ChatChannelsEntryfmt[]="iixssssssssssssssssxxxxxxxxxxxxxxxxxx";

View file

@ -80,9 +80,9 @@ bool Group::Create(const uint64 &guid, const char * name)
m_leaderGuid = guid;
m_leaderName = name;
m_groupType = isBGGroup() ? GROUPTYPE_RAID : GROUPTYPE_NORMAL;
m_groupType = isBGGroup() ? GROUPTYPE_BGRAID : GROUPTYPE_NORMAL;
if (m_groupType == GROUPTYPE_RAID)
if (m_groupType & GROUPTYPE_RAID)
_initRaidSubGroupsCounter();
m_lootMethod = GROUP_LOOT;
@ -111,7 +111,7 @@ bool Group::Create(const uint64 &guid, const char * name)
CharacterDatabase.PExecute("INSERT INTO groups (groupId,leaderGuid,mainTank,mainAssistant,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,isRaid,difficulty,raiddifficulty) "
"VALUES ('%u','%u','%u','%u','%u','%u','%u','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','%u','%u','%u')",
m_Id, GUID_LOPART(m_leaderGuid), GUID_LOPART(m_mainTank), GUID_LOPART(m_mainAssistant), uint32(m_lootMethod),
GUID_LOPART(m_looterGuid), uint32(m_lootThreshold), m_targetIcons[0], m_targetIcons[1], m_targetIcons[2], m_targetIcons[3], m_targetIcons[4], m_targetIcons[5], m_targetIcons[6], m_targetIcons[7], isRaidGroup(), uint32(m_dungeonDifficulty), m_raidDifficulty);
GUID_LOPART(m_looterGuid), uint32(m_lootThreshold), m_targetIcons[0], m_targetIcons[1], m_targetIcons[2], m_targetIcons[3], m_targetIcons[4], m_targetIcons[5], m_targetIcons[6], m_targetIcons[7], uint8(m_groupType), uint32(m_dungeonDifficulty), m_raidDifficulty);
}
if(!AddMember(guid, name))
@ -135,9 +135,9 @@ bool Group::LoadGroupFromDB(Field* fields)
if(!sObjectMgr.GetPlayerNameByGUID(m_leaderGuid, m_leaderName))
return false;
m_groupType = fields[13].GetBool() ? GROUPTYPE_RAID : GROUPTYPE_NORMAL;
m_groupType = GroupType(fields[13].GetUInt8());
if (m_groupType == GROUPTYPE_RAID)
if (m_groupType & GROUPTYPE_RAID)
_initRaidSubGroupsCounter();
uint32 diff = fields[14].GetUInt8();
@ -182,7 +182,7 @@ bool Group::LoadMemberFromDB(uint32 guidLow, uint8 subgroup, bool assistant)
void Group::ConvertToRaid()
{
m_groupType = GROUPTYPE_RAID;
m_groupType = GroupType(m_groupType | GROUPTYPE_RAID);
_initRaidSubGroupsCounter();
@ -1457,24 +1457,31 @@ void Group::UpdateLooterGuid( Creature* creature, bool ifneed )
SendUpdate();
}
uint32 Group::CanJoinBattleGroundQueue(BattleGround const* bgOrTemplate, BattleGroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot)
GroupJoinBattlegroundResult Group::CanJoinBattleGroundQueue(BattleGround const* bgOrTemplate, BattleGroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot)
{
BattlemasterListEntry const* bgEntry = sBattlemasterListStore.LookupEntry(bgOrTemplate->GetTypeID());
if(!bgEntry)
return ERR_GROUP_JOIN_BATTLEGROUND_FAIL; // shouldn't happen
// 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;
// only check for MinPlayerCount since MinPlayerCount == MaxPlayerCount for arenas...
if(bgOrTemplate->isArena() && memberscount != MinPlayerCount)
return ERR_ARENA_TEAM_PARTY_SIZE;
if(memberscount > bgEntry->maxGroupSize) // no MinPlayerCount for battlegrounds
return ERR_BATTLEGROUND_NONE; // ERR_GROUP_JOIN_BATTLEGROUND_TOO_MANY handled on client side
// 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;
return ERR_BATTLEGROUND_JOIN_FAILED;
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgOrTemplate->GetMapId(),reference->getLevel());
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgOrTemplate->GetMapId(), reference->getLevel());
if(!bracketEntry)
return BG_JOIN_ERR_OFFLINE_MEMBER;
return ERR_BATTLEGROUND_JOIN_FAILED;
uint32 arenaTeamId = reference->GetArenaTeamId(arenaSlot);
uint32 team = reference->GetTeam();
@ -1485,28 +1492,28 @@ uint32 Group::CanJoinBattleGroundQueue(BattleGround const* bgOrTemplate, BattleG
Player *member = itr->getSource();
// offline member? don't let join
if(!member)
return BG_JOIN_ERR_OFFLINE_MEMBER;
return ERR_BATTLEGROUND_JOIN_FAILED;
// 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
PvPDifficultyEntry const* memberBracketEntry = GetBattlegroundBracketByLevel(bracketEntry->mapId,member->getLevel());
return ERR_BATTLEGROUND_JOIN_TIMED_OUT;
// not in the same battleground level bracket, don't let join
PvPDifficultyEntry const* memberBracketEntry = GetBattlegroundBracketByLevel(bracketEntry->mapId, member->getLevel());
if(memberBracketEntry != bracketEntry)
return BG_JOIN_ERR_MIXED_LEVELS;
return ERR_BATTLEGROUND_JOIN_RANGE_INDEX;
// 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;
return ERR_BATTLEGROUND_JOIN_FAILED;
// don't let join if someone from the group is already in that bg queue
if(member->InBattleGroundQueueForBattleGroundQueueType(bgQueueTypeId))
return BG_JOIN_ERR_GROUP_MEMBER_ALREADY_IN_QUEUE;
return ERR_BATTLEGROUND_JOIN_FAILED; // not blizz-like
// check for deserter debuff in case not arena queue
if(bgOrTemplate->GetTypeID() != BATTLEGROUND_AA && !member->CanJoinToBattleground())
return BG_JOIN_ERR_GROUP_DESERTER;
return ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS;
// check if member can join any more battleground queues
if(!member->HasFreeBattleGroundQueueId())
return BG_JOIN_ERR_ALL_QUEUES_USED;
return ERR_BATTLEGROUND_TOO_MANY_QUEUES; // not blizz-like
}
return BG_JOIN_ERR_OK;
return GroupJoinBattlegroundResult(bgOrTemplate->GetTypeID());
}
//===================================================

View file

@ -181,8 +181,8 @@ class MANGOS_DLL_SPEC Group
// properties accessories
uint32 GetId() const { return m_Id; }
bool IsFull() const { return (m_groupType==GROUPTYPE_NORMAL) ? (m_memberSlots.size()>=MAXGROUPSIZE) : (m_memberSlots.size()>=MAXRAIDSIZE); }
bool isRaidGroup() const { return m_groupType==GROUPTYPE_RAID; }
bool IsFull() const { return (m_groupType == GROUPTYPE_NORMAL) ? (m_memberSlots.size() >= MAXGROUPSIZE) : (m_memberSlots.size() >= MAXRAIDSIZE); }
bool isRaidGroup() const { return m_groupType & GROUPTYPE_RAID; }
bool isBGGroup() const { return m_bgGroup != NULL; }
bool IsCreated() const { return GetMembersCount() > 0; }
const uint64& GetLeaderGUID() const { return m_leaderGuid; }
@ -258,7 +258,7 @@ class MANGOS_DLL_SPEC Group
void ConvertToRaid();
void SetBattlegroundGroup(BattleGround *bg) { m_bgGroup = bg; }
uint32 CanJoinBattleGroundQueue(BattleGround const* bgOrTemplate, BattleGroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot);
GroupJoinBattlegroundResult CanJoinBattleGroundQueue(BattleGround const* bgOrTemplate, BattleGroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot);
void ChangeMembersGroup(const uint64 &guid, const uint8 &group);
void ChangeMembersGroup(Player *player, const uint8 &group);

View file

@ -143,7 +143,6 @@ class MANGOS_DLL_SPEC WorldSession
bool PlayerLogout() const { return m_playerLogout; }
bool PlayerLogoutWithSave() const { return m_playerLogout && m_playerSave; }
void SizeError(WorldPacket const& packet, uint32 size) const;
void ReadAddonsInfo(WorldPacket &data);
@ -274,7 +273,6 @@ class MANGOS_DLL_SPEC WorldSession
void SendNotInArenaTeamPacket(uint8 type);
void SendPetitionShowList( uint64 guid );
void SendSaveGuildEmblem( uint32 msg );
void SendBattleGroundOrArenaJoinError(uint8 err);
// Looking For Group
// TRUE values set by client sending CMSG_LFG_SET_AUTOJOIN and CMSG_LFM_CLEAR_AUTOFILL before player login
@ -770,7 +768,7 @@ class MANGOS_DLL_SPEC WorldSession
void LogUnexpectedOpcode(WorldPacket *packet, const char * reason);
void LogUnprocessedTail(WorldPacket *packet);
uint32 m_GUIDLow; // set loggined or recently logout player (while m_playerRecentlyLogout set)
uint32 m_GUIDLow; // set logged or recently logout player (while m_playerRecentlyLogout set)
Player *_player;
WorldSocket *m_Socket;
std::string m_Address;