Initial MSVC 2008 projects workspace

This commit is contained in:
alexey.min
2012-02-01 05:25:08 +00:00
commit 03de3bdc95
1446 changed files with 476853 additions and 0 deletions

View File

@@ -0,0 +1,181 @@
#include "stdafx.h"
#include "AionGamePacket.h"
unsigned char *AionGamePacket::STATIC_XOR_KEY = NULL;
void AionGamePacket::_checkInitStaticXorKey()
{
if( !AionGamePacket::STATIC_XOR_KEY )
AionGamePacket::STATIC_XOR_KEY = (unsigned char *)"nKO/WctQ0AVLbpzfBkS6NevDYT8ourG5CRlmdjyJ72aswx4EPq1UgZhFMXH?3iI9";
}
AionGamePacket::AionGamePacket()
{
this->_initNull();
this->_checkInitStaticXorKey();
}
AionGamePacket::AionGamePacket( const unsigned char *bytes, unsigned int length )
{
this->_initNull();
this->_checkInitStaticXorKey();
this->setBytes( bytes, length );
}
bool AionGamePacket::decodeXOR( unsigned char *key )
{
if( !key ) return false;
bool r = AionGamePacket::decodeXOR_buffer( b.getBytesPtr(), getPacketSize(), key );
return r;
}
bool AionGamePacket::encodeXOR( unsigned char *key )
{
if( !key ) return false;
bool r = AionGamePacket::encodeXOR_buffer( b.getBytesPtr(), getPacketSize(), key );
return r;
}
bool AionGamePacket::decodeXOR_buffer( unsigned char *decodeBytes, unsigned int bytesLen, unsigned char *key )
{
if( !key ) return false;
const int data_offset = 2; // do not touch 1st 2 bytes - with packet length; pass them
unsigned int i = 0;
unsigned char cur = 0; // current byte
unsigned char prev = decodeBytes[data_offset]; // prev. encrypted byte
decodeBytes[data_offset] ^= key[0]; // decrypt 1st byte
// decrypt loop
for( i=(data_offset + 1); i<bytesLen; i++ )
{
cur = decodeBytes[i];
decodeBytes[i] ^= AionGamePacket::STATIC_XOR_KEY[(i-data_offset) & 63] ^ key[(i-data_offset) & 7] ^ prev;
prev = cur;
}
// old key value as 64-bit unsigned int
unsigned long long oldKey = (unsigned long long)key[0] | ((unsigned long long)key[1] << 8) |
((unsigned long long)key[2] << 16) | ((unsigned long long)key[3] << 24) |
((unsigned long long)key[4] << 32) | ((unsigned long long)key[5] << 40) |
((unsigned long long)key[6] << 48) | ((unsigned long long)key[7] << 56);
// packet size is added to old key value
oldKey += (bytesLen - 2); // data size = whole packet length - 2
// update key
key[0] = (unsigned char)(oldKey & 0xFF);
key[1] = (unsigned char)((oldKey >> 8) & 0xFF);
key[2] = (unsigned char)((oldKey >> 16) & 0xFF);
key[3] = (unsigned char)((oldKey >> 24) & 0xFF);
key[4] = (unsigned char)((oldKey >> 32) & 0xFF);
key[5] = (unsigned char)((oldKey >> 40) & 0xFF);
key[6] = (unsigned char)((oldKey >> 48) & 0xFF);
key[7] = (unsigned char)((oldKey >> 56) & 0xFF);
return true;
}
bool AionGamePacket::encodeXOR_buffer( unsigned char *encodeBytes, unsigned int bytesLen, unsigned char *key )
{
if( !key ) return false;
unsigned int i = 0;
unsigned char prev = 0; // prev. encoded byte
const int data_offset = 2; // do not touch 1st 2 bytes - with packet length; pass them
// encrypt 1st byte
encodeBytes[data_offset] ^= key[0];
prev = encodeBytes[data_offset];
// encrypt loop
for( i=(data_offset+1); i<bytesLen; i++ )
{
encodeBytes[i] ^= AionGamePacket::STATIC_XOR_KEY[(i-data_offset) & 63] ^ key[(i-data_offset) & 7] ^ prev;
prev = encodeBytes[i];
}
// old key value as 64-bit unsigned int
unsigned long long oldKey = (unsigned long long)key[0] | ((unsigned long long)key[1] << 8) |
((unsigned long long)key[2] << 16) | ((unsigned long long)key[3] << 24) |
((unsigned long long)key[4] << 32) | ((unsigned long long)key[5] << 40) |
((unsigned long long)key[6] << 48) | ((unsigned long long)key[7] << 56);
// packet size is added to old key value
oldKey += (bytesLen - 2); // data size = whole packet length - 2
// update key
key[0] = (unsigned char)(oldKey & 0xFF);
key[1] = (unsigned char)((oldKey >> 8) & 0xFF);
key[2] = (unsigned char)((oldKey >> 16) & 0xFF);
key[3] = (unsigned char)((oldKey >> 24) & 0xFF);
key[4] = (unsigned char)((oldKey >> 32) & 0xFF);
key[5] = (unsigned char)((oldKey >> 40) & 0xFF);
key[6] = (unsigned char)((oldKey >> 48) & 0xFF);
key[7] = (unsigned char)((oldKey >> 56) & 0xFF);
return true;
}
unsigned char AionGamePacket::obfuscateServerOpcode( unsigned char opcode )
{
return ((opcode + 0xAE) ^ 0xEE);
}
unsigned char AionGamePacket::deobfuscateServerOpcode( unsigned char opcode )
{
return ((opcode ^ 0xEE) - 0xAE);
}
bool AionGamePacket::writeServerOpcode( unsigned char opcode )
{
writeReset();
unsigned char scrambled_opcode = obfuscateServerOpcode( opcode );
writeUChar( scrambled_opcode );
writeUChar( AionGamePacket::STATIC_SERVER_OPCODE );
writeUChar( ~scrambled_opcode );
return true;
}
// TODO: verify this
bool AionGamePacket::writeClientOpcode( unsigned char opcode )
{
writeReset();
unsigned char scrambled_opcode = obfuscateServerOpcode( opcode ); // REALLYY??????????
writeUChar( scrambled_opcode ); // ARE YOU SURE??
writeUChar( AionGamePacket::STATIC_CLIENT_OPCODE );
writeUChar( ~scrambled_opcode );
return true;
}
bool AionGamePacket::validateClientOpcode() const
{
if( getDataSize() >= 3 )
{
unsigned char o1 = b[2];
unsigned char o2 = b[3];
unsigned char o3 = b[4];
if( (o1 == (unsigned char)(~o3)) && (o2 == AionGamePacket::STATIC_CLIENT_OPCODE) ) return true;
}
return false;
}
bool AionGamePacket::validateServerOpcode() const
{
if( getDataSize() >= 3 )
{
unsigned char o1 = b[2];
unsigned char o2 = b[3];
unsigned char o3 = b[4];
if( (o1 == (unsigned char)(~o3)) && (o2 == AionGamePacket::STATIC_SERVER_OPCODE) ) return true;
}
return false;
}
void AionGamePacket::initStaticXORKey( unsigned char *key )
{
key[4] = 0xA1;
key[5] = 0x6C;
key[6] = 0x54;
key[7] = 0x87;
}
unsigned char AionGamePacket::readOpcode()
{
unsigned char opcode = 0;
readReset();
if( canReadBytes( 3 ) )
{
opcode = readUChar();
readUChar(); // static opcode
readUChar(); // ~opcode
}
return opcode;
}

View File

@@ -0,0 +1,58 @@
#ifndef AIONGAMEPACKET_H_
#define AIONGAMEPACKET_H_
#include "../base/L2BasePacket.h"
class AionGamePacket : public L2BasePacket
{
public:
static const unsigned char STATIC_SERVER_OPCODE = 0x54;
static const unsigned char STATIC_CLIENT_OPCODE = 0x5D;
static unsigned char *STATIC_XOR_KEY;
//(const unsigned char *)"nKO/WctQ0AVLbpzfBkS6NevDYT8ourG5CRlmdjyJ72aswx4EPq1UgZhFMXH?3iI9";
public:
AionGamePacket();
AionGamePacket( const unsigned char *bytes, unsigned int length );
public:
/* Decodes this packet data with Aion XORgame encryption. key is updated at every dec/enc call
* \param key - 8-byte lenght key buffer */
bool decodeXOR( unsigned char *key );
/* Encodes this packet data with Aion XORgame encryption. key is updated at every dec/enc call
* \param key - 8-byte lenght key buffer */
bool encodeXOR( unsigned char *key );
/* Decodes buffer contents with Aion XOR game encryption. key is updated at every dec/enc call
* \param decodeBytes pointer to data to be decrypted
* \param bytesLen data length in bytes
* \param key - 8-byte lenght key buffer */
static bool decodeXOR_buffer( unsigned char *decodeBytes, unsigned int bytesLen, unsigned char *key );
/* Encodes buffer contents with Aion XOR game encryption. key is updated at every dec/enc call
* \param decodeBytes pointer to data to be decrypted
* \param bytesLen data length in bytes
* \param key - 8-byte lenght key buffer */
static bool encodeXOR_buffer( unsigned char *encodeBytes, unsigned int bytesLen, unsigned char *key );
public:
static unsigned char obfuscateServerOpcode( unsigned char opcode );
static unsigned char deobfuscateServerOpcode( unsigned char opcode );
bool writeServerOpcode( unsigned char opcode );
bool writeClientOpcode( unsigned char opcode );
bool validateServerOpcode() const;
bool validateClientOpcode() const;
unsigned char readOpcode();
public:
/** Creates initial XOR key - sets last 4 bytes of key. First 4 bytes are dynamic, last 4 bytes are const.\n
* key must point to 8-byte buffer.
* \param key 8-byte buffer; function updates last 4 of them. */
static void initStaticXORKey( unsigned char *key );
protected:
void _checkInitStaticXorKey();
};
#endif /* AIONGAMEPACKET_H_ */

View File

@@ -0,0 +1,153 @@
#include "stdafx.h"
#include "L2GamePacket.h"
L2GamePacket::L2GamePacket()
{
this->_initNull();
}
L2GamePacket::L2GamePacket( const unsigned char *bytes, unsigned int length )
{
this->_initNull();
this->setBytes( bytes, length );
}
// in Hellbound key must be 16-byte array
// key is changed after enc/dec procedure
bool L2GamePacket::decodeXOR( unsigned char *key )
{
if( !key ) return false;
unsigned int sz = this->getPacketSize();
unsigned int dsz = this->getDataSize();
if( sz < 3 ) return false;
unsigned char temp = 0, temp2 = 0;
unsigned int i = 0;
unsigned char *data = (unsigned char *)this->getBytesPtr();
// xor enc/dec from index 2 (pass 2 bytes - packet size)
data += 2;
for( i = 0; i < dsz; i++ )
{
temp2 = data[i];
data[i] = (temp2 ^ (key[i & 15]) ^ temp);
temp = temp2;
}
unsigned int old = 0;
old |= key[8] & 0x000000ff;
old |= (key[9] << 0x08) & 0x0000ff00;
old |= (key[10] << 0x10) & 0x00ff0000;
old |= (key[11] << 0x18) & 0xff000000;
//old += sz;
old += dsz; // key increases by data size
key[8] = (unsigned char)((old) & 0xff);
key[9] = (unsigned char)((old >> 0x08) & 0xff);
key[10] = (unsigned char)((old >> 0x10) & 0xff);
key[11] = (unsigned char)((old >> 0x18) & 0xff);
return true;
}
// in Hellbound key must be 16-byte array
// key is changed after enc/dec procedure
bool L2GamePacket::encodeXOR( unsigned char *key )
{
if( !key ) return false;
unsigned int sz = this->getPacketSize();
unsigned int dsz = this->getDataSize();
if( sz < 3 ) return false;
unsigned char temp = 0, temp2 = 0;
unsigned int i = 0;
unsigned char *data = (unsigned char *)this->getBytesPtr();
// xor enc/dec from index 2 (pass 2 bytes - packet size)
data += 2;
for( i = 0; i < dsz; i++ )
{
temp2 = data[i];
data[i] = (temp2 ^ (key[i & 15]) ^ temp );
temp = data[i];
}
unsigned int old = 0;
old |= key[8] & 0x000000ff;
old |= (key[9] << 0x08) & 0x0000ff00;
old |= (key[10] << 0x10) & 0x00ff0000;
old |= (key[11] << 0x18) & 0xff000000;
//old += sz;
old += dsz; // key increases by data size
key[8] = (unsigned char)((old) & 0xff);
key[9] = (unsigned char)((old >> 0x08) & 0xff);
key[10] = (unsigned char)((old >> 0x10) & 0xff);
key[11] = (unsigned char)((old >> 0x18) & 0xff);
return true;
}
bool L2GamePacket::decodeXOR_buffer( unsigned char *decodeBytes, unsigned int bytesLen,
unsigned char *key )
{
//if( !key ) return false;
unsigned int dsz = bytesLen - 2;
//if( sz < 3 ) return false;
unsigned char temp = 0, temp2 = 0;
unsigned int i = 0;
unsigned char *data = decodeBytes;
// xor enc/dec from index 2 (pass 2 bytes - packet size)
data += 2;
for( i = 0; i < dsz; i++ )
{
temp2 = data[i];
data[i] = (temp2 ^ (key[i & 15]) ^ temp);
temp = temp2;
}
unsigned int old = 0;
old |= key[8] & 0x000000ff;
old |= (key[9] << 0x08) & 0x0000ff00;
old |= (key[10] << 0x10) & 0x00ff0000;
old |= (key[11] << 0x18) & 0xff000000;
//old += sz;
old += dsz; // key increases by data size
key[8] = (unsigned char)((old) & 0xff);
key[9] = (unsigned char)((old >> 0x08) & 0xff);
key[10] = (unsigned char)((old >> 0x10) & 0xff);
key[11] = (unsigned char)((old >> 0x18) & 0xff);
return true;
}
bool L2GamePacket::encodeXOR_buffer( unsigned char *encodeBytes, unsigned int bytesLen,
unsigned char *key )
{
//if( !key ) return false;
unsigned int dsz = bytesLen - 2;
//if( sz < 3 ) return false;
unsigned char temp = 0, temp2 = 0;
unsigned int i = 0;
unsigned char *data = encodeBytes;
// xor enc/dec from index 2 (pass 2 bytes - packet size)
data += 2;
for( i = 0; i < dsz; i++ )
{
temp2 = data[i];
data[i] = (temp2 ^ (key[i & 15]) ^ temp );
temp = data[i];
}
unsigned int old = 0;
old |= key[8] & 0x000000ff;
old |= (key[9] << 0x08) & 0x0000ff00;
old |= (key[10] << 0x10) & 0x00ff0000;
old |= (key[11] << 0x18) & 0xff000000;
//old += sz;
old += dsz; // key increases by data size
key[8] = (unsigned char)((old) & 0xff);
key[9] = (unsigned char)((old >> 0x08) & 0xff);
key[10] = (unsigned char)((old >> 0x10) & 0xff);
key[11] = (unsigned char)((old >> 0x18) & 0xff);
return true;
}

