Package com.l2jfrozen.gameserver.network.serverpackets

Examples of com.l2jfrozen.gameserver.network.serverpackets.SystemMessage


      case admin_silence:
        if(activeChar.getMessageRefusal()) // already in message refusal mode
        {
          activeChar.setMessageRefusal(false);
          activeChar.sendPacket(new SystemMessage(SystemMessageId.MESSAGE_ACCEPTANCE_MODE));
        }
        else
        {
          activeChar.setMessageRefusal(true);
          activeChar.sendPacket(new SystemMessage(SystemMessageId.MESSAGE_REFUSAL_MODE));
        }
        return true;
      case admin_saveolymp:
       
        Olympiad.getInstance().saveOlympiadStatus();
View Full Code Here


    // Command for unspawn all Npcs on Server, use //repsawnall to respawn the npc
    else if(command.startsWith("admin_unspawnall"))
    {
      for(L2PcInstance player : L2World.getInstance().getAllPlayers())
      {
        player.sendPacket(new SystemMessage(SystemMessageId.NPC_SERVER_NOT_OPERATING));
      }
      RaidBossSpawnManager.getInstance().cleanUp();
      DayNightSpawnManager.getInstance().cleanUp();
      L2World.getInstance().deleteVisibleNpcSpawns();
      GmListTable.broadcastMessageToGMs("NPC Unspawn completed!");
View Full Code Here

    catch(Exception e)
    {
      if(Config.ENABLE_ALL_EXCEPTIONS)
        e.printStackTrace();
     
      activeChar.sendPacket(new SystemMessage(SystemMessageId.TARGET_CANT_FOUND));
    }

    template1 = null;
    target = null;
  }
View Full Code Here

    if(requestor == null)
      return;

    if(_response == 1)
    {
      SystemMessage msg1 = null, msg2 = null;
      if(requestor.isInDuel())
      {
        msg1 = new SystemMessage(SystemMessageId.S1_CANNOT_DUEL_BECAUSE_S1_IS_ALREADY_ENGAGED_IN_A_DUEL);
        msg1.addString(requestor.getName());
        player.sendPacket(msg1);
        return;
      }
      else if(player.isInDuel())
      {
        player.sendPacket(new SystemMessage(SystemMessageId.YOU_ARE_UNABLE_TO_REQUEST_A_DUEL_AT_THIS_TIME));
        return;
      }

      if(_partyDuel == 1)
      {
        msg1 = new SystemMessage(SystemMessageId.YOU_HAVE_ACCEPTED_S1S_CHALLENGE_TO_A_PARTY_DUEL_THE_DUEL_WILL_BEGIN_IN_A_FEW_MOMENTS);
        msg1.addString(requestor.getName());

        msg2 = new SystemMessage(SystemMessageId.S1_HAS_ACCEPTED_YOUR_CHALLENGE_TO_DUEL_AGAINST_THEIR_PARTY_THE_DUEL_WILL_BEGIN_IN_A_FEW_MOMENTS);
        msg2.addString(player.getName());
      }
      else
      {
        msg1 = new SystemMessage(SystemMessageId.YOU_HAVE_ACCEPTED_S1S_CHALLENGE_TO_A_DUEL_THE_DUEL_WILL_BEGIN_IN_A_FEW_MOMENTS);
        msg1.addString(requestor.getName());

        msg2 = new SystemMessage(SystemMessageId.S1_HAS_ACCEPTED_YOUR_CHALLENGE_TO_A_DUEL_THE_DUEL_WILL_BEGIN_IN_A_FEW_MOMENTS);
        msg2.addString(player.getName());
      }

      player.sendPacket(msg1);
      requestor.sendPacket(msg2);

      DuelManager.getInstance().addDuel(requestor, player, _partyDuel);
    }
    else
    {
      SystemMessage msg = null;
      if(_partyDuel == 1)
      {
        msg = new SystemMessage(SystemMessageId.THE_OPPOSING_PARTY_HAS_DECLINED_YOUR_CHALLENGE_TO_A_DUEL);
      }
      else
      {
        msg = new SystemMessage(SystemMessageId.S1_HAS_DECLINED_YOUR_CHALLENGE_TO_A_DUEL);
        msg.addString(player.getName());
      }
      requestor.sendPacket(msg);
    }

    player.setActiveRequester(null);
View Full Code Here

    }

    // Item Max Limit Check
    if(!warehouse.validateCapacity(slots))
    {
      sendPacket(new SystemMessage(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED));
      return;
    }

    // Check if enough adena and charge the fee
    if(currentAdena < fee || !player.reduceAdena("Warehouse", fee, player.getLastFolkNPC(), false))
    {
      sendPacket(new SystemMessage(SystemMessageId.YOU_NOT_ENOUGH_ADENA));
      return;
    }

    // Proceed to the transfer
    InventoryUpdate playerIU = Config.FORCE_INVENTORY_UPDATE ? null : new InventoryUpdate();
