Jump to content

Recommended Posts

Posted

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.

Posted

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

Posted

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.

Posted

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...

Posted

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.

  • 4 weeks later...
Posted

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

----------

 

Posted

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.

  • 3 weeks later...
Posted

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

  • 9 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • Μάγκες καλησπέρα,   Παίζω Lineage 2 εδώ και χρόνια και πήρα απόφαση ότι θέλω επιτέλους να μάθω πώς δουλεύουν τα πράγματα πίσω από τις κάμερες. Δεν ψάχνομαι ούτε να ανοίξω τον επόμενο μεγάλο x5000 server ούτε να βγάλω λεφτά. Καθαρά από περιέργεια και για μένα θέλω να μάθω πώς στήνεται ένας server από το απόλυτο μηδέν. Το θέμα είναι ότι από development πλευρά είμαι τελείως άσχετος. Ξέρω τη βασική ιδέα, αλλά όταν βλέπω όλα αυτά που πρέπει να μάθω, ψιλοπελαγώνω. Από αυτά που έχω καταλάβει μέχρι στιγμής, πρέπει να μάθω πώς να στήνω το local περιβάλλον στο PC μου με Java, MySQL και κάποιο πρόγραμμα τύπου Navicat για να κουμαντάρω τη βάση δεδομένων. Μετά είναι το κομμάτι του compilation (με IntelliJ ή Eclipse), ή έστω το πώς να δουλεύω με έτοιμα datapacks και gameservers χωρίς να τα διαλύω όλα.   Εκτός από το server-side κομμάτι δηλαδή να αλλάζω stats σε items, να πειράζω spawns από NPCs, formulas για skills και custom μαγαζιά, πρέπει να μάθω και το client-side. Πράγματα όπως το να πειράζω τα .dat αρχεία με το L2FileEdit για να επικοινωνεί σωστά ο server με το παιχνίδι. Και για να είμαι ειλικρινής, το πιο ζόρικο κομμάτι θα είναι να μάθω να διαβάζω εκείνα τα τεράστια error logs όταν κρασάρει ο server, αντί να τα κοιτάω σαν χαζός. Ψάχνω λοιπόν κάποιον που να έχει μια εμπειρία και να γουστάρει να με καθοδηγήσει λίγο σαν μέντορας, ή ακόμα και κάποιον άλλον αρχάριο που θέλει να φάμε τα μούτρα μας παρέα μέχρι να το βρούμε.   Φράγκα δεν παίζουν μιας και το βλέπω καθαρά σαν χόμπι, αλλά έχω άπειρη υπομονή, δεν περιμένω από τον άλλον να κάνει τη δουλειά για μένα και είμαι διατεθειμένος να φάω ώρες για να μάθω. Απλά χρειάζομαι έναν άνθρωπο να ρωτάω μια γνώμη όταν αναπόφευκτα σκαλώνω σε κάποιο config αρχείο.   Αν βαριέστε και θέλετε να βοηθήσετε έναν παλιό παίκτη να μάθει τα βασικά, αφήστε ένα reply ή στείλτε μου PM με το Discord σας. Να 'στε καλά προκαταβολικά για οποιαδήποτε βοήθεια!
    • Hey guys 😃   I’ve been playing Lineage 2 for years, and I’ve finally decided I want to learn how the magic actually happens behind the scenes. I’m not trying to launch the next big x5000 server or make money. I literally just want to learn how to build one from absolute scratch for my own fun and curiosity. The issue is, I’m a total newbie when it comes to the dev side of things. I know the basic idea, but looking at everything I need to learn is getting pretty overwhelming. From what I've gathered so far, I need to figure out how to set up a local environment on my PC using Java, MySQL, and a tool like Navicat just to get the database running. Then there's compiling source code with IntelliJ or Eclipse, or at least figuring out how to work with a pre-compiled data pack and game server without breaking everything.   On top of the server side ike modifying item stats, editing NPC spawns, tweaking skill formulas, and setting up custom shops—I also need to learn the client-side stuff. Things like editing .dat files with L2FileEdit to make sure the server and client actually talk to each other correctly. And honestly, the scariest part is just learning how to read those massive error logs when the server crashes instead of just staring at them blankly.   I'm looking for someone who has some experience and wouldn't mind mentoring me a bit, or even another beginner who wants to team up so we can figure it out together. I can't pay anything since this is just a hobby project, but I’m super patient, I don't expect you to do the work for me, and I’m down to put in the hours to learn. I just need someone I can bounce questions off of when I inevitably mess up a config file.   If you’re bored and want to help a passionate player learn the ropes, drop a reply or shoot me a PM with your Discord. Appreciate any help I can get! ❤️
    • TG Support: https://t.me/buyingproxysup | Channel: https://t.me/buyingproxycom Discord support: #buyingproxy | Server: Join the BuyingProxy Discord Server!  Create your free account here
    • Season IV online in 3 hours 😄
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..