View File

@@ -0,0 +1,24 @@
#ifndef L2GAMEPACKET_H_
#define L2GAMEPACKET_H_
#include "../base/L2BasePacket.h"
class L2GamePacket : public L2BasePacket
{
public:
L2GamePacket();
L2GamePacket( const unsigned char *bytes, unsigned int length );
//virtual ~L2GamePacket();
public:
// in Hellbound key must be 16-byte array
// key is changed after enc/dec procedure
bool decodeXOR( unsigned char *key );
// in Hellbound key must be 16-byte array
// key is changed after enc/dec procedure
bool encodeXOR( unsigned char *key );
public:
static bool decodeXOR_buffer( unsigned char *decodeBytes, unsigned int bytesLen, unsigned char *key );
static bool encodeXOR_buffer( unsigned char *encodeBytes, unsigned int bytesLen, unsigned char *key );
};
#endif /*L2GAMEPACKET_H_*/

View File

@@ -0,0 +1,63 @@
#include "stdafx.h"
#include "L2Game_Action.h"
/* L2J:
private int _objectId;
@SuppressWarnings("unused")
private int _originX;
@SuppressWarnings("unused")
private int _originY;
@SuppressWarnings("unused")
private int _originZ;
private int _actionId;
@Override
protected void readImpl()
{
_objectId = readD(); // Target object Identifier
_originX = readD();
_originY = readD();
_originZ = readD();
_actionId = readC(); // Action identifier : 0-Simple click, 1-Shift click
}
*/
L2Game_Action::L2Game_Action()
{
this->_initNull();
}
L2Game_Action::L2Game_Action( const unsigned char *bytes, unsigned int length )
{
this->_initNull();
this->setBytes( bytes, length );
}
bool L2Game_Action::create( unsigned int objectID,
unsigned int originX,
unsigned int originY,
unsigned int originZ,
unsigned char bUseShift )
{
this->writeReset();
this->writeUChar( 0x1f ); // packet type - Action
this->writeUInt( objectID );
this->writeUInt( originX );
this->writeUInt( originY );
this->writeUInt( originZ );
this->writeUChar( bUseShift );
return true;
}
unsigned int L2Game_Action::read_objectID()
{
if( !(this->canReadBytes(5)) ) return 0;
this->readReset();
this->readUChar(); // pcode
return this->readUInt();
}
int L2Game_Action::read_originX() { return this->readInt(); }
int L2Game_Action::read_originY() { return this->readInt(); }
int L2Game_Action::read_originZ() { return this->readInt(); }
char L2Game_Action::read_useShift() { return this->readChar(); }

View File

@@ -0,0 +1,24 @@
#ifndef L2GAME_ACTION_H_
#define L2GAME_ACTION_H_
#include "../L2GamePacket.h"
class L2Game_Action : public L2GamePacket
{
public:
L2Game_Action();
L2Game_Action( const unsigned char *bytes, unsigned int length );
public:
bool create( unsigned int objectID,
unsigned int originX,
unsigned int originY,
unsigned int originZ,
unsigned char bUseShift );
unsigned int read_objectID();
int read_originX();
int read_originY();
int read_originZ();
char read_useShift();
};
#endif /*L2GAME_CHARACTERSELECT_H_*/

View File

@@ -0,0 +1,96 @@
#include "stdafx.h"
#include "L2Game_AuthLogin.h"
/* interlude pcode is 08
hellbound pcode is 2b
L2J:
protected void readImpl()
{
_loginName = readS().toLowerCase();
_playKey2 = readD();
_playKey1 = readD();
_loginKey1 = readD();
_loginKey2 = readD();
}
*/
L2Game_AuthLogin::L2Game_AuthLogin()
{
this->_initNull();
}
L2Game_AuthLogin::L2Game_AuthLogin( const unsigned char *bytes, unsigned int length )
{
this->_initNull();
this->setBytes( bytes, length );
}
// session keys must point to 8-byte arrays
bool L2Game_AuthLogin::create( char *loginName,
unsigned char *sessionKey1,
unsigned char *sessionKey2 )
{
if( !loginName || !sessionKey1 || !sessionKey2 ) return false;
wchar_t loginU[32];
memset( loginU, 0, sizeof(loginU) );
#ifdef L2PACKETS_WINDOWS
_snwprintf( loginU, 32, L"%S", loginName );
#endif
#ifdef L2PACKETS_LINUX
swprintf( loginU, 32, L"%ls", loginName );
#endif
loginU[31] = 0;
return this->create( loginU, sessionKey1, sessionKey2 );
}
bool L2Game_AuthLogin::create( wchar_t *loginName,
unsigned char *sessionKey1,
unsigned char *sessionKey2 )
{
if( !loginName || !sessionKey1 || !sessionKey2 ) return false;
this->writeReset();
// write packet code
//this->writeUChar( 0x08 ); // interlude
this->writeUChar( 0x2b ); // hellbound
this->writeUnicodeString( loginName );
this->writeBytes( sessionKey2+4, 4 );
this->writeBytes( sessionKey2, 4 );
this->writeBytes( sessionKey1, 8 );
this->writeUInt( 1 );
return true;
}
bool L2Game_AuthLogin::read_login( wchar_t *loginOut )
{
if( !loginOut ) return false;
this->readReset();
this->readUChar();
loginOut[0] = 0;
wchar_t *login = this->readUnicodeString();
if( !login ) return false;
wcscpy( loginOut, login );
free( login );
return true;
}
bool L2Game_AuthLogin::read_login( char *loginOut )
{
if( !loginOut ) return false;
loginOut[0] = 0;
wchar_t loginU[32] = {0};
if( this->read_login(loginU) )
{
if( loginU[0] == 0 ) return true;
#ifdef L2PACKETS_WINDOWS
sprintf( loginOut, "%S", loginU );
#else
#ifdef L2PACKETS_LINUX
sprintf( loginOut, "%ls", loginU );
#else
#error Unknown OS? O_o
#endif
#endif
return true;
}
return false;
}

View File

@@ -0,0 +1,27 @@
#ifndef L2GAME_AUTHLOGIN_H_
#define L2GAME_AUTHLOGIN_H_
#include "../L2GamePacket.h"
class L2Game_AuthLogin : public L2GamePacket
{
public:
L2Game_AuthLogin();
L2Game_AuthLogin( const unsigned char *bytes, unsigned int length );
public:
// session keys must point to 8-byte arrays
bool create( char *loginName,
unsigned char *sessionKey1,
unsigned char *sessionKey2 );
// unicode version of upper function
// session keys must point to 8-byte arrays
bool create( wchar_t *loginName,
unsigned char *sessionKey1,
unsigned char *sessionKey2 );
public:
bool read_login( char *loginOut );
bool read_login( wchar_t *loginOut );
//bool read_session_keys( unsigned char *skey1, unsigned char *skey2 );
};
#endif /*L2GAME_AUTHLOGIN_H_*/

View File

@@ -0,0 +1,53 @@
#include "stdafx.h"
#include "L2Game_CharacterCreate.h"
/*
Client: Len 63 [CharacterCreate]
3F 00
0C // opcode
41 00 65 00 72 00 69 00 6E 00 00 00 // name
01 00 00 00 // race
01 00 00 00 // sex
19 00 00 00 // class id
1C 00 00 00 // INT
27 00 00 00 // STR
1E 00 00 00 // CON
1B 00 00 00 // MEN
23 00 00 00 // DEX
0B 00 00 00 // WIT
00 00 00 00 // hair style
00 00 00 00 // hair color
00 00 00 00 // face
*/
L2Game_CharacterCreate::L2Game_CharacterCreate()
{
_initNull();
}
L2Game_CharacterCreate::L2Game_CharacterCreate( const unsigned char *bytes, unsigned int length )
{
_initNull();
setBytes( bytes, length );
}
bool L2Game_CharacterCreate::create( const L2Game_NewCharacterTemplate *tmpl, const wchar_t *name,
int hairStyle, int hairColor, int face, int gender )
{
if( !tmpl ) return false;
setPacketType( 0x0C ); // CharacterCreate
writeS( name );
writeD( tmpl->race );
writeD( gender );
writeD( tmpl->classID );
writeD( tmpl->base_INT );
writeD( tmpl->base_STR );
writeD( tmpl->base_CON );
writeD( tmpl->base_MEN );
writeD( tmpl->base_DEX );
writeD( tmpl->base_WIT );
writeD( hairStyle );
writeD( hairColor );
writeD( face );
return true;
}

View File

@@ -0,0 +1,17 @@
#ifndef H_L2GAME_CHARACTERCREATE
#define H_L2GAME_CHARACTERCREATE
#include "../L2GamePacket.h"
#include "../server/L2Game_NewCharacterSuccess.h"
class L2Game_CharacterCreate: public L2GamePacket
{
public:
L2Game_CharacterCreate();
L2Game_CharacterCreate( const unsigned char *bytes, unsigned int length );
public:
bool create( const L2Game_NewCharacterTemplate *tmpl, const wchar_t *name,
int hairStyle, int hairColor, int face, int gender );
};
#endif

View File

@@ -0,0 +1,29 @@
#include "stdafx.h"
#include "L2Game_CharacterDelete.h"
L2Game_CharacterDelete::L2Game_CharacterDelete()
{
_initNull();
}
L2Game_CharacterDelete::L2Game_CharacterDelete( const unsigned char *bytes, unsigned int length )
{
_initNull();
setBytes( bytes, length );
}
bool L2Game_CharacterDelete::create( L2_VERSION ver )
{
ver = L2_VERSION_T1;
setPacketType( 0x0D ); // CharacterDelete
writeD( p_charSlot );
return true;
}
bool L2Game_CharacterDelete::parse( L2_VERSION ver )
{
ver = L2_VERSION_T1;
if( getPacketType() != 0x0D ) return false;
p_charSlot = readD();
return true;
}

View File

@@ -0,0 +1,18 @@
#ifndef H_L2GAME_CHARACTERDELETE
#define H_L2GAME_CHARACTERDELETE
#include "../L2GamePacket.h"
class L2Game_CharacterDelete: public L2GamePacket
{
public:
L2Game_CharacterDelete();
L2Game_CharacterDelete( const unsigned char *bytes, unsigned int length );
public:
bool create( L2_VERSION ver = L2_VERSION_T1 );
bool parse( L2_VERSION ver = L2_VERSION_T1 );
public:
int p_charSlot;
};
#endif

View File

