示例#1
0
        //Shorthand for SubPacket with account type
        public SubPacket(bool register, ushort lengthOfUsername, ushort lengthOfPassword, uint sourceId, uint targetId, byte[] data, SubPacketTypes spt)
        {
            header        = new SubPacketHeader();
            accountHeader = new AccountHeader();
            if (register)
            {
                accountHeader.setForRegister = 1;
            }
            else
            {
                accountHeader.setForRegister = 0;
            }
            accountHeader.lengthOfUserName = lengthOfUsername;
            accountHeader.lengthOfPassword = lengthOfPassword;
            accountHeader.timeStamp        = Utils.UnixTimeStampUTC();
            accountHeader.misc2            = 0;
            accountHeader.misc3            = 0;
            accountHeader.misc4            = 0;
            header.sourceId = sourceId;
            header.targetId = targetId;

            header.type          = (ushort)spt;
            header.subpacketMisc = 0x00;

            this.data            = data;
            header.subpacketSize = (ushort)(SUBPACKET_SIZE + ACCOUNTMESSAGE_SIZE + data.Length);
        }
示例#2
0
        //Shorthand for SubPacket with gamepacket type
        public SubPacket(GamePacketOpCode opCode, uint sourceId, uint targetId, byte[] data, SubPacketTypes spt)
        {
            header      = new SubPacketHeader();
            gameMessage = new GameMessageHeader();

            gameMessage.opcode = (ushort)opCode;
            header.sourceId    = sourceId;
            header.targetId    = targetId;

            gameMessage.timestamp = Utils.UnixTimeStampUTC();

            header.type                 = (ushort)spt;
            header.subpacketMisc        = 0x00;
            gameMessage.gamepacketMisc  = 0x0;
            gameMessage.gamepacketMisc2 = 0;
            gameMessage.gamepacketMisc3 = 0;

            this.data = data;

            header.subpacketSize = (ushort)(SUBPACKET_SIZE + GAMEMESSAGE_SIZE + data.Length);
        }