• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook pagefor updates, or we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.)

JourneyDEV v83

Elite Diviner
Joined
Mar 24, 2015
Messages
426
Reaction score
416
Small Update:
Added some of my new packet stuff to github, Packetcreator.java and LoginHandlers.java. My reason for making these is that nexon's packets contain alot of stuff that I don't need and so I will probably remake most of the packets. This will also give me the opporunity to make the packetcreator/handlers easier to read, because I'm not a huge fan of the odin defaults. To give an example of what I mean:

Old login stuff:
Code:
public static byte[] getAuthSuccess(MapleClient c) {
        final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendOpcode.LOGIN_STATUS.getValue());
        mplew.writeInt(0);
        mplew.writeShort(0);
        mplew.writeInt(c.getAccID()); //user id
        mplew.write(c.getGender());
        mplew.writeBool(c.gmLevel() > 0); //admin byte
        short toWrite = (short) (c.gmLevel() * 32);
        //toWrite = toWrite |= 0x100; only in higher versions
        mplew.write(toWrite > 0x80 ? 0x80 : toWrite);//0x80 is admin, 0x20 and 0x40 = subgm
        mplew.writeBool(c.gmLevel() > 0);
        //mplew.writeShort(toWrite > 0x80 ? 0x80 : toWrite); only in higher versions...
        mplew.writeMapleAsciiString(c.getAccountName());
        mplew.write(0);
        mplew.write(0); //isquietbanned
        mplew.writeLong(0);//isquietban time
        mplew.writeLong(0); //creation time
        mplew.writeInt(0);
        mplew.writeShort(2);//PIN
        return mplew.getPacket();
    }

public static byte[] getLoginFailed(int reason) {
        final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(8);
        mplew.writeShort(SendOpcode.LOGIN_STATUS.getValue());
        mplew.write(reason);
        mplew.write(0);
        mplew.writeInt(0);
        return mplew.getPacket();
    }

public static byte[] getPermBan(byte reason) {
        final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendOpcode.LOGIN_STATUS.getValue());
        mplew.write(2); // Account is banned
        mplew.write(0);
        mplew.writeInt(0);
        mplew.write(0);
        mplew.writeLong(getTime(-1));

        return mplew.getPacket();
    }

    public static byte[] getTempBan(long timestampTill, byte reason) {
        final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(17);
        mplew.writeShort(SendOpcode.LOGIN_STATUS.getValue());
        mplew.write(2);
        mplew.write(0);
        mplew.writeInt(0);
        mplew.write(reason);
        mplew.writeLong(getTime(timestampTill)); // Tempban date is handled as a 64-bit long, number of 100NS intervals since 1/1/1601. Lulz.

        return mplew.getPacket();
    }

New Login packet:
Code:
public static byte[] LoginStatus(MapleClient c, byte reason, boolean muted) {
        final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendOpcode.LOGIN_STATUS.getValue());
        mplew.write(reason);
        if (reason > 0) {
            return mplew.getPacket();
        }
        mplew.writeInt(c.getAccID());
        mplew.write(c.getGender());
        mplew.write(c.gmLevel());
        mplew.writeMapleAsciiString(c.getAccountName());
        mplew.writeBool(muted);
        mplew.writeShort(2);
        return mplew.getPacket();
    }

My handler for new login:
Code:
class login_result_h : protected vhandler
    {
        void login_result_h::handle(packet recv)
        {
            char reason = recv.readbyte();
            if (reason > 0)
            {
                switch (reason)
                {
                case 2:
                    game.sendmessage(program::BANNED, reason);
                    return;
                default:
                    game.sendmessage(program::LOGINFAILED, reason);
                    return;
                }
            }
            int accid = recv.readint();
            bool female = recv.readbool();
            char gmlevel = recv.readbyte();
            std::string accname = recv.readascii();
            bool muted = recv.readbool();
            char pin = recv.readshort();
            game.getaccount()->init(accid, accname, gmlevel, female, muted, pin);
            game.sendmessage(program::FINISHLOGIN);
        }
    };
 
Last edited:
Back
Top