예제 #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);
     }
 }
예제 #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);
     }
 }
예제 #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);
 }
예제 #4
0
        public void lowerHealth(ushort originalId, Location location)
        {
            WorldObject worldObject = getObject(originalId, location);

            if (worldObject == null)
            {
                addObjectToList(originalId, location);
            }
            if (worldObject.getOriginalId() == 733)
            { // Web
                if (Misc.random(6) == 0)
                {
                    changeObject(worldObject);
                }
                return;
            }
            worldObject = getObject(originalId, location);
            worldObject.setObjectHealth(worldObject.getObjectHealth() - 1);
            if (worldObject.getObjectHealth() <= 0)
            {
                changeObject(worldObject);
            }
        }
예제 #5
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);
     }
 }
예제 #6
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);
     }
 }
예제 #7
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;
 }