Exemple #1
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);
     }
 }
Exemple #2
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);
     }
 }
Exemple #3
0
 private int getType(WorldObject worldObject)
 {
     switch (worldObject.getOriginalId())
     {
     case 733:                 // Wilderness web
         if (worldObject.getOriginalId() == 733)
         {
             Location web1Location = new Location(3092, 3957, 0);                         // Eastern mage bank web
             Location web2Location = new Location(3095, 3957, 0);                         // Western mage bank web
             if (worldObject.getLocation().Equals(web1Location) || worldObject.getLocation().Equals(web2Location))
             {
                 return(0);
             }
         }
         break;
     }
     return(10);
 }
	    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 int getType(WorldObject worldObject) {
            switch (worldObject.getOriginalId())
            {
			    case 733: // Wilderness web
                    if (worldObject.getOriginalId() == 733)
                    {
					    Location web1Location = new Location(3092, 3957, 0); // Eastern mage bank web
					    Location web2Location = new Location(3095, 3957, 0); // Western mage bank web
                        if (worldObject.getLocation().Equals(web1Location) || worldObject.getLocation().Equals(web2Location))
                        {
						    return 0;
					    }
				    }
				    break;
		    }
		    return 10;
	    }
	    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);
		    }
	    }