mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-16 10:20:27 +00:00
[Command] Command autogear
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["autogear"] = &ChatActionContext::autogear;
|
||||
creators["equip upgrade"] = &ChatActionContext::equip_upgrade;
|
||||
creators["attack my target"] = &ChatActionContext::attack_my_target;
|
||||
creators["chat"] = &ChatActionContext::chat;
|
||||
@@ -214,6 +215,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* autogear(PlayerbotAI* botAI) { return new AutoGearAction(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); }
|
||||
|
||||
@@ -150,9 +150,11 @@ void TrainerAction::TellFooter(uint32 totalCost)
|
||||
|
||||
bool MaintenanceAction::Execute(Event event)
|
||||
{
|
||||
if (!sPlayerbotAIConfig->maintenanceCommand)
|
||||
if (!sPlayerbotAIConfig->maintenanceCommand) {
|
||||
botAI->TellMaster("maintenance command is not allowed, please check the configuration.");
|
||||
return false;
|
||||
botAI->TellMaster("maintenance");
|
||||
}
|
||||
botAI->TellMaster("I'm maintaining");
|
||||
PlayerbotFactory factory(bot, bot->GetLevel());
|
||||
factory.InitBags(false);
|
||||
factory.InitAmmo();
|
||||
@@ -171,4 +173,25 @@ bool MaintenanceAction::Execute(Event event)
|
||||
}
|
||||
bot->DurabilityRepairAll(false, 1.0f, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AutoGearAction::Execute(Event event)
|
||||
{
|
||||
if (!sPlayerbotAIConfig->autoGearCommand) {
|
||||
botAI->TellMaster("autogear command is not allowed, please check the configuration.");
|
||||
return false;
|
||||
}
|
||||
botAI->TellMaster("I'm auto gearing");
|
||||
uint32 gs = sPlayerbotAIConfig->autoGearScoreLimit == 0 ? 0 :
|
||||
PlayerbotFactory::CalcMixedGearScore(sPlayerbotAIConfig->autoGearScoreLimit, sPlayerbotAIConfig->autoGearQualityLimit);
|
||||
PlayerbotFactory factory(bot,
|
||||
bot->GetLevel(),
|
||||
sPlayerbotAIConfig->autoGearQualityLimit,
|
||||
gs);
|
||||
factory.InitEquipment(true);
|
||||
if (bot->getLevel() >= sPlayerbotAIConfig->minEnchantingBotLevel) {
|
||||
factory.ApplyEnchantAndGemsNew();
|
||||
}
|
||||
bot->DurabilityRepairAll(false, 1.0f, false);
|
||||
return true;
|
||||
}
|
||||
@@ -34,4 +34,12 @@ class MaintenanceAction : public Action
|
||||
MaintenanceAction(PlayerbotAI* botAI) : Action(botAI, "maintenance") { }
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class AutoGearAction : public Action
|
||||
{
|
||||
public:
|
||||
AutoGearAction(PlayerbotAI* botAI) : Action(botAI, "autogear") { }
|
||||
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("autogear");
|
||||
supported.push_back("equip upgrade");
|
||||
supported.push_back("chat");
|
||||
supported.push_back("home");
|
||||
|
||||
@@ -55,6 +55,7 @@ class ChatTriggerContext : public NamedObjectContext<Trigger>
|
||||
creators["de"] = &ChatTriggerContext::dead;
|
||||
creators["trainer"] = &ChatTriggerContext::trainer;
|
||||
creators["maintenance"] = &ChatTriggerContext::maintenance;
|
||||
creators["autogear"] = &ChatTriggerContext::autogear;
|
||||
creators["equip upgrade"] = &ChatTriggerContext::equip_upgrade;
|
||||
creators["attack"] = &ChatTriggerContext::attack;
|
||||
creators["chat"] = &ChatTriggerContext::chat;
|
||||
@@ -167,6 +168,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* autogear(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "autogear"); }
|
||||
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"); }
|
||||
|
||||
Reference in New Issue
Block a user