Jump to content

Recommended Posts

Posted

where do you save the player's level after its done;

It does not require to save the Level. It is working like //setlevel command. You do not have to touch db. ;)

  • 5 months later...
Posted

I adopted it for latest L2J BETA 6253 and 9998 but when i use it nothing happens, i dont even get console errors.

package custom.DeLevelManager;
import com.l2jserver.gameserver.cache.HtmCache;
import com.l2jserver.gameserver.datatables.ItemTable;
import com.l2jserver.gameserver.model.skills.L2Skill;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.network.serverpackets.ExBrExtraUserInfo;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.UserInfo;

/**
 * @author `Heroin
 * Made For Maxcheaters.com
 */
public class DeLevelManager extends Quest
{
	private static final int npcid = 36650; // npc id
	private static final int MinLevel = 10; // Minimum Level, (e.g if you set 10, players wont be able to be level 9).
	private static final int ItemConsumeId = 57; // Item Consume id
	private int levels ; // Item Consume id
	private static final int ItemConsumeNumEveryLevel = 100; // Item ItemConsumeNumEveryLevel
	private static String htm = "data/scripts/custom/DeLevelManager/1.htm"; //html location
	private static String ItemName = ItemTable.getInstance().createDummyItem(ItemConsumeId).getItemName();
	
	public DeLevelManager(int questId, String name, String descr)
	{
		super(questId, name, descr);
		addFirstTalkId(npcid);
		addTalkId(npcid);
		addStartNpc(npcid);
	}
	
	@Override
	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
	{
		if (event.startsWith("dlvl"))
		{
			Dlvl(event, npc, player, event);
		}

		return "";
	}
	
	private void Dlvl(String event, L2Npc npc, L2PcInstance player, String command)
	{
		
		try
		{
			String val = command.substring(5);
			int pointer = Integer.parseInt(val);
			int k = player.getLevel();
			levels = k - pointer;
			if (player.getInventory().getItemByItemId(ItemConsumeId) == null)
			{
				player.sendMessage("You don't have enough items!");
				return;
			}
			if (val == null)
			{
				player.sendMessage("Something went wrong!");
				return;
			}
			if (pointer < 10)
			{
				player.sendMessage("Incorrect Level Number!");
				return;
			}
			if (pointer < MinLevel)
			{
				player.sendMessage("Incorrect Level Number!");
				return;
			}
			if (player.getLevel() <= pointer)
			{
				player.sendMessage("Your level is already lower.");
				return;
			}
			if (player.getInventory().getItemByItemId(ItemConsumeId).getCount() < ItemConsumeNumEveryLevel*levels)
			{
				
				player.sendMessage("You don't have enough items!");
				return;
			}
			if (player.getInventory().getItemByItemId(ItemConsumeId).getCount() >= ItemConsumeNumEveryLevel)
			{
				k = player.getLevel();
				final byte lvl = Byte.parseByte(pointer + "");	
				player.getStat().setLevel(lvl);
				player.sendMessage("Congratulations! You are now "+pointer+" level.");
				for(L2Skill sk : player.getAllSkills())
				{
					player.removeSkill(sk);
				}
				player.broadcastStatusUpdate();
				player.broadcastUserInfo();
				player.sendPacket(new UserInfo(player));
				player.sendPacket(new ExBrExtraUserInfo(player));
				player.giveAvailableAutoGetSkills();
				player.giveAvailableSkills(true, true);
				player.sendSkillList();
				levels = k - pointer;
				player.destroyItemByItemId("DlvlManager", ItemConsumeId, ItemConsumeNumEveryLevel*levels, player, true);
			}
		}
		catch (Exception e)
		{
			player.sendMessage("Something went wrong try again.");
		}
	}
	
	
	
