| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
#ifndef PROTOCOL_H |
| 24 |
#define PROTOCOL_H |
| 25 |
|
| 26 |
class ProtocolPacket |
| 27 |
{ |
| 28 |
public: |
| 29 |
ProtocolPacket() {}; |
| 30 |
|
| 31 |
}; |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
class PacketRecord |
| 42 |
{ |
| 43 |
public: |
| 44 |
virtual unsigned int size() = 0; |
| 45 |
}; |
| 46 |
|
| 47 |
class RecordShell |
| 48 |
{ |
| 49 |
public: |
| 50 |
RecordShell(class PacketRecord & p, void * d) : records(p), data(d) {}; |
| 51 |
class PacketRecord & operator[](int i) { return *(PacketRecord *)((char *)data + (i * records.size())); }; |
| 52 |
private: |
| 53 |
class PacketRecord & records; |
| 54 |
void * data; |
| 55 |
}; |
| 56 |
|
| 57 |
class ZeroPaddedString |
| 58 |
{ |
| 59 |
public: |
| 60 |
ZeroPaddedString(int s, char * d) : size(s), data(d) {}; |
| 61 |
unsigned char operator[] (int index) { }; |
| 62 |
void operator=(char *) {}; |
| 63 |
private: |
| 64 |
unsigned int size; |
| 65 |
char * data; |
| 66 |
}; |
| 67 |
|
| 68 |
|
| 69 |
class OROPlayerListPacket : public ProtocolPacket |
| 70 |
{ |
| 71 |
public: |
| 72 |
OROPlayerListPacket(char * p) : data(p), playerRecord(pr, p) { }; |
| 73 |
void * data; |
| 74 |
unsigned short unknown(void) { return *(unsigned short * )data; }; |
| 75 |
unsigned char playerRecords(void) { return (unsigned char )((char *)data)[2]; }; |
| 76 |
|
| 77 |
|
| 78 |
class PlayerRecord : public PacketRecord |
| 79 |
{ |
| 80 |
public: |
| 81 |
PlayerRecord(void) : name(10) {}; |
| 82 |
unsigned int size(void) { return 0x28; }; |
| 83 |
ZeroPaddedString name; |
| 84 |
unsigned short id(void) { return (unsigned short)*((char *)this + 0x0a); }; |
| 85 |
unsigned char specialIdByte(void) { return (unsigned char)*((char *)this + 0xc); }; |
| 86 |
unsigned char rankByte(void) { return (unsigned char)*((char *)this + 0xd); }; |
| 87 |
unsigned char unknown2; |
| 88 |
unsigned char countryCode; |
| 89 |
unsigned char inviteByte; |
| 90 |
unsigned char unknown3; |
| 91 |
unsigned short rankScore; |
| 92 |
unsigned short wins; |
| 93 |
unsigned short losses; |
| 94 |
unsigned short unknown4; |
| 95 |
unsigned short unknown5; |
| 96 |
} pr; |
| 97 |
const class RecordShell playerRecord; |
| 98 |
}; |
| 99 |
|
| 100 |
#endif |