public void updatePlayerAppearance(Default317Buffer stream) { stream.position = 0; gender = stream.getUnsignedByte(); headIcon = stream.getUnsignedByte(); npcAppearance = null; this.team = 0; for (int slot = 0; slot < 12; slot++) { int itemId1 = stream.getUnsignedByte(); if (itemId1 == 0) { appearance[slot] = 0; continue; } int itemId2 = stream.getUnsignedByte(); appearance[slot] = (itemId1 << 8) + itemId2; if (slot == 0 && appearance[0] == 65535) { npcAppearance = EntityDefinition.getDefinition(stream.getUnsignedLEShort()); break; } if (appearance[slot] >= 512 && appearance[slot] - 512 < ItemDefinition.itemCount) { int team = ItemDefinition.getDefinition(appearance[slot] - 512).teamId; if (team != 0) { this.team = team; } } } for (int bodyPart = 0; bodyPart < 5; bodyPart++) { int colour = stream.getUnsignedByte(); if (colour < 0 || colour >= ConstantData.GetAppearanceColorRowLength(bodyPart)) { colour = 0; } bodyPartColour[bodyPart] = colour; } base.standAnimationId = stream.getUnsignedLEShort(); if (base.standAnimationId == 65535) { base.standAnimationId = -1; } base.standTurnAnimationId = stream.getUnsignedLEShort(); if (base.standTurnAnimationId == 65535) { base.standTurnAnimationId = -1; } base.walkAnimationId = stream.getUnsignedLEShort(); if (base.walkAnimationId == 65535) { base.walkAnimationId = -1; } base.turnAboutAnimationId = stream.getUnsignedLEShort(); if (base.turnAboutAnimationId == 65535) { base.turnAboutAnimationId = -1; } base.turnRightAnimationId = stream.getUnsignedLEShort(); if (base.turnRightAnimationId == 65535) { base.turnRightAnimationId = -1; } base.turnLeftAnimationId = stream.getUnsignedLEShort(); if (base.turnLeftAnimationId == 65535) { base.turnLeftAnimationId = -1; } base.runAnimationId = stream.getUnsignedLEShort(); if (base.runAnimationId == 65535) { base.runAnimationId = -1; } name = TextClass.formatName(TextClass.longToName(stream.getLong())); combatLevel = stream.getUnsignedByte(); skill = stream.getUnsignedLEShort(); visible = true; appearanceOffset = 0L; for (int slot = 0; slot < 12; slot++) { appearanceOffset <<= 4; if (appearance[slot] >= 256) { appearanceOffset += appearance[slot] - 256; } } if (appearance[0] >= 256) { appearanceOffset += appearance[0] - 256 >> 4; } if (appearance[1] >= 256) { appearanceOffset += appearance[1] - 256 >> 8; } for (int bodyPart = 0; bodyPart < 5; bodyPart++) { appearanceOffset <<= 3; appearanceOffset += bodyPartColour[bodyPart]; } appearanceOffset <<= 1; appearanceOffset += gender; }