auto equip upgrade

This commit is contained in:
Yunfan Li
2023-11-02 22:01:52 +08:00
parent 5c579ecf17
commit a320a716fa
5 changed files with 11 additions and 4 deletions

View File

@@ -155,8 +155,12 @@ AiPlayerbot.FreeMethodLoot = 0
AiPlayerbot.AutoPickReward = no
# Bots equip upgrades (Bots will equip any item obtained from looting or a quest if they are upgrades)
# Default: 0 (disabled)
AiPlayerbot.AutoEquipUpgradeLoot = 0
# Default: 1 (enable)
AiPlayerbot.AutoEquipUpgradeLoot = 1
# Equip upgrade threshold for auto equip upgrade
# Default: 1.1 (Equip when the equipment score is 1.1 times higher than the current)
AiPlayerbot.EquipUpgradeThreshold = 1.1
# Sync quests with player (Bots will complete quests the moment you hand them in. Bots will ignore looting quest items.)
# Default: 0 (disabled)

View File

@@ -334,6 +334,7 @@ bool PlayerbotAIConfig::Initialize()
freeMethodLoot = sConfigMgr->GetOption<bool>("AiPlayerbot.FreeMethodLoot", false);
autoPickReward = sConfigMgr->GetOption<std::string>("AiPlayerbot.AutoPickReward", "yes");
autoEquipUpgradeLoot = sConfigMgr->GetOption<bool>("AiPlayerbot.AutoEquipUpgradeLoot", true);
equipUpgradeThreshold = sConfigMgr->GetOption<float>("AiPlayerbot.EquipUpgradeThreshold", 1.1f);
syncQuestWithPlayer = sConfigMgr->GetOption<bool>("AiPlayerbot.SyncQuestWithPlayer", false);
syncQuestForPlayer = sConfigMgr->GetOption<bool>("AiPlayerbot.SyncQuestForPlayer", false);
autoTrainSpells = sConfigMgr->GetOption<std::string>("AiPlayerbot.AutoTrainSpells", "yes");

View File

@@ -151,6 +151,7 @@ class PlayerbotAIConfig
bool freeMethodLoot;
std::string autoPickReward;
bool autoEquipUpgradeLoot;
float equipUpgradeThreshold;
bool syncQuestWithPlayer;
bool syncQuestForPlayer;
std::string autoTrainSpells;

View File

@@ -289,7 +289,7 @@ std::vector<Item*> InventoryAction::parseItems(std::string const text, IterateIt
found.insert(visitor.GetResult().begin(), visitor.GetResult().end());
}
FindUsableNamedItemVisitor visitor(bot, text);
FindNamedItemVisitor visitor(bot, text);
IterateItems(&visitor, ITERATE_ITEMS_IN_BAGS);
found.insert(visitor.GetResult().begin(), visitor.GetResult().end());

View File

@@ -6,6 +6,7 @@
#include "AiFactory.h"
#include "ChatHelper.h"
#include "GuildTaskMgr.h"
#include "PlayerbotAIConfig.h"
#include "PlayerbotFactory.h"
#include "Playerbots.h"
#include "RandomItemMgr.h"
@@ -208,7 +209,7 @@ ItemUsage ItemUsageValue::QueryItemUsageForEquip(ItemTemplate const* itemProto)
// uint32 oldStatWeight = sRandomItemMgr->GetLiveStatWeight(bot, oldItemProto->ItemId);
if (itemScore || oldScore)
{
shouldEquip = itemScore > oldScore * 1.1;
shouldEquip = itemScore > oldScore * sPlayerbotAIConfig->equipUpgradeThreshold;
}
}