mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 13:16:23 +00:00
committed by
GitHub
parent
d4b3e8f201
commit
d6b9639259
@@ -15,9 +15,11 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "DBCStores.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "LFGMgr.h"
|
||||
#include "LFGPackets.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Player.h"
|
||||
@@ -44,56 +46,34 @@ void BuildPartyLockDungeonBlock(WorldPacket& data, const lfg::LfgLockPartyMap& l
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData)
|
||||
void WorldSession::HandleLfgJoinOpcode(WorldPackets::LFG::LFGJoin& packet)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(lfg::LFG_OPTION_ENABLE_DUNGEON_FINDER | lfg::LFG_OPTION_ENABLE_RAID_BROWSER | lfg::LFG_OPTION_ENABLE_SEASONAL_BOSSES))
|
||||
{
|
||||
recvData.rfinish();
|
||||
if (!sLFGMgr->isOptionEnabled(lfg::LFG_OPTION_ENABLE_DUNGEON_FINDER | lfg::LFG_OPTION_ENABLE_RAID_BROWSER) ||
|
||||
(GetPlayer()->GetGroup() && GetPlayer()->GetGroup()->GetLeaderGUID() != GetPlayer()->GetGUID() &&
|
||||
(GetPlayer()->GetGroup()->GetMembersCount() == MAXGROUPSIZE || !GetPlayer()->GetGroup()->isLFGGroup())))
|
||||
return;
|
||||
}
|
||||
|
||||
// pussywizard:
|
||||
if (Group* g = GetPlayer()->GetGroup())
|
||||
if (g->isLFGGroup() && g->GetLeaderGUID() != GetPlayer()->GetGUID())
|
||||
{
|
||||
recvData.rfinish();
|
||||
return;
|
||||
}
|
||||
|
||||
uint8 numDungeons;
|
||||
uint32 roles;
|
||||
|
||||
recvData >> roles;
|
||||
recvData.read_skip<uint16>(); // uint8 (always 0) - uint8 (always 0)
|
||||
recvData >> numDungeons;
|
||||
if (!numDungeons)
|
||||
if (packet.Slots.empty())
|
||||
{
|
||||
LOG_DEBUG("network", "CMSG_LFG_JOIN [{}] no dungeons selected", GetPlayer()->GetGUID().ToString());
|
||||
recvData.rfinish();
|
||||
LOG_DEBUG("lfg", "CMSG_LFG_JOIN {} no dungeons selected", GetPlayerInfo().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
lfg::LfgDungeonSet newDungeons;
|
||||
for (int8 i = 0; i < numDungeons; ++i)
|
||||
for (uint32 slot : packet.Slots)
|
||||
{
|
||||
uint32 dungeon;
|
||||
recvData >> dungeon;
|
||||
dungeon &= 0x00FFFFFF; // remove the type from the dungeon entry
|
||||
if (dungeon)
|
||||
uint32 dungeon = slot & 0x00FFFFFF; // remove the type from the dungeon entry
|
||||
if (sLFGDungeonStore.LookupEntry(dungeon))
|
||||
newDungeons.insert(dungeon);
|
||||
}
|
||||
|
||||
recvData.read_skip<uint32>(); // for 0..uint8 (always 3) { uint8 (always 0) }
|
||||
|
||||
std::string comment;
|
||||
recvData >> comment;
|
||||
LOG_DEBUG("network", "CMSG_LFG_JOIN [{}] roles: {}, Dungeons: {}, Comment: {}",
|
||||
GetPlayer()->GetGUID().ToString(), roles, uint8(newDungeons.size()), comment);
|
||||
GetPlayerInfo().c_str(), packet.Roles, newDungeons.size(), packet.Comment.c_str());
|
||||
|
||||
sLFGMgr->JoinLfg(GetPlayer(), uint8(roles), newDungeons, comment);
|
||||
sLFGMgr->JoinLfg(GetPlayer(), uint8(packet.Roles), newDungeons, packet.Comment);
|
||||
}
|
||||
|
||||
void WorldSession::HandleLfgLeaveOpcode(WorldPacket& /*recvData*/)
|
||||
void WorldSession::HandleLfgLeaveOpcode(WorldPackets::LFG::LFGLeave& /*packet*/)
|
||||
{
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
ObjectGuid guid = GetPlayer()->GetGUID();
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#ifndef AllPackets_h__
|
||||
#define AllPackets_h__
|
||||
|
||||
#include "LFGPackets.h"
|
||||
#include "BankPackets.h"
|
||||
#include "CharacterPackets.h"
|
||||
#include "ChatPackets.h"
|
||||
|
||||
34
src/server/game/Server/Packets/LFGPackets.cpp
Normal file
34
src/server/game/Server/Packets/LFGPackets.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "LFGPackets.h"
|
||||
|
||||
void WorldPackets::LFG::LFGJoin::Read()
|
||||
{
|
||||
_worldPacket >> Roles;
|
||||
_worldPacket >> NoPartialClear;
|
||||
_worldPacket >> Achievements;
|
||||
Slots.resize(_worldPacket.read<uint8>());
|
||||
for (uint32& slot : Slots)
|
||||
_worldPacket >> slot;
|
||||
|
||||
_worldPacket.read_skip<uint8>(); // Needs count, hardcoded to 3 in client
|
||||
for (uint8& needs : Needs)
|
||||
_worldPacket >> needs;
|
||||
|
||||
_worldPacket >> Comment;
|
||||
}
|
||||
50
src/server/game/Server/Packets/LFGPackets.h
Normal file
50
src/server/game/Server/Packets/LFGPackets.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LFGPackets_h__
|
||||
#define LFGPackets_h__
|
||||
|
||||
#include "Packet.h"
|
||||
#include "PacketUtilities.h"
|
||||
|
||||
namespace WorldPackets::LFG
|
||||
{
|
||||
class LFGJoin final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
LFGJoin(WorldPacket&& packet) : ClientPacket(CMSG_LFG_JOIN, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
uint32 Roles = 0;
|
||||
Array<uint32, 50> Slots;
|
||||
std::string Comment;
|
||||
bool NoPartialClear = false;
|
||||
bool Achievements = false;
|
||||
std::array<uint8, 3> Needs = { };
|
||||
};
|
||||
|
||||
class LFGLeave final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
LFGLeave(WorldPacket&& packet) : ClientPacket(CMSG_LFG_LEAVE, std::move(packet)) { }
|
||||
|
||||
void Read() override { };
|
||||
};
|
||||
}
|
||||
|
||||
#endif // LFGPackets_h__
|
||||
@@ -71,6 +71,12 @@ namespace lfg
|
||||
|
||||
namespace WorldPackets
|
||||
{
|
||||
namespace LFG
|
||||
{
|
||||
class LFGJoin;
|
||||
class LFGLeave;
|
||||
}
|
||||
|
||||
namespace Chat
|
||||
{
|
||||
class EmoteClient;
|
||||
@@ -930,8 +936,8 @@ public: // opcodes handlers
|
||||
void HandleLfgSetCommentOpcode(WorldPacket& recvData);
|
||||
void HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& recvData);
|
||||
void HandleLfgPartyLockInfoRequestOpcode(WorldPacket& recvData);
|
||||
void HandleLfgJoinOpcode(WorldPacket& recvData);
|
||||
void HandleLfgLeaveOpcode(WorldPacket& recvData);
|
||||
void HandleLfgJoinOpcode(WorldPackets::LFG::LFGJoin& lfgJoin);
|
||||
void HandleLfgLeaveOpcode(WorldPackets::LFG::LFGLeave& lfgleave);
|
||||
void HandleLfgSetRolesOpcode(WorldPacket& recvData);
|
||||
void HandleLfgProposalResultOpcode(WorldPacket& recvData);
|
||||
void HandleLfgSetBootVoteOpcode(WorldPacket& recvData);
|
||||
|
||||
Reference in New Issue
Block a user