не сработал твой вариант.
Вот полный код файла:
package services;
import l2ft.gameserver.Config;
import l2ft.gameserver.data.htm.HtmCache;
import l2ft.gameserver.data.xml.holder.ItemHolder;
import l2ft.gameserver.model.GameObject;
import l2ft.gameserver.model.Player;
import l2ft.gameserver.network.l2.components.SystemMsg;
import l2ft.gameserver.scripts.Functions;
import l2ft.gameserver.tables.PetDataTable;
import l2ft.gameserver.model.base.Experience;
import l2ft.gameserver.model.instances.PetInstance;
public class lvl extends Functions
{
public void list()
{
Player player = getSelf();
if(!Config.SERVICES_LVL_ENABLED)
{
show(HtmCache.getInstance().getNotNull("npcdefault.htm", player), player);
return;
}
String html = null;
html = HtmCache.getInstance().getNotNull("scripts/services/lvl.htm", player);
String add = "";
if(player.getLevel() < Config.SERVICES_LVL_UP_MAX)
if(player.isLangRus())
add += "<button value=\"Поднять уровень на 1 (Цена:" + Config.SERVICES_LVL_UP_PRICE + " " + ItemHolder.getInstance().getTemplate(Config.SERVICES_LVL_UP_ITEM).getName() + ") \" action=\"bypass -h scripts_services.lvl:up" + "\" width=250 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">" + "</a><br>";
else
add += "<button value=\"Raise the level at1 (Price:" + Config.SERVICES_LVL_UP_PRICE + " " + ItemHolder.getInstance().getTemplate(Config.SERVICES_LVL_UP_ITEM).getName() + ") \" action=\"bypass -h scripts_services.lvl:up" + "\" width=250 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">" + "</a><br>";
if(player.getLevel() > Config.SERVICES_LVL_DOWN_MAX)
if(player.isLangRus())
add += "<button value=\"Понизить уровень на 1 (Цена:" + Config.SERVICES_LVL_DOWN_PRICE + " " + ItemHolder.getInstance().getTemplate(Config.SERVICES_LVL_DOWN_ITEM).getName() + ") \" action=\"bypass -h scripts_services.lvl:down" + "\" width=250 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">" + "</a><br>";
else
add += "<button value=\"Lower level at the 1 (Price:" + Config.SERVICES_LVL_DOWN_PRICE + " " + ItemHolder.getInstance().getTemplate(Config.SERVICES_LVL_DOWN_ITEM).getName() + ") \" action=\"bypass -h scripts_services.lvl:down" + "\" width=250 height=20 back=\"L2UI_CT1.Button_DF\" fore=\"L2UI_CT1.Button_DF\">" + "</a><br>";
html = html.replaceFirst("%toreplace%", add);
show(html, player);
}
public void up()
{
Player player = getSelf();
if(!Config.SERVICES_LVL_ENABLED)
{
show(HtmCache.getInstance().getNotNull("npcdefault.htm", player), player);
return;
}
if ((Functions.getItemCount(player, Config.SERVICES_LVL_UP_ITEM) > Config.SERVICES_LVL_UP_PRICE))
{
Functions.removeItem(player, Config.SERVICES_LVL_UP_ITEM, Config.SERVICES_LVL_UP_PRICE);
setLevel(null, 85);
}
else
player.sendPacket(SystemMsg.INCORRECT_ITEM_COUNT);
}
public void down()
{
Player player = getSelf();
if(!Config.SERVICES_LVL_ENABLED)
{
show(HtmCache.getInstance().getNotNull("npcdefault.htm", player), player);
return;
}
int level = player.getLevel()-1;
if ((Functions.getItemCount(player, Config.SERVICES_LVL_DOWN_ITEM) > Config.SERVICES_LVL_DOWN_PRICE))
{
Functions.removeItem(player, Config.SERVICES_LVL_DOWN_ITEM, Config.SERVICES_LVL_DOWN_PRICE);
setLevel(player, level);
}
else
player.sendPacket(SystemMsg.INCORRECT_ITEM_COUNT);
}
public static int getMaxLevel()
{
return Config.ALT_MAX_LEVEL;
}
public final static long LEVEL[] = { -1L, // level 0 (unreachable)
/* Lvl:85 */ 13180481103L,};
public static int getLevel(long thisExp)
{
int level = 0;
for(int i = 0; i < LEVEL.length; i++)
{
long exp = LEVEL[i];
if(thisExp >= exp)
level = i;
}
return level;
}
private void setLevel(Player player, int level)
{
Long exp_add = Experience.LEVEL[level] - player.getExp();
player.addExpAndSp(exp_add, 0, 0, 0, false, false);
}
}