Fix JoinLFG crash

This commit is contained in:
Yunfan Li
2024-12-19 22:44:54 +08:00
parent ea1ec98645
commit 4e64745861

View File

@@ -8,10 +8,14 @@
#include "AiFactory.h" #include "AiFactory.h"
#include "ItemVisitors.h" #include "ItemVisitors.h"
#include "LFGMgr.h" #include "LFGMgr.h"
#include "LFGPackets.h"
#include "Opcodes.h"
#include "Playerbots.h" #include "Playerbots.h"
#include "World.h"
using namespace lfg; using namespace lfg;
bool LfgJoinAction::Execute(Event event) { return JoinLFG(); } bool LfgJoinAction::Execute(Event event) { return JoinLFG(); }
uint32 LfgJoinAction::GetRoles() uint32 LfgJoinAction::GetRoles()
@@ -146,7 +150,19 @@ bool LfgJoinAction::JoinLFG()
// Set RbotAId Browser comment // Set RbotAId Browser comment
std::string const _gs = std::to_string(botAI->GetEquipGearScore(bot, false, false)); std::string const _gs = std::to_string(botAI->GetEquipGearScore(bot, false, false));
sLFGMgr->JoinLfg(bot, roleMask, list, _gs);
WorldPacket* data = new WorldPacket(CMSG_LFG_JOIN);
*data << (uint32)roleMask;
*data << (bool)false;
*data << (bool)false;
// Slots
*data << (uint8)(list.size());
for (uint32 dungeon : list)
*data << (uint32)dungeon;
// Needs
*data << (uint8)3 << (uint8)0 << (uint8)0 << (uint8)0;
*data << _gs;
bot->GetSession()->QueuePacket(data);
return true; return true;
} }