mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-28 06:15:55 +00:00
Refactor of EquipActions (#1994)
#PR Description The root cause of issue #1987 was the AI Value item usage becoming a very expensive call when bots gained professions accidentally. My original approach was to eliminate it entirely, but after inputs and testing I decided to introduce a more focused Ai value "Item upgrade" that only checks equipment and ammo inheriting directly from item usage, so the logic is unified between them. Upgrades are now only assessed when receiving an item that can be equipped. Additionally, I noticed that winning loot rolls did not trigger the upgrade action, so I added a new package handler for that. Performance needs to be re-evaluated, but I expect a reduction in calls and in the cost of each call. I tested with bots and selfbot in deadmines and ahadowfang keep. --------- Co-authored-by: bashermens <31279994+hermensbas@users.noreply.github.com>
This commit is contained in:
@@ -216,6 +216,7 @@ public:
|
||||
creators["formation"] = &ValueContext::formation;
|
||||
creators["stance"] = &ValueContext::stance;
|
||||
creators["item usage"] = &ValueContext::item_usage;
|
||||
creators["item upgrade"] = &ValueContext::item_upgrade;
|
||||
creators["speed"] = &ValueContext::speed;
|
||||
creators["last said"] = &ValueContext::last_said;
|
||||
creators["last emote"] = &ValueContext::last_emote;
|
||||
@@ -341,6 +342,7 @@ private:
|
||||
static UntypedValue* already_seen_players(PlayerbotAI* botAI) { return new AlreadySeenPlayersValue(botAI); }
|
||||
static UntypedValue* new_player_nearby(PlayerbotAI* botAI) { return new NewPlayerNearbyValue(botAI); }
|
||||
static UntypedValue* item_usage(PlayerbotAI* botAI) { return new ItemUsageValue(botAI); }
|
||||
static UntypedValue* item_upgrade(PlayerbotAI* botAI) { return new ItemUpgradeValue(botAI); }
|
||||
static UntypedValue* formation(PlayerbotAI* botAI) { return new FormationValue(botAI); }
|
||||
static UntypedValue* stance(PlayerbotAI* botAI) { return new StanceValue(botAI); }
|
||||
static UntypedValue* mana_save_level(PlayerbotAI* botAI) { return new ManaSaveLevelValue(botAI); }
|
||||
|
||||
Reference in New Issue
Block a user