Jump to content
  • 0

Problem On A Code After Updating The Source!


Question

Posted (edited)

Hello guys... so i have l2jserver High Five (unstable) and i updated it to the latest revision.. so i have many custom codes and features in my pack and i've got a problem that pissed me off!!

 

so the file is this:

/*
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package handlers.bypasshandlers;

import java.text.DecimalFormat;

import com.l2jserver.gameserver.datatables.ItemTable;
import com.l2jserver.gameserver.enums.InstanceType;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.items.L2Item;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.util.StringUtil;

public class DropInfo implements IBypassHandler
{
	private static final String[] COMMANDS =
	{
		"drop",
		"spoil",
		"info",
		"dropquest"
	};
	
	@Override
	public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
	{
		try
		{
			final NpcHtmlMessage html = new NpcHtmlMessage(0);
			L2Object targetmob = activeChar.getTarget();
			L2Npc npc = (L2Npc) targetmob;
			String droptext = "";
			
			if (command.startsWith("drop"))
			{
				try
				{
					html.setFile(activeChar.getHtmlPrefix(), "data/html/dropinfo/mobdrop.htm");
					
					if (!(npc.isChampion() || npc.isMinion() || (npc.getInstanceType() == InstanceType.L2GrandBossInstance) || npc.isRaid() || npc.isRaidMinion() || npc.isMob()))
					{
						return false;
					}
					if (npc.getTemplate().getDropLists().isEmpty())
					{
						droptext = "WARNING: This Npc has no Drops!";
						html.replace("%drops%", droptext);
						activeChar.sendPacket(html);
						return false;
					}
					String champ = "";
					String imgsg = "<img src=\"l2ui.squaregray\" width=\"274\" height=\"1\">";
					String ta_op = "<table bgcolor=333333 cellspacing=2 cellpadding=1><tr><td height=38 fixwidth=36><img src=\"";
					String ta_op2 = "\" height=32 width=32></td><td fixwidth=234><table VALIGN=top valing = top width=234 cellpadding=0 cellspacing=0><tr>";
					
					final StringBuilder droptext1 = StringUtil.startAppend(9000, champ + "<br>" + imgsg);
					for (L2DropCategory cat : npc.getTemplate().getDropLists())
					{
						for (L2DropData drop : cat.getAllDrops())
						{
							final L2Item item = ItemTable.getInstance().getTemplate(drop.getItemId());
							if (item == null)
							{
								continue;
							}
							if (cat.isSweep())
							{
								continue;
							}
							if (drop.isQuestDrop())
							{
								continue;
							}
							
							String smind = null, drops = null;
							String name = item.getName();
							double chance = (drop.getChance() / 10000);
							
							if (item.getCrystalType() == 0)
							{
								smind = "<img src=\"L2UI_CH3.joypad_shortcut\" width=16 height=16>";
							}
							else if (item.getCrystalType() == 1)
							{
								smind = "<img src=\"L2UI_CT1.Icon_DF_ItemGrade_D\" width=16 height=16>";
							}
							else if (item.getCrystalType() == 2)
							{
								smind = "<img src=\"L2UI_CT1.Icon_DF_ItemGrade_C\" width=16 height=16>";
							}
							else if (item.getCrystalType() == 3)
							{
								smind = "<img src=\"L2UI_CT1.Icon_DF_ItemGrade_B\" width=16 height=16>";
							}
							else if (item.getCrystalType() == 4)
							{
								smind = "<img src=\"L2UI_CT1.Icon_DF_ItemGrade_A\" width=16 height=16>";
							}
							else if (item.getCrystalType() == 5)
							{
								smind = "<img src=\"L2UI_CT1.Icon_DF_ItemGrade_S\" width=16 height=16>";
							}
							else if (item.getCrystalType() == 6)
							{
								smind = "<img src=\"L2UI_CT1.Icon_DF_ItemGrade_80\" width=16 height=16>";
							}
							else if (item.getCrystalType() == 7)
							{
								smind = "<img src=\"L2UI_CT1.Icon_DF_ItemGrade_84\" width=16 height=16>";
							}
							
							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("Recipe - Sealed"))
							{
								name = "<font color=00FF00>(Re)</font><font color=FF00FF>(Sl)</font>" + name.substring(16);
							}
							if (name.startsWith("Sealed "))
							{
								name = "<font color=FF00FF>(Sl)</font>" + name.substring(7);
							}
							if (name.startsWith("Common Item - "))
							{
								name = "<font color=00FFFF>(Ci)</font>" + name.substring(14);
							}
							if (name.startsWith("Recipe: "))
							{
								name = "<font color=00FF00>(Re)</font>" + name.substring(8);
							}
							if (name.startsWith("Recipe -"))
							{
								name = "<font color=00FF00>(Re)</font>" + name.substring(8);
							}
							if (name.startsWith("Mid-Grade Life Stone"))
							{
								name = "<font color=fff600>Mid-Grade LS</font>" + name.substring(20);
							}
							if (name.startsWith("High-Grade Life Stone"))
							{
								name = "<font color=fff600>High-Grade LS</font>" + name.substring(21);
							}
							if (name.startsWith("Top-Grade Life Stone"))
							{
								name = "<font color=fff600>Top-Grade LS</font>" + name.substring(20);
							}
							if (name.startsWith("Forgotten Scroll - "))
							{
								name = "<font color=fff600>FS - </font>" + name.substring(19);
							}
							if (name.startsWith("Greater Dye of "))
							{
								name = "<font color=fff600>G Dye of </font>" + name.substring(15);
							}
							
							droptext1.append(ta_op + item.getIcon() + ta_op2 + "<td align=left width=16>" + smind + "</td><td align=left width=260><font color=fff600>" + name + "</font></td></tr><tr><td align=left width=16><img src=\"L2UI_CH3.QuestWndToolTipBtn\" width=16 height=16></td><td align=left width=55><font color=E15656>" + drops + "%</font></td></tr></table></td></tr></table>" + imgsg);
						}
					}
					droptext = droptext1.toString();
					html.replace("%drops%", droptext);
					activeChar.sendPacket(html);
				}
				catch (Exception e)
				{
					activeChar.sendMessage("Something went wrong with the drop preview.");
				}
			}
			if (command.startsWith("spoil"))
			{
				try
				{
					html.setFile(activeChar.getHtmlPrefix(), "data/html/dropinfo/mobspoil.htm");
					
					if (!(npc.isChampion() || npc.isMinion() || npc.isRaid() || npc.isRaidMinion() || npc.isMob()))
					{
						return false;
					}
					if (npc.getTemplate().getDropLists().isEmpty())
					{
						droptext = "WARNING: This Npc has no Drops!";
						html.replace("%drops%", droptext);
						activeChar.sendPacket(html);
						return false;
					}
					String champ = "";
					String imgsg = "<img src=\"l2ui.squaregray\" width=\"274\" height=\"1\">";
					String ta_op = "<table bgcolor=333333 cellspacing=2 cellpadding=1><tr><td height=38 fixwidth=36><img src=\"";
					String ta_op2 = "\" height=32 width=32></td><td fixwidth=234><table VALIGN=top valing = top width=234 cellpadding=0 cellspacing=1><tr>";
					final StringBuilder droptext1 = StringUtil.startAppend(1000, champ + "<br>" + imgsg);
					for (L2DropCategory cat : npc.getTemplate().getDropLists())
					{
						for (L2DropData drop : cat.getAllDrops())
						{
							final L2Item item = ItemTable.getInstance().getTemplate(drop.getItemId());
							if (item == null)
							{
								continue;
							}
							if (!(cat.isSweep()))
							{
								continue;
							}
							
							String smind = null, drops = null;
							String name = item.getName();
							double chance = (drop.getChance() / 10000);
							
							if (item.getCrystalType() == 0)
							{
								smind = "<img src=\"L2UI_CH3.joypad_shortcut\" width=16 height=16>";
							}
							else if (item.getCrystalType() == 1)
							{
								smind = "<img src=\"L2UI_CT1.Icon_DF_ItemGrade_D\" width=16 height=16>";
							}
							else if (item.getCrystalType() == 2)
							{
								smind = "<img src=\"L2UI_CT1.Icon_DF_ItemGrade_C\" width=16 height=16>";
							}
							else if (item.getCrystalType() == 3)
							{
								smind = "<img src=\"L2UI_CT1.Icon_DF_ItemGrade_B\" width=16 height=16>";
							}
							else if (item.getCrystalType() == 4)
							{
								smind = "<img src=\"L2UI_CT1.Icon_DF_ItemGrade_A\" width=16 height=16>";
							}
							else if (item.getCrystalType() == 5)
							{
								smind = "<img src=\"L2UI_CT1.Icon_DF_ItemGrade_S\" width=16 height=16>";
							}
							else if (item.getCrystalType() == 6)
							{
								smind = "<img src=\"L2UI_CT1.Icon_DF_ItemGrade_80\" width=16 height=16>";
							}
							else if (item.getCrystalType() == 7)
							{
								smind = "<img src=\"L2UI_CT1.Icon_DF_ItemGrade_84\" width=16 height=16>";
							}
							
							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("Recipe - Sealed"))
							{
								name = "<font color=00FF00>(Re)</font><font color=FF00FF>(Sl)</font>" + name.substring(16);
							}
							if (name.startsWith("Sealed "))
							{
								name = "<font color=FF00FF>(Sl)</font>" + name.substring(7);
							}
							if (name.startsWith("Common Item - "))
							{
								name = "<font color=00FFFF>(Ci)</font>" + name.substring(14);
							}
							if (name.startsWith("Recipe: "))
							{
								name = "<font color=00FF00>(Re)</font>" + name.substring(8);
							}
							if (name.startsWith("Recipe -"))
							{
								name = "<font color=00FF00>(Re)</font>" + name.substring(8);
							}
							if (name.startsWith("Mid-Grade Life Stone"))
							{
								name = "<font color=fff600>Mid-Grade LS</font>" + name.substring(20);
							}
							if (name.startsWith("High-Grade Life Stone"))
							{
								name = "<font color=fff600>High-Grade LS</font>" + name.substring(21);
							}
							if (name.startsWith("Top-Grade Life Stone"))
							{
								name = "<font color=fff600>Top-Grade LS</font>" + name.substring(20);
							}
							if (name.startsWith("Forgotten Scroll - "))
							{
								name = "<font color=fff600>FS - </font>" + name.substring(19);
							}
							if (name.startsWith("Greater Dye of "))
							{
								name = "<font color=fff600>G Dye of </font>" + name.substring(15);
							}
							
							droptext1.append(ta_op + item.getIcon() + ta_op2 + "<td align=left width=16>" + smind + "</td><td align=left width=260><font color=fff600>" + name + "</font></td></tr><tr><td align=left width=16><img src=\"L2UI_CH3.QuestWndToolTipBtn\" width=16 height=16></td><td align=left width=55><font color=E15656>" + drops + "%</font></td></tr></table></td></tr></table>" + imgsg);
						}
					}
					droptext = droptext1.toString();
					html.replace("%drops%", droptext);
					activeChar.sendPacket(html);
				}
				catch (Exception e)
				{
					activeChar.sendMessage("Something went wrong with the drop preview.");
				}
			}
			if (command.startsWith("dropquest"))
			{
				try
				{
					html.setFile(activeChar.getHtmlPrefix(), "data/html/dropinfo/mobquest.htm");
					
					if (!(npc.isChampion() || npc.isMinion() || npc.isRaid() || npc.isRaidMinion() || npc.isMob()))
					{
						return false;
					}
					if (npc.getTemplate().getDropLists().isEmpty())
					{
						droptext = "WARNING: This Npc has no Drops!";
						html.replace("%drops%", droptext);
						activeChar.sendPacket(html);
						return false;
					}
					String champ = "";
					String imgsg = "<img src=\"l2ui.squaregray\" width=\"274\" height=\"1\">";
					String ta_op = "<table bgcolor=333333 cellspacing=2 cellpadding=1><tr><td height=38 fixwidth=36><img src=\"";
					String ta_op2 = "\" height=32 width=32></td><td fixwidth=234><table VALIGN=top valing = top width=234 cellpadding=0 cellspacing=1><tr>";
					final StringBuilder droptext1 = StringUtil.startAppend(1000, champ + "<br>" + imgsg);
					for (L2DropCategory cat : npc.getTemplate().getDropLists())
					{
						for (L2DropData drop : cat.getAllDrops())
						{
							final L2Item item = ItemTable.getInstance().getTemplate(drop.getItemId());
							if (item == null)
							{
								continue;
							}
							if (!(drop.isQuestDrop()))
							{
								continue;
							}
							
							String smind = null, drops = null;
							String name = item.getName();
							double chance = (drop.getChance() / 10000);
							
							if (item.getCrystalType() == 0)
							{
								smind = "<img src=\"L2UI_CH3.joypad_shortcut\" width=16 height=16>";
							}
							else if (item.getCrystalType() == 1)
							{
								smind = "<img src=\"L2UI_CT1.Icon_DF_ItemGrade_D\" width=16 height=16>";
							}
							else if (item.getCrystalType() == 2)
							{
								smind = "<img src=\"L2UI_CT1.Icon_DF_ItemGrade_C\" width=16 height=16>";
							}
							else if (item.getCrystalType() == 3)
							{
								smind = "<img src=\"L2UI_CT1.Icon_DF_ItemGrade_B\" width=16 height=16>";
							}
							else if (item.getCrystalType() == 4)
							{
								smind = "<img src=\"L2UI_CT1.Icon_DF_ItemGrade_A\" width=16 height=16>";
							}
							else if (item.getCrystalType() == 5)
							{
								smind = "<img src=\"L2UI_CT1.Icon_DF_ItemGrade_S\" width=16 height=16>";
							}
							else if (item.getCrystalType() == 6)
							{
								smind = "<img src=\"L2UI_CT1.Icon_DF_ItemGrade_80\" width=16 height=16>";
							}
							else if (item.getCrystalType() == 7)
							{
								smind = "<img src=\"L2UI_CT1.Icon_DF_ItemGrade_84\" width=16 height=16>";
							}
							
							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("Recipe - Sealed"))
							{
								name = "<font color=00FF00>(Re)</font><font color=FF00FF>(Sl)</font>" + name.substring(16);
							}
							if (name.startsWith("Sealed "))
							{
								name = "<font color=FF00FF>(Sl)</font>" + name.substring(7);
							}
							if (name.startsWith("Common Item - "))
							{
								name = "<font color=00FFFF>(Ci)</font>" + name.substring(14);
							}
							if (name.startsWith("Recipe: "))
							{
								name = "<font color=00FF00>(Re)</font>" + name.substring(8);
							}
							if (name.startsWith("Recipe -"))
							{
								name = "<font color=00FF00>(Re)</font>" + name.substring(8);
							}
							if (name.startsWith("Mid-Grade Life Stone"))
							{
								name = "<font color=fff600>Mid-Grade LS</font>" + name.substring(20);
							}
							if (name.startsWith("High-Grade Life Stone"))
							{
								name = "<font color=fff600>High-Grade LS</font>" + name.substring(21);
							}
							if (name.startsWith("Top-Grade Life Stone"))
							{
								name = "<font color=fff600>Top-Grade LS</font>" + name.substring(20);
							}
							if (name.startsWith("Forgotten Scroll - "))
							{
								name = "<font color=fff600>FS - </font>" + name.substring(19);
							}
							if (name.startsWith("Greater Dye of "))
							{
								name = "<font color=fff600>G Dye of </font>" + name.substring(15);
							}
							
							droptext1.append(ta_op + item.getIcon() + ta_op2 + "<td align=left width=16>" + smind + "</td><td align=left width=260><font color=fff600>" + name + "</font></td></tr><tr><td align=left width=16><img src=\"L2UI_CH3.QuestWndToolTipBtn\" width=16 height=16></td><td align=left width=55><font color=E15656>" + drops + "%</font></td></tr></table></td></tr></table>" + imgsg);
						}
					}
					droptext = droptext1.toString();
					html.replace("%drops%", droptext);
					activeChar.sendPacket(html);
				}
				catch (Exception e)
				{
					activeChar.sendMessage("Something went wrong with the drop preview.");
				}
			}
		}
		catch (Exception e)
		{
			activeChar.sendMessage("You cant use this option with this target.");
		}
		return false;
	}
	
	@Override
	public String[] getBypassList()
	{
		return COMMANDS;
	}
}

so i have problem with these:

 

for (L2DropCategory cat : npc.getTemplate().getDropLists())
                    {
                        for (L2DropData drop : cat.getAllDrops())

 

 

these codes are placed 3 times in the whole file..!

I'll appreciate your help a lot!
(P.S. these methods (L2DropData and L2DropCategory) have been removed by L2JServer team... but i didn't found any other way to solve these problems!)

Edited by xXObanXx

1 answer to this question

Recommended Posts

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
Answer this question...

×   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

    • From Salvation onwards I think you need a patched nwindow.dll that allows such modifications, try to see if you get what you need here: https://drive.google.com/drive/u/1/folders/1LLbQFGf8KlR-O0Iv5umfF-pwZgrDh9bd
    • hello everyone! I am wanting to save the files (Ini. - Data - ) of the EP5 Client: Salvation... But they generate the error "corrupt files"... I tried several versions of L2FileEditor without good results. I need help! Thank you!
    • Opening December 6th at 19:00 (GMT +3)! Open Beta Test from November 30th!   https://l2soe.com/   🌟 Introducing L2 Saga of Eternia: A Revolution in Lineage 2 High Five! 🌟   Dear Lineage 2 enthusiasts, Prepare to witness the future of private servers! L2 Saga of Eternia is not just another High Five project—it’s a game-changing experience designed to compete with the giants of the Lineage 2 private server scene. Built for the community, by the community, we’re here to raise the bar in quality, innovation, and longevity. What Sets Us Apart? 💎 No Wipes, Ever Say goodbye to the fear of losing your progress. Our server is built to last and will never close. Stability and consistency are our promises to you. ⚔️ Weekly New Content Our dedicated development team ensures fresh challenges, events, and updates every week. From custom quests to exclusive features, there will always be something exciting to explore. 💰 No Pay-to-Win Skill and strategy matter most here. Enjoy a balanced gameplay environment where your achievements come from effort, not your wallet. 🌍 A Massive Community With 2000+ players expected, join a vibrant and active community of like-minded adventurers ready to conquer the world of Aden. 🏆 Fair and Competitive Gameplay Our systems are designed to promote healthy competition while avoiding abusive mechanics and exploits. 🔧 Professional Development From advanced bug fixes to carefully curated content, we pride ourselves on smooth performance, no lag, and unparalleled server quality. Key Features Chronicle: High Five with unique interface Rate: Dynamic x10 rates Class Balance: Carefully fine-tuned for a fair experience PvP Focused: PvP Ranking & aura display effect for 3 Top PvPers every week Custom Events: Seasonal and permanent events to keep you engaged Additional Features:   Custom Endgame Content: Introduce unique dungeons, raids, or zones unavailable in other servers. Player-Driven Economy: Implement a strong market system and avoid overinflated drops or rewards. Epic Siege Battles: Announce special large-scale sieges and PvP events. Incentives for Streamers and Clans: Attract influencers and big clans to boost server publicity. Roadmap Transparency: Share a public roadmap of planned updates to build trust and excitemen   Here you can read all the features: https://l2soe.com/features   Video preview: Join the Revolution! This is your chance to be part of something legendary. L2 Saga of Eternia is not just a server; it’s a movement to redefine what Lineage 2 can be. Whether you’re a seasoned veteran or a newcomer to the world of Aden, we invite you to experience Lineage 2 at its finest.   Official Launch Date: December 6th 2024 Website: https://l2soe.com/ Facebook: https://www.facebook.com/l2soe Discord: https://discord.com/invite/l2eternia   Let’s build the ultimate Lineage 2 experience together. See you in-game! 🎮
    • That's like a tutorial on how to run l2 on MacOS Xd but good job for the investigation. 
    • small update: dc robe set sold   wts adena 1kk = 1.5$ 
  • Topics

×
×
  • Create New...