コード例 #1
0
 private void fixDoorV4(int fromRoom, ExitDirectionEnum exitDirection, int v4) {
   try {
     Room room = _area.getRoomMap().get(fromRoom);
     Exit exit = room.getExit(exitDirection);
     exit.getDoor().setV4(v4);
   } catch (Exception e) {
     _log.error("Error attempting to hack door consumes value for room " + fromRoom);
   }
 }
コード例 #2
0
  private void parseDoorLine(String line) {
    if (line.startsWith(DOORTOT_KEYWORD)) {
      _log.debug("Found the " + DOORTOT_KEYWORD + " section");
      return;
    }

    String data = line.substring(DOOR_KEYWORD.length());
    String[] doorDataSplit = getData(data);

    int fromRoom = Integer.valueOf(doorDataSplit[1]);
    int toRoom = Integer.valueOf(doorDataSplit[2]);

    Room room = _area.getEntry(fromRoom);
    if (room == null) {
      room = _townArea.getEntry(fromRoom);
    }

    Exit exit = room.getExit(toRoom);
    if (exit == null) {
      _log.info(
          "Exit from room "
              + room.getRoomNumber()
              + " to room "
              + toRoom
              + " does not exist!  Skipping");
      return;
    }

    int doorTypeInt = Integer.valueOf(doorDataSplit[0]).intValue();
    Door door = new NullDoor();

    if (doorTypeInt >= 0) {
      door = new ItemKeyDoor();
    } else {
      DoorType doorType = DoorType.getDoorType(doorTypeInt);
      if (doorType.equals(DoorType.HAS_RUNE)) {
        door = new HasRuneDoor();
      } else if (doorType.equals(DoorType.MINIMUM_RUNE)) {
        door = new MinimumRuneDoor();
      } else if (doorType.equals(DoorType.PRIVATE_ROOM)) {
        door = new PrivateRoomDoor();
      } else if (doorType.equals(DoorType.PUZZLE)) {
        door = new PuzzleDoor();
      } else if (doorType.equals(DoorType.PROMOTE_DOOR)) {
        door = new PromoteDoor();
      }
    }
    door.setV0(Integer.valueOf(doorDataSplit[0]).intValue());
    door.setV3(Integer.valueOf(doorDataSplit[3]).intValue());
    door.setV4(Integer.valueOf(doorDataSplit[4]).intValue());
    door.setV5(Integer.valueOf(doorDataSplit[5]).intValue());
    door.setV6(Integer.valueOf(doorDataSplit[6]).intValue());

    exit.setDoor(door);
  }
コード例 #3
0
 private void fixDoorPuzzle(int roomVnum1, int roomVnum2) {
   try {
     Room room1 = _area.getRoomMap().get(roomVnum1);
     Exit exit1 = room1.getExit(ExitDirectionEnum.NORTH);
     Room room2 = _area.getRoomMap().get(roomVnum2);
     Exit exit2 = room2.getExit(ExitDirectionEnum.SOUTH);
     exit1.setDoor(exit2.getDoor());
     exit2.setDoor(null);
   } catch (Exception e) {
     _log.error("Error attempting to hack door puzzle for room " + roomVnum1);
   }
 }
コード例 #4
0
 private void fixExits() {
   int roomVnum = 1605;
   int oldValue = 1712;
   int newValue = 1680;
   Room room = _area.getRoomMap().get(roomVnum);
   Exit exit = room.getExit(ExitDirectionEnum.UP);
   if (exit.getToRoom() == oldValue) {
     exit.setToRoom(newValue);
   } else {
     _log.error(
         "Room "
             + roomVnum
             + ".  Expected to see "
             + oldValue
             + " but got "
             + exit.getToRoom()
             + ".");
   }
 }