Created
September 16, 2012 23:50
-
-
Save Subv/3734863 to your computer and use it in GitHub Desktop.
Battlegrounds, from @Flemzard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp | |
index cbaab48..490bf07 100644 | |
--- a/src/server/game/Battlefield/Battlefield.cpp | |
+++ b/src/server/game/Battlefield/Battlefield.cpp | |
@@ -34,13 +34,12 @@ | |
Battlefield::Battlefield() | |
{ | |
- m_Guid = MAKE_NEW_GUID(m_TypeId, 0, HIGHGUID_TYPE_BATTLEGROUND); | |
- | |
m_Timer = 0; | |
m_IsEnabled = true; | |
m_isActive = false; | |
m_DefenderTeam = TEAM_NEUTRAL; | |
+ m_Guid = 0; | |
m_TypeId = 0; | |
m_BattleId = 0; | |
m_ZoneId = 0; | |
warning: LF will be replaced by CRLF in src/server/game/Battlefield/Battlefield.cpp. | |
The file will have its original line endings in your working directory. | |
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp | |
index 9a701b5..f2e2437 100644 | |
--- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp | |
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp | |
@@ -47,6 +47,7 @@ bool BattlefieldWG::SetupBattlefield() | |
InitStalker(BATTLEFIELD_WG_NPC_STALKER, WintergraspStalkerPos[0], WintergraspStalkerPos[1], WintergraspStalkerPos[2], WintergraspStalkerPos[3]); | |
m_TypeId = BATTLEFIELD_WG; // See enum BattlefieldTypes | |
+ m_Guid = MAKE_NEW_GUID(m_TypeId, 0, HIGHGUID_TYPE_BATTLEGROUND); | |
m_BattleId = BATTLEFIELD_BATTLEID_WG; | |
m_ZoneId = BATTLEFIELD_WG_ZONEID; | |
m_MapId = BATTLEFIELD_WG_MAPID; | |
warning: LF will be replaced by CRLF in src/server/game/Battlefield/Zones/BattlefieldWG.cpp. | |
The file will have its original line endings in your working directory. | |
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp | |
index ab69ed4..c961665 100755 | |
--- a/src/server/game/Battlegrounds/Battleground.cpp | |
+++ b/src/server/game/Battlegrounds/Battleground.cpp | |
@@ -131,7 +131,7 @@ void Battleground::BroadcastWorker(Do& _do) | |
Battleground::Battleground() | |
{ | |
- m_Guid = MAKE_NEW_GUID(m_TypeID, 0, HIGHGUID_TYPE_BATTLEGROUND); | |
+ m_Guid = 0; | |
m_TypeID = BATTLEGROUND_TYPE_NONE; | |
m_RandomTypeID = BATTLEGROUND_TYPE_NONE; | |
m_InstanceID = 0; | |
@@ -494,7 +494,7 @@ inline void Battleground::_ProcessJoin(uint32 diff) | |
WorldPacket status; | |
BattlegroundQueueTypeId bgQueueTypeId = sBattlegroundMgr->BGQueueTypeId(m_TypeID, GetArenaType()); | |
uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId); | |
- sBattlegroundMgr->BuildBattlegroundStatusPacket(&status, this, player, queueSlot, STATUS_IN_PROGRESS, 0, GetStartTime(), GetArenaType()); | |
+ sBattlegroundMgr->BuildBattlegroundStatusPacket(&status, this, player, queueSlot, STATUS_IN_PROGRESS, GetEndTime(), GetStartTime(), GetArenaType()); | |
player->GetSession()->SendPacket(&status); | |
player->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION); | |
warning: LF will be replaced by CRLF in src/server/game/Battlegrounds/Battleground.cpp. | |
The file will have its original line endings in your working directory. | |
diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h | |
index 67f5199..1826e83 100755 | |
--- a/src/server/game/Battlegrounds/Battleground.h | |
+++ b/src/server/game/Battlegrounds/Battleground.h | |
@@ -259,25 +259,25 @@ enum BattlegroundStartingEventsIds | |
}; | |
#define BG_STARTING_EVENT_COUNT 4 | |
+// @TODO finish to update this enum | |
enum GroupJoinBattlegroundResult | |
{ | |
- // 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. | |
+ ERR_BATTLEGROUND_NONE = 0, // 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_BATTLEGROUND_TEAM_LEFT_QUEUE_2 = 13, // Your team has left the arena queue | |
+ ERR_LFG_CANT_USE_BATTLEGROUND = 14, // You cannot queue for a battleground or arena while using the dungeon system. | |
+ ERR_IN_RANDOM_BG = 15, // Can't do that while in a Random Battleground queue. | |
+ ERR_IN_NON_RANDOM_BG = 16 // Can't queue for Random Battleground while in another Battleground queue. | |
}; | |
class BattlegroundScore | |
@@ -368,6 +368,7 @@ class Battleground | |
bool IsRandom() const { return m_IsRandom; } | |
// Set methods: | |
+ void SetGuid(uint64 newGuid) { m_Guid = newGuid; } | |
void SetName(char const* Name) { m_Name = Name; } | |
void SetTypeID(BattlegroundTypeId TypeID) { m_TypeID = TypeID; } | |
void SetRandomTypeID(BattlegroundTypeId TypeID) { m_RandomTypeID = TypeID; } | |
warning: LF will be replaced by CRLF in src/server/game/Battlegrounds/Battleground.h. | |
The file will have its original line endings in your working directory. | |
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp | |
index becfc70..050b08a 100755 | |
--- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp | |
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp | |
@@ -187,89 +187,24 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket *data, Battlegro | |
ObjectGuid guidBytes1 = pPlayer->GetGUID(); | |
ObjectGuid guidBytes2 = bg->GetGUID(); | |
- | |
+ | |
switch (StatusID) | |
{ | |
case STATUS_NONE: | |
{ | |
- data->Initialize(SMSG_BATTLEFIELD_STATUS_FAILED); | |
- ObjectGuid unkGuid1 = 0; // Not seen packets | |
- ObjectGuid unkGuid2 = 0; // Not seen packets | |
- | |
- data->Initialize(SMSG_BATTLEFIELD_STATUS_FAILED); | |
- | |
- data->WriteBit(guidBytes2[3]); | |
- data->WriteBit(unkGuid2[3]); | |
- data->WriteBit(unkGuid1[3]); | |
- data->WriteBit(unkGuid2[0]); | |
- data->WriteBit(guidBytes2[6]); | |
- data->WriteBit(unkGuid1[5]); | |
- data->WriteBit(unkGuid1[6]); | |
- data->WriteBit(unkGuid1[4]); | |
- | |
- data->WriteBit(unkGuid1[2]); | |
- data->WriteBit(unkGuid2[1]); | |
- data->WriteBit(guidBytes2[1]); | |
- data->WriteBit(unkGuid2[5]); | |
- data->WriteBit(unkGuid2[6]); | |
- data->WriteBit(unkGuid1[1]); | |
- data->WriteBit(guidBytes2[7]); | |
- data->WriteBit(unkGuid2[4]); | |
- | |
- data->WriteBit(guidBytes2[2]); | |
- data->WriteBit(guidBytes2[5]); | |
- data->WriteBit(unkGuid2[7]); | |
- data->WriteBit(guidBytes2[4]); | |
- data->WriteBit(guidBytes2[0]); | |
- data->WriteBit(unkGuid1[0]); | |
- data->WriteBit(unkGuid2[2]); | |
- data->WriteBit(unkGuid1[7]); | |
- | |
- data->WriteByteSeq(guidBytes2[1]); | |
- | |
- *data << uint32(bg->GetStatus()); | |
- *data << uint32(QueueSlot); | |
- | |
- data->WriteByteSeq(unkGuid1[6]); | |
- data->WriteByteSeq(unkGuid1[3]); | |
- data->WriteByteSeq(unkGuid1[7]); | |
- data->WriteByteSeq(unkGuid1[4]); | |
- data->WriteByteSeq(guidBytes2[0]); | |
- data->WriteByteSeq(unkGuid1[5]); | |
- data->WriteByteSeq(guidBytes2[7]); | |
- data->WriteByteSeq(guidBytes2[6]); | |
- data->WriteByteSeq(guidBytes2[2]); | |
- data->WriteByteSeq(unkGuid2[6]); | |
- data->WriteByteSeq(unkGuid2[3]); | |
- data->WriteByteSeq(unkGuid1[1]); | |
- data->WriteByteSeq(guidBytes2[3]); | |
- data->WriteByteSeq(unkGuid2[0]); | |
- data->WriteByteSeq(unkGuid2[1]); | |
- data->WriteByteSeq(unkGuid2[4]); | |
- data->WriteByteSeq(unkGuid1[0]); | |
- data->WriteByteSeq(guidBytes2[5]); | |
- data->WriteByteSeq(unkGuid2[7]); | |
- data->WriteByteSeq(guidBytes2[4]); | |
- data->WriteByteSeq(unkGuid1[2]); | |
- | |
- *data << uint32(bg->GetTypeID()); | |
- | |
- data->WriteByteSeq(unkGuid2[2]); | |
- | |
- *data << uint32(time(NULL)); | |
- | |
- data->WriteByteSeq(unkGuid2[5]); | |
+ data->Initialize(SMSG_BATTLEFIELD_STATUS); | |
+ *data << uint32(QueueSlot); // Queue slot | |
break; | |
} | |
case STATUS_WAIT_QUEUE: | |
{ | |
data->Initialize(SMSG_BATTLEFIELD_STATUS_QUEUED); | |
- | |
+ | |
data->WriteBit(guidBytes1[3]); | |
data->WriteBit(guidBytes1[0]); | |
data->WriteBit(guidBytes2[3]); | |
data->WriteBit(guidBytes1[2]); | |
- data->WriteBit(0); // unk | |
+ data->WriteBit(1); // Eligible In Queue | |
data->WriteBit(0); // Join Failed | |
data->WriteBit(guidBytes2[2]); | |
data->WriteBit(guidBytes1[1]); | |
@@ -283,16 +218,16 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket *data, Battlegro | |
data->WriteBit(guidBytes1[4]); | |
data->WriteBit(guidBytes1[5]); | |
data->WriteBit(0); // unk | |
- data->WriteBit(0); // unk | |
+ data->WriteBit(0); // Waiting On Other Activity | |
data->WriteBit(guidBytes2[1]); | |
- | |
+ | |
data->FlushBits(); | |
- | |
+ | |
data->WriteByteSeq(guidBytes1[0]); | |
- *data << uint32(0); // unk | |
+ *data << uint32(1); // unk - always 1 | |
data->WriteByteSeq(guidBytes2[5]); | |
data->WriteByteSeq(guidBytes1[3]); | |
- *data << uint32(0); // unk | |
+ *data << uint32(Time1); // Estimated Wait Time | |
data->WriteByteSeq(guidBytes2[7]); | |
data->WriteByteSeq(guidBytes2[1]); | |
data->WriteByteSeq(guidBytes2[2]); | |
@@ -305,15 +240,14 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket *data, Battlegro | |
data->WriteByteSeq(guidBytes2[3]); | |
data->WriteByteSeq(guidBytes1[6]); | |
data->WriteByteSeq(guidBytes2[0]); | |
- *data << uint32(bg->GetStartTime()); // Time | |
- *data << uint32(0); // unk | |
+ *data << uint32(time(NULL)); // Time | |
+ *data << uint32(QueueSlot); // Queue slot | |
*data << uint8(bg->GetMinLevel()); // Min Level | |
- *data << uint32(0); // unk | |
+ *data << uint32(Time2); // Time since started | |
data->WriteByteSeq(guidBytes1[1]); | |
data->WriteByteSeq(guidBytes1[5]); | |
*data << uint32(0); // unk | |
data->WriteByteSeq(guidBytes1[4]); | |
- | |
break; | |
} | |
case STATUS_WAIT_JOIN: | |
@@ -324,7 +258,7 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket *data, Battlegro | |
*data << uint32(Time1); // Time until closed | |
*data << uint8(0); // unk | |
*data << uint32(QueueSlot); // Queue slot | |
- *data << uint32(Time2); // Time | |
+ *data << uint32(time(NULL)); // Time | |
*data << uint8(bg->GetMinLevel()); // Min Level | |
*data << uint32(bg->GetStatus()); // Status | |
*data << uint32(bg->GetMapId()); // Map Id | |
@@ -377,7 +311,7 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket *data, Battlegro | |
data->WriteBit(guidBytes2[7]); | |
data->WriteBit(guidBytes2[1]); | |
data->WriteBit(guidBytes1[5]); | |
- data->WriteBit(0); // Unk | |
+ data->WriteBit(0); // Battlefield Faction ( 0 horde, 1 alliance ) | |
data->WriteBit(guidBytes2[0]); | |
data->WriteBit(guidBytes1[1]); | |
data->WriteBit(guidBytes2[3]); | |
@@ -402,8 +336,8 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket *data, Battlegro | |
data->WriteByteSeq(guidBytes2[7]); | |
data->WriteByteSeq(guidBytes1[6]); | |
- *data << uint32(Time2); // Time | |
- *data << uint8(bg->GetPlayersCountByTeam(bg->GetPlayerTeam(pPlayer->GetGUID()))); // Teamsize | |
+ *data << uint32(time(NULL)); // Time | |
+ *data << uint8(arenatype); // Teamsize (0 if not arena) | |
data->WriteByteSeq(guidBytes1[4]); | |
data->WriteByteSeq(guidBytes1[1]); | |
@@ -413,11 +347,11 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket *data, Battlegro | |
*data << uint32(bg->GetStatus()); // Status | |
*data << uint32(bg->GetMapId()); // Map Id | |
*data << uint8(bg->GetMinLevel()); // Min Level | |
- *data << uint32(Time1); // Time until closed | |
+ *data << uint32(Time2); // Time since started | |
data->WriteByteSeq(guidBytes1[2]); | |
- *data << uint32(bg->GetStartTime()); // Time since started | |
+ *data << uint32(Time1); // Time until closed | |
data->WriteByteSeq(guidBytes1[0]); | |
data->WriteByteSeq(guidBytes1[3]); | |
@@ -436,7 +370,7 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket *data, Battlegro | |
*data << uint8(0); // unk | |
*data << uint32(bg->GetStatus()); // Status | |
*data << uint32(QueueSlot); // Queue slot | |
- *data << uint32(Time1); // Time until closed | |
+ *data << uint32(bg->GetEndTime()); // Time until closed | |
*data << uint32(0); // unk | |
*data << uint8(0); // unk | |
*data << uint8(0); // unk | |
@@ -444,7 +378,7 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket *data, Battlegro | |
*data << uint8(0); // unk | |
*data << uint8(0); // unk | |
*data << uint32(bg->GetMapId()); // Map Id | |
- *data << uint32(Time2); // Time | |
+ *data << uint32(time(NULL)); // Time | |
*data << uint8(0); // unk | |
data->WriteBit(guidBytes2[0]); | |
@@ -722,13 +656,136 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg) | |
*data << uint8(0); // unk | |
} | |
-void BattlegroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket* data, Battleground* bg, Player* pPlayer, GroupJoinBattlegroundResult result) | |
+void BattlegroundMgr::BuildStatusFailedPacket(WorldPacket* data, Battleground* bg, Player* pPlayer, uint8 QueueSlot, GroupJoinBattlegroundResult result) | |
{ | |
- ObjectGuid guidBytes1 = pPlayer->GetGUID(); | |
+ //ObjectGuid guidBytes1 = pPlayer->GetGUID(); | |
ObjectGuid guidBytes2 = bg->GetGUID(); | |
data->Initialize(SMSG_BATTLEFIELD_STATUS_FAILED); | |
+ | |
+ ObjectGuid unkGuid1 = 0; // Not seen packets | |
+ ObjectGuid unkGuid2 = 0; // Not seen packets | |
+ | |
+ data->WriteBit(guidBytes2[3]); | |
+ data->WriteBit(unkGuid2[3]); | |
+ data->WriteBit(unkGuid1[3]); | |
+ data->WriteBit(unkGuid2[0]); | |
+ data->WriteBit(guidBytes2[6]); | |
+ data->WriteBit(unkGuid1[5]); | |
+ data->WriteBit(unkGuid1[6]); | |
+ data->WriteBit(unkGuid1[4]); | |
+ | |
+ data->WriteBit(unkGuid1[2]); | |
+ data->WriteBit(unkGuid2[1]); | |
+ data->WriteBit(guidBytes2[1]); | |
+ data->WriteBit(unkGuid2[5]); | |
+ data->WriteBit(unkGuid2[6]); | |
+ data->WriteBit(unkGuid1[1]); | |
+ data->WriteBit(guidBytes2[7]); | |
+ data->WriteBit(unkGuid2[4]); | |
+ | |
+ data->WriteBit(guidBytes2[2]); | |
+ data->WriteBit(guidBytes2[5]); | |
+ data->WriteBit(unkGuid2[7]); | |
+ data->WriteBit(guidBytes2[4]); | |
+ data->WriteBit(guidBytes2[0]); | |
+ data->WriteBit(unkGuid1[0]); | |
+ data->WriteBit(unkGuid2[2]); | |
+ data->WriteBit(unkGuid1[7]); | |
+ | |
+ data->WriteByteSeq(guidBytes2[1]); | |
+ | |
+ *data << uint32(bg->GetStatus()); // Status | |
+ *data << uint32(QueueSlot); // Queue slot | |
+ | |
+ data->WriteByteSeq(unkGuid1[6]); | |
+ data->WriteByteSeq(unkGuid1[3]); | |
+ data->WriteByteSeq(unkGuid1[7]); | |
+ data->WriteByteSeq(unkGuid1[4]); | |
+ data->WriteByteSeq(guidBytes2[0]); | |
+ data->WriteByteSeq(unkGuid1[5]); | |
+ data->WriteByteSeq(guidBytes2[7]); | |
+ data->WriteByteSeq(guidBytes2[6]); | |
+ data->WriteByteSeq(guidBytes2[2]); | |
+ data->WriteByteSeq(unkGuid2[6]); | |
+ data->WriteByteSeq(unkGuid2[3]); | |
+ data->WriteByteSeq(unkGuid1[1]); | |
+ data->WriteByteSeq(guidBytes2[3]); | |
+ data->WriteByteSeq(unkGuid2[0]); | |
+ data->WriteByteSeq(unkGuid2[1]); | |
+ data->WriteByteSeq(unkGuid2[4]); | |
+ data->WriteByteSeq(unkGuid1[0]); | |
+ data->WriteByteSeq(guidBytes2[5]); | |
+ data->WriteByteSeq(unkGuid2[7]); | |
+ data->WriteByteSeq(guidBytes2[4]); | |
+ data->WriteByteSeq(unkGuid1[2]); | |
+ | |
+ *data << uint32(result); // Result | |
+ | |
+ data->WriteByteSeq(unkGuid2[2]); | |
+ | |
+ *data << uint32(time(NULL)); // Time | |
+ | |
+ data->WriteByteSeq(unkGuid2[5]); | |
+} | |
+ | |
+void BattlegroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket* data, Battleground* bg, Player* pPlayer) | |
+{ | |
+ ObjectGuid guidBytes1 = pPlayer->GetGUID(); | |
+ ObjectGuid guidBytes2 = bg->GetGUID(); | |
+ /* | |
+ // @TODO What now ? :/ | |
+ data->Initialize(SMSG_GROUP_JOINED_BATTLEGROUND); // new name: SMSG_BATTLEFIELD_STATUS_QUEUED | |
+ | |
+ data->WriteBit(guidBytes1[3]); | |
+ data->WriteBit(guidBytes1[0]); | |
+ data->WriteBit(guidBytes2[3]); | |
+ data->WriteBit(guidBytes1[2]); | |
+ data->WriteBit(1); // unk - always 1 | |
+ data->WriteBit(0); // Join Failed | |
+ data->WriteBit(guidBytes2[2]); | |
+ data->WriteBit(guidBytes1[1]); | |
+ data->WriteBit(guidBytes2[0]); | |
+ data->WriteBit(guidBytes2[6]); | |
+ data->WriteBit(guidBytes2[4]); | |
+ data->WriteBit(guidBytes1[6]); | |
+ data->WriteBit(guidBytes1[7]); | |
+ data->WriteBit(guidBytes2[7]); | |
+ data->WriteBit(guidBytes2[5]); | |
+ data->WriteBit(guidBytes1[4]); | |
+ data->WriteBit(guidBytes1[5]); | |
+ data->WriteBit(0); // unk | |
+ data->WriteBit(0); // unk | |
+ data->WriteBit(guidBytes2[1]); | |
+ | |
+ data->FlushBits(); | |
+ | |
+ data->WriteByteSeq(guidBytes1[0]); | |
+ *data << uint32(1); // unk - always 1 | |
+ data->WriteByteSeq(guidBytes2[5]); | |
+ data->WriteByteSeq(guidBytes1[3]); | |
+ *data << uint32(0); // unk | |
+ data->WriteByteSeq(guidBytes2[7]); | |
+ data->WriteByteSeq(guidBytes2[1]); | |
+ data->WriteByteSeq(guidBytes2[2]); | |
+ *data << uint8(0); // unk | |
+ data->WriteByteSeq(guidBytes2[4]); | |
+ data->WriteByteSeq(guidBytes1[2]); | |
+ *data << uint8(0); // unk | |
+ data->WriteByteSeq(guidBytes2[6]); | |
+ data->WriteByteSeq(guidBytes1[7]); | |
+ data->WriteByteSeq(guidBytes2[3]); | |
+ data->WriteByteSeq(guidBytes1[6]); | |
+ data->WriteByteSeq(guidBytes2[0]); | |
+ *data << uint32(bg->GetStartTime()); // Time | |
+ *data << uint32(0); // unk | |
+ *data << uint8(bg->GetMinLevel()); // Min Level | |
+ *data << uint32(0); // start timer ? it increase | |
+ data->WriteByteSeq(guidBytes1[1]); | |
+ data->WriteByteSeq(guidBytes1[5]); | |
+ *data << uint32(0); // unk | |
+ data->WriteByteSeq(guidBytes1[4]);*/ | |
} | |
void BattlegroundMgr::BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value) | |
@@ -1019,6 +1076,7 @@ uint32 BattlegroundMgr::CreateBattleground(CreateBattlegroundData& data) | |
break; | |
} | |
+ bg->SetGuid(MAKE_NEW_GUID(data.bgTypeId, 0, HIGHGUID_TYPE_BATTLEGROUND)); | |
bg->SetMapId(data.MapID); | |
bg->SetTypeID(data.bgTypeId); | |
bg->SetInstanceID(0); | |
warning: LF will be replaced by CRLF in src/server/game/Battlegrounds/BattlegroundMgr.cpp. | |
The file will have its original line endings in your working directory. | |
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.h b/src/server/game/Battlegrounds/BattlegroundMgr.h | |
index a161f36..98edcfb 100755 | |
--- a/src/server/game/Battlegrounds/BattlegroundMgr.h | |
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.h | |
@@ -69,7 +69,8 @@ class BattlegroundMgr | |
void BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, uint64 guid); | |
void BuildPlayerLeftBattlegroundPacket(WorldPacket* data, uint64 guid); | |
void BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* player, BattlegroundTypeId bgTypeId); | |
- void BuildGroupJoinedBattlegroundPacket(WorldPacket* data, Battleground* bg, Player* player, GroupJoinBattlegroundResult result); | |
+ void BuildGroupJoinedBattlegroundPacket(WorldPacket* data, Battleground* bg, Player* player); | |
+ void BuildStatusFailedPacket(WorldPacket* data, Battleground* bg, Player* pPlayer, uint8 QueueSlot, GroupJoinBattlegroundResult result); | |
void BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value); | |
void BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg); | |
void BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, Player* player, uint8 queueSlot, uint8 statusId, uint32 time1, uint32 time2, uint8 arenaType, uint8 uiFrame = 1); | |
warning: LF will be replaced by CRLF in src/server/game/Battlegrounds/BattlegroundMgr.h. | |
The file will have its original line endings in your working directory. | |
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp | |
index b9ede2e..84e5dd5 100755 | |
--- a/src/server/game/Groups/Group.cpp | |
+++ b/src/server/game/Groups/Group.cpp | |
@@ -1815,7 +1815,7 @@ GroupJoinBattlegroundResult Group::CanJoinBattlegroundQueue(Battleground const* | |
BattlemasterListEntry const* bgEntry = sBattlemasterListStore.LookupEntry(bgOrTemplate->GetTypeID()); | |
if (!bgEntry) | |
- return ERR_GROUP_JOIN_BATTLEGROUND_FAIL; // shouldn't happen | |
+ return ERR_BATTLEGROUND_JOIN_FAILED; // shouldn't happen | |
// check for min / max count | |
uint32 memberscount = GetMembersCount(); | |
warning: LF will be replaced by CRLF in src/server/game/Groups/Group.cpp. | |
The file will have its original line endings in your working directory. | |
diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp | |
index 9a67c37..f85f0a7 100755 | |
--- a/src/server/game/Handlers/BattleGroundHandler.cpp | |
+++ b/src/server/game/Handlers/BattleGroundHandler.cpp | |
@@ -147,9 +147,8 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData) | |
{ | |
if (GetPlayer()->isUsingLfg()) | |
{ | |
- // player is using dungeon finder or raid finder | |
WorldPacket data; | |
- sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, bg, _player, ERR_LFG_CANT_USE_BATTLEGROUND); | |
+ sBattlegroundMgr->BuildStatusFailedPacket(&data, bg, _player, 0, ERR_LFG_CANT_USE_BATTLEGROUND); | |
GetPlayer()->GetSession()->SendPacket(&data); | |
return; | |
} | |
@@ -158,7 +157,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData) | |
if (!_player->CanJoinToBattleground()) | |
{ | |
WorldPacket data; | |
- sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, bg, _player, ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS); | |
+ sBattlegroundMgr->BuildStatusFailedPacket(&data, bg, _player, 0, ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS); | |
_player->GetSession()->SendPacket(&data); | |
return; | |
} | |
@@ -167,7 +166,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData) | |
{ | |
//player is already in random queue | |
WorldPacket data; | |
- sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, bg, _player, ERR_IN_RANDOM_BG); | |
+ sBattlegroundMgr->BuildStatusFailedPacket(&data, bg, _player, 0, ERR_IN_RANDOM_BG); | |
_player->GetSession()->SendPacket(&data); | |
return; | |
} | |
@@ -176,7 +175,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData) | |
{ | |
//player is already in queue, can't start random queue | |
WorldPacket data; | |
- sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, bg, _player, ERR_IN_NON_RANDOM_BG); | |
+ sBattlegroundMgr->BuildStatusFailedPacket(&data, bg, _player, 0, ERR_IN_NON_RANDOM_BG); | |
_player->GetSession()->SendPacket(&data); | |
return; | |
} | |
@@ -190,11 +189,11 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData) | |
if (!_player->HasFreeBattlegroundQueueId()) | |
{ | |
WorldPacket data; | |
- sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, bg, _player, ERR_BATTLEGROUND_TOO_MANY_QUEUES); | |
+ sBattlegroundMgr->BuildStatusFailedPacket(&data, bg, _player, 0, ERR_BATTLEGROUND_TOO_MANY_QUEUES); | |
_player->GetSession()->SendPacket(&data); | |
return; | |
} | |
- | |
+ | |
BattlegroundQueue& bgQueue = sBattlegroundMgr->m_BattlegroundQueues[bgQueueTypeId]; | |
GroupQueueInfo* ginfo = bgQueue.AddGroup(_player, NULL, bgTypeId, bracketEntry, 0, false, isPremade, 0, 0); | |
@@ -223,7 +222,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData) | |
GroupQueueInfo* ginfo = NULL; | |
uint32 avgTime = 0; | |
- if (err > 0) | |
+ if (!err) | |
{ | |
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: the following players are joining as group:"); | |
ginfo = bgQueue.AddGroup(_player, grp, bgTypeId, bracketEntry, 0, false, isPremade, 0, 0); | |
@@ -238,9 +237,9 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData) | |
WorldPacket data; | |
- if (err <= 0) | |
+ if (err) | |
{ | |
- sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, bg, _player, err); | |
+ sBattlegroundMgr->BuildStatusFailedPacket(&data, bg, _player, 0, err); | |
member->GetSession()->SendPacket(&data); | |
continue; | |
} | |
@@ -251,7 +250,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData) | |
// send status packet (in queue) | |
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, member, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->ArenaType); | |
member->GetSession()->SendPacket(&data); | |
- sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, bg, _player, err); | |
+ sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, bg, _player); | |
member->GetSession()->SendPacket(&data); | |
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, member->GetGUIDLow(), member->GetName()); | |
} | |
@@ -395,13 +394,13 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData) | |
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_BATTLEFIELD_PORT Message"); | |
uint32 time; | |
- uint32 type; // guessed | |
+ uint32 queueSlot; | |
uint32 bgTypeId_; // type id from dbc | |
uint8 action; // enter battle 0x1, leave queue 0x0 | |
ObjectGuid guid; | |
recvData >> time; | |
- recvData >> type; | |
+ recvData >> queueSlot; | |
recvData >> bgTypeId_; | |
guid[0] = recvData.ReadBit(); | |
@@ -438,7 +437,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData) | |
//get GroupQueueInfo from BattlegroundQueue | |
BattlegroundTypeId bgTypeId = BattlegroundTypeId(bgTypeId_); | |
- BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(bgTypeId, type); | |
+ BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(bgTypeId, 0); | |
BattlegroundQueue& bgQueue = sBattlegroundMgr->m_BattlegroundQueues[bgQueueTypeId]; | |
//we must use temporary variable, because GroupQueueInfo pointer can be deleted in BattlegroundQueue::RemovePlayer() function | |
GroupQueueInfo ginfo; | |
@@ -478,7 +477,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData) | |
{ | |
//send bg command result to show nice message | |
WorldPacket data2; | |
- sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data2, bg, _player, ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS); | |
+ sBattlegroundMgr->BuildStatusFailedPacket(&data2, bg, _player, 0, ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS); | |
_player->GetSession()->SendPacket(&data2); | |
action = 0; | |
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player %s (%u) has a deserter debuff, do not port him to battleground!", _player->GetName(), _player->GetGUIDLow()); | |
@@ -491,7 +490,8 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData) | |
action = 0; | |
} | |
} | |
- uint32 queueSlot = _player->GetBattlegroundQueueIndex(bgQueueTypeId); | |
+ //uint32 queueSlot = _player->GetBattlegroundQueueIndex(bgQueueTypeId); | |
+ | |
WorldPacket data; | |
switch (action) | |
{ | |
@@ -515,7 +515,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData) | |
_player->CleanupAfterTaxiFlight(); | |
} | |
- sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, _player, queueSlot, STATUS_IN_PROGRESS, 0, bg->GetStartTime(), bg->GetArenaType()); | |
+ sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, _player, queueSlot, STATUS_IN_PROGRESS, bg->GetEndTime(), bg->GetStartTime(), bg->GetArenaType()); | |
_player->GetSession()->SendPacket(&data); | |
// remove battleground queue status from BGmgr | |
bgQueue.RemovePlayer(_player->GetGUID(), false); | |
@@ -580,7 +580,7 @@ void WorldSession::HandleBattlefieldLeaveOpcode(WorldPacket& recvData) | |
void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recvData*/) | |
{ | |
// empty opcode | |
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Battleground status"); | |
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_BATTLEFIELD_STATUS Message"); | |
WorldPacket data; | |
// we must update all queues here | |
@@ -601,7 +601,7 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recvData*/) | |
{ | |
// this line is checked, i only don't know if GetStartTime is changing itself after bg end! | |
// send status in Battleground | |
- sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, GetPlayer(), i, STATUS_IN_PROGRESS, bg->GetEndTime(), bg->GetStartTime(), arenaType); | |
+ sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, GetPlayer(), i, STATUS_IN_PROGRESS, bg->GetEndTime(), 0, arenaType); | |
SendPacket(&data); | |
continue; | |
} | |
@@ -617,9 +617,9 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recvData*/) | |
bg = sBattlegroundMgr->GetBattleground(ginfo.IsInvitedToBGInstanceGUID, bgTypeId); | |
if (!bg) | |
continue; | |
- uint32 remainingTime = getMSTimeDiff(getMSTime(), ginfo.RemoveInviteTime); | |
+ | |
// send status invited to Battleground | |
- sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, GetPlayer(), i, STATUS_WAIT_JOIN, remainingTime, 0, arenaType); | |
+ sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, GetPlayer(), i, STATUS_WAIT_JOIN, getMSTimeDiff(getMSTime(), ginfo.RemoveInviteTime), 0, arenaType); | |
SendPacket(&data); | |
} | |
else | |
@@ -704,7 +704,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recvData) | |
if (!bracketEntry) | |
return; | |
- GroupJoinBattlegroundResult err = ERR_GROUP_JOIN_BATTLEGROUND_FAIL; | |
+ GroupJoinBattlegroundResult err = ERR_BATTLEGROUND_NONE; | |
if (!asGroup) | |
{ | |
@@ -753,7 +753,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recvData) | |
{ | |
uint32 avgTime = 0; | |
- if (err > 0) | |
+ if (!err) | |
{ | |
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: arena join as group start"); | |
if (isRated) | |
@@ -776,9 +776,9 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recvData) | |
WorldPacket data; | |
- if (err <= 0) | |
+ if (err) | |
{ | |
- sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, bg, _player, err); | |
+ sBattlegroundMgr->BuildStatusFailedPacket(&data, bg, _player, 0, err); | |
member->GetSession()->SendPacket(&data); | |
continue; | |
} | |
@@ -789,7 +789,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recvData) | |
// send status packet (in queue) | |
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, member, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype); | |
member->GetSession()->SendPacket(&data); | |
- sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, bg, _player, err); | |
+ sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, bg, _player); | |
member->GetSession()->SendPacket(&data); | |
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "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()); | |
} | |
warning: LF will be replaced by CRLF in src/server/game/Handlers/BattleGroundHandler.cpp. | |
The file will have its original line endings in your working directory. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment