Method isVisible should be named isSpawned to reflect what it does.
This commit is contained in:
parent
0ac09f876f
commit
ae2e9409c6
@ -152,7 +152,7 @@ abstract class AbstractAI implements Ctrl
|
||||
@Override
|
||||
public void setIntention(CtrlIntention intention, Object arg0, Object arg1)
|
||||
{
|
||||
if (!_actor.isVisible() || !_actor.hasAI())
|
||||
if (!_actor.isSpawned() || !_actor.hasAI())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -252,7 +252,7 @@ abstract class AbstractAI implements Ctrl
|
||||
@Override
|
||||
public void notifyEvent(CtrlEvent evt, Object arg0, Object arg1)
|
||||
{
|
||||
if (!_actor.isVisible() || !_actor.hasAI() || ((_actor instanceof PlayerInstance) && !((PlayerInstance) _actor).isOnline()) || ((_actor instanceof PlayerInstance) && ((PlayerInstance) _actor).isInOfflineMode()))
|
||||
if (!_actor.isSpawned() || !_actor.hasAI() || ((_actor instanceof PlayerInstance) && !((PlayerInstance) _actor).isOnline()) || ((_actor instanceof PlayerInstance) && ((PlayerInstance) _actor).isInOfflineMode()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -823,7 +823,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
||||
@Override
|
||||
public void onEvtThink()
|
||||
{
|
||||
// if(getIntention() != AI_INTENTION_IDLE && (!_actor.isVisible() || !_actor.hasAI() || !_actor.isKnownPlayers()))
|
||||
// if(getIntention() != AI_INTENTION_IDLE && (!_actor.isSpawned() || !_actor.hasAI() || !_actor.isKnownPlayers()))
|
||||
// setIntention(AI_INTENTION_IDLE);
|
||||
|
||||
// Check if the actor can't use skills and if a thinking action isn't already in progress
|
||||
|
@ -69,7 +69,7 @@ public class Resurrect implements ISkillHandler
|
||||
}
|
||||
}
|
||||
|
||||
if (target.isVisible())
|
||||
if (target.isSpawned())
|
||||
{
|
||||
targetToRes.add(target);
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ public class DayNightSpawnManager
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
if (!boss.isVisible())
|
||||
if (!boss.isSpawned())
|
||||
{
|
||||
boss.spawnMe();
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ public class ItemsOnGroundManager
|
||||
item.getPosition().getWorldRegion().addVisibleObject(item);
|
||||
item.setDropTime(result.getLong(8));
|
||||
item.setProtected(result.getLong(8) == -1);
|
||||
item.setVisible(true);
|
||||
item.setSpawned(true);
|
||||
World.getInstance().addVisibleObject(item, item.getPosition().getWorldRegion(), null);
|
||||
_items.add(item);
|
||||
count++;
|
||||
|
@ -119,7 +119,7 @@ public class ObjectPosition
|
||||
}
|
||||
|
||||
setWorldPosition(correctX, correctY, z);
|
||||
_activeObject.setVisible(false);
|
||||
_activeObject.setSpawned(false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -127,7 +127,7 @@ public class ObjectPosition
|
||||
*/
|
||||
public void updateWorldRegion()
|
||||
{
|
||||
if (!_activeObject.isVisible())
|
||||
if (!_activeObject.isSpawned())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -503,7 +503,7 @@ public class World
|
||||
continue; // skip our own character
|
||||
}
|
||||
|
||||
if (!wo.isVisible())
|
||||
if (!wo.isSpawned())
|
||||
{
|
||||
continue; // skip dying objects
|
||||
}
|
||||
@ -533,7 +533,7 @@ public class World
|
||||
*/
|
||||
public List<WorldObject> getVisibleObjects(WorldObject object, int radius)
|
||||
{
|
||||
if ((object == null) || !object.isVisible())
|
||||
if ((object == null) || !object.isSpawned())
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@ -600,7 +600,7 @@ public class World
|
||||
*/
|
||||
public List<WorldObject> getVisibleObjects3D(WorldObject object, int radius)
|
||||
{
|
||||
if ((object == null) || !object.isVisible())
|
||||
if ((object == null) || !object.isSpawned())
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@ -684,7 +684,7 @@ public class World
|
||||
continue; // skip our own character
|
||||
}
|
||||
|
||||
if (!playable.isVisible())
|
||||
if (!playable.isSpawned())
|
||||
{
|
||||
continue; // skip dying objects
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public abstract class WorldObject
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(WorldObject.class.getName());
|
||||
|
||||
private boolean _visible;
|
||||
private boolean _isSpawned;
|
||||
private WorldObjectKnownList _knownList;
|
||||
private String _name;
|
||||
private int _objectId;
|
||||
@ -134,7 +134,7 @@ public abstract class WorldObject
|
||||
public void decayMe()
|
||||
{
|
||||
// Remove the WorldObject from the world
|
||||
_visible = false;
|
||||
_isSpawned = false;
|
||||
World.getInstance().removeVisibleObject(this, getPosition().getWorldRegion());
|
||||
World.getInstance().removeObject(this);
|
||||
getPosition().setWorldRegion(null);
|
||||
@ -170,7 +170,7 @@ public abstract class WorldObject
|
||||
|
||||
synchronized (this)
|
||||
{
|
||||
_visible = false;
|
||||
_isSpawned = false;
|
||||
getPosition().setWorldRegion(null);
|
||||
}
|
||||
|
||||
@ -218,7 +218,7 @@ public abstract class WorldObject
|
||||
synchronized (this)
|
||||
{
|
||||
// Set the x,y,z position of the WorldObject spawn and update its _worldregion
|
||||
_visible = true;
|
||||
_isSpawned = true;
|
||||
getPosition().setWorldRegion(World.getInstance().getRegion(getPosition().getWorldPosition()));
|
||||
|
||||
// Add the WorldObject spawn in the _allobjects of World
|
||||
@ -239,7 +239,7 @@ public abstract class WorldObject
|
||||
synchronized (this)
|
||||
{
|
||||
// Set the x,y,z position of the WorldObject spawn and update its _worldregion
|
||||
_visible = true;
|
||||
_isSpawned = true;
|
||||
|
||||
int spawnX = x;
|
||||
if (spawnX > World.MAP_MAX_X)
|
||||
@ -288,7 +288,7 @@ public abstract class WorldObject
|
||||
|
||||
public void toggleVisible()
|
||||
{
|
||||
if (isVisible())
|
||||
if (isSpawned())
|
||||
{
|
||||
decayMe();
|
||||
}
|
||||
@ -300,21 +300,15 @@ public abstract class WorldObject
|
||||
|
||||
public abstract boolean isAutoAttackable(Creature attacker);
|
||||
|
||||
/**
|
||||
* <b><u>Concept</u>:</b><br>
|
||||
* <br>
|
||||
* A WorldObject is visible if <b>__IsVisible</b>=true and <b>_worldregion</b>!=null
|
||||
* @return the visibility state of the WorldObject.
|
||||
*/
|
||||
public boolean isVisible()
|
||||
public boolean isSpawned()
|
||||
{
|
||||
return getPosition().getWorldRegion() != null;
|
||||
}
|
||||
|
||||
public void setVisible(boolean value)
|
||||
public void setSpawned(boolean value)
|
||||
{
|
||||
_visible = value;
|
||||
if (!_visible)
|
||||
_isSpawned = value;
|
||||
if (!_isSpawned)
|
||||
{
|
||||
getPosition().setWorldRegion(null);
|
||||
}
|
||||
@ -387,7 +381,7 @@ public abstract class WorldObject
|
||||
_instanceId = instanceId;
|
||||
|
||||
// If we change it for visible objects, me must clear & revalidates knownlists
|
||||
if (_visible && (_knownList != null))
|
||||
if (_isSpawned && (_knownList != null))
|
||||
{
|
||||
if (this instanceof PlayerInstance)
|
||||
{
|
||||
|
@ -1104,7 +1104,7 @@ public class Attackable extends NpcInstance
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ai._attacker.isAlikeDead() || !getKnownList().knowsObject(ai._attacker) || !ai._attacker.isVisible() || ((ai._attacker instanceof PlayerInstance) && !((PlayerInstance) ai._attacker).isOnline() && !((PlayerInstance) ai._attacker).isInOfflineMode()))
|
||||
if (ai._attacker.isAlikeDead() || !getKnownList().knowsObject(ai._attacker) || !ai._attacker.isSpawned() || ((ai._attacker instanceof PlayerInstance) && !((PlayerInstance) ai._attacker).isOnline() && !((PlayerInstance) ai._attacker).isInOfflineMode()))
|
||||
{
|
||||
ai._hate = 0;
|
||||
}
|
||||
@ -1155,7 +1155,7 @@ public class Attackable extends NpcInstance
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!ai._attacker.isVisible())
|
||||
if (!ai._attacker.isSpawned())
|
||||
{
|
||||
_aggroList.remove(target);
|
||||
return 0;
|
||||
|
@ -5145,7 +5145,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isVisible())
|
||||
if (!isSpawned())
|
||||
{
|
||||
_move = null;
|
||||
return true;
|
||||
@ -5361,7 +5361,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
public void setTarget(WorldObject worldObject)
|
||||
{
|
||||
WorldObject object = worldObject;
|
||||
if ((object != null) && !object.isVisible())
|
||||
if ((object != null) && !object.isSpawned())
|
||||
{
|
||||
object = null;
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ public abstract class Summon extends Playable
|
||||
{
|
||||
super.broadcastStatusUpdate();
|
||||
|
||||
if ((_owner != null) && isVisible())
|
||||
if ((_owner != null) && isSpawned())
|
||||
{
|
||||
_owner.sendPacket(new PetStatusUpdate(this));
|
||||
}
|
||||
@ -404,7 +404,7 @@ public abstract class Summon extends Playable
|
||||
|
||||
public synchronized void unSummon(PlayerInstance owner)
|
||||
{
|
||||
if (isVisible() && !isDead())
|
||||
if (isSpawned() && !isDead())
|
||||
{
|
||||
stopAllEffects();
|
||||
|
||||
|
@ -153,7 +153,7 @@ public class CabaleBufferInstance extends NpcInstance
|
||||
private boolean handleCast(PlayerInstance player, int skillId)
|
||||
{
|
||||
final int skillLevel = player.getLevel() > 40 ? 1 : 2;
|
||||
if (player.isDead() || !player.isVisible() || !isInsideRadius(player, getDistanceToWatchObject(player), false, false))
|
||||
if (player.isDead() || !player.isSpawned() || !isInsideRadius(player, getDistanceToWatchObject(player), false, false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ public class ChestInstance extends MonsterInstance
|
||||
skillLevel = 6;
|
||||
}
|
||||
|
||||
if (creature.isDead() || !creature.isVisible() || !creature.isInsideRadius(this, getDistanceToWatchObject(creature), false, false))
|
||||
if (creature.isDead() || !creature.isSpawned() || !creature.isInsideRadius(this, getDistanceToWatchObject(creature), false, false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -453,7 +453,7 @@ public class CubicInstance
|
||||
{
|
||||
targetIt = false;
|
||||
}
|
||||
if (!enemy.isVisible())
|
||||
if (!enemy.isSpawned())
|
||||
{
|
||||
targetIt = false;
|
||||
}
|
||||
|
@ -476,7 +476,7 @@ public class PetInstance extends Summon
|
||||
|
||||
synchronized (target)
|
||||
{
|
||||
if (!target.isVisible())
|
||||
if (!target.isSpawned())
|
||||
{
|
||||
getOwner().sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
|
@ -5100,7 +5100,7 @@ public class PlayerInstance extends Playable
|
||||
synchronized (target)
|
||||
{
|
||||
// Check if the target to pick up is visible
|
||||
if (!target.isVisible())
|
||||
if (!target.isSpawned())
|
||||
{
|
||||
// Send a Server->Client packet ActionFailed to this PlayerInstance
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
@ -5267,7 +5267,7 @@ public class PlayerInstance extends Playable
|
||||
{
|
||||
// Check if the new target is visible
|
||||
WorldObject newTarget = worldObject;
|
||||
if ((newTarget != null) && !newTarget.isVisible())
|
||||
if ((newTarget != null) && !newTarget.isSpawned())
|
||||
{
|
||||
newTarget = null;
|
||||
}
|
||||
@ -12729,7 +12729,7 @@ public class PlayerInstance extends Playable
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isVisible())
|
||||
if (!isSpawned())
|
||||
{
|
||||
_move = null;
|
||||
return true;
|
||||
@ -13507,7 +13507,7 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
|
||||
// Remove the PlayerInstance from the world
|
||||
if (isVisible())
|
||||
if (isSpawned())
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ public class ProtectorInstance extends NpcInstance
|
||||
// Cast for Player
|
||||
private boolean handleCast(PlayerInstance player, int skillId, int skillLevel)
|
||||
{
|
||||
if (player.isGM() || player.isDead() || !player.isVisible() || !isInsideRadius(player, Config.PROTECTOR_RADIUS_ACTION, false, false))
|
||||
if (player.isGM() || player.isDead() || !player.isSpawned() || !isInsideRadius(player, Config.PROTECTOR_RADIUS_ACTION, false, false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -96,7 +96,7 @@ public class ProtectorInstance extends NpcInstance
|
||||
// Cast for pet
|
||||
private boolean handleCastonPet(Summon player, int skillId, int skillLevel)
|
||||
{
|
||||
if (player.isDead() || !player.isVisible() || !isInsideRadius(player, Config.PROTECTOR_RADIUS_ACTION, false, false))
|
||||
if (player.isDead() || !player.isSpawned() || !isInsideRadius(player, Config.PROTECTOR_RADIUS_ACTION, false, false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ public class SepulcherMonsterInstance extends MonsterInstance
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_activeChar.isVisible())
|
||||
if (!_activeChar.isSpawned())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -392,7 +392,7 @@ public class SepulcherMonsterInstance extends MonsterInstance
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_activeChar.isVisible())
|
||||
if (!_activeChar.isSpawned())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public class FriendlyMobKnownList extends AttackableKnownList
|
||||
}
|
||||
}
|
||||
|
||||
if (getActiveChar().isVisible() && getKnownPlayers().isEmpty())
|
||||
if (getActiveChar().isSpawned() && getKnownPlayers().isEmpty())
|
||||
{
|
||||
getActiveChar().clearAggroList();
|
||||
if (getActiveChar().hasAI())
|
||||
|
@ -72,7 +72,7 @@ public class MonsterKnownList extends AttackableKnownList
|
||||
getActiveChar().getAI().notifyEvent(CtrlEvent.EVT_FORGET_OBJECT, object);
|
||||
}
|
||||
|
||||
if (getActiveChar().isVisible() && getKnownPlayers().isEmpty())
|
||||
if (getActiveChar().isSpawned() && getKnownPlayers().isEmpty())
|
||||
{
|
||||
// Clear the _aggroList of the MonsterInstance
|
||||
getActiveChar().clearAggroList();
|
||||
|
@ -51,7 +51,7 @@ public class WorldObjectKnownList
|
||||
// Check if already know object
|
||||
if (knowsObject(object))
|
||||
{
|
||||
if (!object.isVisible())
|
||||
if (!object.isSpawned())
|
||||
{
|
||||
removeKnownObject(object);
|
||||
}
|
||||
@ -168,7 +168,7 @@ public class WorldObjectKnownList
|
||||
|
||||
// Remove all invisible objects
|
||||
// Remove all too far objects
|
||||
if (!object.isVisible() || !Util.checkIfInRange(getDistanceToForgetObject(object), _activeObject, object, true))
|
||||
if (!object.isSpawned() || !Util.checkIfInRange(getDistanceToForgetObject(object), _activeObject, object, true))
|
||||
{
|
||||
if ((object instanceof BoatInstance) && (_activeObject instanceof PlayerInstance))
|
||||
{
|
||||
|
@ -1090,7 +1090,7 @@ public class ItemInstance extends WorldObject
|
||||
synchronized (this)
|
||||
{
|
||||
// Set the x,y,z position of the ItemInstance dropped and update its _worldregion
|
||||
setVisible(true);
|
||||
setSpawned(true);
|
||||
getPosition().setWorldPosition(x, y, z);
|
||||
getPosition().setWorldRegion(World.getInstance().getRegion(getPosition().getWorldPosition()));
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class RequestPrivateStoreManageBuy extends GameClientPacket
|
||||
}
|
||||
|
||||
// Fix for privatestore exploit during login
|
||||
if (!player.isVisible() || player.isLocked())
|
||||
if (!player.isSpawned() || player.isLocked())
|
||||
{
|
||||
Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " try exploit at login with privatestore!", Config.DEFAULT_PUNISH);
|
||||
LOGGER.warning("Player " + player.getName() + " try exploit at login with privatestore!");
|
||||
|
@ -45,7 +45,7 @@ public class RequestPrivateStoreManageSell extends GameClientPacket
|
||||
}
|
||||
|
||||
// Fix for privatestore exploit during login
|
||||
if (!player.isVisible() || player.isLocked())
|
||||
if (!player.isSpawned() || player.isLocked())
|
||||
{
|
||||
Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " try exploit at login with privatestore!", Config.DEFAULT_PUNISH);
|
||||
LOGGER.warning("Player " + player.getName() + " try exploit at login with privatestore!");
|
||||
|
@ -82,7 +82,7 @@ public class KnownListUpdateTaskManager
|
||||
{
|
||||
for (WorldObject object : region.getVisibleObjects()) // and for all members in region
|
||||
{
|
||||
if (!object.isVisible())
|
||||
if (!object.isSpawned())
|
||||
{
|
||||
continue; // skip dying objects
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ abstract class AbstractAI implements Ctrl
|
||||
@Override
|
||||
public void setIntention(CtrlIntention intention, Object arg0, Object arg1)
|
||||
{
|
||||
if (!_actor.isVisible() || !_actor.hasAI())
|
||||
if (!_actor.isSpawned() || !_actor.hasAI())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -252,7 +252,7 @@ abstract class AbstractAI implements Ctrl
|
||||
@Override
|
||||
public void notifyEvent(CtrlEvent evt, Object arg0, Object arg1)
|
||||
{
|
||||
if (!_actor.isVisible() || !_actor.hasAI() || ((_actor instanceof PlayerInstance) && !((PlayerInstance) _actor).isOnline()) || ((_actor instanceof PlayerInstance) && ((PlayerInstance) _actor).isInOfflineMode()))
|
||||
if (!_actor.isSpawned() || !_actor.hasAI() || ((_actor instanceof PlayerInstance) && !((PlayerInstance) _actor).isOnline()) || ((_actor instanceof PlayerInstance) && ((PlayerInstance) _actor).isInOfflineMode()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -823,7 +823,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
||||
@Override
|
||||
public void onEvtThink()
|
||||
{
|
||||
// if(getIntention() != AI_INTENTION_IDLE && (!_actor.isVisible() || !_actor.hasAI() || !_actor.isKnownPlayers()))
|
||||
// if(getIntention() != AI_INTENTION_IDLE && (!_actor.isSpawned() || !_actor.hasAI() || !_actor.isKnownPlayers()))
|
||||
// setIntention(AI_INTENTION_IDLE);
|
||||
|
||||
// Check if the actor can't use skills and if a thinking action isn't already in progress
|
||||
|
@ -69,7 +69,7 @@ public class Resurrect implements ISkillHandler
|
||||
}
|
||||
}
|
||||
|
||||
if (target.isVisible())
|
||||
if (target.isSpawned())
|
||||
{
|
||||
targetToRes.add(target);
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ public class DayNightSpawnManager
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
if (!boss.isVisible())
|
||||
if (!boss.isSpawned())
|
||||
{
|
||||
boss.spawnMe();
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ public class ItemsOnGroundManager
|
||||
item.getPosition().getWorldRegion().addVisibleObject(item);
|
||||
item.setDropTime(result.getLong(8));
|
||||
item.setProtected(result.getLong(8) == -1);
|
||||
item.setVisible(true);
|
||||
item.setSpawned(true);
|
||||
World.getInstance().addVisibleObject(item, item.getPosition().getWorldRegion(), null);
|
||||
_items.add(item);
|
||||
count++;
|
||||
|
@ -119,7 +119,7 @@ public class ObjectPosition
|
||||
}
|
||||
|
||||
setWorldPosition(correctX, correctY, z);
|
||||
_activeObject.setVisible(false);
|
||||
_activeObject.setSpawned(false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -127,7 +127,7 @@ public class ObjectPosition
|
||||
*/
|
||||
public void updateWorldRegion()
|
||||
{
|
||||
if (!_activeObject.isVisible())
|
||||
if (!_activeObject.isSpawned())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -503,7 +503,7 @@ public class World
|
||||
continue; // skip our own character
|
||||
}
|
||||
|
||||
if (!wo.isVisible())
|
||||
if (!wo.isSpawned())
|
||||
{
|
||||
continue; // skip dying objects
|
||||
}
|
||||
@ -533,7 +533,7 @@ public class World
|
||||
*/
|
||||
public List<WorldObject> getVisibleObjects(WorldObject object, int radius)
|
||||
{
|
||||
if ((object == null) || !object.isVisible())
|
||||
if ((object == null) || !object.isSpawned())
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@ -600,7 +600,7 @@ public class World
|
||||
*/
|
||||
public List<WorldObject> getVisibleObjects3D(WorldObject object, int radius)
|
||||
{
|
||||
if ((object == null) || !object.isVisible())
|
||||
if ((object == null) || !object.isSpawned())
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@ -684,7 +684,7 @@ public class World
|
||||
continue; // skip our own character
|
||||
}
|
||||
|
||||
if (!playable.isVisible())
|
||||
if (!playable.isSpawned())
|
||||
{
|
||||
continue; // skip dying objects
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public abstract class WorldObject
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(WorldObject.class.getName());
|
||||
|
||||
private boolean _visible;
|
||||
private boolean _isSpawned;
|
||||
private WorldObjectKnownList _knownList;
|
||||
private String _name;
|
||||
private int _objectId;
|
||||
@ -134,7 +134,7 @@ public abstract class WorldObject
|
||||
public void decayMe()
|
||||
{
|
||||
// Remove the WorldObject from the world
|
||||
_visible = false;
|
||||
_isSpawned = false;
|
||||
World.getInstance().removeVisibleObject(this, getPosition().getWorldRegion());
|
||||
World.getInstance().removeObject(this);
|
||||
getPosition().setWorldRegion(null);
|
||||
@ -170,7 +170,7 @@ public abstract class WorldObject
|
||||
|
||||
synchronized (this)
|
||||
{
|
||||
_visible = false;
|
||||
_isSpawned = false;
|
||||
getPosition().setWorldRegion(null);
|
||||
}
|
||||
|
||||
@ -218,7 +218,7 @@ public abstract class WorldObject
|
||||
synchronized (this)
|
||||
{
|
||||
// Set the x,y,z position of the WorldObject spawn and update its _worldregion
|
||||
_visible = true;
|
||||
_isSpawned = true;
|
||||
getPosition().setWorldRegion(World.getInstance().getRegion(getPosition().getWorldPosition()));
|
||||
|
||||
// Add the WorldObject spawn in the _allobjects of World
|
||||
@ -239,7 +239,7 @@ public abstract class WorldObject
|
||||
synchronized (this)
|
||||
{
|
||||
// Set the x,y,z position of the WorldObject spawn and update its _worldregion
|
||||
_visible = true;
|
||||
_isSpawned = true;
|
||||
|
||||
int spawnX = x;
|
||||
if (spawnX > World.MAP_MAX_X)
|
||||
@ -288,7 +288,7 @@ public abstract class WorldObject
|
||||
|
||||
public void toggleVisible()
|
||||
{
|
||||
if (isVisible())
|
||||
if (isSpawned())
|
||||
{
|
||||
decayMe();
|
||||
}
|
||||
@ -300,21 +300,15 @@ public abstract class WorldObject
|
||||
|
||||
public abstract boolean isAutoAttackable(Creature attacker);
|
||||
|
||||
/**
|
||||
* <b><u>Concept</u>:</b><br>
|
||||
* <br>
|
||||
* A WorldObject is visible if <b>__IsVisible</b>=true and <b>_worldregion</b>!=null
|
||||
* @return the visibility state of the WorldObject.
|
||||
*/
|
||||
public boolean isVisible()
|
||||
public boolean isSpawned()
|
||||
{
|
||||
return getPosition().getWorldRegion() != null;
|
||||
}
|
||||
|
||||
public void setVisible(boolean value)
|
||||
public void setSpawned(boolean value)
|
||||
{
|
||||
_visible = value;
|
||||
if (!_visible)
|
||||
_isSpawned = value;
|
||||
if (!_isSpawned)
|
||||
{
|
||||
getPosition().setWorldRegion(null);
|
||||
}
|
||||
@ -387,7 +381,7 @@ public abstract class WorldObject
|
||||
_instanceId = instanceId;
|
||||
|
||||
// If we change it for visible objects, me must clear & revalidates knownlists
|
||||
if (_visible && (_knownList != null))
|
||||
if (_isSpawned && (_knownList != null))
|
||||
{
|
||||
if (this instanceof PlayerInstance)
|
||||
{
|
||||
|
@ -1105,7 +1105,7 @@ public class Attackable extends NpcInstance
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ai._attacker.isAlikeDead() || !getKnownList().knowsObject(ai._attacker) || !ai._attacker.isVisible() || ((ai._attacker instanceof PlayerInstance) && !((PlayerInstance) ai._attacker).isOnline() && !((PlayerInstance) ai._attacker).isInOfflineMode()))
|
||||
if (ai._attacker.isAlikeDead() || !getKnownList().knowsObject(ai._attacker) || !ai._attacker.isSpawned() || ((ai._attacker instanceof PlayerInstance) && !((PlayerInstance) ai._attacker).isOnline() && !((PlayerInstance) ai._attacker).isInOfflineMode()))
|
||||
{
|
||||
ai._hate = 0;
|
||||
}
|
||||
@ -1156,7 +1156,7 @@ public class Attackable extends NpcInstance
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!ai._attacker.isVisible())
|
||||
if (!ai._attacker.isSpawned())
|
||||
{
|
||||
_aggroList.remove(target);
|
||||
return 0;
|
||||
|
@ -5193,7 +5193,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isVisible())
|
||||
if (!isSpawned())
|
||||
{
|
||||
_move = null;
|
||||
return true;
|
||||
@ -5409,7 +5409,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
public void setTarget(WorldObject worldObject)
|
||||
{
|
||||
WorldObject object = worldObject;
|
||||
if ((object != null) && !object.isVisible())
|
||||
if ((object != null) && !object.isSpawned())
|
||||
{
|
||||
object = null;
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ public abstract class Summon extends Playable
|
||||
{
|
||||
super.broadcastStatusUpdate();
|
||||
|
||||
if ((_owner != null) && isVisible())
|
||||
if ((_owner != null) && isSpawned())
|
||||
{
|
||||
_owner.sendPacket(new PetStatusUpdate(this));
|
||||
}
|
||||
@ -404,7 +404,7 @@ public abstract class Summon extends Playable
|
||||
|
||||
public synchronized void unSummon(PlayerInstance owner)
|
||||
{
|
||||
if (isVisible() && !isDead())
|
||||
if (isSpawned() && !isDead())
|
||||
{
|
||||
stopAllEffects();
|
||||
|
||||
|
@ -153,7 +153,7 @@ public class CabaleBufferInstance extends NpcInstance
|
||||
private boolean handleCast(PlayerInstance player, int skillId)
|
||||
{
|
||||
final int skillLevel = player.getLevel() > 40 ? 1 : 2;
|
||||
if (player.isDead() || !player.isVisible() || !isInsideRadius(player, getDistanceToWatchObject(player), false, false))
|
||||
if (player.isDead() || !player.isSpawned() || !isInsideRadius(player, getDistanceToWatchObject(player), false, false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ public class ChestInstance extends MonsterInstance
|
||||
skillLevel = 6;
|
||||
}
|
||||
|
||||
if (creature.isDead() || !creature.isVisible() || !creature.isInsideRadius(this, getDistanceToWatchObject(creature), false, false))
|
||||
if (creature.isDead() || !creature.isSpawned() || !creature.isInsideRadius(this, getDistanceToWatchObject(creature), false, false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -524,7 +524,7 @@ public class CubicInstance
|
||||
{
|
||||
targetIt = false;
|
||||
}
|
||||
if (!enemy.isVisible())
|
||||
if (!enemy.isSpawned())
|
||||
{
|
||||
targetIt = false;
|
||||
}
|
||||
|
@ -485,7 +485,7 @@ public class PetInstance extends Summon
|
||||
|
||||
synchronized (target)
|
||||
{
|
||||
if (!target.isVisible())
|
||||
if (!target.isSpawned())
|
||||
{
|
||||
getOwner().sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
|
@ -5192,7 +5192,7 @@ public class PlayerInstance extends Playable
|
||||
synchronized (target)
|
||||
{
|
||||
// Check if the target to pick up is visible
|
||||
if (!target.isVisible())
|
||||
if (!target.isSpawned())
|
||||
{
|
||||
// Send a Server->Client packet ActionFailed to this PlayerInstance
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
@ -5364,7 +5364,7 @@ public class PlayerInstance extends Playable
|
||||
{
|
||||
// Check if the new target is visible
|
||||
WorldObject newTarget = worldObject;
|
||||
if ((newTarget != null) && !newTarget.isVisible())
|
||||
if ((newTarget != null) && !newTarget.isSpawned())
|
||||
{
|
||||
newTarget = null;
|
||||
}
|
||||
@ -13039,7 +13039,7 @@ public class PlayerInstance extends Playable
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isVisible())
|
||||
if (!isSpawned())
|
||||
{
|
||||
_move = null;
|
||||
return true;
|
||||
@ -13829,7 +13829,7 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
|
||||
// Remove the PlayerInstance from the world
|
||||
if (isVisible())
|
||||
if (isSpawned())
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ public class ProtectorInstance extends NpcInstance
|
||||
// Cast for Player
|
||||
private boolean handleCast(PlayerInstance player, int skillId, int skillLevel)
|
||||
{
|
||||
if (player.isGM() || player.isDead() || !player.isVisible() || !isInsideRadius(player, Config.PROTECTOR_RADIUS_ACTION, false, false))
|
||||
if (player.isGM() || player.isDead() || !player.isSpawned() || !isInsideRadius(player, Config.PROTECTOR_RADIUS_ACTION, false, false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -96,7 +96,7 @@ public class ProtectorInstance extends NpcInstance
|
||||
// Cast for pet
|
||||
private boolean handleCastonPet(Summon player, int skillId, int skillLevel)
|
||||
{
|
||||
if (player.isDead() || !player.isVisible() || !isInsideRadius(player, Config.PROTECTOR_RADIUS_ACTION, false, false))
|
||||
if (player.isDead() || !player.isSpawned() || !isInsideRadius(player, Config.PROTECTOR_RADIUS_ACTION, false, false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ public class SepulcherMonsterInstance extends MonsterInstance
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_activeChar.isVisible())
|
||||
if (!_activeChar.isSpawned())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -392,7 +392,7 @@ public class SepulcherMonsterInstance extends MonsterInstance
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_activeChar.isVisible())
|
||||
if (!_activeChar.isSpawned())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public class FriendlyMobKnownList extends AttackableKnownList
|
||||
}
|
||||
}
|
||||
|
||||
if (getActiveChar().isVisible() && getKnownPlayers().isEmpty())
|
||||
if (getActiveChar().isSpawned() && getKnownPlayers().isEmpty())
|
||||
{
|
||||
getActiveChar().clearAggroList();
|
||||
if (getActiveChar().hasAI())
|
||||
|
@ -72,7 +72,7 @@ public class MonsterKnownList extends AttackableKnownList
|
||||
getActiveChar().getAI().notifyEvent(CtrlEvent.EVT_FORGET_OBJECT, object);
|
||||
}
|
||||
|
||||
if (getActiveChar().isVisible() && getKnownPlayers().isEmpty())
|
||||
if (getActiveChar().isSpawned() && getKnownPlayers().isEmpty())
|
||||
{
|
||||
// Clear the _aggroList of the MonsterInstance
|
||||
getActiveChar().clearAggroList();
|
||||
|
@ -51,7 +51,7 @@ public class WorldObjectKnownList
|
||||
// Check if already know object
|
||||
if (knowsObject(object))
|
||||
{
|
||||
if (!object.isVisible())
|
||||
if (!object.isSpawned())
|
||||
{
|
||||
removeKnownObject(object);
|
||||
}
|
||||
@ -168,7 +168,7 @@ public class WorldObjectKnownList
|
||||
|
||||
// Remove all invisible objects
|
||||
// Remove all too far objects
|
||||
if (!object.isVisible() || !Util.checkIfInRange(getDistanceToForgetObject(object), _activeObject, object, true))
|
||||
if (!object.isSpawned() || !Util.checkIfInRange(getDistanceToForgetObject(object), _activeObject, object, true))
|
||||
{
|
||||
if ((object instanceof BoatInstance) && (_activeObject instanceof PlayerInstance))
|
||||
{
|
||||
|
@ -1151,7 +1151,7 @@ public class ItemInstance extends WorldObject
|
||||
synchronized (this)
|
||||
{
|
||||
// Set the x,y,z position of the ItemInstance dropped and update its _worldregion
|
||||
setVisible(true);
|
||||
setSpawned(true);
|
||||
getPosition().setWorldPosition(x, y, z);
|
||||
getPosition().setWorldRegion(World.getInstance().getRegion(getPosition().getWorldPosition()));
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class RequestPrivateStoreManageBuy extends GameClientPacket
|
||||
}
|
||||
|
||||
// Fix for privatestore exploit during login
|
||||
if (!player.isVisible() || player.isLocked())
|
||||
if (!player.isSpawned() || player.isLocked())
|
||||
{
|
||||
Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " try exploit at login with privatestore!", Config.DEFAULT_PUNISH);
|
||||
LOGGER.warning("Player " + player.getName() + " try exploit at login with privatestore!");
|
||||
|
@ -45,7 +45,7 @@ public class RequestPrivateStoreManageSell extends GameClientPacket
|
||||
}
|
||||
|
||||
// Fix for privatestore exploit during login
|
||||
if (!player.isVisible() || player.isLocked())
|
||||
if (!player.isSpawned() || player.isLocked())
|
||||
{
|
||||
Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " try exploit at login with privatestore!", Config.DEFAULT_PUNISH);
|
||||
LOGGER.warning("Player " + player.getName() + " try exploit at login with privatestore!");
|
||||
|
@ -82,7 +82,7 @@ public class KnownListUpdateTaskManager
|
||||
{
|
||||
for (WorldObject object : region.getVisibleObjects()) // and for all members in region
|
||||
{
|
||||
if (!object.isVisible())
|
||||
if (!object.isSpawned())
|
||||
{
|
||||
continue; // skip dying objects
|
||||
}
|
||||
|
@ -635,7 +635,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
||||
@Override
|
||||
public void onEvtThink()
|
||||
{
|
||||
// if(getIntention() != AI_INTENTION_IDLE && (!_actor.isVisible() || !_actor.hasAI() || !_actor.isKnownPlayers()))
|
||||
// if(getIntention() != AI_INTENTION_IDLE && (!_actor.isSpawned() || !_actor.hasAI() || !_actor.isKnownPlayers()))
|
||||
// setIntention(AI_INTENTION_IDLE);
|
||||
|
||||
// Check if the actor can't use skills and if a thinking action isn't already in progress
|
||||
|
@ -636,7 +636,7 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
|
||||
@Override
|
||||
public void onEvtThink()
|
||||
{
|
||||
// if(getIntention() != AI_INTENTION_IDLE && (!_actor.isVisible() || !_actor.hasAI() || !_actor.isKnownPlayers()))
|
||||
// if(getIntention() != AI_INTENTION_IDLE && (!_actor.isSpawned() || !_actor.hasAI() || !_actor.isKnownPlayers()))
|
||||
// setIntention(AI_INTENTION_IDLE);
|
||||
|
||||
// Check if the thinking action is already in progress
|
||||
|
@ -635,7 +635,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
||||
@Override
|
||||
public void onEvtThink()
|
||||
{
|
||||
// if(getIntention() != AI_INTENTION_IDLE && (!_actor.isVisible() || !_actor.hasAI() || !_actor.isKnownPlayers()))
|
||||
// if(getIntention() != AI_INTENTION_IDLE && (!_actor.isSpawned() || !_actor.hasAI() || !_actor.isKnownPlayers()))
|
||||
// setIntention(AI_INTENTION_IDLE);
|
||||
|
||||
// Check if the actor can't use skills and if a thinking action isn't already in progress
|
||||
|
@ -636,7 +636,7 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
|
||||
@Override
|
||||
public void onEvtThink()
|
||||
{
|
||||
// if(getIntention() != AI_INTENTION_IDLE && (!_actor.isVisible() || !_actor.hasAI() || !_actor.isKnownPlayers()))
|
||||
// if(getIntention() != AI_INTENTION_IDLE && (!_actor.isSpawned() || !_actor.hasAI() || !_actor.isKnownPlayers()))
|
||||
// setIntention(AI_INTENTION_IDLE);
|
||||
|
||||
// Check if the thinking action is already in progress
|
||||
|
Loading…
Reference in New Issue
Block a user