Package net.sf.l2j.gameserver.serverpackets

Examples of net.sf.l2j.gameserver.serverpackets.ActionFailed


      {
        showSiegeInfoWindow(player);
      }
    }
    // Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
    player.sendPacket(new ActionFailed());
  }
View Full Code Here


            NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
            html.setFile("data/html/siege/" + getTemplate().npcId + "-busy.htm");
            html.replace("%castlename%",getCastle().getName());
            html.replace("%objectId%",String.valueOf(getObjectId()));
            player.sendPacket(html);
            player.sendPacket( new ActionFailed() );
        }
  }
View Full Code Here

    }
    else
    {
      _log.warning("no buylist with id:" +val);
    }
    activeChar.sendPacket( new ActionFailed() );
  }
View Full Code Here

                false)))
      return;

    if (_size < 1)
    {
      sendPacket(new ActionFailed());
      return;
    }
    L2ManorManagerInstance manorManager = (L2ManorManagerInstance) target;

    int currentManorId = manorManager.getCastle().getCastleId();
View Full Code Here

    // =========================================================
    // Event - Public
    public void onAction(L2PcInstance player)
    {
        player.sendPacket(new ActionFailed());
    }
View Full Code Here

        player.sendPacket(new ActionFailed());
    }

    public void onActionShift(L2GameClient client)
    {
        client.getActiveChar().sendPacket(new ActionFailed());
    }
View Full Code Here

        client.getActiveChar().sendPacket(new ActionFailed());
    }

    public void onForcedAttack(L2PcInstance player)
    {
        player.sendPacket(new ActionFailed());
    }
View Full Code Here

      {
        // Notify the L2PcInstance AI with AI_INTENTION_INTERACT
        player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this);
       
        // Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
        player.sendPacket(new ActionFailed());
      }
    }
  }
View Full Code Here

        if (_listId > 1000000) // lease
    {
      if (merchant != null && merchant.getTemplate().npcId != _listId-1000000)
      {
        sendPacket(new ActionFailed());
        return;
      }
    }
        if(_count < 1)
    {
            sendPacket(new ActionFailed());
        return;
    }
    double taxRate = 0;
    if (merchant != null && merchant.getIsInTown()) taxRate = merchant.getCastle().getTaxRate();
    long subTotal = 0;
    int tax = 0;

    // Check for buylist validity and calculates summary values
    long slots = 0;
    long weight = 0;
    for (int i = 0; i < _count; i++)
    {
      int itemId = _items[i * 2 + 0];
      int count  = _items[i * 2 + 1];
      int price = -1;

      if (!list.containsItemId(itemId))
      {
        Util.handleIllegalPlayerAction(player,"Warning!! Character "+player.getName()+" of account "+player.getAccountName()+" sent a false BuyList list_id.",Config.DEFAULT_PUNISH);
        return;
      }

            L2Item template = ItemTable.getInstance().getTemplate(itemId);

            if (template == null) continue;
            if (count > Integer.MAX_VALUE || (!template.isStackable() && count > 1))
      {
        Util.handleIllegalPlayerAction(player,"Warning!! Character "+player.getName()+" of account "+player.getAccountName()+" tried to purchase invalid quantity of items at the same time.",Config.DEFAULT_PUNISH);
        SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED);
        sendPacket(sm);
        sm = null;

        return;
      }

      if (_listId < 1000000)
      {
        //list = TradeController.getInstance().getBuyList(_listId);
        price = list.getPriceForItemId(itemId);
                if (itemId >= 3960 && itemId <= 4026) price *= Config.RATE_SIEGE_GUARDS_PRICE;

      }
/* TODO: Disabled until Leaseholders are rewritten ;-)
      } else {
        L2ItemInstance li = merchant.findLeaseItem(itemId, 0);
        if (li == null || li.getCount() < cnt) {
          cnt = li.getCount();
          if (cnt <= 0) {
            items.remove(i);
            continue;
          }
          items.get(i).setCount((int)cnt);
        }
        price = li.getPriceToSell(); // lease holder sells the item
        weight = li.getItem().getWeight();
      }

*/
      if (price < 0)
      {
        _log.warning("ERROR, no price found .. wrong buylist ??");
                sendPacket(new ActionFailed());
                return;
      }

      if(price == 0 && !player.isGM() && Config.ONLY_GM_ITEMS_FREE)
      {
View Full Code Here

      _log.finest(activeChar.getName()+" request Action use: id "+_actionId + " 2:" + _ctrlPressed + " 3:"+_shiftPressed);

    // dont do anything if player is dead
    if (activeChar.isAlikeDead())
    {
      getClient().sendPacket(new ActionFailed());
      return;
    }

    // don't do anything if player is confused
    if (activeChar.isOutOfControl())
    {
      getClient().sendPacket(new ActionFailed());
      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.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(new ActionFailed());
          return;
        }

        if (activeChar.getAccessLevel() < Config.GM_PEACEATTACK &&
            activeChar.isInsidePeaceZone(pet, target))
        {
          activeChar.sendPacket(new SystemMessage(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.sendPacket(new SystemMessage(SystemMessageId.PET_CANNOT_SENT_BACK_DURING_BATTLE));
        }
        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);
          msg = null;
        }
        else if (pet.isDead())
        {
          //A dead strider cannot be ridden.
          SystemMessage msg = new SystemMessage(SystemMessageId.DEAD_STRIDER_CANT_BE_RIDDEN);
          activeChar.sendPacket(msg);
          msg = null;
        }
        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);
          msg = null;
        }
        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);
          msg = null;
        }
        else if (activeChar.isSitting() || activeChar.isMoving())
        {
          //A strider can be ridden only when standing
          SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_CAN_BE_RIDDEN_ONLY_WHILE_STANDING);
          activeChar.sendPacket(msg);
          msg = null;
        }
        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);
          msg = null;
        }
        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;
          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);
        }
      }
      else if (activeChar.isRentedPet())
      {
        activeChar.stopRentPet();
      }
      else if (activeChar.isMounted())
      {
        if (activeChar.setMountType(0))
        {
          if (activeChar.isFlying())activeChar.removeSkill(SkillTable.getInstance().getInfo(4289, 1));
          Ride dismount = new Ride(activeChar.getObjectId(), Ride.ACTION_DISMOUNT, 0);
          activeChar.broadcastPacket(dismount);
          activeChar.setMountObjectID(0);
        }
      }
      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(new ActionFailed());
        return;
      }
      if(activeChar.getPrivateStoreType() != 0){
        activeChar.setPrivateStoreType(L2PcInstance.STORE_PRIVATE_NONE);
        activeChar.broadcastUserInfo();
          }
      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(new ActionFailed());
        return;
      }
      if(activeChar.getPrivateStoreType() != 0){
        activeChar.setPrivateStoreType(L2PcInstance.STORE_PRIVATE_NONE);
        activeChar.broadcastUserInfo();
View Full Code Here

TOP

Related Classes of net.sf.l2j.gameserver.serverpackets.ActionFailed

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.