mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
[Random bots] Ensure teleport after randomize
This commit is contained in:
@@ -152,6 +152,7 @@ class ActionContext : public NamedObjectContext<Action>
|
||||
creators["auto talents"] = &ActionContext::auto_talents;
|
||||
creators["auto learn spell"] = &ActionContext::auto_learn_spell;
|
||||
creators["auto teleport for level"] = &ActionContext::auto_teleport_for_level;
|
||||
creators["auto upgrade equip"] = &ActionContext::auto_upgrade_equip;
|
||||
creators["xp gain"] = &ActionContext::xp_gain;
|
||||
creators["invite nearby"] = &ActionContext::invite_nearby;
|
||||
creators["invite guild"] = &ActionContext::invite_guild;
|
||||
@@ -319,6 +320,7 @@ class ActionContext : public NamedObjectContext<Action>
|
||||
static Action* auto_talents(PlayerbotAI* botAI) { return new AutoSetTalentsAction(botAI); }
|
||||
static Action* auto_learn_spell(PlayerbotAI* botAI) { return new AutoLearnSpellAction(botAI); }
|
||||
static Action* auto_teleport_for_level(PlayerbotAI* botAI) { return new AutoTeleportForLevelAction(botAI); }
|
||||
static Action* auto_upgrade_equip(PlayerbotAI* botAI) { return new AutoUpgradeEquipAction(botAI); }
|
||||
static Action* xp_gain(PlayerbotAI* botAI) { return new XpGainAction(botAI); }
|
||||
static Action* invite_nearby(PlayerbotAI* botAI) { return new InviteNearbyToGroupAction(botAI); }
|
||||
static Action* invite_guild(PlayerbotAI* botAI) { return new InviteGuildToGroupAction(botAI); }
|
||||
|
||||
@@ -24,7 +24,6 @@ bool AutoLearnSpellAction::Execute(Event event)
|
||||
out << ".";
|
||||
botAI->TellMaster(out);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -181,3 +180,15 @@ void AutoLearnSpellAction::LearnSpell(uint32 spellId, std::ostringstream* out)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool AutoUpgradeEquipAction::Execute(Event event) {
|
||||
if (!sPlayerbotAIConfig->autoUpgradeEquip || !sRandomPlayerbotMgr->IsRandomBot(bot)) {
|
||||
return false;
|
||||
}
|
||||
PlayerbotFactory factory(bot, bot->GetLevel(), ITEM_QUALITY_RARE);
|
||||
if (!sPlayerbotAIConfig->equipmentPersistence || bot->GetLevel() < sPlayerbotAIConfig->equipmentPersistenceLevel) {
|
||||
factory.InitEquipment(true);
|
||||
}
|
||||
factory.InitAmmo();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -23,4 +23,12 @@ class AutoLearnSpellAction : public Action
|
||||
void LearnSpell(uint32 spellId, std::ostringstream* out);
|
||||
};
|
||||
|
||||
class AutoUpgradeEquipAction : public Action
|
||||
{
|
||||
public:
|
||||
AutoUpgradeEquipAction(PlayerbotAI* botAI, std::string const name = "auto upgrade equip") : Action(botAI, name) { }
|
||||
|
||||
bool Execute(Event event);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
#include "SharedDefines.h"
|
||||
|
||||
bool AutoTeleportForLevelAction::Execute(Event event) {
|
||||
AutoUpgradeEquip();
|
||||
|
||||
if (!sPlayerbotAIConfig->autoTeleportForLevel || !sRandomPlayerbotMgr->IsRandomBot(bot)) {
|
||||
return false;
|
||||
}
|
||||
@@ -16,15 +14,4 @@ bool AutoTeleportForLevelAction::Execute(Event event) {
|
||||
}
|
||||
sRandomPlayerbotMgr->RandomTeleportForLevel(bot);
|
||||
return true;
|
||||
}
|
||||
|
||||
void AutoTeleportForLevelAction::AutoUpgradeEquip() {
|
||||
if (!sPlayerbotAIConfig->autoUpgradeEquip || !sRandomPlayerbotMgr->IsRandomBot(bot)) {
|
||||
return;
|
||||
}
|
||||
PlayerbotFactory factory(bot, bot->GetLevel(), ITEM_QUALITY_RARE);
|
||||
if (!sPlayerbotAIConfig->equipmentPersistence || bot->GetLevel() < sPlayerbotAIConfig->equipmentPersistenceLevel) {
|
||||
factory.InitEquipment(true);
|
||||
}
|
||||
factory.InitAmmo();
|
||||
}
|
||||
@@ -15,8 +15,6 @@ class AutoTeleportForLevelAction : public Action
|
||||
AutoTeleportForLevelAction(PlayerbotAI* botAI, std::string const name = "auto teleport for level") : Action(botAI, name) { }
|
||||
|
||||
bool Execute(Event event);
|
||||
private:
|
||||
void AutoUpgradeEquip();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -37,9 +37,10 @@ void WorldPacketHandlerStrategy::InitTriggers(std::vector<TriggerNode*>& trigger
|
||||
triggers.push_back(new TriggerNode("bg status", NextAction::array(0, new NextAction("bg status", relevance), nullptr)));
|
||||
triggers.push_back(new TriggerNode("xpgain", NextAction::array(0, new NextAction("xp gain", relevance), nullptr)));
|
||||
triggers.push_back(new TriggerNode("levelup", NextAction::array(0,
|
||||
new NextAction("auto talents", relevance),
|
||||
new NextAction("auto learn spell", relevance),
|
||||
new NextAction("auto teleport for level", relevance),
|
||||
new NextAction("auto teleport for level", relevance + 3),
|
||||
new NextAction("auto talents", relevance + 2),
|
||||
new NextAction("auto learn spell", relevance + 1),
|
||||
new NextAction("auto upgrade equip", relevance),
|
||||
nullptr)));
|
||||
// triggers.push_back(new TriggerNode("group destroyed", NextAction::array(0, new NextAction("reset botAI", relevance), nullptr)));
|
||||
triggers.push_back(new TriggerNode("questgiver quest details", NextAction::array(0, new NextAction("turn in query quest", relevance), nullptr)));
|
||||
|
||||
Reference in New Issue
Block a user