Пример #1
0
 /** Update objects when entering a new region or logging in */
 public void updateObjects(Client c) {
   for (Objects o : globalObjects) {
     if (c != null) {
       if (c.heightLevel == o.getObjectHeight() && o.objectTicks == 0) {
         if (c.distanceToPoint(o.getObjectX(), o.getObjectY()) <= 60) {
           c.getPA()
               .object(
                   o.getObjectId(),
                   o.getObjectX(),
                   o.getObjectY(),
                   o.getObjectFace(),
                   o.getObjectType());
         }
       }
     }
   }
   if (10 + Misc.random(10) == 15 && !Flax.flaxRemoved.isEmpty()) {
     int[] flax =
         Flax.flaxRemoved.get(Flax.flaxRemoved.indexOf(Flax.flaxRemoved.iterator().next()));
     // Server.objectHandler.createAnObject(2646, flax[0], flax[1]);
     // c.getPA().checkObjectSpawn(2646, flax[0], flax[1]);
     Flax.flaxRemoved.remove(Flax.flaxRemoved.indexOf(flax));
   }
   if (c.distanceToPoint(2813, 3463) <= 60) {
     c.getFarming().updateHerbPatch();
   }
   if (c.distanceToPoint(2961, 3389) <= 60) {
     c.getPA().object(6552, 2961, 3389, -1, 10);
   }
 }
Пример #2
0
 public void doorHandling(int doorId, int doorX, int doorY, int doorHeight) {
   for (int i = 0; i < doors.length; i++) {
     if (doorX == doors[i][0] && doorY == doors[i][1] && doorHeight == doors[i][2]) {
       if (doors[i][4] == 0) {
         doorId++;
       } else {
         doorId--;
       }
       for (Player p : Server.playerHandler.players) {
         if (p != null) {
           Client person = (Client) p;
           if (person != null) {
             if (person.heightLevel == doorHeight) {
               if (person.distanceToPoint(doorX, doorY) <= 60) {
                 person.getPA().object(-1, doors[i][0], doors[i][1], 0, 0);
                 if (doors[i][3] == 0 && doors[i][4] == 1) {
                   person.getPA().object(doorId, doors[i][0], doors[i][1] + 1, -1, 0);
                 } else if (doors[i][3] == -1 && doors[i][4] == 1) {
                   person.getPA().object(doorId, doors[i][0] - 1, doors[i][1], -2, 0);
                 } else if (doors[i][3] == -2 && doors[i][4] == 1) {
                   person.getPA().object(doorId, doors[i][0], doors[i][1] - 1, -3, 0);
                 } else if (doors[i][3] == -3 && doors[i][4] == 1) {
                   person.getPA().object(doorId, doors[i][0] + 1, doors[i][1], 0, 0);
                 } else if (doors[i][3] == 0 && doors[i][4] == 0) {
                   person.getPA().object(doorId, doors[i][0] - 1, doors[i][1], -3, 0);
                 } else if (doors[i][3] == -1 && doors[i][4] == 0) {
                   person.getPA().object(doorId, doors[i][0], doors[i][1] - 1, 0, 0);
                 } else if (doors[i][3] == -2 && doors[i][4] == 0) {
                   person.getPA().object(doorId, doors[i][0] + 1, doors[i][1], -1, 0);
                 } else if (doors[i][3] == -3 && doors[i][4] == 0) {
                   person.getPA().object(doorId, doors[i][0], doors[i][1] + 1, -2, 0);
                 }
               }
             }
           }
         }
       }
     }
   }
 }
Пример #3
0
 /** Creates the object for anyone who is within 60 squares of the object */
 public void placeObject(Objects o) {
   for (Player p : Server.playerHandler.players) {
     if (p != null) {
       Client person = (Client) p;
       if (person != null) {
         if (person.heightLevel == o.getObjectHeight() && o.objectTicks == 0) {
           if (person.distanceToPoint(o.getObjectX(), o.getObjectY()) <= 60) {
             removeAllObjects(o);
             globalObjects.add(o);
             person
                 .getPA()
                 .object(
                     o.getObjectId(),
                     o.getObjectX(),
                     o.getObjectY(),
                     o.getObjectFace(),
                     o.getObjectType());
           }
         }
       }
     }
   }
 }