示例#1
0
  @Override
  public void execute(Player player, String... params) {
    Wedding wedding = WeddingService.getInstance().getWedding(player);

    if (params == null || params.length != 1) {
      PacketSendUtility.sendMessage(player, "syntax .answer yes/no.");
      return;
    }

    if (player.getWorldId() == 510010000 || player.getWorldId() == 520010000) {
      PacketSendUtility.sendMessage(player, "You can't use this command on prison.");
      return;
    }

    if (wedding == null) {
      PacketSendUtility.sendMessage(player, "Wedding not started.");
      return;
    }

    if (params[0].toLowerCase().equals("yes")) {
      PacketSendUtility.sendMessage(
          player,
          "\u0412\u044b \u0441\u043e\u0433\u043b\u0430\u0441\u0438\u043b\u0438\u0441\u044c.");
      WeddingService.getInstance().acceptWedding(player);
    }

    if (params[0].toLowerCase().equals("no")) {
      PacketSendUtility.sendMessage(
          player, "\u0412\u044b \u043e\u0442\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c.");
      WeddingService.getInstance().cancelWedding(player);
    }
  }
示例#2
0
  @Override
  public void execute(Player admin, String... params) {

    if (params.length != 1) {
      PacketSendUtility.sendMessage(admin, "Syntax: //addcube <player name>");
      return;
    }

    Player receiver = null;

    receiver = World.getInstance().findPlayer(Util.convertName(params[0]));

    if (receiver == null) {
      PacketSendUtility.sendMessage(
          admin, "The player " + Util.convertName(params[0]) + " is not online.");
      return;
    }

    if (receiver != null) {
      if (receiver.getNpcExpands() < CustomConfig.BASIC_CUBE_SIZE_LIMIT) {
        CubeExpandService.expand(receiver, true);
        PacketSendUtility.sendMessage(
            admin, "9 cube slots successfully added to player " + receiver.getName() + "!");
        PacketSendUtility.sendMessage(
            receiver, "Admin " + admin.getName() + " gave you a cube expansion!");
      } else {
        PacketSendUtility.sendMessage(
            admin,
            "Cube expansion cannot be added to "
                + receiver.getName()
                + "!\nReason: player cube already fully expanded.");
        return;
      }
    }
  }
示例#3
0
  @Override
  public void execute(Player admin, String... params) {
    if (params.length > 1) onFail(admin, null);

    VisibleObject target = admin.getTarget();
    if (target == null) PacketSendUtility.sendMessage(admin, "No target selected");
    else if (target instanceof Creature) {
      Creature creature = (Creature) target;
      int dmg;
      try {
        String percent = params[0];
        Pattern damage = Pattern.compile("([^%]+)%");
        Matcher result = damage.matcher(percent);

        if (result.find()) {
          dmg = Integer.parseInt(result.group(1));

          if (dmg < 100)
            creature
                .getController()
                .onAttack(admin, (int) (dmg / 100f * creature.getLifeStats().getMaxHp()), true);
          else
            creature.getController().onAttack(admin, creature.getLifeStats().getMaxHp() + 1, true);
        } else creature.getController().onAttack(admin, Integer.parseInt(params[0]), true);
      } catch (Exception ex) {
        onFail(admin, null);
      }
    }
  }
  /* (non-Javadoc)
   * @see org.typezero.gameserver.utils.chathandlers.ChatCommand#execute(org.typezero.gameserver.model.gameobjects.player.Player, java.lang.String[])
   */
  @Override
  public void execute(Player player, String... params) {
    if (params.length < 1) {
      PacketSendUtility.sendMessage(
          player, "Syntax: //token <playername> || //token show <playername>");
      return;
    }
    Player receiver = null;

    if (params[0].equals("show")) {
      receiver = World.getInstance().findPlayer(Util.convertName(params[1]));
      if (receiver == null) {
        PacketSendUtility.sendMessage(player, "Can't find this player, maybe he's not online");
        return;
      }

      if (!"".equals(receiver.getPlayerAccount().getSecurityToken())) {
        PacketSendUtility.sendMessage(
            player,
            "The Security Token of this player is: "
                + receiver.getPlayerAccount().getSecurityToken());
      } else {
        PacketSendUtility.sendMessage(player, "This player haven't an Security Token!");
      }

    } else {
      receiver = World.getInstance().findPlayer(Util.convertName(params[0]));

      if (receiver == null) {
        PacketSendUtility.sendMessage(player, "Can't find this player, maybe he's not online");
        return;
      }

      PlayerSecurityTokenService.getInstance().generateToken(receiver);
    }
  }
