Jump to content
  • 0

[Help] Npc password changer


Question

4 answers to this question

Recommended Posts

  • 0
Posted

Πήγαινε στο model/actor/instance και κάνε ένα αρχείο με όνομα L2PasswordChangerInstance.java και κάνε επικόλληση αυτό

/* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package com.l2jfrozen.gameserver.model.actor.instance;

import com.l2jfrozen.crypt.Base64;
import com.l2jfrozen.gameserver.ai.CtrlIntention;
import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
import com.l2jfrozen.gameserver.network.serverpackets.LeaveWorld;
import com.l2jfrozen.gameserver.network.serverpackets.MyTargetSelected;
import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jfrozen.gameserver.network.serverpackets.ValidateLocation;
import com.l2jfrozen.gameserver.templates.L2NpcTemplate;
import com.l2jfrozen.util.database.L2DatabaseFactory;

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 javolution.text.TextBuilder;

public class L2PasswordChangerInstance extends L2FolkInstance
{
public L2PasswordChangerInstance(int objectId, L2NpcTemplate template)
{
super(objectId, template);
}

public void onBypassFeedback(L2PcInstance player, String command)
{
if (command.startsWith("change_password"))
{
StringTokenizer st = new StringTokenizer(command);
st.nextToken();
String currPass = null;
String newPass = null;
String repeatNewPass = null;
try
{
if (st.hasMoreTokens())
{
currPass = st.nextToken();
newPass = st.nextToken();
repeatNewPass = st.nextToken();
}
else
{
player.sendMessage("Please fill in all the blanks before requesting for a password change.");
return;
}
changePassword(currPass, newPass, repeatNewPass, player);
}
catch (StringIndexOutOfBoundsException e)
{
}
}
}

public void onAction(L2PcInstance player)
{
if (!canTarget(player)) {
return;
}

if (this != player.getTarget())
{
player.setTarget(this);

player.sendPacket(new MyTargetSelected(getObjectId(), 0));

player.sendPacket(new ValidateLocation(this));
}
else if (!canInteract(player))
{
player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);
}
else
{
showHtmlWindow(player);
}

player.sendPacket(new ActionFailed());
}

private void showHtmlWindow(L2PcInstance activeChar)
{
NpcHtmlMessage nhm = new NpcHtmlMessage(5);
TextBuilder replyMSG = new TextBuilder("");

replyMSG.append("<html><title>L2 InStadia Account Manager</title>");
replyMSG.append("<body><center>");
replyMSG.append("To change your password:<br1> First fill in your current password and then your new!</font><br>");
replyMSG.append("Current Password: <edit var=\"cur\" width=100 height=15><br>");
replyMSG.append("New Password: <edit var=\"new\" width=100 height=15><br>");
replyMSG.append("Repeat New Password: <edit var=\"repeatnew\" width=100 height=15><br><br>");
replyMSG.append("<button value=\"Change Password\" action=\"bypass -h npc_" + getObjectId() + "_change_password $cur $new $repeatnew\" width=204 height=20 back=\"sek.cbui75\" fore=\"sek.cbui75\">");
replyMSG.append("</center></body></html>");

nhm.setHtml(replyMSG.toString());
activeChar.sendPacket(nhm);

activeChar.sendPacket(new ActionFailed());
}

public static boolean changePassword(String currPass, String newPass, String repeatNewPass, L2PcInstance activeChar)
{
if (newPass.length() < 5)
{
activeChar.sendMessage("The new password is too short!");
return false;
}
if (newPass.length() > 20)
{
activeChar.sendMessage("The new password is too long!");
return false;
}
if (!newPass.equals(repeatNewPass))
{
activeChar.sendMessage("Repeated password doesn't match the new password.");
return false;
}

Connection con = null;
String password = null;
try
{
MessageDigest md = MessageDigest.getInstance("SHA");
byte[] raw = currPass.getBytes("UTF-8");
raw = md.digest(raw);
String currPassEncoded = Base64.encodeBytes(raw);

con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement("SELECT password FROM accounts WHERE login=?");
statement.setString(1, activeChar.getAccountName());
ResultSet rset = statement.executeQuery();
while (rset.next())
{
password = rset.getString("password");
}
rset.close();
statement.close();
byte[] password2 =
null;
if (currPassEncoded.equals(password))
{
password2 = newPass.getBytes("UTF-8");
password2 = md.digest(password2);

PreparedStatement statement2 = con.prepareStatement("UPDATE accounts SET password=? WHERE login=?");
statement2.setString(1, Base64.encodeBytes(password2));
statement2.setString(2, activeChar.getAccountName());
statement2.executeUpdate();
statement2.close();

activeChar.sendMessage("Congratulations! Your password has been changed succesfully. You will now be disconnected for security reasons. Please login again!");
try
{
Thread.sleep(3000L);
}
catch (Exception e)
{
}

activeChar.deleteMe();

activeChar.sendPacket(new LeaveWorld());
}
else
{
activeChar.sendMessage("The current password you've inserted is incorrect! Please try again!");

return password2 != null;
}
}
catch (Exception e)
{
_log.warning("could not update the password of account: " + activeChar.getAccountName());
}
finally
{
try
{
if (con != null)
con.close();
}
catch (SQLException e)
{
_log.warning("Failed to close database connection!");
}

}

return true;
}
}

Μετά κάνε ένα npc με type L2PasswordChanger.

Guest
This topic is now closed to further replies.


  • Posts

    • Hi everyone,   I’m currently playing Lineage 2 on the L2Damage server and I’d like to know the current status of botting tools there. With all the server updates and protections, many tools stop working or get detected pretty fast, so I wanted to ask the community:   Is anyone currently using any bot on L2Damage that still works reliably? Have you had any success with tools like Adrenaline, L2Walker, L2Tower, or similar? Any general experience or feedback about what’s still usable on this server?   I know every server has different protections, so any up-to-date info or personal experience would be appreciated.   Thanks in advance.
    • Hey Dexters! Https://lineage2dex.com SKADI server starting TODAY! ✅ On 18:00 (UTC +2) We allow you to login for create character! To restrict your name and transfer ToDs/Starter packs in game. Make it before start! On start, we can have problems with WEB! It is IMPORTANT to prepare everything for starting the game RIGHT NOW, do not postpone for later, during the opening there may be problems with the web part of the project and you simply can not register. ## [ - REGISTRATION AND FILES](https://lineage2dex.com/en/start) ✨ Get a +15% bonus on all TOD orders! The bonus is active until February 1st, 23:00 and also applies to UNION. ✅ What you need to know at the start: ➡️ All Epic Raid Bosses dead on start. Re-spawn time you can check in game ALT+B Raid tab ➡️ All other RBs (for difficult 1 location) alive on server start (including Sub and Nobl RB) ➡️ Max enchant for items +10, this limits will be change with server time ➡️ Difficulty 1 locations are available ➡️ Locations drop Basic and Advanced tier resources, allowing you to craft B and A grade equivalent gear ➡️ School of Dark Arts — PvP zone with x5 drop. Its intance Zone, to enter it you need make TP from GateKeeper. If you will teleport on it by map, you will go on regular zone, not pvp ➡️ Only B-grade equivalent equipment is available for purchase (common, its dont have durability) ➡️ Tier 1 talents are available to learn ➡️ Talent Point Shop is available [ - Roadmap](https://wiki.lineage2dex.com/road-map/en) [ - Basic server description](https://wiki.lineage2dex.com/general-description-skadi-x100/en) Thank you for participating in the beta! All players who spent more than 1 hour on the beta server will receive useful items for autofarming and equipment repair. The rewards will be granted to the first character on the same account that participated in the beta. All items will be placed in the Quest Inventory. Good luck everyone! And have a fun on new Skadi server!
    • ## [1.5.1] - 2026-01-30   ### 🐛 Bug Fixes - **Top Voters**: Top voters list now loads correctly for inactive servers (previously showed "Server not found"). - **View Counter**: Server info page view count now records correctly for inactive servers.   ### 🔄 Improvements - **My Servers – Hide/Active**: The hide/active toggle now works correctly and is only shown when the server is approved (active) by an admin. Owner hide/show is separate from admin status. Toggling no longer causes a full page refresh. - **Accessibility**: Form fields across the site now have proper labels and IDs for screen readers and autofill — server info edit form, add server form, My Servers edit, Admin Panel (Email, Vote System, pricing, filters, logs), and related inputs. ## [1.5.2] - 2026-01-30   ### ✨ New Features - **Server Type**: Replaced the old "Server Options" checkboxes with a single-choice **Server Type** selection: Normal, MultiSkill, GvE, Olympiad, PvP, and Stacksub. Choose one type that best describes your server. - **Server Type in Edit Forms**: You can now change the server type when editing a server — in **My Servers → Edit** and in **Admin Panel → Servers → Edit Server**.   ### 🔄 Improvements - **Sidebar Filters**: Server type filters (MultiSkill, GvE, Olympiad, PvP, Stacksub) are now single-choice — selecting one clears the previous selection. Order updated to: VIP L2 Servers, Low Rate, then the server type options. VIP L2 Servers and Low Rate remain independent toggles. - **Rate Display**: Server rows now show full rate values (e.g. x50000) without truncation. - **My Servers – Edit Modal**: Edit form layout restored with slightly tighter spacing so it fits better on screen.   ### 🗑️ Removed - **International Option**: Removed from the Add Server form; server type options are now simplified.
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..