Merge branch 'master' into more-av-fixes

This commit is contained in:
Fuzz
2024-07-22 09:29:13 +10:00
19 changed files with 296 additions and 77 deletions

View File

@@ -95,6 +95,16 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
return false;
}
if (target->IsPlayer() && !target->IsPvP() && !target->IsFFAPvP() && (!bot->duel || bot->duel->Opponent != target || bot->duel->StartTime))
{
if (verbose)
{
botAI->TellError(Acore::StringFormat("%s is not flagged for pvp", target->GetName()));
}
return false;
}
if (bot->IsMounted() && bot->IsWithinLOSInMap(target))
{
WorldPacket emptyPacket;

View File

@@ -9,14 +9,14 @@
#include "Playerbots.h"
#include "ServerFacade.h"
uint32 FindLastSeparator(std::string const text, std::string const sep)
size_t FindLastSeparator(std::string const text, std::string const sep)
{
size_t pos = text.rfind(sep);
if (pos == std::string::npos)
return pos;
uint32 lastLinkBegin = text.rfind("|H");
uint32 lastLinkEnd = text.find("|h|r", lastLinkBegin + 1);
size_t lastLinkBegin = text.rfind("|H");
size_t lastLinkEnd = text.find("|h|r", lastLinkBegin + 1);
if (pos >= lastLinkBegin && pos <= lastLinkEnd)
pos = text.find_last_of(sep, lastLinkBegin);

View File

@@ -137,6 +137,8 @@ std::string const QueryItemUsageAction::QueryItemUsage(ItemTemplate const* item)
return "Auctionhouse";
case ITEM_USAGE_AMMO:
return "Ammunition";
default:
break;
}
return "";

View File

@@ -588,11 +588,12 @@ void ChatReplyAction::ChatReplyDo(Player* bot, uint32 type, uint32 guid1, uint32
if (ChannelMgr* cMgr = ChannelMgr::forTeam(bot->GetTeamId()))
{
std::string worldChan = "World";
if (Channel* chn = cMgr->GetJoinChannel(worldChan.c_str(), 0))
if (Channel* chn = cMgr->GetJoinChannel(worldChan.c_str(), 0)) {
if (bot->GetTeamId() == TEAM_ALLIANCE)
chn->Say(bot->GetGUID(), c, LANG_COMMON);
else
chn->Say(bot->GetGUID(), c, LANG_ORCISH);
}
}
}
else

View File

@@ -151,7 +151,7 @@ void TrainerAction::TellFooter(uint32 totalCost)
bool MaintenanceAction::Execute(Event event)
{
if (!sPlayerbotAIConfig->maintenanceCommand) {
botAI->TellMaster("maintenance command is not allowed, please check the configuration.");
botAI->TellError("maintenance command is not allowed, please check the configuration.");
return false;
}
botAI->TellMaster("I'm maintaining");
@@ -187,7 +187,7 @@ bool RemoveGlyphAction::Execute(Event event)
bool AutoGearAction::Execute(Event event)
{
if (!sPlayerbotAIConfig->autoGearCommand) {
botAI->TellMaster("autogear command is not allowed, please check the configuration.");
botAI->TellError("autogear command is not allowed, please check the configuration.");
return false;
}
botAI->TellMaster("I'm auto gearing");

View File

@@ -164,6 +164,15 @@ bool SummonAction::SummonUsingNpcs(Player* summoner, Player* player)
bool SummonAction::Teleport(Player* summoner, Player* player)
{
Player* master = GetMaster();
if (master->GetMap() && master->GetMap()->IsDungeon()) {
InstanceMap* map = master->GetMap()->ToInstanceMap();
if (map) {
if (map->CannotEnter(player) == Map::CANNOT_ENTER_MAX_PLAYERS) {
botAI->TellError("I can not enter this dungeon");
return false;
}
}
}
if (!summoner->IsBeingTeleported() && !player->IsBeingTeleported())
{
float followAngle = GetFollowAngle();

View File

@@ -51,5 +51,5 @@ void GenericRogueNonCombatStrategy::InitTriggers(std::vector<TriggerNode*>& trig
triggers.push_back(new TriggerNode(
"often",
NextAction::array(0, new NextAction("unstealth", 10.0f), NULL)));
NextAction::array(0, new NextAction("unstealth", 30.0f), NULL)));
}

View File

@@ -35,7 +35,7 @@ class GenericShamanStrategyActionNodeFactory : public NamedObjectFactory<ActionN
{
return new ActionNode ("flametongue weapon",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("flametongue weapon"), nullptr),
/*A*/ NextAction::array(0, new NextAction("rockbiter weapon"), nullptr),
/*C*/ nullptr);
}
@@ -43,7 +43,7 @@ class GenericShamanStrategyActionNodeFactory : public NamedObjectFactory<ActionN
{
return new ActionNode ("frostbrand weapon",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("frostbrand weapon"), nullptr),
/*A*/ NextAction::array(0, new NextAction("flametongue weapon"), nullptr),
/*C*/ nullptr);
}
@@ -51,7 +51,7 @@ class GenericShamanStrategyActionNodeFactory : public NamedObjectFactory<ActionN
{
return new ActionNode ("windfury weapon",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("windfury weapon"), nullptr),
/*A*/ NextAction::array(0, new NextAction("flametongue weapon"), nullptr),
/*C*/ nullptr);
}

View File

@@ -34,15 +34,15 @@ bool ShamanWeaponTrigger::IsActive()
*/
bool MainHandWeaponNoImbueTrigger::IsActive() {
Item* const itemForSpell = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND );
Item* const itemForSpell = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
if (!itemForSpell || itemForSpell->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT))
return false;
return true;
}
bool OffHandWeaponNoImbueTrigger::IsActive() {
Item* const itemForSpell = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND );
if (!itemForSpell || itemForSpell->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT))
Item* const itemForSpell = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
if (!itemForSpell || itemForSpell->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT) || itemForSpell->GetTemplate()->InventoryType != INVTYPE_WEAPON)
return false;
return true;
}
@@ -106,4 +106,4 @@ bool NoAirTotemTrigger::IsActive()
{
return !AI_VALUE2(bool, "has totem", "wrath of air totem") &&
!AI_VALUE2(bool, "has totem", "windfury totem");
}
}

View File

@@ -46,7 +46,7 @@ class AreaDebuffValue : public CalculatedValue<Aura*>
{
public:
AreaDebuffValue(PlayerbotAI* botAI) :
CalculatedValue<Aura*>(botAI, "area debuff", 1 * 1000) { }
CalculatedValue<Aura*>(botAI, "area debuff", 1) { }
Aura* Calculate() override;
};