Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * This methods decodes the argued [buffer] and stores the details in this [ItemTemplate].
- * The decode used to interpret the [buffer] is determined by the specified [revision].
- *
- * @param buffer the [Buffer] containing the animation details.
- */
- override fun decode(buffer: Buffer) {
- while (true) {
- val attributeId = buffer.unsignedByte
- if (attributeId == 0)
- break
- when (attributeId) {
- 1 -> modelID = buffer.unsignedShort
- 2 -> name = buffer.string
- 3 -> description = buffer.bytes!!.contentToString()
- 4 -> zoom2d = buffer.unsignedShort
- 5 -> rotationX = buffer.unsignedShort
- 6 -> rotationY = buffer.unsignedShort
- 7 -> {
- offsetX2d = buffer.unsignedShort
- if (offsetX2d > 32767) offsetX2d -= 65536
- }
- 8 -> {
- offsetY2d = buffer.unsignedShort
- if (offsetY2d > 32767) offsetY2d -= 65536
- }
- 10 -> buffer.unsignedShort
- 11 -> stackable = true
- 12 -> value = buffer.int
- 16 -> membersOnly= true
- 23 -> {
- maleEquipPrimaryModel = buffer.unsignedShort
- maleEquipOffset = buffer.signedByte
- }
- 24 -> maleEquipSecondaryModel = buffer.unsignedShort
- 25 -> {
- femaleEquipPrimaryModel = buffer.unsignedShort
- femaleEquipOffset = buffer.signedByte
- }
- 26 -> femaleEquipSecondaryModel = buffer.unsignedShort
- in 30..34 -> {
- if(groundActions.isEmpty())
- groundActions = arrayOfNulls(5)
- groundActions[attributeId - 30] = buffer.string
- if (groundActions[attributeId - 30].equals("hidden", ignoreCase = true))
- groundActions[attributeId - 30] = ""
- }
- in 35..39 -> {
- if(inventoryActions.isEmpty())
- inventoryActions = arrayOfNulls(5)
- inventoryActions[attributeId - 35] = buffer.string
- }
- 40 -> {
- val modelColorCount = buffer.unsignedByte
- modelColorsOriginal = IntArray(modelColorCount).toTypedArray()
- modelColorsModified = IntArray(modelColorCount).toTypedArray()
- for (modelColor in 0 until modelColorCount) {
- modelColorsOriginal[modelColor] = buffer.unsignedShort
- modelColorsModified[modelColor] = buffer.unsignedShort
- }
- }
- 78 -> maleEmblem = buffer.unsignedShort
- 79 -> femaleEmblem = buffer.unsignedShort
- 90 -> maleDialogue = buffer.unsignedShort
- 91 -> femaleDialogue = buffer.unsignedShort
- 92 -> maleDialogueHat = buffer.unsignedShort
- 93 -> femaleDialogueHat = buffer.unsignedShort
- 95 -> diagonalRotation = buffer.unsignedShort
- 97 -> noteID = buffer.unsignedShort
- 98 -> noteTemplateID = buffer.unsignedShort
- in 100..109 -> {
- if(!this::stackableIds.isInitialized || stackableIds.isEmpty()){
- stackableIds = IntArray(10)
- stackableAmounts = IntArray(10)
- }
- stackableIds[attributeId - 100] = buffer.unsignedShort
- stackableAmounts[attributeId - 100] = buffer.unsignedShort
- }
- 110 -> modelSizeX = buffer.unsignedShort
- 111 -> modelSizeY = buffer.unsignedShort
- 112 -> modelSizeZ = buffer.unsignedShort
- 113 -> lightModifier = buffer.signedByte.toInt()
- 114 -> shadowModifier = buffer.signedByte * 5
- 115 -> teamID = buffer.unsignedByte
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement