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)
|
bool PlayerbotAI::HasAuraToDispel(Unit* target, uint32 dispelType)
|
||||||
{
|
{
|
||||||
|
if (!target->IsInWorld())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
bool isFriend = bot->IsFriendlyTo(target);
|
bool isFriend = bot->IsFriendlyTo(target);
|
||||||
for (uint32 type = SPELL_AURA_NONE; type < TOTAL_AURAS; ++type)
|
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;
|
z = 0.05f + ground;
|
||||||
|
|
||||||
LOG_INFO("playerbots", "Random teleporting bot (level {}) {} to {} {},{},{} ({}/{} locations)",
|
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());
|
bot->GetName().c_str(), bot->GetLevel(), zone->area_name[0], x, y, z, attemtps, tlocs.size());
|
||||||
|
|
||||||
if (hearth)
|
if (hearth)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,6 +63,10 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!target->IsInWorld())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
std::ostringstream msg;
|
std::ostringstream msg;
|
||||||
msg << target->GetName();
|
msg << target->GetName();
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,10 @@ uint8 AoeHealValue::Calculate()
|
|||||||
Player* player = ObjectAccessor::FindPlayer(itr->guid);
|
Player* player = ObjectAccessor::FindPlayer(itr->guid);
|
||||||
if (!player || !player->IsAlive())
|
if (!player || !player->IsAlive())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (player->GetDistance(bot) >= sPlayerbotAIConfig->sightDistance)
|
||||||
|
continue;
|
||||||
|
|
||||||
float percent = (static_cast<float> (player->GetHealth()) / player->GetMaxHealth()) * 100;
|
float percent = (static_cast<float> (player->GetHealth()) / player->GetMaxHealth()) * 100;
|
||||||
if (percent <= range)
|
if (percent <= range)
|
||||||
++count;
|
++count;
|
||||||
|
|||||||
Reference in New Issue
Block a user