@@ -0,0 +1,30 @@
#include "stdafx.h"
#include "L2Game_CharacterRestore.h"
L2Game_CharacterRestore::L2Game_CharacterRestore()
{
_initNull();
}
L2Game_CharacterRestore::L2Game_CharacterRestore( const unsigned char *bytes, unsigned int length )
{
_initNull();
setBytes( bytes, length );
}
bool L2Game_CharacterRestore::create( L2_VERSION ver )
{
ver = L2_VERSION_T1;
setPacketType( 0x7B ); // CharacterDelete
writeD( p_charSlot );
return true;
}
bool L2Game_CharacterRestore::parse( L2_VERSION ver )
{
ver = L2_VERSION_T1;
if( getPacketType() != 0x7B ) return false;
p_charSlot = readD();
return true;
}

View File

@@ -0,0 +1,18 @@
#ifndef H_L2GAME_CHARACTERRESTORE
#define H_L2GAME_CHARACTERRESTORE
#include "../L2GamePacket.h"
class L2Game_CharacterRestore: public L2GamePacket
{
public:
L2Game_CharacterRestore();
L2Game_CharacterRestore( const unsigned char *bytes, unsigned int length );
public:
bool create( L2_VERSION ver = L2_VERSION_T1 );
bool parse( L2_VERSION ver = L2_VERSION_T1 );
public:
int p_charSlot;
};
#endif

View File

@@ -0,0 +1,46 @@
#include "stdafx.h"
#include "L2Game_CharacterSelect.h"
/* L2J:
protected void readImpl()
{
_charSlot = readD();
_unk1 = readH();
_unk2 = readD();
_unk3 = readD();
_unk4 = readD();
}
*/
L2Game_CharacterSelect::L2Game_CharacterSelect()
{
this->_initNull();
}
L2Game_CharacterSelect::L2Game_CharacterSelect( const unsigned char *bytes, unsigned int length )
{
this->_initNull();
this->setBytes( bytes, length );
}
bool L2Game_CharacterSelect::create( unsigned int charSlot )
{
this->writeReset();
this->writeUChar( 0x12 ); // packet type
this->writeUInt( charSlot );
this->writeUShort( 0x0000 );
this->writeUInt( 0x00000000 );
this->writeUInt( 0x00000000 );
this->writeUInt( 0x00000000 );
return true;
}
bool L2Game_CharacterSelect::read_charSlot( unsigned int *charSlot )
{
if( !charSlot || !(this->canReadBytes(5)) ) return false;
(*charSlot) = 0;
this->readReset();
this->readUChar(); // pcode
(*charSlot) = this->readUInt();
return true;
}

View File

@@ -0,0 +1,16 @@
#ifndef L2GAME_CHARACTERSELECT_H_
#define L2GAME_CHARACTERSELECT_H_
#include "../L2GamePacket.h"
class L2Game_CharacterSelect : public L2GamePacket
{
public:
L2Game_CharacterSelect();
L2Game_CharacterSelect( const unsigned char *bytes, unsigned int length );
public:
bool create( unsigned int charSlot );
bool read_charSlot( unsigned int *charSlot );
};
#endif /*L2GAME_CHARACTERSELECT_H_*/

View File

@@ -0,0 +1,54 @@
#include "stdafx.h"
#include "L2Game_EnterWorld.h"
/*
Client: Len 107
6B 00
11
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
C9 BC F2 A7 66 5A 0B 98 36 A5 BD 89 ED 7F E4 D7
6B 49 E2 9F EF 76 EB CE A3 FA F4 BF 0C 64 A3 B4
A4 CE DC C6 08 3E 6E EA 45 CA D3 FE 88 13 87 B8
06 2C 96 F0 9B 1E 8E BC C6 9B 98 C8 63 16 CF D0
29 00 00 00 0A E1 74 17 0A 08 00 08 5C 32 BD E1
5C 32 BE 22 5E 19 03 41
last 2 D's are different, depend on char
unsigned char array = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xC9, 0xBC, 0xF2, 0xA7, 0x66, 0x5A, 0x0B, 0x98, 0x36, 0xA5, 0xBD, 0x89, 0xED, 0x7F, 0xE4, 0xD7,
0x6B, 0x49, 0xE2, 0x9F, 0xEF, 0x76, 0xEB, 0xCE, 0xA3, 0xFA, 0xF4, 0xBF, 0x0C, 0x64, 0xA3, 0xB4,
0xA4, 0xCE, 0xDC, 0xC6, 0x08, 0x3E, 0x6E, 0xEA, 0x45, 0xCA, 0xD3, 0xFE, 0x88, 0x13, 0x87, 0xB8,
0x06, 0x2C, 0x96, 0xF0, 0x9B, 0x1E, 0x8E, 0xBC, 0xC6, 0x9B, 0x98, 0xC8, 0x63, 0x16, 0xCF, 0xD0,
0x29, 0x00, 0x00, 0x00, 0x0A, 0xE1, 0x74, 0x17, 0x0A, 0x08, 0x00, 0x08, 0x5C, 0x32, 0xBD, 0xE1,
0x5C, 0x32, 0xBE, 0x22, 0x5E, 0x19, 0x03, 0x41, };
*/
L2Game_EnterWorld::L2Game_EnterWorld()
{
_initNull();
}
L2Game_EnterWorld::L2Game_EnterWorld( const unsigned char *bytes, unsigned int length )
{
_initNull();
setBytes( bytes, length );
}
bool L2Game_EnterWorld::create( L2_VERSION ver /*= L2_VERSION_T1*/ )
{
UNREFERENCED_PARAMETER(ver);
unsigned char ew_array[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xC9, 0xBC, 0xF2, 0xA7, 0x66, 0x5A, 0x0B, 0x98, 0x36, 0xA5, 0xBD, 0x89, 0xED, 0x7F, 0xE4, 0xD7,
0x6B, 0x49, 0xE2, 0x9F, 0xEF, 0x76, 0xEB, 0xCE, 0xA3, 0xFA, 0xF4, 0xBF, 0x0C, 0x64, 0xA3, 0xB4,
0xA4, 0xCE, 0xDC, 0xC6, 0x08, 0x3E, 0x6E, 0xEA, 0x45, 0xCA, 0xD3, 0xFE, 0x88, 0x13, 0x87, 0xB8,
0x06, 0x2C, 0x96, 0xF0, 0x9B, 0x1E, 0x8E, 0xBC, 0xC6, 0x9B, 0x98, 0xC8, 0x63, 0x16, 0xCF, 0xD0,
0x29, 0x00, 0x00, 0x00, 0x0A, 0xE1, 0x74, 0x17, 0x0A, 0x08, 0x00, 0x08, 0x5C, 0x32, 0xBD, 0xE1,
0x5C, 0x32, 0xBE, 0x22, 0x5E, 0x19, 0x03, 0x41 };
this->writeReset();
this->writeUChar( 0x11 ); // EnterWorld
this->writeBytes( ew_array, sizeof(ew_array) );
return true;
}

View File

@@ -0,0 +1,16 @@
#ifndef L2GAME_ENTERWORLD_H_
#define L2GAME_ENTERWORLD_H_
#include "../L2GamePacket.h"
class L2Game_EnterWorld : public L2GamePacket
{
public:
L2Game_EnterWorld();
L2Game_EnterWorld( const unsigned char *bytes, unsigned int length );
public:
virtual bool create( L2_VERSION ver = L2_VERSION_T1 );
//void read() {} // L2J Server ignores its contents, parsing is unknown :)
};
#endif

View File

@@ -0,0 +1,33 @@
#include "stdafx.h"
#include "L2Game_NewCharacter.h"
/**
Client: Len 3 [NewCharacter]
03 00
13 // opcode
*/
L2Game_NewCharacter::L2Game_NewCharacter()
{
_initNull();
}
L2Game_NewCharacter::L2Game_NewCharacter( const unsigned char *bytes, unsigned int length )
{
_initNull();
setBytes( bytes, length );
}
bool L2Game_NewCharacter::create( L2_VERSION ver )
{
ver = L2_VERSION_T1;
setPacketType( 0x13 );
return true;
}
bool L2Game_NewCharacter::parse( L2_VERSION ver )
{
ver = L2_VERSION_T1;
// just trugger
return true;
}

View File

@@ -0,0 +1,16 @@
#ifndef H_L2GAME_NEWCHARACTER
#define H_L2GAME_NEWCHARACTER
#include "../L2GamePacket.h"
class L2Game_NewCharacter: public L2GamePacket
{
public:
L2Game_NewCharacter();
L2Game_NewCharacter( const unsigned char *bytes, unsigned int length );
public:
bool create( L2_VERSION ver = L2_VERSION_T1 );
bool parse( L2_VERSION ver = L2_VERSION_T1 );
};
#endif

View File

