Add parameters to allow bot to talk in guild + fix multi guild same message + bot in group wont ask for dungeon

This commit is contained in:
Atidot3
2024-07-28 20:43:17 +02:00
parent 1128e0280a
commit cf9dca6b16
7 changed files with 14 additions and 10 deletions

View File

@@ -143,6 +143,7 @@ bool PlayerbotAIConfig::Initialize()
randomBotTalk = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotTalk", false); randomBotTalk = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotTalk", false);
randomBotEmote = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotEmote", false); randomBotEmote = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotEmote", false);
randomBotSuggestDungeons = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotSuggestDungeons", true); randomBotSuggestDungeons = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotSuggestDungeons", true);
randomBotGuildTalk = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotGuildTalk", false);
suggestDungeonsInLowerCaseRandomly = sConfigMgr->GetOption<bool>("AiPlayerbot.SuggestDungeonsInLowerCaseRandomly", false); suggestDungeonsInLowerCaseRandomly = sConfigMgr->GetOption<bool>("AiPlayerbot.SuggestDungeonsInLowerCaseRandomly", false);
randomBotJoinBG = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotJoinBG", true); randomBotJoinBG = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotJoinBG", true);
randomBotAutoJoinBG = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotAutoJoinBG", false); randomBotAutoJoinBG = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotAutoJoinBG", false);

View File

@@ -98,6 +98,7 @@ class PlayerbotAIConfig
bool randomBotTalk; bool randomBotTalk;
bool randomBotEmote; bool randomBotEmote;
bool randomBotSuggestDungeons; bool randomBotSuggestDungeons;
bool randomBotGuildTalk;
bool suggestDungeonsInLowerCaseRandomly; bool suggestDungeonsInLowerCaseRandomly;
bool randomBotJoinBG; bool randomBotJoinBG;
bool randomBotAutoJoinBG; bool randomBotAutoJoinBG;

View File

@@ -36,7 +36,7 @@ void AutoLearnSpellAction::LearnSpells(std::ostringstream* out)
if (sPlayerbotAIConfig->autoLearnQuestSpells && sRandomPlayerbotMgr->IsRandomBot(bot))// || (!botAI->GetMaster() && sRandomPlayerbotMgr->IsRandomBot(bot))) if (sPlayerbotAIConfig->autoLearnQuestSpells && sRandomPlayerbotMgr->IsRandomBot(bot))// || (!botAI->GetMaster() && sRandomPlayerbotMgr->IsRandomBot(bot)))
LearnQuestSpells(out); LearnQuestSpells(out);
if (sPlayerbotAIConfig->randomBotTalk) if (sPlayerbotAIConfig->randomBotGuildTalk)
{ {
Guild* guild = sGuildMgr->GetGuildById(bot->GetGuildId()); Guild* guild = sGuildMgr->GetGuildById(bot->GetGuildId());
if (guild) if (guild)

View File

@@ -417,7 +417,7 @@ bool StoreLootAction::Execute(Event event)
if (proto->Quality >= ITEM_QUALITY_RARE && !urand(0, 1) && botAI->HasStrategy("emote", BOT_STATE_NON_COMBAT)) if (proto->Quality >= ITEM_QUALITY_RARE && !urand(0, 1) && botAI->HasStrategy("emote", BOT_STATE_NON_COMBAT))
botAI->PlayEmote(TEXT_EMOTE_CHEER); botAI->PlayEmote(TEXT_EMOTE_CHEER);
if (sPlayerbotAIConfig->randomBotTalk && bot->GetGuildId() && urand(0, 10) && proto->Quality >= ITEM_QUALITY_RARE) if (sPlayerbotAIConfig->randomBotGuildTalk && bot->GetGuildId() && urand(0, 10) && proto->Quality >= ITEM_QUALITY_RARE)
{ {
Guild* guild = sGuildMgr->GetGuildById(bot->GetGuildId()); Guild* guild = sGuildMgr->GetGuildById(bot->GetGuildId());

View File

@@ -674,7 +674,7 @@ void ChatReplyAction::ChatReplyDo(Player* bot, uint32 type, uint32 guid1, uint32
else if (type == CHAT_MSG_GUILD) else if (type == CHAT_MSG_GUILD)
{ {
if (!bot->GetGuildId()) if (!bot->GetGuildId() || !sPlayerbotAIConfig->randomBotGuildTalk)
return; return;
Guild* guild = sGuildMgr->GetGuildById(bot->GetGuildId()); Guild* guild = sGuildMgr->GetGuildById(bot->GetGuildId());

View File

@@ -306,13 +306,13 @@ void SuggestWhatToDoAction::spam(std::string msg, uint8 flags, bool worldChat, b
if (Channel* worldChannel = cMgr->GetChannel("World", bot)) if (Channel* worldChannel = cMgr->GetChannel("World", bot))
worldChannel->Say(bot->GetGUID(), msg.c_str(), LANG_UNIVERSAL); worldChannel->Say(bot->GetGUID(), msg.c_str(), LANG_UNIVERSAL);
} }
}
if (guild && bot->GetGuildId()) if (sPlayerbotAIConfig->randomBotGuildTalk && guild && bot->GetGuildId())
{ {
Guild* guild = sGuildMgr->GetGuildById(bot->GetGuildId()); Guild* guild = sGuildMgr->GetGuildById(bot->GetGuildId());
if (guild) if (guild)
guild->BroadcastToGuild(bot->GetSession(), false, msg.c_str(), LANG_UNIVERSAL); guild->BroadcastToGuild(bot->GetSession(), false, msg.c_str(), LANG_UNIVERSAL);
}
} }
} }
@@ -355,6 +355,8 @@ bool SuggestDungeonAction::Execute(Event event)
{ {
// TODO: use sPlayerbotDungeonSuggestionMgr // TODO: use sPlayerbotDungeonSuggestionMgr
if (!sPlayerbotAIConfig->randomBotSuggestDungeons || bot->GetGroup()) return false;
if (instances.empty()) if (instances.empty())
{ {
instances["Ragefire Chasm"] = 15; instances["Ragefire Chasm"] = 15;

View File

@@ -33,7 +33,7 @@ bool XpGainAction::Execute(Event event)
p >> groupBonus; // 8 group bonus p >> groupBonus; // 8 group bonus
} }
if (sPlayerbotAIConfig->randomBotTalk && bot->GetGuildId() && urand(0, 10)) if (sPlayerbotAIConfig->randomBotGuildTalk && bot->GetGuildId() && urand(0, 10))
{ {
Creature* creature = botAI->GetCreature(guid); Creature* creature = botAI->GetCreature(guid);
if (creature && (creature->isElite() || creature->isWorldBoss() || creature->GetLevel() > 61 || creature->GetLevel() > bot->GetLevel() + 4)) if (creature && (creature->isElite() || creature->isWorldBoss() || creature->GetLevel() > 61 || creature->GetLevel() > bot->GetLevel() + 4))