Package l2p.gameserver.model

Examples of l2p.gameserver.model.L2Summon


    }
  }

  public static void unSummonPet(L2Player player, boolean onlyPets)
  {
    L2Summon pet = player.getPet();
    if(pet == null)
    {
      return;
    }
    if(pet.isPet() || !onlyPets)
    {
      pet.unSummon();
    }
  }
View Full Code Here


      while(rset.next())
      {
        petObjectId = rset.getInt("objId");
      }
      DatabaseUtils.closeDatabaseSR(statement, rset);
      L2Summon summon = owner.getPet();
      if(summon != null && summon.getObjectId() == petObjectId)
      {
        summon.unSummon();
      }
      L2Player player = owner.getPlayer();
      if(player != null && player.isMounted() && player.getMountObjId() == petObjectId)
      {
        player.setMount(0, 0, 0);
View Full Code Here

      }
      if(owner == null)
      {
        return;
      }
      L2Summon summon = owner.getPet();
      if(summon != null && summon.getObjectId() == petObjectId)
      {
        summon.unSummon();
      }
      L2Player player = owner.getPlayer();
      if(player != null && player.isMounted() && player.getMountObjId() == petObjectId)
      {
        player.setMount(0, 0, 0);
View Full Code Here

      if(st.getQuestItemsCount(i[2]) != 0)
      {
        return null;
      }
      GArray<AggroInfo> attackerList = npc.getAggroList();
      L2Summon summon = st.getPlayer().getPet();
      if(summon == null || summon.isPet())
      {
        st.giveItems(i[2], 1, false);
      }
      else
      {
View Full Code Here

    L2ItemInstance item = st.getPlayer().getInventory().getItemByItemId(PENITENTS_MANACLES);
    if(item == null)
    {
      return 0;
    }
    L2Summon pet = st.getPlayer().getPet();
    if(pet == null)
    {
      return item.getEnchantLevel();
    }
    if(pet.getNpcId() != Sin_Eater)
    {
      return 0;
    }
    return pet.getLevel();
  }
View Full Code Here

    if(event.equalsIgnoreCase("3"))
    {
      int plevel = findPetLvl(st);
      int level = st.getPlayer().getLevel();
      int olevel = st.getInt("level");
      L2Summon pet = st.getPlayer().getPet();
      if(pet != null)
      {
        if(pet.getNpcId() == Sin_Eater)
        {
          return "black_judge_q0422_15t.htm";
        }
      }
      else
View Full Code Here

        activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), action.value));
     
      return;
    }
    final L2Object target = activeChar.getTarget();
    final L2Summon pet = activeChar.getPet();
    if(usePet && (pet == null || pet.isOutOfControl()))
    {
      activeChar.sendActionFailed();
      return;
    }
    // Скиллы петов
    if(action.type == 2)
    {
      // TODO перенести эти условия в скиллы
      if(action.id == 1000 && !target.isDoor()) // Siege Golem - Siege Hammer
      {
        activeChar.sendActionFailed();
        return;
      }
      if((action.id == 1039 || action.id == 1040) && (target.isDoor() || target instanceof L2SiegeHeadquarterInstance)) // Swoop Cannon (не может атаковать двери и флаги)
      {
        activeChar.sendActionFailed();
        return;
      }
      UseSkill(action.value);
      return;
    }
    switch(action.id)
    {
      // Действия с игроками:
      case 0: // Сесть/встать
        // На страйдере нельзя садиться
        if(activeChar.isMounted())
        {
          activeChar.sendActionFailed();
          break;
        }
        int distance = (int) activeChar.getDistance(activeChar.getTarget());
        if(target != null && !activeChar.isSitting() && target instanceof L2StaticObjectInstance && ((L2StaticObjectInstance) target).getType() == 1 && distance <= L2Character.INTERACTION_DISTANCE)
        {
          ChairSit cs = new ChairSit(activeChar, ((L2StaticObjectInstance) target).getStaticObjectId());
          activeChar.sendPacket(cs);
          activeChar.sitDown();
          activeChar.broadcastPacket(cs);
          break;
        }
        if(activeChar.isFakeDeath())
        {
          activeChar.breakFakeDeath();
          activeChar.updateEffectIcons();
        }
        else if(activeChar.isSitting())
        {
          activeChar.standUp();
        }
        else
        {
          activeChar.sitDown();
        }
        break;
      case 1: // Изменить тип передвижения, шаг/бег
        if(activeChar.isRunning())
        {
          activeChar.setWalking();
        }
        else
        {
          activeChar.setRunning();
        }
        activeChar.sendUserInfo(true);
        break;
      case 7: // Next Target
        L2Character nearest_target = null;
        for(L2Character cha : L2World.getAroundCharacters(activeChar, 400, 200))
        {
          if(cha != null && !cha.isAlikeDead())
          {
            if((nearest_target == null || activeChar.getDistance3D(cha) < activeChar.getDistance3D(nearest_target)) && cha.isAutoAttackable(activeChar))
            {
              nearest_target = cha;
            }
          }
        }
        if(nearest_target != null && activeChar.getTarget() != nearest_target)
        {
          activeChar.setTarget(nearest_target);
          if(activeChar.getTarget() == nearest_target)
          {
            if(nearest_target.isNpc())
            {
              activeChar.sendPacket(new MyTargetSelected(nearest_target.getObjectId(), activeChar.getLevel() - nearest_target.getLevel()));
              activeChar.sendPacket(nearest_target.makeStatusUpdate(StatusUpdate.CUR_HP, StatusUpdate.MAX_HP));
              activeChar.sendPacket(new ValidateLocation(nearest_target), Msg.ActionFail);
            }
            else
            {
              activeChar.sendPacket(new MyTargetSelected(nearest_target.getObjectId(), 0));
            }
          }
          return;
        }
        break;
      case 10: // Запрос на создание приватного магазина продажи
      case 61: // Запрос на создание приватного магазина продажи (Package)
      {
        if(activeChar.isInTransaction())
        {
          activeChar.getTransaction().cancel();
        }
        if(activeChar.getTradeList() != null)
        {
          activeChar.getTradeList().removeAll();
          activeChar.sendPacket(new SendTradeDone(0));
        }
        else
        {
          activeChar.setTradeList(new L2TradeList(0));
        }
        activeChar.getTradeList().updateSellList(activeChar, activeChar.getSellList());
        activeChar.setPrivateStoreType(L2Player.STORE_PRIVATE_NONE);
        activeChar.standUp();
        activeChar.broadcastUserInfo(true);
        if(!activeChar.checksForShop(false))
        {
          activeChar.sendActionFailed();
          return;
        }
        activeChar.sendPacket(new PrivateStoreManageList(activeChar, _actionId == 61));
        break;
      }
      case 28: // Запрос на создание приватного магазина покупки
      {
        if(activeChar.isInTransaction())
        {
          activeChar.getTransaction().cancel();
        }
        if(activeChar.getTradeList() != null)
        {
          activeChar.getTradeList().removeAll();
          activeChar.sendPacket(new SendTradeDone(0));
        }
        else
        {
          activeChar.setTradeList(new L2TradeList(0));
        }
        activeChar.setPrivateStoreType(L2Player.STORE_PRIVATE_NONE);
        activeChar.standUp();
        activeChar.broadcastUserInfo(true);
        if(!activeChar.checksForShop(false))
        {
          activeChar.sendActionFailed();
          return;
        }
        activeChar.sendPacket(new PrivateStoreManageListBuy(activeChar));
      }
      break;
      case 37: // Создание магазина Common Craft
      {
        if(activeChar.isInTransaction())
        {
          activeChar.getTransaction().cancel();
        }
        if(activeChar.getCreateList() == null)
        {
          activeChar.setCreateList(new L2ManufactureList());
        }
        activeChar.setPrivateStoreType(L2Player.STORE_PRIVATE_NONE);
        activeChar.standUp();
        activeChar.broadcastUserInfo(true);
        if(!activeChar.checksForShop(true))
        {
          activeChar.sendActionFailed();
          return;
        }
        activeChar.sendPacket(new RecipeShopManageList(activeChar, true));
        break;
      }
      case 51: // Создание магазина Dwarven Craft
      {
        if(!activeChar.checksForShop(true))
        {
          activeChar.sendActionFailed();
          return;
        }
        if(activeChar.getCreateList() == null)
        {
          activeChar.setCreateList(new L2ManufactureList());
        }
        activeChar.setPrivateStoreType(L2Player.STORE_PRIVATE_NONE);
        activeChar.standUp();
        activeChar.broadcastUserInfo(true);
        activeChar.sendPacket(new RecipeShopManageList(activeChar, false));
        break;
      }
      case 96: // Quit Party Command Channel?
        _log.info("96 Accessed");
        break;
      case 97: // Request Party Command Channel Info?
        _log.info("97 Accessed");
        break;
      // Действия с петами:
      case 15:
      case 21: // Follow для пета
        if(pet != null)
        {
          pet.setFollowTarget(pet.getPlayer());
          pet.setFollowStatus(!pet.isFollow(), true);
        }
        break;
      case 16:
      case 22: // Атака петом
        if(target == null || pet == target || pet.isDead())
        {
          activeChar.sendActionFailed();
          return;
        }
        if(activeChar.isInOlympiadMode() && !activeChar.isOlympiadCompStart())
        {
          activeChar.sendActionFailed();
          return;
        }
        // Sin Eater
        if(pet.getTemplate().getNpcId() == PetDataTable.SIN_EATER_ID)
        {
          return;
        }
        if(!_ctrlPressed && !target.isAutoAttackable(activeChar))
        {
          pet.setFollowTarget((L2Character) target);
          pet.setFollowStatus(true, true);
          return;
        }
        if(!target.isMonster() && (pet.isInZonePeace() || target.isInZonePeace()))
        {
          activeChar.sendPacket(Msg.YOU_MAY_NOT_ATTACK_THIS_TARGET_IN_A_PEACEFUL_ZONE);
          return;
        }
        if(activeChar.getLevel() + 20 <= pet.getLevel())
        {
          activeChar.sendPacket(Msg.THE_PET_IS_TOO_HIGH_LEVEL_TO_CONTROL);
          return;
        }
        if(!target.isDoor() && pet.isSiegeWeapon())
        {
          activeChar.sendPacket(Msg.INVALID_TARGET);
          return;
        }
        pet.getAI().Attack(target, _ctrlPressed, _shiftPressed);
        break;
      case 17:
      case 23: // Отмена действия у пета
        pet.setFollowTarget(pet.getPlayer());
        pet.setFollowStatus(pet.isFollow(), true);
        break;
      case 19: // Отзыв пета
        if(pet.isDead())
        {
          activeChar.sendPacket(Msg.A_DEAD_PET_CANNOT_BE_SENT_BACK, Msg.ActionFail);
          return;
        }
        if(pet.isInCombat())
        {
          activeChar.sendPacket(Msg.A_PET_CANNOT_BE_SENT_BACK_DURING_BATTLE, Msg.ActionFail);
          break;
        }
        if(pet.isPet() && pet.getCurrentFed() < 0.55 * pet.getMaxFed())
        {
          activeChar.sendPacket(Msg.YOU_CANNOT_RESTORE_HUNGRY_PETS, Msg.ActionFail);
          break;
        }
        pet.unSummon();
        break;
      case 38: // Mount
        if(activeChar.getTransformation() != 0)
        {
          activeChar.sendPacket(Msg.YOU_CANNOT_MOUNT_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS);
        }
        else if(pet == null || !pet.isMountable())
        {
          if(activeChar.isMounted())
          {
            if(activeChar.isFlying() && !activeChar.checkLandingState()) // Виверна
            {
              activeChar.sendPacket(Msg.YOU_ARE_NOT_ALLOWED_TO_DISMOUNT_AT_THIS_LOCATION, Msg.ActionFail);
              return;
            }
            activeChar.setMount(0, 0, 0);
          }
        }
        else if(activeChar.isMounted() || activeChar.isInVehicle())
        {
          activeChar.sendPacket(Msg.YOU_CANNOT_MOUNT_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS);
        }
        else if(activeChar.isDead())
        {
          activeChar.sendPacket(Msg.YOU_CANNOT_MOUNT_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS);
        }
        else if(pet.isDead())
        {
          activeChar.sendPacket(Msg.A_DEAD_PET_CANNOT_BE_RIDDEN);
        }
        else if(activeChar.isInDuel())
        {
          activeChar.sendPacket(Msg.YOU_CANNOT_MOUNT_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS);
        }
        else if(activeChar.isInCombat() || pet.isInCombat())
        {
          activeChar.sendPacket(Msg.YOU_CANNOT_MOUNT_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS);
        }
        else if(activeChar.isFishing())
        {
          activeChar.sendPacket(Msg.YOU_CANNOT_MOUNT_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS);
        }
        else if(activeChar.isSitting())
        {
          activeChar.sendPacket(Msg.YOU_CANNOT_MOUNT_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS);
        }
        else if(activeChar.isCursedWeaponEquipped())
        {
          activeChar.sendPacket(Msg.YOU_CANNOT_MOUNT_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS);
        }
        else if(activeChar.isCombatFlagEquipped() || activeChar.isTerritoryFlagEquipped())
        {
          activeChar.sendPacket(Msg.YOU_CANNOT_MOUNT_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS);
        }
        else if(activeChar.isCastingNow())
        {
          activeChar.sendPacket(Msg.YOU_CANNOT_MOUNT_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS);
        }
        else if(activeChar.isParalyzed())
        {
          activeChar.sendPacket(Msg.YOU_CANNOT_MOUNT_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS);
        }
        else
        {
          activeChar.getEffectList().stopEffect(L2Skill.SKILL_EVENT_TIMER);
          activeChar.setMount(pet.getTemplate().npcId, pet.getObjectId(), pet.getLevel());
          pet.unSummon();
        }
        break;
      case 52: // Отзыв саммона
        if(pet.isInCombat())
        {
          activeChar.sendPacket(Msg.A_PET_CANNOT_BE_SENT_BACK_DURING_BATTLE, Msg.ActionFail);
        }
        else
        {
          pet.unSummon();
        }
        break;
      case 53:
      case 54: // Передвинуть пета к цели
        if(target != null && pet != target && !pet.isMovementDisabled())
        {
          pet.setFollowStatus(false, true);
          ThreadPoolManager.getInstance().executePathfind(new Runnable()
          {
            public void run()
            {
              pet.moveToLocation(target.getLoc(), 100, true);
            }
          });
        }
        break;
      case 1070:
View Full Code Here

  }

  private void UseSkill(int skillId)
  {
    L2Player activeChar = getClient().getActiveChar();
    L2Summon pet = activeChar.getPet();
    if(pet == null)
    {
      activeChar.sendActionFailed();
      return;
    }
    int skillLevel = PetSkillsTable.getInstance().getAvailableLevel(pet, skillId);
    if(skillLevel == 0)
    {
      activeChar.sendActionFailed();
      return;
    }
    L2Skill skill = SkillTable.getInstance().getInfo(skillId, skillLevel);
    if(skill == null)
    {
      activeChar.sendActionFailed();
      return;
    }
    if(activeChar.getLevel() + 20 <= pet.getLevel())
    {
      activeChar.sendPacket(Msg.THE_PET_IS_TOO_HIGH_LEVEL_TO_CONTROL);
      return;
    }
    L2Character aimingTarget = skill.getAimingTarget(pet, activeChar.getTarget());
    if(skill.checkCondition(pet, aimingTarget, _ctrlPressed, _shiftPressed, true))
    {
      pet.getAI().Cast(skill, aimingTarget, _ctrlPressed, _shiftPressed);
    }
    else
    {
      activeChar.sendActionFailed();
    }
View Full Code Here

      curMp = (int) member.getCurrentMp();
      maxMp = member.getMaxMp();
      level = member.getLevel();
      class_id = member.getClassId().getId();
      race_id = member.getRace().ordinal();
      L2Summon pet = member.getPet();
      if(pet != null)
      {
        pet_id = pet.getObjectId();
        pet_NpcId = pet.getNpcId() + 1000000;
        pet_Name = pet.getName();
        pet_curHp = (int) pet.getCurrentHp();
        pet_maxHp = pet.getMaxHp();
        pet_curMp = (int) pet.getCurrentMp();
        pet_maxMp = pet.getMaxMp();
        pet_level = pet.getLevel();
      }
      else
      {
        pet_id = 0;
      }
View Full Code Here

      curMp = (int) member.getCurrentMp();
      maxMp = member.getMaxMp();
      level = member.getLevel();
      class_id = member.getClassId().getId();
      race_id = member.getRace().ordinal();
      L2Summon pet = member.getPet();
      if(pet != null)
      {
        pet_id = pet.getObjectId();
        pet_NpcId = pet.getNpcId() + 1000000;
        pet_Name = pet.getName();
        pet_curHp = (int) pet.getCurrentHp();
        pet_maxHp = pet.getMaxHp();
        pet_curMp = (int) pet.getCurrentMp();
        pet_maxMp = pet.getMaxMp();
        pet_level = pet.getLevel();
      }
      else
      {
        pet_id = 0;
      }
View Full Code Here

TOP

Related Classes of l2p.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.