mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-16 00:26:10 +00:00
Enhance equip upgrade
This commit is contained in:
@@ -115,6 +115,7 @@ class ChatActionContext : public NamedObjectContext<Action>
|
||||
creators["de"] = &ChatActionContext::dead;
|
||||
creators["trainer"] = &ChatActionContext::trainer;
|
||||
creators["maintenance"] = &ChatActionContext::maintenance;
|
||||
creators["equip upgrade"] = &ChatActionContext::equip_upgrade;
|
||||
creators["attack my target"] = &ChatActionContext::attack_my_target;
|
||||
creators["chat"] = &ChatActionContext::chat;
|
||||
creators["home"] = &ChatActionContext::home;
|
||||
@@ -213,6 +214,7 @@ class ChatActionContext : public NamedObjectContext<Action>
|
||||
static Action* attack_my_target(PlayerbotAI* botAI) { return new AttackMyTargetAction(botAI); }
|
||||
static Action* trainer(PlayerbotAI* botAI) { return new TrainerAction(botAI); }
|
||||
static Action* maintenance(PlayerbotAI* botAI) { return new MaintenanceAction(botAI); }
|
||||
static Action* equip_upgrade(PlayerbotAI* botAI) { return new EquipUpgradeAction(botAI); }
|
||||
static Action* co(PlayerbotAI* botAI) { return new ChangeCombatStrategyAction(botAI); }
|
||||
static Action* nc(PlayerbotAI* botAI) { return new ChangeNonCombatStrategyAction(botAI); }
|
||||
static Action* dead(PlayerbotAI* botAI) { return new ChangeDeadStrategyAction(botAI); }
|
||||
|
||||
@@ -129,3 +129,20 @@ bool EquipUpgradesAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EquipUpgradeAction::Execute(Event event)
|
||||
{
|
||||
ListItemsVisitor visitor;
|
||||
IterateItems(&visitor, ITERATE_ITEMS_IN_BAGS);
|
||||
|
||||
ItemIds items;
|
||||
for (std::map<uint32, uint32>::iterator i = visitor.items.begin(); i != visitor.items.end(); ++i)
|
||||
{
|
||||
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", i->first);
|
||||
if (usage == ITEM_USAGE_EQUIP || usage == ITEM_USAGE_REPLACE || usage == ITEM_USAGE_BAD_EQUIP)
|
||||
{
|
||||
items.insert(i->first);
|
||||
}
|
||||
}
|
||||
EquipItems(items);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -34,4 +34,13 @@ class EquipUpgradesAction : public EquipAction
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class EquipUpgradeAction : public EquipAction
|
||||
{
|
||||
public:
|
||||
EquipUpgradeAction(PlayerbotAI* botAI, std::string const name = "equip upgrade") : EquipAction(botAI, name) { }
|
||||
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -89,6 +89,7 @@ ChatCommandHandlerStrategy::ChatCommandHandlerStrategy(PlayerbotAI* botAI) : Pas
|
||||
supported.push_back("de");
|
||||
supported.push_back("trainer");
|
||||
supported.push_back("maintenance");
|
||||
supported.push_back("equip upgrade");
|
||||
supported.push_back("chat");
|
||||
supported.push_back("home");
|
||||
supported.push_back("destroy");
|
||||
|
||||
@@ -26,7 +26,7 @@ class RacialsStrategyActionNodeFactory : public NamedObjectFactory<ActionNode>
|
||||
void RacialsStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
||||
{
|
||||
triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("lifeblood", 71.0f), nullptr)));
|
||||
triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, new NextAction("war stomp", 71.0f), nullptr)));
|
||||
// triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, new NextAction("war stomp", 71.0f), nullptr)));
|
||||
/*triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("war stomp", 71.0f), nullptr)));*/
|
||||
/*triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new NextAction("arcane torrent", ACTION_EMERGENCY + 6), nullptr)));
|
||||
triggers.push_back(new TriggerNode("medium mana", NextAction::array(0, new NextAction("mana tap", ACTION_EMERGENCY + 6), nullptr)));*/
|
||||
|
||||
@@ -55,6 +55,7 @@ class ChatTriggerContext : public NamedObjectContext<Trigger>
|
||||
creators["de"] = &ChatTriggerContext::dead;
|
||||
creators["trainer"] = &ChatTriggerContext::trainer;
|
||||
creators["maintenance"] = &ChatTriggerContext::maintenance;
|
||||
creators["equip upgrade"] = &ChatTriggerContext::equip_upgrade;
|
||||
creators["attack"] = &ChatTriggerContext::attack;
|
||||
creators["chat"] = &ChatTriggerContext::chat;
|
||||
creators["accept"] = &ChatTriggerContext::accept;
|
||||
@@ -166,6 +167,7 @@ class ChatTriggerContext : public NamedObjectContext<Trigger>
|
||||
static Trigger* attack(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "attack"); }
|
||||
static Trigger* trainer(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "trainer"); }
|
||||
static Trigger* maintenance(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "maintenance"); }
|
||||
static Trigger* equip_upgrade(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "equip upgrade"); }
|
||||
static Trigger* co(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "co"); }
|
||||
static Trigger* nc(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "nc"); }
|
||||
static Trigger* dead(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "de"); }
|
||||
|
||||
Reference in New Issue
Block a user