mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-16 08:36:10 +00:00
Bug fix. Equip Action triggered action (#2142)
# Pull Request Brighton caught a mistake I made changeing the action registry, so the correct action was no longer triggering. I cleaned that up, and renamed the action. ## How to Test the Changes - This was tested by adding logging to both equip actions. But to test this without that, the best way to verify the fix is to stop alts from auto upgrading via config. Then they should correctly follow the configured behavior. ## Complexity & Impact Does this change add new decision branches? - - [x ] No - - [ ] Yes (**explain below**) Does this change increase per-bot or per-tick processing? - - [x] No - - [ ] Yes (**describe and justify impact**) Could this logic scale poorly under load? - - [x] No - - [ ] Yes (**explain why**) --- ## Defaults & Configuration Does this change modify default bot behavior? - - [x] No - - [ ] Yes (**explain why**) If this introduces more advanced or AI-heavy logic: - - [x] Lightweight mode remains the default - - [ ] More complex behavior is optional and thereby configurable --- ## AI Assistance Was AI assistance (e.g. ChatGPT or similar tools) used while working on this change? - - [x] No - - [ ] Yes (**explain below**) If yes, please specify: - AI tool or model used (e.g. ChatGPT, GPT-4, Claude, etc.) - Purpose of usage (e.g. brainstorming, refactoring, documentation, code generation) - Which parts of the change were influenced or generated - Whether the result was manually reviewed and adapted AI assistance is allowed, but all submitted code must be fully understood, reviewed, and owned by the contributor. Any AI-influenced changes must be verified against existing CORE and PB logic. We expect contributors to be honest about what they do and do not understand. --- ## Final Checklist - - [x] Stability is not compromised - - [x] Performance impact is understood, tested, and acceptable - - [x] Added logic complexity is justified and explained - - [x] Documentation updated if needed --- ## Notes for Reviewers Anything that significantly improves realism at the cost of stability or performance should be carefully discussed before merging.
This commit is contained in:
@@ -175,7 +175,7 @@ bool BuyAction::Execute(Event event)
|
||||
|
||||
if (needMoneyFor == NeedMoneyFor::gear)
|
||||
{
|
||||
botAI->DoSpecificAction("equip upgrades");
|
||||
botAI->DoSpecificAction("equip upgrades packet action");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -206,7 +206,7 @@ bool BuyAction::Execute(Event event)
|
||||
if (usage == ITEM_USAGE_REPLACE || usage == ITEM_USAGE_EQUIP ||
|
||||
usage == ITEM_USAGE_BAD_EQUIP || usage == ITEM_USAGE_BROKEN_EQUIP)
|
||||
{
|
||||
botAI->DoSpecificAction("equip upgrades");
|
||||
botAI->DoSpecificAction("equip upgrades packet action");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,12 +364,12 @@ ItemIds EquipAction::SelectInventoryItemsToEquip()
|
||||
return items;
|
||||
}
|
||||
|
||||
bool EquipUpgradesTriggeredAction::Execute(Event event)
|
||||
bool EquipUpgradesPacketAction::Execute(Event event)
|
||||
{
|
||||
if (!sPlayerbotAIConfig.autoEquipUpgradeLoot && !sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||
return false;
|
||||
|
||||
if (event.GetSource() == "trade status")
|
||||
std::string const source = event.GetSource();
|
||||
if (source == "trade status")
|
||||
{
|
||||
WorldPacket p(event.getPacket());
|
||||
p.rpos(0);
|
||||
@@ -380,7 +380,7 @@ bool EquipUpgradesTriggeredAction::Execute(Event event)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (event.GetSource() == "item push result")
|
||||
else if (source == "item push result")
|
||||
{
|
||||
WorldPacket p(event.getPacket());
|
||||
p.rpos(0);
|
||||
|
||||
@@ -29,10 +29,10 @@ private:
|
||||
void EquipItem(Item* item);
|
||||
};
|
||||
|
||||
class EquipUpgradesTriggeredAction : public EquipAction
|
||||
class EquipUpgradesPacketAction : public EquipAction
|
||||
{
|
||||
public:
|
||||
explicit EquipUpgradesTriggeredAction(PlayerbotAI* botAI, std::string const name = "equip upgrades") : EquipAction(botAI, name) {}
|
||||
explicit EquipUpgradesPacketAction(PlayerbotAI* botAI, std::string const name = "equip upgrades packet action") : EquipAction(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
@@ -120,7 +120,6 @@ public:
|
||||
creators["use"] = &ChatActionContext::use;
|
||||
creators["item count"] = &ChatActionContext::item_count;
|
||||
creators["equip"] = &ChatActionContext::equip;
|
||||
creators["equip upgrades"] = &ChatActionContext::equip_upgrade;
|
||||
creators["unequip"] = &ChatActionContext::unequip;
|
||||
creators["sell"] = &ChatActionContext::sell;
|
||||
creators["buy"] = &ChatActionContext::buy;
|
||||
|
||||
@@ -56,7 +56,7 @@ void MasterFishingStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
||||
"random",
|
||||
{
|
||||
NextAction("end master fishing", 12.0f),
|
||||
NextAction("equip upgrades", 6.0f)
|
||||
NextAction("equip upgrades packet action", 6.0f)
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
@@ -32,7 +32,7 @@ void WorldPacketHandlerStrategy::InitTriggers(std::vector<TriggerNode*>& trigger
|
||||
triggers.push_back(new TriggerNode("activate taxi", { NextAction("remember taxi", relevance),
|
||||
NextAction("taxi", relevance) }));
|
||||
triggers.push_back(new TriggerNode("taxi done", { NextAction("taxi", relevance) }));
|
||||
triggers.push_back(new TriggerNode("trade status", { NextAction("accept trade", relevance), NextAction("equip upgrades", relevance) }));
|
||||
triggers.push_back(new TriggerNode("trade status", { NextAction("accept trade", relevance), NextAction("equip upgrades packet action", relevance) }));
|
||||
triggers.push_back(new TriggerNode("trade status extended", { NextAction("trade status extended", relevance) }));
|
||||
triggers.push_back(new TriggerNode("area trigger", { NextAction("reach area trigger", relevance) }));
|
||||
triggers.push_back(new TriggerNode("within area trigger", { NextAction("area trigger", relevance) }));
|
||||
@@ -40,9 +40,9 @@ void WorldPacketHandlerStrategy::InitTriggers(std::vector<TriggerNode*>& trigger
|
||||
triggers.push_back(new TriggerNode("item push result", { NextAction("unlock items", relevance),
|
||||
NextAction("open items", relevance),
|
||||
NextAction("query item usage", relevance),
|
||||
NextAction("equip upgrades", relevance) }));
|
||||
NextAction("equip upgrades packet action", relevance) }));
|
||||
triggers.push_back(new TriggerNode("item push result", { NextAction("quest item push result", relevance) }));
|
||||
triggers.push_back(new TriggerNode("loot roll won", { NextAction("equip upgrades", relevance) }));
|
||||
triggers.push_back(new TriggerNode("loot roll won", { NextAction("equip upgrades packet action", relevance) }));
|
||||
triggers.push_back(new TriggerNode("ready check finished", { NextAction("finish ready check", relevance) }));
|
||||
// triggers.push_back(new TriggerNode("often", { NextAction("security check", relevance), NextAction("check mail", relevance) }));
|
||||
triggers.push_back(new TriggerNode("guild invite", { NextAction("guild accept", relevance) }));
|
||||
|
||||
@@ -72,6 +72,7 @@ public:
|
||||
creators["store loot"] = &WorldPacketActionContext::store_loot;
|
||||
creators["self resurrect"] = &WorldPacketActionContext::self_resurrect;
|
||||
creators["pet"] = &WorldPacketActionContext::pet;
|
||||
creators["equip upgrades packet action"] = &WorldPacketActionContext::equip_upgrades_packet_action;
|
||||
|
||||
// quest
|
||||
creators["talk to quest giver"] = &WorldPacketActionContext::turn_in_quest;
|
||||
@@ -142,6 +143,7 @@ private:
|
||||
static Action* tell_cannot_equip(PlayerbotAI* botAI) { return new InventoryChangeFailureAction(botAI); }
|
||||
static Action* self_resurrect(PlayerbotAI* botAI) { return new SelfResurrectAction(botAI); }
|
||||
static Action* pet(PlayerbotAI* botAI) { return new PetsAction(botAI); }
|
||||
static Action* equip_upgrades_packet_action(PlayerbotAI* botAI) { return new EquipUpgradesPacketAction(botAI); }
|
||||
|
||||
// quest
|
||||
static Action* quest_update_add_kill(PlayerbotAI* ai) { return new QuestUpdateAddKillAction(ai); }
|
||||
|
||||
@@ -51,7 +51,7 @@ void GenericHunterNonCombatStrategy::InitTriggers(std::vector<TriggerNode*>& tri
|
||||
}));
|
||||
triggers.push_back(new TriggerNode("low ammo", { NextAction("say::low ammo", ACTION_NORMAL)}));
|
||||
triggers.push_back(new TriggerNode("no track", { NextAction("track humanoids", ACTION_NORMAL)}));
|
||||
triggers.push_back(new TriggerNode("no ammo", { NextAction("equip upgrades", ACTION_HIGH + 1)}));
|
||||
triggers.push_back(new TriggerNode("no ammo", { NextAction("equip upgrades packet action", ACTION_HIGH + 1)}));
|
||||
}
|
||||
|
||||
void HunterPetStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
||||
|
||||
@@ -98,7 +98,7 @@ void GenericHunterStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
||||
CombatStrategy::InitTriggers(triggers);
|
||||
|
||||
// Mark/Ammo/Mana Triggers
|
||||
triggers.push_back(new TriggerNode("no ammo", { NextAction("equip upgrades", 30.0f) }));
|
||||
triggers.push_back(new TriggerNode("no ammo", { NextAction("equip upgrades packet action", 30.0f) }));
|
||||
triggers.push_back(new TriggerNode("hunter's mark", { NextAction("hunter's mark", 29.5f) }));
|
||||
triggers.push_back(new TriggerNode("rapid fire", { NextAction("rapid fire", 29.0f) }));
|
||||
triggers.push_back(new TriggerNode("aspect of the viper", { NextAction("aspect of the viper", 28.0f) }));
|
||||
|
||||
Reference in New Issue
Block a user