	@Override
	public String onFirstTalk(L2Npc npc, L2PcInstance player)
	{
		final int npcId = npc.getId();
		if (player.getQuestState(getName()) == null)
		{
			newQuestState(player);
		}
		if (npcId == npcid)
		{
			String html = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), htm);
			html = html.replaceAll("%player%", player.getName());
			html = html.replaceAll("%itemname%", ItemName);
			html = html.replaceAll("%price%", ""+ItemConsumeNumEveryLevel+"");
			
			NpcHtmlMessage npcHtml = new NpcHtmlMessage(0);
			npcHtml.setHtml(html);
			player.sendPacket(npcHtml);
		}
		return "";
	}
	
	public static void main(final String[] args)
	{
		new DeLevelManager(-1, DeLevelManager.class.getSimpleName(), "custom");
		System.out.println("De Level Manager by `Heroin has been loaded successfully!");
	}
}
  • 2 weeks later...
Posted

I am trying to use this NPC on aCis. Modified a little the imports, changed some lines, also the NPC html view, it loads without problem, but after I spawn it and I try to talk, I get the message shown as servernews :). Can anybody give me a clue on how to make it work ?

Thank you in advance !

  • 3 weeks later...
  • 7 months later...
Posted (edited)

Hi there for one more time, i made this npc today because i can see there are lots of npc like this but there is not any like this i made today. It is just an NPC where player can choose what level would like to be. Price is being regulated automatically like that: Number_of_levels_decreased * Configurable_price.

 

E.g: Player is 85 level, he chooses to be 70. His payment would be 15(levels) * code_price.

 

Preview (HTM Dialog):

 

shot00001ti.png

 

How to install:

 

1. Create a new java file on data/scripts/custom/DeLevelManager/DeLevelManager.java

 

Paste this code:

package custom.DeLevelManager;
import com.l2jserver.gameserver.cache.HtmCache;
import com.l2jserver.gameserver.datatables.ItemTable;
import com.l2jserver.gameserver.model.L2Skill;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.network.serverpackets.ExBrExtraUserInfo;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.UserInfo;

/**
 * @author `Heroin
 * Made For Maxcheaters.com
 */
public class DeLevelManager extends Quest
{
	private static final int npcid = 36650; // npc id
	private static final int MinLevel = 10; // Minimum Level, (e.g if you set 10, players wont be able to be level 9).
	private static final int ItemConsumeId = 57; // Item Consume id
	private int levels ; // Item Consume id
	private static final int ItemConsumeNumEveryLevel = 100; // Item ItemConsumeNumEveryLevel
	private static String htm = "data/scripts/custom/DeLevelManager/1.htm"; //html location
	private static String ItemName = ItemTable.getInstance().createDummyItem(ItemConsumeId).getItemName();
	
	public DeLevelManager(int questId, String name, String descr)
	{
		super(questId, name, descr);
		addFirstTalkId(npcid);
		addTalkId(npcid);
		addStartNpc(npcid);
	}
	
	@Override
	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
	{
		if (event.startsWith("dlvl"))
		{
			Dlvl(event, npc, player, event);
		}

		return "";
	}
	
