Package net.sf.l2j.gameserver.model

Examples of net.sf.l2j.gameserver.model.L2Summon


        return;
    }

    private void thinkCast()
    {
        L2Summon summon = (L2Summon) _actor;
        if (checkTargetLost(getCastTarget()))
        {
            setCastTarget(null);
            return;
        }
        if (maybeMoveToPawn(getCastTarget(), _actor.getMagicalAttackRange(_skill))) return;
        clientStopMoving(null);
        summon.setFollowStatus(false);
        setIntention(AI_INTENTION_IDLE);
        _accessor.doCast(_skill);
        return;
    }
View Full Code Here


        player.stopAllEffects();
       
        //Remove Summon's Buffs
        if (player.getPet() != null)
        {
          L2Summon summon = player.getPet();
          summon.stopAllEffects();
         
          if (summon instanceof L2PetInstance)
            summon.unSummon(player);
          }
               
                /*if (player.getCubics() != null)
                {
                    for(L2CubicInstance cubic : player.getCubics().values())
View Full Code Here

                    }
                }
                // If there is no weapon equipped, check for an active summon.
                else if (activeChar instanceof L2Summon)
                {
                    L2Summon activeSummon = (L2Summon)activeChar;

                    if (activeSummon.getChargedSpiritShot() == L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT)
                    {
                        hp *= 1.5;
                        activeSummon.setChargedSpiritShot(L2ItemInstance.CHARGED_NONE);
                    }
                    else if (activeSummon.getChargedSpiritShot() == L2ItemInstance.CHARGED_SPIRITSHOT)
                    {
                        hp *= 1.3;
                        activeSummon.setChargedSpiritShot(L2ItemInstance.CHARGED_NONE);
                    }
                }
            }

      //int cLev = activeChar.getLevel();
View Full Code Here

                      }
              }
            }
            else if (activeChar instanceof L2Summon)
            {
                L2Summon activeSummon = (L2Summon) activeChar;
              if (skill.isMagic())
              {
                  if (activeSummon.getChargedSpiritShot() == L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT)
                  {
                      bss = true;
                      activeSummon.setChargedSpiritShot(L2ItemInstance.CHARGED_NONE);
                  }
                  else if (activeSummon.getChargedSpiritShot() == L2ItemInstance.CHARGED_SPIRITSHOT)
                  {
                      sps = true;
                      activeSummon.setChargedSpiritShot(L2ItemInstance.CHARGED_NONE);
                  }
              }
                else
                  if (activeSummon.getChargedSoulShot() == L2ItemInstance.CHARGED_SOULSHOT)
                  {
                      ss = true;
                      activeSummon.setChargedSoulShot(L2ItemInstance.CHARGED_NONE);
                  }
            }

        boolean acted = Formulas.getInstance().calcSkillSuccess(activeChar, target, skill, ss, sps, bss);
        if (!acted) {
View Full Code Here

          _activeChar.sendPacket(new StaticObject((L2StaticObjectInstance) object));
        else if (object instanceof L2NpcInstance)
          _activeChar.sendPacket(new NpcInfo((L2NpcInstance) object, _activeChar));
        else if (object instanceof L2Summon)
        {
          L2Summon summon = (L2Summon) object;

          // Check if the L2PcInstance is the owner of the Pet
          if (_activeChar.equals(summon.getOwner()))
          {
            _activeChar.sendPacket(new PetInfo(summon));

            if (summon instanceof L2PetInstance)
              _activeChar.sendPacket(new PetItemList((L2PetInstance) summon));
          }
          else
            _activeChar.sendPacket(new NpcInfo(summon, _activeChar));

          // The PetInfo packet wipes the PartySpelled (list of active spells' icons).  Re-add them
          summon.updateEffectIcons(true);
        }
               else if (object instanceof L2PcInstance)
        {
          L2PcInstance otherPlayer = (L2PcInstance) object;
View Full Code Here

    {
      getClient().sendPacket(new ActionFailed());
      return;
    }

    L2Summon pet = activeChar.getPet();
    L2Object target = activeChar.getTarget();

    if (Config.DEBUG)
      _log.info("Requested Action ID: " + String.valueOf(_actionId));

    switch (_actionId)
    {
    case 0:
      if (activeChar.getMountType() != 0)
        break;

      if (target != null
          && !activeChar.isSitting()
          && target instanceof L2StaticObjectInstance
          && ((L2StaticObjectInstance)target).getType() == 1
          && CastleManager.getInstance().getCastle(target) != null
          && activeChar.isInsideRadius(target, L2StaticObjectInstance.INTERACTION_DISTANCE, false, false)
      )
      {
        ChairSit cs = new ChairSit(activeChar,((L2StaticObjectInstance)target).getStaticObjectId());
        activeChar.sendPacket(cs);
        activeChar.sitDown();
        activeChar.broadcastPacket(cs);
        break;
      }

      if (activeChar.isSitting())
        activeChar.standUp();
      else
        activeChar.sitDown();

      if (Config.DEBUG)
        _log.fine("new wait type: "+(activeChar.isSitting() ? "SITTING" : "STANDING"));

      break;
    case 1:
      if (activeChar.isRunning())
        activeChar.setWalking();
      else
        activeChar.setRunning();

      if (Config.DEBUG)
        _log.fine("new move type: "+(activeChar.isRunning() ? "RUNNING" : "WALKIN"));
      break;
    case 15:
    case 21: // pet follow/stop
      if (pet != null && !pet.isMovementDisabled() && !activeChar.isBetrayed())
        pet.setFollowStatus(!pet.getFollowStatus());

      break;
    case 16:
    case 22: // pet attack
      if (target != null && pet != null && pet != target && !pet.isAttackingDisabled() && !activeChar.isBetrayed())
      {
        if (activeChar.isInOlympiadMode() && !activeChar.isOlympiadStart()){
          // if L2PcInstance is in Olympia and the match isn't already start, send a Server->Client packet ActionFailed
          activeChar.sendPacket(new ActionFailed());
          return;
        }

        if (activeChar.getAccessLevel() < Config.GM_PEACEATTACK &&
            activeChar.isInsidePeaceZone(pet, target))
        {
          activeChar.sendPacket(new SystemMessage(SystemMessageId.TARGET_IN_PEACEZONE));
          return;
        }

        if (target.isAutoAttackable(activeChar) || _ctrlPressed)
        {
          if (target instanceof L2DoorInstance)
          {
            if(((L2DoorInstance)target).isAttackable(activeChar) && pet.getNpcId() != L2SiegeSummonInstance.SWOOP_CANNON_ID)
              pet.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
          }
          // siege golem AI doesn't support attacking other than doors at the moment
          else if (pet.getNpcId() != L2SiegeSummonInstance.SIEGE_GOLEM_ID)
            pet.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
        }
      }
      break;
    case 17:
    case 23: // pet - cancel action
      if (pet != null && !pet.isMovementDisabled() && !activeChar.isBetrayed())
        pet.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, null);

      break;
    case 19: // pet unsummon
      if (pet != null && !activeChar.isBetrayed())
      {
        //returns pet to control item
        if (pet.isDead())
        {
          activeChar.sendPacket(new SystemMessage(SystemMessageId.DEAD_PET_CANNOT_BE_RETURNED));
        }
        else if (pet.isAttackingNow() || pet.isRooted())
        {
          activeChar.sendPacket(new SystemMessage(SystemMessageId.PET_CANNOT_SENT_BACK_DURING_BATTLE));
        }
        else
        {
          // if it is a pet and not a summon
          if (pet instanceof L2PetInstance)
          {
            L2PetInstance petInst = (L2PetInstance)pet;

            // if the pet is more than 40% fed
            if (petInst.getCurrentFed() > (petInst.getMaxFed() * 0.40))
              pet.unSummon(activeChar);
            else
              activeChar.sendPacket(new SystemMessage(SystemMessageId.YOU_CANNOT_RESTORE_HUNGRY_PETS));
          }
        }
      }
      break;
    case 38: // pet mount
      // mount
      if (pet != null && pet.isMountable() && !activeChar.isMounted() && !activeChar.isBetrayed())
      {
        if (activeChar.isDead())
        {
          //A strider cannot be ridden when dead
          SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_CANT_BE_RIDDEN_WHILE_DEAD);
          activeChar.sendPacket(msg);
          msg = null;
        }
        else if (pet.isDead())
        {
          //A dead strider cannot be ridden.
          SystemMessage msg = new SystemMessage(SystemMessageId.DEAD_STRIDER_CANT_BE_RIDDEN);
          activeChar.sendPacket(msg);
          msg = null;
        }
        else if (pet.isInCombat() || pet.isRooted())
        {
          //A strider in battle cannot be ridden
          SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_IN_BATLLE_CANT_BE_RIDDEN);
          activeChar.sendPacket(msg);
          msg = null;
        }
        else if (activeChar.isInCombat())
        {
          //A strider cannot be ridden while in battle
          SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_CANT_BE_RIDDEN_WHILE_IN_BATTLE);
          activeChar.sendPacket(msg);
          msg = null;
        }
        else if (activeChar.isSitting() || activeChar.isMoving())
        {
          //A strider can be ridden only when standing
          SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_CAN_BE_RIDDEN_ONLY_WHILE_STANDING);
          activeChar.sendPacket(msg);
          msg = null;
        }
        else if (activeChar.isFishing())
        {
          //You can't mount, dismount, break and drop items while fishing
          SystemMessage msg = new SystemMessage(SystemMessageId.CANNOT_DO_WHILE_FISHING_2);
          activeChar.sendPacket(msg);
          msg = null;
        }
        else if (activeChar.isCursedWeaponEquiped())
        {
          //You can't mount, dismount, break and drop items while weilding a cursed weapon
          SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_CANT_BE_RIDDEN_WHILE_IN_BATTLE);
          activeChar.sendPacket(msg);
        }
        else if (!pet.isDead() && !activeChar.isMounted())
        {
          if(!activeChar.disarmWeapons()) return;
          Ride mount = new Ride(activeChar.getObjectId(), Ride.ACTION_MOUNT, pet.getTemplate().npcId);
          activeChar.broadcastPacket(mount);
          activeChar.setMountType(mount.getMountType());
          activeChar.setMountObjectID(pet.getControlItemId());
          pet.unSummon(activeChar);
        }
      }
      else if (activeChar.isRentedPet())
      {
        activeChar.stopRentPet();
      }
      else if (activeChar.isMounted())
      {
        if (activeChar.setMountType(0))
        {
          if (activeChar.isFlying())activeChar.removeSkill(SkillTable.getInstance().getInfo(4289, 1));
          Ride dismount = new Ride(activeChar.getObjectId(), Ride.ACTION_DISMOUNT, 0);
          activeChar.broadcastPacket(dismount);
          activeChar.setMountObjectID(0);
        }
      }
      break;
    case 32: // Wild Hog Cannon - Mode Change
      useSkill(4230);
      break;
    case 36: // Soulless - Toxic Smoke
      useSkill(4259);
      break;
    case 37:
      if (activeChar.isAlikeDead())
      {
        getClient().sendPacket(new ActionFailed());
        return;
      }
      if(activeChar.getPrivateStoreType() != 0){
        activeChar.setPrivateStoreType(L2PcInstance.STORE_PRIVATE_NONE);
        activeChar.broadcastUserInfo();
          }
      if (activeChar.isSitting())
        activeChar.standUp();

      if (activeChar.getCreateList() == null)
      {
        activeChar.setCreateList(new L2ManufactureList());
      }

      activeChar.sendPacket(new RecipeShopManageList(activeChar, true));
      break;
    case 39: // Soulless - Parasite Burst
    useSkill(4138);
    break;
    case 41: // Wild Hog Cannon - Attack
    useSkill(4230);
    break;
    case 42: // Kai the Cat - Self Damage Shield
    useSkill(4378, activeChar);
    break;
    case 43: // Unicorn Merrow - Hydro Screw
      useSkill(4137);
      break;
    case 44: // Big Boom - Boom Attack
      useSkill(4139);
      break;
    case 45: // Unicorn Boxer - Master Recharge
      useSkill(4025, activeChar);
      break;
    case 46: // Mew the Cat - Mega Storm Strike
      useSkill(4261);
      break;
    case 47: // Silhouette - Steal Blood
      useSkill(4260);
      break;
    case 48: // Mechanic Golem - Mech. Cannon
      useSkill(4068);
      break;
    case 51:
      // Player shouldn't be able to set stores if he/she is alike dead (dead or fake death)
      if (activeChar.isAlikeDead())
      {
        getClient().sendPacket(new ActionFailed());
        return;
      }
      if(activeChar.getPrivateStoreType() != 0){
        activeChar.setPrivateStoreType(L2PcInstance.STORE_PRIVATE_NONE);
        activeChar.broadcastUserInfo();
          }
      if (activeChar.isSitting())
        activeChar.standUp();

      if (activeChar.getCreateList() == null)
        activeChar.setCreateList(new L2ManufactureList());

      activeChar.sendPacket(new RecipeShopManageList(activeChar, false));
      break;
    case 52: // unsummon
      if (pet != null && pet instanceof L2SummonInstance)
        pet.unSummon(activeChar);
      break;
    case 53: // move to target
      if (target != null && pet != null && pet != target && !pet.isMovementDisabled())
      {
        pet.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO,
            new L2CharPosition(target.getX(),target.getY(), target.getZ(), 0 ));
      }
      break;
    case 54: // move to target hatch/strider
      if (target != null && pet != null && pet != target && !pet.isMovementDisabled())
      {
        pet.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO,
            new L2CharPosition(target.getX(),target.getY(), target.getZ(), 0 ));
      }
      break;
    case 96: // Quit Party Command Channel
      _log.info("98 Accessed");
View Full Code Here

            }
        }
        // If there is no weapon equipped, check for an active summon.
        else if (activeChar instanceof L2Summon)
        {
            L2Summon activeSummon = (L2Summon) activeChar;

            if (activeSummon.getChargedSpiritShot() == L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT)
            {
                bss = true;
                activeSummon.setChargedSpiritShot(L2ItemInstance.CHARGED_NONE);
            }
            else if (activeSummon.getChargedSpiritShot() == L2ItemInstance.CHARGED_SPIRITSHOT)
            {
                ss = true;
                activeSummon.setChargedSpiritShot(L2ItemInstance.CHARGED_NONE);
            }
        }

        for (int index = 0; index < targets.length; index++)
        {
View Full Code Here

  private void useSkill(int skillId, L2Object target)
  {
    L2PcInstance activeChar = getClient().getActiveChar();
    if (activeChar == null) return;

    L2Summon activeSummon = activeChar.getPet();

    if (activeChar.getPrivateStoreType() != 0)
    {
      activeChar.sendMessage("Cannot use skills while trading");
      return;
    }

    if (activeSummon != null && !activeChar.isBetrayed())
    {
      Map<Integer, L2Skill> _skills = activeSummon.getTemplate().getSkills();

      if (_skills == null) return;

      if (_skills.size() == 0)
      {
        activeChar.sendPacket(new SystemMessage(SystemMessageId.SKILL_NOT_AVAILABLE));
        return;
      }

      L2Skill skill = _skills.get(skillId);

      if (skill == null)
      {
        if (Config.DEBUG)
          _log.warning("Skill " + skillId + " missing from npcskills.sql for a summon id " + activeSummon.getNpcId());
        return;
      }

      activeSummon.setTarget(target);
      activeSummon.useMagic(skill, _ctrlPressed, _shiftPressed);
    }
  }
View Full Code Here

        writeD(_flyRunSpd);
        writeD(_flyWalkSpd);
        writeF(_moveMultiplier);
        writeF(_activeChar.getAttackSpeedMultiplier());

        L2Summon pet = _activeChar.getPet();
        if (_activeChar.getMountType() != 0 && pet != null)
        {
            writeF(pet.getTemplate().collisionRadius);
            writeF(pet.getTemplate().collisionHeight);
        }
        else
        {
            writeF(_activeChar.getBaseTemplate().collisionRadius);
            writeF(_activeChar.getBaseTemplate().collisionHeight);
View Full Code Here

          }
            }
            // If there is no weapon equipped, check for an active summon.
            else if (activeChar instanceof L2Summon)
            {
                L2Summon activeSummon = (L2Summon)activeChar;

                if (activeSummon.getChargedSpiritShot() == L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT)
                {
                    bss = true;
                    activeSummon.setChargedSpiritShot(L2ItemInstance.CHARGED_NONE);
                }
                else if (activeSummon.getChargedSpiritShot() == L2ItemInstance.CHARGED_SPIRITSHOT)
                {
                    ss = true;
                    activeSummon.setChargedSpiritShot(L2ItemInstance.CHARGED_NONE);
                }
            }

      boolean mcrit = Formulas.getInstance().calcMCrit(activeChar.getMCriticalHit(target, this));
      int damage = (int)Formulas.getInstance().calcMagicDam(
View Full Code Here

TOP

Related Classes of net.sf.l2j.gameserver.model.L2Summon

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.