Examples of IGame


Examples of scotlandyard.engine.spec.IGame

      if(request.getParameter("selected_game")!=null){
        gameId  = request.getParameter("selected_game");
      }
      if(gameId==null || "".equals(gameId)){throw new Exception("Game Id is unknown");}

      final IGame game = Engine.instance().games.get(gameId);
      if(game==null){throw new Exception("Game is unknown");}

      final IPlayer player = game.getPlayer(xhash);
      if(player==null){throw new Exception("player is unknown");}

      final String moves = Arrays.toString(game.getLegalMoves(player.getEmail())).replace("{", "[").replace("}", "]").replace("null", "0");
      final IPlayer mrx = game.getMrX();
      if(mrx==null){
        throw new Exception("MR X Is not there");
      }
      String position = "-1";
      if(game.isRoundExposingMrX(game.getRound())){
        position = mrx.getPosition()+"";
      }
      out.print("{\"msg\" : "+ moves +", \"mrx\" : { \"position\" : "+ position +", \"face\" : \""+ mrx.getIcon() +"\", \"name\" : \""+mrx.getName()+"\"} }");

    }catch(Exception e){
View Full Code Here

Examples of scotlandyard.engine.spec.IGame

     
      if(game_id==null || "".equals(game_id)){
        throw new Exception("Game ID is missing");
      }

      final IGame game = Engine.instance().games.get(game_id);

      if(game==null){
        throw new Exception("Unknown Game");
      }

        final IUser user = Engine.instance().getUser(hash);

        if(user==null){
          throw new Exception("Unknown USER");
        }
        if(game.getStatus()!=IGame.NEW){
          throw new Exception("the game has already started.");
        }
        game.removePlayer("{\"msg\" : \""+user.getEmail()+"\"}");
       
      }catch(Exception e){
        out.print("{\"msg\" : \"EXCEPTION : "+(e.getMessage()+"").replace("\"", "'")+"\", \"className\" : \""+getClass().getName()+"\"}");
      }
  }
View Full Code Here

Examples of scotlandyard.engine.spec.IGame

          if(parameters.get("selected_game")!=null){
            game_id  = parameters.get("selected_game");
          }
          if(game_id==null || "".equals(game_id)){throw new Exception("Game id is missing");}

          final IGame game = Engine.instance().games.get(game_id);
          if(game==null){throw new Exception("GAME is unknow");}

          final IPlayer player = game.getPlayer(xhash);
          if(player==null){throw new Exception("UNKNOWN Player");}

          sb.append("<div class='player_tickets'><table cellpadding='2' class='tokens'>");
          final StringBuffer sb1 = new StringBuffer();
          final StringBuffer sb2 = new StringBuffer();
View Full Code Here

Examples of scotlandyard.engine.spec.IGame

      if(parameters.get("selected_game")!=null){
        gameId  = parameters.get("selected_game");
      }
      if(gameId==null || "".equals(gameId)){throw new Exception("Game Id is unknown");}
     
      final IGame game = Engine.instance().games.get(gameId);
      if(game==null){throw new Exception("Game is unknown");}

          final IPlayer player = game.getPlayer(xhash);
          if(player==null){throw new Exception("player is unknown");}

          final Integer newPosition = Integer.parseInt(parameters.get("newPosition"));
          if(newPosition==null){throw new Exception("New position is unknown");}

          final Integer transport = Integer.parseInt(parameters.get("transport"));
          if(transport==null){throw new Exception("Transport is unknown");}

          game.movePlayer(player.getEmail(), newPosition, transport);
         
          if(player.isMrx()){
            String msg = "<img src='http://scotlandyard.comule.com/get_icon.php?icon="+((int)Math.pow(2,transport))+"' width='32' height='32' alt='"+ BMap.convTransport(transport)+"'/>["+BMap.convTransport(transport)+"] was used by Mr X";
            new send_chat("SYSTEM",msg).processRequest(sid);
          }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.