PDA

Просмотр полной версии : Разговор про ОptCode


i_am_kisly
28.12.2014, 15:47
Просматриваю тут исходники, обьясните мне, в L2 используются opcodы разных размеров ? И в каких хрониках какие ?

/** Sets 3rd byte of packet (which holds packet opcode).
* Equivalent to call writeReset() and writeUChar() with parameter type.
* Moves write pointer to byte #3 (next after opcode)
* \param type new packet opcode. */
public virtual void setPacketType(byte type)
{
writeReset();
writeUChar(type);
}
/** Sets 3rd,4th,5th bytes of packet (which holds packet opcode and extended opcode).
* Equivalent to call writeReset(); writeUChar(); writeUShort() with parameter type.
* Moves write pointer!
* \param opcode new packet opcode.
* \param opcode2 extended opcode. */
public virtual void setPacketType2(byte opcode, ushort opcode2)
{
writeReset();
writeUChar(opcode);
writeUShort(opcode2);
}
/** Sets 3rd,4th,5th,6th,7th bytes of packet (which holds packet opcode, ext opcode, ext opcode 2).
* Equivalent to call writeReset(); writeUChar(); writeUShort() writeUShort() with parameter type.
* Moves write pointer!
* \param opcode new packet opcode.
* \param opcode2 extended opcode.
* \param opcode3 extended opcode 2.
*/
public virtual void setPacketType3(byte opcode, ushort opcode2, ushort opcode3)
{
writeReset();
writeUChar(opcode);
writeUShort(opcode2);
writeUShort(opcode3);
}
/** Reads packet opcode. Moves read pointer to byte #3 (next after opcode). Equivalent calls: readReset(); readUChar()
* \return read packet opcode. */
public virtual byte getPacketType()
{
readReset();
return readUChar();
}

xixi
28.12.2014, 22:12
Есть extended опкоды
Например 0xD0:
У сервера оно выглядит так:
case 0xd0:
int id3 = buf.getShort() & 0xffff;
switch(id3)
{
case 0x00:
// msg = new ?();
break;
case 0x01:
msg = new RequestManorList();
break;
case 0x02:
msg = new RequestProcureCropList();
break;