diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/BattleGround.h | 31 | ||||
-rw-r--r-- | src/game/BattleGroundHandler.cpp | 152 | ||||
-rw-r--r-- | src/game/BattleGroundMgr.cpp | 15 | ||||
-rw-r--r-- | src/game/BattleGroundMgr.h | 2 | ||||
-rw-r--r-- | src/game/DBCStructure.h | 2 | ||||
-rw-r--r-- | src/game/DBCfmt.h | 2 | ||||
-rw-r--r-- | src/game/Group.cpp | 49 | ||||
-rw-r--r-- | src/game/Group.h | 2 | ||||
-rw-r--r-- | src/game/WorldSession.h | 2 |
9 files changed, 121 insertions, 136 deletions
diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h index 146d89cb4c0..ce3efdcecb4 100644 --- a/src/game/BattleGround.h +++ b/src/game/BattleGround.h @@ -245,20 +245,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, - BG_JOIN_ERR_BG_DISABLED = 10, - BG_JOIN_ERR_ARENA_DISABLED = 11, + // 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 diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index dc7fd519182..6e38362ef66 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -117,14 +117,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; } @@ -142,13 +144,10 @@ 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. @@ -156,21 +155,37 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data) BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId]; if (joinAsGroup /* && _player->GetGroup()*/) { - 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 - 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()); } @@ -364,8 +379,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()); @@ -635,7 +650,8 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data) if (!bracketEntry) return; - // check queueing conditions + GroupJoinBattlegroundResult err; + if (!asGroup) { // check if already in queue @@ -652,12 +668,9 @@ 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); - return; - } + if (grp->GetLeaderGUID() != _player->GetGUID()) + return; + err = grp->CanJoinBattleGroundQueue(bg, bgQueueTypeId, arenatype, arenatype, (bool)isRated, arenaslot); } uint32 ateamId = 0; @@ -696,34 +709,48 @@ 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); - bg->SetRated(true); + 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); + bg->SetRated(true); + } + else + bg->SetRated(false); + + GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, grp, bgTypeId, bracketEntry, arenatype, isRated, false, arenaRating, ateamId); + avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId()); } - else - bg->SetRated(false); - 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: arena join as group end"); - //announce to world ... removed } else { @@ -756,48 +783,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_ARENA_DISABLED: - msg = LANG_ARENA_DISABLED; - break; - case BG_JOIN_ERR_BG_DISABLED: - msg = LANG_BG_DISABLED; - 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, GetTrinityString(msg), NULL); - SendPacket(&data); - return; -} - diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index 5dc260bebef..c676cc7a451 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -1411,19 +1411,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) diff --git a/src/game/BattleGroundMgr.h b/src/game/BattleGroundMgr.h index 548e4f34fc6..892fcc153c5 100644 --- a/src/game/BattleGroundMgr.h +++ b/src/game/BattleGroundMgr.h @@ -190,7 +190,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); diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index 66a049b4c49..574bef4601c 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -599,7 +599,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 diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h index 98a71f3bbce..0a090d0fd0b 100644 --- a/src/game/DBCfmt.h +++ b/src/game/DBCfmt.h @@ -30,7 +30,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"; diff --git a/src/game/Group.cpp b/src/game/Group.cpp index de03527da31..c6179ffe0b6 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -83,9 +83,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; @@ -112,7 +112,7 @@ bool Group::Create(const uint64 &guid, const char * name) CharacterDatabase.PExecute("INSERT INTO groups (leaderGuid,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,isRaid,difficulty,raiddifficulty) " "VALUES ('%u','%u','%u','%u','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','%u','%u','%u')", GUID_LOPART(m_leaderGuid), 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)) @@ -144,9 +144,9 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult_AutoPtr result if (!objmgr.GetPlayerNameByGUID(m_leaderGuid, m_leaderName)) return false; - m_groupType = (*result)[11].GetBool() ? GROUPTYPE_RAID : GROUPTYPE_NORMAL; + m_groupType = GroupType(fields[11].GetUInt8()); - if (m_groupType == GROUPTYPE_RAID) + if (m_groupType & GROUPTYPE_RAID) _initRaidSubGroupsCounter(); uint32 diff = (*result)[12].GetUInt8(); @@ -205,7 +205,7 @@ bool Group::LoadMemberFromDB(uint32 guidLow, uint8 memberFlags, uint8 subgroup) void Group::ConvertToRaid() { - m_groupType = GROUPTYPE_RAID; + m_groupType = GroupType(m_groupType | GROUPTYPE_RAID); _initRaidSubGroupsCounter(); @@ -1487,24 +1487,31 @@ void Group::UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed) } } -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()); if (!bracketEntry) - return BG_JOIN_ERR_OFFLINE_MEMBER; + return ERR_BATTLEGROUND_JOIN_FAILED; uint32 arenaTeamId = reference->GetArenaTeamId(arenaSlot); uint32 team = reference->GetTeam(); @@ -1515,28 +1522,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; + return ERR_BATTLEGROUND_JOIN_TIMED_OUT; // not in the same battleground level braket, 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()); } //=================================================== diff --git a/src/game/Group.h b/src/game/Group.h index 052f8c970b8..41e45a4cac6 100644 --- a/src/game/Group.h +++ b/src/game/Group.h @@ -266,7 +266,7 @@ class 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); diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index 246b8b9a28e..423a51aec03 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -263,8 +263,6 @@ class 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 bool LookingForGroup_auto_join; |