From 82f5a9d2f64a69b034e98413ea2514af9cbf2a32 Mon Sep 17 00:00:00 2001 From: oldnapalm <38410858+oldnapalm@users.noreply.github.com> Date: Thu, 12 Dec 2024 08:05:20 -0300 Subject: [PATCH] Update schedule --- cdn/gameassets/MapSchedule_v2.xml | 636 ++++++----------------- cdn/gameassets/PortalRoadSchedule_v1.xml | 243 +++++---- scripts/gen_schedule.py | 53 +- 3 files changed, 353 insertions(+), 579 deletions(-) diff --git a/cdn/gameassets/MapSchedule_v2.xml b/cdn/gameassets/MapSchedule_v2.xml index 80683fac..9f1b2b1a 100644 --- a/cdn/gameassets/MapSchedule_v2.xml +++ b/cdn/gameassets/MapSchedule_v2.xml @@ -1,506 +1,206 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + - + - - + + - - - - - - - + + + + + + + - + - - + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - + + - - + + - + - - - + + + - - + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - + + + + - - - - + + + + + + + + + 1 diff --git a/cdn/gameassets/PortalRoadSchedule_v1.xml b/cdn/gameassets/PortalRoadSchedule_v1.xml index b807d699..aa1d63f0 100644 --- a/cdn/gameassets/PortalRoadSchedule_v1.xml +++ b/cdn/gameassets/PortalRoadSchedule_v1.xml @@ -2,106 +2,149 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 diff --git a/scripts/gen_schedule.py b/scripts/gen_schedule.py index 9b11fd09..5005f0eb 100755 --- a/scripts/gen_schedule.py +++ b/scripts/gen_schedule.py @@ -8,6 +8,7 @@ import json from xml.dom import minidom +from dateutil.relativedelta import relativedelta MAPS = ['FRANCE', 'INNSBRUCK', 'LONDON', 'MAKURIISLANDS', 'RICHMOND', 'SCOTLAND'] @@ -15,9 +16,13 @@ appts = dom.getElementsByTagName('appointments')[0] now = datetime.datetime.now(datetime.timezone.utc).replace(day=1) +maps_loop = [] prev_map = None -for i in range(0, 500): - map_choice = random.choice(MAPS) +for _ in range(0, 200): + if not maps_loop: + maps_loop = list(MAPS) + random.shuffle(maps_loop) + map_choice = maps_loop.pop() while map_choice == prev_map: map_choice = random.choice(MAPS) prev_map = map_choice @@ -38,20 +43,46 @@ dom = minidom.parseString('1') appts = dom.getElementsByTagName('appointments')[0] -now = datetime.datetime.now(datetime.timezone.utc) +month = datetime.datetime.now(datetime.timezone.utc).replace(day=1) +climbs_loop = [] +climbs_loop_month = [] prev_climb = None -for i in range(0, 100): - climb_choice = random.choice(CLIMBS) - while climb_choice == prev_climb: - climb_choice = random.choice(CLIMBS) - prev_climb = climb_choice +prev_climb_month = None +for _ in range(0, 13): + if not climbs_loop_month: + climbs_loop_month = list(CLIMBS) + random.shuffle(climbs_loop_month) + climb_choice_month = climbs_loop_month.pop() + while climb_choice_month == prev_climb_month: + climb_choice_month = random.choice(CLIMBS) + prev_climb_month = climb_choice_month appt = dom.createElement('appointment') - appt.setAttribute('road', climb_choice) + appt.setAttribute('road', climb_choice_month) + appt.setAttribute('world', '10') + appt.setAttribute('portal_of_month', 'true') appt.setAttribute('portal', '0') - appt.setAttribute('start', now.strftime("%Y-%m-%dT00:01-04")) + appt.setAttribute('start', month.strftime("%Y-%m-%dT00:01-04")) appts.appendChild(appt) - now += datetime.timedelta(days=2) + day = month + month += relativedelta(months=+1) + + for _ in range(0, 10): + if not climbs_loop: + climbs_loop = list(CLIMBS) + random.shuffle(climbs_loop) + climb_choice = climbs_loop.pop() + while climb_choice == prev_climb or climb_choice == climb_choice_month: + climb_choice = random.choice(CLIMBS) + prev_climb = climb_choice + appt = dom.createElement('appointment') + appt.setAttribute('road', climb_choice) + appt.setAttribute('world', '1') + appt.setAttribute('portal', '0') + appt.setAttribute('start', day.strftime("%Y-%m-%dT00:01-04")) + + appts.appendChild(appt) + day += datetime.timedelta(days=3) with open('PortalRoadSchedule_v1.xml', 'w') as f: f.write(dom.toprettyxml())