From eae8836b255eded05330cdebf7da47a689a2c628 Mon Sep 17 00:00:00 2001 From: robojumper Date: Thu, 9 May 2024 16:27:27 +0200 Subject: [PATCH 1/3] Counters dump --- dump.yaml | 800 ++++++++++++++++++++++++++++++++++++++ logic/dump.py | 13 +- logic/logic_expression.py | 37 ++ randoscript.py | 4 +- 4 files changed, 851 insertions(+), 3 deletions(-) diff --git a/dump.yaml b/dump.yaml index 635c11858..38b495351 100644 --- a/dump.yaml +++ b/dump.yaml @@ -12957,3 +12957,803 @@ dungeon_completion_requirements: Ancient Cistern: \Ancient Cistern\Flame Room\Farore's Flame Sandship: \Sandship\Boss Room\Nayru's Flame Fire Sanctuary: \Fire Sanctuary\Flame Room\Din's Flame +well_known_requirements: + open_got: \GoT Opening Requirement + raise_got: \GoT Raising Requirement + horde_door: \Horde Door Requirement + impa_song_check: \Faron\Sealed Grounds\Sealed Temple\Song from Impa + complete_triforce: \Complete Triforce +options: + Open Thunderhead option: + type: query + option: open-thunderhead + op: eq + value: Open + negation: false + Open ET option: + type: query + option: open-et + op: eq + value: true + negation: false + Open LMF option: + type: query + option: open-lmf + op: eq + value: Open + negation: false + LMF Nodes On option: + type: query + option: open-lmf + op: eq + value: Main Node + negation: false + Floria Gates option: + type: query + option: open-lake-floria + op: eq + value: Floria Gates + negation: false + Talk to Yerbal option: + type: query + option: open-lake-floria + op: eq + value: Talk to Yerbal + negation: false + Vanilla Lake Floria option: + type: query + option: open-lake-floria + op: eq + value: Vanilla + negation: false + Open Lake Floria option: + type: query + option: open-lake-floria + op: eq + value: Open + negation: false + Randomized Beedle option: + type: query + option: shopsanity + op: eq + value: true + negation: false + Gondo Upgrades On option: + type: query + option: gondo-upgrades + op: eq + value: true + negation: true + FS Lava Flow option: + type: query + option: fs-lava-flow + op: eq + value: true + negation: false + BiT patches: + type: query + option: bit-patches + op: eq + value: Fix BiT Crashes + negation: false + Nonlethal Hot Cave: + type: query + option: damage-multiplier + op: lt + value: 12 + negation: false + Upgraded Skyward Strike option: + type: query + option: upgraded-skyward-strike + op: eq + value: true + negation: false + Bomb Throws Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Bomb Throws + negation: false + Long Range Skyward Strike Jumpslash Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Long Range Skyward Strike Jumpslash + negation: false + Advanced Lizalfos Combat Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Advanced Lizalfos Combat + negation: false + Waterfall Cave Jump Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Waterfall Cave Jump + negation: false + Beedle's Shop With Bombs Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Beedle's Shop With Bombs + negation: false + Baby Rattle from Beedle's Shop Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Baby Rattle from Beedle's Shop + negation: false + Sky Keep Entrance Jump Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Sky Keep Entrance Jump + negation: false + Gravestone Jump Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Gravestone Jump + negation: false + Sky - Volcanic Island Dive Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Sky - Volcanic Island Dive + negation: false + Sky - Beedle's Island Cage Chest Dive Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Sky - Beedle's Island Cage Chest Dive + negation: false + Thunderhead - East Island Dive Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Thunderhead - East Island Dive + negation: false + Gym's Rope Jump Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Gym's Rope Jump + negation: false + Early Lake Floria - Fence Hop Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Early Lake Floria - Fence Hop + negation: false + Early Lake Floria - Swordless Rope Floria Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Early Lake Floria - Swordless Rope Floria + negation: false + Faron - Bokoblin Luring Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Faron - Bokoblin Luring + negation: false + Stuttersprint Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Stuttersprint + negation: false + Itemless First Timeshift Stone Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Itemless First Timeshift Stone + negation: false + Lanayru Mine - Quick Bomb Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Lanayru Mine - Quick Bomb + negation: false + Brakeslide Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Brakeslide + negation: false + Lanayru Desert - Ampilus Bomb Toss Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Lanayru Desert - Ampilus Bomb Toss + negation: false + Temple of Time - Slingshot Shot Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Temple of Time - Slingshot Shot + negation: false + Temple of Time Skip - Brakeslide Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Temple of Time Skip - Brakeslide + negation: false + Secret Passageway Hook Beetle Opening Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Secret Passageway Hook Beetle Opening + negation: false + Lightning Node End with Bombs Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Lightning Node End with Bombs + negation: false + Cactus Bomb Whip Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Cactus Bomb Whip + negation: false + Skipper's Retreat Fast Clawshots Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Skipper's Retreat Fast Clawshots + negation: false + Pirate Stronghold - Beetle Pillar Checks Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Pirate Stronghold - Beetle Pillar Checks + negation: false + Skyview - Spider Roll Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Skyview - Spider Roll + negation: false + Skyview Slingshot Shot Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Skyview Slingshot Shot + negation: false + Earth Temple - Keese Yeet Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Earth Temple - Keese Yeet + negation: false + Earth Temple - Slope Stuttersprint Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Earth Temple - Slope Stuttersprint + negation: false + Earth Temple - Bomb Flower Scaldera Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Earth Temple - Bomb Flower Scaldera + negation: false + LMF - Whip First Room Switch Trick: + type: query + option: enabled-tricks-bitless + op: in + value: LMF - Whip First Room Switch + negation: false + LMF - Keylocked Slingshot Trickshot Trick: + type: query + option: enabled-tricks-bitless + op: in + value: LMF - Keylocked Slingshot Trickshot + negation: false + LMF - Whip Armos Room Timeshift Stone Trick: + type: query + option: enabled-tricks-bitless + op: in + value: LMF - Whip Armos Room Timeshift Stone + negation: false + LMF - Minecart Jump Trick: + type: query + option: enabled-tricks-bitless + op: in + value: LMF - Minecart Jump + negation: false + LMF - Moldarach without Gust Bellows Trick: + type: query + option: enabled-tricks-bitless + op: in + value: LMF - Moldarach without Gust Bellows + negation: false + Ancient Cistern - Cistern Clip Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Ancient Cistern - Cistern Clip + negation: false + Ancient Cistern - Cistern Whip Room Clip Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Ancient Cistern - Cistern Whip Room Clip + negation: false + Ancient Cistern - Map Chest Jump Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Ancient Cistern - Map Chest Jump + negation: false + Ancient Cistern - Lever Jump Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Ancient Cistern - Lever Jump + negation: false + Ancient Cistern - Basement Highflip Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Ancient Cistern - Basement Highflip + negation: false + Sandship - No Combination Hint Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Sandship - No Combination Hint + negation: false + Sandship - Itemless Spume Skip Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Sandship - Itemless Spume Skip + negation: false + Sandship - Mast Jump Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Sandship - Mast Jump + negation: false + Fire Sanctuary - Pillar Jump Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Fire Sanctuary - Pillar Jump + negation: false + Fire Sanctuary - Swordless Pillar Jump Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Fire Sanctuary - Swordless Pillar Jump + negation: false + Fire Sanctuary - No Bombable Wall Hint Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Fire Sanctuary - No Bombable Wall Hint + negation: false + Sky Keep - Shooting LMF Bow Switches in Present Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Sky Keep - Shooting LMF Bow Switches in Present + negation: false + Sky Keep - FS Room Clawshots Vine Clip Trick: + type: query + option: enabled-tricks-bitless + op: in + value: Sky Keep - FS Room Clawshots Vine Clip + negation: false +counters: + Gratitude Crystals: !!python/object:logic.logic_expression.Counter + targets: + - !!python/tuple + - !!set + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 110 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 111 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 112 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 113 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 114 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 115 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 116 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 117 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 118 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 119 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 120 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 121 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 122 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 123 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 124 + : null + - !!python/name:logic.logic_expression.%3Clambda%3E '' + - !!python/tuple + - !!set + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 128 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 129 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 130 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 131 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 132 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 133 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 134 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 135 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 136 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 137 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 125 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 126 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 127 + : null + - !!python/name:logic.logic_expression.%3Clambda%3E '' + limit: .inf + Wallet Capacity: !!python/object:logic.logic_expression.Counter + targets: + - !!python/tuple + - !!set + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 232 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 233 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 234 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 235 + : null + - !!python/name:logic.logic_expression.%3Clambda%3E '' + - !!python/tuple + - !!set + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 85 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 86 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 87 + : null + - !!python/name:logic.logic_expression.%3Clambda%3E '' + limit: .inf + Unique Rupees: !!python/object:logic.logic_expression.Counter + targets: + - !!python/tuple + - !!set + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 138 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 139 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 140 + : null + - !!python/name:logic.logic_expression.%3Clambda%3E '' + - !!python/tuple + - !!set + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 14 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 15 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 16 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 17 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 18 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 19 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 20 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 21 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 22 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 23 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 24 + : null + - !!python/name:logic.logic_expression.%3Clambda%3E '' + - !!python/tuple + - !!set + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 256 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 257 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 258 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 259 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 260 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 261 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 262 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 263 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 264 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 265 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 266 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 267 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 268 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 269 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 270 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 271 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 272 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 273 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 274 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 275 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 276 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 277 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 278 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 279 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 280 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 281 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 282 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 283 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 284 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 285 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 286 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 287 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 288 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 289 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 248 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 249 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 250 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 251 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 252 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 253 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 254 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 255 + : null + - !!python/name:logic.logic_expression.%3Clambda%3E '' + - !!python/tuple + - !!set + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 309 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 310 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 311 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 312 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 313 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 314 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 315 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 316 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 317 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 318 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 319 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 320 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 321 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 322 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 323 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 324 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 325 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 326 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 327 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 328 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 329 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 330 + : null + - !!python/name:logic.logic_expression.%3Clambda%3E '' + - !!python/tuple + - !!set + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 98 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 99 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 100 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 101 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 102 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 103 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 104 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 105 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 106 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 107 + : null + ? !!python/object/new:logic.inventory.EXTENDED_ITEM + - 108 + : null + - !!python/name:logic.logic_expression.%3Clambda%3E '' + limit: .inf diff --git a/logic/dump.py b/logic/dump.py index bb1437de3..c6c64c6ba 100644 --- a/logic/dump.py +++ b/logic/dump.py @@ -1,5 +1,5 @@ from logic.constants import * - +from logic.inventory import EXTENDED_ITEM def dump_constants(short_to_full): """ @@ -18,6 +18,13 @@ def dump_constants(short_to_full): "dungeon_completion_requirements": { k: short_to_full(v) for k, v in DUNGEON_FINAL_CHECK.items() }, + "well_known_requirements": { + "open_got": short_to_full(GOT_OPENING_REQUIREMENT), + "raise_got": short_to_full(GOT_RAISING_REQUIREMENT), + "horde_door": short_to_full(HORDE_DOOR_REQUIREMENT), + "impa_song_check": short_to_full(SONG_IMPA_CHECK), + "complete_triforce": short_to_full(COMPLETE_TRIFORCE), + } } @@ -41,3 +48,7 @@ def dungeon(pool, short_to_full): ), "exit_from_inside": short_to_full(exit_from_dungeon), } + + +def dump_counters_and_options(): + return { "options": EXTENDED_ITEM.options, "counters": EXTENDED_ITEM.counters } \ No newline at end of file diff --git a/logic/logic_expression.py b/logic/logic_expression.py index 10e8eb103..534981626 100644 --- a/logic/logic_expression.py +++ b/logic/logic_expression.py @@ -51,6 +51,9 @@ def with_options(self, options, required_dungeons): @staticmethod def parse(text: str) -> QueryExpression: raise NotImplementedError + + def represent(self): + raise NotImplementedError def QueryElseBanned(query: QueryExpression) -> QueryExpression: @@ -80,6 +83,9 @@ def eval(self, options: Options, required_dungeons: List[str]) -> bool: if self.negation: return not options[self.option] return options[self.option] + + def represent(self): + return { "type": "query", "option": self.option, "op": "eq", "value": True, "negation": self.negation } @dataclass @@ -92,6 +98,9 @@ def eval(self, options: Options, required_dungeons: List[str]) -> bool: if self.negation: return options[self.option] != self.value return options[self.option] == self.value + + def represent(self): + return { "type": "query", "option": self.option, "op": "eq", "value": self.value, "negation": self.negation } @dataclass @@ -104,6 +113,9 @@ def eval(self, options: Options, required_dungeons: List[str]) -> bool: if self.negation: return options[self.option] >= self.threshold return options[self.option] < self.threshold + + def represent(self): + return { "type": "query", "option": self.option, "op": "lt", "value": self.threshold, "negation": self.negation } @dataclass @@ -116,6 +128,9 @@ def eval(self, options: Options, required_dungeons: List[str]) -> bool: if self.negation: return options[self.option] <= self.threshold return options[self.option] > self.threshold + + def represent(self): + return { "type": "query", "option": self.option, "op": "gt", "value": self.threshold, "negation": self.negation } @dataclass @@ -128,6 +143,9 @@ def eval(self, options: Options, required_dungeons: List[str]) -> bool: if self.negation: return self.value not in options[self.option] return self.value in options[self.option] + + def represent(self): + return { "type": "query", "option": self.option, "op": "in", "value": self.value, "negation": self.negation } @dataclass @@ -139,6 +157,9 @@ def eval(self, options: Options, required_dungeons: List[str]) -> bool: if self.negation: return self.dungeon not in required_dungeons return self.dungeon in required_dungeons + + def represent(self): + return { "type": "req_dungeon", "dungeon": self.dungeon, "negation": self.negation } @dataclass @@ -147,6 +168,9 @@ class QueryAndCombination(QueryExpression): def eval(self, options: Options, required_dungeons: List[str]) -> bool: return all(arg.eval(options, required_dungeons) for arg in self.arguments) + + def represent(self): + return { "type": "combination", "op": "and", "args": [arg.represent() for arg in self.arguments] } @dataclass @@ -155,6 +179,9 @@ class QueryOrCombination(QueryExpression): def eval(self, options: Options, required_dungeons: List[str]) -> bool: return any(arg.eval(options, required_dungeons) for arg in self.arguments) + + def represent(self): + return { "type": "combination", "op": "and", "args": [arg.represent() for arg in self.arguments] } # Parsing @@ -885,6 +912,9 @@ def unknown_atom_representer(dumper, data): def combination_representer(dumper, data): return dumper.represent_scalar("tag:yaml.org,2002:str", str(data), "folded") +def option_representer(dumper: yaml.Dumper, data): + return dumper.represent_dict(data.represent()) + yaml.add_representer(BasicTextAtom, text_atom_representer) yaml.add_representer(EmptyReq, true_atom_representer) @@ -892,3 +922,10 @@ def combination_representer(dumper, data): yaml.add_representer(UnknownReq, unknown_atom_representer) yaml.add_representer(AndCombination, combination_representer) yaml.add_representer(OrCombination, combination_representer) +yaml.add_representer(QueryBoolOption, option_representer) +yaml.add_representer(QueryOption, option_representer) +yaml.add_representer(QueryLessThanOption, option_representer) +yaml.add_representer(QueryGreaterThanOption, option_representer) +yaml.add_representer(QueryContainerOption, option_representer) +yaml.add_representer(QueryAndCombination, option_representer) +yaml.add_representer(QueryOrCombination, option_representer) \ No newline at end of file diff --git a/randoscript.py b/randoscript.py index a7ca12179..bbd8ac385 100644 --- a/randoscript.py +++ b/randoscript.py @@ -3,7 +3,7 @@ import argparse import yaml import json -from logic.dump import dump_constants +from logic.dump import dump_constants, dump_counters_and_options from logic.logic_input import Areas from yaml_files import requirements, checks, hints, map_exits @@ -132,7 +132,7 @@ def main(): with open(dest, mode="w") as f: yaml.Dumper.ignore_aliases = lambda *args: True yaml.dump( - {**areas.to_dict(), **dump_constants(areas.short_to_full)}, + {**areas.to_dict(), **dump_constants(areas.short_to_full), **dump_counters_and_options()}, f, sort_keys=False, ) From ca04d84018159c364a8fdcba2b49ae4d0b45339e Mon Sep 17 00:00:00 2001 From: robojumper Date: Sat, 18 May 2024 18:19:25 +0200 Subject: [PATCH 2/3] Dump counters --- dump.yaml | 449 ++++---------------------------------- logic/dump.py | 5 +- logic/logic_expression.py | 116 +++++++--- randoscript.py | 6 +- 4 files changed, 134 insertions(+), 442 deletions(-) diff --git a/dump.yaml b/dump.yaml index 38b495351..aef6a0c3d 100644 --- a/dump.yaml +++ b/dump.yaml @@ -13349,411 +13349,50 @@ options: value: Sky Keep - FS Room Clawshots Vine Clip negation: false counters: - Gratitude Crystals: !!python/object:logic.logic_expression.Counter + Gratitude Crystals: targets: - - !!python/tuple - - !!set - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 110 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 111 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 112 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 113 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 114 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 115 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 116 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 117 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 118 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 119 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 120 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 121 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 122 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 123 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 124 - : null - - !!python/name:logic.logic_expression.%3Clambda%3E '' - - !!python/tuple - - !!set - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 128 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 129 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 130 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 131 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 132 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 133 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 134 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 135 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 136 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 137 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 125 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 126 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 127 - : null - - !!python/name:logic.logic_expression.%3Clambda%3E '' - limit: .inf - Wallet Capacity: !!python/object:logic.logic_expression.Counter + - item: Gratitude Crystal + expression: + type: mul + factor: 1 + - item: Gratitude Crystal Pack + expression: + type: mul + factor: 5 + Wallet Capacity: targets: - - !!python/tuple - - !!set - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 232 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 233 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 234 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 235 - : null - - !!python/name:logic.logic_expression.%3Clambda%3E '' - - !!python/tuple - - !!set - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 85 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 86 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 87 - : null - - !!python/name:logic.logic_expression.%3Clambda%3E '' - limit: .inf - Unique Rupees: !!python/object:logic.logic_expression.Counter + - item: Progressive Wallet + expression: + type: lookup + dict: + 0: 300 + 1: 500 + 2: 1000 + 3: 5000 + 4: 9000 + - item: Extra Wallet + expression: + type: mul + factor: 300 + Unique Rupees: targets: - - !!python/tuple - - !!set - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 138 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 139 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 140 - : null - - !!python/name:logic.logic_expression.%3Clambda%3E '' - - !!python/tuple - - !!set - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 14 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 15 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 16 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 17 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 18 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 19 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 20 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 21 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 22 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 23 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 24 - : null - - !!python/name:logic.logic_expression.%3Clambda%3E '' - - !!python/tuple - - !!set - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 256 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 257 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 258 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 259 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 260 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 261 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 262 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 263 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 264 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 265 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 266 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 267 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 268 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 269 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 270 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 271 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 272 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 273 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 274 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 275 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 276 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 277 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 278 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 279 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 280 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 281 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 282 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 283 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 284 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 285 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 286 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 287 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 288 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 289 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 248 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 249 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 250 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 251 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 252 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 253 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 254 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 255 - : null - - !!python/name:logic.logic_expression.%3Clambda%3E '' - - !!python/tuple - - !!set - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 309 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 310 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 311 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 312 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 313 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 314 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 315 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 316 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 317 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 318 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 319 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 320 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 321 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 322 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 323 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 324 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 325 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 326 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 327 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 328 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 329 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 330 - : null - - !!python/name:logic.logic_expression.%3Clambda%3E '' - - !!python/tuple - - !!set - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 98 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 99 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 100 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 101 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 102 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 103 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 104 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 105 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 106 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 107 - : null - ? !!python/object/new:logic.inventory.EXTENDED_ITEM - - 108 - : null - - !!python/name:logic.logic_expression.%3Clambda%3E '' - limit: .inf + - item: Green Rupee + expression: + type: mul + factor: 1 + - item: Blue Rupee + expression: + type: mul + factor: 5 + - item: Red Rupee + expression: + type: mul + factor: 20 + - item: Silver Rupee + expression: + type: mul + factor: 100 + - item: Gold Rupee + expression: + type: mul + factor: 300 diff --git a/logic/dump.py b/logic/dump.py index c6c64c6ba..b68a74d7c 100644 --- a/logic/dump.py +++ b/logic/dump.py @@ -1,6 +1,7 @@ from logic.constants import * from logic.inventory import EXTENDED_ITEM + def dump_constants(short_to_full): """ Some things aren't defined in the YAML files but instead hardcoded in the rando source files. @@ -24,7 +25,7 @@ def dump_constants(short_to_full): "horde_door": short_to_full(HORDE_DOOR_REQUIREMENT), "impa_song_check": short_to_full(SONG_IMPA_CHECK), "complete_triforce": short_to_full(COMPLETE_TRIFORCE), - } + }, } @@ -51,4 +52,4 @@ def dungeon(pool, short_to_full): def dump_counters_and_options(): - return { "options": EXTENDED_ITEM.options, "counters": EXTENDED_ITEM.counters } \ No newline at end of file + return {"options": EXTENDED_ITEM.options, "counters": EXTENDED_ITEM.counters} diff --git a/logic/logic_expression.py b/logic/logic_expression.py index 534981626..21dd7f69b 100644 --- a/logic/logic_expression.py +++ b/logic/logic_expression.py @@ -51,8 +51,8 @@ def with_options(self, options, required_dungeons): @staticmethod def parse(text: str) -> QueryExpression: raise NotImplementedError - - def represent(self): + + def dump(self): raise NotImplementedError @@ -83,9 +83,15 @@ def eval(self, options: Options, required_dungeons: List[str]) -> bool: if self.negation: return not options[self.option] return options[self.option] - - def represent(self): - return { "type": "query", "option": self.option, "op": "eq", "value": True, "negation": self.negation } + + def dump(self): + return { + "type": "query", + "option": self.option, + "op": "eq", + "value": True, + "negation": self.negation, + } @dataclass @@ -98,9 +104,15 @@ def eval(self, options: Options, required_dungeons: List[str]) -> bool: if self.negation: return options[self.option] != self.value return options[self.option] == self.value - - def represent(self): - return { "type": "query", "option": self.option, "op": "eq", "value": self.value, "negation": self.negation } + + def dump(self): + return { + "type": "query", + "option": self.option, + "op": "eq", + "value": self.value, + "negation": self.negation, + } @dataclass @@ -113,9 +125,15 @@ def eval(self, options: Options, required_dungeons: List[str]) -> bool: if self.negation: return options[self.option] >= self.threshold return options[self.option] < self.threshold - - def represent(self): - return { "type": "query", "option": self.option, "op": "lt", "value": self.threshold, "negation": self.negation } + + def dump(self): + return { + "type": "query", + "option": self.option, + "op": "lt", + "value": self.threshold, + "negation": self.negation, + } @dataclass @@ -128,9 +146,15 @@ def eval(self, options: Options, required_dungeons: List[str]) -> bool: if self.negation: return options[self.option] <= self.threshold return options[self.option] > self.threshold - - def represent(self): - return { "type": "query", "option": self.option, "op": "gt", "value": self.threshold, "negation": self.negation } + + def dump(self): + return { + "type": "query", + "option": self.option, + "op": "gt", + "value": self.threshold, + "negation": self.negation, + } @dataclass @@ -143,9 +167,15 @@ def eval(self, options: Options, required_dungeons: List[str]) -> bool: if self.negation: return self.value not in options[self.option] return self.value in options[self.option] - - def represent(self): - return { "type": "query", "option": self.option, "op": "in", "value": self.value, "negation": self.negation } + + def dump(self): + return { + "type": "query", + "option": self.option, + "op": "in", + "value": self.value, + "negation": self.negation, + } @dataclass @@ -157,9 +187,13 @@ def eval(self, options: Options, required_dungeons: List[str]) -> bool: if self.negation: return self.dungeon not in required_dungeons return self.dungeon in required_dungeons - - def represent(self): - return { "type": "req_dungeon", "dungeon": self.dungeon, "negation": self.negation } + + def dump(self): + return { + "type": "req_dungeon", + "dungeon": self.dungeon, + "negation": self.negation, + } @dataclass @@ -168,9 +202,13 @@ class QueryAndCombination(QueryExpression): def eval(self, options: Options, required_dungeons: List[str]) -> bool: return all(arg.eval(options, required_dungeons) for arg in self.arguments) - - def represent(self): - return { "type": "combination", "op": "and", "args": [arg.represent() for arg in self.arguments] } + + def dump(self): + return { + "type": "combination", + "op": "and", + "args": [arg.dump() for arg in self.arguments], + } @dataclass @@ -179,9 +217,13 @@ class QueryOrCombination(QueryExpression): def eval(self, options: Options, required_dungeons: List[str]) -> bool: return any(arg.eval(options, required_dungeons) for arg in self.arguments) - - def represent(self): - return { "type": "combination", "op": "and", "args": [arg.represent() for arg in self.arguments] } + + def dump(self): + return { + "type": "combination", + "op": "and", + "args": [arg.dump() for arg in self.arguments], + } # Parsing @@ -851,6 +893,8 @@ def mk_pair(self, a, b): def mk_counter_atom(self, item, c): if item not in RAW_ITEM_NAMES and item not in EXTENDED_ITEM: raise ValueError(f"Unknown item {item}") + if GLOBAL_DUMP_MODE: + return [{"item": str(item), "expression": c}] if item in EXTENDED_ITEM: return [({EXTENDED_ITEM[item]}, c)] s = {EXTENDED_ITEM[number(item, index)] for index in range(ITEM_COUNTS[item])} @@ -859,11 +903,15 @@ def mk_counter_atom(self, item, c): def mk_counter_multiplier(self, count, item): count = int(count) c = lambda n: count * n + if GLOBAL_DUMP_MODE: + c = {"type": "mul", "factor": count} return self.mk_counter_atom(item, c) def mk_counter_value_list(self, item, *counts): counts_dict = {i: int(count) for i, count in enumerate(counts)} c = lambda n: counts_dict[n] + if GLOBAL_DUMP_MODE: + c = {"type": "lookup", "dict": counts_dict} return self.mk_counter_atom(item, c) def mk_counter_add(self, left, right): @@ -912,8 +960,13 @@ def unknown_atom_representer(dumper, data): def combination_representer(dumper, data): return dumper.represent_scalar("tag:yaml.org,2002:str", str(data), "folded") + def option_representer(dumper: yaml.Dumper, data): - return dumper.represent_dict(data.represent()) + return dumper.represent_dict(data.dump()) + + +def counter_representer(dumper: yaml.Dumper, data: Counter): + return dumper.represent_dict({"targets": data.targets}) yaml.add_representer(BasicTextAtom, text_atom_representer) @@ -922,10 +975,5 @@ def option_representer(dumper: yaml.Dumper, data): yaml.add_representer(UnknownReq, unknown_atom_representer) yaml.add_representer(AndCombination, combination_representer) yaml.add_representer(OrCombination, combination_representer) -yaml.add_representer(QueryBoolOption, option_representer) -yaml.add_representer(QueryOption, option_representer) -yaml.add_representer(QueryLessThanOption, option_representer) -yaml.add_representer(QueryGreaterThanOption, option_representer) -yaml.add_representer(QueryContainerOption, option_representer) -yaml.add_representer(QueryAndCombination, option_representer) -yaml.add_representer(QueryOrCombination, option_representer) \ No newline at end of file +yaml.add_multi_representer(QueryExpression, option_representer) +yaml.add_representer(Counter, counter_representer) diff --git a/randoscript.py b/randoscript.py index bbd8ac385..afc3eff8a 100644 --- a/randoscript.py +++ b/randoscript.py @@ -132,7 +132,11 @@ def main(): with open(dest, mode="w") as f: yaml.Dumper.ignore_aliases = lambda *args: True yaml.dump( - {**areas.to_dict(), **dump_constants(areas.short_to_full), **dump_counters_and_options()}, + { + **areas.to_dict(), + **dump_constants(areas.short_to_full), + **dump_counters_and_options(), + }, f, sort_keys=False, ) From 427daf4cb3632ad940602ccf53fb28685f14c579 Mon Sep 17 00:00:00 2001 From: robojumper Date: Sat, 18 May 2024 19:00:36 +0200 Subject: [PATCH 3/3] Typo --- logic/logic_expression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logic/logic_expression.py b/logic/logic_expression.py index 21dd7f69b..2f198244c 100644 --- a/logic/logic_expression.py +++ b/logic/logic_expression.py @@ -221,7 +221,7 @@ def eval(self, options: Options, required_dungeons: List[str]) -> bool: def dump(self): return { "type": "combination", - "op": "and", + "op": "or", "args": [arg.dump() for arg in self.arguments], }