Package com.l2jfrozen.gameserver.model

Examples of com.l2jfrozen.gameserver.model.L2Skill


    AquireSkillList asl = new AquireSkillList(AquireSkillList.skillType.Usual);
    int counts = 0;
   
    for (L2SkillLearn s : skills)
    {
      L2Skill sk = SkillTable.getInstance().getInfo(s.getId(), s.getLevel());
     
      if (sk == null || !sk.getCanLearn(player.getClassId()) || !sk.canTeachBy(npcId))
      {
        continue;
      }
     
      int cost = SkillTreeTable.getInstance().getSkillCost(player, sk);
View Full Code Here


    ExEnchantSkillList esl = new ExEnchantSkillList();
    int counts = 0;
   
    for (L2EnchantSkillLearn s : skills)
    {
      L2Skill sk = SkillTable.getInstance().getInfo(s.getId(), s.getLevel());
      if (sk == null)
      {
        continue;
      }
      counts++;
View Full Code Here

      if(_skill != null)
        skill2 = _skill;
    }
   
    final L2Skill skill = skill2;
    if(skill == null){
      return;
    }
   
    boolean bss = activeChar.checkBss();
    boolean sps = activeChar.checkSps();
    boolean ss = activeChar.checkSs();
   
    for(final L2Object target2 : targets)
    {
      L2Character target = (L2Character) target2;

      if(target == null){
        continue;
      }
     
      if(target instanceof L2PcInstance && activeChar instanceof L2PlayableInstance && skill.isOffensive())
      {
        L2PcInstance _char = (activeChar instanceof L2PcInstance)?(L2PcInstance)activeChar:((L2Summon)activeChar).getOwner();
        L2PcInstance _attacked = (L2PcInstance) target;
        if(_attacked.getClanId()!=0 && _char.getClanId()!=0 &&
           _attacked.getClanId() == _char.getClanId() && _attacked.getPvpFlag()==0)
          continue;
        if(_attacked.getAllyId()!=0 && _char.getAllyId()!=0 &&
           _attacked.getAllyId()==_char.getAllyId() && _attacked.getPvpFlag()==0)
          continue;
      }

      if(skill.getSkillType() != L2Skill.SkillType.BUFF && skill.getSkillType() != L2Skill.SkillType.HOT && skill.getSkillType() != L2Skill.SkillType.CPHOT && skill.getSkillType() != L2Skill.SkillType.MPHOT && skill.getSkillType() != L2Skill.SkillType.UNDEAD_DEFENSE && skill.getSkillType() != L2Skill.SkillType.AGGDEBUFF && skill.getSkillType() != L2Skill.SkillType.CONT)
      {
        if(target.reflectSkill(skill))
          target = activeChar;
      }

      // Walls and Door should not be buffed
      if(target instanceof L2DoorInstance && (skill.getSkillType() == L2Skill.SkillType.BUFF || skill.getSkillType() == L2Skill.SkillType.HOT))
        continue;

      // Anti-Buff Protection prevents you from getting buffs by other players
      if (activeChar instanceof L2PlayableInstance && target != activeChar && target.isBuffProtected() && !skill.isHeroSkill()
            && (skill.getSkillType() == L2Skill.SkillType.BUFF
            || skill.getSkillType() == L2Skill.SkillType.HEAL_PERCENT
          || skill.getSkillType() == L2Skill.SkillType.FORCE_BUFF
          || skill.getSkillType() == L2Skill.SkillType.MANAHEAL_PERCENT
          || skill.getSkillType() == L2Skill.SkillType.COMBATPOINTHEAL
          || skill.getSkillType() == L2Skill.SkillType.REFLECT))
          continue;
     
      // Player holding a cursed weapon can't be buffed and can't buff
      if(skill.getSkillType() == L2Skill.SkillType.BUFF)
      {
        if(target != activeChar)
        {
          if(target instanceof L2PcInstance && ((L2PcInstance) target).isCursedWeaponEquiped())
            continue;
          else if(player != null && player.isCursedWeaponEquiped())
            continue;
        }
      }

      //Possibility of a lethal strike
      if(!target.isRaid() && !(target instanceof L2NpcInstance && ((L2NpcInstance) target).getNpcId() == 35062))
      {
        int chance = Rnd.get(100);
        Formulas.getInstance();
        if(skill.getLethalChance2() > 0 && chance < Formulas.calcLethal(activeChar, target, skill.getLethalChance2()))
        {
          if(target instanceof L2NpcInstance)
          {
            target.reduceCurrentHp(target.getCurrentHp() - 1, activeChar);
            activeChar.sendPacket(new SystemMessage(SystemMessageId.LETHAL_STRIKE));
          }
        }
        else
        {
          Formulas.getInstance();
          if(skill.getLethalChance1() > 0 && chance < Formulas.calcLethal(activeChar, target, skill.getLethalChance1()))
          {
            if(target instanceof L2NpcInstance)
            {
              target.reduceCurrentHp(target.getCurrentHp() / 2, activeChar);
              activeChar.sendPacket(new SystemMessage(SystemMessageId.LETHAL_STRIKE));
            }
          }
        }
      }

      if(skill.isOffensive())
      {
       
        boolean acted = Formulas.getInstance().calcSkillSuccess(activeChar, target, skill, ss, sps, bss);

        if(!acted)
        {
          activeChar.sendPacket(new SystemMessage(SystemMessageId.ATTACK_FAILED));
          continue;
        }

      }
      else if(skill.getSkillType() == L2Skill.SkillType.BUFF)
      {
        if(!Formulas.getInstance().calcBuffSuccess(target, skill))
        {
          if(player!=null)
          {
            SystemMessage sm = new SystemMessage(SystemMessageId.S1_WAS_UNAFFECTED_BY_S2);
            sm.addString(target.getName());
            sm.addSkillName(skill.getDisplayId());
            activeChar.sendPacket(sm);
          }
          continue;
        }
      }
     


      if(skill.isToggle()){

        boolean stopped = false;
       
              L2Effect[] effects = target.getAllEffects();
              if(effects != null)
              {
                for(L2Effect e : effects)
                {
                  if(e != null)
                    if(e.getSkill().getId() == skill.getId())
                    {
                      e.exit(false);
                      stopped = true;
                    }
                }
              }
             
             
        if(stopped)
          break;
      }
       

      // If target is not in game anymore...
      if((target instanceof L2PcInstance) && ((L2PcInstance) target).isOnline()==0)
        continue;
     

      // if this is a debuff let the duel manager know about it
      // so the debuff can be removed after the duel
      // (player & target must be in the same duel)
      if(target instanceof L2PcInstance && player != null
          && ((L2PcInstance) target).isInDuel()
          && (skill.getSkillType() == L2Skill.SkillType.DEBUFF
            || skill.getSkillType() == L2Skill.SkillType.BUFF)
          && player.getDuelId() == ((L2PcInstance) target).getDuelId())
      {
        DuelManager dm = DuelManager.getInstance();
        if(dm!=null)
        {
          L2Effect[] effects = skill.getEffects(activeChar, target, ss, sps, bss);
          if(effects!=null)
            for(L2Effect buff : effects)
              if(buff != null)
                dm.onBuff(((L2PcInstance) target), buff);
        }
        dm = null;
      }
      else
        skill.getEffects(activeChar, target, ss, sps, bss);

      if(skill.getSkillType() == L2Skill.SkillType.AGGDEBUFF)
      {
        if(target instanceof L2Attackable)
          target.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, activeChar, (int) skill.getPower());
        else if(target instanceof L2PlayableInstance)
        {
          if(target.getTarget() == activeChar)
            target.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, activeChar);
          else
            target.setTarget(activeChar);
        }
      }

      if(target.isDead() && skill.getTargetType() == L2Skill.SkillTargetType.TARGET_AREA_CORPSE_MOB && target instanceof L2NpcInstance)
      {
        ((L2NpcInstance) target).endDecayTask();
      }
    }
   
    if(!skill.isToggle()){
     
      if (skill.isMagic())
      {
        if (bss){
          activeChar.removeBss();
        }else if(sps){
          activeChar.removeSps();
        }
       
      }else{
       
        activeChar.removeSs();
       
      }
     
    }
   
    player = null;
   
