Jump to content

[Share]Mob Drop Preview Panel


Darule

Recommended Posts

Hi there i'd like to share a Drop Preview Panel for Mobs.

 

So what this system does?

When you Shift + Click a mob you can view its Drops.

 

Drop Preview Panel Supports: (for each item)

Item Icon

Item Name

Item Min+Max Drop

Item Drop Quantity

Item Percentage Drop % (enhanced for low drops)

 

 

Here is a preview pic of the system

droppreview.png

 

This is the patch file for the latest action shift for l2jhi5.

 

Index: L2NpcActionShift.java
===================================================================
--- L2NpcActionShift.java	(revision 8584)
+++ L2NpcActionShift.java	(working copy)
@@ -183,77 +183,13 @@
				activeChar.sendPacket(su);
			}

-			NpcHtmlMessage html = new NpcHtmlMessage(0);
-			int hpMul = Math.round((float)(((L2Character)target).getStat().calcStat(Stats.MAX_HP, 1, (L2Character)target, null) / BaseStats.CON.calcBonus((L2Character)target)));
-			if (hpMul == 0)
-				hpMul = 1;
-			final StringBuilder html1 = StringUtil.startAppend(
+			NpcHtmlMessage html = new NpcHtmlMessage(0);final StringBuilder html1 = StringUtil.startAppend(
					1000,
-					"<html><body>" +
-					"<br><center><font color=\"LEVEL\">[Combat Stats]</font></center>" +
-					"<table border=0 width=\"100%\">" +
-					"<tr><td>Max.HP</td><td>",
-					String.valueOf(((L2Character)target).getMaxHp() / hpMul),
-					"*",
-					String.valueOf(hpMul),
-					"</td><td>Max.MP</td><td>",
-					String.valueOf(((L2Character)target).getMaxMp()),
-					"</td></tr>" +
-					"<tr><td>P.Atk.</td><td>",
-					String.valueOf(((L2Character)target).getPAtk(null)),
-					"</td><td>M.Atk.</td><td>",
-					String.valueOf(((L2Character)target).getMAtk(null, null)),
-					"</td></tr>" +
-					"<tr><td>P.Def.</td><td>",
-					String.valueOf(((L2Character)target).getPDef(null)),
-					"</td><td>M.Def.</td><td>",
-					String.valueOf(((L2Character)target).getMDef(null, null)),
-					"</td></tr>" +
-					"<tr><td>Accuracy</td><td>",
-					String.valueOf(((L2Character)target).getAccuracy()),
-					"</td><td>Evasion</td><td>",
-					String.valueOf(((L2Character)target).getEvasionRate(null)),
-					"</td></tr>" +
-					"<tr><td>Critical</td><td>",
-					String.valueOf(((L2Character)target).getCriticalHit(null, null)),
-					"</td><td>Speed</td><td>",
-					String.valueOf(((L2Character)target).getRunSpeed()),
-					"</td></tr>" +
-					"<tr><td>Atk.Speed</td><td>",
-					String.valueOf(((L2Character)target).getPAtkSpd()),
-					"</td><td>Cast.Speed</td><td>",
-					String.valueOf(((L2Character)target).getMAtkSpd()),
-					"</td></tr>" +
-					"<tr><td>Race</td><td>",
-					((L2Npc)target).getTemplate().getRace().toString(),
-					"</td><td></td><td></td></tr>" +
-					"</table>" +
-					"<br><center><font color=\"LEVEL\">[basic Stats]</font></center>" +
-					"<table border=0 width=\"100%\">" +
-					"<tr><td>STR</td><td>",
-					String.valueOf(((L2Character)target).getSTR()),
-					"</td><td>DEX</td><td>",
-					String.valueOf(((L2Character)target).getDEX()),
-					"</td><td>CON</td><td>",
-					String.valueOf(((L2Character)target).getCON()),
-					"</td></tr>" +
-					"<tr><td>INT</td><td>",
-					String.valueOf(((L2Character)target).getINT()),
-					"</td><td>WIT</td><td>",
-					String.valueOf(((L2Character)target).getWIT()),
-					"</td><td>MEN</td><td>",
-					String.valueOf(((L2Character)target).getMEN()),
-					"</td></tr>" +
-					"</table>"
+					"<html><head><title>"+((L2Npc) target).getName()+"</title><body><table bgcolor=444444 border=1 cellspacing=2 cellpadding=0 width=293><tr><td align=center>Drop Panel</td></tr></table><br><table  bgcolor=333333 cellpadding=0 cellspacing=0 width=274><tr><td align=center><font color=fff600>Legend</font></td></tr></table><table bgcolor=333333 width=276><tr><td align=center>[D]= Drop   [s]= Spoil   [Q]= Quest</td></tr><tr><td align=center>(CI)= Common Item</td></tr></table><br><table bgcolor=444444 cellspacing=2 cellpadding=1 border=1 width=280>"
			);

			if (!((L2Npc) target).getTemplate().getDropData().isEmpty())
			{
-				StringUtil.append(html1,
-						"<br><center><font color=\"LEVEL\">[Drop Info]</font></center>" +
-						"<br>Rates legend: <font color=\"ff9999\">50%+</font> <font color=\"00ff00\">30%+</font> <font color=\"0066ff\">less than 30%</font>" +
-						"<table border=0 width=\"100%\">"
-				);
				for (L2DropCategory cat : ((L2Npc)target).getTemplate().getDropData())
				{
					for (L2DropData drop : cat.getAllDrops())
@@ -261,31 +197,76 @@
						final L2Item item = ItemTable.getInstance().getTemplate(drop.getItemId());
						if (item == null)
							continue;
+						int mind = 0,maxd = 0;
+						String smind = null,smaxd = null,drops = null;
+						String name = item.getName();
+						double chance = 100/(1000000/(drop.getChance()));

-						final String color;
-						
-						if (drop.getChance() >= 500000)
-							color = "ff9999";
-						else if (drop.getChance() >= 300000)
-							color = "00ff00";
+						if (cat.isSweep())
+						{
+							mind = (int) (Config.RATE_DROP_SPOIL * drop.getMinDrop());
+							maxd = (int) (Config.RATE_DROP_SPOIL * drop.getMaxDrop());
+						}
+						else if (drop.getItemId()==57)
+						{
+							mind = 300 * drop.getMinDrop();
+							maxd = 300 * drop.getMaxDrop();
+						}
						else
-							color = "0066ff";
+						{
+							mind = (int) (Config.RATE_DROP_ITEMS * drop.getMinDrop());
+							maxd = (int) (Config.RATE_DROP_ITEMS * drop.getMaxDrop());
+						}
+						if (mind > 999999)
+						{
+							DecimalFormat df = new DecimalFormat("###.#");
+							smind = df.format(((double)(mind))/1000000)+" KK";
+							smaxd = df.format(((double)(maxd))/1000000)+" KK";
+						}
+						else if (mind > 999)
+						{
+							smind = ((int)(mind/1000))+" K";
+							smaxd = ((int)(maxd/1000))+" K";
+						}

+						else
+						{ 
+							smind = Integer.toString(mind);
+							smaxd = Integer.toString(maxd);
+						}
+						if (chance <= 0.001)
+						{
+							DecimalFormat df = new DecimalFormat("#.####");
+							drops = df.format(chance);
+						}
+						else if (chance <= 0.01)
+						{
+							DecimalFormat df = new DecimalFormat("#.###");
+							drops = df.format(chance);
+						}
+						else
+						{
+							DecimalFormat df = new DecimalFormat("##.##");
+							drops = df.format(chance);
+						}
+						if (name.startsWith("Common Item - "))
+						{
+							name = "(CI)" + name.substring(14);
+						}
+						if (name.length() >= 36)
+						{
+							name = name.substring(0, 33) + "...";
+						}
						StringUtil.append(html1,
-								"<tr>",
-								"<td><img src=\"" + item.getIcon() + "\" height=32 width=32></td>" + 
-								"<td><font color=\"", color, "\">", item.getName(), "</font></td>",
-								"<td>", (drop.isQuestDrop() ? "Quest" : (cat.isSweep() ? "Sweep" : "Drop")),"</td>",
-								"</tr>"
-						);
+						"<tr><td valign=top align=center height=38 width=40><img src=\""+item.getIcon()+"\" height=32 width=32></td><td><table cellpadding=0 cellspacing=1 width=237><tr><td>"+drops+"%</td></tr><tr><td>"+(drop.isQuestDrop() ? "[Q]" : (cat.isSweep() ? "[s]" : "[D]"))+"<font color=fff600>"+name+"</font>"+(maxd==1 ? "[1]" : "["+smind+" - "+smaxd+"]") + "</td></tr></table></td>"
+                        );
					}
				}
