mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[11355] Use ArenaType enum instead raw values
* Drop duplicate ArenaTeamTypes * Use enum type where appropriate * More strict check integrity arena team data at loading.
This commit is contained in:
parent
6f8aa617d0
commit
adcb84a325
12 changed files with 114 additions and 88 deletions
|
|
@ -36,7 +36,7 @@ void ArenaTeamMember::ModifyPersonalRating(Player* plr, int32 mod, uint32 slot)
|
|||
ArenaTeam::ArenaTeam()
|
||||
{
|
||||
m_TeamId = 0;
|
||||
m_Type = 0;
|
||||
m_Type = ARENA_TYPE_NONE;
|
||||
m_BackgroundColor = 0; // background
|
||||
m_EmblemStyle = 0; // icon
|
||||
m_EmblemColor = 0; // icon color
|
||||
|
|
@ -66,8 +66,10 @@ ArenaTeam::~ArenaTeam()
|
|||
|
||||
}
|
||||
|
||||
bool ArenaTeam::Create(ObjectGuid captainGuid, uint32 type, std::string arenaTeamName)
|
||||
bool ArenaTeam::Create(ObjectGuid captainGuid, ArenaType type, std::string arenaTeamName)
|
||||
{
|
||||
if (!IsArenaTypeValid(type))
|
||||
return false;
|
||||
if (!sObjectMgr.GetPlayer(captainGuid)) // player not exist
|
||||
return false;
|
||||
if (sObjectMgr.GetArenaTeamByName(arenaTeamName)) // arena team with this name already exist
|
||||
|
|
@ -197,7 +199,11 @@ bool ArenaTeam::LoadArenaTeamFromDB(QueryResult *arenaTeamDataResult)
|
|||
m_TeamId = fields[0].GetUInt32();
|
||||
m_Name = fields[1].GetCppString();
|
||||
m_CaptainGuid = ObjectGuid(HIGHGUID_PLAYER, fields[2].GetUInt32());
|
||||
m_Type = fields[3].GetUInt32();
|
||||
m_Type = ArenaType(fields[3].GetUInt32());
|
||||
|
||||
if (!IsArenaTypeValid(m_Type))
|
||||
return false;
|
||||
|
||||
m_BackgroundColor = fields[4].GetUInt32();
|
||||
m_EmblemStyle = fields[5].GetUInt32();
|
||||
m_EmblemColor = fields[6].GetUInt32();
|
||||
|
|
@ -257,6 +263,11 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult *arenaTeamMembersResult)
|
|||
DelMember(newmember.guid);
|
||||
continue;
|
||||
}
|
||||
|
||||
// arena team can't be > 2 * arenatype (2 for 2.x, 3 for 3x3, 5 for 5x5)
|
||||
if (m_members.size() >= m_Type * 2)
|
||||
return false;
|
||||
|
||||
if (newmember.guid == GetCaptainGuid())
|
||||
captainPresentInTeam = true;
|
||||
|
||||
|
|
@ -517,13 +528,13 @@ void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, ObjectGuid guid, char cons
|
|||
DEBUG_LOG("WORLD: Sent SMSG_ARENA_TEAM_EVENT");
|
||||
}
|
||||
|
||||
uint8 ArenaTeam::GetSlotByType( uint32 type )
|
||||
uint8 ArenaTeam::GetSlotByType(ArenaType type )
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case ARENA_TEAM_2v2: return 0;
|
||||
case ARENA_TEAM_3v3: return 1;
|
||||
case ARENA_TEAM_5v5: return 2;
|
||||
case ARENA_TYPE_2v2: return 0;
|
||||
case ARENA_TYPE_3v3: return 1;
|
||||
case ARENA_TYPE_5v5: return 2;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -559,9 +570,9 @@ uint32 ArenaTeam::GetPoints(uint32 MemberRating)
|
|||
points = 1511.26f / (1.0f + 1639.28f * exp(-0.00412f * (float)rating));
|
||||
|
||||
// type penalties for <5v5 teams
|
||||
if(m_Type == ARENA_TEAM_2v2)
|
||||
if (m_Type == ARENA_TYPE_2v2)
|
||||
points *= 0.76f;
|
||||
else if(m_Type == ARENA_TEAM_3v3)
|
||||
else if(m_Type == ARENA_TYPE_3v3)
|
||||
points *= 0.88f;
|
||||
|
||||
return (uint32) points;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "Common.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "SharedDefines.h"
|
||||
|
||||
class QueryResult;
|
||||
class WorldPacket;
|
||||
|
|
@ -86,13 +87,6 @@ enum ArenaTeamStatTypes
|
|||
STAT_TYPE_RANK = 5
|
||||
};
|
||||
|
||||
enum ArenaTeamTypes
|
||||
{
|
||||
ARENA_TEAM_2v2 = 2,
|
||||
ARENA_TEAM_3v3 = 3,
|
||||
ARENA_TEAM_5v5 = 5
|
||||
};
|
||||
|
||||
struct ArenaTeamMember
|
||||
{
|
||||
ObjectGuid guid;
|
||||
|
|
@ -125,15 +119,15 @@ class ArenaTeam
|
|||
ArenaTeam();
|
||||
~ArenaTeam();
|
||||
|
||||
bool Create(ObjectGuid captainGuid, uint32 type, std::string arenaTeamName);
|
||||
bool Create(ObjectGuid captainGuid, ArenaType type, std::string arenaTeamName);
|
||||
void Disband(WorldSession *session);
|
||||
|
||||
typedef std::list<ArenaTeamMember> MemberList;
|
||||
|
||||
uint32 GetId() const { return m_TeamId; }
|
||||
uint32 GetType() const { return m_Type; }
|
||||
ArenaType GetType() const { return m_Type; }
|
||||
uint8 GetSlot() const { return GetSlotByType(GetType()); }
|
||||
static uint8 GetSlotByType(uint32 type);
|
||||
static uint8 GetSlotByType(ArenaType type);
|
||||
ObjectGuid GetCaptainGuid() const { return m_CaptainGuid; }
|
||||
std::string GetName() const { return m_Name; }
|
||||
const ArenaTeamStats& GetStats() const { return m_stats; }
|
||||
|
|
@ -215,7 +209,7 @@ class ArenaTeam
|
|||
protected:
|
||||
|
||||
uint32 m_TeamId;
|
||||
uint32 m_Type;
|
||||
ArenaType m_Type;
|
||||
std::string m_Name;
|
||||
ObjectGuid m_CaptainGuid;
|
||||
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ BattleGround::BattleGround()
|
|||
m_BracketId = BG_BRACKET_ID_FIRST;
|
||||
m_InvitedAlliance = 0;
|
||||
m_InvitedHorde = 0;
|
||||
m_ArenaType = 0;
|
||||
m_ArenaType = ARENA_TYPE_NONE;
|
||||
m_IsArena = false;
|
||||
m_Winner = 2;
|
||||
m_StartTime = 0;
|
||||
|
|
@ -1055,7 +1055,7 @@ void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
|
|||
if (SendPacket)
|
||||
{
|
||||
WorldPacket data;
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, this, plr->GetBattleGroundQueueIndex(bgQueueTypeId), STATUS_NONE, 0, 0, 0);
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, this, plr->GetBattleGroundQueueIndex(bgQueueTypeId), STATUS_NONE, 0, 0, ARENA_TYPE_NONE);
|
||||
plr->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
|
|
@ -1090,7 +1090,7 @@ void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
|
|||
{
|
||||
// a player has left the battleground, so there are free slots -> add to queue
|
||||
AddToBGFreeSlotQueue();
|
||||
sBattleGroundMgr.ScheduleQueueUpdate(0, 0, bgQueueTypeId, bgTypeId, GetBracketId());
|
||||
sBattleGroundMgr.ScheduleQueueUpdate(0, ARENA_TYPE_NONE, bgQueueTypeId, bgTypeId, GetBracketId());
|
||||
}
|
||||
|
||||
// Let others know
|
||||
|
|
@ -1122,7 +1122,7 @@ void BattleGround::Reset()
|
|||
SetStatus(STATUS_WAIT_QUEUE);
|
||||
SetStartTime(0);
|
||||
SetEndTime(0);
|
||||
SetArenaType(0);
|
||||
SetArenaType(ARENA_TYPE_NONE);
|
||||
SetRated(false);
|
||||
|
||||
m_Events = 0;
|
||||
|
|
|
|||
|
|
@ -194,13 +194,6 @@ enum ScoreType
|
|||
SCORE_SECONDARY_OBJECTIVES = 15
|
||||
};
|
||||
|
||||
enum ArenaType
|
||||
{
|
||||
ARENA_TYPE_2v2 = 2,
|
||||
ARENA_TYPE_3v3 = 3,
|
||||
ARENA_TYPE_5v5 = 5
|
||||
};
|
||||
|
||||
enum BattleGroundType
|
||||
{
|
||||
TYPE_BATTLEGROUND = 3,
|
||||
|
|
@ -328,7 +321,7 @@ class BattleGround
|
|||
uint32 GetMinPlayersPerTeam() const { return m_MinPlayersPerTeam; }
|
||||
|
||||
int32 GetStartDelayTime() const { return m_StartDelayTime; }
|
||||
uint8 GetArenaType() const { return m_ArenaType; }
|
||||
ArenaType GetArenaType() const { return m_ArenaType; }
|
||||
uint8 GetWinner() const { return m_Winner; }
|
||||
uint32 GetBattlemasterEntry() const;
|
||||
uint32 GetBonusHonorFromKill(uint32 kills) const;
|
||||
|
|
@ -346,7 +339,7 @@ class BattleGround
|
|||
void SetMinPlayers(uint32 MinPlayers) { m_MinPlayers = MinPlayers; }
|
||||
void SetLevelRange(uint32 min, uint32 max) { m_LevelMin = min; m_LevelMax = max; }
|
||||
void SetRated(bool state) { m_IsRated = state; }
|
||||
void SetArenaType(uint8 type) { m_ArenaType = type; }
|
||||
void SetArenaType(ArenaType type) { m_ArenaType = type; }
|
||||
void SetArenaorBGType(bool _isArena) { m_IsArena = _isArena; }
|
||||
void SetWinner(uint8 winner) { m_Winner = winner; }
|
||||
|
||||
|
|
@ -581,7 +574,7 @@ class BattleGround
|
|||
bool m_ArenaBuffSpawned; // to cache if arenabuff event is started (cause bool is faster than checking IsActiveEvent)
|
||||
int32 m_EndTime; // it is set to 120000 when bg is ending and it decreases itself
|
||||
BattleGroundBracketId m_BracketId;
|
||||
uint8 m_ArenaType; // 2=2v2, 3=3v3, 5=5v5
|
||||
ArenaType m_ArenaType; // 2=2v2, 3=3v3, 5=5v5
|
||||
bool m_InBGFreeSlotQueue; // used to make sure that BG is only once inserted into the BattleGroundMgr.BGFreeSlotQueue[bgTypeId] deque
|
||||
bool m_IsArena;
|
||||
uint8 m_Winner; // 0=alliance, 1=horde, 2=none
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Log.h"
|
||||
|
|
@ -99,7 +100,7 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data )
|
|||
DEBUG_LOG( "WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from %s", guid.GetString().c_str());
|
||||
|
||||
// can do this, since it's battleground, not arena
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, 0);
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, ARENA_TYPE_NONE);
|
||||
|
||||
// ignore if player is already in BG
|
||||
if (_player->InBattleGround())
|
||||
|
|
@ -166,7 +167,7 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data )
|
|||
if(err > 0)
|
||||
{
|
||||
DEBUG_LOG("Battleground: the following players are joining as group:");
|
||||
ginfo = bgQueue.AddGroup(_player, grp, bgTypeId, bracketEntry, 0, false, isPremade, 0);
|
||||
ginfo = bgQueue.AddGroup(_player, grp, bgTypeId, bracketEntry, ARENA_TYPE_NONE, false, isPremade, 0);
|
||||
avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId());
|
||||
}
|
||||
|
||||
|
|
@ -189,7 +190,7 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data )
|
|||
uint32 queueSlot = member->AddBattleGroundQueueId(bgQueueTypeId);
|
||||
|
||||
// send status packet (in queue)
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->ArenaType);
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->arenaType);
|
||||
member->GetSession()->SendPacket(&data);
|
||||
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, err);
|
||||
member->GetSession()->SendPacket(&data);
|
||||
|
|
@ -199,18 +200,18 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
else
|
||||
{
|
||||
GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, NULL, bgTypeId, bracketEntry, 0, false, isPremade, 0);
|
||||
GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, NULL, bgTypeId, bracketEntry, ARENA_TYPE_NONE, false, isPremade, 0);
|
||||
uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId());
|
||||
// already checked if queueSlot is valid, now just get it
|
||||
uint32 queueSlot = _player->AddBattleGroundQueueId(bgQueueTypeId);
|
||||
|
||||
WorldPacket data;
|
||||
// send status packet (in queue)
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->ArenaType);
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->arenaType);
|
||||
SendPacket(&data);
|
||||
DEBUG_LOG("Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,_player->GetGUIDLow(), _player->GetName());
|
||||
}
|
||||
sBattleGroundMgr.ScheduleQueueUpdate(0, 0, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
|
||||
sBattleGroundMgr.ScheduleQueueUpdate(0, ARENA_TYPE_NONE, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
|
||||
}
|
||||
|
||||
void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv_data*/ )
|
||||
|
|
@ -338,6 +339,13 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data )
|
|||
sLog.outError("BattlegroundHandler: invalid bgtype (%u) received.", bgTypeId_);
|
||||
return;
|
||||
}
|
||||
|
||||
if (type && !IsArenaTypeValid(ArenaType(type)))
|
||||
{
|
||||
sLog.outError("BattlegroundHandler: Invalid CMSG_BATTLEFIELD_PORT received from player (%u), arena type wrong: %u.", _player->GetGUIDLow(), type);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_player->InBattleGroundQueue())
|
||||
{
|
||||
sLog.outError("BattlegroundHandler: Invalid CMSG_BATTLEFIELD_PORT received from player (%u), he is not in bg_queue.", _player->GetGUIDLow());
|
||||
|
|
@ -346,7 +354,7 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data )
|
|||
|
||||
//get GroupQueueInfo from BattleGroundQueue
|
||||
BattleGroundTypeId bgTypeId = BattleGroundTypeId(bgTypeId_);
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, type);
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, ArenaType(type));
|
||||
BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
|
||||
//we must use temporary variable, because GroupQueueInfo pointer can be deleted in BattleGroundQueue::RemovePlayer() function
|
||||
GroupQueueInfo ginfo;
|
||||
|
|
@ -379,7 +387,7 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data )
|
|||
return;
|
||||
|
||||
//some checks if player isn't cheating - it is not exactly cheating, but we cannot allow it
|
||||
if (action == 1 && ginfo.ArenaType == 0)
|
||||
if (action == 1 && ginfo.arenaType == ARENA_TYPE_NONE)
|
||||
{
|
||||
//if player is trying to enter battleground (not arena!) and he has deserter debuff, we must just remove him from queue
|
||||
if (!_player->CanJoinToBattleground())
|
||||
|
|
@ -455,11 +463,11 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data )
|
|||
}
|
||||
}
|
||||
_player->RemoveBattleGroundQueueId(bgQueueTypeId); // must be called this way, because if you move this call to queue->removeplayer, it causes bugs
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0);
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, ARENA_TYPE_NONE);
|
||||
bgQueue.RemovePlayer(_player->GetObjectGuid(), true);
|
||||
// player left queue, we should update it - do not update Arena Queue
|
||||
if (!ginfo.ArenaType)
|
||||
sBattleGroundMgr.ScheduleQueueUpdate(ginfo.ArenaTeamRating, ginfo.ArenaType, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
|
||||
if (ginfo.arenaType == ARENA_TYPE_NONE)
|
||||
sBattleGroundMgr.ScheduleQueueUpdate(ginfo.ArenaTeamRating, ginfo.arenaType, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
|
||||
SendPacket(&data);
|
||||
DEBUG_LOG("Battleground: player %s (%u) left queue for bgtype %u, queue type %u.", _player->GetName(), _player->GetGUIDLow(), bg->GetTypeID(), bgQueueTypeId);
|
||||
break;
|
||||
|
|
@ -504,7 +512,7 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
|
|||
if (!bgQueueTypeId)
|
||||
continue;
|
||||
BattleGroundTypeId bgTypeId = BattleGroundMgr::BGTemplateId(bgQueueTypeId);
|
||||
uint8 arenaType = BattleGroundMgr::BGArenaType(bgQueueTypeId);
|
||||
ArenaType arenaType = BattleGroundMgr::BGArenaType(bgQueueTypeId);
|
||||
if (bgTypeId == _player->GetBattleGroundTypeId())
|
||||
{
|
||||
bg = _player->GetBattleGround();
|
||||
|
|
@ -619,7 +627,7 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
|
|||
if(!unit->isBattleMaster()) // it's not battle master
|
||||
return;
|
||||
|
||||
uint8 arenatype = 0;
|
||||
ArenaType arenatype;
|
||||
uint32 arenaRating = 0;
|
||||
|
||||
switch(arenaslot)
|
||||
|
|
|
|||
|
|
@ -147,14 +147,14 @@ bool BattleGroundQueue::SelectionPool::AddGroup(GroupQueueInfo *ginfo, uint32 de
|
|||
/*********************************************************/
|
||||
|
||||
// add group or player (grp == NULL) to bg queue with the given leader and bg specifications
|
||||
GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, Group* grp, BattleGroundTypeId BgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 arenaRating, uint32 arenateamid)
|
||||
GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, Group* grp, BattleGroundTypeId BgTypeId, PvPDifficultyEntry const* bracketEntry, ArenaType arenaType, bool isRated, bool isPremade, uint32 arenaRating, uint32 arenateamid)
|
||||
{
|
||||
BattleGroundBracketId bracketId = bracketEntry->GetBracketId();
|
||||
|
||||
// create new ginfo
|
||||
GroupQueueInfo* ginfo = new GroupQueueInfo;
|
||||
ginfo->BgTypeId = BgTypeId;
|
||||
ginfo->ArenaType = ArenaType;
|
||||
ginfo->arenaType = arenaType;
|
||||
ginfo->ArenaTeamId = arenateamid;
|
||||
ginfo->IsRated = isRated;
|
||||
ginfo->IsInvitedToBGInstanceGUID = 0;
|
||||
|
|
@ -181,7 +181,7 @@ GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, Group* grp, BattleG
|
|||
//announce world (this don't need mutex)
|
||||
if (isRated && sWorld.getConfig(CONFIG_BOOL_ARENA_QUEUE_ANNOUNCER_JOIN))
|
||||
{
|
||||
sWorld.SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN, ginfo->ArenaType, ginfo->ArenaType, ginfo->ArenaTeamRating);
|
||||
sWorld.SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN, ginfo->arenaType, ginfo->arenaType, ginfo->ArenaTeamRating);
|
||||
}
|
||||
|
||||
//add players from group to ginfo
|
||||
|
|
@ -213,7 +213,7 @@ GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, Group* grp, BattleG
|
|||
m_QueuedGroups[bracketId][index].push_back(ginfo);
|
||||
|
||||
//announce to world, this code needs mutex
|
||||
if (!ArenaType && !isRated && !isPremade && sWorld.getConfig(CONFIG_UINT32_BATTLEGROUND_QUEUE_ANNOUNCER_JOIN))
|
||||
if (arenaType == ARENA_TYPE_NONE && !isRated && !isPremade && sWorld.getConfig(CONFIG_UINT32_BATTLEGROUND_QUEUE_ANNOUNCER_JOIN))
|
||||
{
|
||||
if (BattleGround* bg = sBattleGroundMgr.GetBattleGroundTemplate(ginfo->BgTypeId))
|
||||
{
|
||||
|
|
@ -255,7 +255,7 @@ void BattleGroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* g
|
|||
{
|
||||
uint32 timeInQueue = WorldTimer::getMSTimeDiff(ginfo->JoinTime, WorldTimer::getMSTime());
|
||||
uint8 team_index = BG_TEAM_ALLIANCE; //default set to BG_TEAM_ALLIANCE - or non rated arenas!
|
||||
if (!ginfo->ArenaType)
|
||||
if (ginfo->arenaType == ARENA_TYPE_NONE)
|
||||
{
|
||||
if (ginfo->GroupTeam == HORDE)
|
||||
team_index = BG_TEAM_HORDE;
|
||||
|
|
@ -282,7 +282,7 @@ void BattleGroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* g
|
|||
uint32 BattleGroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattleGroundBracketId bracket_id)
|
||||
{
|
||||
uint8 team_index = BG_TEAM_ALLIANCE; //default set to BG_TEAM_ALLIANCE - or non rated arenas!
|
||||
if (!ginfo->ArenaType)
|
||||
if (ginfo->arenaType == ARENA_TYPE_NONE)
|
||||
{
|
||||
if (ginfo->GroupTeam == HORDE)
|
||||
team_index = BG_TEAM_HORDE;
|
||||
|
|
@ -373,8 +373,8 @@ void BattleGroundQueue::RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount)
|
|||
m_QueuedPlayers.erase(itr);
|
||||
|
||||
// announce to world if arena team left queue for rated match, show only once
|
||||
if (group->ArenaType && group->IsRated && group->Players.empty() && sWorld.getConfig(CONFIG_BOOL_ARENA_QUEUE_ANNOUNCER_EXIT))
|
||||
sWorld.SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT, group->ArenaType, group->ArenaType, group->ArenaTeamRating);
|
||||
if (group->arenaType != ARENA_TYPE_NONE && group->IsRated && group->Players.empty() && sWorld.getConfig(CONFIG_BOOL_ARENA_QUEUE_ANNOUNCER_EXIT))
|
||||
sWorld.SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT, group->arenaType, group->arenaType, group->ArenaTeamRating);
|
||||
|
||||
//if player leaves queue and he is invited to rated arena match, then he have to loose
|
||||
if (group->IsInvitedToBGInstanceGUID && group->IsRated && decreaseInvitedCount)
|
||||
|
|
@ -408,12 +408,12 @@ void BattleGroundQueue::RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount)
|
|||
if (Player *plr2 = sObjectMgr.GetPlayer(group->Players.begin()->first))
|
||||
{
|
||||
BattleGround * bg = sBattleGroundMgr.GetBattleGroundTemplate(group->BgTypeId);
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(group->BgTypeId, group->ArenaType);
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(group->BgTypeId, group->arenaType);
|
||||
uint32 queueSlot = plr2->GetBattleGroundQueueIndex(bgQueueTypeId);
|
||||
plr2->RemoveBattleGroundQueueId(bgQueueTypeId); // must be called this way, because if you move this call to
|
||||
// queue->removeplayer, it causes bugs
|
||||
WorldPacket data;
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0);
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, ARENA_TYPE_NONE);
|
||||
plr2->GetSession()->SendPacket(&data);
|
||||
}
|
||||
// then actually delete, this may delete the group as well!
|
||||
|
|
@ -481,7 +481,7 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * b
|
|||
plr->SetInviteForBattleGroundQueueType(bgQueueTypeId, ginfo->IsInvitedToBGInstanceGUID);
|
||||
|
||||
// create remind invite events
|
||||
BGQueueInviteEvent* inviteEvent = new BGQueueInviteEvent(plr->GetObjectGuid(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, ginfo->ArenaType, ginfo->RemoveInviteTime);
|
||||
BGQueueInviteEvent* inviteEvent = new BGQueueInviteEvent(plr->GetObjectGuid(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, ginfo->arenaType, ginfo->RemoveInviteTime);
|
||||
plr->m_Events.AddEvent(inviteEvent, plr->m_Events.CalculateTime(INVITATION_REMIND_TIME));
|
||||
// create automatic remove events
|
||||
BGQueueRemoveEvent* removeEvent = new BGQueueRemoveEvent(plr->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, bgQueueTypeId, ginfo->RemoveInviteTime);
|
||||
|
|
@ -495,7 +495,7 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * b
|
|||
plr->GetGuidStr().c_str(), bg->GetInstanceID(), queueSlot, bg->GetTypeID());
|
||||
|
||||
// send status packet
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType);
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->arenaType);
|
||||
plr->GetSession()->SendPacket(&data);
|
||||
}
|
||||
return true;
|
||||
|
|
@ -751,7 +751,7 @@ this method is called when group is inserted, or player / group is removed from
|
|||
it must be called after fully adding the members of a group to ensure group joining
|
||||
should be called from BattleGround::RemovePlayer function in some cases
|
||||
*/
|
||||
void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id, uint8 arenaType, bool isRated, uint32 arenaRating)
|
||||
void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id, ArenaType arenaType, bool isRated, uint32 arenaRating)
|
||||
{
|
||||
//ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_Lock);
|
||||
//if no players in queue - do nothing
|
||||
|
|
@ -856,7 +856,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
|||
if (CheckPremadeMatch(bracket_id, MinPlayersPerTeam, MaxPlayersPerTeam))
|
||||
{
|
||||
//create new battleground
|
||||
BattleGround * bg2 = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, bracketEntry, 0, false);
|
||||
BattleGround * bg2 = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, bracketEntry, ARENA_TYPE_NONE, false);
|
||||
if (!bg2)
|
||||
{
|
||||
sLog.outError("BattleGroundQueue::Update - Cannot create battleground: %u", bgTypeId);
|
||||
|
|
@ -1104,10 +1104,10 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
|||
bgQueue.RemovePlayer(m_PlayerGuid, true);
|
||||
//update queues if battleground isn't ended
|
||||
if (bg && bg->isBattleGround() && bg->GetStatus() != STATUS_WAIT_LEAVE)
|
||||
sBattleGroundMgr.ScheduleQueueUpdate(0, 0, m_BgQueueTypeId, m_BgTypeId, bg->GetBracketId());
|
||||
sBattleGroundMgr.ScheduleQueueUpdate(0, ARENA_TYPE_NONE, m_BgQueueTypeId, m_BgTypeId, bg->GetBracketId());
|
||||
|
||||
WorldPacket data;
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0);
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, ARENA_TYPE_NONE);
|
||||
plr->GetSession()->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
|
|
@ -1171,7 +1171,7 @@ void BattleGroundMgr::Update(uint32 diff)
|
|||
for (uint8 i = 0; i < scheduled.size(); i++)
|
||||
{
|
||||
uint32 arenaRating = scheduled[i] >> 32;
|
||||
uint8 arenaType = scheduled[i] >> 24 & 255;
|
||||
ArenaType arenaType = ArenaType(scheduled[i] >> 24 & 255);
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundQueueTypeId(scheduled[i] >> 16 & 255);
|
||||
BattleGroundTypeId bgTypeId = BattleGroundTypeId((scheduled[i] >> 8) & 255);
|
||||
BattleGroundBracketId bracket_id = BattleGroundBracketId(scheduled[i] & 255);
|
||||
|
|
@ -1215,7 +1215,7 @@ void BattleGroundMgr::Update(uint32 diff)
|
|||
}
|
||||
}
|
||||
|
||||
void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket *data, BattleGround *bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype)
|
||||
void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket *data, BattleGround *bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, ArenaType arenatype)
|
||||
{
|
||||
// we can be in 2 queues in same time...
|
||||
|
||||
|
|
@ -1470,7 +1470,7 @@ uint32 BattleGroundMgr::CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeI
|
|||
}
|
||||
|
||||
// create a new battleground that will really be used to play
|
||||
BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 arenaType, bool isRated)
|
||||
BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, ArenaType arenaType, bool isRated)
|
||||
{
|
||||
// get the template BG
|
||||
BattleGround *bg_template = GetBattleGroundTemplate(bgTypeId);
|
||||
|
|
@ -1871,7 +1871,7 @@ bool BattleGroundMgr::IsArenaType(BattleGroundTypeId bgTypeId)
|
|||
bgTypeId == BATTLEGROUND_RL );
|
||||
}
|
||||
|
||||
BattleGroundQueueTypeId BattleGroundMgr::BGQueueTypeId(BattleGroundTypeId bgTypeId, uint8 arenaType)
|
||||
BattleGroundQueueTypeId BattleGroundMgr::BGQueueTypeId(BattleGroundTypeId bgTypeId, ArenaType arenaType)
|
||||
{
|
||||
switch(bgTypeId)
|
||||
{
|
||||
|
|
@ -1936,7 +1936,7 @@ BattleGroundTypeId BattleGroundMgr::BGTemplateId(BattleGroundQueueTypeId bgQueue
|
|||
}
|
||||
}
|
||||
|
||||
uint8 BattleGroundMgr::BGArenaType(BattleGroundQueueTypeId bgQueueTypeId)
|
||||
ArenaType BattleGroundMgr::BGArenaType(BattleGroundQueueTypeId bgQueueTypeId)
|
||||
{
|
||||
switch(bgQueueTypeId)
|
||||
{
|
||||
|
|
@ -1947,7 +1947,7 @@ uint8 BattleGroundMgr::BGArenaType(BattleGroundQueueTypeId bgQueueTypeId)
|
|||
case BATTLEGROUND_QUEUE_5v5:
|
||||
return ARENA_TYPE_5v5;
|
||||
default:
|
||||
return 0;
|
||||
return ARENA_TYPE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1969,7 +1969,7 @@ void BattleGroundMgr::ToggleArenaTesting()
|
|||
sWorld.SendWorldText(LANG_DEBUG_ARENA_OFF);
|
||||
}
|
||||
|
||||
void BattleGroundMgr::ScheduleQueueUpdate(uint32 arenaRating, uint8 arenaType, BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id)
|
||||
void BattleGroundMgr::ScheduleQueueUpdate(uint32 arenaRating, ArenaType arenaType, BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id)
|
||||
{
|
||||
//ACE_Guard<ACE_Thread_Mutex> guard(SchedulerLock);
|
||||
//we will use only 1 number created of bgTypeId and bracket_id
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include "Common.h"
|
||||
#include "Policies/Singleton.h"
|
||||
#include "Utilities/EventProcessor.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "DBCEnums.h"
|
||||
#include "BattleGround.h"
|
||||
#include "ace/Recursive_Thread_Mutex.h"
|
||||
|
|
@ -53,7 +54,7 @@ struct GroupQueueInfo // stores informatio
|
|||
Team GroupTeam; // Player team (ALLIANCE/HORDE)
|
||||
BattleGroundTypeId BgTypeId; // battleground type id
|
||||
bool IsRated; // rated
|
||||
uint8 ArenaType; // 2v2, 3v3, 5v5 or 0 when BG
|
||||
ArenaType arenaType; // 2v2, 3v3, 5v5 or 0 when BG
|
||||
uint32 ArenaTeamId; // team id if rated match
|
||||
uint32 JoinTime; // time when group was added
|
||||
uint32 RemoveInviteTime; // time when we will remove invite for players in group
|
||||
|
|
@ -78,13 +79,13 @@ class BattleGroundQueue
|
|||
BattleGroundQueue();
|
||||
~BattleGroundQueue();
|
||||
|
||||
void Update(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id, uint8 arenaType = 0, bool isRated = false, uint32 minRating = 0);
|
||||
void Update(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id, ArenaType arenaType = ARENA_TYPE_NONE, bool isRated = false, uint32 minRating = 0);
|
||||
|
||||
void FillPlayersToBG(BattleGround* bg, BattleGroundBracketId bracket_id);
|
||||
bool CheckPremadeMatch(BattleGroundBracketId bracket_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam);
|
||||
bool CheckNormalMatch(BattleGround* bg_template, BattleGroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers);
|
||||
bool CheckSkirmishForSameFaction(BattleGroundBracketId bracket_id, uint32 minPlayersPerTeam);
|
||||
GroupQueueInfo * AddGroup(Player* leader, Group* group, BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 ArenaTeamId = 0);
|
||||
GroupQueueInfo * AddGroup(Player* leader, Group* group, BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, ArenaType arenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 ArenaTeamId = 0);
|
||||
void RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount);
|
||||
bool IsPlayerInvited(ObjectGuid pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime);
|
||||
bool GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo* ginfo);
|
||||
|
|
@ -143,7 +144,7 @@ class BattleGroundQueue
|
|||
class BGQueueInviteEvent : public BasicEvent
|
||||
{
|
||||
public:
|
||||
BGQueueInviteEvent(ObjectGuid pl_guid, uint32 BgInstanceGUID, BattleGroundTypeId BgTypeId, uint8 arenaType, uint32 removeTime) :
|
||||
BGQueueInviteEvent(ObjectGuid pl_guid, uint32 BgInstanceGUID, BattleGroundTypeId BgTypeId, ArenaType arenaType, uint32 removeTime) :
|
||||
m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_ArenaType(arenaType), m_RemoveTime(removeTime)
|
||||
{
|
||||
};
|
||||
|
|
@ -155,7 +156,7 @@ class BGQueueInviteEvent : public BasicEvent
|
|||
ObjectGuid m_PlayerGuid;
|
||||
uint32 m_BgInstanceGUID;
|
||||
BattleGroundTypeId m_BgTypeId;
|
||||
uint8 m_ArenaType;
|
||||
ArenaType m_ArenaType;
|
||||
uint32 m_RemoveTime;
|
||||
};
|
||||
|
||||
|
|
@ -198,7 +199,7 @@ class BattleGroundMgr
|
|||
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);
|
||||
void BuildBattleGroundStatusPacket(WorldPacket *data, BattleGround *bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, ArenaType arenatype);
|
||||
void BuildPlaySoundPacket(WorldPacket *data, uint32 soundid);
|
||||
|
||||
/* Battlegrounds */
|
||||
|
|
@ -206,7 +207,7 @@ class BattleGroundMgr
|
|||
BattleGround* GetBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId); //there must be uint32 because MAX_BATTLEGROUND_TYPE_ID means unknown
|
||||
|
||||
BattleGround* GetBattleGroundTemplate(BattleGroundTypeId bgTypeId);
|
||||
BattleGround* CreateNewBattleGround(BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 arenaType, bool isRated);
|
||||
BattleGround* CreateNewBattleGround(BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, ArenaType arenaType, bool isRated);
|
||||
|
||||
uint32 CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char const* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO);
|
||||
|
||||
|
|
@ -230,7 +231,7 @@ class BattleGroundMgr
|
|||
|
||||
BGFreeSlotQueueType BGFreeSlotQueue[MAX_BATTLEGROUND_TYPE_ID];
|
||||
|
||||
void ScheduleQueueUpdate(uint32 arenaRating, uint8 arenaType, BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id);
|
||||
void ScheduleQueueUpdate(uint32 arenaRating, ArenaType arenaType, BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id);
|
||||
uint32 GetMaxRatingDifference() const;
|
||||
uint32 GetRatingDiscardTimer() const;
|
||||
uint32 GetPrematureFinishTime() const;
|
||||
|
|
@ -270,9 +271,9 @@ class BattleGroundMgr
|
|||
|
||||
static bool IsArenaType(BattleGroundTypeId bgTypeId);
|
||||
static bool IsBattleGroundType(BattleGroundTypeId bgTypeId) { return !BattleGroundMgr::IsArenaType(bgTypeId); }
|
||||
static BattleGroundQueueTypeId BGQueueTypeId(BattleGroundTypeId bgTypeId, uint8 arenaType);
|
||||
static BattleGroundQueueTypeId BGQueueTypeId(BattleGroundTypeId bgTypeId, ArenaType arenaType);
|
||||
static BattleGroundTypeId BGTemplateId(BattleGroundQueueTypeId bgQueueTypeId);
|
||||
static uint8 BGArenaType(BattleGroundQueueTypeId bgQueueTypeId);
|
||||
static ArenaType BGArenaType(BattleGroundQueueTypeId bgQueueTypeId);
|
||||
|
||||
static HolidayIds BGTypeToWeekendHolidayId(BattleGroundTypeId bgTypeId);
|
||||
static BattleGroundTypeId WeekendHolidayIdToBGType(HolidayIds holiday);
|
||||
|
|
|
|||
|
|
@ -496,7 +496,10 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
|
|||
return;
|
||||
}
|
||||
|
||||
uint8 slot = ArenaTeam::GetSlotByType(type);
|
||||
if (!IsArenaTypeValid(ArenaType(type)))
|
||||
return;
|
||||
|
||||
uint8 slot = ArenaTeam::GetSlotByType(ArenaType(type));
|
||||
if(slot >= MAX_ARENA_SLOT)
|
||||
return;
|
||||
|
||||
|
|
@ -647,7 +650,10 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
|
|||
return;
|
||||
}
|
||||
|
||||
uint8 slot = ArenaTeam::GetSlotByType(type);
|
||||
if (!IsArenaTypeValid(ArenaType(type)))
|
||||
return;
|
||||
|
||||
uint8 slot = ArenaTeam::GetSlotByType(ArenaType(type));
|
||||
if(slot >= MAX_ARENA_SLOT)
|
||||
return;
|
||||
|
||||
|
|
@ -752,7 +758,10 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
|||
}
|
||||
else
|
||||
{
|
||||
uint8 slot = ArenaTeam::GetSlotByType(type);
|
||||
if (!IsArenaTypeValid(ArenaType(type)))
|
||||
return;
|
||||
|
||||
uint8 slot = ArenaTeam::GetSlotByType(ArenaType(type));
|
||||
if (slot >= MAX_ARENA_SLOT)
|
||||
return;
|
||||
|
||||
|
|
@ -844,7 +853,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
|||
else // or arena team
|
||||
{
|
||||
ArenaTeam* at = new ArenaTeam;
|
||||
if (!at->Create(_player->GetObjectGuid(), type, name))
|
||||
if (!at->Create(_player->GetObjectGuid(), ArenaType(type), name))
|
||||
{
|
||||
sLog.outError("PetitionsHandler: arena team create failed.");
|
||||
delete at;
|
||||
|
|
|
|||
|
|
@ -6697,7 +6697,7 @@ uint32 Player::GetRankFromDB(ObjectGuid guid)
|
|||
return 0;
|
||||
}
|
||||
|
||||
uint32 Player::GetArenaTeamIdFromDB(ObjectGuid guid, uint8 type)
|
||||
uint32 Player::GetArenaTeamIdFromDB(ObjectGuid guid, ArenaType type)
|
||||
{
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT arena_team_member.arenateamid FROM arena_team_member JOIN arena_team ON arena_team_member.arenateamid = arena_team.arenateamid WHERE guid='%u' AND type='%u' LIMIT 1", guid.GetCounter(), type);
|
||||
if (!result)
|
||||
|
|
|
|||
|
|
@ -1802,7 +1802,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
|||
static void RemovePetitionsAndSigns(ObjectGuid guid, uint32 type);
|
||||
|
||||
// Arena Team
|
||||
void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot, uint8 type)
|
||||
void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot, ArenaType type)
|
||||
{
|
||||
SetArenaTeamInfoField(slot, ARENA_TEAM_ID, ArenaTeamId);
|
||||
SetArenaTeamInfoField(slot, ARENA_TEAM_TYPE, type);
|
||||
|
|
@ -1813,7 +1813,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
|||
}
|
||||
uint32 GetArenaTeamId(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_ID); }
|
||||
uint32 GetArenaPersonalRating(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING); }
|
||||
static uint32 GetArenaTeamIdFromDB(ObjectGuid guid, uint8 slot);
|
||||
static uint32 GetArenaTeamIdFromDB(ObjectGuid guid, ArenaType type);
|
||||
void SetArenaTeamIdInvited(uint32 ArenaTeamId) { m_ArenaTeamIdInvited = ArenaTeamId; }
|
||||
uint32 GetArenaTeamIdInvited() { return m_ArenaTeamIdInvited; }
|
||||
static void LeaveAllArenaTeams(ObjectGuid guid);
|
||||
|
|
|
|||
|
|
@ -2722,6 +2722,16 @@ enum BattleGroundTypeId
|
|||
};
|
||||
#define MAX_BATTLEGROUND_TYPE_ID 33
|
||||
|
||||
enum ArenaType
|
||||
{
|
||||
ARENA_TYPE_NONE = 0, // used for mark non-arenas or problematic cases
|
||||
ARENA_TYPE_2v2 = 2,
|
||||
ARENA_TYPE_3v3 = 3,
|
||||
ARENA_TYPE_5v5 = 5
|
||||
};
|
||||
|
||||
inline bool IsArenaTypeValid(ArenaType type) { return type == ARENA_TYPE_2v2 || type == ARENA_TYPE_3v3 || type == ARENA_TYPE_5v5; }
|
||||
|
||||
enum MailResponseType
|
||||
{
|
||||
MAIL_SEND = 0,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11354"
|
||||
#define REVISION_NR "11355"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue