Package lineage2.gameserver.model

Examples of lineage2.gameserver.model.Summon


    if (!Config.SERVICES_EXCHANGE_BABY_PET_ENABLED)
    {
      show("Серви�? откл�?чен.", player);
      return;
    }
    Summon pl_pet = player.getSummonList().getPet();
    if ((pl_pet == null) || pl_pet.isDead() || !((pl_pet.getNpcId() == PetDataTable.IMPROVED_BABY_COUGAR_ID) || (pl_pet.getNpcId() == PetDataTable.IMPROVED_BABY_KOOKABURRA_ID)))
    {
      show("�?ет должен быт�? вызван.", player);
      return;
    }
    if (Config.ALT_IMPROVED_PETS_LIMITED_USE && player.isMageClass())
    {
      show("Этот пет тол�?ко дл�? воинов.", player);
      return;
    }
    if (player.getInventory().destroyItemByItemId(Config.SERVICES_EXCHANGE_BABY_PET_ITEM, Config.SERVICES_EXCHANGE_BABY_PET_PRICE))
    {
      ItemInstance control = player.getInventory().getItemByObjectId(pl_pet.getControlItemObjId());
      control.setItemId(L2Pet.IMPROVED_BABY_BUFFALO.getControlItemId());
      control/**
       * Method exToKookaburra.
       */
      .setJdbcState(JdbcEntityState.UPDATED);
 
View Full Code Here


    if (!Config.SERVICES_EXCHANGE_BABY_PET_ENABLED)
    {
      show("Серви�? откл�?чен.", player);
      return;
    }
    Summon pl_pet = player.getSummonList().getPet();
    if ((pl_pet == null) || pl_pet.isDead() || !((pl_pet.getNpcId() == PetDataTable.IMPROVED_BABY_BUFFALO_ID) || (pl_pet.getNpcId() == PetDataTable.IMPROVED_BABY_COUGAR_ID)))
    {
      show("�?ет должен быт�? вызван.", player);
      return;
    }
    if (Config.ALT_IMPROVED_PETS_LIMITED_USE && !player.isMageClass())
    {
      show("Этот пет тол�?ко дл�? магов.", player);
      return;
    }
    if (player.getInventory().destroyItemByItemId(Config.SERVICES_EXCHANGE_BABY_PET_ITEM, Config.SERVICES_EXCHANGE_BABY_PET_PRICE))
    {
      ItemInstance control = player.getInventory().getItemByObjectId(pl_pet.getControlItemObjId());
      control.setItemId(L2Pet.IMPROVED_BABY_KOOKABURRA.getControlItemId());
      control.setJdbcState(JdbcEntityState.UPDATED);
      control.update();
      player.sendPacket(new InventoryUpdate().addModifiedItem(control));
      player.getSummonList().unsummonPet(false);
View Full Code Here

    NpcInstance npc = getNpc();
    if ((player == null) || (npc == null))
    {
      return;
    }
    Summon pl_pet = player.getSummonList().getPet();
    if (player.getInventory().getItemByItemId(WOLF_COLLAR) == null)
    {
      show("scripts/services/petevolve/no_item.htm", player, npc);
      return;
    }
    if ((pl_pet == null) || pl_pet.isDead())
    {
      show("scripts/services/petevolve/evolve_no.htm", player, npc);
      return;
    }
    if (pl_pet.getNpcId() != WOLF)
    {
      show("scripts/services/petevolve/no_wolf.htm", player, npc);
      return;
    }
    if (pl_pet.getLevel() < 55)
    {
      show("scripts/services/petevolve/no_level.htm", player, npc);
      return;
    }
    int controlItemId = pl_pet.getControlItemObjId();
    player.getSummonList().unsummonPet(false);
    ItemInstance control = player.getInventory().getItemByObjectId(controlItemId);
    control.setItemId(GREAT_WOLF_NECKLACE);
    control.setEnchantLevel(L2Pet.GREAT_WOLF.getMinLevel());
    control.setJdbcState(JdbcEntityState.UPDATED);
View Full Code Here

    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

    }
    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

    _zoneListener = new ZoneListener();
    for (String element : ZONES)
    {
      int random = Rnd.get(60 * 1000 * 1, 60 * 1000 * 7);
      int message;
      Zone zone = ReflectionUtils.getZone(element);
      ThreadPoolManager.getInstance().schedule(new CampDestroyTask(zone), random);
      if (random > (5 * 60000))
      {
        message = random - (5 * 60000);
        ThreadPoolManager.getInstance().schedule(new BroadcastMessageTask(0, zone), message);
      }
      if (random > (3 * 60000))
      {
        message = random - (3 * 60000);
        ThreadPoolManager.getInstance().schedule(new BroadcastMessageTask(0, zone), message);
      }
      if (random > 60000)
      {
        message = random - 60000;
        ThreadPoolManager.getInstance().schedule(new BroadcastMessageTask(0, zone), message);
      }
      if (random > 15000)
      {
        message = random - 15000;
        ThreadPoolManager.getInstance().schedule(new BroadcastMessageTask(1, zone), message);
      }
      zone.addListener(_zoneListener);
    }
    _buffTask = ThreadPoolManager.getInstance().scheduleAtFixedRate(new BuffTask(), TICK_BUFF_DELAY, TICK_BUFF_DELAY);
  }
View Full Code Here

  @Override
  public void onReload()
  {
    for (String element : ZONES)
    {
      Zone zone = ReflectionUtils.getZone(element);
      zone.removeListener(_zoneListener);
    }
    if (_buffTask != null)
    {
      _buffTask.cancel(false);
      _buffTask = null;
View Full Code Here

    @Override
    public void runImpl()
    {
      for (String element : ZONES)
      {
        Zone zone = ReflectionUtils.getZone(element);
        NpcInstance npc = getKasha(zone);
        if ((npc != null) && (zone != null))
        {
          int curseLvl = 0;
          int yearningLvl = 0;
          int despairLvl = 0;
          for (Creature c : zone.getObjects())
          {
            if (c.isMonster() && !c.isDead())
            {
              if (getRealNpcId((NpcInstance) c) == mobs[0])
              {
                curseLvl++;
              }
              else if (getRealNpcId((NpcInstance) c) == mobs[1])
              {
                yearningLvl++;
              }
              else if (getRealNpcId((NpcInstance) c) == mobs[2])
              {
                despairLvl++;
              }
            }
          }
          if ((yearningLvl > 0) || (curseLvl > 0) || (despairLvl > 0))
          {
            for (Creature cha : zone.getInsidePlayables())
            {
              boolean casted = false;
              if (curseLvl > 0)
              {
                addEffect(npc, cha.getPlayer(), SkillTable.getInstance().getInfo(_buffs[0], curseLvl), true);
View Full Code Here

  private void init()
  {
    _zoneListener = new ZoneListener();
    for (String s : zones)
    {
      Zone zone = ReflectionUtils.getZone(s);
      zone.addListener(_zoneListener);
    }
  }
View Full Code Here

   * Method init.
   */
  private void init()
  {
    _zoneListener = new ZoneListener();
    Zone zone = ReflectionUtils.getZone(ZONE_NAME);
    if (zone != null)
    {
      zone.addListener(_zoneListener);
    }
  }
View Full Code Here

TOP

Related Classes of lineage2.gameserver.model.Summon

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.