thezxtreme

Arena Ready Check

Mar 9th, 2015
1,145
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. commit 2d3055f10861f0b134043915888c13e5b777785c
  2. Author: thezxtreme <thezxtreme@live.com>
  3. Date:   Sat Oct 11 23:01:39 2014 +0300
  4.  
  5.     018 - Implement arena ready check
  6.  
  7. diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
  8. index e8c3446..d4c4c7c 100644
  9. --- a/src/server/game/Battlegrounds/Battleground.cpp
  10. +++ b/src/server/game/Battlegrounds/Battleground.cpp
  11. @@ -464,6 +464,9 @@ inline void Battleground::_ProcessJoin(uint32 diff)
  12.      {
  13.          m_Events |= BG_STARTING_EVENT_2;
  14.          SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_SECOND], CHAT_MSG_BG_SYSTEM_NEUTRAL);
  15. +
  16. +        if (this->isArena())
  17. +            this->SendArenaReadyCheck();
  18.      }
  19.      // After 30 or 15 seconds, warning is signaled
  20.      else if (GetStartDelayTime() <= StartDelayTimes[BG_STARTING_EVENT_THIRD] && !(m_Events & BG_STARTING_EVENT_3))
  21. @@ -489,6 +492,13 @@ inline void Battleground::_ProcessJoin(uint32 diff)
  22.              for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
  23.                  if (Player* player = ObjectAccessor::FindPlayer(itr->first))
  24.                  {
  25. +                    if (!m_ArenaReadyCheckMap.count(itr->first))
  26. +                    {
  27. +                        WorldPacket data(0x3C6, 0x1);
  28. +                        data << uint8(0x1);
  29. +                        player->GetSession()->SendPacket(&data);
  30. +                    }
  31. +
  32.                      // BG Status packet
  33.                      WorldPacket status;
  34.                      BattlegroundQueueTypeId bgQueueTypeId = sBattlegroundMgr->BGQueueTypeId(m_TypeID, GetArenaType());
  35. @@ -519,6 +529,7 @@ inline void Battleground::_ProcessJoin(uint32 diff)
  36.                  }
  37.  
  38.              CheckWinConditions();
  39. +            m_ArenaReadyCheckMap.clear();
  40.          }
  41.          else
  42.          {
  43. @@ -1832,3 +1843,28 @@ uint8 Battleground::GetUniqueBracketId() const
  44.  {
  45.      return GetMinLevel() / 10;
  46.  }
  47. +
  48. +void Battleground::SendArenaReadyCheck() const
  49. +{
  50. +    WorldPacket packet_0x1(0x051, 0x17);
  51. +    packet_0x1.appendPackGUID(0xFFFFFFFF);
  52. +    packet_0x1 << uint8(0x0);
  53. +    packet_0x1 << std::string("Arena");
  54. +    packet_0x1 << uint8(0x0);
  55. +    packet_0x1 << uint8(0xa);
  56. +    packet_0x1 << uint8(0x0);
  57. +    packet_0x1 << uint8(0x4);
  58. +    packet_0x1 << uint8(0x0);
  59. +
  60. +    WorldPacket packet_0x2(0x322, 0x8);
  61. +    packet_0x2 << uint64(0xFFFFFFFF);
  62. +
  63. +    for (const auto itr : m_Players)
  64. +    {
  65. +        if (const Player* const player = ObjectAccessor::FindPlayer(itr.first))
  66. +        {
  67. +            player->GetSession()->SendPacket(&packet_0x1);
  68. +            player->GetSession()->SendPacket(&packet_0x2);
  69. +        }
  70. +    }
  71. +}
  72. diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h
  73. index 001c33c..9bd5eb8 100644
  74. --- a/src/server/game/Battlegrounds/Battleground.h
  75. +++ b/src/server/game/Battlegrounds/Battleground.h
  76. @@ -465,6 +465,9 @@ class Battleground
  77.  
  78.          virtual uint32 GetPrematureWinner();
  79.  
  80. +        std::set<uint64> m_ArenaReadyCheckMap;
  81. +        void SendArenaReadyCheck() const;
  82. +
  83.          // because BattleGrounds with different types and same level range has different m_BracketId
  84.          uint8 GetUniqueBracketId() const;
  85.  
  86. diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp
  87. index 8d044e7..42719e8 100644
  88. --- a/src/server/game/Handlers/GroupHandler.cpp
  89. +++ b/src/server/game/Handlers/GroupHandler.cpp
  90. @@ -32,6 +32,7 @@
  91.  #include "World.h"
  92.  #include "WorldPacket.h"
  93.  #include "WorldSession.h"
  94. +#include "Battleground.h"
  95.  
  96.  class Aura;
  97.  
  98. @@ -691,6 +692,9 @@ void WorldSession::HandleRaidReadyCheckOpcode(WorldPacket& recvData)
  99.  
  100.      if (recvData.empty())                                   // request
  101.      {
  102. +        if (this->GetPlayer()->InArena())
  103. +            return;
  104. +
  105.          /** error handling **/
  106.          if (!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
  107.              return;
  108. @@ -708,6 +712,14 @@ void WorldSession::HandleRaidReadyCheckOpcode(WorldPacket& recvData)
  109.          uint8 state;
  110.          recvData >> state;
  111.  
  112. +        if (this->GetPlayer()->InArena() && state)
  113. +        {
  114. +            this->GetPlayer()->GetBattleground()->m_ArenaReadyCheckMap.insert(this->GetPlayer()->GetGUID());
  115. +
  116. +            if (this->GetPlayer()->GetBattleground()->GetPlayersSize() == this->GetPlayer()->GetBattleground()->m_ArenaReadyCheckMap.size())
  117. +                this->GetPlayer()->GetBattleground()->SetStartDelayTime(BG_START_DELAY_NONE);
  118. +        }
  119. +
  120.          // everything's fine, do it
  121.          WorldPacket data(MSG_RAID_READY_CHECK_CONFIRM, 9);
  122.          data << uint64(GetPlayer()->GetGUID());
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×