Akakori's Gender Script Updated by Sparks to v.59

🚫
Exiled
Joined
Oct 19, 2006
Messages
400
Reaction score
1
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:
LOGIN_PASSWORD = RELOG 1
Add bellow it:

PHP:
SET_GENDER = CHAR_SELECT 1 //V59 = 0x08
Next open up sendops.properties.

Find:

PHP:
RELOG_RESPONSE = CHARLIST 2
Add bellow it:

PHP:
GENDER_SET = PIN_OPERATION 1 //V59 = 0x04
Now open up MapleClient.java.

Find:

PHP:
private byte greason = 1;
And right bellow it add:

PHP:
        private int gender = 0;
        private int status = 0;
[php]

Find:

[php].prepareStatement("SELECT id,password,salt,tempban,banned,gm,macs,greason FROM accounts WHERE name = ?");
Replace it with:

PHP:
.prepareStatement("SELECT id,password,salt,tempban,banned,gm,macs,greason,gender FROM accounts WHERE name = ?");
Find:

PHP:
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]
        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:
/*
    This file is part of the OdinMS Maple Story Server
    Copyright (C) 2008 Patrick Huy <[email protected]> 
                       Matthias Butz <[email protected]>
                       Jan Christian Meyer <[email protected]>

    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:
client.getSession().write(MaplePacketCreator.getAuthSuccessRequestPin(client.getAccountName()));
Replace it with this:

PHP:
client.getSession().write(MaplePacketCreator.getAuthSuccessRequestPin(client.getAccountName(), client.getAccID(), client.status(), client.getGender()));
Open up PacketProcessor.java.

Find:

PHP:
import net.sf.odinms.net.channel.handler.BBSOperationHandler;
Add bellow it:

PHP:
import net.sf.odinms.net.channel.handler.SetGenderHandler;
Find:

PHP:
registerHandler(RecvPacketOpcode.SKILL_EFFECT, new SkillEffectHandler());
Add bellow it:

PHP:
                        registerHandler(RecvPacketOpcode.SET_GENDER, new SetGenderHandler());
Open up RecvPacketOpcode.java.

Find:

PHP:
SERVERSTATUS_REQUEST,
Add Bellow it:

PHP:
SET_GENDER, //V59 = 0x08
Now open up SendPacketOpcode.java.

Find:

PHP:
DELETE_CHAR_RESPONSE, // 0xf
Add bellow it:

PHP:
GENDER_SET, //V59 = 0x04
Now open up MaplePacketCreator.java.

Find:

PHP:
public static MaplePacket getAuthSuccessRequestPin(String account) {
Replace it with:

PHP:
public static MaplePacket getAuthSuccessRequestPin(String account, int acid, int status, int gender) {
Find this whole set:

PHP:
        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:
                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:

PHP:
/**
And add this under it:

PHP:
     * 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 .
 
Re: [Release] Akakori's Gender Script Updated by Sparks to v.59

So what does this do other then allow you to use pins in v59?
 
Re: [Release] Akakori's Gender Script Updated by Sparks to v.59

So what does this do other then allow you to use pins in v59?

Check Akakori's thread. And yes, this is required to install pins.
 
Re: [Release] Akakori's Gender Script Updated by Sparks to v.59

Meh, I guess I won't be getting pins in my v59 source.... Oh well.

Couldn't compile after doing this. I suspected something was wrong from the beginning when it said to Ctrl+F for "LOGIN_PASSWORD = RELOG 1" when in my source, there was a packet there instead of "RELOG 1."
 
Re: [Release] Akakori's Gender Script Updated by Sparks to v.59

ER.. I hate to say this.. xD but guys you dont need my Gender Fix to get the pin =d.

LOL You just need to reroute some features.. thats all. If you want to know how i could always teach ya =P after all i fixed both of them and linked them together, thus of course i know how to unlink them.. bah~~
 
Re: [Release] Akakori's Gender Script Updated by Sparks to v.59

NOOOO!!! Quick erase the evo-networks link before more leechers come :/
 
Back