mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 12:11:33 -06:00

* Adds some events, renames things, fails for many players. * Adds entrance rules for requires hints. * Cleanup and add goal item. * Cleanup. * Add additional rule. * Event and regions additions. * Updates from merge. * Adds collect behavior option. * Fix missing generator location. * Fix whitespace and optimize imports. * Switch location order back. * Add name replacement for storage. * Fix test failure. * Improve puzzle hints required. * Add missing locations and cleanup indirect conditions. * Fix naming. * PR feedback. * Missed comment. * Cleanup imports, use strings for option equivalence, and update option description. * Fix rule. * Create rolling buffer goal items and remove goal items and location from default options. * Cleanup. * Removes dateutil. * Fixes Subterranean World information plaque.
26 lines
841 B
Python
26 lines
841 B
Python
import json
|
|
import os
|
|
import pkgutil
|
|
from datetime import datetime
|
|
|
|
|
|
def load_data_file(*args) -> dict:
|
|
fname = "/".join(["data", *args])
|
|
return json.loads(pkgutil.get_data(__name__, fname).decode())
|
|
|
|
|
|
def relative_years_from_today(dt2: datetime) -> int:
|
|
today = datetime.now()
|
|
years = today.year - dt2.year
|
|
if today.month < dt2.month or (today.month == dt2.month and today.day < dt2.day):
|
|
years -= 1
|
|
return years
|
|
|
|
|
|
location_id_offset: int = 27000
|
|
location_info = load_data_file("locations.json")
|
|
location_name_to_id = {name: location_id_offset + index for index, name in enumerate(location_info["all_locations"])}
|
|
exclusion_info = load_data_file("excluded_locations.json")
|
|
region_info = load_data_file("regions.json")
|
|
years_since_sep_30_1980 = relative_years_from_today(datetime.fromisoformat("1980-09-30"))
|