Package com.l2jfrozen.gameserver.model

Examples of com.l2jfrozen.gameserver.model.L2Skill


      activeChar.sendPacket(ActionFailed.STATIC_PACKET);
      return;
    }

    // Get the L2Skill template corresponding to the skillID received from the client
    L2Skill skill = SkillTable.getInstance().getInfo(_magicId, level);
   
    // Check the validity of the skill
    if (skill != null)
    {

      // _log.fine(" [FINE]   skill:"+skill.getName() + " level:"+skill.getLevel() + " passive:"+skill.isPassive());
      // _log.fine(" [FINE]   range:"+skill.getCastRange()+" targettype:"+skill.getTargetType()+" optype:"+skill.getOperateType()+" power:"+skill.getPower());
      // _log.fine(" [FINE]   reusedelay:"+skill.getReuseDelay()+" hittime:"+skill.getHitTime());
      // _log.fine(" [FINE]   currentState:"+activeChar.getCurrentState());  //for debug
     
      // If Alternate rule Karma punishment is set to true, forbid skill Return to player with Karma
      if (skill.getSkillType() == SkillType.RECALL && !Config.ALT_GAME_KARMA_PLAYER_CAN_TELEPORT && activeChar.getKarma() > 0)
        return;
     
      // players mounted on pets cannot use any toggle skills
      if (skill.isToggle() && activeChar.isMounted())
        return;
      // activeChar.stopMove();
     
      //final L2Object target = activeChar.getTarget();
      //if(target!=null && target instanceof L2Character)
View Full Code Here


    {
      return;
    }
   
    boolean canteach = false;
    L2Skill skill = SkillTable.getInstance().getInfo(_id, _level);
    if(skill == null)
    {
      if(Config.DEBUG)
      {
        _log.warning("skill id " + _id + " level " + _level + " is undefined. aquireSkillInfo failed.");
      }
      return;
    }

    if(_skillType == 0)
    {
      if(!trainer.getTemplate().canTeach(activeChar.getSkillLearningClassId()))
        return; // cheater

      L2SkillLearn[] skills = SkillTreeTable.getInstance().getAvailableSkills(activeChar, activeChar.getSkillLearningClassId());

      for(L2SkillLearn s : skills)
      {
        if(s.getId() == _id && s.getLevel() == _level)
        {
          canteach = true;
          break;
        }
      }

      if(!canteach)
        return; // cheater

      int requiredSp = SkillTreeTable.getInstance().getSkillCost(activeChar, skill);
      AquireSkillInfo asi = new AquireSkillInfo(skill.getId(), skill.getLevel(), requiredSp, 0);

      int spbId = -1;
      if(Config.DIVINE_SP_BOOK_NEEDED && skill.getId() == L2Skill.SKILL_DIVINE_INSPIRATION)
      {
        spbId = SkillSpellbookTable.getInstance().getBookForSkill(skill, _level);
      }
      else if(Config.SP_BOOK_NEEDED && skill.getLevel() == 1)
      {
        spbId = SkillSpellbookTable.getInstance().getBookForSkill(skill);
      }

      if(spbId > -1)
      {
        asi.addRequirement(99, spbId, 1, 50);
      }

      sendPacket(asi);
    }
    else if(_skillType == 2)
    {
      int requiredRep = 0;
      int itemId = 0;
      L2PledgeSkillLearn[] skills = SkillTreeTable.getInstance().getAvailablePledgeSkills(activeChar);

      for(L2PledgeSkillLearn s : skills)
      {
        if(s.getId() == _id && s.getLevel() == _level)
        {
          canteach = true;
          requiredRep = s.getRepCost();
          itemId = s.getItemId();
          break;
        }
      }

      if(!canteach)
        return; // cheater

      AquireSkillInfo asi = new AquireSkillInfo(skill.getId(), skill.getLevel(), requiredRep, 2);

      if(Config.LIFE_CRYSTAL_NEEDED)
      {
        asi.addRequirement(1, itemId, 1, 0);
      }

      sendPacket(asi);
    }
    else
    // Common Skills
    {
      int costid = 0;
      int costcount = 0;
      int spcost = 0;

      L2SkillLearn[] skillsc = SkillTreeTable.getInstance().getAvailableSkills(activeChar);

      for(L2SkillLearn s : skillsc)
      {
        L2Skill sk = SkillTable.getInstance().getInfo(s.getId(), s.getLevel());

        if(sk == null || sk != skill)
        {
          continue;
        }
View Full Code Here

      return;
    }
   
    boolean canteach = false;
   
    L2Skill skill = SkillTable.getInstance().getInfo(_skillId, _skillLvl);
    if(skill == null || skill.getId() != _skillId)
      return;

    if(!trainer.getTemplate().canTeach(activeChar.getClassId()))
      return; // cheater

    L2EnchantSkillLearn[] skills = SkillTreeTable.getInstance().getAvailableEnchantSkills(activeChar);

    for(L2EnchantSkillLearn s : skills)
    {
      if(s.getId() == _skillId && s.getLevel() == _skillLvl)
      {
        canteach = true;
        break;
      }
    }

    if(!canteach)
      return; // cheater

    int requiredSp = SkillTreeTable.getInstance().getSkillSpCost(activeChar, skill);
    int requiredExp = SkillTreeTable.getInstance().getSkillExpCost(activeChar, skill);
    byte rate = SkillTreeTable.getInstance().getSkillRate(activeChar, skill);
    ExEnchantSkillInfo asi = new ExEnchantSkillInfo(skill.getId(), skill.getLevel(), requiredSp, requiredExp, rate);

    if(Config.ES_SP_BOOK_NEEDED && (skill.getLevel() == 101 || skill.getLevel() == 141)) // only first lvl requires book
    {
      int spbId = 6622;
      asi.addRequirement(4, spbId, 1, 0);
    }
    sendPacket(asi);
View Full Code Here

      sendPacket(ActionFailed.STATIC_PACKET);
      return;
    }

    // Get the L2Skill template corresponding to the skillID received from the client
    L2Skill skill = SkillTable.getInstance().getInfo(_skillId, level);

    if(skill != null)
    {
      activeChar.setCurrentSkillWorldPosition(new Point3D(_x, _y, _z));
View Full Code Here

    if(player.getSkillLevel(_id) >= _level)
      // already knows the skill with this level
      return;

    L2Skill skill = SkillTable.getInstance().getInfo(_id, _level);

    int counts = 0;
    int _requiredSp = 10000000;

    if(_skillType == 0)
    {

      L2SkillLearn[] skills = SkillTreeTable.getInstance().getAvailableSkills(player, player.getSkillLearningClassId());

      for(L2SkillLearn s : skills)
      {
        L2Skill sk = SkillTable.getInstance().getInfo(s.getId(), s.getLevel());
        if(sk == null || sk != skill || !sk.getCanLearn(player.getSkillLearningClassId()) || !sk.canTeachBy(npcid))
        {
          continue;
        }
        counts++;
        _requiredSp = SkillTreeTable.getInstance().getSkillCost(player, skill);
      }

      if(counts == 0 && !Config.ALT_GAME_SKILL_LEARN)
      {
        player.sendMessage("You are trying to learn skill that u can't..");
        Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " tried to learn skill that he can't!!!", IllegalPlayerAction.PUNISH_KICK);
        return;
      }

      if(player.getSp() >= _requiredSp)
      {
        int spbId = -1;
        // divine inspiration require book for each level
        if(Config.DIVINE_SP_BOOK_NEEDED && skill.getId() == L2Skill.SKILL_DIVINE_INSPIRATION)
        {
          spbId = SkillSpellbookTable.getInstance().getBookForSkill(skill, _level);
        }
        else if(Config.SP_BOOK_NEEDED && skill.getLevel() == 1)
        {
          spbId = SkillSpellbookTable.getInstance().getBookForSkill(skill);
        }

        // spellbook required
        if(spbId > -1)
        {
          L2ItemInstance spb = player.getInventory().getItemByItemId(spbId);

          if(spb == null)
          {
            // Haven't spellbook
            player.sendPacket(new SystemMessage(SystemMessageId.ITEM_MISSING_TO_LEARN_SKILL));
            return;
          }

          // ok
          player.destroyItem("Consume", spb, trainer, true);
        }
      }
      else
      {
        SystemMessage sm = new SystemMessage(SystemMessageId.NOT_ENOUGH_SP_TO_LEARN_SKILL);
        player.sendPacket(sm);

        return;
      }
    }
    else if(_skillType == 1)
    {
      int costid = 0;
      int costcount = 0;
      // Skill Learn bug Fix
      L2SkillLearn[] skillsc = SkillTreeTable.getInstance().getAvailableSkills(player);

      for(L2SkillLearn s : skillsc)
      {
        L2Skill sk = SkillTable.getInstance().getInfo(s.getId(), s.getLevel());

        if(sk == null || sk != skill)
        {
          continue;
        }

        counts++;
        costid = s.getIdCost();
        costcount = s.getCostCount();
        _requiredSp = s.getSpCost();
      }

      if(counts == 0)
      {
        player.sendMessage("You are trying to learn skill that u can't..");
        Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " tried to learn skill that he can't!!!", IllegalPlayerAction.PUNISH_KICK);
        return;
      }

      if(player.getSp() >= _requiredSp)
      {
        if(!player.destroyItemByItemId("Consume", costid, costcount, trainer, false))
        {
          // Haven't spellbook
          player.sendPacket(new SystemMessage(SystemMessageId.ITEM_MISSING_TO_LEARN_SKILL));
          return;
        }

        SystemMessage sm = new SystemMessage(SystemMessageId.DISSAPEARED_ITEM);
        sm.addNumber(costcount);
        sm.addItemName(costid);
        sendPacket(sm);
      }
      else
      {
        SystemMessage sm = new SystemMessage(SystemMessageId.NOT_ENOUGH_SP_TO_LEARN_SKILL);
        player.sendPacket(sm);
        return;
      }
    }
    else if(_skillType == 2) //pledgeskills TODO: Find appropriate system messages.
    {
      if(!player.isClanLeader())
      {
        // TODO: Find and add system msg
        player.sendMessage("This feature is available only for the clan leader");
        return;
      }

      int itemId = 0;
      int repCost = 100000000;
      // Skill Learn bug Fix
      L2PledgeSkillLearn[] skills = SkillTreeTable.getInstance().getAvailablePledgeSkills(player);

      for(L2PledgeSkillLearn s : skills)
      {
        L2Skill sk = SkillTable.getInstance().getInfo(s.getId(), s.getLevel());

        if(sk == null || sk != skill)
        {
          continue;
        }
View Full Code Here

    while(skills.length > unLearnable)
    {
      for(L2SkillLearn s : skills)
      {
        L2Skill sk = SkillTable.getInstance().getInfo(s.getId(), s.getLevel());

        if(sk == null || !sk.getCanLearn(player.getClassId()))
        {
          if(countUnlearnable)
          {
            unLearnable++;
          }

          continue;
        }

        if(player.getSkillLevel(sk.getId()) == -1)
        {
          skillCounter++;
        }

        player.addSkill(sk, true);
View Full Code Here

    {
      showMainPage(activeChar);
    }
    else
    {
      L2Skill skill = null;

      try
      {
        String id = st.nextToken();
        String level = st.nextToken();

        int idval = Integer.parseInt(id);
        int levelval = Integer.parseInt(level);

        skill = SkillTable.getInstance().getInfo(idval, levelval);

        level = null;
        id = null;
      }
      catch(Exception e)
      {
        if(Config.ENABLE_ALL_EXCEPTIONS)
          e.printStackTrace();
      }

      if(skill != null)
      {
        String name = skill.getName();
        player.sendMessage("Admin gave you the skill " + name + ".");
        player.addSkill(skill, true);
        //Admin information
        activeChar.sendMessage("You gave the skill " + name + " to " + player.getName() + ".");
View Full Code Here

    {
      activeChar.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));
      return;
    }

    L2Skill skill = SkillTable.getInstance().getInfo(idval, player.getSkillLevel(idval));

    if(skill != null)
    {
      String skillname = skill.getName();
      player.sendMessage("Admin removed the skill " + skillname + " from your skills list.");
      player.removeSkill(skill);
      //Admin information 
      activeChar.sendMessage("You removed the skill " + skillname + " from " + player.getName() + ".");
View Full Code Here

      showMainPage(activeChar);

      return;
    }
   
    L2Skill skill = SkillTable.getInstance().getInfo(id, level);
    if(skill != null)
    {
      String skillname = skill.getName();
      SystemMessage sm = new SystemMessage(SystemMessageId.CLAN_SKILL_S1_ADDED);
      sm.addSkillName(id);
      player.sendPacket(sm);
      player.getClan().broadcastToOnlineMembers(sm);
      player.getClan().addNewSkill(skill);
View Full Code Here

      else if (currentCommand.startsWith("magebuff"))
      {
        ArrayList<L2Skill> skills_to_buff = new ArrayList<L2Skill>();
        for(int skillId:PowerPakConfig.MAGE_SKILL_LIST.keySet())
        {
            L2Skill skill = SkillTable.getInstance().getInfo(skillId, PowerPakConfig.MAGE_SKILL_LIST.get(skillId));
            if(skill!=null)
            {
              skills_to_buff.add(skill);
            }
           
          }
         
        }
        else if(currentCommand.startsWith("fighterbuff"))
        {
          ArrayList<L2Skill> skills_to_buff = new ArrayList<L2Skill>();
          for(int skillId:PowerPakConfig.FIGHTER_SKILL_LIST.keySet())
          {
            L2Skill skill = SkillTable.getInstance().getInfo(skillId, PowerPakConfig.FIGHTER_SKILL_LIST.get(skillId));
            if(skill!=null)
            {
              skills_to_buff.add(skill);
            }
          }
View Full Code Here

TOP

Related Classes of com.l2jfrozen.gameserver.model.L2Skill

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.