コード例 #1
0
ファイル: CombatHandler.java プロジェクト: Tiim/Illarion-Java
 /**
  * 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;
   }
 }
コード例 #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();
   }
 }
コード例 #3
0
 /** 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();
   }
 }
コード例 #4
0
ファイル: People.java プロジェクト: pschiffm/Illarion-Java
  /**
   * 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;
  }
コード例 #5
0
ファイル: CombatHandler.java プロジェクト: Tiim/Illarion-Java
 /**
  * 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);
 }