L2Object rework.

This commit is contained in:
MobiusDev
2018-09-08 04:13:34 +00:00
parent e5c0665db3
commit 2bb8220df2
250 changed files with 1750 additions and 5952 deletions

View File

@@ -2138,9 +2138,7 @@ public class SevenSignsFestival implements SpawnListener
{
final L2Spawn npcSpawn = new L2Spawn(_witchSpawn._npcId);
npcSpawn.setX(_witchSpawn._x);
npcSpawn.setY(_witchSpawn._y);
npcSpawn.setZ(_witchSpawn._z);
npcSpawn.setXYZ(_witchSpawn._x, _witchSpawn._y, _witchSpawn._z);
npcSpawn.setHeading(_witchSpawn._heading);
npcSpawn.setAmount(1);
npcSpawn.setRespawnDelay(1);
@@ -2268,9 +2266,7 @@ public class SevenSignsFestival implements SpawnListener
{
final L2Spawn npcSpawn = new L2Spawn(currSpawn._npcId);
npcSpawn.setX(currSpawn._x);
npcSpawn.setY(currSpawn._y);
npcSpawn.setZ(currSpawn._z);
npcSpawn.setXYZ(currSpawn._x, currSpawn._y, currSpawn._z);
npcSpawn.setHeading(Rnd.nextInt(65536));
npcSpawn.setAmount(1);
npcSpawn.setRespawnDelay(respawnDelay);

View File

@@ -263,9 +263,7 @@ public final class SpawnTable implements IGameXmlReader
{
spawnDat = new L2Spawn(spawnInfo.getInt("npcTemplateid"));
spawnDat.setAmount(spawnInfo.getInt("count", 1));
spawnDat.setX(spawnInfo.getInt("x", 0));
spawnDat.setY(spawnInfo.getInt("y", 0));
spawnDat.setZ(spawnInfo.getInt("z", 0));
spawnDat.setXYZ(spawnInfo.getInt("x", 0), spawnInfo.getInt("y", 0), spawnInfo.getInt("z", 0));
spawnDat.setHeading(spawnInfo.getInt("heading", -1));
spawnDat.setRespawnDelay(spawnInfo.getInt("respawnDelay", 0), spawnInfo.getInt("respawnRandom", 0));
spawnDat.setLocationId(spawnInfo.getInt("locId", 0));

View File

@@ -188,9 +188,7 @@ public final class DimensionalRiftManager
{
final L2Spawn spawnDat = new L2Spawn(mobId);
spawnDat.setAmount(1);
spawnDat.setX(x);
spawnDat.setY(y);
spawnDat.setZ(z);
spawnDat.setXYZ(x, y, z);
spawnDat.setHeading(-1);
spawnDat.setRespawnDelay(delay);
SpawnTable.getInstance().addNewSpawn(spawnDat, false);

View File

@@ -116,9 +116,7 @@ public final class FortSiegeGuardManager
{
final L2Spawn spawn = new L2Spawn(rs.getInt("npcId"));
spawn.setAmount(1);
spawn.setX(rs.getInt("x"));
spawn.setY(rs.getInt("y"));
spawn.setZ(rs.getInt("z"));
spawn.setXYZ(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
spawn.setHeading(rs.getInt("heading"));
spawn.setRespawnDelay(rs.getInt("respawnDelay"));
spawn.setLocationId(0);

View File

@@ -281,33 +281,25 @@ public final class FourSepulchersManager
{
case 31921: // conquerors
{
spawnDat.setX(181061);
spawnDat.setY(-85595);
spawnDat.setZ(-7200);
spawnDat.setXYZ(181061, -85595, -7200);
spawnDat.setHeading(-32584);
break;
}
case 31922: // emperors
{
spawnDat.setX(179292);
spawnDat.setY(-88981);
spawnDat.setZ(-7200);
spawnDat.setXYZ(179292, -88981, -7200);
spawnDat.setHeading(-33272);
break;
}
case 31923: // sages
{
spawnDat.setX(173202);
spawnDat.setY(-87004);
spawnDat.setZ(-7200);
spawnDat.setXYZ(173202, -87004, -7200);
spawnDat.setHeading(-16248);
break;
}
case 31924: // judges
{
spawnDat.setX(175606);
spawnDat.setY(-82853);
spawnDat.setZ(-7200);
spawnDat.setXYZ(175606, -82853, -7200);
spawnDat.setHeading(-16248);
break;
}
@@ -422,9 +414,7 @@ public final class FourSepulchersManager
{
final L2Spawn spawnDat = new L2Spawn(rs.getInt("npc_templateid"));
spawnDat.setAmount(rs.getInt("count"));
spawnDat.setX(rs.getInt("locx"));
spawnDat.setY(rs.getInt("locy"));
spawnDat.setZ(rs.getInt("locz"));
spawnDat.setXYZ(rs.getInt("locx"), rs.getInt("locy"), rs.getInt("locz"));
spawnDat.setHeading(rs.getInt("heading"));
spawnDat.setRespawnDelay(rs.getInt("respawn_delay"));
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
@@ -449,9 +439,7 @@ public final class FourSepulchersManager
{
final L2Spawn spawnDat = new L2Spawn(keyNpc.getValue());
spawnDat.setAmount(1);
spawnDat.setX(0);
spawnDat.setY(0);
spawnDat.setZ(0);
spawnDat.setXYZ(0, 0, 0);
spawnDat.setHeading(0);
spawnDat.setRespawnDelay(3600);
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
@@ -489,9 +477,7 @@ public final class FourSepulchersManager
{
final L2Spawn spawnDat = new L2Spawn(rs2.getInt("npc_templateid"));
spawnDat.setAmount(rs2.getInt("count"));
spawnDat.setX(rs2.getInt("locx"));
spawnDat.setY(rs2.getInt("locy"));
spawnDat.setZ(rs2.getInt("locz"));
spawnDat.setXYZ(rs2.getInt("locx"), rs2.getInt("locy"), rs2.getInt("locz"));
spawnDat.setHeading(rs2.getInt("heading"));
spawnDat.setRespawnDelay(rs2.getInt("respawn_delay"));
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
@@ -537,9 +523,7 @@ public final class FourSepulchersManager
{
final L2Spawn spawnDat = new L2Spawn(rset2.getInt("npc_templateid"));
spawnDat.setAmount(rset2.getInt("count"));
spawnDat.setX(rset2.getInt("locx"));
spawnDat.setY(rset2.getInt("locy"));
spawnDat.setZ(rset2.getInt("locz"));
spawnDat.setXYZ(rset2.getInt("locx"), rset2.getInt("locy"), rset2.getInt("locz"));
spawnDat.setHeading(rset2.getInt("heading"));
spawnDat.setRespawnDelay(rset2.getInt("respawn_delay"));
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
@@ -588,9 +572,7 @@ public final class FourSepulchersManager
{
final L2Spawn spawnDat = new L2Spawn(rset2.getInt("npc_templateid"));
spawnDat.setAmount(rset2.getInt("count"));
spawnDat.setX(rset2.getInt("locx"));
spawnDat.setY(rset2.getInt("locy"));
spawnDat.setZ(rset2.getInt("locz"));
spawnDat.setXYZ(rset2.getInt("locx"), rset2.getInt("locy"), rset2.getInt("locz"));
spawnDat.setHeading(rset2.getInt("heading"));
spawnDat.setRespawnDelay(rset2.getInt("respawn_delay"));
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
@@ -637,9 +619,7 @@ public final class FourSepulchersManager
{
final L2Spawn spawnDat = new L2Spawn(rs2.getInt("npc_templateid"));
spawnDat.setAmount(rs2.getInt("count"));
spawnDat.setX(rs2.getInt("locx"));
spawnDat.setY(rs2.getInt("locy"));
spawnDat.setZ(rs2.getInt("locz"));
spawnDat.setXYZ(rs2.getInt("locx"), rs2.getInt("locy"), rs2.getInt("locz"));
spawnDat.setHeading(rs2.getInt("heading"));
spawnDat.setRespawnDelay(rs2.getInt("respawn_delay"));
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
@@ -678,9 +658,7 @@ public final class FourSepulchersManager
{
final L2Spawn spawnDat = new L2Spawn(_shadowSpawnLoc[locNo][i][0]);
spawnDat.setAmount(1);
spawnDat.setX(_shadowSpawnLoc[locNo][i][1]);
spawnDat.setY(_shadowSpawnLoc[locNo][i][2]);
spawnDat.setZ(_shadowSpawnLoc[locNo][i][3]);
spawnDat.setXYZ(_shadowSpawnLoc[locNo][i][1], _shadowSpawnLoc[locNo][i][2], _shadowSpawnLoc[locNo][i][3]);
spawnDat.setHeading(_shadowSpawnLoc[locNo][i][4]);
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
_shadowSpawns.put(gateKeeper[i], spawnDat);
@@ -700,9 +678,7 @@ public final class FourSepulchersManager
{
final L2Spawn spawnDat = new L2Spawn(_victim.get(keyNpcId));
spawnDat.setAmount(1);
spawnDat.setX(0);
spawnDat.setY(0);
spawnDat.setZ(0);
spawnDat.setXYZ(0, 0, 0);
spawnDat.setHeading(0);
spawnDat.setRespawnDelay(3600);
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
@@ -1131,7 +1107,7 @@ public final class FourSepulchersManager
{
final L2Spawn keyBoxMobSpawn = new L2Spawn(18149);
keyBoxMobSpawn.setAmount(1);
keyBoxMobSpawn.setLocation(spawnDat.getLocation());
keyBoxMobSpawn.setLocation(spawnDat);
keyBoxMobSpawn.setRespawnDelay(3600);
SpawnTable.getInstance().addNewSpawn(keyBoxMobSpawn, false);
mob = (L2SepulcherMonsterInstance) keyBoxMobSpawn.doSpawn();
@@ -1241,9 +1217,7 @@ public final class FourSepulchersManager
if (spawnDat != null)
{
spawnDat.setAmount(1);
spawnDat.setX(activeChar.getX());
spawnDat.setY(activeChar.getY());
spawnDat.setZ(activeChar.getZ());
spawnDat.setXYZ(activeChar);
spawnDat.setHeading(activeChar.getHeading());
spawnDat.setRespawnDelay(3600);
_allMobs.add(spawnDat.doSpawn());
@@ -1262,9 +1236,7 @@ public final class FourSepulchersManager
if (spawnDat != null)
{
spawnDat.setAmount(1);
spawnDat.setX(activeChar.getX());
spawnDat.setY(activeChar.getY());
spawnDat.setZ(activeChar.getZ());
spawnDat.setXYZ(activeChar);
spawnDat.setHeading(activeChar.getHeading());
spawnDat.setRespawnDelay(3600);
_allMobs.add(spawnDat.doSpawn());
@@ -1332,9 +1304,7 @@ public final class FourSepulchersManager
{
final int keyNpcId = gateKeeper[i];
final L2Spawn spawnDat = _shadowSpawns.get(keyNpcId);
spawnDat.setX(_shadowSpawnLoc[locNo][i][1]);
spawnDat.setY(_shadowSpawnLoc[locNo][i][2]);
spawnDat.setZ(_shadowSpawnLoc[locNo][i][3]);
spawnDat.setXYZ(_shadowSpawnLoc[locNo][i][1], _shadowSpawnLoc[locNo][i][2], _shadowSpawnLoc[locNo][i][3]);
spawnDat.setHeading(_shadowSpawnLoc[locNo][i][4]);
_shadowSpawns.put(keyNpcId, spawnDat);
}

View File

@@ -82,9 +82,7 @@ public class RaidBossSpawnManager
while (rs.next())
{
final L2Spawn spawnDat = new L2Spawn(rs.getInt("boss_id"));
spawnDat.setX(rs.getInt("loc_x"));
spawnDat.setY(rs.getInt("loc_y"));
spawnDat.setZ(rs.getInt("loc_z"));
spawnDat.setXYZ(rs.getInt("loc_x"), rs.getInt("loc_y"), rs.getInt("loc_z"));
spawnDat.setAmount(rs.getInt("amount"));
spawnDat.setHeading(rs.getInt("heading"));
spawnDat.setRespawnDelay(rs.getInt("respawn_delay"), rs.getInt("respawn_random"));

View File

@@ -202,9 +202,7 @@ public final class SiegeGuardManager
{
final L2Spawn spawn = new L2Spawn(rs.getInt("npcId"));
spawn.setAmount(1);
spawn.setX(rs.getInt("x"));
spawn.setY(rs.getInt("y"));
spawn.setZ(rs.getInt("z"));
spawn.setXYZ(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
spawn.setHeading(rs.getInt("heading"));
spawn.setRespawnDelay(rs.getInt("respawnDelay"));
spawn.setLocationId(0);

View File

@@ -734,9 +734,7 @@ public final class TerritoryWarManager implements Siegable
{
final L2Spawn spawnDat = new L2Spawn(npcId);
spawnDat.setAmount(1);
spawnDat.setX(loc.getX());
spawnDat.setY(loc.getY());
spawnDat.setZ(loc.getZ());
spawnDat.setXYZ(loc);
spawnDat.setHeading(loc.getHeading());
spawnDat.stopRespawn();
return spawnDat.doSpawn(false);

View File

@@ -450,9 +450,7 @@ public class AutoSpawnHandler
final int heading = locationList[locationIndex].getHeading();
final L2Spawn newSpawn = new L2Spawn(spawnInst.getId());
newSpawn.setX(x);
newSpawn.setY(y);
newSpawn.setZ(z);
newSpawn.setXYZ(x, y, z);
if (heading != -1)
{
newSpawn.setHeading(heading);

View File

@@ -18,7 +18,6 @@ package com.l2jmobius.gameserver.model;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.enums.ShotType;
@@ -31,7 +30,6 @@ import com.l2jmobius.gameserver.instancemanager.InstanceManager;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.poly.ObjectPoly;
import com.l2jmobius.gameserver.model.events.ListenersContainer;
import com.l2jmobius.gameserver.model.instancezone.Instance;
import com.l2jmobius.gameserver.model.interfaces.IDecayable;
@@ -61,18 +59,18 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
/** World Region */
private L2WorldRegion _worldRegion;
/** Instance type */
private InstanceType _instanceType = null;
private InstanceType _instanceType;
private volatile Map<String, Object> _scripts;
/** X coordinate */
private final AtomicInteger _x = new AtomicInteger(0);
private volatile int _x = 0;
/** Y coordinate */
private final AtomicInteger _y = new AtomicInteger(0);
private volatile int _y = 0;
/** Z coordinate */
private final AtomicInteger _z = new AtomicInteger(0);
private volatile int _z = 0;
/** Orientation */
private final AtomicInteger _heading = new AtomicInteger(0);
private volatile int _heading = 0;
/** Instance id of object. 0 - Global */
private final AtomicInteger _instanceId = new AtomicInteger(0);
private volatile int _instanceId = 0;
private boolean _isSpawned;
private boolean _isInvisible;
@@ -255,12 +253,6 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
return _objectId;
}
public final ObjectPoly getPoly()
{
final ObjectPoly poly = getScript(ObjectPoly.class);
return (poly == null) ? addScript(new ObjectPoly(this)) : poly;
}
public abstract void sendInfo(L2PcInstance activeChar);
public void sendPacket(IClientOutgoingPacket... packets)
@@ -559,7 +551,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public int getX()
{
return _x.get();
return _x;
}
/**
@@ -569,7 +561,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public int getY()
{
return _y.get();
return _y;
}
/**
@@ -579,7 +571,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public int getZ()
{
return _z.get();
return _z;
}
/**
@@ -589,7 +581,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public int getHeading()
{
return _heading.get();
return _heading;
}
/**
@@ -599,7 +591,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public int getInstanceId()
{
return _instanceId.get();
return _instanceId;
}
/**
@@ -609,37 +601,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public Location getLocation()
{
return new Location(_x.get(), _y.get(), _z.get(), _heading.get(), _instanceId.get());
}
/**
* Sets the X coordinate
* @param newX the X coordinate
*/
@Override
public void setX(int newX)
{
_x.set(newX);
}
/**
* Sets the Y coordinate
* @param newY the Y coordinate
*/
@Override
public void setY(int newY)
{
_y.set(newY);
}
/**
* Sets the Z coordinate
* @param newZ the Z coordinate
*/
@Override
public void setZ(int newZ)
{
_z.set(newZ);
return new Location(_x, _y, _z, _heading, _instanceId);
}
/**
@@ -651,9 +613,9 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public void setXYZ(int newX, int newY, int newZ)
{
setX(newX);
setY(newY);
setZ(newZ);
_x = newX;
_y = newY;
_z = newZ;
if (_isSpawned)
{
@@ -688,7 +650,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public void setHeading(int newHeading)
{
_heading.set(newHeading);
_heading = newHeading;
}
/**
@@ -699,7 +661,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public void setInstanceId(int instanceId)
{
if ((instanceId < 0) || (_instanceId.get() == instanceId))
if ((instanceId < 0) || (_instanceId == instanceId))
{
return;
}
@@ -714,7 +676,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
if (isPlayer())
{
final L2PcInstance player = getActingPlayer();
if ((_instanceId.get() > 0) && (oldI != null))
if ((_instanceId > 0) && (oldI != null))
{
oldI.removePlayer(_objectId);
if (oldI.isShowTimer())
@@ -738,7 +700,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
else if (isNpc())
{
final L2Npc npc = (L2Npc) this;
if ((_instanceId.get() > 0) && (oldI != null))
if ((_instanceId > 0) && (oldI != null))
{
oldI.removeNpc(npc);
}
@@ -748,7 +710,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
}
}
_instanceId.set(instanceId);
_instanceId = instanceId;
}
/**
@@ -777,11 +739,11 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public void setLocation(Location loc)
{
_x.set(loc.getX());
_y.set(loc.getY());
_z.set(loc.getZ());
_heading.set(loc.getHeading());
_instanceId.set(loc.getInstanceId());
_x = loc.getX();
_y = loc.getY();
_z = loc.getZ();
_heading = loc.getHeading();
_instanceId = loc.getInstanceId();
}
/**
@@ -793,7 +755,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
*/
public double calculateDistance2D(int x, int y, int z)
{
return Math.sqrt(Math.pow(x - _x.get(), 2) + Math.pow(y - _y.get(), 2));
return Math.sqrt(Math.pow(x - _x, 2) + Math.pow(y - _y, 2));
}
/**
@@ -815,7 +777,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
*/
public double calculateDistance3D(int x, int y, int z)
{
return Math.sqrt(Math.pow(x - _x.get(), 2) + Math.pow(y - _y.get(), 2) + Math.pow(z - _z.get(), 2));
return Math.sqrt(Math.pow(x - _x, 2) + Math.pow(y - _y, 2) + Math.pow(z - _z, 2));
}
/**
@@ -837,7 +799,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
*/
public double calculateDistanceSq2D(int x, int y, int z)
{
return Math.pow(x - _x.get(), 2) + Math.pow(y - _y.get(), 2);
return Math.pow(x - _x, 2) + Math.pow(y - _y, 2);
}
/**
@@ -859,7 +821,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
*/
public double calculateDistanceSq3D(int x, int y, int z)
{
return Math.pow(x - _x.get(), 2) + Math.pow(y - _y.get(), 2) + Math.pow(z - _z.get(), 2);
return Math.pow(x - _x, 2) + Math.pow(y - _y, 2) + Math.pow(z - _z, 2);
}
/**
@@ -881,7 +843,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
*/
public double calculateDirectionTo(ILocational target)
{
int heading = Util.calculateHeadingFrom(this, target) - _heading.get();
int heading = Util.calculateHeadingFrom(this, target) - _heading;
if (heading < 0)
{
heading = 65535 + heading;

View File

@@ -35,9 +35,7 @@ import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jmobius.gameserver.model.interfaces.IIdentifiable;
import com.l2jmobius.gameserver.model.interfaces.ILocational;
import com.l2jmobius.gameserver.model.interfaces.INamable;
import com.l2jmobius.gameserver.model.interfaces.IPositionable;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.model.zone.type.NpcSpawnTerritory;
@@ -48,7 +46,7 @@ import com.l2jmobius.gameserver.model.zone.type.NpcSpawnTerritory;
* The heading of the L2NpcInstance can be a random heading if not defined (value= -1) or an exact heading (ex : merchant...).
* @author Nightmare
*/
public class L2Spawn implements IPositionable, IIdentifiable, INamable
public class L2Spawn extends Location implements IIdentifiable, INamable
{
protected static final Logger LOGGER = Logger.getLogger(L2Spawn.class.getName());
@@ -64,8 +62,6 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
protected int _scheduledCount;
/** The identifier of the location area where L2NpcInstance can be spawned */
private int _locationId;
/** The Location of this NPC spawn. */
private Location _location = new Location(0, 0, 0, 0, 0);
/** Link to NPC spawn territory */
private NpcSpawnTerritory _spawnTerritory = null;
/** Minimum respawn delay */
@@ -126,6 +122,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
*/
public L2Spawn(L2NpcTemplate template) throws SecurityException, ClassNotFoundException, NoSuchMethodException, ClassCastException
{
super(0, 0, 0);
// Set the _template of the L2Spawn
_template = template;
@@ -184,122 +181,6 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
return _locationId;
}
@Override
public Location getLocation()
{
return _location;
}
/**
* @return the X position of the spawn point.
*/
@Override
public int getX()
{
return _location.getX();
}
/**
* Set the X position of the spawn point.
* @param x the x coordinate
*/
@Override
public void setX(int x)
{
_location.setX(x);
}
/**
* @return the Y position of the spawn point.
*/
@Override
public int getY()
{
return _location.getY();
}
/**
* Set the Y position of the spawn point.
* @param y the y coordinate
*/
@Override
public void setY(int y)
{
_location.setY(y);
}
/**
* @return the Z position of the spawn point.
*/
@Override
public int getZ()
{
return _location.getZ();
}
/**
* Set the Z position of the spawn point.
* @param z the z coordinate
*/
@Override
public void setZ(int z)
{
_location.setZ(z);
}
/**
* Set the x, y, z position of the spawn point.
* @param x The x coordinate.
* @param y The y coordinate.
* @param z The z coordinate.
*/
@Override
public void setXYZ(int x, int y, int z)
{
setX(x);
setY(y);
setZ(z);
}
/**
* Set the x, y, z position of the spawn point.
* @param loc The location.
*/
@Override
public void setXYZ(ILocational loc)
{
setXYZ(loc.getX(), loc.getY(), loc.getZ());
}
/**
* @return the heading of L2NpcInstance when they are spawned.
*/
@Override
public int getHeading()
{
return _location.getHeading();
}
/**
* Set the heading of L2NpcInstance when they are spawned.
* @param heading
*/
@Override
public void setHeading(int heading)
{
_location.setHeading(heading);
}
/**
* Set the XYZ position of the spawn point.
* @param loc
*/
@Override
public void setLocation(Location loc)
{
_location = loc;
}
/**
* Gets the NPC ID.
* @return the NPC ID
@@ -473,7 +354,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
// Call the constructor of the L2Npc
final L2Npc npc = _constructor.newInstance(_template);
npc.setInstanceId(_location.getInstanceId()); // Must be done before object is spawned into visible world
npc.setInstanceId(getInstanceId()); // Must be done before object is spawned into visible world
if (isSummonSpawn)
{
npc.setShowSummonAnimation(isSummonSpawn);
@@ -506,8 +387,9 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
newlocx = loc.getX();
newlocy = loc.getY();
newlocz = loc.getZ();
setLocation(loc);
}
else if ((_location.getX() == 0) && (_location.getY() == 0))
else if ((getX() == 0) && (getY() == 0))
{
LOGGER.warning("NPC " + npc + " doesn't have spawn location!");
return null;
@@ -515,9 +397,9 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
else
{
// The L2NpcInstance is spawned at the exact position (Lox, Locy, Locz)
newlocx = _location.getX();
newlocy = _location.getY();
newlocz = _location.getZ();
newlocx = getX();
newlocy = getY();
newlocz = getZ();
}
// If random spawn system is enabled
@@ -549,13 +431,13 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
npc.setRandomWalking(_randomWalk);
// Set the heading of the L2NpcInstance (random heading if not defined)
if (_location.getHeading() == -1)
if (getHeading() == -1)
{
npc.setHeading(Rnd.nextInt(61794));
}
else
{
npc.setHeading(_location.getHeading());
npc.setHeading(getHeading());
}
if (npc.isAttackable())
@@ -566,7 +448,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
if (Config.CHAMPION_ENABLE)
{
// Set champion on next spawn
if (npc.isMonster() && !npc.isQuestMonster() && !_template.isUndying() && !npc.isRaid() && !npc.isRaidMinion() && (Config.CHAMPION_FREQUENCY > 0) && (npc.getLevel() >= Config.CHAMP_MIN_LVL) && (npc.getLevel() <= Config.CHAMP_MAX_LVL) && (Config.CHAMPION_ENABLE_IN_INSTANCES || (_location.getInstanceId() == 0)))
if (npc.isMonster() && !npc.isQuestMonster() && !_template.isUndying() && !npc.isRaid() && !npc.isRaidMinion() && (Config.CHAMPION_FREQUENCY > 0) && (npc.getLevel() >= Config.CHAMP_MIN_LVL) && (npc.getLevel() <= Config.CHAMP_MAX_LVL) && (Config.CHAMPION_ENABLE_IN_INSTANCES || (getInstanceId() == 0)))
{
if (Rnd.get(100) < Config.CHAMPION_FREQUENCY)
{
@@ -679,7 +561,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
public boolean isTerritoryBased()
{
return (_spawnTerritory != null) && (_location.getX() == 0) && (_location.getY() == 0);
return (_spawnTerritory != null) && (getX() == 0) && (getY() == 0);
}
public L2Npc getLastSpawn()
@@ -697,18 +579,6 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
return _template;
}
@Override
public int getInstanceId()
{
return _location.getInstanceId();
}
@Override
public void setInstanceId(int instanceId)
{
_location.setInstanceId(instanceId);
}
public final boolean getRandomWalking()
{
return _randomWalk;
@@ -732,6 +602,6 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
@Override
public String toString()
{
return "L2Spawn ID: " + _template.getId() + " " + _location;
return "L2Spawn ID: " + _template.getId() + " X: " + getX() + " Y: " + getY() + " Z: " + getZ() + " Heading: " + getHeading();
}
}

View File

@@ -34,12 +34,12 @@ public class Location implements IPositionable
public Location(int x, int y, int z)
{
this(x, y, z, 0, -1);
this(x, y, z, 0, 0);
}
public Location(int x, int y, int z, int heading)
{
this(x, y, z, heading, -1);
this(x, y, z, heading, 0);
}
public Location(L2Object obj)
@@ -66,16 +66,6 @@ public class Location implements IPositionable
return _x;
}
/**
* Set the x coordinate.
* @param x the x coordinate
*/
@Override
public void setX(int x)
{
_x = x;
}
/**
* Get the y coordinate.
* @return the y coordinate
@@ -86,16 +76,6 @@ public class Location implements IPositionable
return _y;
}
/**
* Set the y coordinate.
* @param y the x coordinate
*/
@Override
public void setY(int y)
{
_y = y;
}
/**
* Get the z coordinate.
* @return the z coordinate
@@ -106,16 +86,6 @@ public class Location implements IPositionable
return _z;
}
/**
* Set the z coordinate.
* @param z the z coordinate
*/
@Override
public void setZ(int z)
{
_z = z;
}
/**
* Set the x, y, z coordinates.
* @param x the x coordinate
@@ -125,9 +95,9 @@ public class Location implements IPositionable
@Override
public void setXYZ(int x, int y, int z)
{
setX(x);
setY(y);
setZ(z);
_x = x;
_y = y;
_z = z;
}
/**

View File

@@ -151,9 +151,7 @@ public final class MobGroup
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
spawn.setX(x + (signX * randX));
spawn.setY(y + (signY * randY));
spawn.setZ(z);
spawn.setXYZ(x + (signX * randX), y + (signY * randY), z);
spawn.stopRespawn();
SpawnTable.getInstance().addNewSpawn(spawn, false);

View File

@@ -1,67 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.actor.poly;
import com.l2jmobius.gameserver.model.L2Object;
public class ObjectPoly
{
private final L2Object _activeObject;
private int _polyId;
private String _polyType;
public ObjectPoly(L2Object activeObject)
{
_activeObject = activeObject;
}
public void setPolyInfo(String polyType, String polyId)
{
setPolyId(Integer.parseInt(polyId));
setPolyType(polyType);
}
public final L2Object getActiveObject()
{
return _activeObject;
}
public final boolean isMorphed()
{
return _polyType != null;
}
public final int getPolyId()
{
return _polyId;
}
public final void setPolyId(int value)
{
_polyId = value;
}
public final String getPolyType()
{
return _polyType;
}
public final void setPolyType(String value)
{
_polyType = value;
}
}

View File

@@ -478,9 +478,7 @@ public final class BlockCheckerEngine
for (int i = 0; i < _numOfBoxes; i++)
{
final L2Spawn spawn = new L2Spawn(18672);
spawn.setX(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400));
spawn.setY(_arenaCoordinates[_arena][5] + Rnd.get(-400, 400));
spawn.setZ(_zCoord);
spawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), _zCoord);
spawn.setAmount(1);
spawn.setHeading(1);
spawn.setRespawnDelay(1);
@@ -506,9 +504,7 @@ public final class BlockCheckerEngine
try
{
final L2Spawn girlSpawn = new L2Spawn(18676);
girlSpawn.setX(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400));
girlSpawn.setY(_arenaCoordinates[_arena][5] + Rnd.get(-400, 400));
girlSpawn.setZ(_zCoord);
girlSpawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), _zCoord);
girlSpawn.setAmount(1);
girlSpawn.setHeading(1);
girlSpawn.setRespawnDelay(1);

View File

@@ -1130,9 +1130,7 @@ public final class Fort extends AbstractResidence
{
final L2Spawn spawnDat = new L2Spawn(rs.getInt("npcId"));
spawnDat.setAmount(1);
spawnDat.setX(rs.getInt("x"));
spawnDat.setY(rs.getInt("y"));
spawnDat.setZ(rs.getInt("z"));
spawnDat.setXYZ(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
spawnDat.setHeading(rs.getInt("heading"));
spawnDat.setRespawnDelay(60);
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
@@ -1161,9 +1159,7 @@ public final class Fort extends AbstractResidence
{
final L2Spawn spawnDat = new L2Spawn(rs.getInt("npcId"));
spawnDat.setAmount(1);
spawnDat.setX(rs.getInt("x"));
spawnDat.setY(rs.getInt("y"));
spawnDat.setZ(rs.getInt("z"));
spawnDat.setXYZ(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
spawnDat.setHeading(rs.getInt("heading"));
spawnDat.setRespawnDelay(60);
_siegeNpcs.add(spawnDat);
@@ -1190,9 +1186,7 @@ public final class Fort extends AbstractResidence
{
final L2Spawn spawnDat = new L2Spawn(rs.getInt("npcId"));
spawnDat.setAmount(1);
spawnDat.setX(rs.getInt("x"));
spawnDat.setY(rs.getInt("y"));
spawnDat.setZ(rs.getInt("z"));
spawnDat.setXYZ(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
spawnDat.setHeading(rs.getInt("heading"));
spawnDat.setRespawnDelay(60);
_npcCommanders.add(spawnDat);
@@ -1223,9 +1217,7 @@ public final class Fort extends AbstractResidence
final int castleId = rs.getInt("castleId");
final L2Spawn spawnDat = new L2Spawn(rs.getInt("npcId"));
spawnDat.setAmount(1);
spawnDat.setX(rs.getInt("x"));
spawnDat.setY(rs.getInt("y"));
spawnDat.setZ(rs.getInt("z"));
spawnDat.setXYZ(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
spawnDat.setHeading(rs.getInt("heading"));
spawnDat.setRespawnDelay(60);
_specialEnvoys.add(spawnDat);

View File

@@ -1101,9 +1101,7 @@ public class FortSiege implements Siegable
{
final L2Spawn spawnDat = new L2Spawn(_sp.getId());
spawnDat.setAmount(1);
spawnDat.setX(_sp.getLocation().getX());
spawnDat.setY(_sp.getLocation().getY());
spawnDat.setZ(_sp.getLocation().getZ());
spawnDat.setXYZ(_sp.getLocation());
spawnDat.setHeading(_sp.getLocation().getHeading());
spawnDat.setRespawnDelay(60);
spawnDat.doSpawn();

View File

@@ -156,9 +156,7 @@ public class L2Event
try
{
final L2Spawn spawn = new L2Spawn(_npcId);
spawn.setX(target.getX() + 50);
spawn.setY(target.getY() + 50);
spawn.setZ(target.getZ());
spawn.setXYZ(target.getX() + 50, target.getY() + 50, target.getZ());
spawn.setAmount(1);
spawn.setHeading(target.getHeading());
spawn.stopRespawn();
@@ -275,7 +273,6 @@ public class L2Event
player.setCurrentCp(player.getMaxCp());
}
player.getPoly().setPolyInfo(null, "1");
player.decayMe();
player.spawnMe(player.getX(), player.getY(), player.getZ());
player.broadcastUserInfo();

View File

@@ -122,9 +122,7 @@ public class TvTEvent
{
_npcSpawn = new L2Spawn(Config.TVT_EVENT_PARTICIPATION_NPC_ID);
_npcSpawn.setX(Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES[0]);
_npcSpawn.setY(Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES[1]);
_npcSpawn.setZ(Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES[2]);
_npcSpawn.setXYZ(Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES[0], Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES[1], Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES[2]);
_npcSpawn.setAmount(1);
_npcSpawn.setHeading(Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES[3]);
_npcSpawn.setRespawnDelay(1);

View File

@@ -156,9 +156,7 @@ public abstract class ClanHallSiegeEngine extends Quest implements Siegable
while (rset.next())
{
final L2Spawn spawn = new L2Spawn(rset.getInt("npcId"));
spawn.setX(rset.getInt("x"));
spawn.setY(rset.getInt("y"));
spawn.setZ(rset.getInt("z"));
spawn.setXYZ(rset.getInt("x"), rset.getInt("y"), rset.getInt("z"));
spawn.setHeading(rset.getInt("heading"));
spawn.setRespawnDelay(rset.getInt("respawnDelay"));
spawn.setAmount(1);

View File

@@ -1877,9 +1877,7 @@ public abstract class AbstractScript extends ManagedScript
final L2Spawn spawn = new L2Spawn(npcId);
spawn.setInstanceId(instanceId);
spawn.setHeading(heading);
spawn.setX(x);
spawn.setY(y);
spawn.setZ(z);
spawn.setXYZ(x, y, z);
spawn.stopRespawn();
final L2Npc npc = spawn.doSpawn(isSummonSpawn);

View File

@@ -429,9 +429,7 @@ public final class Instance
{
final L2Spawn spawnDat = new L2Spawn(set.getInt("npcId"));
spawnDat.setX(set.getInt("x"));
spawnDat.setY(set.getInt("y"));
spawnDat.setZ(set.getInt("z"));
spawnDat.setXYZ(set.getInt("x"), set.getInt("y"), set.getInt("z"));
spawnDat.setAmount(1);
spawnDat.setHeading(set.getInt("heading"));
spawnDat.setRespawnDelay(set.getInt("respawn"), set.getInt("respawnRandom"));

View File

@@ -24,24 +24,6 @@ import com.l2jmobius.gameserver.model.Location;
*/
public interface IPositionable extends ILocational
{
/**
* Sets the X coordinate of this object.
* @param x the new X coordinate
*/
void setX(int x);
/**
* Sets the Y coordinate of this object.
* @param y the new Y coordinate
*/
void setY(int y);
/**
* Sets the Z coordinate of this object.
* @param z the new Z coordinate
*/
void setZ(int z);
/**
* Sets all three coordinates of this object.
* @param x the new X coordinate

View File

@@ -23,7 +23,6 @@ import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.serverpackets.ExBrExtraUserInfo;
import com.l2jmobius.gameserver.network.serverpackets.SpawnItem;
import com.l2jmobius.gameserver.network.serverpackets.UserInfo;
public class RequestRecordInfo implements IClientIncomingPacket
@@ -48,27 +47,20 @@ public class RequestRecordInfo implements IClientIncomingPacket
L2World.getInstance().forEachVisibleObject(activeChar, L2Object.class, object ->
{
if (object.getPoly().isMorphed() && object.getPoly().getPolyType().equals("item"))
if (!object.isVisibleFor(activeChar))
{
activeChar.sendPacket(new SpawnItem(object));
}
else
{
if (!object.isVisibleFor(activeChar))
object.sendInfo(activeChar);
if (object.isCharacter())
{
object.sendInfo(activeChar);
if (object.isCharacter())
// Update the state of the L2Character object client
// side by sending Server->Client packet
// MoveToPawn/CharMoveToLocation and AutoAttackStart to
// the L2PcInstance
final L2Character obj = (L2Character) object;
if (obj.getAI() != null)
{
// Update the state of the L2Character object client
// side by sending Server->Client packet
// MoveToPawn/CharMoveToLocation and AutoAttackStart to
// the L2PcInstance
final L2Character obj = (L2Character) object;
if (obj.getAI() != null)
{
obj.getAI().describeStateToPlayer(activeChar);
}
obj.getAI().describeStateToPlayer(activeChar);
}
}
}

View File

@@ -18,11 +18,9 @@ package com.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.Config;
import com.l2jmobius.commons.network.PacketWriter;
import com.l2jmobius.gameserver.data.xml.impl.NpcData;
import com.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import com.l2jmobius.gameserver.model.actor.L2Decoy;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
import com.l2jmobius.gameserver.model.skills.AbnormalVisualEffect;
import com.l2jmobius.gameserver.model.zone.ZoneId;
@@ -41,7 +39,6 @@ public class CharInfo implements IClientOutgoingPacket
private final int _flyRunSpd;
private final int _flyWalkSpd;
private final double _moveMultiplier;
private final float _attackSpeedMultiplier;
private int _vehicleId = 0;
private final boolean _gmSeeInvis;
@@ -91,7 +88,6 @@ public class CharInfo implements IClientOutgoingPacket
_heading = _activeChar.getHeading();
_mAtkSpd = _activeChar.getMAtkSpd();
_pAtkSpd = (int) _activeChar.getPAtkSpd();
_attackSpeedMultiplier = _activeChar.getAttackSpeedMultiplier();
_moveMultiplier = cha.getMovementSpeedMultiplier();
_runSpd = (int) Math.round(cha.getRunSpeed() / _moveMultiplier);
@@ -116,206 +112,135 @@ public class CharInfo implements IClientOutgoingPacket
@Override
public boolean write(PacketWriter packet)
{
final L2NpcTemplate template = _activeChar.getPoly().isMorphed() ? NpcData.getInstance().getTemplate(_activeChar.getPoly().getPolyId()) : null;
if (template != null)
OutgoingPackets.CHAR_INFO.writeId(packet);
packet.writeD(_x);
packet.writeD(_y);
packet.writeD(_z);
packet.writeD(_vehicleId);
packet.writeD(_objId);
packet.writeS(_activeChar.getAppearance().getVisibleName());
packet.writeD(_activeChar.getRace().ordinal());
packet.writeD(_activeChar.getAppearance().getSex() ? 1 : 0);
packet.writeD(_activeChar.getBaseClass());
for (int slot : getPaperdollOrder())
{
OutgoingPackets.NPC_INFO.writeId(packet);
packet.writeD(_objId);
packet.writeD(template.getId() + 1000000); // npctype id
packet.writeD(_activeChar.getKarma() > 0 ? 1 : 0);
packet.writeD(_x);
packet.writeD(_y);
packet.writeD(_z);
packet.writeD(_heading);
packet.writeD(0x00);
packet.writeD(_mAtkSpd);
packet.writeD(_pAtkSpd);
packet.writeD(_runSpd);
packet.writeD(_walkSpd);
packet.writeD(_swimRunSpd);
packet.writeD(_swimWalkSpd);
packet.writeD(_flyRunSpd);
packet.writeD(_flyWalkSpd);
packet.writeD(_flyRunSpd);
packet.writeD(_flyWalkSpd);
packet.writeF(_moveMultiplier);
packet.writeF(_attackSpeedMultiplier);
packet.writeF(template.getfCollisionRadius());
packet.writeF(template.getfCollisionHeight());
packet.writeD(template.getRHandId()); // right hand weapon
packet.writeD(template.getChestId()); // chest
packet.writeD(template.getLHandId()); // left hand weapon
packet.writeC(1); // name above char 1=true ... ??
packet.writeC(_activeChar.isRunning() ? 1 : 0);
packet.writeC(_activeChar.isInCombat() ? 1 : 0);
packet.writeC(_activeChar.isAlikeDead() ? 1 : 0);
packet.writeC(!_gmSeeInvis && _activeChar.isInvisible() ? 1 : 0); // invisible ?? 0=false 1=true 2=summoned (only works if model has a summon animation)
packet.writeD(-1); // High Five NPCString ID
packet.writeS(_activeChar.getAppearance().getVisibleName());
packet.writeD(-1); // High Five NPCString ID
packet.writeS(_gmSeeInvis ? "Invisible" : _activeChar.getAppearance().getVisibleTitle());
packet.writeD(_activeChar.getAppearance().getTitleColor()); // Title color 0=client default
packet.writeD(_activeChar.getPvpFlag()); // pvp flag
packet.writeD(_activeChar.getKarma()); // karma ??
packet.writeD(_gmSeeInvis ? (_activeChar.getAbnormalVisualEffects() | AbnormalVisualEffect.STEALTH.getMask()) : _activeChar.getAbnormalVisualEffects()); // C2
packet.writeD(_activeChar.getClanId()); // clan id
packet.writeD(_activeChar.getClanCrestId()); // crest id
packet.writeD(_activeChar.getAllyId()); // ally id
packet.writeD(_activeChar.getAllyCrestId()); // all crest
packet.writeC(_activeChar.isFlying() ? 2 : 0); // is Flying
packet.writeC(_activeChar.getTeam().getId());
packet.writeF(template.getfCollisionRadius());
packet.writeF(template.getfCollisionHeight());
packet.writeD(0x00); // enchant effect
packet.writeD(_activeChar.isFlying() ? 2 : 0); // is Flying again?
packet.writeD(0x00);
packet.writeD(0x00); // CT1.5 Pet form and skills, Color effect
packet.writeC(template.isTargetable() ? 1 : 0); // targetable
packet.writeC(template.isShowName() ? 1 : 0); // show name
packet.writeC(_activeChar.getAbnormalVisualEffectSpecial());
packet.writeD(0x00);
packet.writeD(_activeChar.getInventory().getPaperdollItemDisplayId(slot));
}
for (int slot : getPaperdollOrder())
{
packet.writeD(_activeChar.getInventory().getPaperdollAugmentationId(slot));
}
packet.writeD(_activeChar.getInventory().getTalismanSlots());
packet.writeD(_activeChar.getInventory().canEquipCloak() ? 1 : 0);
packet.writeD(_activeChar.getPvpFlag());
packet.writeD(_activeChar.getKarma());
packet.writeD(_mAtkSpd);
packet.writeD(_pAtkSpd);
packet.writeD(0x00); // ?
packet.writeD(_runSpd);
packet.writeD(_walkSpd);
packet.writeD(_swimRunSpd);
packet.writeD(_swimWalkSpd);
packet.writeD(_flyRunSpd);
packet.writeD(_flyWalkSpd);
packet.writeD(_flyRunSpd);
packet.writeD(_flyWalkSpd);
packet.writeF(_moveMultiplier);
packet.writeF(_activeChar.getAttackSpeedMultiplier());
packet.writeF(_activeChar.getCollisionRadius());
packet.writeF(_activeChar.getCollisionHeight());
packet.writeD(_activeChar.getAppearance().getHairStyle());
packet.writeD(_activeChar.getAppearance().getHairColor());
packet.writeD(_activeChar.getAppearance().getFace());
packet.writeS(_gmSeeInvis ? "Invisible" : _activeChar.getAppearance().getVisibleTitle());
if (!_activeChar.isCursedWeaponEquipped())
{
packet.writeD(_activeChar.getClanId());
packet.writeD(_activeChar.getClanCrestId());
packet.writeD(_activeChar.getAllyId());
packet.writeD(_activeChar.getAllyCrestId());
}
else
{
OutgoingPackets.CHAR_INFO.writeId(packet);
packet.writeD(_x);
packet.writeD(_y);
packet.writeD(_z);
packet.writeD(_vehicleId);
packet.writeD(_objId);
packet.writeS(_activeChar.getAppearance().getVisibleName());
packet.writeD(_activeChar.getRace().ordinal());
packet.writeD(_activeChar.getAppearance().getSex() ? 1 : 0);
packet.writeD(_activeChar.getBaseClass());
for (int slot : getPaperdollOrder())
{
packet.writeD(_activeChar.getInventory().getPaperdollItemDisplayId(slot));
}
for (int slot : getPaperdollOrder())
{
packet.writeD(_activeChar.getInventory().getPaperdollAugmentationId(slot));
}
packet.writeD(_activeChar.getInventory().getTalismanSlots());
packet.writeD(_activeChar.getInventory().canEquipCloak() ? 1 : 0);
packet.writeD(_activeChar.getPvpFlag());
packet.writeD(_activeChar.getKarma());
packet.writeD(_mAtkSpd);
packet.writeD(_pAtkSpd);
packet.writeD(0x00); // ?
packet.writeD(_runSpd);
packet.writeD(_walkSpd);
packet.writeD(_swimRunSpd);
packet.writeD(_swimWalkSpd);
packet.writeD(_flyRunSpd);
packet.writeD(_flyWalkSpd);
packet.writeD(_flyRunSpd);
packet.writeD(_flyWalkSpd);
packet.writeF(_moveMultiplier);
packet.writeF(_activeChar.getAttackSpeedMultiplier());
packet.writeF(_activeChar.getCollisionRadius());
packet.writeF(_activeChar.getCollisionHeight());
packet.writeD(_activeChar.getAppearance().getHairStyle());
packet.writeD(_activeChar.getAppearance().getHairColor());
packet.writeD(_activeChar.getAppearance().getFace());
packet.writeS(_gmSeeInvis ? "Invisible" : _activeChar.getAppearance().getVisibleTitle());
if (!_activeChar.isCursedWeaponEquipped())
{
packet.writeD(_activeChar.getClanId());
packet.writeD(_activeChar.getClanCrestId());
packet.writeD(_activeChar.getAllyId());
packet.writeD(_activeChar.getAllyCrestId());
}
else
{
packet.writeD(0x00);
packet.writeD(0x00);
packet.writeD(0x00);
packet.writeD(0x00);
}
packet.writeC(_activeChar.isSitting() ? 0 : 1); // standing = 1 sitting = 0
packet.writeC(_activeChar.isRunning() ? 1 : 0); // running = 1 walking = 0
packet.writeC(_activeChar.isInCombat() ? 1 : 0);
packet.writeC(!_activeChar.isInOlympiadMode() && _activeChar.isAlikeDead() ? 1 : 0);
packet.writeC(!_gmSeeInvis && _activeChar.isInvisible() ? 1 : 0); // invisible = 1 visible =0
packet.writeC(_activeChar.getMountType().ordinal()); // 1-on Strider, 2-on Wyvern, 3-on Great Wolf, 0-no mount
packet.writeC(_activeChar.getPrivateStoreType().getId());
packet.writeH(_activeChar.getCubics().size());
for (int cubicId : _activeChar.getCubics().keySet())
{
packet.writeH(cubicId);
}
packet.writeC(_activeChar.isInPartyMatchRoom() ? 1 : 0);
packet.writeD(_gmSeeInvis ? (_activeChar.getAbnormalVisualEffects() | AbnormalVisualEffect.STEALTH.getMask()) : _activeChar.getAbnormalVisualEffects());
packet.writeC(_activeChar.isInsideZone(ZoneId.WATER) ? 1 : _activeChar.isFlyingMounted() ? 2 : 0);
packet.writeH(_activeChar.getRecomHave()); // Blue value for name (0 = white, 255 = pure blue)
packet.writeD(_activeChar.getMountNpcId() + 1000000);
packet.writeD(_activeChar.getClassId().getId());
packet.writeD(0x00); // ?
packet.writeC(_activeChar.isMounted() ? 0 : _activeChar.getEnchantEffect());
packet.writeC(_activeChar.getTeam().getId());
packet.writeD(_activeChar.getClanCrestLargeId());
packet.writeC(_activeChar.isNoble() ? 1 : 0); // Symbol on char menu ctrl+I
packet.writeC(_activeChar.isHero() || (_activeChar.isGM() && Config.GM_HERO_AURA) ? 1 : 0); // Hero Aura
packet.writeC(_activeChar.isFishing() ? 1 : 0); // 0x01: Fishing Mode (Cant be undone by setting back to 0)
packet.writeD(_activeChar.getFishx());
packet.writeD(_activeChar.getFishy());
packet.writeD(_activeChar.getFishz());
packet.writeD(_activeChar.getAppearance().getNameColor());
packet.writeD(_heading);
packet.writeD(_activeChar.getPledgeClass());
packet.writeD(_activeChar.getPledgeType());
packet.writeD(_activeChar.getAppearance().getTitleColor());
packet.writeD(_activeChar.isCursedWeaponEquipped() ? CursedWeaponsManager.getInstance().getLevel(_activeChar.getCursedWeaponEquippedId()) : 0);
packet.writeD(_activeChar.getClanId() > 0 ? _activeChar.getClan().getReputationScore() : 0);
// T1
packet.writeD(_activeChar.getTransformationDisplayId());
packet.writeD(_activeChar.getAgathionId());
// T2
packet.writeD(0x01);
// T2.3
packet.writeD(_activeChar.getAbnormalVisualEffectSpecial());
packet.writeD(0x00);
packet.writeD(0x00);
packet.writeD(0x00);
packet.writeD(0x00);
}
packet.writeC(_activeChar.isSitting() ? 0 : 1); // standing = 1 sitting = 0
packet.writeC(_activeChar.isRunning() ? 1 : 0); // running = 1 walking = 0
packet.writeC(_activeChar.isInCombat() ? 1 : 0);
packet.writeC(!_activeChar.isInOlympiadMode() && _activeChar.isAlikeDead() ? 1 : 0);
packet.writeC(!_gmSeeInvis && _activeChar.isInvisible() ? 1 : 0); // invisible = 1 visible =0
packet.writeC(_activeChar.getMountType().ordinal()); // 1-on Strider, 2-on Wyvern, 3-on Great Wolf, 0-no mount
packet.writeC(_activeChar.getPrivateStoreType().getId());
packet.writeH(_activeChar.getCubics().size());
for (int cubicId : _activeChar.getCubics().keySet())
{
packet.writeH(cubicId);
}
packet.writeC(_activeChar.isInPartyMatchRoom() ? 1 : 0);
packet.writeD(_gmSeeInvis ? (_activeChar.getAbnormalVisualEffects() | AbnormalVisualEffect.STEALTH.getMask()) : _activeChar.getAbnormalVisualEffects());
packet.writeC(_activeChar.isInsideZone(ZoneId.WATER) ? 1 : _activeChar.isFlyingMounted() ? 2 : 0);
packet.writeH(_activeChar.getRecomHave()); // Blue value for name (0 = white, 255 = pure blue)
packet.writeD(_activeChar.getMountNpcId() + 1000000);
packet.writeD(_activeChar.getClassId().getId());
packet.writeD(0x00); // ?
packet.writeC(_activeChar.isMounted() ? 0 : _activeChar.getEnchantEffect());
packet.writeC(_activeChar.getTeam().getId());
packet.writeD(_activeChar.getClanCrestLargeId());
packet.writeC(_activeChar.isNoble() ? 1 : 0); // Symbol on char menu ctrl+I
packet.writeC(_activeChar.isHero() || (_activeChar.isGM() && Config.GM_HERO_AURA) ? 1 : 0); // Hero Aura
packet.writeC(_activeChar.isFishing() ? 1 : 0); // 0x01: Fishing Mode (Cant be undone by setting back to 0)
packet.writeD(_activeChar.getFishx());
packet.writeD(_activeChar.getFishy());
packet.writeD(_activeChar.getFishz());
packet.writeD(_activeChar.getAppearance().getNameColor());
packet.writeD(_heading);
packet.writeD(_activeChar.getPledgeClass());
packet.writeD(_activeChar.getPledgeType());
packet.writeD(_activeChar.getAppearance().getTitleColor());
packet.writeD(_activeChar.isCursedWeaponEquipped() ? CursedWeaponsManager.getInstance().getLevel(_activeChar.getCursedWeaponEquippedId()) : 0);
packet.writeD(_activeChar.getClanId() > 0 ? _activeChar.getClan().getReputationScore() : 0);
// T1
packet.writeD(_activeChar.getTransformationDisplayId());
packet.writeD(_activeChar.getAgathionId());
// T2
packet.writeD(0x01);
// T2.3
packet.writeD(_activeChar.getAbnormalVisualEffectSpecial());
return true;
}

View File

@@ -34,13 +34,6 @@ public class DropItem implements IClientOutgoingPacket
{
_item = item;
_charObjId = playerObjId;
// Future test.
if ((_item.getX() == 0) && (_item.getY() == 0))
{
LOGGER.warning("DropItem with x=0 and y=0.");
Thread.dumpStack(); // Why? Also check SpawnItem, just in case.
}
}
@Override

View File

@@ -17,60 +17,31 @@
package com.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.commons.network.PacketWriter;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.network.OutgoingPackets;
public final class SpawnItem implements IClientOutgoingPacket
{
private final int _objectId;
private int _itemId;
private final int _x, _y, _z;
private int _stackable;
private long _count;
private final L2ItemInstance _item;
public SpawnItem(L2Object obj)
public SpawnItem(L2ItemInstance item)
{
_objectId = obj.getObjectId();
_x = obj.getX();
_y = obj.getY();
_z = obj.getZ();
// Future test.
if ((_x == 0) && (_y == 0))
{
LOGGER.warning("SpawnItem with x=0 and y=0.");
Thread.dumpStack(); // Why? Also check DropItem, just in case.
}
if (obj.isItem())
{
final L2ItemInstance item = (L2ItemInstance) obj;
_itemId = item.getDisplayId();
_stackable = item.isStackable() ? 0x01 : 0x00;
_count = item.getCount();
}
else
{
_itemId = obj.getPoly().getPolyId();
_stackable = 0;
_count = 1;
}
_item = item;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.SPAWN_ITEM.writeId(packet);
packet.writeD(_objectId);
packet.writeD(_itemId);
packet.writeD(_x);
packet.writeD(_y);
packet.writeD(_z);
packet.writeD(_item.getObjectId());
packet.writeD(_item.getDisplayId());
packet.writeD(_item.getX());
packet.writeD(_item.getY());
packet.writeD(_item.getZ());
// only show item count if it is a stackable item
packet.writeD(_stackable);
packet.writeQ(_count);
packet.writeD(_item.isStackable() ? 0x01 : 0x00);
packet.writeQ(_item.getCount());
packet.writeD(0x00); // c2
packet.writeD(0x00); // freya unk
return true;

View File

@@ -19,12 +19,10 @@ package com.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.Config;
import com.l2jmobius.commons.network.PacketWriter;
import com.l2jmobius.gameserver.data.xml.impl.ExperienceData;
import com.l2jmobius.gameserver.data.xml.impl.NpcData;
import com.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import com.l2jmobius.gameserver.instancemanager.TerritoryWarManager;
import com.l2jmobius.gameserver.model.Elementals;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jmobius.gameserver.model.skills.AbnormalVisualEffect;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.network.OutgoingPackets;
@@ -173,14 +171,6 @@ public final class UserInfo implements IClientOutgoingPacket
{
title = "[Invisible]";
}
if (_activeChar.getPoly().isMorphed())
{
final L2NpcTemplate polyObj = NpcData.getInstance().getTemplate(_activeChar.getPoly().getPolyId());
if (polyObj != null)
{
title += " - " + polyObj.getName();
}
}
packet.writeS(title);
packet.writeD(_activeChar.getClanId());