def readZoneFlag(file): data = [] with open(file, "rb") as f: br = BinaryReader(f) dataCount = br.ReadInt() for i in range(dataCount): data.append({ "npcId": br.ReadInt(), "zoneFlag": br.ReadInt64(), "extraFlag": br.ReadInt64() }) return data
def readItem(file, isGamigo): MAX_MAKE_ITEM_MATERIAL = 10 DEF_SMC_DEFAULT_LENGTH = 64 DEF_MAX_ORIGIN_OPTION = 10 DEF_EFFECT_DEFAULT_LENGTH = 32 data = [] with open(file, "rb") as f: br = BinaryReader(f) dataCount = br.ReadInt() for i in range(dataCount): data.append({ "itemId": br.ReadInt(), "jobFlag": br.ReadInt(), "stack": br.ReadInt(), "fame/maxuse": br.ReadInt(), "level": br.ReadInt(), "flag": br.ReadInt64(), "wearing": br.ReadInt(), "type": br.ReadInt(), "subtype": br.ReadInt(), "crafting": { "needItemId": br.ReadIntToList(MAX_MAKE_ITEM_MATERIAL), "needItemCount": br.ReadIntToList(MAX_MAKE_ITEM_MATERIAL) }, "specialSkill": { "needSpecialSkill1": br.ReadIntToList(2), "needSpecialSkill2": br.ReadIntToList(2), }, "iconPosition": br.ReadIntToList(3), "num": br.ReadIntToList(4), "price": br.ReadInt(), "set": br.ReadIntToList(7 if isGamigo else 5), "smc": br.ReadBytesToString(DEF_SMC_DEFAULT_LENGTH, 'latin1'), "effect": { "normal": br.ReadBytesToString(DEF_EFFECT_DEFAULT_LENGTH, 'latin1'), "attack": br.ReadBytesToString(DEF_EFFECT_DEFAULT_LENGTH, 'latin1'), "damage": br.ReadBytesToString(DEF_EFFECT_DEFAULT_LENGTH, 'latin1') }, "rareOption": { "id": br.ReadInt(), "chance": br.ReadInt(), "optionIds": br.ReadIntToList(DEF_MAX_ORIGIN_OPTION), "optionLevels": br.ReadIntToList(DEF_MAX_ORIGIN_OPTION) }, "rvr": { "type": br.ReadInt(), "grade": br.ReadInt() }, "fortuneId": br.ByteToInt(br.ReadByte()), "castleWar": br.ReadInt() }) return data