@@ -0,0 +1,274 @@
#include "stdafx.h"
#include "L2Game_ProtocolVersion.h"
/* L2J:
// "[C] 00 ProtocolVersion";
* pcode 0c00 is in interlude
* pcode 0x0e is in hellbound
protected void readImpl()
{
_version = readD();
}
*/
L2Game_ProtocolVersion::L2Game_ProtocolVersion()
{
this->_initNull();
}
L2Game_ProtocolVersion::L2Game_ProtocolVersion( const unsigned char *bytes, unsigned int length )
{
this->_initNull();
this->setBytes( bytes, length );
}
bool L2Game_ProtocolVersion::create( L2_VERSION ver )
{
switch( ver )
{
case L2_VERSION_T1: this->createDefaultKamael(); break;
case L2_VERSION_T15: this->createDefaultHellbound(); break;
case L2_VERSION_T2: this->createDefaultGracia1(); break;
case L2_VERSION_T22: this->createDefaultGracia2(); break;
case L2_VERSION_T23: this->createDefaultGracia3(); break;
case L2_VERSION_T24: this->createDefaultGracia4(); break;
default: return false; break;
}
return true;
}
/** Kamael
C->S
0B 01 // len
0E // p.code ProtocolVersion
3C 03 00 00 // protocol - 828
09 07 54 56 03 09 0B 01 07 02 54 54 56 07 00 02
55 56 00 51 00 53 57 04 07 55 08 54 01 07 01 53
00 56 55 56 01 06 05 04 51 03 08 51 08 51 56 04
54 06 55 08 02 09 51 56 01 53 06 55 04 53 00 56
56 53 01 09 02 09 01 51 54 51 09 55 56 09 03 04
07 05 55 04 06 55 04 06 09 04 51 01 08 08 06 05
52 06 04 01 07 54 03 06 52 55 06 55 55 51 01 02
04 54 03 55 54 01 57 51 55 05 52 05 54 07 51 51
55 07 02 53 53 00 52 05 52 07 01 54 00 03 05 05
08 06 05 05 06 03 00 0D 08 01 07 09 03 51 03 07
53 09 51 06 07 54 0A 50 56 02 52 04 05 55 51 02
53 00 08 54 04 52 56 06 02 09 00 08 03 53 56 01
05 00 55 06 08 56 04 0D 06 07 52 06 07 04 0A 06
01 04 54 04 00 05 02 04 54 00 09 52 53 05 04 01
04 05 05 01 52 51 52 0D 06 51 08 09 54 53 00 0D
01 02 03 54 53 01 05 03 08 56 54 07 02 54 0B 06
8D 71 5F 08
*/
bool L2Game_ProtocolVersion::createDefaultKamael( unsigned int gameProtoVer /*= 828*/ )
{
this->writeReset();
// packet code 0x00 was in Interlude!!!!
// this->writeUChar( 0x00 ); // packet type - ProtocolVersion
// in Hellbound this code is 0x0e
this->writeUChar( 0x0e ); // packet type - ProtocolVersion
this->writeUInt( gameProtoVer );
unsigned char pv_array[] = {
0x09, 0x07, 0x54, 0x56, 0x03, 0x09, 0x0B, 0x01, 0x07, 0x02, 0x54, 0x54, 0x56, 0x07, 0x00, 0x02,
0x55, 0x56, 0x00, 0x51, 0x00, 0x53, 0x57, 0x04, 0x07, 0x55, 0x08, 0x54, 0x01, 0x07, 0x01, 0x53,
0x00, 0x56, 0x55, 0x56, 0x01, 0x06, 0x05, 0x04, 0x51, 0x03, 0x08, 0x51, 0x08, 0x51, 0x56, 0x04,
0x54, 0x06, 0x55, 0x08, 0x02, 0x09, 0x51, 0x56, 0x01, 0x53, 0x06, 0x55, 0x04, 0x53, 0x00, 0x56,
0x56, 0x53, 0x01, 0x09, 0x02, 0x09, 0x01, 0x51, 0x54, 0x51, 0x09, 0x55, 0x56, 0x09, 0x03, 0x04,
0x07, 0x05, 0x55, 0x04, 0x06, 0x55, 0x04, 0x06, 0x09, 0x04, 0x51, 0x01, 0x08, 0x08, 0x06, 0x05,
0x52, 0x06, 0x04, 0x01, 0x07, 0x54, 0x03, 0x06, 0x52, 0x55, 0x06, 0x55, 0x55, 0x51, 0x01, 0x02,
0x04, 0x54, 0x03, 0x55, 0x54, 0x01, 0x57, 0x51, 0x55, 0x05, 0x52, 0x05, 0x54, 0x07, 0x51, 0x51,
0x55, 0x07, 0x02, 0x53, 0x53, 0x00, 0x52, 0x05, 0x52, 0x07, 0x01, 0x54, 0x00, 0x03, 0x05, 0x05,
0x08, 0x06, 0x05, 0x05, 0x06, 0x03, 0x00, 0x0D, 0x08, 0x01, 0x07, 0x09, 0x03, 0x51, 0x03, 0x07,
0x53, 0x09, 0x51, 0x06, 0x07, 0x54, 0x0A, 0x50, 0x56, 0x02, 0x52, 0x04, 0x05, 0x55, 0x51, 0x02,
0x53, 0x00, 0x08, 0x54, 0x04, 0x52, 0x56, 0x06, 0x02, 0x09, 0x00, 0x08, 0x03, 0x53, 0x56, 0x01,
0x05, 0x00, 0x55, 0x06, 0x08, 0x56, 0x04, 0x0D, 0x06, 0x07, 0x52, 0x06, 0x07, 0x04, 0x0A, 0x06,
0x01, 0x04, 0x54, 0x04, 0x00, 0x05, 0x02, 0x04, 0x54, 0x00, 0x09, 0x52, 0x53, 0x05, 0x04, 0x01,
0x04, 0x05, 0x05, 0x01, 0x52, 0x51, 0x52, 0x0D, 0x06, 0x51, 0x08, 0x09, 0x54, 0x53, 0x00, 0x0D,
0x01, 0x02, 0x03, 0x54, 0x53, 0x01, 0x05, 0x03, 0x08, 0x56, 0x54, 0x07, 0x02, 0x54, 0x0B, 0x06,
0x8D, 0x71, 0x5F, 0x08 };
writeBytes( pv_array, sizeof(pv_array) );
return true;
}
/* Hellbound
C->S Len 267
0B 01 // len
0E // p. code
3F 03 00 00 // protocol - 831 (Hellbound?)
09 07 54 56 03 09 0B 01 07 02 54 54 56 07 00 02
55 56 00 51 00 53 57 04 07 55 08 54 01 07 01 53
00 56 55 56 01 06 05 04 51 03 08 51 08 51 56 04
54 06 55 08 02 09 51 56 01 53 06 55 04 53 00 56
56 53 01 09 02 09 01 51 54 51 09 55 56 09 03 04
07 05 55 04 06 55 04 06 09 04 51 01 08 08 06 05
52 06 04 01 07 54 03 06 52 55 06 55 55 51 01 02
04 54 03 55 54 01 57 51 55 05 52 05 54 07 51 51
55 07 02 53 53 00 52 05 52 07 01 54 00 03 05 05
08 06 05 05 06 03 00 0D 08 01 07 09 03 51 03 07
53 09 51 06 07 54 0A 50 56 02 52 04 05 55 51 02
53 00 08 54 04 52 56 06 02 09 00 08 03 53 56 01
05 00 55 06 08 56 04 0D 06 07 52 06 07 04 0A 06
01 04 54 04 00 05 02 04 54 00 09 52 53 05 04 01
04 05 05 01 52 51 52 0D 06 51 08 09 54 53 00 0D
01 02 03 54 53 01 05 03 08 56 54 07 02 54 0B 06
FB 87 B9 4A
*/
bool L2Game_ProtocolVersion::createDefaultHellbound( unsigned int gameProtoVer /*= 851*/ )
{
this->writeReset();
// packet code 0x00 was in Interlude!!!!
// this->writeUChar( 0x00 ); // packet type - ProtocolVersion
// in Hellbound this code is 0x0e
this->writeUChar( 0x0e ); // packet type - ProtocolVersion
this->writeUInt( gameProtoVer );
unsigned char pv_array[] = {
0x09, 0x07, 0x54, 0x56, 0x03, 0x09, 0x0B, 0x01, 0x07, 0x02, 0x54, 0x54, 0x56, 0x07, 0x00, 0x02,
0x55, 0x56, 0x00, 0x51, 0x00, 0x53, 0x57, 0x04, 0x07, 0x55, 0x08, 0x54, 0x01, 0x07, 0x01, 0x53,
0x00, 0x56, 0x55, 0x56, 0x01, 0x06, 0x05, 0x04, 0x51, 0x03, 0x08, 0x51, 0x08, 0x51, 0x56, 0x04,
0x54, 0x06, 0x55, 0x08, 0x02, 0x09, 0x51, 0x56, 0x01, 0x53, 0x06, 0x55, 0x04, 0x53, 0x00, 0x56,
0x56, 0x53, 0x01, 0x09, 0x02, 0x09, 0x01, 0x51, 0x54, 0x51, 0x09, 0x55, 0x56, 0x09, 0x03, 0x04,
0x07, 0x05, 0x55, 0x04, 0x06, 0x55, 0x04, 0x06, 0x09, 0x04, 0x51, 0x01, 0x08, 0x08, 0x06, 0x05,
0x52, 0x06, 0x04, 0x01, 0x07, 0x54, 0x03, 0x06, 0x52, 0x55, 0x06, 0x55, 0x55, 0x51, 0x01, 0x02,
0x04, 0x54, 0x03, 0x55, 0x54, 0x01, 0x57, 0x51, 0x55, 0x05, 0x52, 0x05, 0x54, 0x07, 0x51, 0x51,
0x55, 0x07, 0x02, 0x53, 0x53, 0x00, 0x52, 0x05, 0x52, 0x07, 0x01, 0x54, 0x00, 0x03, 0x05, 0x05,
0x08, 0x06, 0x05, 0x05, 0x06, 0x03, 0x00, 0x0D, 0x08, 0x01, 0x07, 0x09, 0x03, 0x51, 0x03, 0x07,
0x53, 0x09, 0x51, 0x06, 0x07, 0x54, 0x0A, 0x50, 0x56, 0x02, 0x52, 0x04, 0x05, 0x55, 0x51, 0x02,
0x53, 0x00, 0x08, 0x54, 0x04, 0x52, 0x56, 0x06, 0x02, 0x09, 0x00, 0x08, 0x03, 0x53, 0x56, 0x01,
0x05, 0x00, 0x55, 0x06, 0x08, 0x56, 0x04, 0x0D, 0x06, 0x07, 0x52, 0x06, 0x07, 0x04, 0x0A, 0x06,
0x01, 0x04, 0x54, 0x04, 0x00, 0x05, 0x02, 0x04, 0x54, 0x00, 0x09, 0x52, 0x53, 0x05, 0x04, 0x01,
0x04, 0x05, 0x05, 0x01, 0x52, 0x51, 0x52, 0x0D, 0x06, 0x51, 0x08, 0x09, 0x54, 0x53, 0x00, 0x0D,
0x01, 0x02, 0x03, 0x54, 0x53, 0x01, 0x05, 0x03, 0x08, 0x56, 0x54, 0x07, 0x02, 0x54, 0x0B, 0x06,
0xFB, 0x87, 0xB9, 0x4A };
writeBytes( pv_array, sizeof(pv_array) );
return true;
}
bool L2Game_ProtocolVersion::createDefaultGracia1( unsigned int gameProtoVer /*= 12*/ )
{
this->writeReset();
// packet code 0x00 was in Interlude!!!!
// this->writeUChar( 0x00 ); // packet type - ProtocolVersion
// in Hellbound this code is 0x0e
this->writeUChar( 0x0e ); // packet type - ProtocolVersion
this->writeUInt( gameProtoVer );
unsigned char pv_array[] = {
0x09, 0x07, 0x54, 0x56, 0x03, 0x09, 0x0b, 0x01, 0x07, 0x02, 0x54, 0x54, 0x56, 0x07, 0x00, 0x02,
0x55, 0x56, 0x00, 0x51, 0x00, 0x53, 0x57, 0x04, 0x07, 0x55, 0x08, 0x54, 0x01, 0x07, 0x01, 0x53,
0x00, 0x56, 0x55, 0x56, 0x01, 0x06, 0x05, 0x04, 0x51, 0x03, 0x08, 0x51, 0x08, 0x51, 0x56, 0x04,
0x54, 0x06, 0x55, 0x08, 0x02, 0x09, 0x51, 0x56, 0x01, 0x53, 0x06, 0x55, 0x04, 0x53, 0x00, 0x56,
0x56, 0x53, 0x01, 0x09, 0x02, 0x09, 0x01, 0x51, 0x54, 0x51, 0x09, 0x55, 0x56, 0x09, 0x03, 0x04,
0x07, 0x05, 0x55, 0x04, 0x06, 0x55, 0x04, 0x06, 0x09, 0x04, 0x51, 0x01, 0x08, 0x08, 0x06, 0x05,
0x52, 0x06, 0x04, 0x01, 0x07, 0x54, 0x03, 0x06, 0x52, 0x55, 0x06, 0x55, 0x55, 0x51, 0x01, 0x02,
0x04, 0x54, 0x03, 0x55, 0x54, 0x01, 0x57, 0x51, 0x55, 0x05, 0x52, 0x05, 0x54, 0x07, 0x51, 0x51,
0x55, 0x07, 0x02, 0x53, 0x53, 0x00, 0x52, 0x05, 0x52, 0x07, 0x01, 0x54, 0x00, 0x03, 0x05, 0x05,
0x08, 0x06, 0x05, 0x05, 0x06, 0x03, 0x00, 0x0d, 0x08, 0x01, 0x07, 0x09, 0x03, 0x51, 0x03, 0x07,
0x53, 0x09, 0x51, 0x06, 0x07, 0x54, 0x0a, 0x50, 0x56, 0x02, 0x52, 0x04, 0x05, 0x55, 0x51, 0x02,
0x53, 0x00, 0x08, 0x54, 0x04, 0x52, 0x56, 0x06, 0x02, 0x09, 0x00, 0x08, 0x03, 0x53, 0x56, 0x01,
0x05, 0x00, 0x55, 0x06, 0x08, 0x56, 0x04, 0x0d, 0x06, 0x07, 0x52, 0x06, 0x07, 0x04, 0x0a, 0x06,
0x01, 0x04, 0x54, 0x04, 0x00, 0x05, 0x02, 0x04, 0x54, 0x00, 0x09, 0x52, 0x53, 0x05, 0x04, 0x01,
0x04, 0x05, 0x05, 0x01, 0x52, 0x51, 0x52, 0x0d, 0x06, 0x51, 0x08, 0x09, 0x54, 0x53, 0x00, 0x0d,
0x01, 0x02, 0x03, 0x54, 0x53, 0x01, 0x05, 0x03, 0x08, 0x56, 0x54, 0x07, 0x02, 0x54, 0x0b, 0x06,
0xdf, 0xb8, 0x3b, 0x54 };
writeBytes( pv_array, sizeof(pv_array) );
return true;
}
// TODO: validate
bool L2Game_ProtocolVersion::createDefaultGracia2( unsigned int gameProtoVer /*= 17*/ )
{
this->writeReset();
// packet code 0x00 was in Interlude!!!!
// this->writeUChar( 0x00 ); // packet type - ProtocolVersion
// in Hellbound this code is 0x0e
this->writeUChar( 0x0e ); // packet type - ProtocolVersion
this->writeUInt( gameProtoVer );
unsigned char pv_array[] = {
0x09, 0x07, 0x54, 0x56, 0x03, 0x09, 0x0B, 0x01, 0x07, 0x02, 0x54, 0x54, 0x56, 0x07, 0x00, 0x02,
0x55, 0x56, 0x00, 0x51, 0x00, 0x53, 0x57, 0x04, 0x07, 0x55, 0x08, 0x54, 0x01, 0x07, 0x01, 0x53,
0x00, 0x56, 0x55, 0x56, 0x01, 0x06, 0x05, 0x04, 0x51, 0x03, 0x08, 0x51, 0x08, 0x51, 0x56, 0x04,
0x54, 0x06, 0x55, 0x08, 0x02, 0x09, 0x51, 0x56, 0x01, 0x53, 0x06, 0x55, 0x04, 0x53, 0x00, 0x56,
0x56, 0x53, 0x01, 0x09, 0x02, 0x09, 0x01, 0x51, 0x54, 0x51, 0x09, 0x55, 0x56, 0x09, 0x03, 0x04,
0x07, 0x05, 0x55, 0x04, 0x06, 0x55, 0x04, 0x06, 0x09, 0x04, 0x51, 0x01, 0x08, 0x08, 0x06, 0x05,
0x52, 0x06, 0x04, 0x01, 0x07, 0x54, 0x03, 0x06, 0x52, 0x55, 0x06, 0x55, 0x55, 0x51, 0x01, 0x02,
0x04, 0x54, 0x03, 0x55, 0x54, 0x01, 0x57, 0x51, 0x55, 0x05, 0x52, 0x05, 0x54, 0x07, 0x51, 0x51,
0x55, 0x07, 0x02, 0x53, 0x53, 0x00, 0x52, 0x05, 0x52, 0x07, 0x01, 0x54, 0x00, 0x03, 0x05, 0x05,
0x08, 0x06, 0x05, 0x05, 0x06, 0x03, 0x00, 0x0D, 0x08, 0x01, 0x07, 0x09, 0x03, 0x51, 0x03, 0x07,
0x53, 0x09, 0x51, 0x06, 0x07, 0x54, 0x0A, 0x50, 0x56, 0x02, 0x52, 0x04, 0x05, 0x55, 0x51, 0x02,
0x53, 0x00, 0x08, 0x54, 0x04, 0x52, 0x56, 0x06, 0x02, 0x09, 0x00, 0x08, 0x03, 0x53, 0x56, 0x01,
0x05, 0x00, 0x55, 0x06, 0x08, 0x56, 0x04, 0x0D, 0x06, 0x07, 0x52, 0x06, 0x07, 0x04, 0x0A, 0x06,
0x01, 0x04, 0x54, 0x04, 0x00, 0x05, 0x02, 0x04, 0x54, 0x00, 0x09, 0x52, 0x53, 0x05, 0x04, 0x01,
0x04, 0x05, 0x05, 0x01, 0x52, 0x51, 0x52, 0x0D, 0x06, 0x51, 0x08, 0x09, 0x54, 0x53, 0x00, 0x0D,
0x01, 0x02, 0x03, 0x54, 0x53, 0x01, 0x05, 0x03, 0x08, 0x56, 0x54, 0x07, 0x02, 0x54, 0x0B, 0x06,
0xEB, 0xEF, 0x3D, 0xE6 };
writeBytes( pv_array, sizeof(pv_array) );
return true;
}
bool L2Game_ProtocolVersion::createDefaultGracia3( unsigned int gameProtoVer /*= 83*/ )
{
this->writeReset();
// packet code 0x00 was in Interlude!!!!
// this->writeUChar( 0x00 ); // packet type - ProtocolVersion
// in Hellbound this code is 0x0e
this->writeUChar( 0x0e ); // packet type - ProtocolVersion
this->writeUInt( gameProtoVer );
unsigned char pv_array[] = {
0x09, 0x07, 0x54, 0x56, 0x03, 0x09, 0x0B, 0x01, 0x07, 0x02, 0x54, 0x54, 0x56, 0x07, 0x00, 0x02,
0x55, 0x56, 0x00, 0x51, 0x00, 0x53, 0x57, 0x04, 0x07, 0x55, 0x08, 0x54, 0x01, 0x07, 0x01, 0x53,
0x00, 0x56, 0x55, 0x56, 0x01, 0x06, 0x05, 0x04, 0x51, 0x03, 0x08, 0x51, 0x08, 0x51, 0x56, 0x04,
0x54, 0x06, 0x55, 0x08, 0x02, 0x09, 0x51, 0x56, 0x01, 0x53, 0x06, 0x55, 0x04, 0x53, 0x00, 0x56,
0x56, 0x53, 0x01, 0x09, 0x02, 0x09, 0x01, 0x51, 0x54, 0x51, 0x09, 0x55, 0x56, 0x09, 0x03, 0x04,
0x07, 0x05, 0x55, 0x04, 0x06, 0x55, 0x04, 0x06, 0x09, 0x04, 0x51, 0x01, 0x08, 0x08, 0x06, 0x05,
0x52, 0x06, 0x04, 0x01, 0x07, 0x54, 0x03, 0x06, 0x52, 0x55, 0x06, 0x55, 0x55, 0x51, 0x01, 0x02,
0x04, 0x54, 0x03, 0x55, 0x54, 0x01, 0x57, 0x51, 0x55, 0x05, 0x52, 0x05, 0x54, 0x07, 0x51, 0x51,
0x55, 0x07, 0x02, 0x53, 0x53, 0x00, 0x52, 0x05, 0x52, 0x07, 0x01, 0x54, 0x00, 0x03, 0x05, 0x05,
0x08, 0x06, 0x05, 0x05, 0x06, 0x03, 0x00, 0x0D, 0x08, 0x01, 0x07, 0x09, 0x03, 0x51, 0x03, 0x07,
0x53, 0x09, 0x51, 0x06, 0x07, 0x54, 0x0A, 0x50, 0x56, 0x02, 0x52, 0x04, 0x05, 0x55, 0x51, 0x02,
0x53, 0x00, 0x08, 0x54, 0x04, 0x52, 0x56, 0x06, 0x02, 0x09, 0x00, 0x08, 0x03, 0x53, 0x56, 0x01,
0x05, 0x00, 0x55, 0x06, 0x08, 0x56, 0x04, 0x0D, 0x06, 0x07, 0x52, 0x06, 0x07, 0x04, 0x0A, 0x06,
0x01, 0x04, 0x54, 0x04, 0x00, 0x05, 0x02, 0x04, 0x54, 0x00, 0x09, 0x52, 0x53, 0x05, 0x04, 0x01,
0x04, 0x05, 0x05, 0x01, 0x52, 0x51, 0x52, 0x0D, 0x06, 0x51, 0x08, 0x09, 0x54, 0x53, 0x00, 0x0D,
0x01, 0x02, 0x03, 0x54, 0x53, 0x01, 0x05, 0x03, 0x08, 0x56, 0x54, 0x07, 0x02, 0x54, 0x0B, 0x06,
0x11, 0x5D, 0x1F, 0x60 }; // these last 4 bytes always differ :)
writeBytes( pv_array, sizeof(pv_array) );
return true;
}
bool L2Game_ProtocolVersion::createDefaultGracia4( unsigned int gameProtoVer /*= 146*/ )
{
this->writeReset();
this->writeUChar( 0x0e ); // packet type - ProtocolVersion
this->writeUInt( gameProtoVer );
unsigned char pv_array[] = {
0x09, 0x07, 0x54, 0x56, 0x03, 0x09, 0x0B, 0x01, 0x07, 0x02, 0x54, 0x54, 0x56, 0x07, 0x00, 0x02,
0x55, 0x56, 0x00, 0x51, 0x00, 0x53, 0x57, 0x04, 0x07, 0x55, 0x08, 0x54, 0x01, 0x07, 0x01, 0x53,
0x00, 0x56, 0x55, 0x56, 0x01, 0x06, 0x05, 0x04, 0x51, 0x03, 0x08, 0x51, 0x08, 0x51, 0x56, 0x04,
0x54, 0x06, 0x55, 0x08, 0x02, 0x09, 0x51, 0x56, 0x01, 0x53, 0x06, 0x55, 0x04, 0x53, 0x00, 0x56,
0x56, 0x53, 0x01, 0x09, 0x02, 0x09, 0x01, 0x51, 0x54, 0x51, 0x09, 0x55, 0x56, 0x09, 0x03, 0x04,
0x07, 0x05, 0x55, 0x04, 0x06, 0x55, 0x04, 0x06, 0x09, 0x04, 0x51, 0x01, 0x08, 0x08, 0x06, 0x05,
0x52, 0x06, 0x04, 0x01, 0x07, 0x54, 0x03, 0x06, 0x52, 0x55, 0x06, 0x55, 0x55, 0x51, 0x01, 0x02,
0x04, 0x54, 0x03, 0x55, 0x54, 0x01, 0x57, 0x51, 0x55, 0x05, 0x52, 0x05, 0x54, 0x07, 0x51, 0x51,
0x55, 0x07, 0x02, 0x53, 0x53, 0x00, 0x52, 0x05, 0x52, 0x07, 0x01, 0x54, 0x00, 0x03, 0x05, 0x05,
0x08, 0x06, 0x05, 0x05, 0x06, 0x03, 0x00, 0x0D, 0x08, 0x01, 0x07, 0x09, 0x03, 0x51, 0x03, 0x07,
0x53, 0x09, 0x51, 0x06, 0x07, 0x54, 0x0A, 0x50, 0x56, 0x02, 0x52, 0x04, 0x05, 0x55, 0x51, 0x02,
0x53, 0x00, 0x08, 0x54, 0x04, 0x52, 0x56, 0x06, 0x02, 0x09, 0x00, 0x08, 0x03, 0x53, 0x56, 0x01,
0x05, 0x00, 0x55, 0x06, 0x08, 0x56, 0x04, 0x0D, 0x06, 0x07, 0x52, 0x06, 0x07, 0x04, 0x0A, 0x06,
0x01, 0x04, 0x54, 0x04, 0x00, 0x05, 0x02, 0x04, 0x54, 0x00, 0x09, 0x52, 0x53, 0x05, 0x04, 0x01,
0x04, 0x05, 0x05, 0x01, 0x52, 0x51, 0x52, 0x0D, 0x06, 0x51, 0x08, 0x09, 0x54, 0x53, 0x00, 0x0D,
0x01, 0x02, 0x03, 0x54, 0x53, 0x01, 0x05, 0x03, 0x08, 0x56, 0x54, 0x07, 0x02, 0x54, 0x0B, 0x06,
0xA6, 0x23, 0xF4, 0xFE }; // these last 4 bytes always differ :)
writeBytes( pv_array, sizeof(pv_array) );
return true;
}
bool L2Game_ProtocolVersion::read_protoVer( unsigned int *pver )
{
if( !pver || !(this->canReadBytes(5)) ) return false;
(*pver) = 0;
this->readReset();
this->readUChar();
(*pver) = this->readUInt();
return true;
}