-				html1.append("</table>");
			}
-			html1.append("</body></html>");
-			
+			html1.append("</tr></table></body></html>");
			html.setHtml(html1.toString());
			activeChar.sendPacket(html);
+		
		}
		return true;
	}

 

This code can be done better, if you have any suggestion tell me here. We can do this with a config file too for more options.

Link to comment
Share on other sites

Try deleting the border to the table (table border=0), deleting the quest drop items who are shown on the droplist (i supouse).

The [D]Drop and [s Spoil delete the [s and [D] and put the indications with colors.

That would be a nice code :)

I'll try to do it by myself and if you want i can post it :)

Very good share, and keep sharing :D

Link to comment
Share on other sites

I havent test it on Interlude, maybe you need some adaptions for it.

Is there a file for shift clicking mobs on il like the L2NpcActionShift.java if yes then you can try it.

Link to comment
Share on other sites

Thanks for the share... But onlu handy for those who like to use the shift+click feature in theirs production server,... a questios, did the properties have already something like shift+click drop list?

Link to comment
Share on other sites

Thanks for the share... But onlu handy for those who like to use the shift+click feature in theirs production server,... a questios, did the properties have already something like shift+click drop list?

 

Stop using the google translator man...

Link to comment
Share on other sites

Thanks for the share... But onlu handy for those who like to use the shift+click feature in theirs production server,... a questios, did the properties have already something like shift+click drop list?

 

Yes the feature is only for servers that want to use such a feature, btw as you said there is in the configs  a shift+click feature already but its not like this system.

Link to comment
Share on other sites

  • 4 weeks later...

Erro L2Brick server

 

 

 

----------

1. ERROR in D:\L2Brick-Rev1608\game\data\scripts\handlers\actionhandlers\L2NpcAc

tionShift.java (at line 38)

        public class L2NpcActionShift implements IActionHandler

                    ^^^^^^^^^^^^^^^^

The type L2NpcActionShift must implement the inherited abstract method IActionHa

ndler.getInstanceType()

----------

2. ERROR in D:\L2Brick-Rev1608\game\data\scripts\handlers\actionhandlers\L2NpcAc

tionShift.java (at line 228)

        DecimalFormat df = new DecimalFormat("000.0");

        ^^^^^^^^^^^^^

DecimalFormat cannot be resolved to a type

----------

3. ERROR in D:\L2Brick-Rev1608\game\data\scripts\handlers\actionhandlers\L2NpcAc

tionShift.java (at line 228)

        DecimalFormat df = new DecimalFormat("000.0");

                              ^^^^^^^^^^^^^

DecimalFormat cannot be resolved to a type

----------

4. ERROR in D:\L2Brick-Rev1608\game\data\scripts\handlers\actionhandlers\L2NpcAc

tionShift.java (at line 245)

        DecimalFormat df = new DecimalFormat("0.0000");

        ^^^^^^^^^^^^^

DecimalFormat cannot be resolved to a type

----------

5. ERROR in D:\L2Brick-Rev1608\game\data\scripts\handlers\actionhandlers\L2NpcAc

tionShift.java (at line 245)

        DecimalFormat df = new DecimalFormat("0.0000");

                              ^^^^^^^^^^^^^

DecimalFormat cannot be resolved to a type

----------

6. ERROR in D:\L2Brick-Rev1608\game\data\scripts\handlers\actionhandlers\L2NpcAc

tionShift.java (at line 250)

        DecimalFormat df = new DecimalFormat("0.000");

        ^^^^^^^^^^^^^

DecimalFormat cannot be resolved to a type

----------

7. ERROR in D:\L2Brick-Rev1608\game\data\scripts\handlers\actionhandlers\L2NpcAc

tionShift.java (at line 250)

        DecimalFormat df = new DecimalFormat("0.000");

                              ^^^^^^^^^^^^^

DecimalFormat cannot be resolved to a type

----------

8. ERROR in D:\L2Brick-Rev1608\game\data\scripts\handlers\actionhandlers\L2NpcAc

tionShift.java (at line 255)

        DecimalFormat df = new DecimalFormat("00.00");

        ^^^^^^^^^^^^^

DecimalFormat cannot be resolved to a type

----------

9. ERROR in D:\L2Brick-Rev1608\game\data\scripts\handlers\actionhandlers\L2NpcAc

tionShift.java (at line 255)

        DecimalFormat df = new DecimalFormat("00.00");

                              ^^^^^^^^^^^^^

DecimalFormat cannot be resolved to a type

----------

10. ERROR in D:\L2Brick-Rev1608\game\data\scripts\handlers\actionhandlers\L2NpcA

ctionShift.java (at line 279)

        }

        ^

