Skip to content

Commit

Permalink
Merge branch 'master' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
oczkers committed Oct 1, 2014
2 parents 629c035 + caf3d20 commit b40add9
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 19 deletions.
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ Patches and Suggestions
- Mauro Marano
- Innursery
- Arthur Nogueira Neves @arthurnn
- jamslater
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ Changelog
---------


0.0.18 (2014-10-01)
++++++++++++++++++
* core: add methods to list and delete available messages (thanks to jamslater)
* core: rework base id from resource id calculation, use new constant (thanks to jamslater)
* core: update android * ios clientVersion (9->11)


0.0.17 (2014-09-22)
++++++++++++++++++
* rename project (fut14->fut)
Expand Down
2 changes: 1 addition & 1 deletion fut/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"""

__title__ = 'fut'
__version__ = '0.0.17'
__version__ = '0.0.18'
__author__ = 'Piotr Staroszczyk'
__author_email__ = 'piotr.staroszczyk@get24.org'
__license__ = 'GNU GPL v3'
Expand Down
48 changes: 31 additions & 17 deletions fut/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,22 @@



def baseId(resource_id, version=False):
"""Calculates base id (assetId?)."""
v = 0
if resource_id > 1358954496:
resource_id -= 1342177280
v += 1
if resource_id > 67108864:
resource_id -= 50331648
v += 1
while resource_id > 16777216:
resource_id -= 16777216
v += 1

if version:
return resource_id, v
def baseId(resource_id, return_version=False):
"""Calculates base id and version from a resource id."""
version = 0

while resource_id > 0x01000000:
version += 1
if version == 1:
resource_id -= 0x70000000
elif version == 2:
resource_id -= 0x03000000
else:
resource_id -= 0x01000000

if return_version:
return resource_id, version

return resource_id

def itemParse(item_data):
Expand Down Expand Up @@ -116,10 +117,10 @@ def __login__(self, email, passwd, secret_answer, platform='pc', emulate=None):
# emulate
if emulate == 'ios':
sku = 'FUT15IOS'
clientVersion = 9
clientVersion = 11
elif emulate == 'and':
sku = 'FUT15AND'
clientVersion = 9
clientVersion = 11
# TODO: need more info about log in procedure in game
# elif emulate == 'xbox':
# sku = 'FFA15XBX' # FFA14CAP ?
Expand Down Expand Up @@ -528,3 +529,16 @@ def clubInfo(self):
'trophies': rc['trophies'],
'seasonTicket': rc['seasonTicket']
}

def messages(self):
"""Return active messages."""
rc = self.__get__(self.urls['fut']['ActiveMessage'])
try:
return rc['activeMessage']
except:
raise UnknownError('Invalid activeMessage response')

def messageDelete(self, message_id):
"""Deletes the specified message, by id."""
url = '{}/{}'.format(self.urls['fut']['ActiveMessage'], message_id)
rc = self.__delete__(url)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


__title__ = 'fut'
__version__ = '0.0.17'
__version__ = '0.0.18'
__author__ = 'Piotr Staroszczyk'
__author_email__ = 'piotr.staroszczyk@get24.org'
__license__ = 'GNU GPL v3'
Expand Down

0 comments on commit b40add9

Please sign in to comment.