View File

@@ -0,0 +1,22 @@
#ifndef L2GAME_PROTOCOLVERSION_H_
#define L2GAME_PROTOCOLVERSION_H_
#include "../L2GamePacket.h"
class L2Game_ProtocolVersion : public L2GamePacket
{
public:
L2Game_ProtocolVersion();
L2Game_ProtocolVersion( const unsigned char *bytes, unsigned int length );
public:
bool create( L2_VERSION ver = L2_VERSION_T1 );
bool createDefaultKamael( unsigned int gameProtoVer = 828 );
bool createDefaultHellbound( unsigned int gameProtoVer = 851 );
bool createDefaultGracia1( unsigned int gameProtoVer = 12 );
bool createDefaultGracia2( unsigned int gameProtoVer = 17 );
bool createDefaultGracia3( unsigned int gameProtoVer = 83 );
bool createDefaultGracia4( unsigned int gameProtoVer = 146 );
bool read_protoVer( unsigned int *pver );
};
#endif /*L2GAME_PROTOCOLVERSION_H_*/

View File

@@ -0,0 +1,30 @@
#include "stdafx.h"
#include "L2Game_RequestGotoLobby.h"
L2Game_RequestGotoLobby::L2Game_RequestGotoLobby()
{
this->_initNull();
}
L2Game_RequestGotoLobby::L2Game_RequestGotoLobby( const unsigned char *bytes, unsigned int length )
{
this->_initNull();
this->setBytes( bytes, length );
}
bool L2Game_RequestGotoLobby::create( L2_VERSION ver )
{
if( ver <= L2_VERSION_T22 ) setPacketType2( 0xD0, 0x0039 );
if( ver >= L2_VERSION_T23 ) setPacketType2( 0xD0, 0x0036 );
return true;
}
bool L2Game_RequestGotoLobby::parse( L2_VERSION ver )
{
if( getPacketType() != 0xD0 ) return false;
if( ver <= L2_VERSION_T22 )
if( readUShort() != 0x0039 ) return false;
if( ver >= L2_VERSION_T23 )
if( readUShort() != 0x0036 ) return false;
return true;
}

View File

@@ -0,0 +1,16 @@
#ifndef L2GAME_REQEUSTGOTOLOBBY_H_
#define L2GAME_REQUESTGOTOLOBBY_H_
#include "../L2GamePacket.h"
class L2Game_RequestGotoLobby : public L2GamePacket
{
public:
L2Game_RequestGotoLobby();
L2Game_RequestGotoLobby( const unsigned char *bytes, unsigned int length );
public:
bool create( L2_VERSION ver = L2_VERSION_T1 );
bool parse( L2_VERSION ver = L2_VERSION_T1 );
};
#endif /*L2GAME_CHARACTERSELECT_H_*/

View File

