Example #1
0
 /**
  * Stop the current attack any report this to the server in case its needed. This does not
  * directly stop the attack. It just requests to stop the attack from the server.
  */
 public void standDown() {
   if (attackedChar != null) {
     World.getNet()
         .sendCommand(CommandFactory.getInstance().getCommand(CommandList.CMD_STAND_DOWN));
     attackedChar = null;
   }
 }
Example #2
0
 /**
  * Stop the current attack any report this to the server in case its needed. This does not
  * directly stop the attack. It just requests to stop the attack from the server.
  */
 public void standDown() {
   if (attackedChar != null) {
     Game.getNet()
         .sendCommand(CommandFactory.getInstance().getCommand(CommandList.CMD_STAND_DOWN));
     Game.getMusicBox().stopFightingMusic();
   }
 }
 /** Recycle the object and put is back into the command factory. */
 @Override
 public final void recycle() {
   PoolContext.enter();
   try {
     CommandFactory.getInstance().recycle(this);
   } finally {
     PoolContext.exit();
   }
 }
Example #4
0
  /**
   * This function creates a new character and requests the required information from the server.
   *
   * @param id the ID of the character to be created
   * @return the created character
   */
  private Char createNewCharacter(final CharacterId id) {
    final Char chara = Char.create();
    chara.setCharId(id);
    updateName(chara);

    addCharacter(chara);

    // request appearance from server if char is not known
    final RequestAppearanceCmd cmd =
        CommandFactory.getInstance()
            .getCommand(CommandList.CMD_REQUEST_APPEARANCE, RequestAppearanceCmd.class);
    cmd.request(id);
    World.getNet().sendCommand(cmd);
    return chara;
  }
Example #5
0
 /**
  * Send a attack command to the server that initiates a fight with the character that ID is set in
  * the parameter.
  *
  * @param id the ID of the character to fight
  */
 private void sendAttackToServer(final CharacterId id) {
   final AttackCmd cmd =
       (AttackCmd) CommandFactory.getInstance().getCommand(CommandList.CMD_ATTACK);
   cmd.setTarget(id);
   World.getNet().sendCommand(cmd);
 }