コード例 #1
0
 public void Parse(Session session, ClientMessage request, ServerMessage message) {
   Player p = session.getPlayer();
   String player = request.readString();
   if (ActiveConnections.getPlayer(player) != null) {
     ServerMessage bRequest = new ServerMessage(ClientPacket.TRADE_REQUEST);
     bRequest.addString(p.getName());
     ActiveConnections.getPlayer(player).getSession().Send(bRequest);
     p.addRequest(player, RequestType.TRADE);
   }
 }
コード例 #2
0
  public void Parse(Session session, ClientMessage request, ServerMessage message) {
    // Player is allowing move to be learned
    Player p = session.getPlayer();
    int pokemonIndex = request.readInt();
    int moveIndex = request.readInt();
    String move = request.readString();

    if (move != null && !move.equalsIgnoreCase("") && p.getParty()[pokemonIndex] != null) {
      boolean hasMove = false;
      for (int i = 0; i < 4; i++) {
        if (p.getParty()[pokemonIndex].getMoveName(i) == null) break;
        if (p.getParty()[pokemonIndex].getMoveName(i).equalsIgnoreCase(move)) {
          hasMove = true;
          break;
        }
      }
      if (p.getParty()[pokemonIndex].getMovesLearning().contains(move) && !hasMove) {
        p.getParty()[pokemonIndex].learnMove(moveIndex, move);
        p.updateClientPP(pokemonIndex, moveIndex);
      }
    }
  }