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);
		    }
	    }
Exemplo n.º 2
0
 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);
		    }
	    }
Exemplo n.º 4
0
 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);
     }
 }