SHARE
TWEET

Untitled

a guest Aug 22nd, 2019 109 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package packets
  2.  
  3. import utils.*
  4. import java.io.ByteArrayOutputStream
  5.  
  6. data class ServerUpdate(
  7.         var worldEdits: ArrayList<WorldEdit> = ArrayList<WorldEdit>(),
  8.         var hits: ArrayList<Hit> = ArrayList<Hit>(),
  9.         var particles: ArrayList<Particle> = ArrayList<Particle>(),
  10.         var sounds: ArrayList<Sound> = ArrayList<Sound>(),
  11.         var shots: ArrayList<Shot> = ArrayList<Shot>(),
  12.         var worldObjects: ArrayList<WorldObject>,
  13.         var chunkLoots: ArrayList<ChunkLoot>,
  14.         var p48s: ArrayList<P48> = ArrayList<P48>(),
  15.         var pickups: ArrayList<Pickup> = ArrayList<Pickup>(),
  16.         var kills: ArrayList<Kill> = ArrayList<Kill>(),
  17.         var attacks: ArrayList<Attack> = ArrayList<Attack>(),
  18.         var buffs: ArrayList<Buff> = ArrayList(),
  19.         var missions: ArrayList<Mission> = ArrayList<Mission>()
  20. ) : Packet(Opcode.ServerUpdate) {
  21.     constructor(reader: Reader) : this() {
  22.         val length = reader.readInt()
  23.         val compressed = ByteArray(length)
  24.         reader.read(compressed)
  25.  
  26.         val uncompressed = Zlib.inflate(compressed)
  27.         val stream = uncompressed.inputStream()
  28.         val _reader = Reader(stream)
  29.        
  30.         repeat(_reader.readInt()) {
  31.             worldEdits.add(WorldEdit(_reader))
  32.         }        
  33.         repeat(_reader.readInt()) {
  34.             hits.add(Hit(_reader))
  35.         }        
  36.         repeat(_reader.readInt()) {
  37.             particles.add(Particle(_reader))
  38.         }
  39.         repeat(_reader.readInt()) {
  40.             sounds.add(Sound(_reader))
  41.         }        
  42.         repeat(_reader.readInt()) {
  43.             shots.add(Shot(_reader))
  44.         }        
  45.         repeat(_reader.readInt()) {
  46.             worldObjects.add(WorldObject(_reader))
  47.         }        
  48.         repeat(_reader.readInt()) {
  49.             chunkLoots.add(ChunkLoot(_reader))
  50.         }        
  51.         repeat(_reader.readInt()) {
  52.             p48s.add(P48(_reader))
  53.         }        
  54.         repeat(_reader.readInt()) {
  55.             pickups.add(Pickup(_reader))
  56.         }        
  57.         repeat(_reader.readInt()) {
  58.             kills.add(Kill(_reader))
  59.         }        
  60.         repeat(_reader.readInt()) {
  61.             attacks.add(Attack(_reader))
  62.         }        
  63.         repeat(_reader.readInt()) {
  64.             buffs.add(Buff(_reader))
  65.         }
  66.         repeat(_reader.readInt()) {
  67.             missions.add(Mission(_reader))
  68.         }
  69.     }
  70.  
  71.     override fun write(writer: Writer) {
  72.         val stream = ByteArrayOutputStream()
  73.         val _writer = Writer(stream)
  74.  
  75.         _writer.writeInt(worldEdits.size)
  76.         worldEdits.forEach {
  77.             it.write(writer)
  78.         }
  79.  
  80.         _writer.writeInt(hits.size)
  81.         hits.forEach {
  82.             it.write(writer)
  83.         }
  84.  
  85.         _writer.writeInt(particles.size)
  86.         particles.forEach {
  87.             it.write(writer)
  88.         }
  89.  
  90.         _writer.writeInt(sounds.size)
  91.         sounds.forEach {
  92.             it.write(writer)
  93.         }
  94.  
  95.         _writer.writeInt(shots.size)
  96.         shots.forEach {
  97.             it.write(writer)
  98.         }
  99.  
  100.         _writer.writeInt(worldObjects.size)
  101.         worldObjects.forEach {
  102.             it.write(writer)
  103.         }
  104.  
  105.         _writer.writeInt(chunkLoots.size)
  106.         chunkLoots.forEach {
  107.             it.write(writer)
  108.         }
  109.  
  110.         _writer.writeInt(p48s.size)
  111.         p48s.forEach {
  112.             it.write(writer)
  113.         }
  114.  
  115.         _writer.writeInt(pickups.size)
  116.         pickups.forEach {
  117.             it.write(writer)
  118.         }
  119.  
  120.         _writer.writeInt(kills.size)
  121.         kills.forEach {
  122.             it.write(writer)
  123.         }
  124.  
  125.         _writer.writeInt(attacks.size)
  126.         attacks.forEach {
  127.             it.write(writer)
  128.         }
  129.  
  130.         _writer.writeInt(buffs.size)
  131.         buffs.forEach {
  132.             it.write(writer)
  133.         }
  134.  
  135.         _writer.writeInt(missions.size)
  136.         missions.forEach {
  137.             it.write(writer)
  138.         }
  139.  
  140.         val uncompressed = stream.toByteArray()
  141.         val compressed = Zlib.deflate(uncompressed)
  142.         writer.writeInt(compressed.size)
  143.         writer.write(compressed)
  144.     }
  145. }
  146.  
  147. data class WorldEdit (
  148.     var position: Vector3<Int>,
  149.     var color: Vector3<Byte>,
  150.     var blockType: BlockType,
  151.     var unknown: Int
  152. ): CwSerializable {
  153.     constructor(reader: Reader) : this(
  154.         position = reader.readVector3Int(),
  155.         color = reader.readVector3Byte(),
  156.         blockType = BlockType(reader.readByte()),
  157.         unknown = reader.readInt()
  158.     )
  159.     override fun write(writer: Writer) {
  160.         writer.writeVector3Int(position)
  161.         writer.writeVector3Byte(color)
  162.         writer.writeByte(blockType.value.toInt())
  163.         writer.writeInt(unknown)
  164.     }
  165. }
  166. inline class BlockType(val value: Byte) {
  167.     companion object {
  168.         var Air = BlockType(0)
  169.         var Solid = BlockType(1)
  170.         var Liquid = BlockType(2)
  171.         var Wet = BlockType(3)
  172.     }
  173. }
  174.  
  175.  
  176.  
  177. data class Particle (
  178.         val position: Vector3<Long>,
  179.         val velocity: Vector3<Float>,
  180.         val color: Vector3<Byte>,
  181.         val alpha: Float,
  182.         val size: Float,
  183.         val count: Int,
  184.         val particleType: ParticleType,
  185.         val spread: Float,
  186.         val unknown: Int
  187. ):CwSerializable {
  188.     constructor(reader: Reader) : this(
  189.         position = reader.readVector3Long(),
  190.         velocity = reader.readVector3Float(),
  191.         color = reader.readVector3Byte(),
  192.         alpha = reader.readFloat(),
  193.         size = reader.readFloat(),
  194.         count = reader.readInt(),
  195.         particleType = ParticleType(reader.readByte()),
  196.         spread = reader.readFloat(),
  197.         unknown = reader.readInt()
  198.     )
  199.     override fun write(writer: Writer) {
  200.         writer.writeVector3Long(position)
  201.         writer.writeVector3Float(velocity)
  202.         writer.writeVector3Byte(color)
  203.         writer.writeFloat(alpha)
  204.         writer.writeFloat(size)
  205.         writer.writeInt(count)
  206.         writer.writeByte(particleType.value.toInt())
  207.         writer.writeFloat(spread)
  208.     }
  209. }
  210. inline class ParticleType(val value: Byte) {
  211.     companion object {
  212.         val Normal = ParticleType(0)
  213.         val Fire = ParticleType(1)
  214.         val Unknown = ParticleType(2)
  215.         val NoSpreadNoRotation = ParticleType(3)
  216.         val NoGravity = ParticleType(4)
  217.     }
  218. }
  219.  
  220.  
  221.  
  222. data class Sound (
  223.     var position: Vector3<Float>,
  224.     var soundID: SoundID,
  225.     var pitch: Float,
  226.     var volume: Float
  227. ):CwSerializable {
  228.     constructor(reader: Reader) : this(
  229.         position = reader.readVector3Float(),
  230.         soundID = SoundID(reader.readInt()),
  231.         pitch = reader.readFloat(),
  232.         volume = reader.readFloat()
  233.     )
  234.     override fun write(writer: Writer) {
  235.         writer.writeVector3Float(position)
  236.         writer.writeInt(soundID.value)
  237.         writer.writeFloat(pitch)
  238.         writer.writeFloat(volume)
  239.     }
  240. }
  241. inline class SoundID(val value: Int) {
  242.     companion object {
  243.         var Hit = SoundID(0)
  244.         var Blade1 = SoundID(1)
  245.         var Blade2 = SoundID(2)
  246.         var LongBlade1 = SoundID(3)
  247.         var LongBlade2 = SoundID(4)
  248.         var Hit1 = SoundID(5)
  249.         var Hit2 = SoundID(6)
  250.         var Punch1 = SoundID(7)
  251.         var Punch2 = SoundID(8)
  252.         var HitArrow = SoundID(9)
  253.         var HitArrowCritical = SoundID(10)
  254.         var Smash1 = SoundID(11)
  255.         var SlamGround = SoundID(12)
  256.         var SmashHit2 = SoundID(13)
  257.         var SmashJump = SoundID(14)
  258.         var Swing = SoundID(15)
  259.         var ShieldSwing = SoundID(16)
  260.         var SwingSlow = SoundID(17)
  261.         var SwingSlow2 = SoundID(18)
  262.         var ArrowDestroy = SoundID(19)
  263.         var Blade3 = SoundID(20)
  264.         var Punch3 = SoundID(21)
  265.         var Salvo2 = SoundID(22)
  266.         var SwordHit03 = SoundID(23)
  267.         var Block = SoundID(24)
  268.         var ShieldSlam = SoundID(25)
  269.         var Roll = SoundID(26)
  270.         var Destroy2 = SoundID(27)
  271.         var Cry = SoundID(28)
  272.         var Levelup2 = SoundID(29)
  273.         var Missioncomplete = SoundID(30)
  274.         var Watersplash01 = SoundID(31)
  275.         var Step2 = SoundID(32)
  276.         var StepWater = SoundID(33)
  277.         var StepWater2 = SoundID(34)
  278.         var StepWater3 = SoundID(35)
  279.         var Channel2 = SoundID(36)
  280.         var ChannelHit = SoundID(37)
  281.         var Fireball = SoundID(38)
  282.         var FireHit = SoundID(39)
  283.         var Magic01 = SoundID(40)
  284.         var Watersplash = SoundID(41)
  285.         var WatersplashHit = SoundID(42)
  286.         var LichScream = SoundID(43)
  287.         var Drink2 = SoundID(44)
  288.         var Pickup = SoundID(45)
  289.         var Disenchant2 = SoundID(46)
  290.         var Upgrade2 = SoundID(47)
  291.         var Swirl = SoundID(48)
  292.         var HumanVoice01 = SoundID(49)
  293.         var HumanVoice02 = SoundID(50)
  294.         var Gate = SoundID(51)
  295.         var SpikeTrap = SoundID(52)
  296.         var FireTrap = SoundID(53)
  297.         var Lever = SoundID(54)
  298.         var Charge2 = SoundID(55)
  299.         var Magic02 = SoundID(56)
  300.         var Drop = SoundID(57)
  301.         var DropCoin = SoundID(58)
  302.         var DropItem = SoundID(59)
  303.         var MaleGroan = SoundID(60)
  304.         var FemaleGroan = SoundID(61)
  305.         var MaleGroan2 = SoundID(62)
  306.         var FemaleGroan2 = SoundID(63)
  307.         var GoblinMaleGroan = SoundID(64)
  308.         var GoblinFemaleGroan = SoundID(65)
  309.         var LizardMaleGroan = SoundID(66)
  310.         var LizardFemaleGroan = SoundID(67)
  311.         var DwarfMaleGroan = SoundID(68)
  312.         var DwarfFemaleGroan = SoundID(69)
  313.         var OrcMaleGroan = SoundID(70)
  314.         var OrcFemaleGroan = SoundID(71)
  315.         var UndeadMaleGroan = SoundID(72)
  316.         var UndeadFemaleGroan = SoundID(73)
  317.         var FrogmanMaleGroan = SoundID(74)
  318.         var FrogmanFemaleGroan = SoundID(75)
  319.         var MonsterGroan = SoundID(76)
  320.         var TrollGroan = SoundID(77)
  321.         var MoleGroan = SoundID(78)
  322.         var SlimeGroan = SoundID(79)
  323.         var ZombieGroan = SoundID(80)
  324.         var Explosion = SoundID(81)
  325.         var Punch4 = SoundID(82)
  326.         var MenuOpen2 = SoundID(83)
  327.         var MenuClose2 = SoundID(84)
  328.         var MenuSelect = SoundID(85)
  329.         var MenuTab = SoundID(86)
  330.         var MenuGrabItem = SoundID(87)
  331.         var MenuDropItem = SoundID(88)
  332.         var Craft = SoundID(89)
  333.         var CraftProc = SoundID(90)
  334.         var Absorb = SoundID(91)
  335.         var Manashield = SoundID(92)
  336.         var Bulwark = SoundID(93)
  337.         var Bird1 = SoundID(94)
  338.         var Bird2 = SoundID(95)
  339.         var Bird3 = SoundID(96)
  340.         var Cricket1 = SoundID(97)
  341.         var Cricket2 = SoundID(98)
  342.         var Owl1 = SoundID(99)
  343.         var Owl2 = SoundID(100)
  344.     }
  345. }
  346.  
  347.  
  348.  
  349. data class WorldObject(
  350.     var chunk: Vector2<Int>,
  351.     var objectID: Int,
  352.     var paddingA: Int,
  353.     var objectType: ObjectType,
  354.     var paddingB: Int,
  355.     var position: Vector3<Long>,
  356.     var orientation: Orientation,
  357.     var size: Vector3<Float>,
  358.     var isClosed: Boolean,
  359.     var transformTime: Int,
  360.     var unknown: Int,
  361.     var paddingC: Int,
  362.     var interactor: Long
  363. ):CwSerializable {
  364.     constructor(reader: Reader) : this(
  365.         chunk = reader.readVector2Int(),
  366.         objectID = reader.readInt(),
  367.         paddingA = reader.readInt(),
  368.         objectType = ObjectType(reader.readInt()),
  369.         paddingB = reader.readInt(),
  370.         position = reader.readVector3Long(),
  371.         orientation = Orientation(reader.readInt()),
  372.         size = reader.readVector3Float(),
  373.         isClosed = reader.readBooleanAsInt(),
  374.         transformTime = reader.readInt(),
  375.         unknown = reader.readInt(),
  376.         paddingC = reader.readInt(),
  377.         interactor = reader.readLong()
  378.     )
  379.     override fun write(writer: Writer) {
  380.         writer.writeVector2Int(chunk)
  381.         writer.writeInt(objectID)
  382.         writer.writeInt(paddingA)
  383.         writer.writeInt(objectType.value)
  384.         writer.writeInt(paddingB)
  385.         writer.writeVector3Long(position)
  386.         writer.writeInt(orientation.value)
  387.         writer.writeVector3Float(size)
  388.         writer.writeBooleanAsInt(isClosed)
  389.         writer.writeInt(transformTime)
  390.         writer.writeInt(unknown)
  391.         writer.writeInt(paddingC)
  392.         writer.writeLong(interactor)
  393.     }
  394. }
  395. inline class ObjectType(val value: Int) {
  396.     companion object {
  397.         val Statue = ObjectType(0)
  398.         val Door = ObjectType(1)
  399.         val BigDoor = ObjectType(2)
  400.         val Window = ObjectType(3)
  401.         val CastleWindow = ObjectType(4)
  402.         val Gate = ObjectType(5)
  403.         val FireTrap = ObjectType(6)
  404.         val SpikeTrap = ObjectType(7)
  405.         val StompTrap = ObjectType(8)
  406.         val Lever = ObjectType(9)
  407.         val Chest = ObjectType(10)
  408.         val ChestTop02 = ObjectType(11)
  409.         val Table1 = ObjectType(12)
  410.         val Table2 = ObjectType(13)
  411.         val Table3 = ObjectType(14)
  412.         val Stool1 = ObjectType(15)
  413.         val Stool2 = ObjectType(16)
  414.         val Stool3 = ObjectType(17)
  415.         val Bench = ObjectType(18)
  416.         val Bed = ObjectType(19)
  417.         val BedTable = ObjectType(20)
  418.         val MarketStand1 = ObjectType(21)
  419.         val MarketStand2 = ObjectType(22)
  420.         val MarketStand3 = ObjectType(23)
  421.         val Barrel = ObjectType(24)
  422.         val Crate = ObjectType(25)
  423.         val OpenCrate = ObjectType(26)
  424.         val Sack = ObjectType(27)
  425.         val Shelter = ObjectType(28)
  426.         val Cupboard = ObjectType(29)
  427.         val Desktop = ObjectType(30)
  428.         val Counter = ObjectType(31)
  429.         val Shelf1 = ObjectType(32)
  430.         val Shelf2 = ObjectType(33)
  431.         val Shelf3 = ObjectType(34)
  432.         val CastleShelf1 = ObjectType(35)
  433.         val CastleShelf2 = ObjectType(36)
  434.         val CastleShelf3 = ObjectType(37)
  435.         val StoneShelf1 = ObjectType(38)
  436.         val StoneShelf2 = ObjectType(39)
  437.         val StoneShelf3 = ObjectType(40)
  438.         val SandstoneShelf1 = ObjectType(41)
  439.         val SandstoneShelf2 = ObjectType(42)
  440.         val SandstoneShelf3 = ObjectType(43)
  441.         val Corpse = ObjectType(44)
  442.         val RuneStone = ObjectType(45)
  443.         val Artifact = ObjectType(46)
  444.         val FlowerBox1 = ObjectType(47)
  445.         val FlowerBox2 = ObjectType(48)
  446.         val FlowerBox3 = ObjectType(49)
  447.         val StreetLight = ObjectType(50)
  448.         val FireStreetLight = ObjectType(51)
  449.         val Fence1 = ObjectType(52)
  450.         val Fence2 = ObjectType(53)
  451.         val Fence3 = ObjectType(54)
  452.         val Fence4 = ObjectType(55)
  453.         val Vase1 = ObjectType(56)
  454.         val Vase2 = ObjectType(57)
  455.         val Vase3 = ObjectType(58)
  456.         val Vase4 = ObjectType(59)
  457.         val Vase5 = ObjectType(60)
  458.         val Vase6 = ObjectType(61)
  459.         val Vase7 = ObjectType(62)
  460.         val Vase8 = ObjectType(63)
  461.         val Vase9 = ObjectType(64)
  462.         val Campfire = ObjectType(65)
  463.         val Tent = ObjectType(66)
  464.         val BeachUmbrella = ObjectType(67)
  465.         val BeachTowel = ObjectType(68)
  466.         val SleepingMat = ObjectType(69)
  467.         val Furnace = ObjectType(70)
  468.         val Anvil = ObjectType(71)
  469.         val SpinningWheel = ObjectType(72)
  470.         val Loom = ObjectType(73)
  471.         val SawBench = ObjectType(74)
  472.         val Workbench = ObjectType(75)
  473.         val CustomizationBench = ObjectType(76)
  474.     }
  475. }
  476. inline class Orientation(val value: Int) {
  477.     companion object {
  478.         val South = Orientation(0)
  479.         val East = Orientation(1)
  480.         val North = Orientation(2)
  481.         val West = Orientation(3)
  482.     }
  483. }
  484.  
  485.  
  486.  
  487. data class ChunkLoot(
  488.         var chunk: Vector2<Int>,
  489.         var drops: ArrayList<Drop> = ArrayList<Drop>()
  490. ): CwSerializable {
  491.     constructor(reader: Reader) : this(reader.readVector2Int()) {
  492.         repeat(reader.readInt()) {
  493.             drops.add(Drop(reader))
  494.         }
  495.     }
  496.     override fun write(writer: Writer) {
  497.         writer.writeVector2Int(chunk)
  498.         drops.forEach {
  499.             it.write(writer)
  500.         }
  501.     }
  502. }
  503.  
  504. data class Drop(
  505.         var item: Item,
  506.         var position: Vector3<Long>,
  507.         var rotation: Float,
  508.         var scale: Float,
  509.         var unknownA: Int,
  510.         var droptime: Int,
  511.         var unknownB: Int,
  512.         var unknownC: Int
  513. ): CwSerializable {
  514.     constructor(reader: Reader) : this(
  515.             item = Item(reader),
  516.             position = reader.readVector3Long(),
  517.             rotation = reader.readFloat(),
  518.             scale = reader.readFloat(),
  519.             unknownA = reader.readInt(),
  520.             droptime = reader.readInt(),
  521.             unknownB = reader.readInt(),
  522.             unknownC = reader.readInt()
  523.     )
  524.     override fun write(writer: Writer) {
  525.         item.write(writer)
  526.         writer.writeVector3Long(position)
  527.         writer.writeFloat(rotation)
  528.         writer.writeFloat(scale)
  529.         writer.writeInt(unknownA)
  530.         writer.writeInt(droptime)
  531.         writer.writeInt(unknownB)
  532.         writer.writeInt(unknownC)
  533.     }
  534. }
  535.  
  536. data class P48(
  537.         var chunk: Vector2<Int>,
  538.         var subPackets: ArrayList<ByteArray> = ArrayList<ByteArray>()
  539. ): CwSerializable {
  540.     constructor(reader: Reader) : this(reader.readVector2Int()) {
  541.         repeat(reader.readInt()) {
  542.             subPackets.add(reader.readByteArray(16))
  543.         }
  544.     }
  545.     override fun write(writer: Writer) {
  546.         writer.writeVector2Int(chunk)
  547.         writer.writeInt(subPackets.size)
  548.         subPackets.forEach {
  549.             writer.write(it)
  550.         }
  551.     }
  552. }
  553.  
  554.  
  555.  
  556. data class Pickup(
  557.         var interactor: Long,
  558.         var item: Item
  559. ): CwSerializable {
  560.     constructor(reader: Reader) : this(
  561.         interactor = reader.readLong(),
  562.         item = Item(reader)
  563.     )
  564.     override fun write(writer: Writer) {
  565.         writer.writeLong(interactor)
  566.         item.write(writer)
  567.     }
  568. }
  569.  
  570. data class Kill(
  571.     var killer: Long,
  572.     var victim: Long,
  573.     var unknown: Int,
  574.     var xp: Int
  575. ): CwSerializable {
  576.     constructor(reader: Reader) : this(
  577.             killer = reader.readLong(),
  578.             victim = reader.readLong(),
  579.             unknown = reader.readInt(),
  580.             xp = reader.readInt()
  581.     )
  582.     override fun write(writer: Writer) {
  583.         writer.writeLong(killer)
  584.         writer.writeLong(victim)
  585.         writer.writeInt(unknown)
  586.         writer.writeInt(xp)
  587.     }
  588. }
  589.  
  590.  
  591.  
  592. data class Attack(
  593.         var target: Long,
  594.         var attacker: Long,
  595.         var damage: Float,
  596.         var unknown: Int
  597. ): CwSerializable {
  598.     constructor(reader: Reader) : this(
  599.             target = reader.readLong(),
  600.             attacker = reader.readLong(),
  601.             damage = reader.readFloat(),
  602.             unknown = reader.readInt()
  603.     )
  604.     override fun write(writer: Writer) {
  605.         writer.writeLong(target)
  606.         writer.writeLong(attacker)
  607.         writer.writeFloat(damage)
  608.         writer.writeInt(unknown)
  609.     }
  610. }
  611.  
  612. data class Mission(
  613.         var sector: Vector2<Int>,
  614.         var unknownA: Int,
  615.         var unknownB: Int,
  616.         var unknownC: Int,
  617.         var id: Int,
  618.         var type: Int,
  619.         var boss: CreatureType,
  620.         var level: Int,
  621.         var unknownE: Byte,
  622.         var state: MissionState,
  623.         var padding: Short,
  624.         var currentHP: Int,
  625.         var maxHP: Int,
  626.         var chunk: Vector2<Int>
  627. ):CwSerializable {
  628.     constructor(reader: Reader) : this(
  629.             sector = reader.readVector2Int(),
  630.             unknownA = reader.readInt(),
  631.             unknownB = reader.readInt(),
  632.             unknownC = reader.readInt(),
  633.             id = reader.readInt(),
  634.             type = reader.readInt(),
  635.             boss = CreatureType(reader.readInt()),
  636.             level = reader.readInt(),
  637.             unknownE = reader.readByte(),
  638.             state = MissionState(reader.readByte()),
  639.             padding = reader.readShort(),
  640.             currentHP = reader.readInt(),
  641.             maxHP = reader.readInt(),
  642.             chunk = reader.readVector2Int()
  643.     )
  644.     override fun write(writer: Writer) {
  645.         writer.writeVector2Int(sector)
  646.         writer.writeInt(unknownA)
  647.         writer.writeInt(unknownB)
  648.         writer.writeInt(unknownC)
  649.         writer.writeInt(id)
  650.         writer.writeInt(type)
  651.         writer.writeInt(boss.value)
  652.         writer.writeInt(level)
  653.         writer.writeByte(unknownE.toInt())
  654.         writer.writeByte(state.value.toInt())
  655.         writer.writeShort(padding.toInt())
  656.         writer.writeInt(currentHP)
  657.         writer.writeInt(maxHP)
  658.         writer.writeVector2Int(chunk)
  659.     }
  660. }
  661.  
  662. inline class MissionState(val value: Byte) {
  663.     companion object {
  664.         val Ready = MissionState(0)
  665.         val InProgress = MissionState(1)
  666.         val Finished = MissionState(2)
  667.     }
  668. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top