Package com.l2jfrozen.gameserver.model

Examples of com.l2jfrozen.gameserver.model.L2Summon$AIAccessor


        {
          _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


  {
    L2Character activeChar = getClient().getActiveChar();
    if(activeChar == null)
      return;

    final L2Summon pet = activeChar.getPet();
    if(pet == null)
      return;

    if(pet.getName() != null)
    {
      activeChar.sendPacket(new SystemMessage(SystemMessageId.NAMING_YOU_CANNOT_SET_NAME_OF_THE_PET));
      return;
    }
    else if(PetNameTable.getInstance().doesPetNameExist(_name, pet.getTemplate().npcId))
    {
      activeChar.sendPacket(new SystemMessage(SystemMessageId.NAMING_ALREADY_IN_USE_BY_ANOTHER_PET));
      return;
    }
    else if(_name.length() < 3 || _name.length() > 16)
    {
      SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
      sm.addString("Your pet's name can be up to 16 characters.");
      // SystemMessage sm = new SystemMessage(SystemMessage.NAMING_PETNAME_UP_TO_8CHARS);
      activeChar.sendPacket(sm);
      sm = null;

      return;
    }
    else if(!PetNameTable.getInstance().isValidPetName(_name))
    {
      activeChar.sendPacket(new SystemMessage(SystemMessageId.NAMING_PETNAME_CONTAINS_INVALID_CHARS));
      return;
    }

    pet.setName(_name);
    pet.broadcastPacket(new NpcInfo(pet, activeChar));
    activeChar.sendPacket(new PetInfo(pet));
    // The PetInfo packet wipes the PartySpelled (list of active spells' icons).  Re-add them
    pet.updateEffectIcons(true);

    // set the flag on the control item to say that the pet has a name
    if(pet instanceof L2PetInstance)
    {
      L2ItemInstance controlItem = pet.getOwner().getInventory().getItemByObjectId(pet.getControlItemId());

      if(controlItem != null)
      {
        controlItem.setCustomType2(1);
        controlItem.updateDatabase();
View Full Code Here

    }else if(activeChar.isCastingNow()){
      getClient().sendPacket(ActionFailed.STATIC_PACKET);
      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.isFakeDeath())
        {
          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(ActionFailed.STATIC_PACKET);
            return;
          }

          if(target instanceof L2PcInstance
            && !activeChar.getAccessLevel().allowPeaceAttack()
            && L2Character.isInsidePeaceZone(pet, target))
          {
            if(!activeChar.isInFunEvent() || !((L2PcInstance)target).isInFunEvent())
            {
              activeChar.sendPacket(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.sendMessage("You cannot despawn a summon during combat."); // Message like L2OFF
          }
          else if (pet.isInCombat() || activeChar.isInCombat())
          {
            activeChar.sendMessage("You cannot despawn a summon during combat."); // Message like L2OFF
          }
          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);
          }
          else if(pet.isDead())
          {
            //A dead strider cannot be ridden.
            SystemMessage msg = new SystemMessage(SystemMessageId.DEAD_STRIDER_CANT_BE_RIDDEN);
            activeChar.sendPacket(msg);
          }
          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);
          }
          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);
          }
          else if(activeChar.isInFunEvent())
          {
            //A strider cannot be ridden while in event
            SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_CANT_BE_RIDDEN_WHILE_IN_BATTLE);
            activeChar.sendPacket(msg);
          }
          else if(activeChar.isSitting()) // Like L2OFF you can mount also during movement
          {
            //A strider can be ridden only when standing
            SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_CAN_BE_RIDDEN_ONLY_WHILE_STANDING);
            activeChar.sendPacket(msg);
          }
          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);
          }
          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;
           
            if (!activeChar.getFloodProtectors().getItemPetSummon().tryPerformAction("mount"))
              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);

            if(activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) != null || activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LRHAND) != null)
            {
              if(activeChar.isFlying())
              {
                // Remove skill Wyvern Breath
                activeChar.removeSkill(SkillTable.getInstance().getInfo(4289, 1));
                activeChar.sendSkillList();
              }
             
              if(activeChar.setMountType(0))
              {
                Ride dismount = new Ride(activeChar.getObjectId(), Ride.ACTION_DISMOUNT, 0);
                activeChar.broadcastPacket(dismount);
                activeChar.setMountObjectID(0);
              }
            }
          }
        }
        else if(activeChar.isRentedPet())
        {
          activeChar.stopRentPet();
        }
        else if(activeChar.isMounted())
        {
          if(activeChar.isFlying())
          {   
            // Remove skill Wyvern Breath
            activeChar.removeSkill(SkillTable.getInstance().getInfo(4289, 1));
            activeChar.sendSkillList();
          }
         
          if(activeChar.setMountType(0))
          {
            Ride dismount = new Ride(activeChar.getObjectId(), Ride.ACTION_DISMOUNT, 0);
            activeChar.broadcastPacket(dismount);
            activeChar.setMountObjectID(0);
           
            // Update status after unmount to avoid visual bug
            activeChar.broadcastStatusUpdate();
            activeChar.broadcastUserInfo();
          }
        }
        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(ActionFailed.STATIC_PACKET);
          return;
        }
       
        // Like L2OFF - You can't open Manufacture when you are in private store
        if (activeChar.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_BUY || activeChar.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_SELL)
        {
          getClient().sendPacket(ActionFailed.STATIC_PACKET);
          return;
        }
       
        // Like L2OFF - You can't open Manufacture when you are sitting
        if (activeChar.isSitting() && activeChar.getPrivateStoreType() != L2PcInstance.STORE_PRIVATE_MANUFACTURE)
        {
          getClient().sendPacket(ActionFailed.STATIC_PACKET);
          return;
        }
       
        // You can't open Manufacture when the task is launched
        if(activeChar.isSittingTaskLaunched())
        {
          sendPacket(ActionFailed.STATIC_PACKET);
          return;
        }
       
        if (activeChar.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_MANUFACTURE)
        {
          activeChar.setPrivateStoreType(L2PcInstance.STORE_PRIVATE_NONE);
         
          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(ActionFailed.STATIC_PACKET);
          return;
        }
       
        // Like L2OFF - You can't open Manufacture when you are in private store
        if (activeChar.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_BUY || activeChar.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_SELL)
        {
          getClient().sendPacket(ActionFailed.STATIC_PACKET);
          return;
        }
       
        // Like L2OFF - You can't open Manufacture when you are sitting
        if (activeChar.isSitting() && activeChar.getPrivateStoreType() != L2PcInstance.STORE_PRIVATE_MANUFACTURE)
        {
          getClient().sendPacket(ActionFailed.STATIC_PACKET);
          return;
        }
       
        // You can't open Manufacture when the task is launched
        if(activeChar.isSittingTaskLaunched())
        {
          sendPacket(ActionFailed.STATIC_PACKET);
          return;
        }
       
        if (activeChar.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_MANUFACTURE)
        {
          activeChar.setPrivateStoreType(L2PcInstance.STORE_PRIVATE_NONE);
         
          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)
        {
          if (pet.isInCombat() || activeChar.isInCombat())
          {
            activeChar.sendMessage("You cannot despawn a summon during combat."); // Message like L2OFF
          }
          else if (pet.isAttackingNow() || pet.isRooted())
          {
            activeChar.sendMessage("You cannot despawn a summon during combat."); // Message like L2OFF
          }
          else
          {
            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");
        break;
View Full Code Here

  {
    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.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);
     
      boolean force = _ctrlPressed;
     
      if (target instanceof L2Character)
      {
        if (activeSummon.isInsideZone(L2Character.ZONE_PVP) && ((L2Character) target).isInsideZone(L2Character.ZONE_PVP))
        {
          force = true;
        }
      }
     
      activeSummon.useMagic(skill, force, _shiftPressed);
    }
  }
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);
        }

        // Remove Tamed Beast
        if (player.getTrainedBeast() != null)
        {
View Full Code Here

     
      _playerOne.teleToLocation(_stadiumPort[0] + 900, _stadiumPort[1], _stadiumPort[2], false);
      // teleport summon to
      if (_playerOne.getPet() != null)
      {
        L2Summon summon = _playerOne.getPet();
        if (summon instanceof L2SummonInstance)
          summon.teleToLocation(_stadiumPort[0] + 900, _stadiumPort[1], _stadiumPort[2], false);
      }
      _playerTwo.teleToLocation(_stadiumPort[0] - 900, _stadiumPort[1], _stadiumPort[2], false);
      // teleport summon to
      if (_playerTwo.getPet() != null)
      {
        L2Summon summon = _playerTwo.getPet();
        if (summon instanceof L2SummonInstance)
          summon.teleToLocation(_stadiumPort[0] - 900, _stadiumPort[1], _stadiumPort[2], false);
      }

      _playerOne.sendPacket(new ExOlympiadMode(2));
      _playerTwo.sendPacket(new ExOlympiadMode(2));
     
View Full Code Here

              if(Config.CTF_ON_START_UNSUMMON_PET)
              {
                // Remove Summon's buffs
                if(player.getPet() != null)
                {
                  L2Summon summon = player.getPet();
                  for(L2Effect e : summon.getAllEffects())
                    if(e != null)
                      e.exit(true);

                  if(summon instanceof L2PetInstance)
                    summon.unSummon(player);
                }
              }

              if(Config.CTF_ON_START_REMOVE_ALL_EFFECTS)
              {
View Full Code Here

          if(Formulas.getInstance().calcSkillSuccess(activeChar, target, skill, ss, sps, bss)
          // Doesn't affect siege golem, wild hog cannon and Pets
          && !(target instanceof L2SiegeSummonInstance) && !(target instanceof L2PetInstance))
          {
            L2PcInstance summonOwner = null;
            L2Summon summonPet = null;
            summonOwner = ((L2Summon) target).getOwner();
            summonPet = summonOwner.getPet();
            summonPet.unSummon(summonOwner);
            summonPet = null;
            SystemMessage sm = new SystemMessage(SystemMessageId.LETHAL_STRIKE);
            summonOwner.sendPacket(sm);
            sm = null;
          }
View Full Code Here

      return;
    }
   
    if (_actor instanceof L2Summon)
    {
      L2Summon summon = (L2Summon) _actor;
      if (summon.getOwner() != null)
        summon.getOwner().getAI().clientStartAutoAttack();
      return;
    }
    if (!isAutoAttacking())
    {
      if (_actor instanceof L2PcInstance && ((L2PcInstance)_actor).getPet() != null)
View Full Code Here

   */
  public void clientStopAutoAttack()
  {
    if (_actor instanceof L2Summon)
    {
      L2Summon summon = (L2Summon) _actor;
      if (summon.getOwner() != null)
        summon.getOwner().getAI().clientStopAutoAttack();
      return;
    }
   
    final boolean isAutoAttacking = isAutoAttacking();
   
View Full Code Here

TOP

Related Classes of com.l2jfrozen.gameserver.model.L2Summon$AIAccessor

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.