View Full Code Here

        {
          if (_member == null)
            continue;
         
          _member.sendPacket(new PartyMatchDetail(_activeChar, _room));
          _member.sendPacket(new SystemMessage(SystemMessageId.PARTY_ROOM_REVISED));
        }
      }
    }
    else
    {
      int _maxid = PartyMatchRoomList.getInstance().getMaxId();
     
      PartyMatchRoom _room = new PartyMatchRoom(_maxid, _roomtitle, _loot, _lvlmin, _lvlmax, _membersmax, _activeChar);
     
      _log.info("PartyMatchRoom #" + _maxid + " created by " + _activeChar.getName());
     
      // Remove from waiting list, and add to current room
      PartyMatchWaitingList.getInstance().removePlayer(_activeChar);
      PartyMatchRoomList.getInstance().addPartyMatchRoom(_maxid, _room);
     
      if (_activeChar.isInParty())
      {
        for (L2PcInstance ptmember : _activeChar.getParty().getPartyMembers())
        {
          if (ptmember == null)
            continue;
          if (ptmember == _activeChar)
            continue;
         
          ptmember.setPartyRoom(_maxid);
         
          _room.addMember(ptmember);
        }
      }
     
      _activeChar.sendPacket(new PartyMatchDetail(_activeChar, _room));
      _activeChar.sendPacket(new ExPartyRoomMember(_activeChar, _room, 1));
     
      _activeChar.sendPacket(new SystemMessage(SystemMessageId.PARTY_ROOM_CREATED));
     
      _activeChar.setPartyRoom(_maxid);
      _activeChar.broadcastUserInfo();
    }
  }
View Full Code Here

    if(target != null && target.isInParty() && activeChar.isInParty() && activeChar.getParty().isInCommandChannel() && target.getParty().isInCommandChannel() && activeChar.getParty().getCommandChannel().getChannelLeader().equals(activeChar))
    {
      target.getParty().getCommandChannel().removeParty(target.getParty());

      SystemMessage sm = SystemMessage.sendString("Your party was dismissed from the CommandChannel.");
      target.getParty().broadcastToPartyMembers(sm);

      sm = SystemMessage.sendString(target.getParty().getPartyMembers().get(0).getName() + "'s party was dismissed from the CommandChannel.");
    }
    else
View Full Code Here

      return;
    }
   
    if (activeChar.getPrivateStoreType() != 0)
    {
      activeChar.sendPacket(new SystemMessage(SystemMessageId.CANNOT_TRADE_DISCARD_DROP_ITEM_WHILE_IN_SHOPMODE));
      activeChar.sendPacket(ActionFailed.STATIC_PACKET);
      return;
    }
   
    if (activeChar.getActiveTradeList() != null)
    {
      activeChar.cancelActiveTrade();
    }
   
    // NOTE: disabled due to deadlocks
    // synchronized (activeChar.getInventory())
    // {
   
    if (item.isWear())
      // No unequipping wear-items
      return;
   
    if (item.getItem().getType2() == L2Item.TYPE2_QUEST)
    {
      SystemMessage sm = new SystemMessage(SystemMessageId.CANNOT_USE_QUEST_ITEMS);
      activeChar.sendPacket(sm);
      sm = null;
      return;
    }
   
    int itemId = item.getItemId();
    /*
     * Alt game - Karma punishment // SOE 736 Scroll of Escape 1538 Blessed Scroll of Escape 1829 Scroll of Escape: Clan Hall 1830 Scroll of Escape: Castle 3958 L2Day - Blessed Scroll of Escape 5858 Blessed Scroll of Escape: Clan Hall 5859 Blessed Scroll of Escape: Castle 6663 Scroll of Escape:
     * Orc Village 6664 Scroll of Escape: Silenos Village 7117 Scroll of Escape to Talking Island 7118 Scroll of Escape to Elven Village 7119 Scroll of Escape to Dark Elf Village 7120 Scroll of Escape to Orc Village 7121 Scroll of Escape to Dwarven Village 7122 Scroll of Escape to Gludin Village
     * 7123 Scroll of Escape to the Town of Gludio 7124 Scroll of Escape to the Town of Dion 7125 Scroll of Escape to Floran 7126 Scroll of Escape to Giran Castle Town 7127 Scroll of Escape to Hardin's Private Academy 7128 Scroll of Escape to Heine 7129 Scroll of Escape to the Town of Oren 7130
     * Scroll of Escape to Ivory Tower 7131 Scroll of Escape to Hunters Village 7132 Scroll of Escape to Aden Castle Town 7133 Scroll of Escape to the Town of Goddard 7134 Scroll of Escape to the Rune Township 7135 Scroll of Escape to the Town of Schuttgart. 7554 Scroll of Escape to Talking
     * Island 7555 Scroll of Escape to Elven Village 7556 Scroll of Escape to Dark Elf Village 7557 Scroll of Escape to Orc Village 7558 Scroll of Escape to Dwarven Village 7559 Scroll of Escape to Giran Castle Town 7618 Scroll of Escape - Ketra Orc Village 7619 Scroll of Escape - Varka Silenos
     * Village 10129 Scroll of Escape : Fortress 10130 Blessed Scroll of Escape : Fortress
     */
    if (!Config.ALT_GAME_KARMA_PLAYER_CAN_TELEPORT && activeChar.getKarma() > 0 && (itemId == 736 || itemId == 1538 || itemId == 1829 || itemId == 1830 || itemId == 3958 || itemId == 5858 || itemId == 5859 || itemId == 6663 || itemId == 6664 || itemId >= 7117 && itemId <= 7135 || itemId >= 7554 && itemId <= 7559 || itemId == 7618 || itemId == 7619 || itemId == 10129 || itemId == 10130))
      return;
   
    // Items that cannot be used
    if (itemId == 57)
      return;
   
    if(!Config.ARENA_ALLOW_S && item.getItem().getItemGrade() == L2Item.CRYSTAL_S &&
        (activeChar.isInArenaEvent() || EvtArenaManager.getInstance().isRegistered(activeChar)))
    {
      activeChar.sendMessage("Event Arena Manager: Items Grade S cannot be used in Arena Event");
      return;
    }
   
    if ((itemId == 5858) && (ClanHallManager.getInstance().getClanHallByOwner(activeChar.getClan()) == null))
    {
      activeChar.sendMessage("Blessed Scroll of Escape: Clan Hall cannot be used due to unsuitable terms.");
      return;
    }
    else if ((itemId == 5859) && (CastleManager.getInstance().getCastleByOwner(activeChar.getClan()) == null))
    {
      activeChar.sendMessage("Blessed Scroll of Escape: Castle cannot be used due to unsuitable terms.");
      return;
    }
   
    if (activeChar.isFishing() && (itemId < 6535 || itemId > 6540))
    {
      // You cannot do anything else while fishing
      SystemMessage sm = new SystemMessage(SystemMessageId.CANNOT_DO_WHILE_FISHING_3);
      getClient().getActiveChar().sendPacket(sm);
      sm = null;
      return;
    }
   
    if (activeChar.getPkKills() > 0 && (itemId >= 7816 && itemId <= 7831))
    {
      // Retail messages... same L2OFF
      activeChar.sendMessage("You do not meet the required condition to equip that item.");
      activeChar.sendMessage("You are unable to equip this item when your PK count is greater than or equal to one.");
      return;
    }
   
    L2Clan cl = activeChar.getClan();
    // A shield that can only be used by the members of a clan that owns a castle.
    if ((cl == null || cl.getHasCastle() == 0) && itemId == 7015 && Config.CASTLE_SHIELD)
    {
      activeChar.sendMessage("You can't equip that");
      return;
    }
   
    // A shield that can only be used by the members of a clan that owns a clan hall.
    if ((cl == null || cl.getHasHideout() == 0) && itemId == 6902 && Config.CLANHALL_SHIELD)
    {
      activeChar.sendMessage("You can't equip that");
      return;
    }
   
    // Apella armor used by clan members may be worn by a Baron or a higher level Aristocrat.
    if (itemId >= 7860 && itemId <= 7879 && Config.APELLA_ARMORS && (cl == null || activeChar.getPledgeClass() < 5))
    {
      activeChar.sendMessage("You can't equip that");
      return;
    }
   
    // Clan Oath armor used by all clan members
    if (itemId >= 7850 && itemId <= 7859 && Config.OATH_ARMORS && cl == null)
    {
      activeChar.sendMessage("You can't equip that");
      return;
    }
   
    // The Lord's Crown used by castle lords only
    if (itemId == 6841 && Config.CASTLE_CROWN && (cl == null || cl.getHasCastle() == 0 || !activeChar.isClanLeader()))
    {
      activeChar.sendMessage("You can't equip that");
      return;
    }
   
    // Scroll of resurrection like L2OFF if you are casting you can't use them
    if ((itemId == 737 || itemId == 3936 || itemId == 3959 || itemId == 6387) && activeChar.isCastingNow())
      return;
   
    // Castle circlets used by the members of a clan that owns a castle, academy members are excluded.
    if (Config.CASTLE_CIRCLETS && (itemId >= 6834 && itemId <= 6840 || itemId == 8182 || itemId == 8183))
    {
      if (cl == null)
      {
        activeChar.sendMessage("You can't equip that");
        return;
      }
     
      int circletId = CastleManager.getInstance().getCircletByCastleId(cl.getHasCastle());
      if (activeChar.getPledgeType() == -1 || circletId != itemId)
      {
        activeChar.sendMessage("You can't equip that");
        return;
      }
    }
   
    /*
     * //You can't equip Shield if you have specific weapon equiped, not retail L2Weapon curwep = activeChar.getActiveWeaponItem(); if(curwep != null) { if(curwep.getItemType() == L2WeaponType.DUAL && item.getItemType() == L2WeaponType.NONE) {
     * activeChar.sendMessage("You are not allowed to do this."); return; } else if(curwep.getItemType() == L2WeaponType.BOW && item.getItemType() == L2WeaponType.NONE) { activeChar.sendMessage("You are not allowed to do this."); return; } else if(curwep.getItemType() == L2WeaponType.BIGBLUNT &&
     * item.getItemType() == L2WeaponType.NONE) { activeChar.sendMessage("You are not allowed to do this."); return; } else if(curwep.getItemType() == L2WeaponType.BIGSWORD && item.getItemType() == L2WeaponType.NONE) { activeChar.sendMessage("You are not allowed to do this."); return; } else
     * if(curwep.getItemType() == L2WeaponType.POLE && item.getItemType() == L2WeaponType.NONE) { activeChar.sendMessage("You are not allowed to do this."); return; } else if(curwep.getItemType() == L2WeaponType.DUALFIST && item.getItemType() == L2WeaponType.NONE) {
     * activeChar.sendMessage("You are not allowed to do this."); return; } }
     */
   
    // Char cannot use item when dead
    if (activeChar.isDead())
    {
      SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED);
      sm.addItemName(itemId);
      getClient().getActiveChar().sendPacket(sm);
      sm = null;
      return;
    }
   
    // Char cannot use pet items
    if (item.getItem().isForWolf() || item.getItem().isForHatchling() || item.getItem().isForStrider() || item.getItem().isForBabyPet())
    {
      SystemMessage sm = new SystemMessage(SystemMessageId.CANNOT_EQUIP_PET_ITEM); // You cannot equip a pet item.
      sm.addItemName(itemId);
      getClient().getActiveChar().sendPacket(sm);
      sm = null;
      return;
    }
   
    if (Config.DEBUG)
    {
      _log.finest(activeChar.getObjectId() + ": use item " + _objectId);
    }
   
    if (item.isEquipable())
    {
      // No unequipping/equipping while the player is in special conditions
      if (activeChar.isFishing() || activeChar.isStunned() || activeChar.isSleeping() || activeChar.isParalyzed() || activeChar.isAlikeDead())
      {
        activeChar.sendMessage("Your status does not allow you to do that.");
        return;
      }
     
      // SECURE FIX - Anti Overenchant Cheat!!
      if (Config.MAX_ITEM_ENCHANT_KICK > 0 && !activeChar.isGM() && item.getEnchantLevel() > Config.MAX_ITEM_ENCHANT_KICK)
      {
        activeChar.sendMessage("You have been kicked for using an item overenchanted!");
        Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " has item Overenchanted! Kicked ", Config.DEFAULT_PUNISH);
        // activeChar.closeNetConnection();
        return;
      }
     
      int bodyPart = item.getItem().getBodyPart();
     
      // Like L2OFF you can't use equips while you are casting
      if ((activeChar.isCastingNow() || activeChar.isCastingPotionNow() || activeChar.isMounted() || (activeChar._inEventCTF && activeChar._haveFlagCTF)))
      {
        if (activeChar._inEventCTF && activeChar._haveFlagCTF)
        {
          activeChar.sendMessage("This item can not be equipped when you have the flag.");
        }
        else
        {
          SystemMessage sm = new SystemMessage(SystemMessageId.CANNOT_USE_ITEM_WHILE_USING_MAGIC);
            activeChar.sendPacket(sm);
        }
        return;
      }

      // Like L2OFF, since c5 you can equip weapon 
      // Don't allow weapon/shield equipment if wearing formal wear
      /*
      if (activeChar.isWearingFormalWear() && (bodyPart == L2Item.SLOT_LR_HAND || bodyPart == L2Item.SLOT_L_HAND || bodyPart == L2Item.SLOT_R_HAND))
      {
        SystemMessage sm = new SystemMessage(SystemMessageId.CANNOT_USE_ITEMS_SKILLS_WITH_FORMALWEAR);
        activeChar.sendPacket(sm);
        return;
      }
      */
     
      // fix enchant
      if (Config.PROTECTED_ENCHANT)
      {
        switch (bodyPart)
        {
          case L2Item.SLOT_LR_HAND:
          case L2Item.SLOT_L_HAND:
          case L2Item.SLOT_R_HAND:
          {
            if ((item.getEnchantLevel() > Config.NORMAL_WEAPON_ENCHANT_LEVEL.size() || item.getEnchantLevel() > Config.BLESS_WEAPON_ENCHANT_LEVEL.size() || item.getEnchantLevel() > Config.CRYSTAL_WEAPON_ENCHANT_LEVEL.size()) && !activeChar.isGM())
            {
              // activeChar.setAccountAccesslevel(-1); //ban
              activeChar.sendMessage("You have been banned for using an item wich is over enchanted!"); // message
              Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " has item Overenchanted! ", Config.DEFAULT_PUNISH);
              // activeChar.closeNetConnection(); //kick
              return;
            }
            break;
          }
          case L2Item.SLOT_CHEST:
          case L2Item.SLOT_BACK:
          case L2Item.SLOT_GLOVES:
          case L2Item.SLOT_FEET:
          case L2Item.SLOT_HEAD:
          case L2Item.SLOT_FULL_ARMOR:
          case L2Item.SLOT_LEGS:
          {
            if ((item.getEnchantLevel() > Config.NORMAL_ARMOR_ENCHANT_LEVEL.size() || item.getEnchantLevel() > Config.BLESS_ARMOR_ENCHANT_LEVEL.size() || item.getEnchantLevel() > Config.CRYSTAL_ARMOR_ENCHANT_LEVEL.size()) && !activeChar.isGM())
            {
              // activeChar.setAccountAccesslevel(-1); //ban
              activeChar.sendMessage("You have been banned for using an item wich is over enchanted!"); // message
              Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " has item Overenchanted! ", Config.DEFAULT_PUNISH);
              // activeChar.closeNetConnection(); //kick
              return;
            }
            break;
          }
          case L2Item.SLOT_R_EAR:
          case L2Item.SLOT_L_EAR:
          case L2Item.SLOT_NECK:
          case L2Item.SLOT_R_FINGER:
          case L2Item.SLOT_L_FINGER:
          {
            if ((item.getEnchantLevel() > Config.NORMAL_JEWELRY_ENCHANT_LEVEL.size() || item.getEnchantLevel() > Config.BLESS_JEWELRY_ENCHANT_LEVEL.size() || item.getEnchantLevel() > Config.CRYSTAL_JEWELRY_ENCHANT_LEVEL.size()) && !activeChar.isGM())
            {
              // activeChar.setAccountAccesslevel(-1); //ban
              activeChar.sendMessage("You have been banned for using an item wich is over enchanted!"); // message
              Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " has item Overenchanted! ", Config.DEFAULT_PUNISH);
              // activeChar.closeNetConnection(); //kick
              return;
            }
            break;
          }
        }
      }
     
      // Don't allow weapon/shield equipment if a cursed weapon is equiped
      if (activeChar.isCursedWeaponEquiped() && (bodyPart == L2Item.SLOT_LR_HAND || bodyPart == L2Item.SLOT_L_HAND || bodyPart == L2Item.SLOT_R_HAND))
        return;
     
      // Don't allow weapon/shield hero equipment during Olimpia
      if(Config.DISABLE_OLY_SGRADE)
      {
         if (activeChar.isInOlympiadMode() && ((bodyPart == L2Item.SLOT_LR_HAND || bodyPart == L2Item.SLOT_L_HAND || bodyPart == L2Item.SLOT_R_HAND) && (item.getItem().getItemGrade() == L2Item.CRYSTAL_S || item.getItemId() >= 6611 && item.getItemId() <= 6621 || item.getItemId() == 6842) || Config.LIST_OLY_RESTRICTED_ITEMS.contains(item.getItemId())))
                return;
      }
      else
      {
        if (activeChar.isInOlympiadMode() && ((bodyPart == L2Item.SLOT_LR_HAND || bodyPart == L2Item.SLOT_L_HAND || bodyPart == L2Item.SLOT_R_HAND) && (item.getItemId() >= 6611 && item.getItemId() <= 6621 || item.getItemId() == 6842) || Config.LIST_OLY_RESTRICTED_ITEMS.contains(item.getItemId())))
                  return;
      }
     
      // Don't allow Hero items equipment if not a hero
      if (!activeChar.isHero() && (item.getItemId() >= 6611 && item.getItemId() <= 6621 || item.getItemId() == 6842) && !activeChar.isGM())
        return;
     
      if(Config.DISABLE_OLY_SGRADE)
      {
          if (activeChar.isInOlympiadMode() && item.getItem().getItemGrade() == L2Item.CRYSTAL_S)
              return;
      }
     
      if (activeChar.isMoving() && activeChar.isAttackingNow() && (bodyPart == L2Item.SLOT_LR_HAND || bodyPart == L2Item.SLOT_L_HAND || bodyPart == L2Item.SLOT_R_HAND))
      {
        L2Object target = activeChar.getTarget();
        activeChar.setTarget(null);
        activeChar.stopMove(null);
        activeChar.setTarget(target);
        activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK);
      }
     
      // Don't allow to put formal wear
      if (activeChar.isCursedWeaponEquipped() && itemId == 6408)
        return;
     
      // Elrokian Trap like L2OFF, add skills
      if (itemId == 8763)
      {
        if (!item.isEquipped())
        {
          activeChar.addSkill(SkillTable.getInstance().getInfo(3626, 1));
          activeChar.addSkill(SkillTable.getInstance().getInfo(3627, 1));
          activeChar.addSkill(SkillTable.getInstance().getInfo(3628, 1));
          activeChar.sendSkillList();
        }
      }
     
      // Equip or unEquip
      L2ItemInstance[] items = null;
      boolean isEquiped = item.isEquipped();
      SystemMessage sm = null;
     
      if (item.getItem().getType2() == L2Item.TYPE2_WEAPON)
      { // if used item is a weapon
     
        L2ItemInstance wep = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LRHAND);
        if (wep == null)
        {
          wep = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
        }
       
        activeChar.checkSSMatch(item, wep);
       
      }
     
      // Remove the item if it's equiped
      if (isEquiped)
      {
        // Elrokian Trap like L2OFF, remove skills
        if (itemId == 8763)
        {
          activeChar.removeSkill(3626, true);
          activeChar.removeSkill(3627, true);
          activeChar.removeSkill(3628, true);
          activeChar.sendSkillList();
        }
       
        if (item.getEnchantLevel() > 0)
        {
          sm = new SystemMessage(SystemMessageId.EQUIPMENT_S1_S2_REMOVED);
          sm.addNumber(item.getEnchantLevel());
          sm.addItemName(itemId);
        }
        else
        {
          sm = new SystemMessage(SystemMessageId.S1_DISARMED);
          sm.addItemName(itemId);
        }
       
        activeChar.sendPacket(sm);
       
        // Remove augementation bonus on unequipment
        if (item.isAugmented())
        {
          item.getAugmentation().removeBoni(activeChar);
        }
       
        switch (item.getEquipSlot())
        {
          case 1:
            bodyPart = L2Item.SLOT_L_EAR;
            break;
          case 2:
            bodyPart = L2Item.SLOT_R_EAR;
            break;
          case 4:
            bodyPart = L2Item.SLOT_L_FINGER;
            break;
          case 5:
            bodyPart = L2Item.SLOT_R_FINGER;
            break;
          default:
            break;
        }
       
        // remove cupid's bow skills on unequip
        if (item.isCupidBow())
        {
          if (item.getItemId() == 9140)
            activeChar.removeSkill(SkillTable.getInstance().getInfo(3261, 1));
          else
          {
            activeChar.removeSkill(SkillTable.getInstance().getInfo(3260, 0));
            activeChar.removeSkill(SkillTable.getInstance().getInfo(3262, 0));
          }
        }
       
        items = activeChar.getInventory().unEquipItemInBodySlotAndRecord(bodyPart);
      }
      else
      {
        // Restrict bow weapon for class except Cupid bow.
        if (item.getItem() instanceof L2Weapon && ((L2Weapon) item.getItem()).getItemType() == L2WeaponType.BOW && !item.isCupidBow())
        {
         
          if (Config.DISABLE_BOW_CLASSES.contains(activeChar.getClassId().getId()))
          {
            activeChar.sendMessage("This item can not be equipped by your class");
            activeChar.sendPacket(ActionFailed.STATIC_PACKET);
            return;
          }
         
        }
       
        int tempBodyPart = item.getItem().getBodyPart();
        L2ItemInstance tempItem = activeChar.getInventory().getPaperdollItemByL2ItemId(tempBodyPart);
       
        // remove augmentation stats for replaced items
        // currently weapons only..
        if (tempItem != null && tempItem.isAugmented())
        {
          tempItem.getAugmentation().removeBoni(activeChar);
        }
       
        // check if the item replaces a wear-item
        if (tempItem != null && tempItem.isWear())
          // dont allow an item to replace a wear-item
          return;
        else if (tempBodyPart == 0x4000) // left+right hand equipment
        {
          // this may not remove left OR right hand equipment
          tempItem = activeChar.getInventory().getPaperdollItem(7);
          if (tempItem != null && tempItem.isWear())
            return;
         
          tempItem = activeChar.getInventory().getPaperdollItem(8);
          if (tempItem != null && tempItem.isWear())
            return;
        }
        else if (tempBodyPart == 0x8000) // fullbody armor
        {
          // this may not remove chest or leggins
          tempItem = activeChar.getInventory().getPaperdollItem(10);
          if (tempItem != null && tempItem.isWear())
            return;
         
          tempItem = activeChar.getInventory().getPaperdollItem(11);
          if (tempItem != null && tempItem.isWear())
            return;
        }
       
        // Left hand
        tempItem = activeChar.getInventory().getPaperdollItem(7);
        // Elrokian Trap like L2OFF, remove skills
        if (tempItem != null && tempItem.getItemId() == 8763)
        {
          activeChar.removeSkill(3626, true);
          activeChar.removeSkill(3627, true);
          activeChar.removeSkill(3628, true);
          activeChar.sendSkillList();
        }
       
        if (item.getEnchantLevel() > 0)
        {
          sm = new SystemMessage(SystemMessageId.S1_S2_EQUIPPED);
          sm.addNumber(item.getEnchantLevel());
          sm.addItemName(itemId);
        }
        else
        {
          sm = new SystemMessage(SystemMessageId.S1_EQUIPPED);
          sm.addItemName(itemId);
        }
        activeChar.sendPacket(sm);
       
        // Apply augementation boni on equip
        if (item.isAugmented())
View Full Code Here

              //activeChar.addAutoSoulShot(_itemId);
              //ExAutoSoulShot atk = new ExAutoSoulShot(_itemId, _type);
              //activeChar.sendPacket(atk);

              //start the auto soulshot use
              SystemMessage sm = new SystemMessage(SystemMessageId.USE_OF_S1_WILL_BE_AUTO);
              sm.addString(item.getItemName());
              activeChar.sendPacket(sm);

              activeChar.rechargeAutoSoulShot(true, true, true);
              }
              else
              {
                SystemMessage sm = new SystemMessage(SystemMessageId.NO_SERVITOR_CANNOT_AUTOMATE_USE);
                  sm.addString(item.getItemName());
                  activeChar.sendPacket(sm);
                  return;
              }
            }
            else
            {
              if(activeChar.getActiveWeaponItem() != activeChar.getFistsWeaponItem() && item.getItem().getCrystalType() == activeChar.getActiveWeaponItem().getCrystalType())
              {
                if(_itemId >= 3947 && _itemId <= 3952 && activeChar.isInOlympiadMode())
                {
                  SystemMessage sm = new SystemMessage(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT);
                  sm.addString(item.getItemName());
                  activeChar.sendPacket(sm);
                }
                else
                {
                  //activeChar.addAutoSoulShot(_itemId);
                 
                  // start the auto soulshot use
                  SystemMessage sm = new SystemMessage(SystemMessageId.USE_OF_S1_WILL_BE_AUTO);
                  sm.addString(item.getItemName());
                  activeChar.sendPacket(sm);

                }
               
              }
              else
              {
                if(_itemId >= 2509 && _itemId <= 2514 || _itemId >= 3947 && _itemId <= 3952 || _itemId == 5790)
                {
                  activeChar.sendPacket(new SystemMessage(SystemMessageId.SPIRITSHOTS_GRADE_MISMATCH));
                }
                else
                {
                  activeChar.sendPacket(new SystemMessage(SystemMessageId.SOULSHOTS_GRADE_MISMATCH));
                }
              }
             
              activeChar.rechargeAutoSoulShot(true, true, false);
             
            }
          }
         
        }
        else if(_type == 0)
        {
          activeChar.removeAutoSoulShot(_itemId);
          //ExAutoSoulShot atk = new ExAutoSoulShot(_itemId, _type);
          //activeChar.sendPacket(atk);

          //cancel the auto soulshot use
          SystemMessage sm = new SystemMessage(SystemMessageId.AUTO_USE_OF_S1_CANCELLED);
          sm.addString(item.getItemName());
          activeChar.sendPacket(sm);
        }
       
        ExAutoSoulShot atk = new ExAutoSoulShot(_itemId, _type);
        activeChar.sendPacket(atk);
