mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Added configuration on excluded prefixes for trade action (#1401)
* - Added configuration on excluded prefixes for trade action * - LoadListString usage reference specified * - Code refactoring
This commit is contained in:
@@ -588,6 +588,9 @@ AiPlayerbot.LimitTalentsExpansion = 0
|
||||
# Default: 1 (enabled)
|
||||
AiPlayerbot.EnableRandomBotTrading = 1
|
||||
|
||||
# Configure message prefixes which will be excluded in analysis in trade action to open trade window
|
||||
AiPlayerbot.TradeActionExcludedPrefixes = "RPLL_H_,DBMv4,{звезда} Questie,{rt1} Questie"
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
*/
|
||||
|
||||
#include "PlayerbotAIConfig.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "Config.h"
|
||||
#include "PlayerbotDungeonSuggestionMgr.h"
|
||||
#include "PlayerbotFactory.h"
|
||||
@@ -465,6 +463,8 @@ bool PlayerbotAIConfig::Initialize()
|
||||
|
||||
LoadListString<std::vector<std::string>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.AllowedLogFiles", ""),
|
||||
allowedLogFiles);
|
||||
LoadListString<std::vector<std::string>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.TradeActionExcludedPrefixes", ""),
|
||||
tradeActionExcludedPrefixes);
|
||||
|
||||
worldBuffs.clear();
|
||||
|
||||
|
||||
@@ -255,6 +255,7 @@ public:
|
||||
uint32 iterationsPerTick;
|
||||
|
||||
std::mutex m_logMtx;
|
||||
std::vector<std::string> tradeActionExcludedPrefixes;
|
||||
std::vector<std::string> allowedLogFiles;
|
||||
std::unordered_map<std::string, std::pair<FILE*, bool>> logFiles;
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*/
|
||||
|
||||
#include "TradeAction.h"
|
||||
|
||||
#include "ChatHelper.h"
|
||||
#include "Event.h"
|
||||
#include "ItemCountValue.h"
|
||||
@@ -15,11 +14,8 @@ bool TradeAction::Execute(Event event)
|
||||
{
|
||||
std::string const text = event.getParam();
|
||||
|
||||
// Table with prefixes to be excluded from analysis
|
||||
static const std::vector<std::string> excludedPrefixes = {"RPLL_H_"};
|
||||
|
||||
// If text starts with any excluded prefix, don't process it further.
|
||||
for (const auto& prefix : excludedPrefixes)
|
||||
for (const auto& prefix : sPlayerbotAIConfig->tradeActionExcludedPrefixes)
|
||||
{
|
||||
if (text.find(prefix) == 0)
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user