Code Search for Developers
 
 
  

Help.java from Riot in Emerald city at Krugle


Show Help.java syntax highlighted

/*
 * Copyright (C) 2001-2005 Pleasant nightmare studio
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
package org.pleasantnightmare.riotinecity.console;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * List console commands
 *
 * @author deus
 * @version 1.0
 * @since Apr 9, 2007 6:29:49 PM
 */
public class Help extends InputProcessor {
    public static final String COMMAND = "help";
    private static final Pattern INPUT = Pattern.compile("help (.+)");

    public void process(String input) throws ProcessingError {
        Matcher m = INPUT.matcher(input);
        if (!m.matches())
            commandList();
        else
            specificCommandHelp(m.group(1));
    }

    private void specificCommandHelp(String command) {
        if (command.equals(ActionList.COMMAND)) {
            model.writeLine("Writes list of actions available");
            model.writeLine("for current Interactible. If called");
            model.writeLine("without <name>, it tries to write");
            model.writeLine("list if only one Interactible is");
            model.writeLine("detected.");
        } else if (command.equals(Call.COMMAND)) {
            model.writeLine("Executes action named <name> for");
            model.writeLine("currently selected entity.");
        } else if (command.equals(Help.COMMAND)) {
            model.writeLine("Called without argument lists available");
            model.writeLine("commands. Call with argument shows help");
            model.writeLine("for specific command.");
        } else if (command.equals(Select.COMMAND)) {
            model.writeLine("Selects Interactible into");
            model.writeLine("context allowing easier action");
            model.writeLine("call. Call 'select none' to deselect");
            model.writeLine("Interactible out of context.");
        } else if (command.equals(Test.COMMAND)) {
            model.writeLine("Tests for interactible collisions.");
        }
    }

    private void commandList() {
        model.writeLine("Available commands: ti, al, help, sel call");
    }

    public boolean isProcessable(String input) {
        return input.trim().startsWith(COMMAND);
    }

    public String getCommand() {
        return COMMAND;
    }
}




See more files for this project here

Riot in Emerald city

Cyberpunk third-person 2100. noir RPG thriller using JMonkey. Its going to be mix between Bloodnet, Neuromancer, DeusEx in gameplay, with pieces of Uplink and many other mini-games for dealing with variety of tasks (lockpicking, hacking...)

Project homepage: http://sourceforge.net/projects/riot-in-ecity
Programming language(s): Java,XML
License: other

  ActionList.java
  Call.java
  ConsoleEngine.java
  ConsoleModel.java
  ConsoleSpatial.java
  ConsoleToggleAction.java
  Help.java
  InputProcessor.java
  ProcessingError.java
  Select.java
  Test.java