Once again: This is not mine, I do not take any credits for this (more than releasing it on RaGEZONE). I was asked by Sparks to release it for him. All credits to Sparks for writing and creating what's below. Also: This is compatible with OdinTeh.
Well guys I finally got it working.
I give you full permission to release this anywhere else AS LONG AS YOU GIVE CREDIT.
Credits to Vana for their v.59 Pin Packets.
Before you start it's very important that you add this:
http://forum.ragezone.com/showthread...74#post3963574
Here we go.
First add this table to your SQL.
PHP Code:
ALTER TABLE `accounts` ADD COLUMN `pin` int(4) NOT NULL default '0';
Then. In MapleClient.java
Find:
PHP Code:
private int status = 0;
Add below it:
PHP Code:
private String pin;
Find:
PHP Code:
private boolean autoCreate = Boolean.parseBoolean(props.getProperty("net.sf.odinms.world.morethanone", "false"));
Add below it:
PHP Code:
private boolean pinActivate = Boolean.parseBoolean(props.getProperty("net.sf.odinms.world.pinactivate", "false"));
Find:
PHP Code:
.prepareStatement("SELECT id,password,salt,tempban,banned,gm,macs,greason,gender FROM accounts WHERE name = ?");
Replace it with:
PHP Code:
.prepareStatement("SELECT id,password,salt,tempban,banned,gm,macs,greason,gender,pin FROM accounts WHERE name = ?");
Find:
PHP Code:
tempban = getTempBanCalendar(rs);
Add bellow it:
PHP Code:
gender = rs.getInt("gender");
if (gender != 0 || gender != 1) {
setStatus(1);
}
else {
if (rs.getString("pin") == null) {
setStatus(2);
}
else
pin = rs.getString("pin");
}
Find:
PHP Code:
public void setStatus(int status) {
this.status = status;
}
Add bellow it:
PHP Code:
public int getPin() {
return Integer.parseInt(this.pin);
}
public void setPin(int pin) {
this.pin = String.valueOf(pin);
}
Now open notepad and make a new Java file. Name it RegisterPinHandler.java.
Add all of this in it.
PHP Code:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package net.sf.odinms.net.login.handler;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import net.sf.odinms.client.MapleClient;
import net.sf.odinms.net.AbstractMaplePacketHandler;
import net.sf.odinms.tools.data.input.SeekableLittleEndianAccessor;
import net.sf.odinms.database.DatabaseConnection;
import net.sf.odinms.tools.MaplePacketCreator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author akakori
*/
public class RegisterPinHandler extends AbstractMaplePacketHandler {
private static final Logger log = LoggerFactory.getLogger(MapleClient.class);
@Override
public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
if(c.status() != 2)
//hacking
return;
if (slea.readByte() == 0x00) {
if (c.getPin() == -1) {
c.setStatus(2);
}
int pin = Integer.parseInt(slea.readMapleAsciiString());
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps;
try {
ps = con.prepareStatement("update accounts set pin = ? where id = ?");
ps.setInt(1, pin);
ps.setInt(2, c.getAccID());
ps.executeUpdate();
ps.close();
//c.setStatus(2);
} catch (SQLException e) {
log.error("ERROR", e);
}
c.getSession().write(MaplePacketCreator.getPinAssgined());
}
}
}
Put it in your net.sf.odinms.net.login.handler folder.
In your PacketProcessor.java
Find:
PHP Code:
import net.sf.odinms.net.channel.handler.ReportHandler;
Add this bellow it:
PHP Code:
import net.sf.odinms.net.login.handler.RegisterPinHandler;
import net.sf.odinms.net.login.handler.SetGenderHandler;
Find:
PHP Code:
registerHandler(RecvPacketOpcode.SET_GENDER, new SetGenderHandler());
Add this bellow it:
PHP Code:
registerHandler(RecvPacketOpcode.REGISTER_PIN, new RegisterPinHandler());
Now open your SendPacketOpcode.java.
Find:
Add bellow:
Now in your RecvPacketOpcode.java.
Find:
Add bellow it:
Now open MaplePacketCreator.java.
Find:
PHP Code:
/**
* Gets a successful authentication and PIN Request packet.
Add ABOVE It with a space in between the both add:
PHP Code:
public static MaplePacket getPinAssgined() {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendPacketOpcode.PIN_ASSIGNED.getValue());
mplew.write(0);
return mplew.getPacket();
}
Now open AfterLoginHandler.java.
Find:
PHP Code:
// Official requests the pin here - but pins suck so we just accept
Add bellow it:
PHP Code:
if(c.getPinActivate())
c.getSession().write(MaplePacketCreator.requestPin());
else
Find:
PHP Code:
if (pin.equals("1234")) {
Replace it with:
PHP Code:
if (Integer.parseInt(pin) == c.getPin()) {
Now open up your SetGenderHandler.java Which you created for Kori's Gender Selection.
Find:
PHP Code:
@author Compaq_Owner
Replace it with:
PHP Code:
@author akakori
Now open recvops.properties.
Find:
PHP Code:
SET_GENDER = CHAR_SELECT 1
Add bellow it:
PHP Code:
REGISTER_PIN = 0x0a
Open up sendops.properties.
Find:
PHP Code:
GENDER_SET = PIN_OPERATION 1
Add bellow:
PHP Code:
PIN_ASSIGNED = 0x07
Lastly. Go to your world.properties.
Find:
PHP Code:
net.sf.odinms.channel.events=lolcastle,3rdjob,ZakumPQ,KerningPQ
Add bellow it:
PHP Code:
# activate log with pins
net.sf.odinms.world.pinactivate = false
# activate in-game account creation
net.sf.odinms.world.autocreate = false
Done.
And if you want to have this for your 0.55 server, go here: http://www.evo-networks.net/index.php?showtopic=57
Remember Evo-Networks is the place to be :P