def etype_eid(pre=""): pre = pre and pre + "_" return Embed(Struct(None, Entity(pre + "entity_type"), #ULInt8(pre + "entity_type"), sid(pre + "entity_id") ) )
), "gold_byte":Struct(None, ULInt8("amount")), "exp_byte":Struct(None, ULInt8("amount")), "exp_word":Struct(None, ULInt16("amount")), "exp_dword":Struct(None, ULInt32("amount")), "attr_byte":Struct(None, attr_code, ULInt8("amount")), "attr_word":Struct(None, attr_code, ULInt16("amount")), "attr_dword":Struct(None, attr_code, ULInt32("amount")), "player_attr":Struct(None, ULInt32("player_id"), attr_code, ULInt32("amount") ), "update_item_oskill":Struct(None, ULInt16("unknown1"), sid("entity_id"), #ULInt16("skill_code"), skills, ULInt8("base_level"), ULInt8("bonus_amount"), ULInt8("unknown2") ), "skill_book_count":Struct(None, entity_type, #ULInt8("entity_type"), ULInt8("unknown1"), ULInt32("entity_id"), #ULInt16("skill_code"), skills, ULInt8("stats_amount"), ULInt16("unknown2")
BitField("unknown1", 1), BitField("y", 15), BitField("unknown2", 36), ), "gold_byte": Struct(None, ULInt8("amount")), "exp_byte": Struct(None, ULInt8("amount")), "exp_word": Struct(None, ULInt16("amount")), "exp_dword": Struct(None, ULInt32("amount")), "attr_byte": Struct(None, attr_code, ULInt8("amount")), "attr_word": Struct(None, attr_code, ULInt16("amount")), "attr_dword": Struct(None, attr_code, ULInt32("amount")), "player_attr": Struct(None, ULInt32("player_id"), attr_code, ULInt32("amount")), "update_item_oskill": Struct( None, ULInt16("unknown1"), sid("entity_id"), # ULInt16("skill_code"), skills, ULInt8("base_level"), ULInt8("bonus_amount"), ULInt8("unknown2"), ), "skill_book_count": Struct( None, entity_type, # ULInt8("entity_type"), ULInt8("unknown1"), ULInt32("entity_id"), # ULInt16("skill_code"), skills, ULInt8("stats_amount"),
swap_cursor_belt = 0x10, cursor_item_when_entering = 0x12, item_is_socketed_into_another = 0x13, item_just_inserted_into_another = 0x15, equipment_swap = 0x17 ), ULInt8("length_of_packet"), Enum(ULInt8("category"), helm = 0x00, armor = 0x01, weapon = 0x05, bow = 0x06, shield = 0x07, other = 0x10 ), sid("item_id"), ) ) def extb(d, bita, count=1): getb = lambda d, bita: (d[bita >> 3] >> (bita & 7)) & 1 ret = 0 while count: count = count - 1 ret = (ret << 1) + getb(d, bita + count) return ret buffers = ("inventory", "body", "belt", "ground", "cursor", "world", "sockets") containers = ("unspecified", "inventory", "npc_trade", "trade_screen", "horadric_cube", "stash") qualities = ("unspecified", "inferior", "normal", "superior", "magic", "set", "rare", "unique", "crafted")
"exp_dword": Struct(None, ULInt32("amount")), "attr_byte": Struct(None, attr_code, ULInt8("amount")), "attr_word": Struct(None, attr_code, ULInt16("amount")), "attr_dword": Struct(None, attr_code, ULInt32("amount")), "player_attr": Struct(None, ULInt32("player_id"), attr_code, ULInt32("amount")), "update_item_oskill": Struct( None, ULInt16("unknown1"), sid("entity_id"), #ULInt16("skill_code"), skills, ULInt8("base_level"), ULInt8("bonus_amount"), ULInt8("unknown2")), "skill_book_count": Struct( None, entity_type, #ULInt8("entity_type"), ULInt8("unknown1"), ULInt32("entity_id"), #ULInt16("skill_code"), skills, ULInt8("stats_amount"),