Exemplo n.º 1
0
  @Override
  public void end(GameActionData<Player> data, boolean success, String[] args) {
    Loggin.debug(
        "IOAction sur la map (cell = %s, action = %s)", data.getArgument(0), data.getArgument(1));
    short cellID = Short.parseShort(data.getArgument(0));
    int action = Integer.parseInt(data.getArgument(1));

    if (!MapUtils.isAdjacentCells(data.getPerformer().getCell().getID(), cellID)) {
      Loggin.debug("Personnage trop loin pour effectuer l'action !");
    }

    MapCell cell = data.getPerformer().getMap().getCellById(cellID);

    if (cell == null) {
      return;
    }

    InteractiveObject IO = cell.getObj();

    if (IO == null) {
      return;
    }

    IO.startAction(data.getPerformer(), action);
  }
Exemplo n.º 2
0
  public static MapCell getValidCurrentCell(org.pvemu.models.Character character, GameMap map) {
    MapCell cell = map.getCellById(character.lastCell);

    if (cell == null) {
      cell = MapUtils.getRandomValidCell(map);
    }

    return cell;
  }