Skip to content

Commit

Permalink
fix #11
Browse files Browse the repository at this point in the history
  • Loading branch information
MalikAza committed Jul 24, 2024
1 parent a7bff09 commit abf9c92
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions pyZUnivers/tickets.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,24 @@ async def gratting(self, ticket_type: Literal['LR', 'RO', 'ZR'] = 'LR') -> Resul

result: GrattingResult = post_datas(f"{self.base_url}/{ticket_id}")

if result['balance']:
self.balance += result['balance']
if result['loreDust']:
self.loreDust += result['loreDust']
if result['loreFragment']:
self.loreFragment += result['loreFragment']
elif result['inventories']:
self.inventories.append(result['inventories'][0])
elif result['luckyLink'] and result['quantity']:
count += 1
self.nbr_ticket_scratched += 1
elif result['luckyLink']:
self.luckyLink.append(result['luckyLink'])
elif result['userBanner']:
self.userBanner = True
# Those are single possibilities, they can't exists with another result at the same time.
if any(key in result for key in ['inventories', 'luckyLink', 'userBanner']):
if 'inventories' in result:
self.inventories.append(result['inventories'][0])
elif 'luckyLink' in result and 'quantity' in result:
count += 1
self.nbr_ticket_scratched += 1
elif 'luckyLink' in result:
self.luckyLink.append(result['luckyLink'])
elif 'userBanner' in result:
self.userBanner = True
else: # Those can exists with another result at the same time.
if 'balance' in result:
self.balance += result['balance']
if 'loreDust' in result:
self.loreDust += result['loreDust']
if 'loreFragment' in result:
self.loreFragment += result['loreFragment']

count -= 1

Expand Down

0 comments on commit abf9c92

Please sign in to comment.