mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
[Crash fix] Target IsInWorld check
This commit is contained in:
@@ -3090,6 +3090,10 @@ bool PlayerbotAI::IsInterruptableSpellCasting(Unit* target, std::string const sp
|
||||
|
||||
bool PlayerbotAI::HasAuraToDispel(Unit* target, uint32 dispelType)
|
||||
{
|
||||
if (!target->IsInWorld())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool isFriend = bot->IsFriendlyTo(target);
|
||||
for (uint32 type = SPELL_AURA_NONE; type < TOTAL_AURAS; ++type)
|
||||
{
|
||||
|
||||
@@ -1196,8 +1196,8 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, std::vector<WorldLocation>&
|
||||
|
||||
z = 0.05f + ground;
|
||||
|
||||
LOG_INFO("playerbots", "Random teleporting bot (level {}) {} to {} {},{},{} ({}/{} locations)",
|
||||
bot->GetLevel(), bot->GetName().c_str(), zone->area_name[0], x, y, z, attemtps, tlocs.size());
|
||||
LOG_INFO("playerbots", "Random teleporting bot {} (level {}) to {} {},{},{} ({}/{} locations)",
|
||||
bot->GetName().c_str(), bot->GetLevel(), zone->area_name[0], x, y, z, attemtps, tlocs.size());
|
||||
|
||||
if (hearth)
|
||||
{
|
||||
|
||||
@@ -63,6 +63,10 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!target->IsInWorld())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
std::ostringstream msg;
|
||||
msg << target->GetName();
|
||||
|
||||
|
||||
@@ -29,7 +29,10 @@ uint8 AoeHealValue::Calculate()
|
||||
Player* player = ObjectAccessor::FindPlayer(itr->guid);
|
||||
if (!player || !player->IsAlive())
|
||||
continue;
|
||||
|
||||
|
||||
if (player->GetDistance(bot) >= sPlayerbotAIConfig->sightDistance)
|
||||
continue;
|
||||
|
||||
float percent = (static_cast<float> (player->GetHealth()) / player->GetMaxHealth()) * 100;
|
||||
if (percent <= range)
|
||||
++count;
|
||||
|
||||
Reference in New Issue
Block a user