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();