mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-28 07:56:24 +00:00
Merge branch 'master' into Tame-Chat-Action-/-Pet-Chat-Action-(stances/commands)
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include "InviteToGroupAction.h"
|
||||
#include "LeaveGroupAction.h"
|
||||
#include "LootAction.h"
|
||||
#include "LootRollAction.h"
|
||||
#include "MoveToRpgTargetAction.h"
|
||||
#include "MoveToTravelTargetAction.h"
|
||||
#include "MovementActions.h"
|
||||
@@ -190,6 +191,7 @@ public:
|
||||
creators["buy tabard"] = &ActionContext::buy_tabard;
|
||||
creators["guild manage nearby"] = &ActionContext::guild_manage_nearby;
|
||||
creators["clean quest log"] = &ActionContext::clean_quest_log;
|
||||
creators["roll"] = &ActionContext::roll_action;
|
||||
creators["cancel channel"] = &ActionContext::cancel_channel;
|
||||
|
||||
// BG Tactics
|
||||
@@ -378,6 +380,7 @@ private:
|
||||
static Action* buy_tabard(PlayerbotAI* botAI) { return new BuyTabardAction(botAI); }
|
||||
static Action* guild_manage_nearby(PlayerbotAI* botAI) { return new GuildManageNearbyAction(botAI); }
|
||||
static Action* clean_quest_log(PlayerbotAI* botAI) { return new CleanQuestLogAction(botAI); }
|
||||
static Action* roll_action(PlayerbotAI* botAI) { return new RollAction(botAI); }
|
||||
|
||||
// BG Tactics
|
||||
static Action* bg_tactics(PlayerbotAI* botAI) { return new BGTactics(botAI); }
|
||||
|
||||
@@ -157,16 +157,23 @@ void AutoMaintenanceOnLevelupAction::LearnSpell(uint32 spellId, std::ostringstre
|
||||
void AutoMaintenanceOnLevelupAction::AutoUpgradeEquip()
|
||||
{
|
||||
if (!sPlayerbotAIConfig->autoUpgradeEquip || !sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerbotFactory factory(bot, bot->GetLevel());
|
||||
|
||||
// Clean up old consumables before adding new ones
|
||||
factory.CleanupConsumables();
|
||||
|
||||
factory.InitAmmo();
|
||||
factory.InitReagents();
|
||||
factory.InitFood();
|
||||
factory.InitConsumables();
|
||||
factory.InitPotions();
|
||||
|
||||
if (!sPlayerbotAIConfig->equipmentPersistence || bot->GetLevel() < sPlayerbotAIConfig->equipmentPersistenceLevel)
|
||||
{
|
||||
if (sPlayerbotAIConfig->incrementalGearInit)
|
||||
factory.InitEquipment(true);
|
||||
}
|
||||
factory.InitAmmo();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,3 +50,16 @@ bool BossNatureResistanceAction::Execute(Event event)
|
||||
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + hunterNatureResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BossShadowResistanceAction::isUseful()
|
||||
{
|
||||
BossShadowResistanceTrigger bossShadowResistanceTrigger(botAI, bossName);
|
||||
return bossShadowResistanceTrigger.IsActive();
|
||||
}
|
||||
|
||||
bool BossShadowResistanceAction::Execute(Event event)
|
||||
{
|
||||
PaladinShadowResistanceStrategy paladinShadowResistanceStrategy(botAI);
|
||||
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + paladinShadowResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -54,4 +54,18 @@ private:
|
||||
std::string bossName;
|
||||
};
|
||||
|
||||
class BossShadowResistanceAction : public Action
|
||||
{
|
||||
public:
|
||||
BossShadowResistanceAction(PlayerbotAI* botAI, std::string const bossName)
|
||||
: Action(botAI, bossName + " shadow resistance action"), bossName(bossName)
|
||||
{
|
||||
}
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
|
||||
private:
|
||||
std::string bossName;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "ListSpellsAction.h"
|
||||
#include "LogLevelAction.h"
|
||||
#include "LootStrategyAction.h"
|
||||
#include "LootRollAction.h"
|
||||
#include "MailAction.h"
|
||||
#include "NamedObjectContext.h"
|
||||
#include "NewRpgAction.h"
|
||||
@@ -192,10 +193,11 @@ public:
|
||||
creators["calc"] = &ChatActionContext::calc;
|
||||
creators["wipe"] = &ChatActionContext::wipe;
|
||||
creators["tame"] = &ChatActionContext::tame;
|
||||
creators["glyphs"] = &ChatActionContext::glyphs; // Added for custom Glyphs
|
||||
creators["glyph equip"] = &ChatActionContext::glyph_equip; // Added for custom Glyphs
|
||||
creators["glyphs"] = &ChatActionContext::glyphs; // Added for custom Glyphs
|
||||
creators["glyph equip"] = &ChatActionContext::glyph_equip; // Added for custom Glyphs
|
||||
creators["pet"] = &ChatActionContext::pet;
|
||||
creators["pet attack"] = &ChatActionContext::pet_attack;
|
||||
creators["roll"] = &ChatActionContext::roll_action;
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -303,10 +305,11 @@ private:
|
||||
static Action* calc(PlayerbotAI* ai) { return new TellCalculateItemAction(ai); }
|
||||
static Action* wipe(PlayerbotAI* ai) { return new WipeAction(ai); }
|
||||
static Action* tame(PlayerbotAI* botAI) { return new TameAction(botAI); }
|
||||
static Action* glyphs(PlayerbotAI* botAI) { return new TellGlyphsAction(botAI); } // Added for custom Glyphs
|
||||
static Action* glyph_equip(PlayerbotAI* ai) { return new EquipGlyphsAction(ai); } // Added for custom Glyphs
|
||||
static Action* glyphs(PlayerbotAI* botAI) { return new TellGlyphsAction(botAI); } // Added for custom Glyphs
|
||||
static Action* glyph_equip(PlayerbotAI* ai) { return new EquipGlyphsAction(ai); } // Added for custom Glyphs
|
||||
static Action* pet(PlayerbotAI* botAI) { return new PetAction(botAI); }
|
||||
static Action* pet_attack(PlayerbotAI* botAI) { return new PetAction(botAI, "attack"); }
|
||||
static Action* roll_action(PlayerbotAI* botAI) { return new RollAction(botAI); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -19,22 +19,51 @@ bool ImbueWithPoisonAction::Execute(Event event)
|
||||
if (bot->HasAura(SPELL_AURA_MOD_STEALTH))
|
||||
bot->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
|
||||
|
||||
// hp check
|
||||
if (bot->getStandState() != UNIT_STAND_STATE_STAND)
|
||||
bot->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
|
||||
// Search and apply poison to weapons
|
||||
// Mainhand ...
|
||||
static const std::vector<uint32_t> prioritizedInstantPoisons = {
|
||||
INSTANT_POISON_IX, INSTANT_POISON_VIII, INSTANT_POISON_VII, INSTANT_POISON_VI, INSTANT_POISON_V, INSTANT_POISON_IV,
|
||||
INSTANT_POISON_III, INSTANT_POISON_II, INSTANT_POISON
|
||||
};
|
||||
|
||||
static const std::vector<uint32_t> prioritizedDeadlyPoisons = {
|
||||
DEADLY_POISON_IX, DEADLY_POISON_VIII, DEADLY_POISON_VII, DEADLY_POISON_VI, DEADLY_POISON_V, DEADLY_POISON_IV,
|
||||
DEADLY_POISON_III, DEADLY_POISON_II, DEADLY_POISON
|
||||
};
|
||||
|
||||
// Check if we have any deadly or instant poisons
|
||||
Item* deadlyPoison = nullptr;
|
||||
for (auto id : prioritizedDeadlyPoisons)
|
||||
{
|
||||
deadlyPoison = botAI->FindConsumable(id);
|
||||
if (deadlyPoison) break;
|
||||
}
|
||||
|
||||
Item* instantPoison = nullptr;
|
||||
for (auto id : prioritizedInstantPoisons)
|
||||
{
|
||||
instantPoison = botAI->FindConsumable(id);
|
||||
if (instantPoison) break;
|
||||
}
|
||||
|
||||
// Mainhand
|
||||
Item* poison = nullptr;
|
||||
Item* weapon = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
|
||||
if (weapon && weapon->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT) == 0)
|
||||
{
|
||||
poison = botAI->FindConsumable(INSTANT_POISON_DISPLAYID);
|
||||
if (!poison)
|
||||
poison = botAI->FindConsumable(DEADLY_POISON_DISPLAYID);
|
||||
|
||||
if (!poison)
|
||||
poison = botAI->FindConsumable(WOUND_POISON_DISPLAYID);
|
||||
if (instantPoison && deadlyPoison)
|
||||
{
|
||||
poison = instantPoison;
|
||||
}
|
||||
else if (deadlyPoison)
|
||||
{
|
||||
poison = deadlyPoison;
|
||||
}
|
||||
else if (instantPoison)
|
||||
{
|
||||
poison = instantPoison;
|
||||
}
|
||||
|
||||
if (poison)
|
||||
{
|
||||
@@ -43,16 +72,23 @@ bool ImbueWithPoisonAction::Execute(Event event)
|
||||
}
|
||||
}
|
||||
|
||||
//... and offhand
|
||||
// Offhand
|
||||
poison = nullptr;
|
||||
weapon = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
|
||||
if (weapon && weapon->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT) == 0)
|
||||
{
|
||||
poison = botAI->FindConsumable(DEADLY_POISON_DISPLAYID);
|
||||
if (!poison)
|
||||
poison = botAI->FindConsumable(WOUND_POISON_DISPLAYID);
|
||||
|
||||
if (!poison)
|
||||
poison = botAI->FindConsumable(INSTANT_POISON_DISPLAYID);
|
||||
if (deadlyPoison && instantPoison)
|
||||
{
|
||||
poison = deadlyPoison;
|
||||
}
|
||||
else if (instantPoison)
|
||||
{
|
||||
poison = instantPoison;
|
||||
}
|
||||
else if (deadlyPoison)
|
||||
{
|
||||
poison = deadlyPoison;
|
||||
}
|
||||
|
||||
if (poison)
|
||||
{
|
||||
@@ -141,8 +177,8 @@ bool ImbueWithOilAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
static const uint32 uPriorizedHealingItemIds[19] = {
|
||||
HEALTHSTONE_DISPLAYID,
|
||||
static const uint32 uPrioritizedHealingItemIds[19] = {
|
||||
HEALTHSTONE,
|
||||
FEL_REGENERATION_POTION,
|
||||
SUPER_HEALING_POTION,
|
||||
CRYSTAL_HEALING_POTION,
|
||||
@@ -182,9 +218,9 @@ bool TryEmergencyAction::Execute(Event event)
|
||||
}
|
||||
|
||||
// Else loop over the list of health consumable to pick one
|
||||
for (uint8 i = 0; i < std::size(uPriorizedHealingItemIds); ++i)
|
||||
for (uint8 i = 0; i < std::size(uPrioritizedHealingItemIds); ++i)
|
||||
{
|
||||
if (Item* healthItem = botAI->FindConsumable(uPriorizedHealingItemIds[i]))
|
||||
if (Item* healthItem = botAI->FindConsumable(uPrioritizedHealingItemIds[i]))
|
||||
{
|
||||
botAI->ImbueItem(healthItem);
|
||||
}
|
||||
|
||||
@@ -224,3 +224,37 @@ bool RollUniqueCheck(ItemTemplate const* proto, Player* bot)
|
||||
}
|
||||
return false; // Item is not equipped or in bags, roll for it
|
||||
}
|
||||
|
||||
bool RollAction::Execute(Event event)
|
||||
{
|
||||
std::string link = event.getParam();
|
||||
|
||||
if (link.empty())
|
||||
{
|
||||
bot->DoRandomRoll(0,100);
|
||||
return false;
|
||||
}
|
||||
ItemIds itemIds = chat->parseItems(link);
|
||||
if (itemIds.empty())
|
||||
return false;
|
||||
uint32 itemId = *itemIds.begin();
|
||||
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemId);
|
||||
if (!proto)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
std::string itemUsageParam;
|
||||
itemUsageParam = std::to_string(itemId);
|
||||
|
||||
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", itemUsageParam);
|
||||
switch (proto->Class)
|
||||
{
|
||||
case ITEM_CLASS_WEAPON:
|
||||
case ITEM_CLASS_ARMOR:
|
||||
if (usage == ITEM_USAGE_EQUIP || usage == ITEM_USAGE_REPLACE || usage == ITEM_USAGE_BAD_EQUIP)
|
||||
{
|
||||
bot->DoRandomRoll(0,100);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -37,4 +37,12 @@ public:
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class RollAction : public Action
|
||||
{
|
||||
public:
|
||||
RollAction(PlayerbotAI* botAI) : Action(botAI, "roll") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -175,6 +175,8 @@ bool MaintenanceAction::Execute(Event event)
|
||||
factory.InitAmmo();
|
||||
factory.InitFood();
|
||||
factory.InitReagents();
|
||||
factory.InitConsumables();
|
||||
factory.InitPotions();
|
||||
factory.InitTalentsTree(true);
|
||||
factory.InitPet();
|
||||
factory.InitPetTalents();
|
||||
@@ -186,7 +188,6 @@ bool MaintenanceAction::Execute(Event event)
|
||||
factory.InitMounts();
|
||||
factory.InitGlyphs(false);
|
||||
factory.InitKeyring();
|
||||
factory.InitPotions();
|
||||
if (bot->GetLevel() >= sPlayerbotAIConfig->minEnchantingBotLevel)
|
||||
factory.ApplyEnchantAndGemsNew();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user