@@ -0,0 +1,44 @@
#include "stdafx.h"
#include "L2Game_RequestJoinParty.h"
/* L2J:
Client: Len 15
0F 00
42
6C 00 6F 00 6C 00 00 00 // target char name
00 00 00 00 // loot type, item distribution
*/
L2Game_RequestJoinParty::L2Game_RequestJoinParty()
{
this->_initNull();
}
L2Game_RequestJoinParty::L2Game_RequestJoinParty( const unsigned char *bytes, unsigned int length )
{
this->_initNull();
this->setBytes( bytes, length );
}
bool L2Game_RequestJoinParty::create( const wchar_t *invitePlayer, unsigned int lootRule )
{
if( !invitePlayer ) return false;
writeReset();
writeUChar( 0x42 );
writeUnicodeString( invitePlayer );
writeUInt( lootRule );
return true;
}
bool L2Game_RequestJoinParty::read_invitePlayer( wchar_t *out )
{
if( !out ) return false;
readReset();
wcscpy( out, readUnicodeStringPtr() );
return true;
}
unsigned int L2Game_RequestJoinParty::read_lootRule()
{
return readUInt();
}

View File

@@ -0,0 +1,30 @@
#ifndef L2GAME_REQUESTJOINPARY_H_
#define L2GAME_REQUESTJOINPARY_H_
#include "../L2GamePacket.h"
#define L2_PARTY_LOOT_ITEM_LOOTER 0
#define L2_PARTY_LOOT_ITEM_RANDOM 1
#define L2_PARTY_LOOT_ITEM_RANDOM_SPOIL 2
#define L2_PARTY_LOOT_ITEM_ORDER 3
#define L2_PARTY_LOOT_ITEM_ORDER_SPOIL 4
class L2Game_RequestJoinParty: public L2GamePacket
{
public:
static const unsigned int ITEM_LOOTER = 0;
static const unsigned int ITEM_RANDOM = 1;
static const unsigned int ITEM_RANDOM_SPOIL = 2;
static const unsigned int ITEM_ORDER = 3;
static const unsigned int ITEM_ORDER_SPOIL = 4;
public:
L2Game_RequestJoinParty();
L2Game_RequestJoinParty( const unsigned char *bytes, unsigned int length );
public:
bool create( const wchar_t *invitePlayer, unsigned int lootRule );
public:
bool read_invitePlayer( wchar_t *out );
unsigned int read_lootRule();
};
#endif

View File

@@ -0,0 +1,56 @@
#include "stdafx.h"
#include "L2Game_RequestUserCommand.h"
/* L2J:
Client Len 7 [ RequestUserCommand]
07 00
B3
00 00 00 00 // command ID
================================
Decimal command numbers:
0 - /loc
52 - /unstuck (Escape)
61 - /Mount
62 - /DisMount
77 - /time
81 - /partyinfo
88 - /AttackList
89 - /underattacklist
90 - /warlist
93 - /ChannelDelete
96 - /ChannelLeave
97 - /ChannelListUpdate
100 - /ClanPenalty
109 - /OlympiadStat
114 - /InstanceZone
*/
L2Game_RequestUserCommand::L2Game_RequestUserCommand()
{
this->_initNull();
}
L2Game_RequestUserCommand::L2Game_RequestUserCommand( const unsigned char *bytes, unsigned int length )
{
this->_initNull();
this->setBytes( bytes, length );
}
bool L2Game_RequestUserCommand::create( unsigned int commandID )
{
writeReset();
writeUChar( 0xB3 );
writeUInt( commandID );
return true;
}
unsigned int L2Game_RequestUserCommand::read_commandID()
{
readReset();
getPacketType();
return readUInt();
}

View File

@@ -0,0 +1,33 @@
#ifndef L2GAME_REQUESTUSERCOMMAND_H_
#define L2GAME_REQUESTUSERCOMMAND_H_
#include "../L2GamePacket.h"
class L2Game_RequestUserCommand: public L2GamePacket
{
public:
static const unsigned int CMD_LOC = 0;
static const unsigned int CMD_UNSTUCK = 52;
static const unsigned int CMD_MOUNT = 61;
static const unsigned int CMD_DISMOUNT = 62;
static const unsigned int CMD_TIME = 77;
static const unsigned int CMD_PARTYINFO = 81;
static const unsigned int CMD_ATTACKLIST = 88;
static const unsigned int CMD_UNDERATTACKLIST = 89;
static const unsigned int CMD_WARLIST = 90;
static const unsigned int CMD_CHANNELDELETE = 93;
static const unsigned int CMD_CHANNELLEAVE = 96;
static const unsigned int CMD_CHANNELLISTUPDATE = 97;
static const unsigned int CMD_CLANPENALTY = 100;
static const unsigned int CMD_OLYMPIADSTAT = 109;
static const unsigned int CMD_INSTANCEZONE = 114;
public:
L2Game_RequestUserCommand();
L2Game_RequestUserCommand( const unsigned char *bytes, unsigned int length );
public:
bool create( unsigned int commandID );
public:
unsigned int read_commandID();
};
#endif

View File

@@ -0,0 +1,37 @@
#include "stdafx.h"
#include "L2Game_UseItem.h"
/*
0B 00 // len 11
19 // ptype - UseItem
57 EA 03 10 // objectID? 268692055
00 00 00 00 // wtf nulls?
*/
L2Game_UseItem::L2Game_UseItem()
{
this->_initNull();
}
L2Game_UseItem::L2Game_UseItem( const unsigned char *bytes, unsigned int length )
{
this->_initNull();
this->setBytes( bytes, length );
}
bool L2Game_UseItem::create( unsigned int oid )
{
this->writeReset();
this->writeUChar( 0x19 ); // packet type - UseItem
this->writeUInt( oid );
this->writeUInt( 0x00000000 );
return true;
}
unsigned int L2Game_UseItem::read_objectID()
{
if( !(this->canReadBytes(5)) ) return 0;
this->readReset();
this->readUChar(); // pcode
return this->readUInt();
}

View File

@@ -0,0 +1,17 @@
#ifndef L2GAME_USEITEM_H_
#define L2GAME_USEITEM_H_
#include "../L2GamePacket.h"
class L2Game_UseItem: public L2GamePacket
{
public:
L2Game_UseItem();
L2Game_UseItem( const unsigned char *bytes, unsigned int length );
public:
bool create( unsigned int oid );
public:
unsigned int read_objectID();
};
#endif

View File

@@ -0,0 +1,49 @@
#include "stdafx.h"
#include "L2Game_AuthLoginFail.h"
L2Game_AuthLoginFail::L2Game_AuthLoginFail()
{
_initNull();
}
L2Game_AuthLoginFail::L2Game_AuthLoginFail( const unsigned char *bytes, unsigned int length )
{
_initNull();
setBytes( bytes, length );
}
bool L2Game_AuthLoginFail::parse( L2_VERSION ver )
{
UNREFERENCED_PARAMETER(ver);
if( getPacketType() != 0x0A ) return false;
p_reasonCode = readUInt();
return true;
}
bool L2Game_AuthLoginFail::create( L2_VERSION ver )
{
UNREFERENCED_PARAMETER(ver);
setPacketType( 0x0A );
writeUInt( p_reasonCode );
return true;
}
void L2Game_AuthLoginFail::reasonCodeToString( int code, char *outString )
{
switch( code )
{
case REASON_NO_TEXT: strcpy( outString, "REASON_NO_TEXT" ); break;
case REASON_SYSTEM_ERROR_LOGIN_LATER: strcpy( outString, "REASON_SYSTEM_ERROR_LOGIN_LATER" ); break;
case REASON_PASSWORD_DOES_NOT_MATCH_THIS_ACCOUNT: strcpy( outString, "REASON_PASSWORD_DOES_NOT_MATCH_THIS_ACCOUNT" ); break;
case REASON_PASSWORD_DOES_NOT_MATCH_THIS_ACCOUNT2: strcpy( outString, "REASON_PASSWORD_DOES_NOT_MATCH_THIS_ACCOUNT2" ); break;
case REASON_ACCESS_FAILED_TRY_LATER: strcpy( outString, "REASON_ACCESS_FAILED_TRY_LATER" ); break;
case REASON_INCORRECT_ACCOUNT_INFO_CONTACT_CUSTOMER_SUPPORT: strcpy( outString, "REASON_INCORRECT_ACCOUNT_INFO_CONTACT_CUSTOMER_SUPPORT" ); break;
case REASON_ACCESS_FAILED_TRY_LATER2: strcpy( outString, "REASON_ACCESS_FAILED_TRY_LATER2" ); break;
case REASON_ACOUNT_ALREADY_IN_USE: strcpy( outString, "REASON_ACOUNT_ALREADY_IN_USE" ); break;
case REASON_ACCESS_FAILED_TRY_LATER3: strcpy( outString, "REASON_ACCESS_FAILED_TRY_LATER3" ); break;
case REASON_ACCESS_FAILED_TRY_LATER4: strcpy( outString, "REASON_ACCESS_FAILED_TRY_LATER4" ); break;
case REASON_ACCESS_FAILED_TRY_LATER5: strcpy( outString, "REASON_ACCESS_FAILED_TRY_LATER5" ); break;
default: strcpy( outString, "REASON_UNKNOWN" ); break;
}
}

View File

@@ -0,0 +1,32 @@
#ifndef L2GAME_AUTHLOGINFAIL_H_
#define L2GAME_AUTHLOGINFAIL_H_
#include "../L2GamePacket.h"
class L2Game_AuthLoginFail: public L2GamePacket
{
public:
static const int REASON_NO_TEXT = 0;
static const int REASON_SYSTEM_ERROR_LOGIN_LATER = 1;
static const int REASON_PASSWORD_DOES_NOT_MATCH_THIS_ACCOUNT = 2;
static const int REASON_PASSWORD_DOES_NOT_MATCH_THIS_ACCOUNT2 = 3;
static const int REASON_ACCESS_FAILED_TRY_LATER = 4;
static const int REASON_INCORRECT_ACCOUNT_INFO_CONTACT_CUSTOMER_SUPPORT = 5;
static const int REASON_ACCESS_FAILED_TRY_LATER2 = 6;
static const int REASON_ACOUNT_ALREADY_IN_USE = 7;
static const int REASON_ACCESS_FAILED_TRY_LATER3 = 8;
static const int REASON_ACCESS_FAILED_TRY_LATER4 = 9;
static const int REASON_ACCESS_FAILED_TRY_LATER5 = 10;
public:
L2Game_AuthLoginFail();
L2Game_AuthLoginFail( const unsigned char *bytes, unsigned int length );
public:
virtual bool parse( L2_VERSION ver = L2_VERSION_T1 );
virtual bool create( L2_VERSION ver = L2_VERSION_T1 );
public:
static void reasonCodeToString( int code, char *outString );
public:
unsigned int p_reasonCode;
};
#endif

View File

@@ -0,0 +1,42 @@
#include "stdafx.h"
#include "L2Game_CharCreateFail.h"
L2Game_CharCreateFail::L2Game_CharCreateFail()
{
_initNull();
}
L2Game_CharCreateFail::L2Game_CharCreateFail( const unsigned char *bytes, unsigned int length )
{
_initNull();
setBytes( bytes, length );
}
bool L2Game_CharCreateFail::parse( L2_VERSION ver )
{
UNREFERENCED_PARAMETER(ver);
if( getPacketType() != 0x10 ) return false;
p_reasonCode = readUInt();
return true;
}
bool L2Game_CharCreateFail::create( L2_VERSION ver )
{
UNREFERENCED_PARAMETER(ver);
setPacketType( 0x10 );
writeUInt( p_reasonCode );
return true;
}
void L2Game_CharCreateFail::reasonCodeToString( int code, char *outString )
{
switch( code )
{
case REASON_CREATION_FAILED: strcpy( outString, "REASON_CREATION_FAILED" ); break;
case REASON_TOO_MANY_CHARACTERS: strcpy( outString, "REASON_TOO_MANY_CHARACTERS" ); break;
case REASON_NAME_ALREADY_EXISTS: strcpy( outString, "REASON_NAME_ALREADY_EXISTS" ); break;
case REASON_16_ENG_CHARS: strcpy( outString, "REASON_16_ENG_CHARS" ); break;
default: strcpy( outString, "REASON_UNKNOWN" ); break;
}
}

View File

@@ -0,0 +1,28 @@
#ifndef L2GAME_CHARCREATEFAIL_H_
#define L2GAME_CHARCREATEFAIL_H_
#include "../L2GamePacket.h"
class L2Game_CharCreateFail: public L2GamePacket
{
public:
static const int REASON_CREATION_FAILED = 0x00;
static const int REASON_TOO_MANY_CHARACTERS = 0x01;
static const int REASON_NAME_ALREADY_EXISTS = 0x02;
static const int REASON_16_ENG_CHARS = 0x03;
static const int REASON_INCORRECT_NAME = 0x04;
static const int REASON_CREATE_NOT_ALLOWED = 0x05;
static const int REASON_CHOOSE_ANOTHER_SVR = 0x06;
public:
L2Game_CharCreateFail();
L2Game_CharCreateFail( const unsigned char *bytes, unsigned int length );
public:
virtual bool parse( L2_VERSION ver = L2_VERSION_T1 );
virtual bool create( L2_VERSION ver = L2_VERSION_T1 );
public:
static void reasonCodeToString( int code, char *outString );
public:
unsigned int p_reasonCode;
};
#endif

