Skip to content

Commit

Permalink
fix #145 (baseId calculation) #140
Browse files Browse the repository at this point in the history
  • Loading branch information
oczkers committed Sep 26, 2015
1 parent e2ae589 commit b66b21e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fut/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,21 @@
def baseId(resource_id, return_version=False):
"""Calculates base id and version from a resource id."""
version = 0
resource_id = abs(resource_id)

while resource_id > 0x01000000: # 16777216
version += 1
if version == 1:
resource_id -= 0x70000000 # 1879048192
resource_id -= 0x80000000 # 2147483648
elif version == 2:
resource_id -= 0x03000000 # 50331648
else:
resource_id -= 0x01000000 # 16777216

if return_version:
return resource_id, version
return abs(resource_id), version

return resource_id
return abs(resource_id)


def itemParse(item_data):
Expand Down

0 comments on commit b66b21e

Please sign in to comment.