	private void Dlvl(String event, L2Npc npc, L2PcInstance player, String command)
	{
		
		try
		{
			String val = command.substring(5);
			int pointer = Integer.parseInt(val);
			int k = player.getLevel();
			levels = k - pointer;
			if (player.getInventory().getItemByItemId(ItemConsumeId) == null)
			{
				player.sendMessage("You don't have enough items!");
				return;
			}
			if (val == null)
			{
				player.sendMessage("Something went wrong!");
				return;
			}
			if (pointer < 10)
			{
				player.sendMessage("Incorrect Level Number!");
				return;
			}
			if (pointer < MinLevel)
			{
				player.sendMessage("Incorrect Level Number!");
				return;
			}
			if (player.getLevel() <= pointer)
			{
				player.sendMessage("Your level is already lower.");
				return;
			}
			if (player.getInventory().getItemByItemId(ItemConsumeId).getCount() < ItemConsumeNumEveryLevel*levels)
			{
				
				player.sendMessage("You don't have enough items!");
				return;
			}
			if (player.getInventory().getItemByItemId(ItemConsumeId).getCount() >= ItemConsumeNumEveryLevel)
			{
				k = player.getLevel();
				final byte lvl = Byte.parseByte(pointer + "");	
				player.getStat().setLevel(lvl);
				player.sendMessage("Congratulations! You are now "+pointer+" level.");
				for(L2Skill sk : player.getAllSkills())
				{
					player.removeSkill(sk);
				}
				player.broadcastStatusUpdate();
				player.broadcastUserInfo();
				player.sendPacket(new UserInfo(player));
				player.sendPacket(new ExBrExtraUserInfo(player));
				player.giveAvailableAutoGetSkills();
				player.giveAvailableSkills(true, true);
				player.sendSkillList();
				levels = k - pointer;
				player.destroyItemByItemId("DlvlManager", ItemConsumeId, ItemConsumeNumEveryLevel*levels, player, true);
			}
		}
		catch (Exception e)
		{
			player.sendMessage("Something went wrong try again.");
		}
	}
	
	
	
	@Override
	public String onFirstTalk(L2Npc npc, L2PcInstance player)
	{
		final int npcId = npc.getNpcId();
		if (player.getQuestState(getName()) == null)
		{
			newQuestState(player);
		}
		if (npcId == npcid)
		{
			String html = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), htm);
			html = html.replaceAll("%player%", player.getName());
			html = html.replaceAll("%itemname%", ItemName);
			html = html.replaceAll("%price%", ""+ItemConsumeNumEveryLevel+"");
			
			NpcHtmlMessage npcHtml = new NpcHtmlMessage(0);
			npcHtml.setHtml(html);
			player.sendPacket(npcHtml);
		}
		return "";
	}
	
	public static void main(final String[] args)
	{
		new DeLevelManager(-1, DeLevelManager.class.getSimpleName(), "custom");
		System.out.println("De Level Manager by `Heroin has been loaded successfully!");
	}
}
2.Create a new htm file on data/scripts/custom/HeroManager/1.htm

Paste this code on it.

 

<html>
<title>%player%</title>
<body><center>
<img src="L2UI_CH3.herotower_deco" width=256 height=32></center><br>
Hello there, if you want to low your current level, you came to right place!<br>
You have just to choose the <font color=FF0000>number</font> of level you would like to be.<br>
In exchange, i am going to take you <font color=LEVEL>%price% %itemname%</font> for <font color=LEVEL>each level
</font> you decrease.<br>
Remember: You can't choose a number higher than your current level.<br>

<table width=270><tr>
<td><button value="Change my level to: " action="bypass -h Quest DeLevelManager dlvl $lv" width=180 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><edit var="lv" width=50></td>
</tr></table>


<br><br><br><br>
<center>
<img src="L2UI_CH3.herotower_deco" width=256 height=32></center>
</body></html>
3. Add script on scripts.cfg file:

custom/DeLevelManager/DeLevelManager.java
4. Run this query on your database or install the NPC by yourself.

INSERT INTO `custom_npc` VALUES ('36650', '13173', 'DeLevelManager', '1', 'MaxCheaters.com', '1', 'LineageNPC.clear_npc', '8.00', '19.00', '85', 'male', 'L2Npc', null, null, null, null, null, '40', '43', '30', '21', '20', '20', '0', '0', null, null, null, null, '230', '1', '0', '333', '0', '0', '0', '60.00000', '120.00000', '1', '1', '0', '0');
How to Modify:

 

Check Variables on code:

