mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Rework in progress crash chat botgroup
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
#include "Playerbots.h"
|
||||
#include "SpellInfo.h"
|
||||
|
||||
#include <regex>
|
||||
|
||||
std::map<std::string, uint32> ChatHelper::consumableSubClasses;
|
||||
std::map<std::string, uint32> ChatHelper::tradeSubClasses;
|
||||
std::map<std::string, uint32> ChatHelper::itemQualities;
|
||||
@@ -571,3 +573,35 @@ void ChatHelper::eraseAllSubStr(std::string& mainStr, std::string const toErase)
|
||||
mainStr.erase(pos, toErase.length());
|
||||
}
|
||||
}
|
||||
|
||||
std::set<uint32> ChatHelper::ExtractAllQuestIds(const std::string& text)
|
||||
{
|
||||
std::set<uint32> ids;
|
||||
|
||||
std::regex rgx("Hquest:[0-9]+");
|
||||
auto begin = std::sregex_iterator(text.begin(), text.end(), rgx);
|
||||
auto end = std::sregex_iterator();
|
||||
for (std::sregex_iterator i = begin; i != end; ++i)
|
||||
{
|
||||
std::smatch match = *i;
|
||||
ids.insert(std::stoi(match.str().erase(0, 7)));
|
||||
}
|
||||
|
||||
return ids;
|
||||
}
|
||||
|
||||
std::set<uint32> ChatHelper::ExtractAllItemIds(const std::string& text)
|
||||
{
|
||||
std::set<uint32> ids;
|
||||
|
||||
std::regex rgx("Hitem:[0-9]+");
|
||||
auto begin = std::sregex_iterator(text.begin(), text.end(), rgx);
|
||||
auto end = std::sregex_iterator();
|
||||
for (std::sregex_iterator i = begin; i != end; ++i)
|
||||
{
|
||||
std::smatch match = *i;
|
||||
ids.insert(std::stoi(match.str().erase(0, 6)));
|
||||
}
|
||||
|
||||
return ids;
|
||||
}
|
||||
@@ -61,6 +61,9 @@ class ChatHelper : public PlayerbotAIAware
|
||||
|
||||
void eraseAllSubStr(std::string& mainStr, std::string const toErase);
|
||||
|
||||
static std::set<uint32> ExtractAllQuestIds(const std::string& text);
|
||||
static std::set<uint32> ExtractAllItemIds(const std::string& text);
|
||||
|
||||
private:
|
||||
static std::map<std::string, uint32> consumableSubClasses;
|
||||
static std::map<std::string, uint32> tradeSubClasses;
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "Vehicle.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "SayAction.h"
|
||||
#include "ChannelMgr.h"
|
||||
#include <cmath>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
@@ -336,66 +337,9 @@ void PlayerbotAI::UpdateAIInternal([[maybe_unused]] uint32 elapsed, bool minimal
|
||||
return;
|
||||
|
||||
std::string const mapString = WorldPosition(bot).isOverworld() ? std::to_string(bot->GetMapId()) : "I";
|
||||
|
||||
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_TOTAL, "PlayerbotAI::UpdateAIInternal " + mapString);
|
||||
ExternalEventHelper helper(aiObjectContext);
|
||||
|
||||
std::vector<ChatCommandHolder> delayed;
|
||||
while (!chatCommands.empty())
|
||||
{
|
||||
ChatCommandHolder holder = chatCommands.front();
|
||||
time_t checkTime = holder.GetTime();
|
||||
if (checkTime && time(nullptr) < checkTime)
|
||||
{
|
||||
delayed.push_back(holder);
|
||||
chatCommands.pop();
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string const command = holder.GetCommand();
|
||||
Player* owner = holder.GetOwner();
|
||||
if (!helper.ParseChatCommand(command, owner) && holder.GetType() == CHAT_MSG_WHISPER)
|
||||
{
|
||||
// To prevent spam caused by WIM
|
||||
if (!(command.rfind("WIM", 0) == 0) &&
|
||||
!(command.rfind("QHpr", 0) == 0)
|
||||
)
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << "Unknown command " << command;
|
||||
TellMaster(out);
|
||||
helper.ParseChatCommand("help");
|
||||
}
|
||||
}
|
||||
|
||||
chatCommands.pop();
|
||||
}
|
||||
|
||||
for (std::vector<ChatCommandHolder>::iterator i = delayed.begin(); i != delayed.end(); ++i)
|
||||
{
|
||||
chatCommands.push(*i);
|
||||
}
|
||||
|
||||
// chat replies
|
||||
std::list<ChatQueuedReply> delayedResponses;
|
||||
while (!chatReplies.empty())
|
||||
{
|
||||
ChatQueuedReply holder = chatReplies.front();
|
||||
time_t checkTime = holder.m_time;
|
||||
if (checkTime && time(0) < checkTime)
|
||||
{
|
||||
delayedResponses.push_back(holder);
|
||||
chatReplies.pop();
|
||||
continue;
|
||||
}
|
||||
ChatReplyAction::ChatReplyDo(bot, holder.m_type, holder.m_guid1, holder.m_guid2, holder.m_msg, holder.m_chanName, holder.m_name);
|
||||
chatReplies.pop();
|
||||
}
|
||||
|
||||
for (std::list<ChatQueuedReply>::iterator i = delayedResponses.begin(); i != delayedResponses.end(); ++i)
|
||||
{
|
||||
chatReplies.push(*i);
|
||||
}
|
||||
|
||||
// logout if logout timer is ready or if instant logout is possible
|
||||
if (bot->GetSession()->isLogingOut())
|
||||
@@ -1898,6 +1842,197 @@ WorldObject* PlayerbotAI::GetWorldObject(ObjectGuid guid)
|
||||
return ObjectAccessor::GetWorldObject(*bot, guid);
|
||||
}
|
||||
|
||||
const AreaTableEntry* PlayerbotAI::GetCurrentArea()
|
||||
{
|
||||
if (const auto map = bot->GetMap())
|
||||
return sAreaTableStore.LookupEntry(bot->GetMap()->GetAreaId(bot->GetPhaseMask(), bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ()));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const AreaTableEntry* PlayerbotAI::GetCurrentZone()
|
||||
{
|
||||
if (const auto map = bot->GetMap())
|
||||
return GetAreaEntryByAreaID(map->GetZoneId(bot->GetMapId(), bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ()));
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::string PlayerbotAI::GetLocalizedAreaName(const AreaTableEntry* entry)
|
||||
{
|
||||
if (entry)
|
||||
return entry->area_name[sWorld->GetDefaultDbcLocale()];
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
std::vector<Player*> PlayerbotAI::GetPlayersInGroup()
|
||||
{
|
||||
std::vector<Player*> members;
|
||||
|
||||
Group* group = bot->GetGroup();
|
||||
|
||||
if (!group)
|
||||
return members;
|
||||
|
||||
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
|
||||
{
|
||||
Player* member = ref->GetSource();
|
||||
|
||||
if (GET_PLAYERBOT_AI(member) && !GET_PLAYERBOT_AI(member)->IsRealPlayer())
|
||||
continue;
|
||||
|
||||
members.push_back(ref->GetSource());
|
||||
}
|
||||
|
||||
return members;
|
||||
}
|
||||
|
||||
bool PlayerbotAI::SayToGuild(const std::string& msg)
|
||||
{
|
||||
if (msg.empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bot->GetGuildId())
|
||||
{
|
||||
if (Guild* guild = sGuildMgr->GetGuildById(bot->GetGuildId()))
|
||||
{
|
||||
if (!guild->HasRankRight(bot, GR_RIGHT_GCHATSPEAK))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
guild->BroadcastToGuild(bot->GetSession(), false, msg.c_str(), LANG_UNIVERSAL);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
bool PlayerbotAI::SayToWorld(const std::string& msg)
|
||||
{
|
||||
if (msg.empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ChannelMgr* cMgr = ChannelMgr::forTeam(bot->GetTeamId());
|
||||
if (!cMgr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//no zone
|
||||
if (Channel* worldChannel = cMgr->GetChannel("World", bot))
|
||||
{
|
||||
worldChannel->Say(bot->GetGUID(), msg.c_str(), LANG_UNIVERSAL);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
bool PlayerbotAI::SayToChannel(const std::string& msg, const ChatChannelId& chanId)
|
||||
{
|
||||
ChannelMgr* cMgr = ChannelMgr::forTeam(bot->GetTeamId());
|
||||
if (!cMgr || msg.empty())
|
||||
return false;
|
||||
|
||||
AreaTableEntry const* current_zone = sAreaTableStore.LookupEntry(bot->GetMap()->GetZoneId(bot->GetPhaseMask(), bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ()));
|
||||
if (!current_zone)
|
||||
return false;
|
||||
|
||||
for (auto const& [key, channel] : cMgr->GetChannels())
|
||||
{
|
||||
//check for current zone
|
||||
if (channel && channel->GetChannelId() == chanId)
|
||||
{
|
||||
const auto does_contains = channel->GetName().find(GetLocalizedAreaName(current_zone)) != std::string::npos;
|
||||
if ((chanId != ChatChannelId::LOOKING_FOR_GROUP && chanId != ChatChannelId::WORLD_DEFENSE) && !does_contains)
|
||||
return false;
|
||||
|
||||
channel->Say(bot->GetGUID(), msg.c_str(), LANG_UNIVERSAL);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
bool PlayerbotAI::SayToParty(const std::string& msg)
|
||||
{
|
||||
if (!bot->GetGroup())
|
||||
return false;
|
||||
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_PARTY, msg.c_str(), LANG_UNIVERSAL, CHAT_TAG_NONE, bot->GetGUID(), bot->GetName());
|
||||
|
||||
for (auto reciever : GetPlayersInGroup())
|
||||
{
|
||||
sServerFacade->SendPacket(reciever, &data);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
bool PlayerbotAI::SayToRaid(const std::string& msg)
|
||||
{
|
||||
if (!bot->GetGroup() || bot->GetGroup()->isRaidGroup())
|
||||
return false;
|
||||
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID, msg.c_str(), LANG_UNIVERSAL, CHAT_TAG_NONE, bot->GetGUID(), bot->GetName());
|
||||
|
||||
for (auto reciever : GetPlayersInGroup())
|
||||
{
|
||||
sServerFacade->SendPacket(reciever, &data);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
bool PlayerbotAI::Yell(const std::string& msg)
|
||||
{
|
||||
if (bot->GetTeamId() == TeamId::TEAM_ALLIANCE)
|
||||
{
|
||||
bot->Yell(msg, LANG_COMMON);
|
||||
}
|
||||
else
|
||||
{
|
||||
bot->Yell(msg, LANG_ORCISH);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
bool PlayerbotAI::Say(const std::string& msg)
|
||||
{
|
||||
if (bot->GetTeamId() == TeamId::TEAM_ALLIANCE)
|
||||
{
|
||||
bot->Say(msg, LANG_COMMON);
|
||||
}
|
||||
else
|
||||
{
|
||||
bot->Say(msg, LANG_ORCISH);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
bool PlayerbotAI::Whisper(const std::string& msg, const std::string& receiverName)
|
||||
{
|
||||
const auto receiver = ObjectAccessor::FindPlayerByName(receiverName);
|
||||
if (!receiver)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bot->GetTeamId() == TeamId::TEAM_ALLIANCE)
|
||||
{
|
||||
bot->Whisper(msg, LANG_COMMON, receiver);
|
||||
}
|
||||
else
|
||||
{
|
||||
bot->Whisper(msg, LANG_ORCISH, receiver);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PlayerbotAI::TellMasterNoFacing(std::ostringstream& stream, PlayerbotSecurityLevel securityLevel)
|
||||
{
|
||||
return TellMasterNoFacing(stream.str(), securityLevel);
|
||||
@@ -4749,3 +4884,171 @@ bool PlayerbotAI::IsSafe(WorldObject* obj)
|
||||
{
|
||||
return obj && obj->GetMapId() == bot->GetMapId() && obj->GetInstanceId() == bot->GetInstanceId() && (!obj->IsPlayer() || !((Player*)obj)->IsBeingTeleported());
|
||||
}
|
||||
ChatChannelSource PlayerbotAI::GetChatChannelSource(Player* bot, uint32 type, std::string channelName)
|
||||
{
|
||||
if (type == CHAT_MSG_CHANNEL)
|
||||
{
|
||||
if (channelName == "World")
|
||||
return ChatChannelSource::SRC_WORLD;
|
||||
else
|
||||
{
|
||||
ChannelMgr* cMgr = ChannelMgr::forTeam(bot->GetTeamId());
|
||||
if (!cMgr)
|
||||
return ChatChannelSource::SRC_UNDEFINED;
|
||||
|
||||
const Channel* channel = cMgr->GetChannel(channelName, bot);
|
||||
if (channel)
|
||||
{
|
||||
switch (channel->GetChannelId())
|
||||
{
|
||||
case ChatChannelId::GENERAL:
|
||||
{
|
||||
return ChatChannelSource::SRC_GENERAL;
|
||||
}
|
||||
case ChatChannelId::TRADE:
|
||||
{
|
||||
return ChatChannelSource::SRC_TRADE;
|
||||
}
|
||||
case ChatChannelId::LOCAL_DEFENSE:
|
||||
{
|
||||
return ChatChannelSource::SRC_LOCAL_DEFENSE;
|
||||
}
|
||||
case ChatChannelId::WORLD_DEFENSE:
|
||||
{
|
||||
return ChatChannelSource::SRC_WORLD_DEFENSE;
|
||||
}
|
||||
case ChatChannelId::LOOKING_FOR_GROUP:
|
||||
{
|
||||
return ChatChannelSource::SRC_LOOKING_FOR_GROUP;
|
||||
}
|
||||
case ChatChannelId::GUILD_RECRUITMENT:
|
||||
{
|
||||
return ChatChannelSource::SRC_GUILD_RECRUITMENT;
|
||||
}
|
||||
default:
|
||||
return ChatChannelSource::SRC_UNDEFINED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case CHAT_MSG_WHISPER:
|
||||
{
|
||||
return ChatChannelSource::SRC_WHISPER;
|
||||
}
|
||||
case CHAT_MSG_SAY:
|
||||
{
|
||||
return ChatChannelSource::SRC_SAY;
|
||||
}
|
||||
case CHAT_MSG_YELL:
|
||||
{
|
||||
return ChatChannelSource::SRC_YELL;
|
||||
}
|
||||
case CHAT_MSG_GUILD:
|
||||
{
|
||||
return ChatChannelSource::SRC_GUILD;
|
||||
}
|
||||
case CHAT_MSG_PARTY:
|
||||
{
|
||||
return ChatChannelSource::SRC_PARTY;
|
||||
}
|
||||
case CHAT_MSG_RAID:
|
||||
{
|
||||
return ChatChannelSource::SRC_RAID;
|
||||
}
|
||||
case CHAT_MSG_EMOTE:
|
||||
{
|
||||
return ChatChannelSource::SRC_EMOTE;
|
||||
}
|
||||
case CHAT_MSG_TEXT_EMOTE:
|
||||
{
|
||||
return ChatChannelSource::SRC_TEXT_EMOTE;
|
||||
}
|
||||
default:
|
||||
return ChatChannelSource::SRC_UNDEFINED;
|
||||
}
|
||||
}
|
||||
return ChatChannelSource::SRC_UNDEFINED;
|
||||
}
|
||||
std::vector<const Quest*> PlayerbotAI::GetAllCurrentQuests()
|
||||
{
|
||||
std::vector<const Quest*> result;
|
||||
|
||||
for (uint16 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot)
|
||||
{
|
||||
uint32 questId = bot->GetQuestSlotQuestId(slot);
|
||||
if (!questId)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
result.push_back(sObjectMgr->GetQuestTemplate(questId));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<const Quest*> PlayerbotAI::GetCurrentIncompleteQuests()
|
||||
{
|
||||
std::vector<const Quest*> result;
|
||||
|
||||
for (uint16 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot)
|
||||
{
|
||||
uint32 questId = bot->GetQuestSlotQuestId(slot);
|
||||
if (!questId)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
QuestStatus status = bot->GetQuestStatus(questId);
|
||||
if (status == QUEST_STATUS_INCOMPLETE || status == QUEST_STATUS_NONE)
|
||||
{
|
||||
result.push_back(sObjectMgr->GetQuestTemplate(questId));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::set<uint32> PlayerbotAI::GetAllCurrentQuestIds()
|
||||
{
|
||||
std::set<uint32> result;
|
||||
|
||||
for (uint16 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot)
|
||||
{
|
||||
uint32 questId = bot->GetQuestSlotQuestId(slot);
|
||||
if (!questId)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
result.insert(questId);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::set<uint32> PlayerbotAI::GetCurrentIncompleteQuestIds()
|
||||
{
|
||||
std::set<uint32> result;
|
||||
|
||||
for (uint16 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot)
|
||||
{
|
||||
uint32 questId = bot->GetQuestSlotQuestId(slot);
|
||||
if (!questId)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
QuestStatus status = bot->GetQuestStatus(questId);
|
||||
if (status == QUEST_STATUS_INCOMPLETE || status == QUEST_STATUS_NONE)
|
||||
{
|
||||
result.insert(questId);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -106,6 +106,38 @@ class MinValueCalculator
|
||||
float minValue;
|
||||
};
|
||||
|
||||
enum ChatChannelSource
|
||||
{
|
||||
SRC_GUILD,
|
||||
SRC_WORLD,
|
||||
SRC_GENERAL,
|
||||
SRC_TRADE,
|
||||
SRC_LOOKING_FOR_GROUP,
|
||||
SRC_LOCAL_DEFENSE,
|
||||
SRC_WORLD_DEFENSE,
|
||||
SRC_GUILD_RECRUITMENT,
|
||||
|
||||
SRC_SAY,
|
||||
SRC_WHISPER,
|
||||
SRC_EMOTE,
|
||||
SRC_TEXT_EMOTE,
|
||||
SRC_YELL,
|
||||
|
||||
SRC_PARTY,
|
||||
SRC_RAID,
|
||||
|
||||
SRC_UNDEFINED
|
||||
};
|
||||
enum ChatChannelId
|
||||
{
|
||||
GENERAL = 1,
|
||||
TRADE = 2,
|
||||
LOCAL_DEFENSE = 22,
|
||||
WORLD_DEFENSE = 23,
|
||||
LOOKING_FOR_GROUP = 26,
|
||||
GUILD_RECRUITMENT = 25,
|
||||
};
|
||||
|
||||
enum RoguePoisonDisplayId
|
||||
{
|
||||
DEADLY_POISON_DISPLAYID = 13707,
|
||||
@@ -356,11 +388,25 @@ class PlayerbotAI : public PlayerbotAIBase
|
||||
GameObject* GetGameObject(ObjectGuid guid);
|
||||
// static GameObject* GetGameObject(GameObjectData const* gameObjectData);
|
||||
WorldObject* GetWorldObject(ObjectGuid guid);
|
||||
std::vector<Player*> GetPlayersInGroup();
|
||||
const AreaTableEntry* GetCurrentArea();
|
||||
const AreaTableEntry* GetCurrentZone();
|
||||
std::string GetLocalizedAreaName(const AreaTableEntry* entry);
|
||||
|
||||
bool TellMaster(std::ostringstream& stream, PlayerbotSecurityLevel securityLevel = PLAYERBOT_SECURITY_ALLOW_ALL);
|
||||
bool TellMaster(std::string const text, PlayerbotSecurityLevel securityLevel = PLAYERBOT_SECURITY_ALLOW_ALL);
|
||||
bool TellMasterNoFacing(std::ostringstream& stream, PlayerbotSecurityLevel securityLevel = PLAYERBOT_SECURITY_ALLOW_ALL);
|
||||
bool TellMasterNoFacing(std::string const text, PlayerbotSecurityLevel securityLevel = PLAYERBOT_SECURITY_ALLOW_ALL);
|
||||
bool TellError(std::string const text, PlayerbotSecurityLevel securityLevel = PLAYERBOT_SECURITY_ALLOW_ALL);
|
||||
bool SayToGuild(const std::string& msg);
|
||||
bool SayToWorld(const std::string& msg);
|
||||
bool SayToChannel(const std::string& msg, const ChatChannelId& chanId);
|
||||
bool SayToParty(const std::string& msg);
|
||||
bool SayToRaid(const std::string& msg);
|
||||
bool Yell(const std::string& msg);
|
||||
bool Say(const std::string& msg);
|
||||
bool Whisper(const std::string& msg, const std::string& receiverName);
|
||||
|
||||
void SpellInterrupted(uint32 spellid);
|
||||
int32 CalculateGlobalCooldown(uint32 spellid);
|
||||
void InterruptSpell();
|
||||
@@ -436,7 +482,7 @@ class PlayerbotAI : public PlayerbotAIBase
|
||||
//Check if player is safe to use.
|
||||
bool IsSafe(Player* player);
|
||||
bool IsSafe(WorldObject* obj);
|
||||
|
||||
ChatChannelSource GetChatChannelSource(Player* bot, uint32 type, std::string channelName);
|
||||
|
||||
bool HasCheat(BotCheatMask mask) { return ((uint32)mask & (uint32)cheatMask) != 0 || ((uint32)mask & (uint32)sPlayerbotAIConfig->botCheatMask) != 0; }
|
||||
BotCheatMask GetCheat() { return cheatMask; }
|
||||
@@ -459,6 +505,11 @@ class PlayerbotAI : public PlayerbotAIBase
|
||||
bool EqualLowercaseName(std::string s1, std::string s2);
|
||||
InventoryResult CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool swap, bool not_loading = true) const;
|
||||
uint8 FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) const;
|
||||
|
||||
std::vector<const Quest*> GetAllCurrentQuests();
|
||||
std::vector<const Quest*> GetCurrentIncompleteQuests();
|
||||
std::set<uint32> GetAllCurrentQuestIds();
|
||||
std::set<uint32> GetCurrentIncompleteQuestIds();
|
||||
private:
|
||||
static void _fillGearScoreData(Player* player, Item* item, std::vector<uint32>* gearScore, uint32& twoHandScore, bool mixed = false);
|
||||
bool IsTellAllowed(PlayerbotSecurityLevel securityLevel = PLAYERBOT_SECURITY_ALLOW_ALL);
|
||||
|
||||
@@ -72,3 +72,8 @@ Unit* ServerFacade::GetChaseTarget(Unit* target)
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ServerFacade::SendPacket(Player *player, WorldPacket *packet)
|
||||
{
|
||||
return player->GetSession()->SendPacket(packet);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
class Player;
|
||||
class Unit;
|
||||
class WorldObject;
|
||||
class WorldPacket;
|
||||
|
||||
class ServerFacade
|
||||
{
|
||||
@@ -33,6 +34,8 @@ class ServerFacade
|
||||
void SetFacingTo(Player* bot, WorldObject* wo, bool force = false);
|
||||
|
||||
Unit* GetChaseTarget(Unit* target);
|
||||
|
||||
void SendPacket(Player *player, WorldPacket* packet);
|
||||
};
|
||||
|
||||
#define sServerFacade ServerFacade::instance()
|
||||
|
||||
@@ -244,12 +244,11 @@ bool QuestUpdateCompleteAction::Execute(Event event)
|
||||
WorldPacket p(event.getPacket());
|
||||
p.rpos(0);
|
||||
|
||||
if (p.empty())
|
||||
return false;
|
||||
uint32 questId = 0;
|
||||
p >> questId;
|
||||
|
||||
uint32 entry, questId, available, required;
|
||||
ObjectGuid guid;
|
||||
p >> questId >> entry >> available >> required >> guid;
|
||||
p.print_storage();
|
||||
LOG_INFO("playerbots", "Packet: empty{} questId{}", p.empty(), questId);
|
||||
|
||||
Quest const* qInfo = sObjectMgr->GetQuestTemplate(questId);
|
||||
if (qInfo)
|
||||
@@ -275,8 +274,7 @@ bool QuestUpdateAddKillAction::Execute(Event event)
|
||||
p.rpos(0);
|
||||
|
||||
uint32 entry, questId, available, required;
|
||||
ObjectGuid guid;
|
||||
p >> questId >> entry >> available >> required >> guid;
|
||||
p >> questId >> entry >> available >> required;
|
||||
|
||||
std::stringstream ss;
|
||||
ss << "Update progression kill questid {" << std::to_string(questId) << "} {" << std::to_string(available) << "} / {" << std::to_string(required) << "}";
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,10 +6,10 @@
|
||||
#define _PLAYERBOT_SAYACTION_H
|
||||
|
||||
#include "Action.h"
|
||||
#include "PlayerbotAI.h"
|
||||
#include "NamedObjectContext.h"
|
||||
|
||||
class PlayerbotAI;
|
||||
|
||||
class SayAction : public Action, public Qualified
|
||||
{
|
||||
public:
|
||||
@@ -31,6 +31,13 @@ public:
|
||||
ChatReplyAction(PlayerbotAI* ai) : Action(ai, "chat message") {}
|
||||
virtual bool Execute(Event event) { return true; }
|
||||
bool isUseful() { return true; }
|
||||
|
||||
static void ChatReplyDo(Player* bot, uint32 type, uint32 guid1, uint32 guid2, std::string msg, std::string chanName, std::string name);
|
||||
static bool HandleThunderfuryReply(Player* bot, ChatChannelSource chatChannelSource, std::string msg, std::string name);
|
||||
static bool HandleToxicLinksReply(Player* bot, ChatChannelSource chatChannelSource, std::string msg, std::string name);
|
||||
static bool HandleWTBItemsReply(Player* bot, ChatChannelSource chatChannelSource, std::string msg, std::string name);
|
||||
static bool HandleLFGQuestsReply(Player* bot, ChatChannelSource chatChannelSource, std::string msg, std::string name);
|
||||
static bool SendGeneralResponse(Player* bot, ChatChannelSource chatChannelSource, std::string responseMessage, std::string name);
|
||||
static std::string GenerateReplyMessage(Player* bot, std::string incomingMessage, uint32 guid1, std::string name);
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -216,13 +216,12 @@ void SuggestWhatToDoAction::something()
|
||||
std::map<std::string, std::string> placeholders;
|
||||
placeholders["%role"] = chat->FormatClass(bot, AiFactory::GetPlayerSpecTab(bot));
|
||||
|
||||
AreaTableEntry const* entry = sAreaTableStore.LookupEntry(bot->GetAreaId());
|
||||
if (!entry)
|
||||
return;
|
||||
AreaTableEntry const* zone = sAreaTableStore.LookupEntry(bot->GetMap()->GetZoneId(bot->GetPhaseMask(), bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ()));
|
||||
if (!zone) return;
|
||||
|
||||
std::ostringstream out;
|
||||
// out << "|cffb04040" << entry->area_name[0] << "|r";
|
||||
out << entry->area_name[_dbc_locale];
|
||||
out << zone->area_name[_dbc_locale];
|
||||
placeholders["%zone"] = out.str();
|
||||
|
||||
spam(BOT_TEXT2("suggest_something", placeholders), urand(0, 1) ? eTalkType::General : 0, !urand(0, 2), !urand(0, 3));
|
||||
|
||||
Reference in New Issue
Block a user