From 1f480861850477010f19c03f50e113dede8f1419 Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Wed, 14 Aug 2024 13:57:31 +0800 Subject: [PATCH] Correct config options --- conf/playerbots.conf.dist | 90 +++++++++++++------------- src/PlayerbotAI.cpp | 4 +- src/strategy/actions/LootAction.cpp | 4 +- src/strategy/generic/EmoteStrategy.cpp | 3 +- 4 files changed, 52 insertions(+), 49 deletions(-) diff --git a/conf/playerbots.conf.dist b/conf/playerbots.conf.dist index 4fbf9c77..e9d6b734 100644 --- a/conf/playerbots.conf.dist +++ b/conf/playerbots.conf.dist @@ -1273,7 +1273,7 @@ AiPlayerbot.CommandPrefix = "" AiPlayerbot.CommandSeparator = "\\\\" # Enable playerbot talk (say / yell / general chatting / lfg) -AiPlayerbot.RandomBotTalk = 0 +AiPlayerbot.RandomBotTalk = 1 # Enable playerbot emote AiPlayerbot.RandomBotEmote = 0 # Enable dungeon suggestions for random bots @@ -1301,7 +1301,7 @@ AiPlayerbot.RandomBotSayWithoutMaster = 0 # Broadcast rates # # 1 - to enable broadcasts globally, 0 - to disable (default 1) -# AiPlayerbot.EnableBroadcasts = 1 +AiPlayerbot.EnableBroadcasts = 1 # # all broadcast chances should be in range 0-30000 # @@ -1310,66 +1310,66 @@ AiPlayerbot.RandomBotSayWithoutMaster = 0 # # setting channel broadcast chance to 0, will re-route most broadcasts to other available channels # setting all channel broadcasts to 0 will disable most broadcasts -# AiPlayerbot.BroadcastToGuildGlobalChance = 30000 -# AiPlayerbot.BroadcastToWorldGlobalChance = 30000 -# AiPlayerbot.BroadcastToGeneralGlobalChance = 30000 -# AiPlayerbot.BroadcastToTradeGlobalChance = 30000 -# AiPlayerbot.BroadcastToLFGGlobalChance = 30000 -# AiPlayerbot.BroadcastToLocalDefenseGlobalChance = 30000 -# AiPlayerbot.BroadcastToWorldDefenseGlobalChance = 30000 -# AiPlayerbot.BroadcastToGuildRecruitmentGlobalChance = 30000 +AiPlayerbot.BroadcastToGuildGlobalChance = 30000 +AiPlayerbot.BroadcastToWorldGlobalChance = 30000 +AiPlayerbot.BroadcastToGeneralGlobalChance = 30000 +AiPlayerbot.BroadcastToTradeGlobalChance = 30000 +AiPlayerbot.BroadcastToLFGGlobalChance = 30000 +AiPlayerbot.BroadcastToLocalDefenseGlobalChance = 30000 +AiPlayerbot.BroadcastToWorldDefenseGlobalChance = 30000 +AiPlayerbot.BroadcastToGuildRecruitmentGlobalChance = 30000 # # individual settings # setting one of these to 0 will disable the particular broadcast -# AiPlayerbot.BroadcastChanceLootingItemPoor = 30 -# AiPlayerbot.BroadcastChanceLootingItemNormal = 150 -# AiPlayerbot.BroadcastChanceLootingItemUncommon = 10000 -# AiPlayerbot.BroadcastChanceLootingItemRare = 20000 -# AiPlayerbot.BroadcastChanceLootingItemEpic = 30000 -# AiPlayerbot.BroadcastChanceLootingItemLegendary = 30000 -# AiPlayerbot.BroadcastChanceLootingItemArtifact = 30000 +AiPlayerbot.BroadcastChanceLootingItemPoor = 30 +AiPlayerbot.BroadcastChanceLootingItemNormal = 150 +AiPlayerbot.BroadcastChanceLootingItemUncommon = 10000 +AiPlayerbot.BroadcastChanceLootingItemRare = 20000 +AiPlayerbot.BroadcastChanceLootingItemEpic = 30000 +AiPlayerbot.BroadcastChanceLootingItemLegendary = 30000 +AiPlayerbot.BroadcastChanceLootingItemArtifact = 30000 # -# AiPlayerbot.BroadcastChanceQuestAccepted = 6000 -# AiPlayerbot.BroadcastChanceQuestUpdateObjectiveCompleted = 300 -# AiPlayerbot.BroadcastChanceQuestUpdateObjectiveProgress = 300 -# AiPlayerbot.BroadcastChanceQuestUpdateFailedTimer = 300 -# AiPlayerbot.BroadcastChanceQuestUpdateComplete = 1000 -# AiPlayerbot.BroadcastChanceQuestTurnedIn = 10000 +AiPlayerbot.BroadcastChanceQuestAccepted = 6000 +AiPlayerbot.BroadcastChanceQuestUpdateObjectiveCompleted = 300 +AiPlayerbot.BroadcastChanceQuestUpdateObjectiveProgress = 300 +AiPlayerbot.BroadcastChanceQuestUpdateFailedTimer = 300 +AiPlayerbot.BroadcastChanceQuestUpdateComplete = 1000 +AiPlayerbot.BroadcastChanceQuestTurnedIn = 10000 # -# AiPlayerbot.BroadcastChanceKillNormal = 30 -# AiPlayerbot.BroadcastChanceKillElite = 300 -# AiPlayerbot.BroadcastChanceKillRareelite = 3000 -# AiPlayerbot.BroadcastChanceKillWorldboss = 20000 -# AiPlayerbot.BroadcastChanceKillRare = 10000 -# AiPlayerbot.BroadcastChanceKillUnknown = 100 -# AiPlayerbot.BroadcastChanceKillPet = 10 -# AiPlayerbot.BroadcastChanceKillPlayer = 30 +AiPlayerbot.BroadcastChanceKillNormal = 30 +AiPlayerbot.BroadcastChanceKillElite = 300 +AiPlayerbot.BroadcastChanceKillRareelite = 3000 +AiPlayerbot.BroadcastChanceKillWorldboss = 20000 +AiPlayerbot.BroadcastChanceKillRare = 10000 +AiPlayerbot.BroadcastChanceKillUnknown = 100 +AiPlayerbot.BroadcastChanceKillPet = 10 +AiPlayerbot.BroadcastChanceKillPlayer = 30 # -# AiPlayerbot.BroadcastChanceLevelupGeneric = 20000 -# AiPlayerbot.BroadcastChanceLevelupTenX = 30000 -# AiPlayerbot.BroadcastChanceLevelupMaxLevel = 30000 +AiPlayerbot.BroadcastChanceLevelupGeneric = 20000 +AiPlayerbot.BroadcastChanceLevelupTenX = 30000 +AiPlayerbot.BroadcastChanceLevelupMaxLevel = 30000 # -# AiPlayerbot.BroadcastChanceSuggestInstance = 5000 -# AiPlayerbot.BroadcastChanceSuggestQuest = 10000 -# AiPlayerbot.BroadcastChanceSuggestGrindMaterials = 5000 -# AiPlayerbot.BroadcastChanceSuggestGrindReputation = 5000 -# AiPlayerbot.BroadcastChanceSuggestSell = 300 -# AiPlayerbot.BroadcastChanceSuggestSomething = 30000 +AiPlayerbot.BroadcastChanceSuggestInstance = 5000 +AiPlayerbot.BroadcastChanceSuggestQuest = 10000 +AiPlayerbot.BroadcastChanceSuggestGrindMaterials = 5000 +AiPlayerbot.BroadcastChanceSuggestGrindReputation = 5000 +AiPlayerbot.BroadcastChanceSuggestSell = 300 +AiPlayerbot.BroadcastChanceSuggestSomething = 30000 # # Very rude speeches -# AiPlayerbot.BroadcastChanceSuggestSomethingToxic = 0 +AiPlayerbot.BroadcastChanceSuggestSomethingToxic = 0 # # Specifically for " [item link]" -# AiPlayerbot.BroadcastChanceSuggestToxicLinks = 0 +AiPlayerbot.BroadcastChanceSuggestToxicLinks = 0 # # prefix is used as a word in " [item link]" -# AiPlayerbot.ToxicLinksPrefix = gnomes +AiPlayerbot.ToxicLinksPrefix = gnomes # # chance to suggest thunderfury -# AiPlayerbot.BroadcastChanceSuggestThunderfury = 1 +AiPlayerbot.BroadcastChanceSuggestThunderfury = 1 # # does not depend on global chance -# AiPlayerbot.BroadcastChanceGuildManagement = 30000 +AiPlayerbot.BroadcastChanceGuildManagement = 30000 # #################################################################################################### diff --git a/src/PlayerbotAI.cpp b/src/PlayerbotAI.cpp index 7a18c520..5dd26287 100644 --- a/src/PlayerbotAI.cpp +++ b/src/PlayerbotAI.cpp @@ -934,9 +934,11 @@ void PlayerbotAI::HandleBotOutgoingPacket(WorldPacket const& packet) } case SMSG_MESSAGECHAT: // do not react to self or if not ready to reply { + if (!sPlayerbotAIConfig->randomBotTalk) + return; + if (!AllowActivity()) return; - WorldPacket p(packet); if (!p.empty() && (p.GetOpcode() == SMSG_MESSAGECHAT || p.GetOpcode() == SMSG_GM_MESSAGECHAT)) { diff --git a/src/strategy/actions/LootAction.cpp b/src/strategy/actions/LootAction.cpp index be48b066..0b45763d 100644 --- a/src/strategy/actions/LootAction.cpp +++ b/src/strategy/actions/LootAction.cpp @@ -419,10 +419,10 @@ bool StoreLootAction::Execute(Event event) packet << itemindex; bot->GetSession()->HandleAutostoreLootItemOpcode(packet); - if (proto->Quality > ITEM_QUALITY_NORMAL && !urand(0, 50) && botAI->HasStrategy("emote", BOT_STATE_NON_COMBAT)) + if (proto->Quality > ITEM_QUALITY_NORMAL && !urand(0, 50) && botAI->HasStrategy("emote", BOT_STATE_NON_COMBAT) && sPlayerbotAIConfig->randomBotEmote) botAI->PlayEmote(TEXT_EMOTE_CHEER); - 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) && sPlayerbotAIConfig->randomBotEmote) botAI->PlayEmote(TEXT_EMOTE_CHEER); BroadcastHelper::BroadcastLootingItem(botAI, bot, proto); diff --git a/src/strategy/generic/EmoteStrategy.cpp b/src/strategy/generic/EmoteStrategy.cpp index 373bc747..f2c67f75 100644 --- a/src/strategy/generic/EmoteStrategy.cpp +++ b/src/strategy/generic/EmoteStrategy.cpp @@ -11,6 +11,7 @@ void EmoteStrategy::InitTriggers(std::vector& triggers) { if (sPlayerbotAIConfig->randomBotEmote) { + triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("talk", 1.0f), nullptr))); triggers.push_back(new TriggerNode("seldom", NextAction::array(0, new NextAction("emote", 1.0f), nullptr))); triggers.push_back( new TriggerNode("receive text emote", NextAction::array(0, new NextAction("emote", 10.0f), nullptr))); @@ -23,7 +24,7 @@ void EmoteStrategy::InitTriggers(std::vector& triggers) triggers.push_back(new TriggerNode( "often", NextAction::array(0, new NextAction("suggest what to do", 10.0f), new NextAction("suggest dungeon", 3.0f), - new NextAction("suggest trade", 3.0f), new NextAction("talk", 1.0f), nullptr))); + new NextAction("suggest trade", 3.0f), nullptr))); } if (sPlayerbotAIConfig->enableGreet)