Package l2p.gameserver.model

Examples of l2p.gameserver.model.L2Object


    }
  }

  private void comeHere(L2GameClient client)
  {
    L2Object obj = client.getActiveChar().getTarget();
    if(obj != null && obj.isNpc())
    {
      L2NpcInstance temp = (L2NpcInstance) obj;
      L2Player activeChar = client.getActiveChar();
      temp.setTarget(activeChar);
      temp.moveToLocation(activeChar.getLoc(), 0, true);
View Full Code Here


    }
    if(template == null)
    {
      return;
    }
    L2Object target = activeChar.getTarget();
    if(target == null)
    {
      target = activeChar;
    }
    try
View Full Code Here

    if(_count < 1 || _items == null)
    {
      player.sendActionFailed();
      return;
    }
    L2Object target = player.getTarget();
    if(!(target instanceof L2ManorManagerInstance))
    {
      target = player.getLastNpc();
    }
    if(!(target instanceof L2ManorManagerInstance))
View Full Code Here

      if(activeChar.getPrivateStoreType() != L2Player.STORE_PRIVATE_NONE)
      {
        activeChar.sendActionFailed();
        return;
      }
      L2Object obj = activeChar.getVisibleObject(_objectId);
      if(obj == null && ((obj = L2ObjectsStorage.getItemByObjId(_objectId)) == null || !activeChar.isInRange(obj, 1000)))
      {
        activeChar.sendActionFailed();
        return;
      }
      if(activeChar.getAggressionTarget() != null && activeChar.getAggressionTarget() != obj)
      {
        activeChar.sendActionFailed();
        return;
      }
      obj.onAction(activeChar, _actionId == 1);
    }
    catch(NullPointerException e)
    {
      e.printStackTrace();
    }
View Full Code Here

    if((activeChar.getClanPrivileges() & L2Clan.CP_CL_INVITE_CLAN) != L2Clan.CP_CL_INVITE_CLAN)
    {
      activeChar.sendPacket(Msg.ONLY_THE_LEADER_CAN_GIVE_OUT_INVITATIONS);
      return;
    }
    L2Object object = activeChar.getVisibleObject(_target);
    if(object == null || !object.isPlayer())
    {
      return;
    }
    L2Player member = (L2Player) object;
    if(!activeChar.getPlayerAccess().CanJoinClan)
View Full Code Here

    // Alt game - Karma punishment
    if(!Config.ALT_GAME_KARMA_PLAYER_CAN_SHOP && player.getKarma() > 0)
    {
      return;
    }
    L2Object target = player.getTarget();
    long subTotal = 0;
    int tax = 0;
    // Check for buylist validity and calculates summary values
    int slots = 0;
    int weight = 0;
View Full Code Here

    if(_size < 1 || _items == null)
    {
      player.sendActionFailed();
      return;
    }
    L2Object target = player.getTarget();
    if(!(target instanceof L2ManorManagerInstance))
    {
      target = player.getLastNpc();
    }
    if(!player.isGM() && (target == null || !(target instanceof L2ManorManagerInstance) || !player.isInRange(target, L2Character.INTERACTION_DISTANCE)))
View Full Code Here

      else if (!Config.ALT_SOCIAL_ACTION_REUSE)
        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

        item = owner.getInventory().getItemByItemId(6644);
      }
      // if the owner has enough food, call the item handler (use the food and triffer all necessary actions)
      if(item != null && item.getCount() >= 1)
      {
        L2Object oldTarget = owner.getTarget();
        owner.setTarget(_tamedBeast);
        GArray<L2Character> targets = new GArray<L2Character>();
        targets.add(_tamedBeast);
        // emulate a call to the owner using food, but bypass all checks for range, etc
        // this also causes a call to the AI tasks handling feeding, which may call onReceiveFood as required.
View Full Code Here

TOP

Related Classes of l2p.gameserver.model.L2Object

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.