View File

@@ -0,0 +1,30 @@
#include "stdafx.h"
#include "L2Game_CharCreateSuccess.h"
L2Game_CharCreateSuccess::L2Game_CharCreateSuccess()
{
_initNull();
}
L2Game_CharCreateSuccess::L2Game_CharCreateSuccess( const unsigned char *bytes, unsigned int length )
{
_initNull();
setBytes( bytes, length );
}
bool L2Game_CharCreateSuccess::parse( L2_VERSION ver )
{
UNREFERENCED_PARAMETER(ver);
if( getPacketType() != 0x0F ) return false;
if( readUInt() != 0x01 ) return false;
return true;
}
bool L2Game_CharCreateSuccess::create( L2_VERSION ver )
{
UNREFERENCED_PARAMETER(ver);
setPacketType( 0x0F );
writeUInt( 0x01 );
return true;
}

View File

@@ -0,0 +1,16 @@
#ifndef L2GAME_CHARCREATEOK_H_
#define L2GAME_CHARCREATEOK_H_
#include "../L2GamePacket.h"
class L2Game_CharCreateSuccess: public L2GamePacket
{
public:
L2Game_CharCreateSuccess();
L2Game_CharCreateSuccess( const unsigned char *bytes, unsigned int length );
public:
virtual bool parse( L2_VERSION ver = L2_VERSION_T1 );
virtual bool create( L2_VERSION ver = L2_VERSION_T1 );
};
#endif

View File

@@ -0,0 +1,41 @@
#include "stdafx.h"
#include "L2Game_CharDeleteFail.h"
L2Game_CharDeleteFail::L2Game_CharDeleteFail()
{
_initNull();
}
L2Game_CharDeleteFail::L2Game_CharDeleteFail( const unsigned char *bytes, unsigned int length )
{
_initNull();
setBytes( bytes, length );
}
bool L2Game_CharDeleteFail::parse( L2_VERSION ver )
{
UNREFERENCED_PARAMETER(ver);
if( getPacketType() != 0x1E ) return false;
p_reasonCode = readUInt();
return true;
}
bool L2Game_CharDeleteFail::create( L2_VERSION ver )
{
UNREFERENCED_PARAMETER(ver);
setPacketType( 0x1E );
writeUInt( p_reasonCode );
return true;
}
void L2Game_CharDeleteFail::reasonCodeToString( int code, char *outString )
{
switch( code )
{
case REASON_DELETION_FAILED: strcpy( outString, "REASON_DELETION_FAILED" ); break;
case REASON_YOU_MAY_NOT_DELETE_CLAN_MEMBER: strcpy( outString, "REASON_YOU_MAY_NOT_DELETE_CLAN_MEMBER" ); break;
case REASON_CLAN_LEADERS_MAY_NOT_BE_DELETED: strcpy( outString, "REASON_CLAN_LEADERS_MAY_NOT_BE_DELETED" ); break;
default: strcpy( outString, "REASON_UNKNOWN" ); break;
}
}

View File

@@ -0,0 +1,24 @@
#ifndef L2GAME_CHARDELETEFAIL_H_
#define L2GAME_CHARDELETEFAIL_H_
#include "../L2GamePacket.h"
class L2Game_CharDeleteFail: public L2GamePacket
{
public:
static const int REASON_DELETION_FAILED = 0x01;
static const int REASON_YOU_MAY_NOT_DELETE_CLAN_MEMBER = 0x02;
static const int REASON_CLAN_LEADERS_MAY_NOT_BE_DELETED = 0x03;
public:
L2Game_CharDeleteFail();
L2Game_CharDeleteFail( const unsigned char *bytes, unsigned int length );
public:
virtual bool parse( L2_VERSION ver = L2_VERSION_T1 );
virtual bool create( L2_VERSION ver = L2_VERSION_T1 );
public:
static void reasonCodeToString( int code, char *outString );
public:
unsigned int p_reasonCode;
};
#endif

View File

@@ -0,0 +1,16 @@
#include "stdafx.h"
#include "L2Game_CharDeleteSuccess.h"
L2Game_CharDeleteSuccess::L2Game_CharDeleteSuccess()
{
_initNull();
}
L2Game_CharDeleteSuccess::L2Game_CharDeleteSuccess( const unsigned char *bytes, unsigned int length )
{
_initNull();
setBytes( bytes, length );
}

View File

@@ -0,0 +1,14 @@
#ifndef L2GAME_CHARDELETESUCCESS_H_
#define L2GAME_CHARDELETESUCCESS_H_
#include "../L2GamePacket.h"
class L2Game_CharDeleteSuccess: public L2GamePacket
{
public:
L2Game_CharDeleteSuccess();
L2Game_CharDeleteSuccess( const unsigned char *bytes, unsigned int length );
// nothing to parse - just trigger
};
#endif

View File

@@ -0,0 +1,124 @@
#include "stdafx.h"
#include "L2Game_CharSelected.h"
L2Game_CharSelected::L2Game_CharSelected()
{
_initNull();
}
L2Game_CharSelected::L2Game_CharSelected( const unsigned char *bytes, unsigned int length )
{
_initNull();
setBytes( bytes, length );
}
bool L2Game_CharSelected::parse( L2_VERSION ver /*= L2_VERSION_T1*/ )
{
UNREFERENCED_PARAMETER(ver);
if( !this->canReadBytes( 200 ) ) return false; // must be at least 200 bytes
readReset();
readUChar(); // 0x0b CharSelected
wcscpy( p_char_name, readUnicodeStringPtr() ); // char name
p_charId = readUInt(); // char id (objectId)
wcscpy( p_title, readUnicodeStringPtr() ); // title
p_sessionId = readUInt(); // sessionId
p_clanId = readUInt(); // clanId
readD(); // 0x00 (maybe allyId?)
p_sex = readD();
p_race = readD();
p_classId = readUInt();
p_isActive = readD();
p_x = readD();
p_y = readD();
p_z = readD();
p_curHp = readF();
p_curMp = readF();
p_sp = readUInt();
p_exp = readUInt64();
p_level = readD();
p_karma = readD();
p_PK_kills = readD();
p_INT = readD();
p_STR = readD();
p_CON = readD();
p_MEN = readD();
p_DEX = readD();
p_WIT = readD();
readD(); // writeD( 0x0451 ); // game time?
readD(); // writeD( 0x00 ); // 0x00
readD(); // writeD( classId ); // classId already read?
//writeD(0x00); // 4 x 0x00
//writeD(0x00);
//writeD(0x00);
//writeD(0x00);
readD(); readD(); readD(); readD();
//writeB(new byte[64]); // some 64 bytes
int i;
for( i=0; i<16; i++ ) readD(); // read 4 x 16 = 64 bytes
p_opcodeObfuscatorSeed = readUInt();
return true;
}
bool L2Game_CharSelected::create( L2_VERSION ver /*= L2_VERSION_T1*/ )
{
UNREFERENCED_PARAMETER(ver);
writeReset();
writeC(0x0b);
writeS( p_char_name );
writeD( p_charId );
writeS( p_title );
writeD( p_sessionId ); // playOkID1
writeD( p_clanId );
writeD( 0x00 ); // maybe allyId?
writeD( p_sex );
writeD( p_race );
writeD( p_classId );
writeD( p_isActive ); // active ??
writeD( p_x );
writeD( p_y );
writeD( p_z );
writeF( p_curHp );
writeF( p_curMp );
writeD( p_sp );
writeQ( p_exp );
writeD( p_level );
writeD( p_karma );
writeD( p_PK_kills );
writeD( p_INT );
writeD( p_STR );
writeD( p_CON );
writeD( p_MEN );
writeD( p_DEX );
writeD( p_WIT );
writeD( 0x0451 ); //?
writeD( 0x00 ); // some constants
writeD( p_classId );
writeD(0x00); // 4 x 0x00
writeD(0x00);
writeD(0x00);
writeD(0x00);
//writeB(new byte[64]); // some 64 bytes
unsigned char *rndbuf = (unsigned char *)malloc( 64 );
writeBytes( rndbuf, 64 );
free( rndbuf );
writeD( p_opcodeObfuscatorSeed ); // writeD(0x00);
return true;
}

View File

@@ -0,0 +1,43 @@
#ifndef L2GAME_CHARSELECTED_H_
#define L2GAME_CHARSELECTED_H_
#include "../L2GamePacket.h"
class L2Game_CharSelected : public L2GamePacket
{
public:
L2Game_CharSelected();
L2Game_CharSelected( const unsigned char *bytes, unsigned int length );
public:
virtual bool parse( L2_VERSION ver = L2_VERSION_T1 );
virtual bool create( L2_VERSION ver = L2_VERSION_T1 );
public:
wchar_t p_char_name[128]; // char name
unsigned int p_charId; // char id (objectId)
wchar_t p_title[128]; // title (empty here)
unsigned int p_sessionId; // sessionId
unsigned int p_clanId; // clan id
int p_sex; // sex
int p_race; // race 0x01 - elf
unsigned int p_classId; // class Id
int p_isActive; // is Active
int p_x;
int p_y;
int p_z;
double p_curHp; // currentHp
double p_curMp; // currentMp
unsigned int p_sp; // sp
unsigned long long int p_exp; // exp
int p_level; // level (64)
int p_karma; // karma
int p_PK_kills; // PK kills
int p_INT; // INT
int p_STR; // STR
int p_CON; // CON
int p_MEN; // MEN
int p_DEX; // DEX
int p_WIT; // WIT
unsigned int p_opcodeObfuscatorSeed; // opcode obfuscator seed
};
#endif

View File

@@ -0,0 +1,109 @@
#include "stdafx.h"
#include "L2Game_CharSelectionInfo.h"
L2Game_CharSelectionInfo::L2Game_CharSelectionInfo()
{
this->_initNull();
}
L2Game_CharSelectionInfo::L2Game_CharSelectionInfo( const unsigned char *bytes, unsigned int length )
{
this->_initNull();
this->setBytes( bytes, length );
}
bool L2Game_CharSelectionInfo::read_nChars( unsigned int *ret )
{
if( !ret ) return false;
this->readReset();
if( !this->canReadBytes(10) ) return false;
this->readUChar(); // pcode
(*ret) = this->readUInt();
return true;
}
// ret can be NULL
bool L2Game_CharSelectionInfo::read_server_maxChars( unsigned int *ret )
{
if( !ret ) return false;
this->readReset();
if( !this->canReadBytes(10) ) return false;
this->readUChar(); // pcode
this->readUInt(); // nChars
if( ret ) (*ret) = this->readUInt();
this->readUChar(); // read 0x00
return true;
}
bool L2Game_CharSelectionInfo::read_next_charSelectInfoBlock( L2_VERSION l2_version,
struct L2Game_CharSelectionInfoBlock *c )
{
if( !c ) return false;
memset( c, 0, sizeof(L2Game_CharSelectionInfoBlock) );
// TODO: how to detect that packet may be incorrect?
// char info must be AT LEAST 280 bytes long (Hellbound)
if( !this->canReadBytes(280) ) return false;
const wchar_t *wstr = NULL;
int i = 0;
wstr = this->readUnicodeStringPtr();
if( !wstr ) return false;
wcsncpy( c->charName, wstr, 31 );
c->charID = this->readUInt();
wstr = this->readUnicodeStringPtr();
if( !wstr ) return false;
wcsncpy( c->accountName, wstr, 31 );
c->sessionID = readUInt();
c->clanID = readUInt();
readUInt(); // 0x00
c->sex = readUInt();
c->race = readUInt();
c->baseClassID = readUInt();
c->isActive = readUInt();
c->x = readInt();
c->y = readInt();
c->z = readInt();
c->HP_cur = readDouble();
c->MP_cur = readDouble();
c->SP = readUInt();
c->Exp = readUInt64();
c->level = readUInt();
c->karma = readUInt();
c->PK_kills = readUInt();
c->PVP_kills = readUInt();
for( i=0; i<7; i++ ) readUInt(); // 7 0x00
c->iid_hair_all = readUInt();
c->iid_R_ear = readUInt();
c->iid_L_ear = readUInt();
c->iid_neck = readUInt();
c->iid_R_finger = readUInt();
c->iid_L_finger = readUInt();
c->iid_head = readUInt();
c->iid_R_hand = readUInt();
c->iid_L_hand = readUInt();
c->iid_gloves = readUInt();
c->iid_chest = readUInt();
c->iid_legs = readUInt();
c->iid_feet = readUInt();
c->iid_back = readUInt();
c->iid_LR_hand = readUInt();
c->iid_hair = readUInt();
c->iid_hair_2 = readUInt();
c->iid_R_bracelet = readUInt();
c->iid_L_bracelet = readUInt();
for( i=0; i<6; i++ ) readUInt(); // DECO1 .. DECO6
if( l2_version >= L2_VERSION_T23 )
c->iid_belt = readUInt(); // Gracia Final T2.3
c->hairStyle = readUInt();
c->hairColor = readUInt();
c->face = readUInt();
c->HP_max = readDouble();
c->MP_max = readDouble();
c->deleteSeconds = readUInt();
c->classID = readUInt();
c->lastUsedChar = readUInt();
c->enchantEffect = readUChar();
c->augmentID = readUShort();
c->augmentSmth = readUShort();
c->transformID = readUInt();
return true;
}

