ex.printStackTrace();
}
}
private void spawnChar(CharacterData newCharacter, Channel recipient) throws Exception {
P077_UpdateAgentAppearance updateAgentAppearance = new P077_UpdateAgentAppearance();
updateAgentAppearance.setUnknown1(newCharacter.getLocalID());
updateAgentAppearance.setUnknown2(newCharacter.getAgentID());
//TODO: utility method that does this, I'm sick of converting everywhere...
byte[] rawData = newCharacter.getAppearance();
//FIXME: appearance is not 4 bytes, why are we truncating the first 4 bytes??
//updateAgentAppearance.setAppearance(new short[]{(short) (rawData[0] & 0xFF), (short) (rawData[1] & 0xFF), (short) (rawData[2] & 0xFF), (short) (rawData[3] & 0xFF)});
//TODO: utility
updateAgentAppearance.setAppearance(1L | rawData[3] << 24 | rawData[2] << 16 | rawData[1] << 8 | rawData[0] & 0xFF);
updateAgentAppearance.setUnknown6(0x3cbfa094);
updateAgentAppearance.setName(newCharacter.getName());
recipient.write(updateAgentAppearance);
P021_SpawnObject spawnObject = new P021_SpawnObject();
spawnObject.setAgentId(newCharacter.getAgentID());
spawnObject.setUnknown2((0x30000000) | newCharacter.getLocalID()); // assumption that this is localID