Spava pakeicia bet po restarto dinksta kur problema? pack acis 362
/*
* 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 net.sf.l2j.gameserver.model.actor.instance;
import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
import net.sf.l2j.gameserver.network.serverpackets.UserInfo;
/**
* @author Bluur
*/
public class L2ColorManagerInstance extends L2NpcInstance
{
public L2ColorManagerInstance(int objectId, NpcTemplate template)
{
super(objectId, template);
}
@Override
public void showChatWindow(L2PcInstance player)
{
NpcHtmlMessage html = new NpcHtmlMessage(0);
html.setFile("data/html/mods/ColorManager.htm");
html.replace("%objectId%", String.valueOf(getObjectId()));
html.replace("%name%", player.getName());
player.sendPacket(html);
}
@Override
public void onBypassFeedback(L2PcInstance player, String command)
{
if (command.startsWith("namecolor"))
{
if (player.getInventory().getInventoryItemCount(57, -1) > (5000000))
{
nameColor(command, player);
player.destroyItemByItemId("namecolor", 57, 5000000, null, true);
}
else
player.sendMessage("[Color Manager]: You do not have enough adena.");
}
else if (command.startsWith("titlecolor"))
{
if (player.getInventory().getInventoryItemCount(57, -1) > (5000000))
{
titleColor(command, player);
player.destroyItemByItemId("titlecolor", 57, 5000000, null, true);
}
else
player.sendMessage("[Color Manager]: You do not have enough adena.");
}
showChatWindow(player);
}
private static void nameColor(String command, L2PcInstance player)
{
try
{
String nameColor = command.substring(10);
player.getAppearance().setNameColor(Integer.decode("0x" + nameColor));
player.sendMessage("[Color Manager]: The color of your name has been changed!");
player.sendPacket(new UserInfo(player));
}
catch (IndexOutOfBoundsException e)
{
}
}
private static void titleColor(String command, L2PcInstance player)
{
try
{
String titleColor = command.substring(11);
player.getAppearance().setTitleColor(Integer.decode("0x" + titleColor));
player.sendMessage("[Color Manager]: The color of your has been changed!");
player.sendPacket(new UserInfo(player));
}
catch (IndexOutOfBoundsException e)
{
}
}