Skip to content

Commit fca76c0

Browse files
authored
Added individual timing and attempt!
Added individual timing and attempt settings for each game in promo code generator script. Implemented configurable delays and retry logic per game to enhance flexibility and control over the key generation process.
1 parent 5cb37ce commit fca76c0

File tree

1 file changed

+29
-10
lines changed

1 file changed

+29
-10
lines changed

main.py

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,36 +21,46 @@
2121
'name': 'Riding Extreme 3D',
2222
'appToken': 'd28721be-fd2d-4b45-869e-9f253b554e50',
2323
'promoId': '43e35910-c168-4634-ad4f-52fd764a843f',
24+
'timing': 25000 / 1000, # in seconds
25+
'attempts': 25,
2426
},
2527
2: {
2628
'name': 'Chain Cube 2048',
2729
'appToken': 'd1690a07-3780-4068-810f-9b5bbf2931b2',
2830
'promoId': 'b4170868-cef0-424f-8eb9-be0622e8e8e3',
31+
'timing': 25000 / 1000,
32+
'attempts': 20,
2933
},
3034
3: {
3135
'name': 'My Clone Army',
3236
'appToken': '74ee0b5b-775e-4bee-974f-63e7f4d5bacb',
3337
'promoId': 'fe693b26-b342-4159-8808-15e3ff7f8767',
38+
'timing': 180000 / 1000,
39+
'attempts': 30,
3440
},
3541
4: {
3642
'name': 'Train Miner',
3743
'appToken': '82647f43-3f87-402d-88dd-09a90025313f',
3844
'promoId': 'c4480ac7-e178-4973-8061-9ed5b2e17954',
45+
'timing': 20000 / 1000,
46+
'attempts': 15,
3947
},
4048
5: {
4149
'name': 'Merge Away',
4250
'appToken': '8d1cc2ad-e097-4b86-90ef-7a27e19fb833',
43-
'promoId': 'dc128d28-c45b-411c-98ff-ac7726fbaea4'
51+
'promoId': 'dc128d28-c45b-411c-98ff-ac7726fbaea4',
52+
'timing': 20000 / 1000,
53+
'attempts': 25,
4454
},
4555
6: {
4656
'name': 'Twerk Race 3D',
4757
'appToken': '61308365-9d16-4040-8bb0-2f4a4c69074c',
48-
'promoId': '61308365-9d16-4040-8bb0-2f4a4c69074c'
58+
'promoId': '61308365-9d16-4040-8bb0-2f4a4c69074c',
59+
'timing': 20000 / 1000,
60+
'attempts': 20,
4961
}
5062
}
5163

52-
EVENTS_DELAY = 20000 / 1000 # converting milliseconds to seconds
53-
5464

5565
async def load_proxies(file_path):
5666
try:
@@ -124,21 +134,21 @@ async def generate_key(client_token, promo_id, proxies):
124134
return data['promoCode']
125135

126136

127-
async def generate_key_process(app_token, promo_id, proxies):
137+
async def generate_key_process(app_token, promo_id, proxies, timing, attempts):
128138
client_id = await generate_client_id()
129139
logger.info(f"Generated client ID: {client_id}")
130140
client_token = await login(client_id, app_token, proxies)
131141
if not client_token:
132142
logger.error(f"Failed to generate client token for client ID: {client_id}")
133143
return None
134144

135-
for i in range(25):
136-
logger.info(f"Emulating progress event {i + 1}/11 for client ID: {client_id}")
137-
await asyncio.sleep(EVENTS_DELAY * (random.random() / 3 + 1))
145+
for i in range(attempts):
146+
logger.info(f"Emulating progress event {i + 1}/{attempts} for client ID: {client_id}")
147+
await asyncio.sleep(timing * (random.random() / 3 + 1))
138148
try:
139149
has_code = await emulate_progress(client_token, promo_id, proxies)
140150
except httpx.HTTPStatusError:
141-
logger.warning(f"Event {i + 1}/15 failed for client ID: {client_id}")
151+
logger.warning(f"Event {i + 1}/{attempts} failed for client ID: {client_id}")
142152
continue
143153

144154
if has_code:
@@ -170,7 +180,16 @@ async def main(game_choice, key_count, proxies):
170180

171181
spinner = asyncio.create_task(spinner_task()) # Start the spinner task
172182

173-
tasks = [generate_key_process(game['appToken'], game['promoId'], proxies) for _ in range(key_count)]
183+
tasks = [
184+
generate_key_process(
185+
game['appToken'],
186+
game['promoId'],
187+
proxies,
188+
game['timing'],
189+
game['attempts']
190+
)
191+
for _ in range(key_count)
192+
]
174193
keys = await asyncio.gather(*tasks)
175194

176195
spinner.cancel() # Stop the spinner task

0 commit comments

Comments
 (0)