private static final int npcid = 36650; // npc id
private static final int MinLevel = 10; // Minimum Level, (e.g if you set 10, players wont be able to be level 9).
private static final int ItemConsumeId = 57; // Item Consume id
private int levels ; // Item Consume id
private static final int ItemConsumeNumEveryLevel = 100; // Item ItemConsumeNumEveryLevel
private static String htm = "data/scripts/custom/DeLevelManager/1.htm"; //html location
Credits & Idea: `Heroin

 

Hello everybody i need help. i don´t understand why you create a new folder that called Olympiamanager . We have tried it but it doesn´t work we have an npc with a quest but the html dialog doesn´t work . Can anybody explain? Sry i mean Heromanager, thanks for help

Edited by rockabill
  • 6 months later...
Posted (edited)

Hello cheaters. I tried to adapt it for latest aCis, but my skills are really poor and I stucked. I fixed the imports and 80% of the errors are gone, but there are 4 more, I cannot fix. Here they are:

				player.sendPacket(new ExBrExtraUserInfo(player));
				player.giveAvailableAutoGetSkills();
				player.giveAvailableSkills(true, true);
				player
String html = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), htm);
Edited by raF
  • 11 months later...
  • 2 weeks later...
Posted

I tested and it works but it have a few problems. It does decrease your level but it does not decrease your EXP/SP.  So after you decrease level you won't be able to level up again because you can't gain no more EXP/SP.

Also the path for the 1.htm  is right on the java file but you tell us to add at another folder, it should be at the same folder as the java file.

 

I was able to fix the EXP/SP problem but if someone add this to a live server it will bug the characters.

  • 2 years later...
Posted

Can someone help me to adjust this DeLevel NPC to the Latest Release of L2jserver???
At this moment i have tried all i can think off, and cant get rid of these 4 errors...
As far as i have been trying to fix it, comparing it to other files like this one, i think my problem is in these lines...



    private static String ItemName = ItemTable.getInstance().getItemByItemId(ItemConsumeId).getItemName();

 

 

            for(SkillData sk : player.getAllSkills())

 

 

                player.removeSkill(sk);

 

 

    if (npcId = npcid)

 

 

If someone could help me would be awesome...
Thanks in advance =9

 

 

 

Posted
18 minutes ago, unfor6iven said:

Can someone help me to adjust this DeLevel NPC to the Latest Release of L2jserver???
At this moment i have tried all i can think off, and cant get rid of these 4 errors...
As far as i have been trying to fix it, comparing it to other files like this one, i think my problem is in these lines...



    private static String ItemName = ItemTable.getInstance().getItemByItemId(ItemConsumeId).getItemName();

 

 

            for(SkillData sk : player.getAllSkills())

 

 

                player.removeSkill(sk);

 

 

    if (npcId = npcid)

 

 

If someone could help me would be awesome...
Thanks in advance =9

 

 

 

 

I fixed the errors you are facing. Check main post, at the bottom :)

P.S: I did not test it but the chance of having errors is low.

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

    • leave only Npcpos the gremlins (for testing).
    • 🚀 New numbers for GMAIL are now available!   We’ve added fresh, stable numbers  perfect for activations and quick code delivery. Join in while they’re still available 👇 Category: GMAIL   Website: https://vibe-sms.net/ 📱 Telegram channel: https://t.me/vibe_sms
    • using Guytis pack....but missed lin_LoadHWIDS & lin_PvpEventLoadEvent sql procedures..maybe any1 know how to fixed it? rly thx...
    • This post originally appeared on MmoGah. Welcome to Borderlands 4, the latest installment in Gearbox Software's beloved looter-shooter franchise. Set in the sprawling world of Kairos, this game introduces new mechanics, characters, and a vast open-world experience. Whether you're a series veteran or a newcomer, this guide will walk you through everything you need to know to get started and succeed.       Choosing Your Vault Hunter Borderlands 4 offers four unique Vault Hunters, each with distinct abilities and playstyles: Amon: A close-quarters tank who excels with shotguns and melee attacks. Ideal for aggressive players who like to be in the thick of battle. Vex: A stealthy clone master who can duplicate herself to confuse enemies and amplify damage. Great for tactical players. Rafa: A long-range specialist with sniper skills and elemental traps. Perfect for precision shooters. Harlowe: A support-oriented character with healing and crowd-control abilities. Best for team players or solo survivalists. Tip: Read each character's affinity and skill tree before committing. You can respec later, but starting with a character that matches your playstyle makes the early game smoother.   What to Do First After completing the prologue, you'll land in Kairos with your first mission: Recruitment Drive. Here's what you should prioritize: Complete "Down and Outbound" This unlocks the Digi-Runner, your summonable vehicle. It's essential for fast travel and early combat support. Secure a Safehouse Safehouses offer fast travel, contracts, and gear storage. Claim one early to make exploration easier. Upgrade Your Backpack Inventory space is limited at first. Upgrading your backpack lets you carry more loot and ammo. Unlock the Glidepack This mobility tool allows you to traverse vertical terrain and reach hidden areas. Return Lost Capsules These collectibles offer XP and gear. They're scattered across Kairos and are worth hunting down.   Navigating Kairos Borderlands 4 removes the traditional minimap. Instead, you'll rely on: ECHO-4 Drone: Your personal navigator. It highlights paths, climbable walls, and grapple points. Radar Display: Enable this in the settings (Gameplay → Toggle Radar Display) for better orientation. Custom Waypoints: Use these to mark objectives or loot spots on your map.   Combat Tips Combat in Borderlands 4 is fast, chaotic, and rewarding. Here's how to stay alive and dominate: Use Cover and Movement Kairos is filled with vertical terrain. Use walls, ledges, and grapple points to dodge enemy fire. Elemental Matchups Matter Match your weapon's element to enemy weaknesses: Fire: Best against flesh Shock: Effective on shields Cryo: Slows and freezes Corrosive: Destroys armor Test Action Skills Each character has three skill trees with unique capstones. Don't hesitate to respec if a skill doesn't suit you—Borderlands 4 money is easy to earn. Use Vehicle Weapons The Digi-Runner comes equipped with basic weapons. Use it to soften up enemies before engaging on foot.   Leveling Up Efficiently XP is crucial for unlocking skills and gear. Here are the best ways to level up: Main Missions: Progress the story to unlock key tools and areas. Side Missions (Contracts): These are found in Safehouses, which offer quick XP and gear. Farm Bosses: Some bosses drop legendary loot and give decent XP. Replay Vault Missions: These are harder but offer large XP rewards. Prospects Drill Site: A top-tier farming location with high XP and legendary gear chances.   Looting and Gear Loot is the heart of Borderlands. Here's how to maximize your haul: Color Rarity Guide: White: Common Green: Uncommon Blue: Rare Purple: Epic Orange: Legendary Don't Just Chase DPS Look at weapon stats like reload speed, magazine size, and elemental effects. A lower-DPS gun with better utility might outperform a high-DPS one. Legendary Drops Bosses and elite enemies have a chance to drop legendary weapons. Keep farming if you're after something specific. Black Market Vendor Hidden in Kairos, this vendor sells rare gear. Check back often for rotating stock.   Advanced Tips Once you've got the basics down, here are some pro-level strategies: Drive Recklessly Vehicles explode easily, but you can summon a new one instantly. Use them aggressively. Fishing Minigame Yes, Borderlands 4 has fishing! Look for bubbling water spots. Fish can be traded for gear or used in crafting. Accessibility Settings Reduce screen shake and head-bob if you're prone to motion sickness. It makes long sessions more comfortable. Explore After Getting Vehicle The map is massive. Wait until you have the Digi-Runner before venturing far from mission hubs. Collect Vault Symbols These unlock lore, XP, and sometimes gear. They're hidden throughout the world.   Final Thoughts Borderlands 4 is a wild ride full of loot, laughs, and laser fire. As a beginner, focus on: Picking the right character Unlocking your vehicle early Using ECHO-4 for navigation Farming XP through missions and bosses Matching elemental weapons to enemies Respeccing your skills to suit your playstyle With these tips, you'll be well on your way to becoming a legendary Vault Hunter in Kairos.
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock