In KMST IDA, function name is "PackedAvatarLook:ackFrom"
Code:
public static byte[] packedAvatarLookEncode(int... args) {
byte[] bytes = new byte[24];
bytes[0] |= args[0] & 0x1; // gender
bytes[0] |= 2 * (args[1] & 0xF); // skin
bytes[0] |= 32 * ((args[2] % 1000) & 0x3FF); // face
bytes[2] |= 4 * ((args[3] / 10000 == 4) ? 1 : 0); // checkHairGender
bytes[2] |= 8 * ((args[3] % 1000) & 0x3FF); // hair
bytes[3] |= 32 * ((args[3] / 1000) % 10 & 0xF); // hairEquip[0]
bytes[4] |= 2 * ((args[4] % 1000) & 0x3FF); // hairEquip[1]
bytes[5] |= 8 * ((args[4] % 1000) / 1000 % 10 & 7); // hairEquip[1]
bytes[5] |= ((args[5] % 1000) & 0x3FF) << 6; // hairEquip[2]
bytes[7] |= ((args[5] % 1000) / 1000 % 10 & 3); // hairEquip[2]
bytes[7] |= 4 * ((args[6] % 1000) & 0x3FF); // hairEquip[3]
bytes[8] |= 16 * (args[6] / 1000 % 10 & 3); // hairEquip[3]
bytes[8] |= ((args[7] % 1000) & 0x3FF) << 6; // hairEquip[4]
bytes[10] |= (args[7] / 1000 % 10 & 3); // hairEquip[4]
bytes[10] |= (4 * ((args[8] / 10000 == 105) ? 1 : 0)); // hairEquip[5] check
bytes[10] |= 8 * ((args[8] % 1000) & 0x3FF); // hairEquip[5]
bytes[11] |= 32 * (args[8] / 1000 % 10 & 0xF); // hairEquip[5]
bytes[12] |= 2 * ((args[9] % 1000) & 0x3FF); // hairEquip[6]
bytes[13] |= 8 * (args[9] / 1000 % 10 & 3); // hairEquip[6]
bytes[13] |= 32 * ((args[10] % 1000) & 0x3FF); // hairEquip[7]
bytes[14] |= (args[10] / 1000 % 10 & 3) << 7; // hairEquip[7]
bytes[15] |= 2 * ((args[11] % 1000) & 0x3FF); // hairEquip[8]
bytes[16] |= 8 * (args[11] / 1000 % 10 & 3); // hairEquip[8]
bytes[16] |= 32 * ((args[12] % 1000) & 0x3FF); // hairEquip[9]
bytes[17] |= (args[12] / 1000 % 10 & 3) << 7; // hairEquip[9]
int v39 = 0;
if (args[13] > 0) {
if (args[13] / 10000 == 109) {
v39 = 1;
} else {
v39 = ((args[13] / 10000 != 134) ? 1 : 0) + 2;
}
}
bytes[18] |= 2 * (v39 & 3); //hairEquip[10]
bytes[18] |= 8 * ((args[13] % 1000) & 0x3FF); //hairEquip[10]
bytes[19] |= 32 * (args[13] / 1000 % 10 & 0xF); //hairEquip[10]
if (args[14] / 100000 == 17) {
bytes[20] |= 2; // hairEquip[11]
}
bytes[20] |= 4 * ((args[14] % 1000) & 0x3FF); // hairEquip[11]
bytes[21] |= 16 * (args[14] / 1000 % 10 & 3); // hairEquip[11]
int weaponType = (args[14] / 10000) % 100;
bytes[21] |= (weaponType & 0x1F) << 6; // weaponType
int drawElfEar = 0; // checkCustomQuestPlz
bytes[22] |= 8 * (drawElfEar & 1); // MercedesElfEar
bytes[23] = 11; // unPackToVersion
return bytes;
}