View File

@@ -0,0 +1,74 @@
#ifndef L2GAME_CHARSELECTIONINFO_H_
#define L2GAME_CHARSELECTIONINFO_H_
#include "../L2GamePacket.h"
struct L2Game_CharSelectionInfoBlock
{
wchar_t charName[32];
unsigned int charID;
wchar_t accountName[32];
unsigned int sessionID;
unsigned int clanID;
unsigned int sex;
unsigned int race;
unsigned int baseClassID;
unsigned int isActive;
int x;
int y;
int z;
double HP_cur;
double MP_cur;
unsigned int SP;
unsigned long long Exp;
unsigned int level;
unsigned int karma;
unsigned int PK_kills;
unsigned int PVP_kills;
unsigned int iid_hair_all;
unsigned int iid_R_ear;
unsigned int iid_L_ear;
unsigned int iid_neck;
unsigned int iid_R_finger;
unsigned int iid_L_finger;
unsigned int iid_head;
unsigned int iid_R_hand;
unsigned int iid_L_hand;
unsigned int iid_gloves;
unsigned int iid_chest;
unsigned int iid_legs;
unsigned int iid_feet;
unsigned int iid_back;
unsigned int iid_LR_hand;
unsigned int iid_hair;
unsigned int iid_hair_2;
unsigned int iid_R_bracelet;
unsigned int iid_L_bracelet;
unsigned int iid_belt; // T2.3
unsigned int hairStyle;
unsigned int hairColor;
unsigned int face;
double HP_max;
double MP_max;
unsigned int deleteSeconds; ///< seconds left before char will be deleted, or 0 if char is not marked to deletion
unsigned int classID;
unsigned int lastUsedChar;
unsigned char enchantEffect;
unsigned short int augmentID;
unsigned short int augmentSmth;
unsigned int transformID;
};
class L2Game_CharSelectionInfo : public L2GamePacket
{
public:
L2Game_CharSelectionInfo();
L2Game_CharSelectionInfo( const unsigned char *bytes, unsigned int length );
public:
bool read_nChars( unsigned int *ret );
bool read_server_maxChars( unsigned int *ret ); // ret can be NULL
bool read_next_charSelectInfoBlock( L2_VERSION l2_version,
struct L2Game_CharSelectionInfoBlock *c );
};
#endif /*L2GAME_CHARSELECTIONINFO_H_*/

View File

@@ -0,0 +1,122 @@
#include "stdafx.h"
#include "L2Game_KeyPacket.h"
/**
* ==========================================
Retail NCSoft
19 00 // p.len 25
2E // pcode
01 // always const
42 55 77 8F C3 05 69 87 // xorkey first part
01 00 00 00 // always const
01 // possible Game Server ID - depends on game server ID
00 00 00 00 // always NULLs
XX XX XX XX // always different, non-nulls: opcode obfuscator
*/
L2Game_KeyPacket::L2Game_KeyPacket()
{
this->_initNull();
}
L2Game_KeyPacket::L2Game_KeyPacket( const unsigned char *bytes, unsigned int length )
{
this->_initNull();
this->setBytes( bytes, length );
}
// key must point to buffer large enough to hold 8 bytes
bool L2Game_KeyPacket::read_key( unsigned char *key )
{
if( !key ) return false;
this->readReset();
if( this->canReadBytes(10) )
{
this->readUChar(); // packet type (0x0e in hellbound, 0x00 - interlude)
this->readUChar(); // 0x01 ?
return this->readBytes( key, 8 );
}
else return false;
}
unsigned char L2Game_KeyPacket::read_GameServerID()
{
if( !this->canReadBytes(5) ) return 0x00;
this->readUInt(); // 01 00 00 00 // always const
return this->readUChar(); // 01 // possible Game Server ID
}
unsigned int L2Game_KeyPacket::read_OpcodeObfuscator()
{
if( !this->canReadBytes(4) ) return 0x00000000;
this->readUInt(); // 00 00 00 00 // always 0x00000000, read 4 NULLs
return this->readUInt(); // XX XX XX XX // always different, opcode obfuscator
}
// keyPacket array points to key bytes received from KeyPacket (8 bytes)
// keyResult will hold resultig key (16 bytes)
void L2Game_KeyPacket::createInitialHellboundKey(
const unsigned char *keyPacket,
unsigned char *keyResult )
{
if( !keyPacket || !keyResult ) return;
// first 8 bytes of key are from KeyPacket
keyResult[0] = keyPacket[0];
keyResult[1] = keyPacket[1];
keyResult[2] = keyPacket[2];
keyResult[3] = keyPacket[3];
keyResult[4] = keyPacket[4];
keyResult[5] = keyPacket[5];
keyResult[6] = keyPacket[6];
keyResult[7] = keyPacket[7];
// last 8 bytes are constant in T1/T1.5/T2/T2.2/T2.3...
keyResult[8] = (unsigned char)0xc8;
keyResult[9] = (unsigned char)0x27;
keyResult[10] = (unsigned char)0x93;
keyResult[11] = (unsigned char)0x01;
keyResult[12] = (unsigned char)0xa1;
keyResult[13] = (unsigned char)0x6c;
keyResult[14] = (unsigned char)0x31;
keyResult[15] = (unsigned char)0x97;
}
/*** Format:
19 00 // plen = 25
2E // pcode
01 // 00 - wrong proto, 01 - proto OK
B6 4D 20 15 CE 0E BC 7A // 1st 8 bytes of crypto key
01 00 00 00 // 0x01
09 // game serverID
00 00 00 00 // wtf?
E3 D1 10 2F // obfuscation key ***/
bool L2Game_KeyPacket::parse( L2_VERSION ver /*= L2_VERSION_T1*/ )
{
UNREFERENCED_PARAMETER( ver );
readReset();
if( !canReadBytes( 19 ) ) return false; // packet size is at least 19 bytes O_o
getPacketType();
this->p_protocolIsOK = readUChar(); // 0x01 - proto OK, 0x00 - proto not supported
readBytes( this->p_initialKey, 8 ); // first 8 bytes of XOR key
readD(); // 0x00000001
this->p_serverId = readUChar(); // server ID
readD(); // 0x00000000;
this->p_obfuscatorSeed = readUInt(); // obfuscator seed
// add last 8 bytes of XOR key - they are constant
createInitialHellboundKey( p_initialKey, p_initialKey );
//
return true;
}
bool L2Game_KeyPacket::create( L2_VERSION ver )
{
UNREFERENCED_PARAMETER( ver );
writeReset();
setPacketType( 0x2E );
writeUChar( p_protocolIsOK );
writeBytes( p_initialKey, 8 );
writeD( 1 );
writeUChar( p_serverId );
writeD( 0 );
writeUInt( p_obfuscatorSeed );
return true;
}

View File

@@ -0,0 +1,32 @@
#ifndef L2GAME_KEYPACKET_H_
#define L2GAME_KEYPACKET_H_
#include "../L2GamePacket.h"
class L2Game_KeyPacket : public L2GamePacket
{
public:
L2Game_KeyPacket();
L2Game_KeyPacket( const unsigned char *bytes, unsigned int length );
public:
// key must point to buffer large enough to hold 8 bytes
bool read_key( unsigned char *key );
unsigned char read_GameServerID();
unsigned int read_OpcodeObfuscator();
public:
// keyPacket array points to key bytes received from KeyPacket (8 bytes)
// keyResult will hold resultig key (16 bytes)
static void createInitialHellboundKey(
const unsigned char *keyPacket,
unsigned char *keyResult );
public:
virtual bool parse( L2_VERSION ver = L2_VERSION_T1 );
virtual bool create( L2_VERSION ver = L2_VERSION_T1 );
public:
unsigned char p_protocolIsOK;
unsigned char p_initialKey[16];
unsigned char p_serverId;
unsigned int p_obfuscatorSeed;
};
#endif /*L2GAME_KEYPACKET_H_*/

View File

@@ -0,0 +1,80 @@
#include "stdafx.h"
#include "L2Game_NewCharacterSuccess.h"
/*
Server: Len 967 [NewCharacterSuccess]
C7 03
0D // opcode
0C 00 00 00 // number of templates
// [ for each template ]
00 00 00 00 // race
00 00 00 00 // class id
46 00 00 00 // 0x46
28 00 00 00 // base STR
0A 00 00 00 // 0x0A
46 00 00 00 // 0x46
1E 00 00 00 // base DEX
0A 00 00 00
46 00 00 00
2B 00 00 00 // base CON
0A 00 00 00
46 00 00 00
15 00 00 00 // base INT
0A 00 00 00
46 00 00 00
0B 00 00 00 // base WIT
0A 00 00 00
46 00 00 00
19 00 00 00 // base MEN
0A 00 00 00
*/
L2Game_NewCharacterSuccess::L2Game_NewCharacterSuccess()
{
_initNull();
}
L2Game_NewCharacterSuccess::L2Game_NewCharacterSuccess( const unsigned char *bytes, unsigned int length )
{
_initNull();
setBytes( bytes, length );
}
int L2Game_NewCharacterSuccess::read_templatesCount()
{
readReset();
getPacketType();
return readInt();
}
bool L2Game_NewCharacterSuccess::read_nextCharacterTemplate( struct L2Game_NewCharacterTemplate *t )
{
if( !t ) return false;
// each template is 80 bytes length (20Ds)
if( !canReadBytes( 80 ) ) return false;
// read
t->race = readD();
t->classID = readD();
readD(); // 0x46
t->base_STR = readD();
readD(); // 0x0A
readD(); // 0x46
t->base_DEX = readD();
readD(); // 0x0A
readD(); // 0x46
t->base_CON = readD();
readD(); // 0x0A
readD(); // 0x46
t->base_INT = readD();
readD(); // 0x0A
readD(); // 0x46
t->base_WIT = readD();
readD(); // 0x0A
readD(); // 0x46
t->base_MEN = readD();
readD(); // 0x0A
return true;
}

View File

@@ -0,0 +1,28 @@
#ifndef H_L2GAME_NEWCHARACTERSUCCESS
#define H_L2GAME_NEWCHARACTERSUCCESS
#include "../L2GamePacket.h"
struct L2Game_NewCharacterTemplate
{
int race;
int classID;
int base_STR;
int base_DEX;
int base_CON;
int base_INT;
int base_WIT;
int base_MEN;
};
class L2Game_NewCharacterSuccess: public L2GamePacket
{
public:
L2Game_NewCharacterSuccess();
L2Game_NewCharacterSuccess( const unsigned char *bytes, unsigned int length );
public:
int read_templatesCount();
bool read_nextCharacterTemplate( struct L2Game_NewCharacterTemplate *t );
};
#endif

View File

@@ -0,0 +1,43 @@
#include "stdafx.h"
#include "L2Game_SSQInfo.h"
L2Game_SSQInfo::L2Game_SSQInfo()
{
_initNull();
}
L2Game_SSQInfo::L2Game_SSQInfo( const unsigned char *bytes, unsigned int length )
{
_initNull();
setBytes( bytes, length );
}
/**
protected final void writeImpl()
{
writeC(0x73);
if (_state == 2) // Dawn Sky
{
writeH(258);
}
else if (_state == 1) // Dusk Sky
{
writeH(257);
}
else
{
writeH(256);
}
}
*/
unsigned short int L2Game_SSQInfo::read_SSQ_SkySatus()
{
if( this->canReadBytes( 3 ) )
{
this->getPacketType();
return this->readUShort();
}
else return SSQ_NORMAL_SKY;
}

View File

@@ -0,0 +1,19 @@
#ifndef L2GAME_SSQINFO_H_
#define L2GAME_SSQINFO_H_
#include "../L2GamePacket.h"
class L2Game_SSQInfo : public L2GamePacket
{
public:
static const unsigned short int SSQ_DAWN_SKY = 258;
static const unsigned short int SSQ_DUSK_SKY = 257;
static const unsigned short int SSQ_NORMAL_SKY = 256;
public:
L2Game_SSQInfo();
L2Game_SSQInfo( const unsigned char *bytes, unsigned int length );
public:
unsigned short int read_SSQ_SkySatus();
};
#endif /* L2GAME_SSQINFO_H_*/