Syntax error, insert "}" to complete ClassBody

----------

 

Link to comment
Share on other sites

working for interlude, but IL don't have getIcon() so there is two way:

1) remove getIcon, but then you dont see icon

2) add getIcon(), its easy, but you need to add all icons to etc, armor and weapons.sql

 

btw, interlude dont have L2NpcActionShift.java, so we add to L2NpcInstance this code.

Link to comment
Share on other sites

  • 3 weeks later...

wow amazing share where all servers need (low rate)

 

thx for share keep ur work

 

Thanks a lot, although i think that even high rate servers can use it too, its good for the player to know the drops cause they are sometimes distrustfull xD

Link to comment
Share on other sites

  • 9 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • ✅ **Episode 2 - Primeval Wars** ➡️ Event: "Medals Collecting" launch for 2 weeks. https://forum.lineage2dex.com/threads/16301/ ➡️ Fixed some problems with the respawn of monsters in imperial tomb (and some other areas). ➡️ Fixed the amount of B/A/S crystals needed to upgrade the body armor to MW version ➡️ Adjusted tvt points formula for support classes ➡️ Launch of a new 1x1 PVP Event Arena is postponed. More time is needed to fix possible bugs and polish the Event
    • a beautiful response from a liar who is not even a man to admit it, at least it is recorded here that you are nothing more than a thief, this is your character as a person, which I hope one day you will have the courage and apologize to whoever you stole from, which I don't even need to talk about anymore, you know very well who you stole each job from, here I end the attacks, because someone deserved to come here and unmask you to the l2 community.
    • Yes Sir. Of course Sir, you know everything, Sir. If you said so, Sir. What about asking your "friends" where they get it they patch from? Kappa
    • Let's make one thing clear here, you don't have a patch/rev, what you have is a complete theft of codes, and if you are a real man, admit it, because my BR friends know very well that you are known for being the so-called interface copy/paste, because you don't create anything, you take advantage of years of work from people and steal it and sell it and you have the courage to talk about my patch, be ashamed of yourself.
    • i dont know why im the topic here if this is not even my patch, it seems you love me, even know my whole story... xd but good old times when we would EXCHANGE stuff betwen our selfs to make interfaces to our usage and likening... never talked to much with OMGz, but seems like a good guy   good old times when was all just having fun and editing stuff and playing, today is all about clout and money, i have that u dont hahahah   they will never come back..   i already left anything beside long time ago idk why think on me too much, just want to enjoy my free time to play some games and have fun.. but looks like somehow find a way to relate me to something, maybe you think on me to much idk, kinda weird.. unfortunately, you are looking at this code thinking that  "oh it has his name and abreviation, its from him" but i must say its not... i dont need to stay here saying that this and that happened, because i know very well that you know exactly what happened... peace for all PS: and.. my main language is pt br, not spanish like in the src...
  • Topics

×
×
  • Create New...