private void changeObject(WorldObject worldObject) { if (worldObject != null) { worldObject.setSecondForm(true); foreach(Player p in Server.getPlayerList()) { if (p != null) { if (p.getLocation().withinDistance(worldObject.getLocation(), 60)) { if (!worldObject.isFire()) { p.getPackets().removeObject(worldObject.getLocation(), worldObject.getFace(), worldObject.getType()); p.getPackets().createObject(worldObject.getSecondaryId(), worldObject.getLocation(), worldObject.getFace(), worldObject.getType()); } else { p.getPackets().createObject(worldObject.getOriginalId(), worldObject.getLocation(), worldObject.getFace(), worldObject.getType()); } } } } int delay = worldObject.isFire() ? (60000 + misc.random(90000)) : worldObject.getRestoreDelay(); Event restoreObjectEvent = new Event(delay); restoreObjectEvent.setAction(() => { restoreObject(worldObject); restoreObjectEvent.stop(); }); Server.registerEvent(restoreObjectEvent); } }
private void changeObject(WorldObject worldObject) { if (worldObject != null) { worldObject.setSecondForm(true); foreach (Player p in Server.getPlayerList()) { if (p != null) { if (p.getLocation().withinDistance(worldObject.getLocation(), 60)) { if (!worldObject.isFire()) { p.getPackets().removeObject(worldObject.getLocation(), worldObject.getFace(), worldObject.getType()); p.getPackets().createObject(worldObject.getSecondaryId(), worldObject.getLocation(), worldObject.getFace(), worldObject.getType()); } else { p.getPackets().createObject(worldObject.getOriginalId(), worldObject.getLocation(), worldObject.getFace(), worldObject.getType()); } } } } int delay = worldObject.isFire() ? (60000 + misc.random(90000)) : worldObject.getRestoreDelay(); Event restoreObjectEvent = new Event(delay); restoreObjectEvent.setAction(() => { restoreObject(worldObject); restoreObjectEvent.stop(); }); Server.registerEvent(restoreObjectEvent); } }
public void restoreObject(WorldObject worldObject) { if (worldObject != null) { foreach(Player p in Server.getPlayerList()) { if (p != null) { if (p.getLocation().withinDistance(worldObject.getLocation(), 60)) { if (!worldObject.isFire()) { p.getPackets().createObject(worldObject.getOriginalId(), worldObject.getLocation(), worldObject.getFace(), worldObject.getType()); } else { p.getPackets().removeObject(worldObject.getLocation(), worldObject.getFace(), worldObject.getType()); } } } } if (worldObject.isFire()) { GroundItem item = new GroundItem(592, 1, worldObject.getLocation(), worldObject.getOwner()); Server.getGroundItems().newWorldItem(item); } } lock(objects) { objects.Remove(worldObject); } }
public void restoreObject(WorldObject worldObject) { if (worldObject != null) { foreach (Player p in Server.getPlayerList()) { if (p != null) { if (p.getLocation().withinDistance(worldObject.getLocation(), 60)) { if (!worldObject.isFire()) { p.getPackets().createObject(worldObject.getOriginalId(), worldObject.getLocation(), worldObject.getFace(), worldObject.getType()); } else { p.getPackets().removeObject(worldObject.getLocation(), worldObject.getFace(), worldObject.getType()); } } } } if (worldObject.isFire()) { GroundItem item = new GroundItem(592, 1, worldObject.getLocation(), worldObject.getOwner()); Server.getGroundItems().newWorldItem(item); } } lock (objects) { objects.Remove(worldObject); } }