Skip to content

Commit

Permalink
Added individual timing and attempt!
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ShafiqSadat authored Aug 18, 2024
1 parent 5cb37ce commit fca76c0
Showing 1 changed file with 29 additions and 10 deletions.
39 changes: 29 additions & 10 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,46 @@
'name': 'Riding Extreme 3D',
'appToken': 'd28721be-fd2d-4b45-869e-9f253b554e50',
'promoId': '43e35910-c168-4634-ad4f-52fd764a843f',
'timing': 25000 / 1000, # in seconds
'attempts': 25,
},
2: {
'name': 'Chain Cube 2048',
'appToken': 'd1690a07-3780-4068-810f-9b5bbf2931b2',
'promoId': 'b4170868-cef0-424f-8eb9-be0622e8e8e3',
'timing': 25000 / 1000,
'attempts': 20,
},
3: {
'name': 'My Clone Army',
'appToken': '74ee0b5b-775e-4bee-974f-63e7f4d5bacb',
'promoId': 'fe693b26-b342-4159-8808-15e3ff7f8767',
'timing': 180000 / 1000,
'attempts': 30,
},
4: {
'name': 'Train Miner',
'appToken': '82647f43-3f87-402d-88dd-09a90025313f',
'promoId': 'c4480ac7-e178-4973-8061-9ed5b2e17954',
'timing': 20000 / 1000,
'attempts': 15,
},
5: {
'name': 'Merge Away',
'appToken': '8d1cc2ad-e097-4b86-90ef-7a27e19fb833',
'promoId': 'dc128d28-c45b-411c-98ff-ac7726fbaea4'
'promoId': 'dc128d28-c45b-411c-98ff-ac7726fbaea4',
'timing': 20000 / 1000,
'attempts': 25,
},
6: {
'name': 'Twerk Race 3D',
'appToken': '61308365-9d16-4040-8bb0-2f4a4c69074c',
'promoId': '61308365-9d16-4040-8bb0-2f4a4c69074c'
'promoId': '61308365-9d16-4040-8bb0-2f4a4c69074c',
'timing': 20000 / 1000,
'attempts': 20,
}
}

EVENTS_DELAY = 20000 / 1000 # converting milliseconds to seconds


async def load_proxies(file_path):
try:
Expand Down Expand Up @@ -124,21 +134,21 @@ async def generate_key(client_token, promo_id, proxies):
return data['promoCode']


async def generate_key_process(app_token, promo_id, proxies):
async def generate_key_process(app_token, promo_id, proxies, timing, attempts):
client_id = await generate_client_id()
logger.info(f"Generated client ID: {client_id}")
client_token = await login(client_id, app_token, proxies)
if not client_token:
logger.error(f"Failed to generate client token for client ID: {client_id}")
return None

for i in range(25):
logger.info(f"Emulating progress event {i + 1}/11 for client ID: {client_id}")
await asyncio.sleep(EVENTS_DELAY * (random.random() / 3 + 1))
for i in range(attempts):
logger.info(f"Emulating progress event {i + 1}/{attempts} for client ID: {client_id}")
await asyncio.sleep(timing * (random.random() / 3 + 1))
try:
has_code = await emulate_progress(client_token, promo_id, proxies)
except httpx.HTTPStatusError:
logger.warning(f"Event {i + 1}/15 failed for client ID: {client_id}")
logger.warning(f"Event {i + 1}/{attempts} failed for client ID: {client_id}")
continue

if has_code:
Expand Down Expand Up @@ -170,7 +180,16 @@ async def main(game_choice, key_count, proxies):

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

tasks = [generate_key_process(game['appToken'], game['promoId'], proxies) for _ in range(key_count)]
tasks = [
generate_key_process(
game['appToken'],
game['promoId'],
proxies,
game['timing'],
game['attempts']
)
for _ in range(key_count)
]
keys = await asyncio.gather(*tasks)

spinner.cancel() # Stop the spinner task
Expand Down

0 comments on commit fca76c0

Please sign in to comment.