Package l2p.gameserver.model.items

Examples of l2p.gameserver.model.items.L2ItemInstance


    if(player.isTerritoryFlagEquipped())
    {
      return;
    }
    decayMe();
    L2ItemInstance item = ItemTable.getInstance().createItem(_itemId);
    item.setCustomFlags(L2ItemInstance.FLAG_EQUIP_ON_PICKUP | L2ItemInstance.FLAG_NO_DESTROY | L2ItemInstance.FLAG_NO_TRADE | L2ItemInstance.FLAG_NO_UNEQUIP, false);
    player.getInventory().addItem(item);
    player.getInventory().equipItem(item, false);
    player.sendChanges();
    _item = item;
    player.sendPacket(Msg.YOU_VE_ACQUIRED_THE_WARD_MOVE_QUICKLY_TO_YOUR_FORCES__OUTPOST);
View Full Code Here


      SystemMessage sm;
      String path;
      int cabal = SevenSigns.CABAL_NULL;
      int stoneType = 0;
      //      int inventorySize = player.getInventory().getSize() + 1;
      L2ItemInstance ancientAdena = player.getInventory().getItemByItemId(SevenSigns.ANCIENT_ADENA_ID);
      long ancientAdenaAmount = ancientAdena == null ? 0 : ancientAdena.getCount();
      int val = Integer.parseInt(command.substring(11, 12).trim());
      if(command.length() > 12) // SevenSigns x[x] x [x..x]
      {
        val = Integer.parseInt(command.substring(11, 13).trim());
      }
      if(command.length() > 13)
      {
        try
        {
          cabal = Integer.parseInt(command.substring(14, 15).trim());
        }
        catch(Exception e)
        {
          try
          {
            cabal = Integer.parseInt(command.substring(13, 14).trim());
          }
          catch(Exception e2)
          {
          }
        }
      }
      switch(val)
      {
        case 2: // Purchase Record of the Seven Signs
          if(!player.getInventory().validateCapacity(1))
          {
            player.sendPacket(Msg.YOUR_INVENTORY_IS_FULL);
            return;
          }
          if(SevenSigns.RECORD_SEVEN_SIGNS_COST > player.getAdena())
          {
            player.sendPacket(Msg.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
            return;
          }
          player.reduceAdena(SevenSigns.RECORD_SEVEN_SIGNS_COST, true);
          player.getInventory().addItem(ItemTable.getInstance().createItem(SevenSigns.RECORD_SEVEN_SIGNS_ID));
          player.sendPacket(SystemMessage.obtainItems(SevenSigns.RECORD_SEVEN_SIGNS_ID, 1, 0));
          break;
        case 3: // Join Cabal Intro 1
        case 8: // Festival of Darkness Intro - SevenSigns x [0]1
          cabal = SevenSigns.getInstance().getPriestCabal(getNpcId());
          showChatWindow(player, val, SevenSigns.getCabalShortName(cabal), false);
          break;
        case 10: // Teleport Locations List
          cabal = SevenSigns.getInstance().getPriestCabal(getNpcId());
          if(SevenSigns.getInstance().isSealValidationPeriod())
          {
            showChatWindow(player, val, "", false);
          }
          else
          {
            int town = TownManager.getInstance().getClosestTownNumber(this);
            if(town >= 6 && town <= 16)
            {
              showChatWindow(player, val, String.valueOf(town), false);
            }
            else
            {
              showChatWindow(player, val, "no", false);
            }
          }
          break;
        case 4: // Join a Cabal - SevenSigns 4 [0]1 x
          int newSeal = Integer.parseInt(command.substring(15));
          int oldCabal = SevenSigns.getInstance().getPlayerCabal(player);
          if(oldCabal != SevenSigns.CABAL_NULL)
          {
            player.sendMessage(new CustomMessage("l2p.gameserver.model.instances.L2SignsPriestInstance.AlreadyMember", player).addString(SevenSigns.getCabalName(cabal)));
            return;
          }
          if(player.getClassId().level() == 0)
          {
            player.sendMessage(new CustomMessage("l2p.gameserver.model.instances.L2SignsPriestInstance.YouAreNewbie", player));
            break;
          }
          else if(player.getClassId().level() >= 2)
          {
            if(Config.ALT_GAME_REQUIRE_CASTLE_DAWN)
            {
              if(getPlayerAllyHasCastle(player))
              {
                if(cabal == SevenSigns.CABAL_DUSK)
                {
                  player.sendMessage(new CustomMessage("l2p.gameserver.model.instances.L2SignsPriestInstance.CastleOwning", player));
                  return;
                }
              }
              else
                /*
                               * If the player is trying to join the Lords of Dawn, check if they are
                               * carrying a Lord's certificate.
                               *
                               * If not then try to take the required amount of adena instead.
                               */
                if(cabal == SevenSigns.CABAL_DAWN)
                {
                  boolean allowJoinDawn = false;
                  if(Functions.getItemCount(player, SevenSigns.CERTIFICATE_OF_APPROVAL_ID) > 0)
                  {
                    Functions.removeItem(player, SevenSigns.CERTIFICATE_OF_APPROVAL_ID, 1);
                    allowJoinDawn = true;
                  }
                  else if(Config.ALT_GAME_ALLOW_ADENA_DAWN && player.getAdena() >= SevenSigns.ADENA_JOIN_DAWN_COST)
                  {
                    player.reduceAdena(SevenSigns.ADENA_JOIN_DAWN_COST, true);
                    allowJoinDawn = true;
                  }
                  if(!allowJoinDawn)
                  {
                    if(Config.ALT_GAME_ALLOW_ADENA_DAWN)
                    {
                      player.sendMessage(new CustomMessage("l2p.gameserver.model.instances.L2SignsPriestInstance.CastleOwningCertificate", player));
                    }
                    else
                    {
                      player.sendMessage(new CustomMessage("l2p.gameserver.model.instances.L2SignsPriestInstance.CastleOwningCertificate2", player));
                    }
                    return;
                  }
                }
            }
          }
          SevenSigns.getInstance().setPlayerInfo(player.getObjectId(), cabal, newSeal);
          if(cabal == SevenSigns.CABAL_DAWN)
          {
            player.sendPacket(Msg.YOU_WILL_PARTICIPATE_IN_THE_SEVEN_SIGNS_AS_A_MEMBER_OF_THE_LORDS_OF_DAWN); // Joined Dawn
          }
          else
          {
            player.sendPacket(Msg.YOU_WILL_PARTICIPATE_IN_THE_SEVEN_SIGNS_AS_A_MEMBER_OF_THE_REVOLUTIONARIES_OF_DUSK);
          } // Joined Dusk
          //Show a confirmation message to the user, indicating which seal they chose.
          switch(newSeal)
          {
            case SevenSigns.SEAL_AVARICE:
              player.sendPacket(Msg.YOUVE_CHOSEN_TO_FIGHT_FOR_THE_SEAL_OF_AVARICE_DURING_THIS_QUEST_EVENT_PERIOD);
              break;
            case SevenSigns.SEAL_GNOSIS:
              player.sendPacket(Msg.YOUVE_CHOSEN_TO_FIGHT_FOR_THE_SEAL_OF_GNOSIS_DURING_THIS_QUEST_EVENT_PERIOD);
              break;
            case SevenSigns.SEAL_STRIFE:
              player.sendPacket(Msg.YOUVE_CHOSEN_TO_FIGHT_FOR_THE_SEAL_OF_STRIFE_DURING_THIS_QUEST_EVENT_PERIOD);
              break;
          }
          showChatWindow(player, 4, SevenSigns.getCabalShortName(cabal), false);
          break;
        case 6: // Contribute Seal Stones - SevenSigns 6 x
          stoneType = Integer.parseInt(command.substring(13));
          L2ItemInstance redStones = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_RED_ID);
          long redStoneCount = redStones == null ? 0 : redStones.getCount();
          L2ItemInstance greenStones = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_GREEN_ID);
          long greenStoneCount = greenStones == null ? 0 : greenStones.getCount();
          L2ItemInstance blueStones = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_BLUE_ID);
          long blueStoneCount = blueStones == null ? 0 : blueStones.getCount();
          long contribScore = SevenSigns.getInstance().getPlayerContribScore(player);
          boolean stonesFound = false;
          if(contribScore == SevenSigns.MAXIMUM_PLAYER_CONTRIB)
          {
            player.sendPacket(Msg.CONTRIBUTION_LEVEL_HAS_EXCEEDED_THE_LIMIT_YOU_MAY_NOT_CONTINUE);
          }
          else
          {
            long redContribCount = 0;
            long greenContribCount = 0;
            long blueContribCount = 0;
            switch(stoneType)
            {
              case 1:
                blueContribCount = (SevenSigns.MAXIMUM_PLAYER_CONTRIB - contribScore) / SevenSigns.BLUE_CONTRIB_POINTS;
                if(blueContribCount > blueStoneCount)
                {
                  blueContribCount = blueStoneCount;
                }
                break;
              case 2:
                greenContribCount = (SevenSigns.MAXIMUM_PLAYER_CONTRIB - contribScore) / SevenSigns.GREEN_CONTRIB_POINTS;
                if(greenContribCount > greenStoneCount)
                {
                  greenContribCount = greenStoneCount;
                }
                break;
              case 3:
                redContribCount = (SevenSigns.MAXIMUM_PLAYER_CONTRIB - contribScore) / SevenSigns.RED_CONTRIB_POINTS;
                if(redContribCount > redStoneCount)
                {
                  redContribCount = redStoneCount;
                }
                break;
              case 4:
                long tempContribScore = contribScore;
                redContribCount = (SevenSigns.MAXIMUM_PLAYER_CONTRIB - tempContribScore) / SevenSigns.RED_CONTRIB_POINTS;
                if(redContribCount > redStoneCount)
                {
                  redContribCount = redStoneCount;
                }
                tempContribScore += redContribCount * SevenSigns.RED_CONTRIB_POINTS;
                greenContribCount = (SevenSigns.MAXIMUM_PLAYER_CONTRIB - tempContribScore) / SevenSigns.GREEN_CONTRIB_POINTS;
                if(greenContribCount > greenStoneCount)
                {
                  greenContribCount = greenStoneCount;
                }
                tempContribScore += greenContribCount * SevenSigns.GREEN_CONTRIB_POINTS;
                blueContribCount = (SevenSigns.MAXIMUM_PLAYER_CONTRIB - tempContribScore) / SevenSigns.BLUE_CONTRIB_POINTS;
                if(blueContribCount > blueStoneCount)
                {
                  blueContribCount = blueStoneCount;
                }
                break;
            }
            if(redContribCount > 0)
            {
              L2ItemInstance temp = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_RED_ID);
              if(temp != null && temp.getCount() >= redContribCount)
              {
                player.getInventory().destroyItemByItemId(SevenSigns.SEAL_STONE_RED_ID, (int) redContribCount, true);
                stonesFound = true;
              }
            }
            if(greenContribCount > 0)
            {
              L2ItemInstance temp = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_GREEN_ID);
              if(temp != null && temp.getCount() >= greenContribCount)
              {
                player.getInventory().destroyItemByItemId(SevenSigns.SEAL_STONE_GREEN_ID, (int) greenContribCount, true);
                stonesFound = true;
              }
            }
            if(blueContribCount > 0)
            {
              L2ItemInstance temp = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_BLUE_ID);
              if(temp != null && temp.getCount() >= blueContribCount)
              {
                player.getInventory().destroyItemByItemId(SevenSigns.SEAL_STONE_BLUE_ID, (int) blueContribCount, true);
                stonesFound = true;
              }
            }
            if(!stonesFound)
            {
              player.sendMessage(new CustomMessage("l2p.gameserver.model.instances.L2SignsPriestInstance.DontHaveAnySSType", player));
              return;
            }
            contribScore = SevenSigns.getInstance().addPlayerStoneContrib(player, blueContribCount, greenContribCount, redContribCount);
            sm = new SystemMessage(SystemMessage.YOUR_CONTRIBUTION_SCORE_IS_INCREASED_BY_S1);
            sm.addNumber(contribScore);
            player.sendPacket(sm);
            showChatWindow(player, 6, null, false);
          }
          break;
        case 7: // Exchange Ancient Adena for Adena - SevenSigns 7 xxxxxxx
          long ancientAdenaConvert = 0;
          try
          {
            ancientAdenaConvert = Long.parseLong(command.substring(13).trim());
          }
          catch(NumberFormatException e)
          {
            player.sendMessage(new CustomMessage("common.IntegerAmount", player));
            return;
          }
          catch(StringIndexOutOfBoundsException e)
          {
            player.sendMessage(new CustomMessage("common.IntegerAmount", player));
            return;
          }
          if(ancientAdenaAmount < ancientAdenaConvert || ancientAdenaConvert < 1)
          {
            player.sendPacket(Msg.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
            return;
          }
          InventoryUpdate iu = new InventoryUpdate();
          iu.addItem(player.addAdena(ancientAdenaConvert));
          iu.addItem(player.getInventory().destroyItemByItemId(SevenSigns.ANCIENT_ADENA_ID, ancientAdenaConvert, true));
          player.sendPacket(iu);
          player.sendPacket(SystemMessage.removeItems(5575, ancientAdenaConvert));
          player.sendPacket(SystemMessage.obtainItems(57, ancientAdenaConvert, 0));
          break;
        case 9: // Receive Contribution Rewards
          int playerCabal = SevenSigns.getInstance().getPlayerCabal(player);
          int winningCabal = SevenSigns.getInstance().getCabalHighestScore();
          if(SevenSigns.getInstance().isSealValidationPeriod() && playerCabal == winningCabal)
          {
            int ancientAdenaReward = SevenSigns.getInstance().getAncientAdenaReward(player, true);
            if(ancientAdenaReward < 3)
            {
              showChatWindow(player, 9, "b", false);
              return;
            }
            ancientAdena = ItemTable.getInstance().createItem(SevenSigns.ANCIENT_ADENA_ID);
            ancientAdena.setCount(ancientAdenaReward);
            player.getInventory().addItem(ancientAdena);
            player.sendPacket(SystemMessage.obtainItems(SevenSigns.ANCIENT_ADENA_ID, ancientAdenaReward, 0));
            showChatWindow(player, 9, "a", false);
          }
          break;
        case 11: // Teleport to Hunting Grounds - deprecated, instead use scripts_Util:QuestGatekeeper x y x 5575 price
          try
          {
            String portInfo = command.substring(14).trim();
            StringTokenizer st = new StringTokenizer(portInfo);
            int x = Integer.parseInt(st.nextToken());
            int y = Integer.parseInt(st.nextToken());
            int z = Integer.parseInt(st.nextToken());
            long ancientAdenaCost = Long.parseLong(st.nextToken());
            if(ancientAdenaCost > 0)
            {
              L2ItemInstance temp = player.getInventory().getItemByItemId(SevenSigns.ANCIENT_ADENA_ID);
              if(temp == null || ancientAdenaCost > temp.getCount())
              {
                player.sendPacket(Msg.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
                return;
              }
              player.getInventory().destroyItemByItemId(SevenSigns.ANCIENT_ADENA_ID, ancientAdenaCost, true);
            }
            player.teleToLocation(x, y, z);
          }
          catch(Exception e)
          {
            _log.warning("SevenSigns: Error occurred while teleporting player: " + e);
          }
          break;
        case 17: // Exchange Seal Stones for Ancient Adena (Type Choice) - SevenSigns 17 x
          stoneType = Integer.parseInt(command.substring(14));
          int stoneId = 0;
          long stoneCount = 0;
          int stoneValue = 0;
          String stoneColor = null;
          String content;
          if(stoneType == 4)
          {
            L2ItemInstance BlueStoneInstance = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_BLUE_ID);
            long bcount = BlueStoneInstance != null ? BlueStoneInstance.getCount() : 0;
            L2ItemInstance GreenStoneInstance = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_GREEN_ID);
            long gcount = GreenStoneInstance != null ? GreenStoneInstance.getCount() : 0;
            L2ItemInstance RedStoneInstance = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_RED_ID);
            long rcount = RedStoneInstance != null ? RedStoneInstance.getCount() : 0;
            long ancientAdenaReward = SevenSigns.calcAncientAdenaReward(bcount, gcount, rcount);
            if(ancientAdenaReward > 0)
            {
              if(BlueStoneInstance != null)
              {
                player.getInventory().destroyItem(BlueStoneInstance, bcount, true);
                player.sendPacket(SystemMessage.removeItems(SevenSigns.SEAL_STONE_BLUE_ID, bcount));
              }
              if(GreenStoneInstance != null)
              {
                player.getInventory().destroyItem(GreenStoneInstance, gcount, true);
                player.sendPacket(SystemMessage.removeItems(SevenSigns.SEAL_STONE_GREEN_ID, gcount));
              }
              if(RedStoneInstance != null)
              {
                player.getInventory().destroyItem(RedStoneInstance, rcount, true);
                player.sendPacket(SystemMessage.removeItems(SevenSigns.SEAL_STONE_RED_ID, rcount));
              }
              ancientAdena = ItemTable.getInstance().createItem(SevenSigns.ANCIENT_ADENA_ID);
              ancientAdena.setCount(ancientAdenaReward);
              player.getInventory().addItem(ancientAdena);
              player.sendPacket(SystemMessage.obtainItems(SevenSigns.ANCIENT_ADENA_ID, ancientAdenaReward, 0));
            }
            else
            {
              player.sendMessage(new CustomMessage("l2p.gameserver.model.instances.L2SignsPriestInstance.DontHaveAnySS", player));
            }
            break;
          }
          switch(stoneType)
          {
            case 1:
              stoneColor = "blue";
              stoneId = SevenSigns.SEAL_STONE_BLUE_ID;
              stoneValue = SevenSigns.SEAL_STONE_BLUE_VALUE;
              break;
            case 2:
              stoneColor = "green";
              stoneId = SevenSigns.SEAL_STONE_GREEN_ID;
              stoneValue = SevenSigns.SEAL_STONE_GREEN_VALUE;
              break;
            case 3:
              stoneColor = "red";
              stoneId = SevenSigns.SEAL_STONE_RED_ID;
              stoneValue = SevenSigns.SEAL_STONE_RED_VALUE;
              break;
          }
          L2ItemInstance stoneInstance = player.getInventory().getItemByItemId(stoneId);
          if(stoneInstance != null)
          {
            stoneCount = stoneInstance.getCount();
          }
          path = SevenSigns.SEVEN_SIGNS_HTML_PATH + "signs_17.htm";
          content = Files.read(path, player);
          if(content != null)
          {
            content = content.replaceAll("%stoneColor%", stoneColor);
            content = content.replaceAll("%stoneValue%", String.valueOf(stoneValue));
            content = content.replaceAll("%stoneCount%", String.valueOf(stoneCount));
            content = content.replaceAll("%stoneItemId%", String.valueOf(stoneId));
            NpcHtmlMessage html = new NpcHtmlMessage(player, this);
            html.setHtml(content);
            player.sendPacket(html);
          }
          else
          {
            _log.warning("Problem with HTML text " + SevenSigns.SEVEN_SIGNS_HTML_PATH + "signs_17.htm: " + path);
          }
          break;
        case 18: // Exchange Seal Stones for Ancient Adena - SevenSigns 18 xxxx xxxxxx
          int convertStoneId = Integer.parseInt(command.substring(14, 18));
          long convertCount = 0;
          try
          {
            convertCount = Long.parseLong(command.substring(19).trim());
          }
          catch(Exception NumberFormatException)
          {
            player.sendMessage(new CustomMessage("common.IntegerAmount", player));
            break;
          }
          L2ItemInstance convertItem = player.getInventory().getItemByItemId(convertStoneId);
          if(convertItem == null)
          {
            player.sendMessage(new CustomMessage("l2p.gameserver.model.instances.L2SignsPriestInstance.DontHaveAnySSType", player));
            break;
          }
          long totalCount = convertItem.getCount();
          long ancientAdenaReward = 0;
          if(convertCount <= totalCount && convertCount > 0)
          {
            switch(convertStoneId)
            {
              case SevenSigns.SEAL_STONE_BLUE_ID:
                ancientAdenaReward = SevenSigns.calcAncientAdenaReward(convertCount, 0, 0);
                break;
              case SevenSigns.SEAL_STONE_GREEN_ID:
                ancientAdenaReward = SevenSigns.calcAncientAdenaReward(0, convertCount, 0);
                break;
              case SevenSigns.SEAL_STONE_RED_ID:
                ancientAdenaReward = SevenSigns.calcAncientAdenaReward(0, 0, convertCount);
                break;
            }
            L2ItemInstance temp = player.getInventory().getItemByItemId(convertStoneId);
            if(temp != null && temp.getCount() >= convertCount)
            {
              player.getInventory().destroyItemByItemId(convertStoneId, convertCount, true);
              ancientAdena = ItemTable.getInstance().createItem(SevenSigns.ANCIENT_ADENA_ID);
              ancientAdena.setCount(ancientAdenaReward);
              player.getInventory().addItem(ancientAdena);
View Full Code Here

    L2Player player = (L2Player) getSelf();
    if(player == null)
    {
      return;
    }
    L2ItemInstance createditem = ItemTable.getInstance().createItem(item);
    player.getInventory().addItem(createditem);
    Log.LogItem(player, Log.GetItem, createditem);
    player.sendPacket(new ItemList(player, true), SystemMessage.obtainItems(item, 1, 0));
  }
View Full Code Here

    }
    L2Player player = (L2Player) target;
    // now we need to find the equipped weapon of the targeted character...
    int curEnchant; // display purposes only
    // only attempt to enchant if there is a weapon equipped
    L2ItemInstance itemInstance = player.getInventory().getPaperdollItem(armorType);
    if(itemInstance != null)
    {
      curEnchant = itemInstance.getEnchantLevel();
      // set enchant value
      player.getInventory().unEquipItemInSlot(armorType);
      itemInstance.setEnchantLevel(ench);
      player.getInventory().equipItem(itemInstance, true);
      // send packets
      player.sendPacket(new InventoryUpdate().addModifiedItem(itemInstance));
      player.broadcastUserInfo(true);
      // informations
      activeChar.sendMessage("Changed enchantment of " + player.getName() + "'s " + itemInstance.getName() + " from " + curEnchant + " to " + ench + ".");
      player.sendMessage("Admin has changed the enchantment of your " + itemInstance.getName() + " from " + curEnchant + " to " + ench + ".");
      if(activeChar != player && ench >= (itemInstance.getItem().getType2() == L2Item.TYPE2_WEAPON ? 6 : 5))
      {
        player.altUseSkill(SkillTable.getInstance().getInfo(21006, 1), player);
        player.broadcastPacket(new SystemMessage(SystemMessage.C1_HAS_SUCCESSFULY_ENCHANTED_A__S2_S3).addName(player).addNumber(ench).addItemName(itemInstance.getItemId()));
      }
      if(Config.ProtectEnchantGMEnable && ench > Config.ProtectEnchantGMMax)
      {
        mOption.banAcc(activeChar, "ProtectEnchantGM");
        mOption.banAcc(player, "ProtectEnchantGM");
View Full Code Here

    {
      return;
    }
    if(count > 0)
    {
      L2ItemInstance ii = player.getInventory().getItemByItemId(item);
      if(ii == null || ii.getCount() < count)
      {
        player.sendPacket(Msg.YOU_DO_NOT_HAVE_ENOUGH_REQUIRED_ITEMS);
        return;
      }
      player.getInventory().destroyItem(ii, count, true);
View Full Code Here

    dialog.append("<td>Crit damage</td><td>").append(df.format(2 * cha.calcStat(Stats.CRITICAL_DAMAGE, null, null))).append("% + ").append((int) cha.calcStat(Stats.CRITICAL_DAMAGE_STATIC, null, null)).append("</td>");
    dialog.append("<td>Magic crit</td><td>").append(df.format(cha.getMagicCriticalRate(null, null))).append("%</td>");
    dialog.append("</tr><tr>");
    dialog.append("<td>Blow rate</td><td>x").append(df.format(cha.calcStat(Stats.FATALBLOW_RATE, null, null))).append("</td>");
    dialog.append("<td>DPS</td><td>").append((int) calcDPS(cha)).append("</td>");
    L2ItemInstance shld = cha.getSecondaryWeaponInstance();
    if(shld != null && shld.getItemType() == WeaponType.NONE)
    {
      dialog.append("</tr><tr>");
      dialog.append("<td>Shield def</td><td>").append(cha.getShldDef()).append("</td>");
      dialog.append("<td>Shield rate</td><td>").append(df.format(cha.calcStat(Stats.SHIELD_RATE, null, null))).append("</td>");
    }
View Full Code Here

    public boolean OnActionShift_L2ItemInstance(L2Player player, L2Object object) {
        if (player == null || object == null || !player.getPlayerAccess().CanViewChar) {
            return false;
        }
        String dialog;
        L2ItemInstance item = (L2ItemInstance) object;
        dialog = Files.read("data/scripts/actions/admin.L2ItemInstance.onActionShift.htm");
        dialog = dialog.replaceFirst("%name%", String.valueOf(item.getItem().getName()));
        dialog = dialog.replaceFirst("%objId%", String.valueOf(item.getObjectId()));
        dialog = dialog.replaceFirst("%itemId%", String.valueOf(item.getItemId()));
        dialog = dialog.replaceFirst("%grade%", String.valueOf(item.getCrystalType()));
        dialog = dialog.replaceFirst("%count%", String.valueOf(item.getCount()));

        dialog = dialog.replaceFirst("%owner%", String.valueOf(item.getPlayer()));
        dialog = dialog.replaceFirst("%ownerId%", String.valueOf(item.getPlayer().getObjectId()));

        dialog = dialog.replaceFirst("%attrElement%", String.valueOf(item.getAttackElement()));
        dialog = dialog.replaceFirst("%attrValue%", String.valueOf(item.getAttributeElementValue()));

        dialog = dialog.replaceFirst("%enchLevel%", String.valueOf(item.getEnchantLevel()));
        dialog = dialog.replaceFirst("%type%", String.valueOf(item.getItemType()));

        dialog = dialog.replaceFirst("%dropTime%", String.valueOf((int) item.getDropTimeOwner()));
        dialog = dialog.replaceFirst("%dropOwner%", String.valueOf(item.getItemDropOwner()));
        dialog = dialog.replaceFirst("%dropOwnerId%", String.valueOf(item.getItemDropOwner().getObjectId()));

        show(dialog, player);
        return true;
    }
View Full Code Here

        return;
      }
      _consumeCountdown -= usedtime;
      if(_itemConsumeIdInTime > 0 && _itemConsumeCountInTime > 0 && _consumeCountdown <= 0)
      {
        L2ItemInstance item = owner.getInventory().getItemByItemId(_summon.getItemConsumeIdInTime());
        if(item != null && item.getCount() >= _summon.getItemConsumeCountInTime())
        {
          _consumeCountdown = _itemConsumeDelay;
          L2ItemInstance dest = owner.getInventory().destroyItemByItemId(_summon.getItemConsumeIdInTime(), _summon.getItemConsumeCountInTime(), true);
          owner.sendPacket(new SystemMessage(SystemMessage.A_SUMMONED_MONSTER_USES_S1).addItemName(dest.getItemId()));
        }
        else
        {
          owner.sendPacket(Msg.SINCE_YOU_DO_NOT_HAVE_ENOUGH_ITEMS_TO_MAINTAIN_THE_SERVITORS_STAY_THE_SERVITOR_WILL_DISAPPEAR);
          _summon.unSummon();
View Full Code Here

    player.getParty().broadcastToPartyMembers(new SystemMessage(SystemMessage.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MINUTES).addNumber(timelimit));
  }

  private void dropItem(L2Character npc, int itemId, int count)
  {
    L2ItemInstance item = ItemTable.getInstance().createItem(itemId);
    item.setCount(count);
    item.dropMe(npc, npc.getLoc());
  }
View Full Code Here

    return true;
  }

  public boolean tryFeed()
  {
    L2ItemInstance food = getInventory().getItemByItemId(getFoodId());
    if(food == null && PetDataTable.isStrider(getNpcId()))
    {
      food = getInventory().getItemByItemId(Deluxe_Food_for_Strider);
    }
    return tryFeedItem(food);
View Full Code Here

TOP

Related Classes of l2p.gameserver.model.items.L2ItemInstance

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.