View Full Code Here

   
    if (miss)
    {
      if (target instanceof L2PcInstance)
      {
        SystemMessage sm = new SystemMessage(SystemMessageId.AVOIDED_S1S_ATTACK);
       
        if (this instanceof L2Summon)
        {
          int mobId = ((L2Summon) this).getTemplate().npcId;
          sm.addNpcName(mobId);
        }
        else
        {
          sm.addString(getName());
        }
       
        ((L2PcInstance) target).sendPacket(sm);
       
        sm = null;
      }
    }
   
    // If attack isn't aborted, send a message system (critical hit, missed...) to attacker/target if they are L2PcInstance
    if (!isAttackAborted())
    {
      if (Config.ALLOW_RAID_BOSS_PETRIFIED && (this instanceof L2PcInstance || this instanceof L2Summon)) // Check if option is True Or False.
      {
        boolean to_be_cursed = false;
       
        // check on BossZone raid lvl
        if (!(target instanceof L2PlayableInstance) && !(target instanceof L2SummonInstance))
        { // this must work just on mobs/raids
       
          if ((target.isRaid() && getLevel() > target.getLevel() + 8) || (!(target instanceof L2PcInstance) && (target.getTarget() != null && target.getTarget() instanceof L2RaidBossInstance && getLevel() > ((L2RaidBossInstance) target.getTarget()).getLevel() + 8)) || (!(target instanceof L2PcInstance) && (target.getTarget() != null && target.getTarget() instanceof L2GrandBossInstance && getLevel() > ((L2GrandBossInstance) target.getTarget()).getLevel() + 8)))
         
          {
            to_be_cursed = true;
          }
         
          // advanced check too if not already cursed
          if (!to_be_cursed)
          {         
            int boss_id = -1;
            L2NpcTemplate boss_template = null;
            L2BossZone boss_zone = GrandBossManager.getInstance().getZone(this);
           
            if (boss_zone != null)
            {
              boss_id = boss_zone.getBossId();
            }
           
            // boolean alive = false;
           
            if (boss_id != -1)
            {         
              boss_template = NpcTable.getInstance().getTemplate(boss_id);
             
              if (boss_template != null && getLevel() > boss_template.getLevel() + 8)
              {           
                L2MonsterInstance boss_instance = null;
               
                if (boss_template.type.equals("L2RaidBoss"))
                {           
                  StatsSet actual_boss_stat = RaidBossSpawnManager.getInstance().getStatsSet(boss_id);
                  if (actual_boss_stat != null)
                  {               
                    // alive = actual_boss_stat.getLong("respawnTime") == 0;
                    boss_instance = RaidBossSpawnManager.getInstance().getBoss(boss_id);               
                  }           
                }
                else if (boss_template.type.equals("L2GrandBoss"))
                {           
                  StatsSet actual_boss_stat = GrandBossManager.getInstance().getStatsSet(boss_id);
                  if (actual_boss_stat != null)
                  {               
                    // alive = actual_boss_stat.getLong("respawn_time") == 0;
                    boss_instance = GrandBossManager.getInstance().getBoss(boss_id);               
                  }
                }
               
                // max allowed rage into take cursed is 3000
                if (boss_instance != null/* && alive */&& boss_instance.isInsideRadius(this, 3000, false, false))
                {
                  to_be_cursed = true;
                }
              }         
            }       
          }     
        }
       
        if (to_be_cursed)
        {
          L2Skill skill = SkillTable.getInstance().getInfo(4515, 1);
         
          if (skill != null)
          {
            abortAttack();
            abortCast();
            getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
            skill.getEffects(target, this, false, false, false);
           
            if (this instanceof L2Summon)
            {         
              L2Summon src = ((L2Summon) this);
              if (src.getOwner() != null)
              {
                src.getOwner().abortAttack();
                src.getOwner().abortCast();
                src.getOwner().getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
                skill.getEffects(target, src.getOwner(), false, false, false);
              }
            }       
          }
          else
            _log.warning("Skill 4515 at level 1 is missing in DP.");
         
          skill = null;
         
          if (target instanceof L2MinionInstance)
          {
            ((L2MinionInstance) target).getLeader().stopHating(this);
           
            List<L2MinionInstance> spawnedMinions = ((L2MinionInstance) target).getLeader().getSpawnedMinions();
            if (spawnedMinions != null && spawnedMinions.size() > 0)
            {
              Iterator<L2MinionInstance> itr = spawnedMinions.iterator();
              L2MinionInstance minion;
              while (itr.hasNext())
              {
                minion = itr.next();
                if (((L2MinionInstance) target).getLeader().getMostHated() == null)
                {
                  ((L2AttackableAI) minion.getAI()).setGlobalAggro(-25);
                  minion.clearAggroList();
                  minion.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
                  minion.setWalking();
                }
                if (minion != null && !minion.isDead())
                {
                  ((L2AttackableAI) minion.getAI()).setGlobalAggro(-25);
                  minion.clearAggroList();
                  minion.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
                  minion.addDamage(((L2MinionInstance) target).getLeader().getMostHated(), 100);
                }
              }
              itr = null;
              spawnedMinions = null;
              minion = null;
            }
          }
          else
          {
            ((L2Attackable) target).stopHating(this);
            List<L2MinionInstance> spawnedMinions = ((L2MonsterInstance) target).getSpawnedMinions();
            if (spawnedMinions != null && spawnedMinions.size() > 0)
            {
              Iterator<L2MinionInstance> itr = spawnedMinions.iterator();
              L2MinionInstance minion;
              while (itr.hasNext())
              {
                minion = itr.next();
                if (((L2Attackable) target).getMostHated() == null)
                {
                  ((L2AttackableAI) minion.getAI()).setGlobalAggro(-25);
                  minion.clearAggroList();
                  minion.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
                  minion.setWalking();
                }
                if (minion != null && !minion.isDead())
                {
                  ((L2AttackableAI) minion.getAI()).setGlobalAggro(-25);
                  minion.clearAggroList();
                  minion.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
                  minion.addDamage(((L2Attackable) target).getMostHated(), 100);
                }
              }
              itr = null;
              spawnedMinions = null;
              minion = null;
            }
          }
         
          damage = 0; // prevents messing up drop calculation
        }
      }
     
      sendDamageMessage(target, damage, false, crit, miss);
     
      // If L2Character target is a L2PcInstance, send a system message
      if (target instanceof L2PcInstance)
      {
        L2PcInstance enemy = (L2PcInstance) target;
       
        // Check if shield is efficient
        if (shld)
        {
          enemy.sendPacket(new SystemMessage(SystemMessageId.SHIELD_DEFENCE_SUCCESSFULL));
          // else if (!miss && damage < 1)
          // enemy.sendMessage("You hit the target's armor.");
        }
       
        enemy = null;
      }
      else if (target instanceof L2Summon)
      {
        L2Summon activeSummon = (L2Summon) target;
       
        SystemMessage sm = new SystemMessage(SystemMessageId.PET_RECEIVED_S2_DAMAGE_BY_S1);
        sm.addString(getName());
        sm.addNumber(damage);
        activeSummon.getOwner().sendPacket(sm);
       
        sm = null;
        activeSummon = null;
      }
View Full Code Here

TOP

Related Classes of com.l2jfrozen.gameserver.network.serverpackets.SystemMessage

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.