Jump to content
  • 0

Drop list panel


Question

Posted

OK, i add Runes for boost drop rates, Now, Who can explain me where i can find this drop setting, when I run Rune drop to be modified here. For exemple. I add rune for boost Drop Rate with 200%, and when i have rune in inventory, this window isn't modified. How i can do this? With Rune Drop i have 6,684-13,646 and without Rune drop 6,684-13,646. SO it's same. How i can do?

http://aXgicWP.jpg 

Recommended Posts

  • 0
Posted

You can't create method like that, you have to put a variable declaration there. Look on the previous method.

 

public static float getBonus(BonusType type)

 

What you want to do, is to create one more the same method, which is pointless.

 

---

 

amountFormat.format(min) this line is responsible for the amount display of min drop. So, all you have to do, is to mul it with getBonus check, the same with max obviously.

amountFormat.format(min * activeChar.getBonus(BonusType.DROP) something like that. I just hope that the default switch from the getBonus method is returning 1.

  • 0
Posted

OK SweeTs, u are greate, but, i get error in GameServer.

This is Code 

public static float getBonus(BonusType type, L2PcInstance activeChar, NumberFormat amountFormat, float min)
	{
		amountFormat.format(min * activeChar.getBonus(BonusType.DROP));
		
		return 1.0f;
	}

And in game doesn't happend something, no changes. Maybe i must put line 

amountFormat.format(min * activeChar.getBonus(BonusType.DROP));

and

amountFormat.format(max * activeChar.getBonus(BonusType.DROP));

?

  • 0
Posted

God, did I told you to paste that line into getBonus method?? Open NpcViewMod, find the line I mentioned (min and max) and add the mul..

  • 0
Posted

Well, This is method which u give me,

 

public static float getBonus(BonusType type)
    {
        return 1;
    }

 

 

and about amountFormat, i find just sb.append

sb.append(amountFormat.format(min * activeChar.getBonus(BonusType.DROP)));

 

and was 

sb.append(amountFormat.format(min));

 

i don;t find 

amountFormat.format(min) like u say. Just with sb.append.

  • 0
Posted

And this is sendNpcDropList method

public static void sendNpcDropList(L2PcInstance activeChar, L2Npc npc, DropListScope dropListScope, int page)
	{
		final List<IDropItem> dropList = npc.getTemplate().getDropList(dropListScope);
		if ((dropList == null) || dropList.isEmpty())
		{
			return;
		}
		
		int pages = dropList.size() / DROP_LIST_ITEMS_PER_PAGE;
		if ((DROP_LIST_ITEMS_PER_PAGE * pages) < dropList.size())
		{
			pages++;
		}
		
		final StringBuilder pagesSb = new StringBuilder();
		if (pages > 1)
		{
			pagesSb.append("<table><tr>");
			for (int i = 0; i < pages; i++)
			{
				pagesSb.append("<td align=center><button value=\"" + (i + 1) + "\" width=20 height=20 action=\"bypass NpcViewMod dropList " + dropListScope + " " + npc.getObjectId() + " " + i + "\" back=\"L2UI_CT1.Button_DF_Calculator_Down\" fore=\"L2UI_CT1.Button_DF_Calculator\"></td>");
			}
			pagesSb.append("</tr></table>");
		}
		
		if (page >= pages)
		{
			page = pages - 1;
		}
		
		final int start = page > 0 ? page * DROP_LIST_ITEMS_PER_PAGE : 0;
		
		int end = (page * DROP_LIST_ITEMS_PER_PAGE) + DROP_LIST_ITEMS_PER_PAGE;
		if (end > dropList.size())
		{
			end = dropList.size();
		}
		
		final DecimalFormat amountFormat = new DecimalFormat("#,###");
		final DecimalFormat chanceFormat = new DecimalFormat("0.00##");
		
		int leftHeight = 0;
		int rightHeight = 0;
		final StringBuilder leftSb = new StringBuilder();
		final StringBuilder rightSb = new StringBuilder();
		for (int i = start; i < end; i++)
		{
			final StringBuilder sb = new StringBuilder();
			
			int height = 64;
			final IDropItem dropItem = dropList.get(i);
			if (dropItem instanceof GeneralDropItem)
			{
				addGeneralDropItem(activeChar, npc, amountFormat, chanceFormat, sb, (GeneralDropItem) dropItem);
			}
			else if (dropItem instanceof GroupedGeneralDropItem)
			{
				final GroupedGeneralDropItem generalGroupedDropItem = (GroupedGeneralDropItem) dropItem;
				if (generalGroupedDropItem.getItems().size() == 1)
				{
					final GeneralDropItem generalDropItem = generalGroupedDropItem.getItems().get(0);
					addGeneralDropItem(activeChar, npc, amountFormat, chanceFormat, sb, new GeneralDropItem(generalDropItem.getItemId(), generalDropItem.getMin(), generalDropItem.getMax(), (generalDropItem.getChance() * generalGroupedDropItem.getChance()) / 100, generalDropItem.getAmountStrategy(), generalDropItem.getChanceStrategy(), generalGroupedDropItem.getPreciseStrategy(), generalGroupedDropItem.getKillerChanceModifierStrategy(), generalDropItem.getDropCalculationStrategy()));
				}
				else
				{
					GroupedGeneralDropItem normalized = generalGroupedDropItem.normalizeMe(npc, activeChar);
					sb.append("<table width=332 cellpadding=2 cellspacing=0 background=\"L2UI_CT1.Windows.Windows_DF_TooltipBG\">");
					sb.append("<tr><td width=32 valign=top><img src=\"L2UI_CT1.ICON_DF_premiumItem\" width=32 height=32></td>");
					sb.append("<td fixwidth=300 align=center><font name=\"ScreenMessageSmall\" color=\"CD9000\">One from group</font>");
					sb.append("</td></tr><tr><td width=32></td><td width=300><table width=295 cellpadding=0 cellspacing=0><tr>");
					sb.append("<td width=48 align=right valign=top><font color=\"LEVEL\">Chance:</font></td>");
					sb.append("<td width=247 align=center>");
					sb.append(chanceFormat.format(Math.min(normalized.getChance(), 100)));
					sb.append("%</td></tr></table><br>");
					
					for (GeneralDropItem generalDropItem : normalized.getItems())
					{
						final L2Item item = ItemTable.getInstance().getTemplate(generalDropItem.getItemId());
						sb.append("<table width=291 cellpadding=2 cellspacing=0 background=\"L2UI_CT1.Windows.Windows_DF_TooltipBG\">");
						sb.append("<tr><td width=32 valign=top>");
						sb.append("<img src=\"" + item.getIcon() + "\" width=32 height=32>");
						sb.append("</td><td fixwidth=259 align=center><font name=\"hs9\" color=\"CD9000\">");
						sb.append(item.getName());
						sb.append("</font></td></tr><tr><td width=32></td><td width=259><table width=253 cellpadding=0 cellspacing=0>");
						sb.append("<tr><td width=48 align=right valign=top><font color=\"LEVEL\">Amount:</font></td><td width=205 align=center>");
						MinMax minMax = getPreciseMinMax(normalized.getChance(), generalDropItem.getMin(npc), generalDropItem.getMax(npc), generalDropItem.isPreciseCalculated());
						final long min = minMax.min;
						final long max = minMax.max;
						if (min == max)
						{
							sb.append(amountFormat.format(min));
						}
						else
						{
							sb.append(amountFormat.format(min));
							sb.append(" - ");
							sb.append(amountFormat.format(max));
						}
						
						sb.append("</td></tr><tr><td width=48 align=right valign=top><font color=\"LEVEL\">Chance:</font></td>");
						sb.append("<td width=205 align=center>");
						sb.append(chanceFormat.format(Math.min(generalDropItem.getChance(), 100)));
						sb.append("%</td></tr></table></td></tr><tr><td width=32></td><td width=259>&nbsp;</td></tr></table>");
						
						height += 64;
					}
					
					sb.append("</td></tr><tr><td width=32></td><td width=300>&nbsp;</td></tr></table>");
				}
			}
			
			if (leftHeight >= (rightHeight + height))
			{
				rightSb.append(sb);
				rightHeight += height;
			}
			else
			{
				leftSb.append(sb);
				leftHeight += height;
			}
		}
		
		final StringBuilder bodySb = new StringBuilder();
		bodySb.append("<table><tr>");
		bodySb.append("<td>");
		bodySb.append(leftSb.toString());
		bodySb.append("</td><td>");
		bodySb.append(rightSb.toString());
		bodySb.append("</td>");
		bodySb.append("</tr></table>");
		
		String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/mods/NpcView/DropList.htm");
		if (html == null)
		{
			_log.warning(NpcViewMod.class.getSimpleName() + ": The html file data/html/mods/NpcView/DropList.htm could not be found.");
			return;
		}
		html = html.replaceAll("%name%", npc.getName());
		html = html.replaceAll("%dropListButtons%", getDropListButtons(npc));
		html = html.replaceAll("%pages%", pagesSb.toString());
		html = html.replaceAll("%items%", bodySb.toString());
		Util.sendCBHtml(activeChar, html);
	}

In this method, where i must put 

activeChar.getBonus(BonusType.DROP)

?

  • 0
Posted

Oh my goodness.. I simply fixed, showed you how the method should looks like. Don't act like 5y old kid. I told you which line you must find and what to add. Don't expect me to copy even sb.append lol, get real dude. Get you shit together or don't mod the core.

Find all occuriences or that amount calculation, formation and simply add that godamn getBonus check.

  • 0
Posted

Well, i make this

if (min == max)
                        {
                            sb.append(amountFormat.format(min));
                        }
                        else
                        {
                            sb.append(amountFormat.format(min * activeChar.getBonus(BonusType.DROP)));
                            sb.append(" - ");
                            sb.append(amountFormat.format(max * activeChar.getBonus(BonusType.DROP)));
                        }
       and nothing happend in game, simply, i can;t open more view mode :)

Guest
This topic is now closed to further replies.
×
×
  • Create New...