aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Handlers/BattlefieldHandler.cpp
diff options
context:
space:
mode:
authorDDuarte <dnpd.dd@gmail.com>2014-01-11 17:26:22 +0000
committerDDuarte <dnpd.dd@gmail.com>2014-01-11 17:26:22 +0000
commit08003577de2ea70fcbf4410eb889b67023bed700 (patch)
tree95f7e4c4edff9551017e4f3da2e6abf70c482140 /src/server/game/Handlers/BattlefieldHandler.cpp
parent33c2bd5ce1f4f8d20981e9f7aea90e37de0abbda (diff)
parent41b613186e06e3f41549912f91e68bafa3e8c059 (diff)
Merge branch 'master' into 4.3.4
Conflicts: dep/libmpq/CMakeLists.txt src/server/game/Battlefield/BattlefieldMgr.cpp src/server/game/Battlefield/BattlefieldMgr.h src/server/game/DataStores/DBCStores.cpp src/server/game/Entities/Creature/Creature.cpp src/server/game/Entities/Creature/Creature.h src/server/game/Entities/Object/Object.cpp src/server/game/Entities/Player/Player.h src/server/game/Entities/Unit/StatSystem.cpp src/server/game/Entities/Unit/Unit.cpp src/server/game/Entities/Vehicle/Vehicle.cpp src/server/game/Globals/ObjectMgr.cpp src/server/game/Handlers/BattlefieldHandler.cpp src/server/game/Handlers/GuildHandler.cpp src/server/game/Movement/Spline/MoveSplineInit.cpp src/server/game/Server/Protocol/Opcodes.cpp src/server/game/Server/WorldSession.h src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp src/server/scripts/EasternKingdoms/ZulAman/zulaman.h src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp src/server/scripts/EasternKingdoms/ZulGurub/boss_kilnara.cpp src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h src/server/scripts/EasternKingdoms/boss_kruul.cpp src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp src/server/scripts/Kalimdor/zone_azshara.cpp src/server/scripts/Kalimdor/zone_moonglade.cpp src/server/scripts/Kalimdor/zone_orgrimmar.cpp src/server/scripts/Kalimdor/zone_stonetalon_mountains.cpp src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp src/server/scripts/OutdoorPvP/OutdoorPvPEP.h src/server/scripts/Spells/spell_dk.cpp src/tools/map_extractor/mpq_libmpq.cpp src/tools/map_extractor/mpq_libmpq04.h src/tools/vmap4_extractor/loadlib/loadlib.h src/tools/vmap4_extractor/mpq_libmpq.cpp src/tools/vmap4_extractor/mpq_libmpq04.h
Diffstat (limited to 'src/server/game/Handlers/BattlefieldHandler.cpp')
-rw-r--r--src/server/game/Handlers/BattlefieldHandler.cpp106
1 files changed, 76 insertions, 30 deletions
diff --git a/src/server/game/Handlers/BattlefieldHandler.cpp b/src/server/game/Handlers/BattlefieldHandler.cpp
index 54bf0857c19..f963e7ac339 100644
--- a/src/server/game/Handlers/BattlefieldHandler.cpp
+++ b/src/server/game/Handlers/BattlefieldHandler.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -15,23 +15,27 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
+#include "Opcodes.h"
+#include "Player.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include "Object.h"
#include "Battlefield.h"
#include "BattlefieldMgr.h"
-#include "Opcodes.h"
-#include "Player.h"
-//This send to player windows for invite player to join the war
-//Param1:(guid) the guid of Bf
-//Param2:(ZoneId) the zone where the battle is (4197 for wg)
-//Param3:(time) Time in second that the player have for accept
-void WorldSession::SendBfInvitePlayerToWar(uint64 guid, uint32 zoneId, uint32 pTime)
+/**
+ * @fn void WorldSession::SendBfInvitePlayerToWar(uint64 guid, uint32 zoneId, uint32 acceptTime)
+ *
+ * @brief This send to player windows for invite player to join the war.
+ *
+ * @param guid The guid of Bf
+ * @param zoneId The zone where the battle is (4197 for wg)
+ * @param acceptTime Time in second that the player have for accept
+ */
+void WorldSession::SendBfInvitePlayerToWar(uint64 guid, uint32 zoneId, uint32 acceptTime)
{
ObjectGuid guidBytes = guid;
@@ -53,15 +57,19 @@ void WorldSession::SendBfInvitePlayerToWar(uint64 guid, uint32 zoneId, uint32 pT
data.WriteByteSeq(guidBytes[4]);
data.WriteByteSeq(guidBytes[2]);
data.WriteByteSeq(guidBytes[0]);
- data << uint32(time(NULL) + pTime); // Invite lasts until
+ data << uint32(time(NULL) + acceptTime); // Invite lasts until
data.WriteByteSeq(guidBytes[7]);
data.WriteByteSeq(guidBytes[5]);
-
- //Sending the packet to player
SendPacket(&data);
}
-//This send invitation to player to join the queue
+/**
+ * @fn void WorldSession::SendBfInvitePlayerToQueue(uint64 guid)
+ *
+ * @brief This send invitation to player to join the queue.
+ *
+ * @param guid The guid of Bf
+ */
void WorldSession::SendBfInvitePlayerToQueue(uint64 guid)
{
ObjectGuid guidBytes = guid;
@@ -95,17 +103,20 @@ void WorldSession::SendBfInvitePlayerToQueue(uint64 guid)
data.WriteByteSeq(guidBytes[4]);
data.WriteByteSeq(guidBytes[1]);
data.WriteByteSeq(guidBytes[7]);
-
- //Sending packet to player
SendPacket(&data);
}
-//This send packet for inform player that he join queue
-//Param1:(guid) the guid of Bf
-//Param2:(ZoneId) the zone where the battle is (4197 for wg)
-//Param3:(CanQueue) if able to queue
-//Param4:(Full) on log in is full
-void WorldSession::SendBfQueueInviteResponse(uint64 guid, uint32 ZoneId, bool CanQueue, bool Full)
+/**
+ * @fn void WorldSession::SendBfQueueInviteResponse(uint64 guid, uint32 zoneId, bool canQueue, bool full)
+ *
+ * @brief This send packet for inform player that he join queue.
+ *
+ * @param guid The guid of Bf
+ * @param zoneId The zone where the battle is (4197 for wg)
+ * @param canQueue if able to queue
+ * @param full on log in is full
+ */
+void WorldSession::SendBfQueueInviteResponse(uint64 guid, uint32 zoneId, bool canQueue, bool full)
{
const bool hasSecondGuid = false;
const bool warmup = true;
@@ -117,7 +128,7 @@ void WorldSession::SendBfQueueInviteResponse(uint64 guid, uint32 ZoneId, bool Ca
data.WriteBit(guidBytes[6]);
data.WriteBit(guidBytes[5]);
data.WriteBit(guidBytes[7]);
- data.WriteBit(Full); // Logging In, VERIFYME
+ data.WriteBit(full); // Logging In, VERIFYME
data.WriteBit(guidBytes[0]);
data.WriteBit(!hasSecondGuid);
data.WriteBit(guidBytes[4]);
@@ -131,7 +142,7 @@ void WorldSession::SendBfQueueInviteResponse(uint64 guid, uint32 ZoneId, bool Ca
data.FlushBits();
- data << uint8(CanQueue); // Accepted
+ data << uint8(canQueue); // Accepted
data.WriteByteSeq(guidBytes[1]);
data.WriteByteSeq(guidBytes[3]);
@@ -145,12 +156,18 @@ void WorldSession::SendBfQueueInviteResponse(uint64 guid, uint32 ZoneId, bool Ca
data.WriteByteSeq(guidBytes[4]);
data.WriteByteSeq(guidBytes[5]);
- data << uint32(ZoneId);
+ data << uint32(zoneId);
SendPacket(&data);
}
-//This is call when player accept to join war
+/**
+ * @fn void WorldSession::SendBfEntered(uint64 guid)
+ *
+ * @brief This is call when player accept to join war.
+ *
+ * @param guid The guid of Bf
+ */
void WorldSession::SendBfEntered(uint64 guid)
{
uint8 isAFK = _player->isAFK() ? 1 : 0;
@@ -184,7 +201,15 @@ void WorldSession::SendBfEntered(uint64 guid)
SendPacket(&data);
}
-void WorldSession::SendBfLeaveMessage(uint64 guid, BFLeaveReason reason)
+/**
+ * @fn void WorldSession::SendBfLeaveMessage(uint64 guid, BFLeaveReason reason)
+ *
+ * @brief This is call when player leave battlefield zone.
+ *
+ * @param guid The guid of Bf
+ * @param reason Reason why player left battlefield
+ */
+void WorldSession::SendBfLeaveMessage(uint64 guid, BFLeaveReason reason /*= BF_LEAVE_REASON_EXITED*/)
{
ObjectGuid guidBytes = guid;
@@ -216,7 +241,11 @@ void WorldSession::SendBfLeaveMessage(uint64 guid, BFLeaveReason reason)
SendPacket(&data);
}
-//Send by client when he click on accept for queue
+/**
+ * @fn void WorldSession::HandleBfQueueInviteResponse(WorldPacket& recvData)
+ *
+ * @brief Send by client when he click on accept for queue.
+ */
void WorldSession::HandleBfQueueInviteResponse(WorldPacket& recvData)
{
uint8 accepted;
@@ -251,7 +280,11 @@ void WorldSession::HandleBfQueueInviteResponse(WorldPacket& recvData)
bf->PlayerAcceptInviteToQueue(_player);
}
-//Send by client on clicking in accept or refuse of invitation windows for join game
+/**
+ * @fn void WorldSession::HandleBfEntryInviteResponse(WorldPacket& recvData)
+ *
+ * @brief Send by client on clicking in accept or refuse of invitation windows for join game.
+ */
void WorldSession::HandleBfEntryInviteResponse(WorldPacket& recvData)
{
uint8 accepted;
@@ -282,13 +315,23 @@ void WorldSession::HandleBfEntryInviteResponse(WorldPacket& recvData)
if (!bf)
return;
+ // If player accept invitation
if (accepted)
+ {
bf->PlayerAcceptInviteToWar(_player);
+ }
else
+ {
if (_player->GetZoneId() == bf->GetZoneId())
bf->KickPlayerFromBattlefield(_player->GetGUID());
+ }
}
+/**
+ * @fn void WorldSession::HandleBfExitRequest(WorldPacket& recvData)
+ *
+ * @brief Send by client when exited battlefield
+ */
void WorldSession::HandleBfExitRequest(WorldPacket& recvData)
{
ObjectGuid guid;
@@ -313,6 +356,9 @@ void WorldSession::HandleBfExitRequest(WorldPacket& recvData)
TC_LOG_ERROR("misc", "HandleBfExitRequest: GUID:"UI64FMTD" ", (uint64)guid);
- if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldByGUID(guid))
- bf->AskToLeaveQueue(_player);
+ Battlefield* bf = sBattlefieldMgr->GetBattlefieldByGUID(guid);
+ if (!bf)
+ return;
+
+ bf->AskToLeaveQueue(_player);
}