Jump to content

[Share]De-Level-Manager (+Level Choice)


Recommended Posts

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

 

 

Adapted to l2jserver high five by Solomun:

 

Spoiler

/*
 * Copyright (C) 2004-2018 L2J Server
 * 
 * This file is part of L2J Server.
 * 
 * L2J Server 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.
 * 
 * L2J Server 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 custom.DeLevelManager;

import com.l2jserver.gameserver.cache.HtmCache;
import com.l2jserver.gameserver.datatables.ItemTable;
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.model.skills.Skill;
import com.l2jserver.gameserver.network.serverpackets.ExBrExtraUserInfo;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.UserInfo;

public class DeLevelManager extends Quest
{
	private static final int NPC_ID = 36650; // npc id
	private static final int MIN_LEVEL = 10; // Minimum Level, (e.g if you set 10, players wont be able to be level 9).
	private static final int ITEM_CONSUME_ID = 57; // Item Consume id
	private int levels; // Item Consume id
	private static final int ITEM_CONSUME_COUNT_PER_LEVEL = 100; // Item ItemConsumeNumEveryLevel
	private static String htm = "data/scripts/custom/DeLevelManager/1.htm"; // html location
	private static String ItemName = ItemTable.getInstance().getTemplate(ITEM_CONSUME_ID).getName();
	
	public DeLevelManager()
	{
		super(-1, DeLevelManager.class.getSimpleName(), "custom");
		addFirstTalkId(NPC_ID);
		addTalkId(NPC_ID);
		addStartNpc(NPC_ID);
	}
	
	@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(ITEM_CONSUME_ID) == 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 < MIN_LEVEL)
			{
				player.sendMessage("Incorrect Level Number!");
				return;
			}
			if (player.getLevel() <= pointer)
			{
				player.sendMessage("Your level is already lower.");
				return;
			}
			if (player.getInventory().getItemByItemId(ITEM_CONSUME_ID).getCount() < (ITEM_CONSUME_COUNT_PER_LEVEL * levels))
			{
				player.sendMessage("You don't have enough items!");
				return;
			}
			if (player.getInventory().getItemByItemId(ITEM_CONSUME_ID).getCount() >= ITEM_CONSUME_COUNT_PER_LEVEL)
			{
				k = player.getLevel();
				final byte lvl = Byte.parseByte(pointer + "");
				player.getStat().setLevel(lvl);
				player.sendMessage("Congratulations! You are now " + pointer + " level.");
				for (Skill 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", ITEM_CONSUME_ID, ITEM_CONSUME_COUNT_PER_LEVEL * 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 (NPC_ID == npcId)
		{
			String html = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), htm);
			html = html.replaceAll("%player%", player.getName());
			html = html.replaceAll("%itemname%", ItemName);
			html = html.replaceAll("%price%", "" + ITEM_CONSUME_COUNT_PER_LEVEL + "");
			
			NpcHtmlMessage npcHtml = new NpcHtmlMessage(0);
			npcHtml.setHtml(html);
			player.sendPacket(npcHtml);
		}
		return "";
	}
	
	public static void main(final String[] args)
	{
		new DeLevelManager();
		System.out.println("De Level Manager by `Heroin has been loaded successfully!");
	}
}

 

 

Edited by Solomun
Link to comment
Share on other sites

Is d-lvl a new idea? Hah

 

We all know that the de-level its one click from admin panel.

He made a npc for that so I found it new.

 

PS: I've never seen such as these shares so?

Link to comment
Share on other sites

An easy share that didn't take you more than 15 mins to create it. Also the actual meaning of your share is trash. What means choose what level you want to be ? Rofl

Link to comment
Share on other sites

An easy share that didn't take you more than 15 mins to create it. Also the actual meaning of your share is trash. What means choose what level you want to be ? Rofl

 

I don't know much from L2 but I find it kewl.

So this is my explanation.

You know he is the only who sharing things that are not shared again. That's why.

Link to comment
Share on other sites

An easy share that didn't take you more than 15 mins to create it. Also the actual meaning of your share is trash. What means choose what level you want to be ? Rofl

I shared it for people who like to download this. You dont like, noone told you to download it. However, all other de-level manager don't work like that. If someone want be 40 level to kill AQ will need to decrease his level one-by-one? With this will be with 1 button in 1 min and pay for 40 levels he lost.

Link to comment
Share on other sites

  • 2 weeks later...

Hi, i have little problem, some fix?

 

----------
1. ERROR in /DeLevelManager.java (at line 99)
player.giveAvailableAutoGetSkills();
       ^^^^^^^^^^^^^^^^^^^^^^^^^^
The method giveAvailableAutoGetSkills() is undefined for the type L2PcInstance
----------
2. ERROR in /DeLevelManager.java (at line 100)
player.giveAvailableSkills(true, true);
       ^^^^^^^^^^^^^^^^^^^
The method giveAvailableSkills() in the type L2PcInstance is not applicable for the arguments (boolean, boolean)

Link to comment
Share on other sites

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

    • Well my friend, I'm not going to stay here arguing anymore, because you won't give up and much less have the humility to accept something you did wrong, as you saw, I value the work of others, I know who really creates or even takes a block of code and does something better and different, but the subject here was about a guy, nicknamed Vraekar, who steals and SELLS interfaces as if they were his, and is that within your beliefs?, belief that if the guy creates something it has to be stolen and whoever stole it can profit from it?, that's what I'm talking about, you've fought a lot against this, and today you help a guy like that to do wrong, but anyway, you know what you're doing, I hope you reflect, the community knows who does and who helps the wrong. Stay with God, because six of the problems that go around.
    • You claim you thought I was a "serious" person before. Well, maybe you just never took the time to actually know me. People evolve, but I stay true to what I do and believe in. If you’re that hung up on what I’ve been doing, maybe it's time to stop speculating and start focusing on yourself. 🙂
    • Well, at least it's clear that you don't respect the work of others. Secondly, everyone knows that you code nothing. Your group has devs. known that you've asked for a lot of help and code exchange with some well-known BRs. there are chats and I can prove it, then don't come playing the good guy because you're not. So, Celestine, I'm not judging you. I'm saying that I know that your group helped vraekar steal the codes, and I have proof. In the past, I thought you were a serious, good-natured guy, but lately, you're a different person. Your text above speaks for you.
    • What I do or who I work with is none of your concern, and honestly, I couldn't care less. Lately, I've seen a lot of people trying to make a quick buck off scams, so let's not even mention names you wouldn't want them getting upset, right? 🙂  As for the projects I've been involved with, there's a server about to launch that I’m personally waiting for, and when it does, I’ll release the work publicly for free because people deserve better than what these so called "developers" are pushing. I’m not here to defend anyone, but if you had any real knowledge, you’d see how poorly written some of these scripts are. I’ve worked with Vraekar in the past, and I know for a fact he’s never sold anything I’ve created. So before you start running your mouth, ask yourself: why are you even juding me?
    • I didn't even want to touch on your name Celestine, but it took a while to want to protect it, right? But then I say, everyone knows that you and your group helped Vraekar in deobfuscating the interfaces, do you want me to post here the dates and videos of the releases of the OMG and Silence interfaces?, and then see Vraekar's?, do you want?, a blatant copy, even their variable names, the theft is blatant, and you who are an admin here at Max and say you are the right one, helped him decrypt and remove the code obfuscation, everyone knows that, and now you come and tell me that his code is not copied?, if you want I can put all the evidence here and this will be very ugly even for you, since those you helped Vraekar and the interface dev community know this, they know about the thefts, very ugly indeed my friend that you still come and tell such a lie.   ps. And just one more thing, did you say that all the code he wrote? you became a joker? Vraekar doesn't program a single line of code, the guy works as a data analyst, what he learned was to copy and paste ready-made codes, but he doesn't write a single line of code.
  • Topics

×
×
  • Create New...