示例#1
0
  @Override
  public void applyEffect(Effect effect) {
    super.applyEffect(effect);
    final Player effector = (Player) effect.getEffector();

    // Move Effector to Effected
    Skill skill = effect.getSkill();
    World.getInstance()
        .updatePosition(effector, skill.getX(), skill.getY(), skill.getZ(), skill.getH());
  }
  private void useSkill(Player player, Item item) {
    if (player.isItemUseDisabled(item.getItemTemplate().getDelayId())) {
      PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.STR_ITEM_CANT_USE_UNTIL_DELAY_TIME);
      return;
    }

    int useDelay = item.getItemTemplate().getDelayTime();
    player.addItemCoolDown(
        item.getItemTemplate().getDelayId(),
        System.currentTimeMillis() + useDelay,
        useDelay / 1000);

    if (item.getItemId() == 182206627) {
      int skillId = 10251;
      int level = 1;

      Skill skill = SkillEngine.getInstance().getSkill(player, skillId, level, player);
      if (skill != null) {
        PacketSendUtility.broadcastPacket(
            player,
            new SM_ITEM_USAGE_ANIMATION(
                player.getObjectId(), item.getObjectId(), item.getItemTemplate().getTemplateId()),
            true);
        skill.useSkill();
      }
      return;
    }
    if (item.getItemId() == 182206628) {
      int skillId = item.getItemId() == 182206627 ? 10251 : 9831;
      int level = item.getItemId() == 182206627 ? 1 : 4;

      Skill skill = SkillEngine.getInstance().getSkill(player, skillId, level, player);
      if (skill != null) {
        PacketSendUtility.broadcastPacket(
            player,
            new SM_ITEM_USAGE_ANIMATION(
                player.getObjectId(), item.getObjectId(), item.getItemTemplate().getTemplateId()),
            true);
        skill.useSkill();
      }
      return;
    } else if (item.getItemId() == 164000137) {
      int skillId = 164000137 == 182207604 ? 10252 : 9832;
      int level = item.getItemId() == 182207604 ? 1 : 4;

      Skill skill = SkillEngine.getInstance().getSkill(player, skillId, level, player);
      if (skill != null) {
        PacketSendUtility.broadcastPacket(
            player,
            new SM_ITEM_USAGE_ANIMATION(
                player.getObjectId(), item.getObjectId(), item.getItemTemplate().getTemplateId()),
            true);
        skill.useSkill();
      }
      return;
    } else if (item.getItemId() == 164000138) {
      int skillId = 164000138 == 182207604 ? 10252 : 9833;
      int level = item.getItemId() == 182207604 ? 1 : 4;

      Skill skill = SkillEngine.getInstance().getSkill(player, skillId, level, player);
      if (skill != null) {
        PacketSendUtility.broadcastPacket(
            player,
            new SM_ITEM_USAGE_ANIMATION(
                player.getObjectId(), item.getObjectId(), item.getItemTemplate().getTemplateId()),
            true);
        skill.useSkill();
      }
      return;
    } else if (item.getItemId() == 164000139) {
      int skillId = 164000139 == 182207604 ? 10252 : 9834;
      int level = item.getItemId() == 182207604 ? 1 : 4;

      Skill skill = SkillEngine.getInstance().getSkill(player, skillId, level, player);
      if (skill != null) {
        PacketSendUtility.broadcastPacket(
            player,
            new SM_ITEM_USAGE_ANIMATION(
                player.getObjectId(), item.getObjectId(), item.getItemTemplate().getTemplateId()),
            true);
        skill.useSkill();
      }
      return;
    }
  }