D
Deleted member 471572
Guest
I am releasing my Pin System FULLY working v.55 for you guys.
Take from this one and how it's functioning and work on it from there.
Be Sure first of all to add this to your SQL.
NOTE: This runs off akakori's Account Gender / Selection fix.
HUGE Credit to akakori, he's helped me with this through the beggining, and unfortunately right before he left, we didn't get a chance to fix up the bugs, so I've taken the script looked over it and re-scripted some areas like the boolean which was the biggest issue.
I've left all credits to him in the patch file.
This script is Modified by me. And it should work 100% no error, previously it used to give 66 errors now its none.
Also as I've told Kori I didn't bother using this on my server, since this was his and he left, I felt like I was using it ie *leeched* so instead of making him work it out, I've done it myself. Also it wasn't compatible with the current SVN, now it is.
It is also now compatible with the newest revision 988.
I won't provide any help (I know that's a dick move), but, it's all straight forward, if you're getting errors you don't know how to patch and/or follow instructions.
Okay, with that being said let's get started.
In MapleClient.java
Find:
Add below it:
Find:
Add below it:
Find:
Replace it with:
Find:
Add bellow it:
Find:
Add bellow it:
Now open notepad and make a new Java file. Name it RegisterPinHandler.java.
Add all of this in it.
Put it in your net.sf.odinms.net.login.handler folder.
In your PacketProcessor.java
Find:
Add this bellow it:
Find:
Add this bellow it:
Now open your SendPacketOpcode.java.
Find:
Add bellow:
Now in your RecvPacketOpcode.java.
Find:
Add bellow it:
Now open MaplePacketCreator.java.
Find:
Add ABOVE It with a space in between the both add:
Now open AfterLoginHandler.java.
Find:
Add bellow it:
Find:
Replace it with:
Now open up your SetGenderHandler.java Which you created for Kori's Gender Selection.
Find:
Replace it with:
Now open recvops.properties.
Find:
Add bellow it:
Open up sendops.properties.
Find:
Add bellow:
Lastly. Go to your world.properties.
Find:
Add bellow it:
Well I've attached a TXT Version of it. The .patch file can be found here:
.txt File is attached.
Take from this one and how it's functioning and work on it from there.
Be Sure first of all to add this to your SQL.
Code:
ALTER TABLE `accounts` ADD COLUMN `pin` int(4) NOT NULL default '0';
HUGE Credit to akakori, he's helped me with this through the beggining, and unfortunately right before he left, we didn't get a chance to fix up the bugs, so I've taken the script looked over it and re-scripted some areas like the boolean which was the biggest issue.
I've left all credits to him in the patch file.
This script is Modified by me. And it should work 100% no error, previously it used to give 66 errors now its none.
Also as I've told Kori I didn't bother using this on my server, since this was his and he left, I felt like I was using it ie *leeched* so instead of making him work it out, I've done it myself. Also it wasn't compatible with the current SVN, now it is.
It is also now compatible with the newest revision 988.
I won't provide any help (I know that's a dick move), but, it's all straight forward, if you're getting errors you don't know how to patch and/or follow instructions.
Okay, with that being said let's get started.
In MapleClient.java
Find:
PHP:
private int status = 0;
PHP:
private String pin;
PHP:
private boolean autoCreate = Boolean.parseBoolean(props.getProperty("net.sf.odinms.world.morethanone", "false"));
PHP:
private boolean pinActivate = Boolean.parseBoolean(props.getProperty("net.sf.odinms.world.pinactivate", "false"));
PHP:
.prepareStatement("SELECT id,password,salt,tempban,banned,gm,macs,greason,gender FROM accounts WHERE name = ?");
PHP:
.prepareStatement("SELECT id,password,salt,tempban,banned,gm,macs,greason,gender,pin FROM accounts WHERE name = ?");
PHP:
tempban = getTempBanCalendar(rs);
PHP:
gender = rs.getInt("gender");
if (gender != 0 || gender != 1) {
setStatus(1);
}
else {
if (rs.getString("pin") == null) {
setStatus(2);
}
else
pin = rs.getString("pin");
}
PHP:
public void setStatus(int status) {
this.status = status;
}
PHP:
public int getPin() {
return Integer.parseInt(this.pin);
}
public void setPin(int pin) {
this.pin = String.valueOf(pin);
}
Add all of this in it.
PHP:
/*
* 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());
}
}
}
In your PacketProcessor.java
Find:
PHP:
import net.sf.odinms.net.channel.handler.ReportHandler;
PHP:
import net.sf.odinms.net.login.handler.RegisterPinHandler;
import net.sf.odinms.net.login.handler.SetGenderHandler;
PHP:
registerHandler(RecvPacketOpcode.SET_GENDER, new SetGenderHandler());
PHP:
registerHandler(RecvPacketOpcode.REGISTER_PIN, new RegisterPinHandler());
Find:
PHP:
GENDER_SET,
PHP:
PIN_ASSIGNED,
Find:
PHP:
SET_GENDER,
PHP:
REGISTER_PIN,
Find:
PHP:
/**
* Gets a successful authentication and PIN Request packet.
PHP:
public static MaplePacket getPinAssgined() {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendPacketOpcode.PIN_ASSIGNED.getValue());
mplew.write(0);
return mplew.getPacket();
}
Find:
PHP:
// Official requests the pin here - but pins suck so we just accept
PHP:
if(c.getPinActivate())
c.getSession().write(MaplePacketCreator.requestPin());
else
PHP:
if (pin.equals("1234")) {
PHP:
if (Integer.parseInt(pin) == c.getPin()) {
Find:
PHP:
@author Compaq_Owner
PHP:
@author akakori
Now open recvops.properties.
Find:
PHP:
SET_GENDER = CHAR_SELECT 1
PHP:
REGISTER_PIN = 0x05
Find:
PHP:
GENDER_SET = PIN_OPERATION 1
PHP:
PIN_ASSIGNED = 0x11
Find:
PHP:
net.sf.odinms.channel.events=lolcastle,3rdjob,ZakumPQ,KerningPQ
PHP:
# activate log with pins
net.sf.odinms.world.pinactivate = false
# activate in-game account creation
To view the content, you need to sign in or register
.txt File is attached.
Attachments
Last edited by a moderator:

