Examples of Summon


Examples of lineage2.gameserver.model.Summon

    NpcInstance npc = getNpc();
    if ((player == null) || (npc == null))
    {
      return;
    }
    Summon pet = player.getSummonList().getPet();
    if (player.getInventory().getItemByItemId(BABY_KOOKABURRA_OCARINA) == null)
    {
      show("scripts/services/petevolve/no_item.htm", player, npc);
      return;
    }
    else if ((pet == null) || pet.isDead())
    {
      show("scripts/services/petevolve/evolve_no.htm", player, npc);
      return;
    }
    if (pet.getNpcId() != BABY_KOOKABURRA)
    {
      show("scripts/services/petevolve/no_pet.htm", player, npc);
      return;
    }
    if (Config.ALT_IMPROVED_PETS_LIMITED_USE && !player.isMageClass())
    {
      show("scripts/services/petevolve/no_class_m.htm", player, npc);
      return;
    }
    if (pet.getLevel() < 55)
    {
      show("scripts/services/petevolve/no_level.htm", player, npc);
      return;
    }
    int controlItemId = pet.getControlItemObjId();
    player.getSummonList().unsummonPet(false);
    ItemInstance control = player.getInventory().getItemByObjectId(controlItemId);
    control.setItemId(IN_KOOKABURRA_OCARINA);
    control.setEnchantLevel(L2Pet.IMPROVED_BABY_KOOKABURRA.getMinLevel());
    control.setJdbcState(JdbcEntityState.UPDATED);
View Full Code Here