示例#5
0
 @Override
 public void onFail(Player admin, String message) {
   PacketSendUtility.sendMessage(admin, "Syntax: //addcube <player name>");
 }
示例#6
0
 @Override
 public void onFail(Player player, String message) {
   PacketSendUtility.sendMessage(player, "syntax //ranking update");
 }
 @Override
 public void onFail(Player admin, String message) {
   PacketSendUtility.sendMessage(
       admin, "Syntax: //token <playername> || //token show <playername>");
 }
示例#8
0
 @Override
 public void onFail(Player player, String message) {
   PacketSendUtility.sendMessage(
       player, "syntax //damage <dmg | dmg%>" + "\n<dmg> must be a number.");
 }
 private void run() {
   admin.getEffectController().setAbnormal(AbnormalState.HIDE.getId());
   admin.setVisualState(CreatureVisualState.HIDE20);
   PacketSendUtility.broadcastPacket(admin, new SM_PLAYER_STATE(admin), true);
   PacketSendUtility.sendMessage(admin, "You are invisible.");
 }
示例#10
0
  @Override
  public void execute(Player admin, String... params) {
    if (params == null || params.length < 1) {
      onFail(admin, null);
      return;
    }

    VisibleObject target = admin.getTarget();
    Player player;

    if (target == null) player = admin;
    else player = (Player) target;

    if (params[0].equals("reset")) {
      PlayerAppearance savedPlayerAppearance = player.getSavedPlayerAppearance();

      if (savedPlayerAppearance == null) {
        PacketSendUtility.sendMessage(admin, "The target has already the normal appearance.");
        return;
      }

      // Edit the current player's appearance with the saved player's appearance
      player.setPlayerAppearance(savedPlayerAppearance);

      // See line 44
      player.setSavedPlayerAppearance(null);

      // Warn the player
      PacketSendUtility.sendMessage(player, "An admin has resetted your appearance.");

      // Send update packets
      TeleportService2.teleportTo(
          player,
          player.getWorldId(),
          player.getInstanceId(),
          player.getX(),
          player.getY(),
          player.getZ(),
          player.getHeading());

      return;
    }

    if (params.length < 2) {
      onFail(player, null);
      return;
    }

    // Get the current player's appearance
    PlayerAppearance playerAppearance = player.getPlayerAppearance();

    // Save a clean player's appearance
    if (player.getSavedPlayerAppearance() == null)
      player.setSavedPlayerAppearance((PlayerAppearance) playerAppearance.clone());

    if (params[0].equals("size")) // Edit player's size. Min: 0, Max: 50 (prevent bug)
    {
      float height;

      try {
        height = Float.parseFloat(params[1]);
      } catch (NumberFormatException e) {
        PacketSendUtility.sendMessage(admin, "The value must be a number !");
        onFail(player, e.getMessage());
        return;
      }

      if (height < 0 || height > 50) {
        PacketSendUtility.sendMessage(admin, "Size: Min value : 0 - Max value : 50");
        return;
      }

      // Edit the height
      playerAppearance.setHeight(height);
    } else if (params[0].equals("voice")) // Min: 0, Max: 3
    {
      int voice;

      try {
        voice = Integer.parseInt(params[1]);
      } catch (NumberFormatException e) {
        PacketSendUtility.sendMessage(admin, "The value must be a number !");
        onFail(player, e.getMessage());
        return;
      }

      if (voice < 0 || voice > 3) {
        PacketSendUtility.sendMessage(admin, "Voice: Min value : 0 - Max value : 3");
        return;
      }

      // Edit the voice
      playerAppearance.setVoice(voice);
    } else if (params[0].equals("hair")) // Min: 1, Max: 43
    {
      int hair;

      try {
        hair = Integer.parseInt(params[1]);
      } catch (NumberFormatException e) {
        PacketSendUtility.sendMessage(admin, "The value must be a number !");
        onFail(player, e.getMessage());
        return;
      }

      if (hair < 1 || hair > 43) {
        PacketSendUtility.sendMessage(admin, "Hair: Min value : 1 - Max value : 43");
        return;
      }

      // Edit the hair
      playerAppearance.setHair(hair);
    } else if (params[0].equals("face")) // Min: 1, Max: 24
    {
      int face;

      try {
        face = Integer.parseInt(params[1]);
      } catch (NumberFormatException e) {
        PacketSendUtility.sendMessage(admin, "The value must be a number !");
        onFail(player, e.getMessage());
        return;
      }

      if (face < 1 || face > 24) {
        PacketSendUtility.sendMessage(admin, "Face: Min value : 1 - Max value : 24");
        return;
      }

      // Edit the face
      playerAppearance.setFace(face);
    } else if (params[0].equals("deco")) // Min: 1, Max: 18
    {
      int deco;

      try {
        deco = Integer.parseInt(params[1]);
      } catch (NumberFormatException e) {
        PacketSendUtility.sendMessage(admin, "The value must be a number !");
        onFail(player, e.getMessage());
        return;
      }

      if (deco < 1 || deco > 18) {
        PacketSendUtility.sendMessage(admin, "Deco: Min value : 1 - Max value : 18");
        return;
      }

      // Edit the deco
      playerAppearance.setDeco(deco);
    } else if (params[0].equals("head_size")) // Min: 0, Max: 100
    {
      int head;

      try {
        head = Integer.parseInt(params[1]);
      } catch (NumberFormatException e) {
        PacketSendUtility.sendMessage(admin, "The value must be a number !");
        onFail(player, e.getMessage());
        return;
      }

      if (head < 0 || head > 100) {
        PacketSendUtility.sendMessage(admin, "Head Size: Min value : 0 - Max value : 100");
        return;
      }

      // Edit the head
      playerAppearance.setHeadSize(head + 200);
    } else if (params[0].equals("tattoo")) // Min: 1, Max: 13
    {
      int tattoo;

      try {
        tattoo = Integer.parseInt(params[1]);
      } catch (NumberFormatException e) {
        PacketSendUtility.sendMessage(admin, "The value must be a number !");
        onFail(player, e.getMessage());
        return;
      }

      if (tattoo < 1 || tattoo > 13) {
        PacketSendUtility.sendMessage(admin, "Tattoo: Min value : 1 - Max value : 13");
        return;
      }

      // Edit the tattoo
      playerAppearance.setTattoo(tattoo);
    } else {
      onFail(player, null);
      return;
    }

    // Edit the current player's appearance with our modifications
    player.setPlayerAppearance(playerAppearance);

    // Warn the player
    PacketSendUtility.sendMessage(player, "An admin has changed your appearance.");

    // Send update packets
    TeleportService2.teleportTo(
        player,
        player.getWorldId(),
        player.getInstanceId(),
        player.getX(),
        player.getY(),
        player.getZ(),
        player.getHeading());
  }
示例#11
0
 @Override
 public void onFail(Player player, String message) {
   String syntax =
       "Syntax: //appearance <size | voice | hair | face | deco | head_size | tattoo | reset (to reset the appearance)> <value>";
   PacketSendUtility.sendMessage(player, syntax);
 }
示例#12
0
 @Override
 public void onFail(Player player, String message) {
   PacketSendUtility.sendMessage(player, "syntax .answer yes/no.");
 }