Released by Weaxer, and all the content below is written by Sparks. Original release by Akakori, and converted to v.59 by Sparks.
ALL CREDITS TO AKAKORI
I only take credit for Updating it to v.59 to fit my v.59 Pin Script.
EDIT: Turns out not much has changed from v.55 - v.59 As far as Gender Selection goes.
Ok, a lot of people have been asking me where to get the script so here.
Kori let me know if you want me to take it down, or better yet, you release it yourself on the forum.
Open up recvops.properties.
Find:
PHP Code:
LOGIN_PASSWORD = RELOG 1
Add bellow it:
PHP Code:
SET_GENDER = CHAR_SELECT 1 //V59 = 0x08
Next open up sendops.properties.
Find:
PHP Code:
RELOG_RESPONSE = CHARLIST 2
Add bellow it:
PHP Code:
GENDER_SET = PIN_OPERATION 1 //V59 = 0x04
Now open up MapleClient.java.
Find:
PHP Code:
private byte greason = 1;
And right bellow it add:
[php] private int gender = 0;
private int status = 0;
[php]
Find:
PHP Code:
.prepareStatement("SELECT id,password,salt,tempban,banned,gm,macs,greason FROM accounts WHERE name = ?");
Replace it with:
PHP Code:
.prepareStatement("SELECT id,password,salt,tempban,banned,gm,macs,greason,gender FROM accounts WHERE name = ?");
Find:
PHP Code:
tempban = getTempBanCalendar(rs);
Add bellow it:
[php] gender = rs.getInt("gender");
if (gender != 0 || gender != 1) {
setStatus(1);
}
[php]
Find:
[php]
this.accountName = accountName;
}
[php]
Add bellow it:
PHP Code:
public int status() {
return this.status;
}
public void setStatus(int status) {
this.status = status;
}
public int getGender() {
return this.gender;
}
public void setGender(int gender) {
this.gender = gender;
}
Now open up Notepad and make a whole new file, name it SetGenderHandler.java.
Add the following content in it:
PHP Code:
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License version 3
as published by the Free Software Foundation. You may not use, modify
or distribute this program under any other version of the
GNU Affero General Public License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.sf.odinms.net.channel.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 SetGenderHandler extends AbstractMaplePacketHandler {
private static final Logger log = LoggerFactory.getLogger(MapleClient.class);
@Override
public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
int status = slea.readByte();
int gender = slea.readByte();
if(status == 1) {
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps;
try {
ps = con.prepareStatement("update accounts set gender = ? where id = ?");
ps.setInt(1, gender);
ps.setInt(2, c.getAccID());
ps.executeUpdate();
ps.close();
c.getSession().write(MaplePacketCreator.setGender(gender));
//c.getSession().write(MaplePacketCreator.getLoginFailed(8));
} catch (SQLException e) {
log.error("ERROR", e);
}
}
}
}
Now open up LoginWorker.java.
Find:
PHP Code:
client.getSession().write(MaplePacketCreator.getAuthSuccessRequestPin(client.getAccountName()));
Replace it with this:
PHP Code:
client.getSession().write(MaplePacketCreator.getAuthSuccessRequestPin(client.getAccountName(), client.getAccID(), client.status(), client.getGender()));
Open up PacketProcessor.java.
Find:
PHP Code:
import net.sf.odinms.net.channel.handler.BBSOperationHandler;
Add bellow it:
PHP Code:
import net.sf.odinms.net.channel.handler.SetGenderHandler;
Find:
PHP Code:
registerHandler(RecvPacketOpcode.SKILL_EFFECT, new SkillEffectHandler());
Add bellow it:
PHP Code:
registerHandler(RecvPacketOpcode.SET_GENDER, new SetGenderHandler());
Open up RecvPacketOpcode.java.
Find:
PHP Code:
SERVERSTATUS_REQUEST,
Add Bellow it:
PHP Code:
SET_GENDER, //V59 = 0x08
Now open up SendPacketOpcode.java.
Find:
PHP Code:
DELETE_CHAR_RESPONSE, // 0xf
Add bellow it:
PHP Code:
GENDER_SET, //V59 = 0x04
Now open up MaplePacketCreator.java.
Find:
PHP Code:
public static MaplePacket getAuthSuccessRequestPin(String account) {
Replace it with:
PHP Code:
public static MaplePacket getAuthSuccessRequestPin(String account, int acid, int status, int gender) {
Find this whole set:
PHP Code:
mplew.writeShort(SendPacketOpcode.LOGIN_STATUS.getValue());
mplew.write(new byte[] { 0, 0, 0, 0, 0, 0, (byte) 0xFF, 0x6A, 1, 0, 0, 0, 0x4E });
mplew.writeMapleAsciiString(account);
mplew
.write(new byte[] { 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (byte) 0xDC, 0x3D, 0x0B, 0x28, 0x64, (byte) 0xC5, 1, 8, 0, 0, 0 });
Replace it with this set:
PHP Code:
mplew.writeInt(0);
mplew.writeShort(0);
mplew.writeInt(acid);
switch(status) {
case 1 : mplew.write(0x0a); break; //Gender Select
case 2 : mplew.write(0x0b); break; //Pin Select
default : mplew.write(gender); break;
}
mplew.write(HexTool.getByteArrayFromHexString("0465"));
mplew.writeInt(0);
mplew.writeInt(0);
mplew.write(HexTool.getByteArrayFromHexString("000000A6B89C2B4CC701"));
mplew.writeInt(0);
Find this part under all that:
And add this under it:
PHP Code:
* Gets a successful gender set Packet
* @param gender The account gender.
* @return The gender set packet.
*/
public static MaplePacket setGender(int gender) {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(3);
mplew.writeShort(SendPacketOpcode.GENDER_SET.getValue());
mplew.write(gender);
mplew.write(1);
return mplew.getPacket();
}
/**
Now remember, I give and left ALL CREDITS TO AKAKORI! Remember that, I merely take credit for updating this to v.59 IF THAT.
And: Evo-Networks is the place to be! For more things and future releases please check http://www.evo-networks.net/index.php?showforum=21.