-
Публикаций
49 -
Зарегистрирован
-
Посещение
-
Победитель дней
1 -
Отзывы
0%
chev7 стал победителем дня 10 апреля 2020
chev7 имел наиболее популярный контент!
Репутация
5Информация о chev7
-
Звание
Решил остаться
Посетители профиля
3482 просмотра профиля
-
Видимо кому то нужен
-
Эта сборка куплена мною у GVB и мои наработки по датапаку и ядру были
-
ты где ее скрысила я ее покупал когда то и над не я работал
-
А можно поконкретнее немного?)
-
Можете подсказать куда копать?
-
if (!activeChar.isPlayer() && (merchant == null || !isValidMerchant || !activeChar.isInRangeZ(merchant, activeChar.getInteractDistance(merchant)))) { А вот и отключение проверки только GM, тоесть данную кнопку могут юзать все
-
Разобрался сам, пример кнопки "Продажи" в кб: <button action="bypass _bbssell" value="Открыть" width=68 height=18 back="L2UI_CT1.ListCTRL_DF_Title_Down" fore="L2UI_CT1.ListCTRL_DF_Title"/>
-
так все таки кнопку вывели в комуннку? по счет проверки я понял что для гма, сделайте пример кнопки байпаса. Выше вашего решения достаточно?
-
acp рабочий в сборке itnterlude.su помоему, только как я понимаю тебе придется их вытащить из сурса, и запилить себе) Ищи по ключевым словам it.su, itnterlude.su здесь на форуме
- 1 ответ
-
- 2
-
в RequedtBypass нужно добавлять по этому мануалу дважды private void updPassKey(L2PcInstance player, String pass) { Connection con = null; String query = "UPDATE passkey SET passkey = ? WHERE obj_Id = ?"; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement st = con.prepareStatement(query); st.setString(1, encodePass(pass)); st.setInt(2, player.getObjectId()); st.executeUpdate(); st.close(); st = null; } catch (Exception e) { e.printStackTrace(); } finally { try { con.close(); } catch (SQLException e) { e.printStackTrace(); } con = null; } } private String encodePass(String password) { String pass = "error"; try { MessageDigest md = MessageDigest.getInstance("SHA"); byte[] raw = password.getBytes("UTF-8"); byte[] hash = md.digest(raw); pass = Base64.encodeBytes(hash); } catch (Exception e) { e.printStackTrace(); } return pass; } private void insertPassKeyInformation(L2PcInstance player, String pass, String question, String answer) { Connection con = null; String query = "INSERT INTO passkey (obj_Id, passkey, question, answer) VALUES (?,?,?,?)"; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement st = con.prepareStatement(query); st.setInt(1, player.getObjectId()); st.setString(2, encodePass(pass)); st.setString(3, question); st.setString(4, answer); st.execute(); st.close(); st = null; } catch (Exception e) { e.printStackTrace(); } finally { try { con.close(); } catch (SQLException e) { e.printStackTrace(); } con = null; } } private String getPassKeyQuestion(L2PcInstance player) { Connection con = null; String query = "SELECT question FROM passkey WHERE obj_Id = ?"; String question = "error"; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement st = con.prepareStatement(query); st.setInt(1, player.getObjectId()); ResultSet rs = st.executeQuery(); while (rs.next()) question = rs.getString(1); rs.close(); st.close(); st = null; rs = null; } catch (Exception e) { e.printStackTrace(); } finally { try { con.close(); } catch (SQLException e) { e.printStackTrace(); } con = null; } return question; } public static boolean getPassKeyEnable(L2PcInstance player) { Connection con = null; String query = "SELECT COUNT(*) FROM passkey WHERE obj_Id = ?"; int count = 0; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement st = con.prepareStatement(query); st.setInt(1, player.getObjectId()); ResultSet rs = st.executeQuery(); while (rs.next()) count = rs.getInt(1); rs.close(); st.close(); st = null; rs = null; } catch (Exception e) { e.printStackTrace(); } finally { try { con.close(); } catch (SQLException e) { e.printStackTrace(); } con = null; } if (count == 1) return true; else return false; } @Override public String getType() { return "[C] 21 RequestBypassToServer"; } } я добавил это в RequestBypass необходимо добавить то, что ниже: else if (_command.equalsIgnoreCase("pkrecovery")) { String msg = HtmCache.getInstance().getHtm("data/html/passkey/recovery.htm",activeChar); NpcHtmlMessage html = new NpcHtmlMessage(1); html.setHtml(msg); html.replace("%question%", getPassKeyQuestion(activeChar)); activeChar.sendPacket(html); html = null; } else if (_command.startsWith("pkset")) { StringTokenizer st = new StringTokenizer(_command, "]"); if (st.countTokens() != 5) { activeChar.sendMessage("[!] Вы ввели не все данные."); String msg = HtmCache.getInstance().getHtm("data/html/passkey/setup.htm",activeChar); NpcHtmlMessage html = new NpcHtmlMessage(1); html.setHtml(msg); activeChar.sendPacket(html); html = null; return; } String newCommand = st.nextToken(); String pass1 = st.nextToken(); pass1 = pass1.substring(1, pass1.length() - 1); String pass2 = st.nextToken(); pass2 = pass2.substring(1, pass2.length() - 1); String question = st.nextToken(); question = question.substring(1, question.length() - 1); String answer = st.nextToken(); answer = answer.substring(1, answer.length()); if (pass1 == null || pass2 == null || question == null || answer == null) { activeChar.sendMessage("[!] Вы ввели недопустимые символы."); String msg = HtmCache.getInstance().getHtm("data/html/passkey/setup.htm",activeChar); NpcHtmlMessage html = new NpcHtmlMessage(1); html.setHtml(msg); activeChar.sendPacket(html); html = null; return; } if (!pass1.equals(pass2)) { activeChar.sendMessage("[!] Пароли не совпадают. Пожалуйста, проверьте."); activeChar.sendMessage("[!] pass1 = " + pass1 + "."); activeChar.sendMessage("[!] pass2 = " + pass2 + "."); activeChar.sendMessage("[!] Question = " + question + "."); activeChar.sendMessage("[!] answer = " + answer + "."); String msg = HtmCache.getInstance().getHtm("data/html/passkey/setup.htm",activeChar); NpcHtmlMessage html = new NpcHtmlMessage(1); html.setHtml(msg); activeChar.sendPacket(html); html = null; return; } insertPassKeyInformation(activeChar, pass1, question, answer); activeChar.sendMessage("[!] Установлена двухфакторная аутентификация!"); String msg = HtmCache.getInstance().getHtm("data/html/passkey/login.htm",activeChar); NpcHtmlMessage html = new NpcHtmlMessage(1); html.setHtml(msg); activeChar.sendPacket(html); html = null; } else if (_command.startsWith("pklogin")) { StringTokenizer st = new StringTokenizer(_command, " "); if (st.countTokens() != 2) { activeChar.sendMessage("[!] Допущена ошибка при вводе пароля."); String msg = HtmCache.getInstance().getHtm("data/html/passkey/login.htm",activeChar); NpcHtmlMessage html = new NpcHtmlMessage(1); html.setHtml(msg); activeChar.sendPacket(html); html = null; return; } String newCommand = st.nextToken(); String pass = st.nextToken(); Connection con = null; String query = "SELECT passkey FROM passkey WHERE obj_Id = ?"; String pwdindb = "error"; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement ps = con.prepareStatement(query); ps.setInt(1, activeChar.getObjectId()); ResultSet rs = ps.executeQuery(); while (rs.next()) pwdindb = rs.getString(1); rs.close(); ps.close(); ps = null; rs = null; } catch (Exception e) { e.printStackTrace(); } finally { try { con.close(); } catch (SQLException e) { e.printStackTrace(); } con = null; } if (pwdindb.equals(encodePass(pass))) { activeChar.setIsParalyzed(false); activeChar.setTradeRefusal(false); try { ObjectRestrictions.getInstance().removeRestriction(activeChar, AvailableRestriction.PlayerChat); } catch (Exception e) { e.printStackTrace(); return; } } else { activeChar.sendMessage("[!] Неправильный пароль от персонажа."); String msg = HtmCache.getInstance().getHtm("data/html/passkey/login.htm",activeChar); NpcHtmlMessage html = new NpcHtmlMessage(1); html.setHtml(msg); activeChar.sendPacket(html); html = null; return; } } else if (_command.startsWith("pkrec")) { StringTokenizer st = new StringTokenizer(_command, " "); if (st.countTokens() != 4) { activeChar.sendMessage("[!] Допущена ошибка при вводе данных!"); String msg = HtmCache.getInstance().getHtm("data/html/passkey/recovery.htm",activeChar); NpcHtmlMessage html = new NpcHtmlMessage(1); html.setHtml(msg); html.replace("%question%", getPassKeyQuestion(activeChar)); activeChar.sendPacket(html); html = null; return; } String newCommand = st.nextToken(); String answer = st.nextToken(); String pass1 = st.nextToken(); String pass2 = st.nextToken(); if (!pass1.equals(pass2)) { activeChar.sendMessage("[!] Пароли не совпадают. Пожалуйста, проверьте."); String msg = HtmCache.getInstance().getHtm("data/html/passkey/recovery.htm",activeChar); NpcHtmlMessage html = new NpcHtmlMessage(1); html.setHtml(msg); html.replace("%question%", getPassKeyQuestion(activeChar)); activeChar.sendPacket(html); html = null; return; } Connection con = null; String query = "SELECT answer FROM passkey WHERE obj_Id = ?"; String anwindb = "error"; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement ps = con.prepareStatement(query); ps.setInt(1, activeChar.getObjectId()); ResultSet rs = ps.executeQuery(); while (rs.next()) anwindb = rs.getString(1); rs.close(); ps.close(); ps = null; rs = null; } catch (Exception e) { e.printStackTrace(); } finally { try { con.close(); } catch (SQLException e) { e.printStackTrace(); } con = null; } if (anwindb.equals(answer)) { updPassKey(activeChar, pass1); activeChar.sendMessage("[!] Пароль от персонажа - успешно изменён."); String msg = HtmCache.getInstance().getHtm("data/html/passkey/login.htm",activeChar); NpcHtmlMessage html = new NpcHtmlMessage(1); html.setHtml(msg); activeChar.sendPacket(html); html = null; } else { activeChar.sendMessage("[!] Введён неправильный ответ на вопрос."); String msg = HtmCache.getInstance().getHtm("data/html/passkey/recovery.htm",activeChar); NpcHtmlMessage html = new NpcHtmlMessage(1); html.setHtml(msg); html.replace("%question%", getPassKeyQuestion(activeChar)); activeChar.sendPacket(html); html = null; return; } }
-
RequestBypassToServer.java
-
package ru.catssoftware.gameserver.network.clientpackets; import java.security.MessageDigest; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.StringTokenizer; import java.util.NoSuchElementException; import java.util.regex.Matcher; import java.util.regex.Pattern; import ru.catssoftware.Config; import ru.catssoftware.gameserver.ai.CtrlIntention; import ru.catssoftware.gameserver.cache.HtmCache; import ru.catssoftware.gameserver.communitybbs.CommunityBoard; import ru.catssoftware.gameserver.datatables.ClanTable; import ru.catssoftware.gameserver.gmaccess.gmController; import ru.catssoftware.gameserver.handler.IExItemHandler; import ru.catssoftware.gameserver.handler.IItemHandler; import ru.catssoftware.gameserver.handler.IVoicedCommandHandler; import ru.catssoftware.gameserver.handler.ItemHandler; import ru.catssoftware.gameserver.handler.VoicedCommandHandler; //import ru.catssoftware.gameserver.instancemanager.BotsPreventionManager; import ru.catssoftware.gameserver.model.BypassManager.DecodedBypass; import ru.catssoftware.gameserver.model.L2CharPosition; import ru.catssoftware.gameserver.model.L2ItemInstance; import ru.catssoftware.gameserver.model.L2Object; import ru.catssoftware.gameserver.model.L2World; // import ru.catssoftware.gameserver.model.BypassManager.DecodedBypass; import ru.catssoftware.gameserver.model.actor.instance.L2NpcInstance; import ru.catssoftware.gameserver.model.actor.instance.L2PcInstance; import ru.catssoftware.gameserver.model.entity.events.GameEvent; import ru.catssoftware.gameserver.model.entity.events.GameEventManager; import ru.catssoftware.gameserver.model.olympiad.Olympiad; import ru.catssoftware.gameserver.model.restriction.AvailableRestriction; import ru.catssoftware.gameserver.model.restriction.ObjectRestrictions; import ru.catssoftware.gameserver.model.restriction.RestrictionBindClassException; import ru.catssoftware.gameserver.network.InvalidPacketException; import ru.catssoftware.gameserver.network.L2GameClient; import ru.catssoftware.gameserver.network.serverpackets.GMViewPledgeInfo; import ru.catssoftware.gameserver.network.serverpackets.NpcHtmlMessage; import ru.catssoftware.tools.codec.Base64; import ru.catssoftware.L2DatabaseFactory; public class RequestBypassToServer extends L2GameClientPacket { private String _command = null; @Override protected void readImpl() { _command = readS(); //System.out.println("##readImpl_01##" + _command); if (!_command.isEmpty() && isDirectBypass(_command)) { if (getClient().getActiveChar() != null) { DecodedBypass bypass = getClient().getActiveChar().decodeBypass(_command); if (bypass == null) { _command = null; } else { _command = bypass.bypass; } } } } private boolean isDirectBypass(String bps) { if ((bps.startsWith("voice")) || (bps.startsWith("_maillist")) || (bps.startsWith("_bbs_add_fav")) || (bps.startsWith("_bbsgetfav")) || (bps.startsWith("_bbsloc")) || (bps.startsWith("_bbsclan")) || (bps.startsWith("_friendlist_")) || (bps.startsWith("_bbsadmin")) || (bps.startsWith("_bbsmemo")) || (bps.startsWith("_bbstopics")) || (bps.startsWith("_bbsposts")) || (bps.startsWith("_bbshome")) || (bps.startsWith("_maillist_")) || (bps.startsWith("_bbschange_class")) || (bps.startsWith("_bbsteleto")) || (bps.startsWith("_bbspwhtm")) || (bps.startsWith("_bbsgmshop")) || (bps.startsWith("_bbsnpc")) || (bps.startsWith("_bbsQuest")) || (bps.startsWith("_bbsauc")) || (bps.startsWith("_bbsmail")) || (bps.startsWith("_bbswarehouse")) || (bps.startsWith("_bbssell")) || (bps.startsWith("_bbspwhero")) || (bps.startsWith("_bbspremium")) || (bps.startsWith("_bbspwenchantskills")) || (bps.startsWith("_bbspwcustomskills")) || (bps.startsWith("_bbspwtittlecolor")) || (bps.startsWith("_bbspwtittlecolr")) || (bps.startsWith("_bbspwnamecolor")) || (bps.startsWith("_bbspwnamecolr")) || (bps.startsWith("_bbschangenick")) || (bps.startsWith("_bbsnobless")) || (bps.startsWith("_bbstransaug")) || (bps.startsWith("_bbstop")) || (bps.startsWith("_bbshome")) || (bps.startsWith("_bbsshow")) || (bps.startsWith("_bbsback"))) { return false; } return true; } @Override protected void runImpl() throws InvalidPacketException { L2PcInstance activeChar = getClient().getActiveChar(); if (activeChar == null) { return; } if (activeChar.isDead()) { ActionFailed(); return; } /*if (activeChar.getStat().getMAtkSpd() > 1200) { ActionFailed(); return; }*/ //System.out.println("####" + _command); activeChar._bbsMultisell = 0; if (_command == null) { return; } //System.out.println("##readImpl_02##" + _command); if (_command.startsWith("admin_")) { if (activeChar.isParalyzed()) { return; } if (activeChar.isGM()) { gmController.getInstance().useCommand(activeChar, _command.substring(6).split(" ")); } else { ActionFailed(); } } else if (_command.startsWith("item_")) { Pattern p = Pattern.compile("item_(\\d+) ?(.?+)"); Matcher m = p.matcher(_command); if (m.find()) { int objId = Integer.parseInt(m.group(1)); if (m.groupCount() > 1) { _command = m.group(2); } else { _command = null; } L2ItemInstance item = activeChar.getInventory().getItemByObjectId(objId); if (item == null) { return; } if (_command == null) { IItemHandler h = ItemHandler.getInstance().getItemHandler(item.getItemId()); if (h == null) { return; } h.useItem(activeChar, item, 0); } else { IExItemHandler handler = ItemHandler.getInstance().getExHandler(item.getItemId()); if (handler == null) { return; } handler.useItem(activeChar, item, _command.split(" ")); } } return; } else if (_command.startsWith("voice_")) { String command; String params = ""; // ------------------------------ Parse command -------------------------------- if (_command.contains(" ")) { command = _command.substring(6, _command.indexOf(" ")); params = _command.substring(_command.indexOf(" ") + 1); } else { command = _command.substring(6); } // ------------------------------ Execute command ------------------------------ IVoicedCommandHandler vc = VoicedCommandHandler.getInstance().getVoicedCommandHandler(command); if (vc == null) { return; } vc.useVoicedCommand(command, activeChar, params); return; } // L2CatsSoftware: Bypass for ctf commands else if (_command.startsWith("event")) { String eventName = _command.substring(6); int i = eventName.indexOf(" "); String cmd = ""; String param = ""; if (i != -1) { cmd = eventName.substring(i + 1); eventName = eventName.substring(0, i); } i = cmd.indexOf(" "); if (i != -1) { param = cmd.substring(i + 1); cmd = cmd.substring(0, i); } GameEvent evt = GameEventManager.getInstance().findEvent(eventName); if (evt != null) { evt.onCommand(activeChar, cmd, param); } return; } else if (_command.equals("come_here") && activeChar.isGM()) { comeHere(activeChar); } else if (_command.startsWith("show_clan_info ")) { activeChar.sendPacket(new GMViewPledgeInfo(ClanTable.getInstance().getClanByName(_command.substring(15)), activeChar)); } else if (_command.startsWith("player_help ")) { playerHelp(activeChar, _command.substring(12)); } else if (_command.startsWith("npc_")) { int endOfId = _command.indexOf('_', 5); String id; if (endOfId > 0) { id = _command.substring(4, endOfId); } else { id = _command.substring(4); } try { L2Object object = null; int objectId = Integer.parseInt(id); if (activeChar.getTargetId() == objectId) { object = activeChar.getTarget(); } if (object == null) { object = L2World.getInstance().findObject(objectId); } if (object instanceof L2NpcInstance && endOfId > 0 && activeChar.isInsideRadius(object, L2NpcInstance.INTERACTION_DISTANCE, false, false)) { try { ((L2NpcInstance) object).onBypassFeedback(activeChar, _command.substring(endOfId + 1)); } catch (NoSuchElementException nsee) { activeChar.sendMessage("Неверно задан аргумент"); } } ActionFailed(); } catch (NumberFormatException nfe) { } } // Draw a Symbol else if (_command.equals("menu_select?ask=-16&reply=1")) { L2Object object = activeChar.getTarget(); if (object instanceof L2NpcInstance) { ((L2NpcInstance) object).onBypassFeedback(activeChar, _command); } } else if (_command.equals("menu_select?ask=-16&reply=2")) { L2Object object = activeChar.getTarget(); if (object instanceof L2NpcInstance) { ((L2NpcInstance) object).onBypassFeedback(activeChar, _command); } } else if (_command.startsWith("manor_menu_select?")) { L2Object object = activeChar.getTarget(); if (object instanceof L2NpcInstance) { ((L2NpcInstance) object).onBypassFeedback(activeChar, _command); } } else if (_command.startsWith("bbs_")) { //System.out.println("##readImpl_03##" + _command); CommunityBoard.getInstance().handleCommands(getClient(), _command); } else if (_command.startsWith("_bbs")) { //System.out.println("##readImpl_04##" + _command); CommunityBoard.getInstance().handleCommands(getClient(), _command); } else if (_command.startsWith("_maillist_0_1_0_")) { CommunityBoard.getInstance().handleCommands(getClient(), "_bbsmail"); } else if (_command.startsWith("Quest ")) { String p = _command.substring(6).trim(); int idx = p.indexOf(' '); if (idx < 0) { activeChar.processQuestEvent(p, ""); } else { activeChar.processQuestEvent(p.substring(0, idx), p.substring(idx).trim()); } } else if (_command.startsWith("OlympiadArenaChange")) { Olympiad.bypassChangeArena(_command, activeChar); //} else if (_command.startsWith("farm_bot")) { } else if (_command.startsWith(activeChar.getFarmLink())) { int pwd = 0; try { pwd = Integer.parseInt(_command.substring(activeChar.getFarmLink().length()).trim()); } catch (Exception ignored) { // } if (activeChar.getFarmLesson() == pwd) { activeChar.showFarmDelayOk(); } else { activeChar.showFarmDelayWindow(); } } /* else if (_command.startsWith(activeChar.getFarmLink())) { BotsPreventionManager.getInstance().AnalyseBypass(_command, activeChar); }*/ } private void comeHere(L2PcInstance activeChar) { L2Object obj = activeChar.getTarget(); if (obj instanceof L2NpcInstance) { L2NpcInstance temp = (L2NpcInstance) obj; temp.setTarget(activeChar); temp.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(activeChar.getX(), activeChar.getY(), activeChar.getZ(), 0)); } } private void playerHelp(L2PcInstance activeChar, String path) { if (path.indexOf("..") != -1) { return; } StringTokenizer st = new StringTokenizer(path); String[] cmd = st.nextToken().split("#"); if (cmd.length > 1) { int itemId = 0; itemId = Integer.parseInt(cmd[1]); String filename = "data/html/help/" + cmd[0]; NpcHtmlMessage html = new NpcHtmlMessage(1, itemId); html.setFile(filename); activeChar.sendPacket(html); } else { String filename = "data/html/help/" + path; NpcHtmlMessage html = new NpcHtmlMessage(1); html.setFile(filename); activeChar.sendPacket(html); } } private void updPassKey(L2PcInstance player, String pass) { Connection con = null; String query = "UPDATE passkey SET passkey = ? WHERE obj_Id = ?"; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement st = con.prepareStatement(query); st.setString(1, encodePass(pass)); st.setInt(2, player.getObjectId()); st.executeUpdate(); st.close(); st = null; } catch (Exception e) { e.printStackTrace(); } finally { try { con.close(); } catch (SQLException e) { e.printStackTrace(); } con = null; } } private String encodePass(String password) { String pass = "error"; try { MessageDigest md = MessageDigest.getInstance("SHA"); byte[] raw = password.getBytes("UTF-8"); byte[] hash = md.digest(raw); pass = Base64.encodeBytes(hash); } catch (Exception e) { e.printStackTrace(); } return pass; } private void insertPassKeyInformation(L2PcInstance player, String pass, String question, String answer) { Connection con = null; String query = "INSERT INTO passkey (obj_Id, passkey, question, answer) VALUES (?,?,?,?)"; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement st = con.prepareStatement(query); st.setInt(1, player.getObjectId()); st.setString(2, encodePass(pass)); st.setString(3, question); st.setString(4, answer); st.execute(); st.close(); st = null; } catch (Exception e) { e.printStackTrace(); } finally { try { con.close(); } catch (SQLException e) { e.printStackTrace(); } con = null; } } private String getPassKeyQuestion(L2PcInstance player) { Connection con = null; String query = "SELECT question FROM passkey WHERE obj_Id = ?"; String question = "error"; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement st = con.prepareStatement(query); st.setInt(1, player.getObjectId()); ResultSet rs = st.executeQuery(); while (rs.next()) question = rs.getString(1); rs.close(); st.close(); st = null; rs = null; } catch (Exception e) { e.printStackTrace(); } finally { try { con.close(); } catch (SQLException e) { e.printStackTrace(); } con = null; } return question; } public static boolean getPassKeyEnable(L2PcInstance player) { Connection con = null; String query = "SELECT COUNT(*) FROM passkey WHERE obj_Id = ?"; int count = 0; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement st = con.prepareStatement(query); st.setInt(1, player.getObjectId()); ResultSet rs = st.executeQuery(); while (rs.next()) count = rs.getInt(1); rs.close(); st.close(); st = null; rs = null; } catch (Exception e) { e.printStackTrace(); } finally { try { con.close(); } catch (SQLException e) { e.printStackTrace(); } con = null; } if (count == 1) return true; else return false; } @Override public String getType() { return "[C] 21 RequestBypassToServer"; } } Я сюда уже добавил блоки с твоего примера, компиляция успешна, осталось только то, что выше указал
-
else if (_command.equalsIgnoreCase("pkrecovery")) { String msg = HtmCache.getInstance().getHtm("data/html/passkey/recovery.htm",activeChar); NpcHtmlMessage html = new NpcHtmlMessage(1); html.setHtml(msg); html.replace("%question%", getPassKeyQuestion(activeChar)); activeChar.sendPacket(html); html = null; } else if (_command.startsWith("pkset")) { StringTokenizer st = new StringTokenizer(_command, "]"); if (st.countTokens() != 5) { activeChar.sendMessage("[!] Вы ввели не все данные."); String msg = HtmCache.getInstance().getHtm("data/html/passkey/setup.htm",activeChar); NpcHtmlMessage html = new NpcHtmlMessage(1); html.setHtml(msg); activeChar.sendPacket(html); html = null; return; } String newCommand = st.nextToken(); String pass1 = st.nextToken(); pass1 = pass1.substring(1, pass1.length() - 1); String pass2 = st.nextToken(); pass2 = pass2.substring(1, pass2.length() - 1); String question = st.nextToken(); question = question.substring(1, question.length() - 1); String answer = st.nextToken(); answer = answer.substring(1, answer.length()); if (pass1 == null || pass2 == null || question == null || answer == null) { activeChar.sendMessage("[!] Вы ввели недопустимые символы."); String msg = HtmCache.getInstance().getHtm("data/html/passkey/setup.htm",activeChar); NpcHtmlMessage html = new NpcHtmlMessage(1); html.setHtml(msg); activeChar.sendPacket(html); html = null; return; } if (!pass1.equals(pass2)) { activeChar.sendMessage("[!] Пароли не совпадают. Пожалуйста, проверьте."); activeChar.sendMessage("[!] pass1 = " + pass1 + "."); activeChar.sendMessage("[!] pass2 = " + pass2 + "."); activeChar.sendMessage("[!] Question = " + question + "."); activeChar.sendMessage("[!] answer = " + answer + "."); String msg = HtmCache.getInstance().getHtm("data/html/passkey/setup.htm",activeChar); NpcHtmlMessage html = new NpcHtmlMessage(1); html.setHtml(msg); activeChar.sendPacket(html); html = null; return; } insertPassKeyInformation(activeChar, pass1, question, answer); activeChar.sendMessage("[!] Установлена двухфакторная аутентификация!"); String msg = HtmCache.getInstance().getHtm("data/html/passkey/login.htm",activeChar); NpcHtmlMessage html = new NpcHtmlMessage(1); html.setHtml(msg); activeChar.sendPacket(html); html = null; } else if (_command.startsWith("pklogin")) { StringTokenizer st = new StringTokenizer(_command, " "); if (st.countTokens() != 2) { activeChar.sendMessage("[!] Допущена ошибка при вводе пароля."); String msg = HtmCache.getInstance().getHtm("data/html/passkey/login.htm",activeChar); NpcHtmlMessage html = new NpcHtmlMessage(1); html.setHtml(msg); activeChar.sendPacket(html); html = null; return; } String newCommand = st.nextToken(); String pass = st.nextToken(); Connection con = null; String query = "SELECT passkey FROM passkey WHERE obj_Id = ?"; String pwdindb = "error"; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement ps = con.prepareStatement(query); ps.setInt(1, activeChar.getObjectId()); ResultSet rs = ps.executeQuery(); while (rs.next()) pwdindb = rs.getString(1); rs.close(); ps.close(); ps = null; rs = null; } catch (Exception e) { e.printStackTrace(); } finally { try { con.close(); } catch (SQLException e) { e.printStackTrace(); } con = null; } if (pwdindb.equals(encodePass(pass))) { activeChar.setIsParalyzed(false); activeChar.setTradeRefusal(false); try { ObjectRestrictions.getInstance().removeRestriction(activeChar, AvailableRestriction.PlayerChat); } catch (Exception e) { e.printStackTrace(); return; } } else { activeChar.sendMessage("[!] Неправильный пароль от персонажа."); String msg = HtmCache.getInstance().getHtm("data/html/passkey/login.htm",activeChar); NpcHtmlMessage html = new NpcHtmlMessage(1); html.setHtml(msg); activeChar.sendPacket(html); html = null; return; } } else if (_command.startsWith("pkrec")) { StringTokenizer st = new StringTokenizer(_command, " "); if (st.countTokens() != 4) { activeChar.sendMessage("[!] Допущена ошибка при вводе данных!"); String msg = HtmCache.getInstance().getHtm("data/html/passkey/recovery.htm",activeChar); NpcHtmlMessage html = new NpcHtmlMessage(1); html.setHtml(msg); html.replace("%question%", getPassKeyQuestion(activeChar)); activeChar.sendPacket(html); html = null; return; } String newCommand = st.nextToken(); String answer = st.nextToken(); String pass1 = st.nextToken(); String pass2 = st.nextToken(); if (!pass1.equals(pass2)) { activeChar.sendMessage("[!] Пароли не совпадают. Пожалуйста, проверьте."); String msg = HtmCache.getInstance().getHtm("data/html/passkey/recovery.htm",activeChar); NpcHtmlMessage html = new NpcHtmlMessage(1); html.setHtml(msg); html.replace("%question%", getPassKeyQuestion(activeChar)); activeChar.sendPacket(html); html = null; return; } Connection con = null; String query = "SELECT answer FROM passkey WHERE obj_Id = ?"; String anwindb = "error"; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement ps = con.prepareStatement(query); ps.setInt(1, activeChar.getObjectId()); ResultSet rs = ps.executeQuery(); while (rs.next()) anwindb = rs.getString(1); rs.close(); ps.close(); ps = null; rs = null; } catch (Exception e) { e.printStackTrace(); } finally { try { con.close(); } catch (SQLException e) { e.printStackTrace(); } con = null; } if (anwindb.equals(answer)) { updPassKey(activeChar, pass1); activeChar.sendMessage("[!] Пароль от персонажа - успешно изменён."); String msg = HtmCache.getInstance().getHtm("data/html/passkey/login.htm",activeChar); NpcHtmlMessage html = new NpcHtmlMessage(1); html.setHtml(msg); activeChar.sendPacket(html); html = null; } else { activeChar.sendMessage("[!] Введён неправильный ответ на вопрос."); String msg = HtmCache.getInstance().getHtm("data/html/passkey/recovery.htm",activeChar); NpcHtmlMessage html = new NpcHtmlMessage(1); html.setHtml(msg); html.replace("%question%", getPassKeyQuestion(activeChar)); activeChar.sendPacket(html); html = null; return; } } спасибо большое. как добавить блок(который указан выше) без ошибок компиляции, скиньте по возможности готовый RequestBypassToServer.
-
[javac] C:\Developers\ANT\apache-ant-1.9.6\bin\src\ru\catssoftware\extension\ExtensionManager.java:41: warning: Service is internal proprietary API and may be removed in a future release [javac] Iterator<?> it = Service.providers(IExtension.class); [javac] ^ [javac] C:\Developers\ANT\apache-ant-1.9.6\bin\src\ru\catssoftware\gameserver\network\clientpackets\RequestBypassToServer.java:383: error: cannot find symbol [javac] MessageDigest md = MessageDigest.getInstance("SHA"); [javac] ^ [javac] symbol: class MessageDigest [javac] location: class RequestBypassToServer [javac] C:\Developers\ANT\apache-ant-1.9.6\bin\src\ru\catssoftware\gameserver\network\clientpackets\RequestBypassToServer.java:383: error: cannot find symbol [javac] MessageDigest md = MessageDigest.getInstance("SHA"); [javac] ^ [javac] symbol: variable MessageDigest [javac] location: class RequestBypassToServer [javac] C:\Developers\ANT\apache-ant-1.9.6\bin\src\ru\catssoftware\gameserver\network\daemons\SuperDeamon.java:42: warning: Service is internal proprietary API and may be removed in a future release [javac] Iterator<?> deamons = Service.providers(IDeamon.class); [javac] ^ [javac] 2 errors