Examples of lineage2.gameserver.model.Summon

    }
    final boolean usePet = action.type == PET_ACTION;
    final boolean useServitor = action.type == SERVITOR_ACTION;
    final boolean useServitorGroup = action.type == SERVITOR_GROUP_ACTION;
    final GameObject target = activeChar.getTarget();
    final Summon pet = activeChar.getSummonList().getPet();
    final Summon servitor = activeChar.getSummonList().getFirstServitor();
    final List<Summon> servitors = activeChar.getSummonList().getServitors();
    if (activeChar.isGM() && activeChar.isDebug())
    {
      activeChar.sendMessage("ActionId:" + action.id + " useServitor:" + useServitor + " useServitorGroup:" + useServitorGroup);
    }
    if (!usePet && !useServitor && !useServitorGroup && (activeChar.isOutOfControl() || activeChar.isActionsDisabled()) && !(activeChar.isFakeDeath() && (_actionId == 0)))
    {
      activeChar.sendActionFailed();
      return;
    }
    if ((activeChar.getTransformation() != 0) && (action.transform > 0))
    {
      activeChar.sendActionFailed();
      return;
    }
    switch (action.type)
    {
      case PLAYER_ACTION:
        switch (action.id)
        {
          case 0:
            if (activeChar.isMounted())
            {
              activeChar.sendActionFailed();
              break;
            }
            if (activeChar.isFakeDeath())
            {
              activeChar.breakFakeDeath();
              activeChar.updateEffectIcons();
              break;
            }
            if (!activeChar.isSitting())
            {
              if ((target != null) && (target instanceof StaticObjectInstance) && (((StaticObjectInstance) target).getType() == 1) && (activeChar.getDistance3D(target) <= Creature.INTERACTION_DISTANCE))
              {
                activeChar.sitDown((StaticObjectInstance) target);
              }
              else
              {
                activeChar.sitDown(null);
              }
            }
            else
            {
              activeChar.standUp();
            }
            break;
          case 1:
            if (activeChar.isRunning())
            {
              activeChar.setWalking();
            }
            else
            {
              activeChar.setRunning();
            }
            break;
          case 10:
          case 61:
          {
            if (activeChar.getSittingTask())
            {
              activeChar.sendActionFailed();
              return;
            }
            if (activeChar.isInStoreMode())
            {
              activeChar.setPrivateStoreType(Player.STORE_PRIVATE_NONE);
              activeChar.standUp();
              activeChar.broadcastCharInfo();
            }
            else if (!TradeHelper.checksIfCanOpenStore(activeChar, _actionId == 61 ? Player.STORE_PRIVATE_SELL_PACKAGE : Player.STORE_PRIVATE_SELL))
            {
              activeChar.sendActionFailed();
              return;
            }
            activeChar.sendPacket(new PrivateStoreManageListSell(activeChar, _actionId == 61));
            break;
          }
          case 28:
          {
            if (activeChar.getSittingTask())
            {
              activeChar.sendActionFailed();
              return;
            }
            if (activeChar.isInStoreMode())
            {
              activeChar.setPrivateStoreType(Player.STORE_PRIVATE_NONE);
              activeChar.standUp();
              activeChar.broadcastCharInfo();
            }
            else if (!TradeHelper.checksIfCanOpenStore(activeChar, Player.STORE_PRIVATE_BUY))
            {
              activeChar.sendActionFailed();
              return;
            }
            activeChar.sendPacket(new PrivateStoreManageListBuy(activeChar));
            break;
          }
          case 51:
          {
            if (activeChar.getSittingTask())
            {
              activeChar.sendActionFailed();
              return;
            }
            if (activeChar.isInStoreMode())
            {
              activeChar.setPrivateStoreType(Player.STORE_PRIVATE_NONE);
              activeChar.standUp();
              activeChar.broadcastCharInfo();
            }
            else if (!TradeHelper.checksIfCanOpenStore(activeChar, Player.STORE_PRIVATE_MANUFACTURE))
            {
              activeChar.sendActionFailed();
              return;
            }
            activeChar.sendPacket(new RecipeShopManageList(activeChar, true));
            break;
          }
          case 38:
            if (activeChar.getTransformation() != 0)
            {
              activeChar.sendPacket(SystemMsg.YOU_CANNOT_BOARD_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS);
            }
            else if (activeChar.isMounted())
            {
              if (activeChar.isFlying() && !activeChar.checkLandingState())
              {
                activeChar.sendPacket(Msg.YOU_ARE_NOT_ALLOWED_TO_DISMOUNT_AT_THIS_LOCATION, ActionFail.STATIC);
                activeChar.sendActionFailed();
                return;
              }
              activeChar.setMount(0, 0, 0);
            }
            else if (activeChar.isMounted() || activeChar.isInBoat())
            {
              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 (activeChar.isInDuel())
            {
              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.getActiveWeaponFlagAttachment() != null)
            {
              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 if ((pet == null) || activeChar.isInCombat() || pet.isInCombat())
            {
              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 ((pet != null) && pet.isMountable())
            {
              activeChar.getEffectList().stopEffect(Skill.SKILL_EVENT_TIMER);
              activeChar.setMount(pet.getTemplate().npcId, pet.getObjectId(), pet.getLevel());
              activeChar.getSummonList().unsummonPet(false);
            }
            break;
          case 37:
          {
            if (activeChar.getSittingTask())
            {
              activeChar.sendActionFailed();
              return;
            }
            if (activeChar.isInStoreMode())
            {
              activeChar.setPrivateStoreType(Player.STORE_PRIVATE_NONE);
              activeChar.standUp();
              activeChar.broadcastCharInfo();
            }
            else if (!TradeHelper.checksIfCanOpenStore(activeChar, Player.STORE_PRIVATE_MANUFACTURE))
            {
              activeChar.sendActionFailed();
              return;
            }
            activeChar.sendPacket(new RecipeShopManageList(activeChar, false));
            break;
          }
          case 67:
            if (activeChar.isInBoat() && activeChar.getBoat().isClanAirShip() && !activeChar.getBoat().isMoving)
            {
              ClanAirShip boat = (ClanAirShip) activeChar.getBoat();
              if (boat.getDriver() == null)
              {
                boat.setDriver(activeChar);
              }
              else
              {
                activeChar.sendPacket(SystemMsg.ANOTHER_PLAYER_IS_PROBABLY_CONTROLLING_THE_TARGET);
              }
            }
            break;
          case 68:
            if (activeChar.isClanAirShipDriver())
            {
              ClanAirShip boat = (ClanAirShip) activeChar.getBoat();
              boat.setDriver(null);
              activeChar.broadcastCharInfo();
            }
            break;
          case 69:
            if (activeChar.isClanAirShipDriver() && activeChar.getBoat().isDocked())
            {
              activeChar.sendPacket(new ExAirShipTeleportList((ClanAirShip) activeChar.getBoat()));
            }
            break;
          case 70:
            if (activeChar.isInBoat() && activeChar.getBoat().isAirShip() && activeChar.getBoat().isDocked())
            {
              activeChar.getBoat().oustPlayer(activeChar, activeChar.getBoat().getReturnLoc(), true);
            }
            break;
          case 78:
            TacticalSignManager.setTacticalSign(activeChar, target, 1);
            break;
          case 79:
            TacticalSignManager.setTacticalSign(activeChar, target, 2);
            break;
          case 80:
            TacticalSignManager.setTacticalSign(activeChar, target, 3);
            break;
          case 81:
            TacticalSignManager.setTacticalSign(activeChar, target, 4);
            break;
          case 82:
            TacticalSignManager.getTargetOnTacticalSign(activeChar, 1);
            break;
          case 83:
            TacticalSignManager.getTargetOnTacticalSign(activeChar, 2);
            break;
          case 84:
            TacticalSignManager.getTargetOnTacticalSign(activeChar, 3);
            break;
          case 85:
            TacticalSignManager.getTargetOnTacticalSign(activeChar, 4);
            break;
          case 96:
            _log.info("96 Accessed");
            break;
          case 97:
            _log.info("97 Accessed");
            break;
        }
        break;
      case PET_ACTION:
        if ((pet == null) || pet.isOutOfControl())
        {
          activeChar.sendActionFailed();
          return;
        }
        if (pet.isDepressed())
        {
          activeChar.sendPacket(SystemMsg.YOUR_PETSERVITOR_IS_UNRESPONSIVE_AND_WILL_NOT_OBEY_ANY_ORDERS);
          return;
        }
        switch (action.id)
        {
          case 15:
            pet.setFollowMode(!pet.isFollowMode());
            break;
          case 16:
            pet.setFollowMode(!pet.isFollowMode());
            if ((target == null) || !target.isCreature() || (pet == target) || pet.isDead())
            {
              activeChar.sendActionFailed();
              return;
            }
            if (activeChar.isInOlympiadMode() && !activeChar.isOlympiadCompStart())
            {
              activeChar.sendActionFailed();
              return;
            }
            if (pet.getTemplate().getNpcId() == PetDataTable.SIN_EATER_ID)
            {
              activeChar.sendActionFailed();
              return;
            }
            if (!_ctrlPressed && target.isCreature() && !((Creature) target).isAutoAttackable(pet))
            {
              activeChar.sendActionFailed();
              return;
            }
            if (_ctrlPressed && !target.isAttackable(pet))
            {
              activeChar.sendPacket(SystemMsg.INVALID_TARGET);
              activeChar.sendActionFailed();
              return;
            }
            if (!target.isMonster() && (pet.isInZonePeace() || (target.isCreature() && ((Creature) target).isInZonePeace())))
            {
              activeChar.sendPacket(SystemMsg.YOU_MAY_NOT_ATTACK_THIS_TARGET_IN_A_PEACEFUL_ZONE);
              activeChar.sendActionFailed();
              return;
            }
            if ((activeChar.getLevel() + 20) <= pet.getLevel())
            {
              activeChar.sendPacket(SystemMsg.YOUR_PET_IS_TOO_HIGH_LEVEL_TO_CONTROL);
              activeChar.sendActionFailed();
              return;
            }
            pet.getAI().Attack(target, _ctrlPressed, _shiftPressed);
            break;
          case 17:
            pet.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
            break;
          case 19:
            if (pet.isDead())
            {
              activeChar.sendPacket(SystemMsg.DEAD_PETS_CANNOT_BE_RETURNED_TO_THEIR_SUMMONING_ITEM, ActionFail.STATIC);
              return;
            }
            if (pet.isInCombat())
            {
              activeChar.sendPacket(SystemMsg.A_PET_CANNOT_BE_UNSUMMONED_DURING_BATTLE, ActionFail.STATIC);
              return;
            }
            if (!PetDataTable.isVitaminPet(pet.getNpcId()) && pet.isPet() && (pet.getCurrentFed() < (0.55 * pet.getMaxFed())))
            {
              activeChar.sendPacket(SystemMsg.YOU_MAY_NOT_RESTORE_A_HUNGRY_PET, ActionFail.STATIC);
              return;
            }
            activeChar.getSummonList().unsummonPet(false);
            break;
          case 54:
            if ((target != null) && (pet != target) && !pet.isMovementDisabled())
            {
              pet.setFollowMode(false);
              pet.moveToLocation(target.getLoc(), 100, true);
            }
            break;
          case 1070:
            if (pet instanceof PetBabyInstance)
            {
              ((PetBabyInstance) pet).triggerBuff();
            }
            break;
        }
        if (action.value > 0)
        {
          UseSkill(action.value, pet);
          activeChar.sendActionFailed();
          return;
        }
        break;
      case SERVITOR_ACTION:
        if (servitor == null)
        {
          activeChar.sendActionFailed();
          return;
        }
        switch (action.id)
        {
          case 21:
            servitor.setFollowMode(!servitor.isFollowMode());
            break;
          case 22:
            if ((target == null) || !target.isCreature())
            {
              activeChar.sendActionFailed();
              return;
            }
            if ((servitor == target) || servitor.isDead())
            {
              activeChar.sendActionFailed();
              return;
            }
            if (activeChar.isInOlympiadMode() && !activeChar.isOlympiadCompStart())
            {
              activeChar.sendActionFailed();
              return;
            }
            if (_ctrlPressed)
            {
              if (!target.isAttackable(servitor))
              {
                activeChar.sendPacket(SystemMsg.INVALID_TARGET);
                activeChar.sendActionFailed();
                return;
              }
            }
            else if (!_ctrlPressed && target.isCreature())
            {
              if (!((Creature) target).isAutoAttackable(servitor))
              {
                activeChar.sendActionFailed();
                return;
              }
            }
            if (!target.isMonster() && (target.isCreature() && ((Creature) target).isInZonePeace()))
            {
              if (servitor.isInZonePeace())
              {
                activeChar.sendPacket(SystemMsg.YOU_MAY_NOT_ATTACK_THIS_TARGET_IN_A_PEACEFUL_ZONE);
                activeChar.sendActionFailed();
                return;
              }
            }
            servitor.setFollowMode(!servitor.isFollowMode());
            servitor.getAI().Attack(target, _ctrlPressed, _shiftPressed);
            break;
          case 23:
            servitor.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
            break;
          case 52:
            if (servitor.isInCombat())
            {
              activeChar.sendPacket(SystemMsg.A_PET_CANNOT_BE_UNSUMMONED_DURING_BATTLE);
              activeChar.sendActionFailed();
            }
            else
            {
              servitor.saveEffects();
              activeChar.getSummonList().unsummonAllServitors();
            }
            break;
          case 53:
            if ((target != null) && (servitor != target) && !servitor.isMovementDisabled())
            {
              servitor.setFollowMode(false);
              servitor.moveToLocation(target.getLoc(), 100, true);
            }
            break;
          case 1000:
            if ((target != null) && !target.isDoor())
            {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.