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); } }
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); }