quarry icon indicating copy to clipboard operation
quarry copied to clipboard

How to unpack 'window_items'?

Open justinrest opened this issue 3 years ago • 3 comments

I don't have any idea how to unpack it. Does anyone know?

justinrest avatar May 18 '22 22:05 justinrest

This is what I did for getting the players inventory, (This is only one part, your inv gets updated by like 5 methods)

In the code below I have it set up for a proxy, with the variables self.data at index of their uuid (self.downstream.uuid) so The different players have different variables (This requires some other code I didn't include, so use different variables)

        buff.save()
        
        self.downstream.send_packet("window_items",buff.read())
        buff.restore()
        window = buff.read(1)
        #below is state id, I know my code is bad, but it is a useless number for the most part
        idc = buff.unpack_varint()
        self.data[self.downstream.uuid]["slot_state"] = idc
        count = buff.unpack_varint()
        # below is check if inv, inventory is always window 00
        if (window == b'\x00'):
            for i in range(count):
                self.data[self.downstream.uuid]["slot_dat"][i] = buff.unpack_slot()
        buff.discard()
        return()```
        
       If you need any more help just ask (sorry if this answer is bad)

davidawesome02 avatar Jun 07 '22 23:06 davidawesome02

@davidawesome02 hey thanks alot! do you have discord? i'd love some more help!

justinrest avatar Jul 15 '22 22:07 justinrest

Sorry for a late reply, my discord is davidawesome01#**** (I will delete this after I get a friend request from you), I forgot to check my email, because of some personal things. I can talk any time (almost) betwine 9am and 8pm.

@tcrch

davidawesome02 avatar Jul 17 '22 16:07 davidawesome02