//    // self Effect :]
//    L2Effect effect = activeChar.getFirstEffect(skill.getId());
//    if(effect != null && effect.isSelfEffect())
//    {
//      //Replace old effect with new one.
//      effect.exit(false);
//    }
    skill.getEffectsSelf(activeChar);

//    effect = null;
  }
View Full Code Here

    activeChar = null;
  }

  public void useScroll(L2PcInstance activeChar, int magicId, int level)
  {
    L2Skill skill = SkillTable.getInstance().getInfo(magicId, level);
    if(skill != null)
    {
      activeChar.doCast(skill);
    }
  }
View Full Code Here

  }

  // Check bleeding player.
  protected void addBleeding()
  {
    L2Skill bleed = SkillTable.getInstance().getInfo(4615, 12);

    for(L2NpcInstance tr : _triolRevelation)
    {
      if(!tr.getKnownList().getKnownPlayersInRadius(tr.getAggroRange()).iterator().hasNext() || tr.isDead())
      {
        continue;
      }

      List<L2PcInstance> bpc = new FastList<L2PcInstance>();

      for(L2PcInstance pc : tr.getKnownList().getKnownPlayersInRadius(tr.getAggroRange()))
      {
        if(pc.getFirstEffect(bleed) == null)
        {
          bleed.getEffects(tr, pc, false, false, false);
          tr.broadcastPacket(new MagicSkillUser(tr, pc, bleed.getId(), 12, 1, 1));
        }

        bpc.add(pc);
      }
      _bleedingPlayers.remove(tr.getNpcId());
View Full Code Here

        //Set HP/CP/MP to Max
        player.setCurrentCp(player.getMaxCp());
        player.setCurrentHp(player.getMaxHp());
        player.setCurrentMp(player.getMaxMp());
        //Wind Walk Buff for Both
        L2Skill skill;
        SystemMessage sm;
        skill = SkillTable.getInstance().getInfo(1204, 2);
        skill.getEffects(player, player);
        player.broadcastPacket(new MagicSkillUser(player, player, skill.getId(), 2, skill.getHitTime(), 0));
        sm = new SystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
        sm.addSkillName(1204);
        player.sendPacket(sm);
        if (!player.isMageClass())
        {
          //Haste Buff to Fighters
          skill = SkillTable.getInstance().getInfo(1086, 1);
          skill.getEffects(player, player);
          player.broadcastPacket(new MagicSkillUser(player, player, skill.getId(), 1, skill.getHitTime(), 0));
          sm = new SystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
          sm.addSkillName(1086);
          player.sendPacket(sm);
        }
        else
        {
          //Acumen Buff to Mages
          skill = SkillTable.getInstance().getInfo(1085, 1);
          skill.getEffects(player, player);
          player.broadcastPacket(new MagicSkillUser(player, player, skill.getId(), 1, skill.getHitTime(), 0));
          sm = new SystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
          sm.addSkillName(1085);
          player.sendPacket(sm);
        }
      }
View Full Code Here

    }

    @Override
    public void run()
    {
      L2Skill fp = SkillTable.getInstance().getInfo(4616, 1); // Invulnerable  by petrification
      fp.getEffects(activeChar, activeChar,false,false,false);
    }
View Full Code Here

    {
      _activeChar.sendPacket(ActionFailed.STATIC_PACKET);
      return;
    }

    L2Skill skill = SkillTable.getInstance().getInfo(2098, 1); //harvesting skill
    _activeChar.useMagic(skill, false, false);
  }
View Full Code Here

        {
          activeChar.sendPacket(new SystemMessage(SystemMessageId.EFFECT_S1_DISAPPEARED).addSkillName(7029));
        }
        else if(val >= 1 && val <= 4)
        {
          L2Skill gmSpeedSkill = SkillTable.getInstance().getInfo(7029, val);
          activeChar.doCast(gmSpeedSkill);
        }
      }
      catch(Exception e)
      {
        if(Config.ENABLE_ALL_EXCEPTIONS)
        e.printStackTrace();
     
        activeChar.sendMessage("Use //gmspeed value (0=off...4=max).");
      }
      finally
      {
        activeChar.updateEffectIcons();
      }
    }

    else if(command.startsWith("admin_polyself"))
    {
      try
      {
        String id = st.nextToken();

        activeChar.getPoly().setPolyInfo("npc", id);
        activeChar.teleToLocation(activeChar.getX(), activeChar.getY(), activeChar.getZ(), false);

        CharInfo info1 = new CharInfo(activeChar);
        activeChar.broadcastPacket(info1);
        UserInfo info2 = new UserInfo(activeChar);
        activeChar.sendPacket(info2);

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

    else if(command.startsWith("admin_unpolyself"))
    {
      try
      {
        activeChar.getPoly().setPolyInfo(null, "1");
        activeChar.decayMe();
        activeChar.spawnMe(activeChar.getX(), activeChar.getY(), activeChar.getZ());

        CharInfo info1 = new CharInfo(activeChar);
        activeChar.broadcastPacket(info1);
        UserInfo info2 = new UserInfo(activeChar);
        activeChar.sendPacket(info2);

        info1 = null;
        info2 = null;
      }
      catch(Exception e)
      {
        if(Config.ENABLE_ALL_EXCEPTIONS)
          e.printStackTrace();
      }
    }

    else if(command.equals("admin_clear_teams"))
    {
      try
      {
        for(L2PcInstance player : activeChar.getKnownList().getKnownPlayers().values())
        {
          player.setTeam(0);
          player.broadcastUserInfo();
        }
      }
      catch(Exception e)
      {
        if(Config.ENABLE_ALL_EXCEPTIONS)
          e.printStackTrace();
      }
    }

    else if(command.startsWith("admin_setteam_close"))
    {
      try
      {
        String val = st.nextToken();

        int teamVal = Integer.parseInt(val);

        for(L2PcInstance player : activeChar.getKnownList().getKnownPlayers().values())
        {
          if(activeChar.isInsideRadius(player, 400, false, true))
          {
            player.setTeam(0);

            if(teamVal != 0)
            {
              SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
              sm.addString("You have joined team " + teamVal);
              player.sendPacket(sm);
              sm = null;
            }

            player.broadcastUserInfo();
          }
        }

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

    else if(command.startsWith("admin_setteam"))
    {
      String val = command.substring(14);

      int teamVal = Integer.parseInt(val);

      L2Object target = activeChar.getTarget();
      L2PcInstance player = null;

      if(target instanceof L2PcInstance)
      {
        player = (L2PcInstance) target;
      }
      else
        return false;

      player.setTeam(teamVal);

      if(teamVal != 0)
      {
        SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
        sm.addString("You have joined team " + teamVal);
        player.sendPacket(sm);
        sm = null;
      }

      player.broadcastUserInfo();

      val = null;
      target = null;
      player = null;
    }

    else if(command.startsWith("admin_social"))
    {
      try
      {
        String target = null;
        L2Object obj = activeChar.getTarget();

        if(st.countTokens() == 2)
        {
          int social = Integer.parseInt(st.nextToken());

          target = st.nextToken();

          if(target != null)
          {
            L2PcInstance player = L2World.getInstance().getPlayer(target);

            if(player != null)
            {
              if(performSocial(social, player, activeChar))
              {
                activeChar.sendMessage(player.getName() + " was affected by your request.");
              }
            }
            else
            {
              try
              {
                int radius = Integer.parseInt(target);

                for(L2Object object : activeChar.getKnownList().getKnownObjects().values())
                  if(activeChar.isInsideRadius(object, radius, false, false))
                  {
                    performSocial(social, object, activeChar);
                  }

                activeChar.sendMessage(radius + " units radius affected by your request.");
              }
              catch(NumberFormatException nbe)
              {
                if(Config.ENABLE_ALL_EXCEPTIONS)
                  nbe.printStackTrace();
               
                activeChar.sendMessage("Incorrect parameter");
              }
            }

            player = null;
          }
        }
        else if(st.countTokens() == 1)
        {
          int social = Integer.parseInt(st.nextToken());

          if(obj == null)
          {
            obj = activeChar;
          }

          if(performSocial(social, obj, activeChar))
          {
            activeChar.sendMessage(obj.getName() + " was affected by your request.");
          }
          else
          {
            activeChar.sendPacket(new SystemMessage(SystemMessageId.NOTHING_HAPPENED));
          }
        }
        else if(!command.contains("menu"))
        {
          activeChar.sendMessage("Usage: //social <social_id> [player_name|radius]");
        }

        target = null;
        obj = null;
      }
      catch(Exception e)
      {
        if(Config.ENABLE_ALL_EXCEPTIONS)
          e.printStackTrace();
      }
    }

    else if(command.startsWith("debuff"))
    {
      try
      {
        L2Object target = activeChar.getTarget();
        L2Character player = null;

        if(target instanceof L2Character)
        {
          player = (L2Character) target;
          player.stopAllEffects();
          activeChar.sendMessage("Effects has been cleared from " + player + ".");
        }

        target = null;
        player = null;
      }
      catch(Exception e)
      {
        if(Config.ENABLE_ALL_EXCEPTIONS)
          e.printStackTrace();
      }
    }

    else if(command.startsWith("admin_abnormal"))
    {
      try
      {
        String target = null;
        L2Object obj = activeChar.getTarget();

        if(st.countTokens() == 2)
        {
          String parm = st.nextToken();

          int abnormal = Integer.decode("0x" + parm);

          target = st.nextToken();

          if(target != null)
          {
            L2PcInstance player = L2World.getInstance().getPlayer(target);

            if(player != null)
            {
              if(performAbnormal(abnormal, player))
              {
                activeChar.sendMessage(player.getName() + "'s abnormal status was affected by your request.");
              }
              else
              {
                activeChar.sendPacket(new SystemMessage(SystemMessageId.NOTHING_HAPPENED));
              }
            }
            else
            {
              try
              {
                int radius = Integer.parseInt(target);

                for(L2Object object : activeChar.getKnownList().getKnownObjects().values())
                  if(activeChar.isInsideRadius(object, radius, false, false))
                  {
                    performAbnormal(abnormal, object);
                  }

                activeChar.sendMessage(radius + " units radius affected by your request.");
              }
              catch(NumberFormatException nbe)
              {
                if(Config.ENABLE_ALL_EXCEPTIONS)
                  nbe.printStackTrace();
               
                activeChar.sendMessage("Usage: //abnormal <hex_abnormal_mask> [player|radius]");
              }
            }

            player = null;
          }

          parm = null;
        }
        else if(st.countTokens() == 1)
        {
          int abnormal = Integer.decode("0x" + st.nextToken());

          if(obj == null)
          {
            obj = activeChar;
          }
         
          if(performAbnormal(abnormal, obj))
          {
            activeChar.sendMessage(obj.getName() + "'s abnormal status was affected by your request.");
          }
          else
          {
            activeChar.sendPacket(new SystemMessage(SystemMessageId.NOTHING_HAPPENED));
          }
        }
        else if(!command.contains("menu"))
        {
          activeChar.sendMessage("Usage: //abnormal <abnormal_mask> [player_name|radius]");
        }

        target = null;
        obj = null;
      }
      catch(Exception e)
      {
        if(Config.ENABLE_ALL_EXCEPTIONS)
          e.printStackTrace();
      }
    }
     else if(command.startsWith("admin_adminspeed"))
    {
                try
                {
                  int val = Integer.parseInt(st.nextToken());
                 boolean sendMessage = activeChar.getFirstEffect(10000) != null;
                
                         activeChar.stopSkillEffects(10000);
                
                         if(val == 0 && sendMessage)
                         {
                           activeChar.sendPacket(new SystemMessage(SystemMessageId.EFFECT_S1_DISAPPEARED).addSkillName(10000));
                         }
                         else if(val >= 1 && val <= 4)
                         {
                           L2Skill gmSpeedSkill = SkillTable.getInstance().getInfo(10000, val);
                           activeChar.doCast(gmSpeedSkill);
                         }
                       }
                       catch(Exception e)
                       {
View Full Code Here

    activeChar = null;
  }

  public void useFw(L2PcInstance activeChar, int magicId, int level)
  {
    L2Skill skill = SkillTable.getInstance().getInfo(magicId, level);
    if(skill != null)
    {
      activeChar.useMagic(skill, false, false);
    }
    skill = null;
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.