Skip to content

Commit d1542f7

Browse files
committed
throwing autogratting optimization because of inventory key (even empty) always present
1 parent 7e7b787 commit d1542f7

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

pyZUnivers/tickets.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -100,24 +100,21 @@ async def gratting(self, ticket_type: Literal['LR', 'RO', 'ZR'] = 'LR') -> Resul
100100

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

103-
# Those are single possibilities, they can't exists with another result at the same time.
104-
if any(key in result for key in ['inventories', 'luckyLink', 'userBanner']):
105-
if 'inventories' in result:
106-
for item in result['inventories']: self.inventories.append(item)
107-
elif 'luckyLink' in result and 'quantity' in result:
108-
count += 1
109-
self.nbr_ticket_scratched += 1
110-
elif 'luckyLink' in result:
111-
self.luckyLink.append(result['luckyLink'])
112-
elif 'userBanner' in result:
113-
self.userBanner = True
114-
else: # Those can exists with another result at the same time.
115-
if 'balance' in result:
116-
self.balance += result['balance']
117-
if 'loreDust' in result:
118-
self.loreDust += result['loreDust']
119-
if 'loreFragment' in result:
120-
self.loreFragment += result['loreFragment']
103+
if 'inventories' in result:
104+
for item in result['inventories']: self.inventories.append(item)
105+
if 'luckyLink' in result and 'quantity' in result:
106+
count += 1
107+
self.nbr_ticket_scratched += 1
108+
elif 'luckyLink' in result:
109+
self.luckyLink.append(result['luckyLink'])
110+
if 'userBanner' in result:
111+
self.userBanner = True
112+
if 'balance' in result:
113+
self.balance += result['balance']
114+
if 'loreDust' in result:
115+
self.loreDust += result['loreDust']
116+
if 'loreFragment' in result:
117+
self.loreFragment += result['loreFragment']
121118

122119
count -= 1
123120

0 commit comments

Comments
 (0)