Showing with 7 additions and 6 deletions.
  1. +3 −3 src/map/ai/controllers/mob_controller.cpp
  2. +3 −3 src/map/lua/lua_baseentity.cpp
  3. +1 −0 src/map/zone.h
@@ -489,7 +489,7 @@ void CMobController::CastSpell(uint16 spellid)
void CMobController::DoCombatTick(time_point tick)
{
HandleEnmity();
PTarget = static_cast<CBattleEntity*>(PMob->loc.zone->GetEntity(PMob->GetBattleTargetID()));
PTarget = static_cast<CBattleEntity*>(PMob->GetEntity(PMob->GetBattleTargetID()));

if (TryDeaggro())
{
@@ -623,9 +623,9 @@ void CMobController::DoCombatTick(time_point tick)

void CMobController::HandleEnmity()
{
if (PMob->getMobMod(MOBMOD_SHARE_TARGET) > 0 && PMob->loc.zone->GetEntity(PMob->getMobMod(MOBMOD_SHARE_TARGET), TYPE_MOB))
if (PMob->getMobMod(MOBMOD_SHARE_TARGET) > 0 && PMob->GetEntity(PMob->getMobMod(MOBMOD_SHARE_TARGET), TYPE_MOB))
{
ChangeTarget(static_cast<CMobEntity*>(PMob->loc.zone->GetEntity(PMob->getMobMod(MOBMOD_SHARE_TARGET), TYPE_MOB))->GetBattleTargetID());
ChangeTarget(static_cast<CMobEntity*>(PMob->GetEntity(PMob->getMobMod(MOBMOD_SHARE_TARGET), TYPE_MOB))->GetBattleTargetID());

if (!PMob->GetBattleTargetID())
{
@@ -6447,7 +6447,7 @@ inline int32 CLuaBaseEntity::getCursorTarget(lua_State* L)
DSP_DEBUG_BREAK_IF(m_PBaseEntity->objtype != TYPE_PC);

CCharEntity* PChar = (CCharEntity*)m_PBaseEntity;
auto PTarget = PChar->loc.zone->GetEntity(PChar->m_TargID);
auto PTarget = PChar->GetEntity(PChar->m_TargID);

if (PTarget == NULL)
{
@@ -7541,7 +7541,7 @@ inline int32 CLuaBaseEntity::injectActionPacket(lua_State* L)
// If you use ACTION_MOBABILITY_FINISH, the first param = anim, the second param = skill id.
if (actiontype == ACTION_MOBABILITY_FINISH || actiontype == ACTION_PET_MOBABILITY_FINISH)
{
CBattleEntity* PTarget = (CBattleEntity*)PChar->loc.zone->GetEntity(PChar->m_TargID);
CBattleEntity* PTarget = (CBattleEntity*)PChar->GetEntity(PChar->m_TargID);
if (PTarget == nullptr)
{
ShowError("Cannot use MOBABILITY_FINISH on a nullptr battle target! Target a mob! \n");
@@ -7612,7 +7612,7 @@ inline int32 CLuaBaseEntity::setMobFlags(lua_State* L)
else
{
CCharEntity* PChar = (CCharEntity*)m_PBaseEntity;
CBattleEntity* PTarget = (CBattleEntity*)PChar->loc.zone->GetEntity(PChar->m_TargID);
CBattleEntity* PTarget = (CBattleEntity*)PChar->GetEntity(PChar->m_TargID);

if (PTarget == nullptr)
{
@@ -524,6 +524,7 @@ class CZone

virtual CCharEntity* GetCharByName(int8* name); // finds the player if exists in zone
virtual CCharEntity* GetCharByID(uint32 id);
// Gets an entity - ignores instances (use CBaseEntity->GetEntity if possible)
virtual CBaseEntity* GetEntity(uint16 targid, uint8 filter = -1); // получаем указатель на любую сущность в зоне

bool IsWeatherStatic(); // погода в зоне не требует изменения (никогда не меняется)