From b33991578b717c3a23a591ff949e7b476b87c080 Mon Sep 17 00:00:00 2001 From: Zach Parks Date: Wed, 2 Oct 2024 10:06:00 -0500 Subject: [PATCH 01/20] Breaking things... again. --- .idea/csv-editor.xml | 30 +++++ data/entrances.csv | 26 ++++ data/locations.csv | 165 +++++++++++++++++++++++ data/regions.csv | 23 ++++ package.json | 1 + pnpm-lock.yaml | 13 ++ src/definitions.ts | 303 ------------------------------------------- src/rules.ts | 256 +++++++++++++++++++++++------------- src/types.ts | 34 +++++ 9 files changed, 458 insertions(+), 393 deletions(-) create mode 100644 .idea/csv-editor.xml create mode 100644 data/entrances.csv create mode 100644 data/locations.csv create mode 100644 data/regions.csv delete mode 100644 src/definitions.ts create mode 100644 src/types.ts diff --git a/.idea/csv-editor.xml b/.idea/csv-editor.xml new file mode 100644 index 0000000..cea8333 --- /dev/null +++ b/.idea/csv-editor.xml @@ -0,0 +1,30 @@ + + + + + + \ No newline at end of file diff --git a/data/entrances.csv b/data/entrances.csv new file mode 100644 index 0000000..9126aa9 --- /dev/null +++ b/data/entrances.csv @@ -0,0 +1,26 @@ +STAGE,ORDER,X,Y,ID,RULES +BoB,1,102,529,91, +WF,2,690,631,241,STARS:1 +JRB,3,671,957,121,STARS:3 +CCM,4,525,528,51,STARS:3 +BBH,5,689,370,41,STARS:12 +HMC,6,1448,778,71,ACCESS:B1 +LLL,7,1169,686,221,ACCESS:B1 +SSL,8,1060,822,81,ACCESS:B1 +DDD,9,1519,994,231,ACCESS:B1 STARS:B1 +SL,10,1104,524,101,ACCESS:F2 +WDW,11,1420,520,111,ACCESS:F2 +TTM,12,1398,336,361,ACCESS:F2 +THIh,13,1682,648,131,ACCESS:F2 +THIt,14,1682,376,132,ACCESS:F2 +TTC,15,1364,104,141,ACCESS:F3 LG/TJ/SF/BF/WK +RR,16,1587,168,151,ACCESS:F3 TJ/SF/BF +BitDW,17,322,308,171,STARS:F1 +BitFS,18,1565,994,191,ACCESS:B1 STARS:B1 SUB +BitS,19,1366,520,null,ACCESS:F3 STARS:F3 +PSS,20,648,762,271,STARS:1 +SA,21,456,874,201,STARS:3 SF/BF | STARS:3 TJ LG | STARS:3 MOVELESS TJ +WMotR,22,1142,168,311,ACCESS:F3 TJ/SF/BF +TotWC,23,286,814,291,STARS:10 +CotMC,24,910,143,281,ACCESS:HMC +VCutM,25,1828,885,181,ACCESS:B1 GP diff --git a/data/locations.csv b/data/locations.csv new file mode 100644 index 0000000..1d02fee --- /dev/null +++ b/data/locations.csv @@ -0,0 +1,165 @@ +LOCATION,REGION,ADDRESS,TYPE,RULES +Big Bob-omb on the Summit,BoB,3626000,Star +Footrace with Koopa the Quick,BoB,3626001,Star +Shoot to the Island in the Sky,BoB:Island,3626002,Star +Find the 8 Red Coins,BoB:Island,3626003,RedCoins, +Mario Wings to the Sky,BoB,3626004,Star,CANN WC | CAPLESS CANN +Behind Chain Chomp's Gate,BoB,3626005,Star,GP | MOVELESS +100 Coins Star,BoB,3626006,100Coins,CANN WC | CANNLESS WC TJ +Bob-omb Buddy,BoB,3626200,Buddy +Chip off Whomp's Block,WF,3626007,Star,GP +To the Top of the Fortress,WF:Tower,3626008,Star +Shoot into the Wild Blue,WF,3626009,Star,WK TJ/SF | CANN +Red Coins on the Floating Isle,WF,3626010,RedCoins +Fall onto the Caged Island,WF,3626011,Star,CL GP | MOVELESS TJ | MOVELESS LJ | MOVELESS CANN +Blast Away the Wall,WF,3626012,Star,CANN | CANNLESS LG +100 Coins Star,WF,3626013,100Coins,GP | MOVELESS +Bob-omb Buddy,WF:Tower,3626201,Buddy +Plunder in the Sunken Ship,JRB,3626014,Star +Can the Eel Come out to Play?,JRB,3626015,Star +Treasure of the Ocean Cave,JRB,3626016,Star +Red Coins on the Ship Afloat,JRB:Upper,3626017,RedCoins,CANN | CL/TJ | MOVELESS BF/WK +Blast to the Stone Pillar,JRB,3626018,Star,CANN CL | CANN MOVELESS | CANNLESS MOVELESS +Through the Jet Stream,JRB,3626019,Star,MC | CAPLESS +100 Coins Star,JRB:Upper,3626020,100Coins,GP +Bob-omb Buddy,JRB,3626202,Buddy +Slip Slidin' Away,CCM,3626021,Star +Li'l Penguin Lost,CCM,3626022,Star +Big Penguin Race,CCM,3626023,Star +Frosty Slide for 8 Red Coins,CCM,3626024,RedCoins +Snowman's Lost his Head,CCM,3626025,Star +Wall Kicks will Work,CCM,3626026,Star,CANN TJ/WK | CANNLESS TJ/WK | MOVELESS +100 Coins Star,CCM,3626027,100Coins +Bob-omb Buddy,CCM,3626203,Buddy +1-Up Block Near Snowman,CCM,3626215,MushBlock +1-Up Block Near Ice Pillar,CCM,3626216,MushBlock +1-Up Block in Secret Slide,CCM,3626217,MushBlock +Go on a Ghost Hunt,BBH,3626028,Star +Ride Big Boo's Merry-Go-Round,BBH,3626029,Star +Secret of the Haunted Books,BBH,3626030,Star,KI | MOVELESS +Seek the 8 Red Coins,BBH,3626031,RedCoins,BF/WK/TJ/SF +Big Boo's Balcony,BBH:Roof,3626032,Star +Eye to Eye in the Secret Room,BBH:ThirdFloor,3626033,Star,VC +100 Coins Star,BBH,3626034,100Coins +1-Up Block on Top of the Mansion,BBH:Roof,3626218,MushBlock +Swimming Beast in the Cavern,HMC,3626035,Star +Elevate for 8 Red Coins,HMC:RedCoinArea,3626036,RedCoins +Metal-Head Mario Can Move!,HMC,3626037,Star,LJ MC | CAPLESS LJ TJ | CAPLESS MOVELESS LJ/TJ/WK +Navigating the Toxic Maze,HMC,3626038,Star,WK/SF/BF/TJ +A-Maze-Ing Emergency Exit,HMC:PitIslands,3626039,Star +Watch for Rolling Rocks,HMC,3626040,Star,WK +100 Coins Star,HMC:RedCoinArea,3626041,100Coins,GP +1-Up Block Above the Pit,HMC:PitIslands,3626219,MushBlock +1-Up Block Past Rolling Rocks,HMC,3626220,MushBlock +Boil the Big Bully,LLL,3626042,Star +Bully the Bullies,LLL,3626043,Star +8-Coin Puzzle with 15 Pieces,LLL,3626044,RedCoins +Red-Hot Log Rolling,LLL,3626045,Star +Hot-Foot-It into the Volcano,LLL:UpperVolcano,3626046,Star +Elevator Tour in the Volcano,LLL:UpperVolcano,3626047,Star +100 Coins Star,LLL,3626048,100Coins +In the Talons of the Big Bird,SSL,3626049,Star +Shining Atop the Pyramid,SSL,3626050,Star +Inside the Ancient Pyramid,SSL:UpperPyramid,3626051,Star +Stand Tall on the Four Pillars,SSL:UpperPyramid,3626052,Star,TJ WC GP | CANN WC GP | CAPLESS TJ/SF/BF | MOVELESS +Free Flying for 8 Red Coins,SSL,3626053,RedCoins,TJ WC | CANN WC | CAPLESS TJ/SF/BF | CAPLESS MOVELESS +Pyramid Puzzle,SSL:UpperPyramid,3626054,Star +100 Coins Star,SSL,3626055,100Coins,GP | CL TJ/BF/SF/LG | MOVELESS +Bob-omb Buddy,SSL,3626207,Buddy +1-Up Block Outside Pyramid,SSL,3626221,MushBlock +1-Up Block in the Pyramid's Left Path,SSL,3626222,MushBlock, +1-Up Block in the Pyramid's Back,SSL,3626223,MushBlock +Board Bowser's Sub,DDD,3626056,Star +Chests in the Current,DDD,3626057,Star +Pole-Jumping for Red Coins,DDD,3626058,RedCoins,CL BOWSER2 | MOVELESS TJ DV LG WK +Through the Jet Stream,DDD,3626059,Star,MC | CAPLESS +The Manta Ray's Reward,DDD,3626060,Star +Collect the Caps...,DDD,3626061,Star,VC MC | CAPLESS VC +100 Coins Star,DDD,3626062,100Coins,CL GP BOWSER2 | MOVELESS TJ DV LG WK GP +Snowman's Big Head,SL,3626063,Star,BF/SF/TJ | CANN +Chill with the Bully,SL,3626064,Star +In the Deep Freeze,SL,3626065,Star,WK/SF/LG/BF/TJ | CANN +Whirl from the Freezing Pond,SL,3626066,Star +Shell Shreddin' for Red Coins,SL,3626067,RedCoins +Into the Igloo,SL,3626068,Star,VC TJ/SF/BF/WK/LG | MOVELESS VC +100 Coins Star,SL,3626069,100Coins,VC | CAPLESS +Bob-omb Buddy,SL,3626209,Buddy +1-Up Block Near Moneybags,SL,3626224,MushBlock +1-Up Block Inside the Igloo,SL,3626225,MushBlock +Shocking Arrow Lifts!,WDW:Top,3626070,Star +Top o' the Town,WDW:Top,3626071,Star +Secrets in the Shallows Sky,WDW:Top,3626072,Star +Express Elevator--Hurry Up!,WDW,3626073,Star +Go to Town for Red Coins,WDW:Downtown,3626074,RedCoins,WK | MOVELESS TJ +Quick Race Through Downtown!,WDW:Downtown,3626075,Star,VC WK/BF | VC TJ LG | MOVELESS VC TJ +100 Coins Star,WDW:Top,3626076,100Coins,GP | NAR LG TJ/SF/BF | CANN | MOVELESS TJ DV +Bob-omb Buddy,WDW:Top,3626210,Buddy,TJ | SF LG | NAR BF/SF +1-Up Block in the Downtown,WDW:Downtown,3626226,MushBlock +Scale the Mountain,TTM:Top,3626077,Star +Mystery of the Monkey Cage,TTM:Top,3626078,Star +"Scary 'Shrooms, Red Coins",TTM,3626079,RedCoins +Mysterious Mountainside,TTM:Top,3626080,Star +Breathtaking View from Bridge,TTM:Top,3626081,Star +Blast to the Lonely Mushroom,TTM,3626082,Star,CANN | CANNLESS LJ | MOVELESS CANNLESS +100 Coins Star,TTM:Top,3626083,100Coins +Bob-omb Buddy,TTM,3626211,Buddy +1-Up Block on the Red Mushroom,TTM,3626227,MushBlock +Pluck the Piranha Flower,THI:Pipes,3626084,Star +The Tip Top of the Huge Island,THI:Pipes,3626085,Star +Rematch with Koopa the Quick,THI:Pipes,3626086,Star +Five Itty Bitty Secrets,THI:Pipes,3626087,Star +Wiggler's Red Coins,THI:Pipes,3626088,RedCoins,WK +Make Wiggler Squirm,THI:LargeTop,3626089,Star,GP | MOVELESS DV +100 Coins Star,THI:LargeTop,3626090,100Coins,GP +Bob-omb Buddy,THI:Pipes,3626212,Buddy +1-Up Block Near Tiny Start,THI:Pipes,3626228,MushBlock +1-Up Block Near Huge Start,THI:Pipes,3626229,MushBlock +1-Up Block in the Windy Area,THI:Pipes,3626230,MushBlock +Roll into the Cage,TTC:Lower,3626091,Star +The Pit and the Pendulums,TTC:Upper,3626092,Star +Get a Hand,TTC:Lower,3626093,Star +Stomp on the Thwomp,TTC:Top,3626094,Star +Timed Jumps on Moving Bars,TTC:Upper,3626095,Star +Stop Time for Red Coins,TTC,3626096,RedCoins,NAR | LG/TJ/SF/BF/WK +100 Coins Star,TTC,3626097,100Coins,GP +1-Up Block Midway Up,TTC:Top,3626231,MushBlock +1-Up Block at the Top,TTC:Top,3626232,MushBlock +Cruiser Crossing the Rainbow,RR:Cruiser,3626098,Star +The Big House in the Sky,RR:House,3626099,Star +Coins Amassed in a Maze,RR:Maze,3626100,RedCoins +Swingin' in the Breeze,RR,3626101,Star,LG/TJ/BF/SF | MOVELESS +Tricky Triangles!,RR,3626102,Star,LG/TJ/BF/SF | MOVELESS +Somewhere over the Rainbow,RR:Cruiser,3626103,Star,CANN +100 Coins Star,RR:Maze,3626104,100Coins,GP WK +Bob-omb Buddy,RR,3626214,Buddy +1-Up Block Above the Red Coin Maze,RR,3626233,MushBlock +1-Up Block Under Fly Guy,RR,3626234,MushBlock +1-Up Block on the House in the Sky,RR:House,3626235,MushBlock +End of the Slide Block,PSS,3626126,Star +Finish under 21 Seconds,PSS,3626127,Star +The Aquarium Red Coins,SA,3626161,RedCoins +First Bowser's Key,BitDW,3626178,BowserKey +Dark World Red Coins,BitDW,3626105,RedCoins +1-Up Block on the Tower,BitDW,3626236,MushBlock +1-Up Block Near the Goombas,BitDW,3626237,MushBlock +Second Bowser's Key,BitFS:Upper,3626179,BowserKey +Fire Sea Red Coins,BitFS:Upper,3626112,RedCoins +1-Up Block on the Swaying Stairs,BitFS:Upper,3626238,MushBlock +1-Up Block Near the Poles,BitFS:Upper,3626239,MushBlock +Sky Red Coins,BitS:Top,3626119,RedCoins, +1-Up Block on the Rotating Platform,BitS,3626240,MushBlock +Wing Cap Switch,TotWC,3626181,RedSwitch +Tower Red Coins,TotWC,3626140,RedCoins +Metal Cap Switch,CotMC,3626182,GreenSwitch +Cavern Red Coins,CotMC,3626133,RedCoins,MC | CAPLESS +1-Up Block Above the Rushing River,CotMC,3626241,MushBlock +Vanish Cap Switch,VCutM,3626183,BlueSwitch,WK/TJ/BF/SF/LG | MOVELESS +Moat Red Coins,VCutM,3626147,RedCoins,WK/TJ/BF/SF/LG VC | CAPLESS WK +1-Up Block on the Slope Platform,VCutM,3626242,MushBlock +Rainbow Red Coins,WMotR,3626154,RedCoins,WC TJ +Rainbow 1-Up Block,WMotR,3626243,MushBlock,WC TJ +Basement Toad's Gift,PPC,3626168,Star,ACCESS:B1 STARS:12 +Second Floor Toad's Gift,PPC,3626169,Star,ACCESS:F2 STARS:25 +Third Floor Toad's Gift,PPC,3626170,Star,ACCESS:F3 STARS:35 +MIPS the Rabbit,PPC,3626171,Star,ACCESS:B1 STARS:MIPS1 +MIPS the Rabbit II,PPC,3626172,Star,ACCESS:B1 STARS:MIPS2 diff --git a/data/regions.csv b/data/regions.csv new file mode 100644 index 0000000..817832e --- /dev/null +++ b/data/regions.csv @@ -0,0 +1,23 @@ +REGION,PARENT,RULES +BoB:Island,BoB,CANN | CANNLESS WC TJ | CAPLESS CANNLESS LJ +WF:Tower,WF,GP +JRB:Upper,JRB,TJ/BF/SF/WK | MOVELESS LG +BBH:ThirdFloor,BBH,WK LG | MOVELESS WK +BBH:Roof,BBH:ThirdFloor,LJ | MOVELESS +HMC:RedCoinArea,HMC,CL WK/LG/BF/SF/TJ | MOVELESS WK +HMC:PitIslands,HMC,TJ CL | MOVELESS WK TJ/LJ | MOVELESS WK SF LG +LLL:UpperVolcano,LLL,CL +SSL:UpperPyramid,SSL,CL TJ/BF/SF/LG | MOVELESS +WDW:Top,WDW,WK/TJ/SF/BF | MOVELESS +WDW:Downtown,WDW,NAR LG TJ/SF/BF | CANN | MOVELESS TJ DV +TTM:Top,TTM,LJ/DV LG/KI | MOVELESS TJ | MOVELESS WK SF/LG | MOVELESS KI/DV +THI:Pipes,THI,NAR | LJ/TJ/DV/LG | MOVELESS BF/SF/KI +THI:LargeTop,THI:Pipes,NAR | LJ/TJ/DV | MOVELESS +TTC:Lower,TTC,LG/TJ/SF/BF/WK +TTC:Upper,TTC:Lower,CL | MOVELESS WK +TTC:Top,TTC:Upper,TJ LG | MOVELESS WK/TJ +RR:Maze,RR,WK | LJ SF/BF/TJ | MOVELESS LG/TJ +RR:Cruiser,RR,WK/SF/BF/LG/TJ +RR:House,RR,TJ/SF/BF/LG +BitFS:Upper,BitFS,CL +BitS:Top,BitS,CL TJ | CL SF LG | MOVELESS TJ WK LG diff --git a/package.json b/package.json index fc46bc6..332f4a9 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "typescript-to-lua": "^1.26.2" }, "dependencies": { + "dedent": "^1.5.3", "yaml": "^2.5.1" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fd692db..6c39a5a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,9 @@ importers: .: dependencies: + dedent: + specifier: ^1.5.3 + version: 1.5.3 yaml: specifier: ^2.5.1 version: 2.5.1 @@ -256,6 +259,14 @@ packages: supports-color: optional: true + dedent@1.5.3: + resolution: {integrity: sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ==} + peerDependencies: + babel-plugin-macros: ^3.1.0 + peerDependenciesMeta: + babel-plugin-macros: + optional: true + deep-is@0.1.4: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} @@ -869,6 +880,8 @@ snapshots: dependencies: ms: 2.1.3 + dedent@1.5.3: {} + deep-is@0.1.4: {} enhanced-resolve@5.17.1: diff --git a/src/definitions.ts b/src/definitions.ts deleted file mode 100644 index 72fb17d..0000000 --- a/src/definitions.ts +++ /dev/null @@ -1,303 +0,0 @@ -/* eslint-disable @stylistic/no-multi-spaces,@stylistic/array-bracket-spacing */ -import { Entrance } from "./entrance.ts"; -import { Location, Region, regions } from "./location.ts"; -import { rule } from "./rules.ts"; - -export const entrances: Entrance[] = [ - // Course Stages - new Entrance("BoB", 1, [ 102, 529], 91), - new Entrance("WF", 2, [ 690, 631], 241, rule("STARS:1")), - new Entrance("JRB", 3, [ 671, 957], 121, rule("STARS:3")), - new Entrance("CCM", 4, [ 525, 528], 51, rule("STARS:3")), - new Entrance("BBH", 5, [ 689, 370], 41, rule("STARS:12")), - new Entrance("HMC", 6, [1448, 778], 71, rule("BASEMENT")), - new Entrance("LLL", 7, [1169, 686], 221, rule("BASEMENT")), - new Entrance("SSL", 8, [1060, 822], 81, rule("BASEMENT")), - new Entrance("DDD", 9, [1519, 994], 231, rule("BASEMENT & BOWSER2")), - new Entrance("SL", 10, [1104, 524], 101, rule("SECONDFLOOR")), - new Entrance("WDW", 11, [1420, 520], 111, rule("SECONDFLOOR")), - new Entrance("TTM", 12, [1398, 336], 361, rule("SECONDFLOOR")), - new Entrance("THIh", 13, [1682, 648], 131, rule("SECONDFLOOR")), - new Entrance("THIt", 14, [1682, 376], 132, rule("SECONDFLOOR")), - new Entrance("TTC", 15, [1364, 104], 141, rule("THIRDFLOOR & LG/TJ/SF/BF/WK")), - new Entrance("RR", 16, [1587, 168], 151, rule("THIRDFLOOR & TJ/SF/BF")), - - // Bowser Stages - new Entrance("BitDW", 17, [ 322, 308], 171, rule("BOWSER1")), - new Entrance("BitFS", 18, [1565, 994], 191, rule("BASEMENT & BOWSER2 & SUB")), - new Entrance("BitS", 19, [1366, 520], null, rule("THIRDFLOOR & BOWSER3")), - - // Secret Stages (excl. Bowser Stages) - new Entrance("PSS", 20, [ 648, 762], 271, rule("STARS:1")), - new Entrance("SA", 21, [ 456, 874], 201, rule("STARS:3 & SF/BF | STARS:3 & TJ & LG | STARS:3 & MOVELESS & TJ")), - new Entrance("WMotR", 22, [1142, 168], 311, rule("THIRDFLOOR & TJ/SF/BF")), - new Entrance("TotWC", 23, [ 286, 814], 291, rule("STARS:10")), - new Entrance("CotMC", 24, [ 910, 143], 281, rule("HMC")), - new Entrance("VCutM", 25, [1828, 885], 181, rule("BASEMENT & GP")), -]; - -// Logical Regions -new Region("BoB"); -new Region("BoB:Island", regions["BoB"], rule("CANN:BoB | CANNLESS & WC & TJ | CAPLESS & CANNLESS & LJ")); -new Region("WF"); -new Region("WF:Tower", regions["WF"], rule("GP")); -new Region("JRB"); -new Region("JRB:Upper", regions["JRB"], rule("TJ/BF/SF/WK | MOVELESS & LG")); -new Region("CCM"); -new Region("BBH"); -new Region("BBH:ThirdFloor", regions["BBH"], rule("WK & LG | MOVELESS & WK")); -new Region("BBH:Roof", regions["BBH:ThirdFloor"], rule("LJ | MOVELESS")); -new Region("HMC"); -new Region("HMC:RedCoinArea", regions["HMC"], rule("CL & WK/LG/BF/SF/TJ | MOVELESS & WK")); -new Region("HMC:PitIslands", regions["HMC"], rule("TJ & CL | MOVELESS & WK & TJ/LJ | MOVELESS & WK & SF & LG")); -new Region("LLL"); -new Region("LLL:UpperVolcano", regions["LLL"], rule("CL")); -new Region("SSL"); -new Region("SSL:UpperPyramid", regions["SSL"], rule("CL & TJ/BF/SF/LG | MOVELESS")); -new Region("DDD"); -new Region("SL"); -new Region("WDW"); -new Region("WDW:Top", regions["WDW"], rule("WK/TJ/SF/BF | MOVELESS")); -new Region("WDW:Downtown", regions["WDW"], rule("NAR & LG & TJ/SF/BF | CANN:WDW | MOVELESS & TJ & DV")); -new Region("TTM"); -new Region("TTM:Top", regions["TTM"], rule("LJ/DV & LG/KI | MOVELESS & TJ | MOVELESS & WK & SF/LG | MOVELESS & KI/DV")); -new Region("THI"); -new Region("THI:Pipes", regions["THI"], rule("NAR | LJ/TJ/DV/LG | MOVELESS & BF/SF/KI")); -new Region("THI:LargeTop", regions["THI:Pipes"], rule("NAR | LJ/TJ/DV | MOVELESS")); -new Region("TTC"); -new Region("TTC:Lower", regions["TTC"], rule("LG/TJ/SF/BF/WK")); -new Region("TTC:Upper", regions["TTC:Lower"], rule("CL | MOVELESS & WK")); -new Region("TTC:Top", regions["TTC:Upper"], rule("TJ & LG | MOVELESS & WK/TJ")); -new Region("RR"); -new Region("RR:Maze", regions["RR"], rule("WK | LJ & SF/BF/TJ | MOVELESS & LG/TJ")); -new Region("RR:Cruiser", regions["RR"], rule("WK/SF/BF/LG/TJ")); -new Region("RR:House", regions["RR"], rule("TJ/SF/BF/LG")); -new Region("BitDW"); -new Region("BitFS"); -new Region("BitFS:Upper", regions["BitFS"], rule("CL")); -new Region("BitS"); -new Region("BitS:Top", regions["BitS"], rule("CL & TJ | CL & SF & LG | MOVELESS & TJ & WK & LG")); -new Region("TotWC"); -new Region("CotMC"); -new Region("VCutM"); -new Region("PSS"); -new Region("SA"); -new Region("WMotR"); -new Region("PPC"); - -// Individual Locations -export const locations: Location[] = [ - // 1. Bob-omb Battlefield - new Location("Big Bob-omb on the Summit", "BoB", 3626000, "Star"), - new Location("Footrace with Koopa the Quick", "BoB", 3626001, "Star"), - new Location("Shoot to the Island in the Sky", "BoB:Island", 3626002, "Star"), - new Location("Find the 8 Red Coins", "BoB:Island", 3626003, "RedCoins"), - new Location("Mario Wings to the Sky", "BoB", 3626004, "Star", rule("CANN:BoB & WC | CAPLESS & CANN:BoB")), - new Location("Behind Chain Chomp's Gate", "BoB", 3626005, "Star", rule("GP | MOVELESS")), - new Location("100 Coins Star", "BoB", 3626006, "100Coins", rule("CANN:BoB & WC | CANNLESS & WC & TJ")), - new Location("Bob-omb Buddy", "BoB", 3626200, "Buddy"), - - // 2. Whomp's Fortress - new Location("Chip off Whomp's Block", "WF", 3626007, "Star", rule("GP")), - new Location("To the Top of the Fortress", "WF:Tower", 3626008, "Star"), - new Location("Shoot into the Wild Blue", "WF", 3626009, "Star", rule("WK & TJ/SF | CANN:WF")), - new Location("Red Coins on the Floating Isle", "WF", 3626010, "RedCoins"), - new Location("Fall onto the Caged Island", "WF", 3626011, "Star", rule("CL & GP | MOVELESS & TJ | MOVELESS & LJ | MOVELESS & CANN:WF")), - new Location("Blast Away the Wall", "WF", 3626012, "Star", rule("CANN:WF | CANNLESS & LG")), - new Location("100 Coins Star", "WF", 3626013, "100Coins", rule("GP | MOVELESS")), - new Location("Bob-omb Buddy", "WF:Tower", 3626201, "Buddy"), - - // 3. Jolly Roger Bay - new Location("Plunder in the Sunken Ship", "JRB", 3626014, "Star"), - new Location("Can the Eel Come out to Play?", "JRB", 3626015, "Star"), - new Location("Treasure of the Ocean Cave", "JRB", 3626016, "Star"), - new Location("Red Coins on the Ship Afloat", "JRB:Upper", 3626017, "RedCoins", rule("CANN:JRB | CL/TJ | MOVELESS & BF/WK")), - new Location("Blast to the Stone Pillar", "JRB", 3626018, "Star", rule("CANN:JRB & CL | CANN:JRB & MOVELESS | CANNLESS & MOVELESS")), - new Location("Through the Jet Stream", "JRB", 3626019, "Star", rule("MC | CAPLESS")), - new Location("100 Coins Star", "JRB:Upper", 3626020, "100Coins", rule("GP")), - new Location("Bob-omb Buddy", "JRB", 3626202, "Buddy"), - - // 4. Cool, Cool Mountain - new Location("Slip Slidin' Away", "CCM", 3626021, "Star"), - new Location("Li'l Penguin Lost", "CCM", 3626022, "Star"), - new Location("Big Penguin Race", "CCM", 3626023, "Star"), - new Location("Frosty Slide for 8 Red Coins", "CCM", 3626024, "RedCoins"), - new Location("Snowman's Lost his Head", "CCM", 3626025, "Star"), - new Location("Wall Kicks will Work", "CCM", 3626026, "Star", rule("CANN:CCM & TJ/WK | CANNLESS & TJ/WK | MOVELESS")), - new Location("100 Coins Star", "CCM", 3626027, "100Coins"), - new Location("Bob-omb Buddy", "CCM", 3626203, "Buddy"), - new Location("1-Up Block Near Snowman", "CCM", 3626215, "MushBlock"), - new Location("1-Up Block Near Ice Pillar", "CCM", 3626216, "MushBlock"), - new Location("1-Up Block in Secret Slide", "CCM", 3626217, "MushBlock"), - - // 5. Big Boo's Haunt - new Location("Go on a Ghost Hunt", "BBH", 3626028, "Star"), - new Location("Ride Big Boo's Merry-Go-Round", "BBH", 3626029, "Star"), - new Location("Secret of the Haunted Books", "BBH", 3626030, "Star", rule("KI | MOVELESS")), - new Location("Seek the 8 Red Coins", "BBH", 3626031, "RedCoins", rule("BF/WK/TJ/SF")), - new Location("Big Boo's Balcony", "BBH:Roof", 3626032, "Star"), - new Location("Eye to Eye in the Secret Room", "BBH:ThirdFloor", 3626033, "Star", rule("VC")), - new Location("100 Coins Star", "BBH", 3626034, "100Coins"), - new Location("1-Up Block on Top of the Mansion", "BBH:Roof", 3626218, "MushBlock"), - - // 6. Hazy Maze Cave - new Location("Swimming Beast in the Cavern", "HMC", 3626035, "Star"), - new Location("Elevate for 8 Red Coins", "HMC:RedCoinArea", 3626036, "RedCoins"), - new Location("Metal-Head Mario Can Move!", "HMC", 3626037, "Star", rule("LJ & MC | CAPLESS & LJ & TJ | CAPLESS & MOVELESS & LJ/TJ/WK")), - new Location("Navigating the Toxic Maze", "HMC", 3626038, "Star", rule("WK/SF/BF/TJ")), - new Location("A-Maze-Ing Emergency Exit", "HMC:PitIslands", 3626039, "Star"), - new Location("Watch for Rolling Rocks", "HMC", 3626040, "Star", rule("WK")), - new Location("100 Coins Star", "HMC:RedCoinArea", 3626041, "100Coins", rule("GP")), - new Location("1-Up Block Above the Pit", "HMC:PitIslands", 3626219, "MushBlock"), - new Location("1-Up Block Past Rolling Rocks", "HMC", 3626220, "MushBlock"), - - // 7. Lethal Lava Land - new Location("Boil the Big Bully", "LLL", 3626042, "Star"), - new Location("Bully the Bullies", "LLL", 3626043, "Star"), - new Location("8-Coin Puzzle with 15 Pieces", "LLL", 3626044, "RedCoins"), - new Location("Red-Hot Log Rolling", "LLL", 3626045, "Star"), - new Location("Hot-Foot-It into the Volcano", "LLL:UpperVolcano", 3626046, "Star"), - new Location("Elevator Tour in the Volcano", "LLL:UpperVolcano", 3626047, "Star"), - new Location("100 Coins Star", "LLL", 3626048, "100Coins"), - - // 8. Shifting Sand Land - new Location("In the Talons of the Big Bird", "SSL", 3626049, "Star"), - new Location("Shining Atop the Pyramid", "SSL", 3626050, "Star"), - new Location("Inside the Ancient Pyramid", "SSL:UpperPyramid", 3626051, "Star"), - new Location("Stand Tall on the Four Pillars", "SSL:UpperPyramid", 3626052, "Star", rule("TJ & WC & GP | CANN:SSL & WC & GP | CAPLESS & TJ/SF/BF | MOVELESS")), - new Location("Free Flying for 8 Red Coins", "SSL", 3626053, "RedCoins", rule("TJ & WC | CANN:SSL & WC | CAPLESS & TJ/SF/BF | CAPLESS & MOVELESS")), - new Location("Pyramid Puzzle", "SSL:UpperPyramid", 3626054, "Star"), - new Location("100 Coins Star", "SSL", 3626055, "100Coins", rule("GP | CL & TJ/BF/SF/LG | MOVELESS")), - new Location("Bob-omb Buddy", "SSL", 3626207, "Buddy"), - new Location("1-Up Block Outside Pyramid", "SSL", 3626221, "MushBlock"), - new Location("1-Up Block in the Pyramid's Left Path", "SSL", 3626222, "MushBlock"), - new Location("1-Up Block in the Pyramid's Back", "SSL", 3626223, "MushBlock"), - - // 9. Dire, Dire Docks - new Location("Board Bowser's Sub", "DDD", 3626056, "Star"), - new Location("Chests in the Current", "DDD", 3626057, "Star"), - new Location("Pole-Jumping for Red Coins", "DDD", 3626058, "RedCoins", rule("BEATBOWSER2 & CL | MOVELESS & TJ & DV & LG & WK")), - new Location("Through the Jet Stream", "DDD", 3626059, "Star", rule("MC | CAPLESS")), - new Location("The Manta Ray's Reward", "DDD", 3626060, "Star"), - new Location("Collect the Caps...", "DDD", 3626061, "Star", rule("VC & MC | CAPLESS & VC")), - new Location("100 Coins Star", "DDD", 3626062, "100Coins", rule("BEATBOWSER2 & CL & GP | MOVELESS & TJ & DV & LG & WK & GP")), - - // 10. Snowman's Land - new Location("Snowman's Big Head", "SL", 3626063, "Star", rule("BF/SF/TJ | CANN:SL")), - new Location("Chill with the Bully", "SL", 3626064, "Star"), - new Location("In the Deep Freeze", "SL", 3626065, "Star", rule("WK/SF/LG/BF/TJ | CANN:SL")), - new Location("Whirl from the Freezing Pond", "SL", 3626066, "Star"), - new Location("Shell Shreddin' for Red Coins", "SL", 3626067, "RedCoins"), - new Location("Into the Igloo", "SL", 3626068, "Star", rule("VC & TJ/SF/BF/WK/LG | MOVELESS & VC")), - new Location("100 Coins Star", "SL", 3626069, "100Coins", rule("VC | CAPLESS")), - new Location("Bob-omb Buddy", "SL", 3626209, "Buddy"), - new Location("1-Up Block Near Moneybags", "SL", 3626224, "MushBlock"), - new Location("1-Up Block Inside the Igloo", "SL", 3626225, "MushBlock"), - - // 11. Wet-Dry World - new Location("Shocking Arrow Lifts!", "WDW:Top", 3626070, "Star"), - new Location("Top o' the Town", "WDW:Top", 3626071, "Star"), - new Location("Secrets in the Shallows & Sky", "WDW:Top", 3626072, "Star"), - new Location("Express Elevator--Hurry Up!", "WDW", 3626073, "Star"), - new Location("Go to Town for Red Coins", "WDW:Downtown", 3626074, "RedCoins", rule("WK | MOVELESS & TJ")), - new Location("Quick Race Through Downtown!", "WDW:Downtown", 3626075, "Star", rule("VC & WK/BF | VC & TJ & LG | MOVELESS & VC & TJ")), - new Location("100 Coins Star", "WDW:Top", 3626076, "100Coins", rule("GP | NAR & LG & TJ/SF/BF | CANN:WDW | MOVELESS & TJ & DV")), - new Location("Bob-omb Buddy", "WDW:Top", 3626210, "Buddy", rule("TJ | SF & LG | NAR & BF/SF")), - new Location("1-Up Block in the Downtown", "WDW:Downtown", 3626226, "MushBlock"), - - // 12. Tall, Tall Mountain - new Location("Scale the Mountain", "TTM:Top", 3626077, "Star"), - new Location("Mystery of the Monkey Cage", "TTM:Top", 3626078, "Star"), - new Location("Scary 'Shrooms, Red Coins", "TTM", 3626079, "RedCoins"), - new Location("Mysterious Mountainside", "TTM:Top", 3626080, "Star"), - new Location("Breathtaking View from Bridge", "TTM:Top", 3626081, "Star"), - new Location("Blast to the Lonely Mushroom", "TTM", 3626082, "Star", rule("CANN:TTM | CANNLESS & LJ | MOVELESS & CANNLESS")), - new Location("100 Coins Star", "TTM:Top", 3626083, "100Coins"), - new Location("Bob-omb Buddy", "TTM", 3626211, "Buddy"), - new Location("1-Up Block on the Red Mushroom", "TTM", 3626227, "MushBlock"), - - // 13. Tiny-Huge Island - new Location("Pluck the Piranha Flower", "THI:Pipes", 3626084, "Star"), - new Location("The Tip Top of the Huge Island", "THI:Pipes", 3626085, "Star"), - new Location("Rematch with Koopa the Quick", "THI:Pipes", 3626086, "Star"), - new Location("Five Itty Bitty Secrets", "THI:Pipes", 3626087, "Star"), - new Location("Wiggler's Red Coins", "THI:Pipes", 3626088, "RedCoins", rule("WK")), - new Location("Make Wiggler Squirm", "THI:LargeTop", 3626089, "Star", rule("GP | MOVELESS & DV")), - new Location("100 Coins Star", "THI:LargeTop", 3626090, "100Coins", rule("GP")), - new Location("Bob-omb Buddy", "THI:Pipes", 3626212, "Buddy"), - new Location("1-Up Block Near Tiny Start", "THI:Pipes", 3626228, "MushBlock"), - new Location("1-Up Block Near Huge Start", "THI:Pipes", 3626229, "MushBlock"), - new Location("1-Up Block in the Windy Area", "THI:Pipes", 3626230, "MushBlock"), - - // 14. Tick Tock Clock - new Location("Roll into the Cage", "TTC:Lower", 3626091, "Star"), - new Location("The Pit and the Pendulums", "TTC:Upper", 3626092, "Star"), - new Location("Get a Hand", "TTC:Lower", 3626093, "Star"), - new Location("Stomp on the Thwomp", "TTC:Top", 3626094, "Star"), - new Location("Timed Jumps on Moving Bars", "TTC:Upper", 3626095, "Star"), - new Location("Stop Time for Red Coins", "TTC", 3626096, "RedCoins", rule("NAR | LG/TJ/SF/BF/WK")), - new Location("100 Coins Star", "TTC", 3626097, "100Coins", rule("GP")), - new Location("1-Up Block Midway Up", "TTC:Top", 3626231, "MushBlock"), - new Location("1-Up Block at the Top", "TTC:Top", 3626232, "MushBlock"), - - // 15. Rainbow Ride - new Location("Cruiser Crossing the Rainbow", "RR:Cruiser", 3626098, "Star"), - new Location("The Big House in the Sky", "RR:House", 3626099, "Star"), - new Location("Coins Amassed in a Maze", "RR:Maze", 3626100, "RedCoins"), - new Location("Swingin' in the Breeze", "RR", 3626101, "Star", rule("LG/TJ/BF/SF | MOVELESS")), - new Location("Tricky Triangles!", "RR", 3626102, "Star", rule("LG/TJ/BF/SF | MOVELESS")), - new Location("Somewhere over the Rainbow", "RR:Cruiser", 3626103, "Star", rule("CANN:RR")), - new Location("100 Coins Star", "RR:Maze", 3626104, "100Coins", rule("GP & WK")), - new Location("Bob-omb Buddy", "RR", 3626214, "Buddy"), - new Location("1-Up Block Above the Red Coin Maze", "RR", 3626233, "MushBlock"), - new Location("1-Up Block Under Fly Guy", "RR", 3626234, "MushBlock"), - new Location("1-Up Block on the House in the Sky", "RR:House", 3626235, "MushBlock"), - - // Peach's Secret Slide - new Location("End of the Slide Block", "PSS", 3626126, "Star"), - new Location("Finish under 21 Seconds", "PSS", 3626127, "Star"), - - // Secret Aquarium - new Location("The Aquarium Red Coins", "SA", 3626161, "RedCoins"), - - // Bowser in the Dark World - new Location("First Bowser's Key", "BitDW", 3626178, "BowserKey"), - new Location("Dark World Red Coins", "BitDW", 3626105, "RedCoins"), - new Location("1-Up Block on the Tower", "BitDW", 3626236, "MushBlock"), - new Location("1-Up Block Near the Goombas", "BitDW", 3626237, "MushBlock"), - - // Bowser in the Fire Sea - new Location("Second Bowser's Key", "BitFS:Upper", 3626179, "BowserKey"), - new Location("Fire Sea Red Coins", "BitFS:Upper", 3626112, "RedCoins"), - new Location("1-Up Block on the Swaying Stairs", "BitFS:Upper", 3626238, "MushBlock"), - new Location("1-Up Block Near the Poles", "BitFS:Upper", 3626239, "MushBlock"), - - // Bowser in the Sky - new Location("Sky Red Coins", "BitS:Top", 3626119, "RedCoins"), - new Location("1-Up Block on the Rotating Platform", "BitS", 3626240, "MushBlock"), - - // Tower of the Wing Cap - new Location("Wing Cap Switch", "TotWC", 3626181, "RedSwitch"), - new Location("Tower Red Coins", "TotWC", 3626140, "RedCoins"), - - // Cavern of the Metal Cap - new Location("Metal Cap Switch", "CotMC", 3626182, "GreenSwitch"), - new Location("Cavern Red Coins", "CotMC", 3626133, "RedCoins", rule("MC | CAPLESS")), - new Location("1-Up Block Above the Rushing River", "CotMC", 3626241, "MushBlock"), - - // Vanish Cap under the Moat - new Location("Vanish Cap Switch", "VCutM", 3626183, "BlueSwitch", rule("WK/TJ/BF/SF/LG | MOVELESS")), - new Location("Moat Red Coins", "VCutM", 3626147, "RedCoins", rule("WK/TJ/BF/SF/LG & VC | CAPLESS & WK")), - new Location("1-Up Block on the Slope Platform", "VCutM", 3626242, "MushBlock"), - - // Wing Mario over the Rainbow - new Location("Rainbow Red Coins", "WMotR", 3626154, "RedCoins", rule("WC & TJ")), - new Location("Rainbow 1-Up Block", "WMotR", 3626243, "MushBlock", rule("WC & TJ")), - - // Peach's Castle Interior - new Location("Basement Toad's Gift", "PPC", 3626168, "Star", rule("BASEMENT & STARS:12")), - new Location("Second Floor Toad's Gift", "PPC", 3626169, "Star", rule("SECONDFLOOR & STARS:25")), - new Location("Third Floor Toad's Gift", "PPC", 3626170, "Star", rule("THIRDFLOOR & STARS:35")), - new Location("MIPS the Rabbit", "PPC", 3626171, "Star", rule("BASEMENT & MIPS1")), - new Location("MIPS the Rabbit II", "PPC", 3626172, "Star", rule("BASEMENT & MIPS2")), -]; diff --git a/src/rules.ts b/src/rules.ts index 36f9c97..e628df6 100644 --- a/src/rules.ts +++ b/src/rules.ts @@ -1,100 +1,176 @@ -/** - * Creates a PopTracker-compatible rules array. - * @remarks OR (`|`) has higher priority than AND (`&`). Parens are not supported (yet). - * @param expressions - */ -export function rule(expressions: string): string[] { - const orExpressions = expressions.split("|").map((expr) => expr.trim()); - const allRules: string[] = []; - - for (const orExpression of orExpressions) { - const rules: string[] = []; - const andExpressions = orExpression.split("&").map((expr) => expr.trim()); - for (const andExpression of andExpressions) { - switch (andExpression) { - // Strict Accessibility Modifiers - case "MOVELESS": - rules.push("^$MoveAccessibility"); - break; - case "CAPLESS": - rules.push("^$CapsAccessibility"); - break; - case "CANNLESS": - rules.push("^$CannAccessibility"); - break; - - // Has Caps - case "VC": - case "MC": - case "WC": - rules.push(`$HasCap|${andExpression}`); - break; - - // No Area Randomizer - case "NAR": - rules.push("$NoAreaRandomizer"); - break; - - // Special DDD - case "SUB": - rules.push("$HasCompleted|3626056"); // DDD: Bowser's Sub Star - break; - case "BEATBOWSER2": - rules.push("$HasCompleted|3626179"); // Second Bowser Defeat - break; - - // HMC Access - case "HMC": - rules.push("^$CanAccessHMC"); - break; - - // Star/Key Requirements - case "BASEMENT": - rules.push("$HasKey|B"); - break; - case "SECONDFLOOR": - rules.push("$HasKey|U"); - break; - case "THIRDFLOOR": - rules.push("$HasKey|U,$HasStars|F2"); - break; - case "BOWSER1": - rules.push("$HasStars|F1"); - break; - case "BOWSER2": - rules.push("$HasStars|B1"); - break; - case "BOWSER3": - rules.push("$HasStars|F3"); - break; - case "MIPS1": - rules.push("$HasStars|MIPS1"); - break; - case "MIPS2": - rules.push("$HasStars|MIPS2"); - break; - - default: - // Star Requirements - if (andExpression.startsWith("STARS:")) { - rules.push(`$HasStars|${andExpression.replace("STARS:", "")}`); - break; +import dedent from "dedent"; + +type RuleToken = { type: AllowedTokenTypes, index: number, value?: string | number }; +type TokenMatcher = { expr: RegExp, type: AllowedTokenTypes | null, extract?: (match: string) => string }; +type AllowedTokenTypes = + | "OR" + | "MOVE_GROUP" + | "CANNON" + | "STARS" + | "ACCESS" + | "NONSTRICT" + | "NO_ER" + | "COMPLETED_SUB" + | "BEATEN_BOWSER2" + | "LITERAL" + | "EOL"; + +const acceptedTokens: TokenMatcher[] = [ + { expr: /\s+/, type: null }, + { expr: /\|/, type: "OR" }, + { + expr: /(WC|MC|VC|TJ|LJ|BF|SF|WK|DV|GP|KI|CL|LG)(\/(WC|MC|VC|TJ|LJ|BF|SF|WK|DV|GP|KI|CL|LG))*/, + type: "MOVE_GROUP", + extract: (match) => match, + }, + { expr: /(MOVELESS|CANNLESS|CAPLESS)/, type: "NONSTRICT", extract: (match) => match }, + { expr: /CANN/, type: "CANNON" }, + { expr: /STARS:\w+/, type: "STARS", extract: (match) => match.split(":")[1] }, + { expr: /NAR/, type: "NO_ER" }, + { expr: /ACCESS:\w+/, type: "ACCESS", extract: (match) => match.split(":")[1] }, + { expr: /BOWSER2/, type: "BEATEN_BOWSER2" }, + { expr: /SUB/, type: "COMPLETED_SUB" }, + { expr: /\^?\$\w+/, type: "LITERAL", extract: (match) => match }, +]; + +function* tokenize(input: string): Generator { + let index = 0; + while (index < input.length) { + let hasMatch = false; + for (const { expr, type, extract } of acceptedTokens) { + const exprMatcher = new RegExp(expr.source, "y"); + exprMatcher.lastIndex = index; + const matched = exprMatcher.exec(input); + if (matched) { + index += matched[0].length; + if (type !== null) { + const token: RuleToken = { type, index }; + if (extract) { + token.value = extract(matched[0]); } - // Has Cannon - if (andExpression.startsWith("CANN:")) { - rules.push(`$HasCannon|${andExpression.replace("CANN:", "")}`); + yield token; + } + + hasMatch = true; + } + } + + validate(hasMatch, input, index + 1); + } + + yield { type: "EOL", index: input.length }; +} + +function validate(result: boolean, input: string, index: number): void { + if (result) { + return; + } + + const message = dedent(` + Unexpected token at position: ${index - 1} + + Rule substring with error: + "${input}" + ${"^".padStart(index, " ")} + `); + + throw new SyntaxError(message); +} + +export function buildRules(input: string, stage: string): string[] { + if (input === "") { + return []; + } + + const rules = new Set(); + const subrules = new Set(); + let lastToken: RuleToken | undefined = undefined; + for (const token of tokenize(input)) { + switch (token.type) { + case "OR": + validate(!!lastToken && lastToken.type !== "OR", input, token.index); + rules.add(Array.from(subrules).sort().join(",")); + subrules.clear(); + break; + + case "MOVE_GROUP": { + const moves = new Set((token.value as string).split("/")); // Remove duplicates. + subrules.add(`$Has|${Array.from(moves).sort().join("|")}`); + break; + } + + case "CANNON": + subrules.add(`$HasCannon|${stage}`); + break; + + case "STARS": { + const value = token.value as string; + switch (value) { + case "F1": + case "B1": + case "F2": + case "F3": + case "MIPS1": + case "MIPS2": + subrules.add(`$HasStars|${value}`); break; - } - // Move Requirements - rules.push(`$HasMoves|${andExpression}`); + default: + validate(!isNaN(parseInt(value)), input, token.index); + subrules.add(`$HasStars|${value}`); + } + + break; + } + + case "ACCESS": { + const value = token.value as string; + switch (value) { + case "B1": + case "F2": + case "F3": + case "HMC": + subrules.add(`$CanAccess|${value}`); + break; + + default: + // Immediate failure. + validate(false, input, token.index); + } + + break; } + + case "NONSTRICT": + subrules.add(`^$StrictAccessibility|${token.value}`); + break; + + case "NO_ER": + subrules.add("$NoAreaRando"); + break; + + case "COMPLETED_SUB": + subrules.add("$Sub"); + break; + + case "BEATEN_BOWSER2": + subrules.add("$BeatBowser2"); + break; + + case "LITERAL": + subrules.add(token.value as string); + break; + + case "EOL": + validate(!!lastToken && lastToken.type !== "OR", input, token.index); + rules.add(Array.from(subrules).sort().join(",")); + subrules.clear(); + break; } - // Append new rule. - allRules.push(rules.join(",")); + lastToken = token; } - return allRules; + return Array.from(rules); } diff --git a/src/types.ts b/src/types.ts new file mode 100644 index 0000000..b9919d3 --- /dev/null +++ b/src/types.ts @@ -0,0 +1,34 @@ +export type LocationData = [ + name: string, + region: string, + code: number, + type: string, + // coords: [x: number, y: number], todo: someday + rules?: string, +]; + +export type RegionData = [ + name: string, + parent: string, + rules: string, +]; + +export type EntranceData = [ + name: string, + order: number, + coords: [x: number, y: number], + id: number | null, + rules: string, +]; + +export function createEntrances(...entrances: EntranceData): void { + +} + +export function createRegions(...regions: RegionData): void { + +} + +export function createLocations(...locations: LocationData): void { + +} From a71ca1b3884197a18a0d601dd25591e798ddac39 Mon Sep 17 00:00:00 2001 From: Zach Parks Date: Wed, 2 Oct 2024 10:23:00 -0500 Subject: [PATCH 02/20] TSVs are cooler --- data/entrances.csv | 26 ------- data/entrances.tsv | 26 +++++++ data/locations.csv | 165 --------------------------------------------- data/locations.tsv | 165 +++++++++++++++++++++++++++++++++++++++++++++ data/regions.csv | 23 ------- data/regions.tsv | 23 +++++++ 6 files changed, 214 insertions(+), 214 deletions(-) delete mode 100644 data/entrances.csv create mode 100644 data/entrances.tsv delete mode 100644 data/locations.csv create mode 100644 data/locations.tsv delete mode 100644 data/regions.csv create mode 100644 data/regions.tsv diff --git a/data/entrances.csv b/data/entrances.csv deleted file mode 100644 index 9126aa9..0000000 --- a/data/entrances.csv +++ /dev/null @@ -1,26 +0,0 @@ -STAGE,ORDER,X,Y,ID,RULES -BoB,1,102,529,91, -WF,2,690,631,241,STARS:1 -JRB,3,671,957,121,STARS:3 -CCM,4,525,528,51,STARS:3 -BBH,5,689,370,41,STARS:12 -HMC,6,1448,778,71,ACCESS:B1 -LLL,7,1169,686,221,ACCESS:B1 -SSL,8,1060,822,81,ACCESS:B1 -DDD,9,1519,994,231,ACCESS:B1 STARS:B1 -SL,10,1104,524,101,ACCESS:F2 -WDW,11,1420,520,111,ACCESS:F2 -TTM,12,1398,336,361,ACCESS:F2 -THIh,13,1682,648,131,ACCESS:F2 -THIt,14,1682,376,132,ACCESS:F2 -TTC,15,1364,104,141,ACCESS:F3 LG/TJ/SF/BF/WK -RR,16,1587,168,151,ACCESS:F3 TJ/SF/BF -BitDW,17,322,308,171,STARS:F1 -BitFS,18,1565,994,191,ACCESS:B1 STARS:B1 SUB -BitS,19,1366,520,null,ACCESS:F3 STARS:F3 -PSS,20,648,762,271,STARS:1 -SA,21,456,874,201,STARS:3 SF/BF | STARS:3 TJ LG | STARS:3 MOVELESS TJ -WMotR,22,1142,168,311,ACCESS:F3 TJ/SF/BF -TotWC,23,286,814,291,STARS:10 -CotMC,24,910,143,281,ACCESS:HMC -VCutM,25,1828,885,181,ACCESS:B1 GP diff --git a/data/entrances.tsv b/data/entrances.tsv new file mode 100644 index 0000000..6381c39 --- /dev/null +++ b/data/entrances.tsv @@ -0,0 +1,26 @@ +STAGE ORDER X Y ID RULES +BoB 1 102 529 91 +WF 2 690 631 241 STARS:1 +JRB 3 671 957 121 STARS:3 +CCM 4 525 528 51 STARS:3 +BBH 5 689 370 41 STARS:12 +HMC 6 1448 778 71 ACCESS:B1 +LLL 7 1169 686 221 ACCESS:B1 +SSL 8 1060 822 81 ACCESS:B1 +DDD 9 1519 994 231 ACCESS:B1 STARS:B1 +SL 10 1104 524 101 ACCESS:F2 +WDW 11 1420 520 111 ACCESS:F2 +TTM 12 1398 336 361 ACCESS:F2 +THIh 13 1682 648 131 ACCESS:F2 +THIt 14 1682 376 132 ACCESS:F2 +TTC 15 1364 104 141 ACCESS:F3 LG/TJ/SF/BF/WK +RR 16 1587 168 151 ACCESS:F3 TJ/SF/BF +BitDW 17 322 308 171 STARS:F1 +BitFS 18 1565 994 191 ACCESS:B1 STARS:B1 SUB +BitS 19 1366 520 null ACCESS:F3 STARS:F3 +PSS 20 648 762 271 STARS:1 +SA 21 456 874 201 STARS:3 SF/BF | STARS:3 TJ LG | STARS:3 MOVELESS TJ +WMotR 22 1142 168 311 ACCESS:F3 TJ/SF/BF +TotWC 23 286 814 291 STARS:10 +CotMC 24 910 143 281 ACCESS:HMC +VCutM 25 1828 885 181 ACCESS:B1 GP diff --git a/data/locations.csv b/data/locations.csv deleted file mode 100644 index 1d02fee..0000000 --- a/data/locations.csv +++ /dev/null @@ -1,165 +0,0 @@ -LOCATION,REGION,ADDRESS,TYPE,RULES -Big Bob-omb on the Summit,BoB,3626000,Star -Footrace with Koopa the Quick,BoB,3626001,Star -Shoot to the Island in the Sky,BoB:Island,3626002,Star -Find the 8 Red Coins,BoB:Island,3626003,RedCoins, -Mario Wings to the Sky,BoB,3626004,Star,CANN WC | CAPLESS CANN -Behind Chain Chomp's Gate,BoB,3626005,Star,GP | MOVELESS -100 Coins Star,BoB,3626006,100Coins,CANN WC | CANNLESS WC TJ -Bob-omb Buddy,BoB,3626200,Buddy -Chip off Whomp's Block,WF,3626007,Star,GP -To the Top of the Fortress,WF:Tower,3626008,Star -Shoot into the Wild Blue,WF,3626009,Star,WK TJ/SF | CANN -Red Coins on the Floating Isle,WF,3626010,RedCoins -Fall onto the Caged Island,WF,3626011,Star,CL GP | MOVELESS TJ | MOVELESS LJ | MOVELESS CANN -Blast Away the Wall,WF,3626012,Star,CANN | CANNLESS LG -100 Coins Star,WF,3626013,100Coins,GP | MOVELESS -Bob-omb Buddy,WF:Tower,3626201,Buddy -Plunder in the Sunken Ship,JRB,3626014,Star -Can the Eel Come out to Play?,JRB,3626015,Star -Treasure of the Ocean Cave,JRB,3626016,Star -Red Coins on the Ship Afloat,JRB:Upper,3626017,RedCoins,CANN | CL/TJ | MOVELESS BF/WK -Blast to the Stone Pillar,JRB,3626018,Star,CANN CL | CANN MOVELESS | CANNLESS MOVELESS -Through the Jet Stream,JRB,3626019,Star,MC | CAPLESS -100 Coins Star,JRB:Upper,3626020,100Coins,GP -Bob-omb Buddy,JRB,3626202,Buddy -Slip Slidin' Away,CCM,3626021,Star -Li'l Penguin Lost,CCM,3626022,Star -Big Penguin Race,CCM,3626023,Star -Frosty Slide for 8 Red Coins,CCM,3626024,RedCoins -Snowman's Lost his Head,CCM,3626025,Star -Wall Kicks will Work,CCM,3626026,Star,CANN TJ/WK | CANNLESS TJ/WK | MOVELESS -100 Coins Star,CCM,3626027,100Coins -Bob-omb Buddy,CCM,3626203,Buddy -1-Up Block Near Snowman,CCM,3626215,MushBlock -1-Up Block Near Ice Pillar,CCM,3626216,MushBlock -1-Up Block in Secret Slide,CCM,3626217,MushBlock -Go on a Ghost Hunt,BBH,3626028,Star -Ride Big Boo's Merry-Go-Round,BBH,3626029,Star -Secret of the Haunted Books,BBH,3626030,Star,KI | MOVELESS -Seek the 8 Red Coins,BBH,3626031,RedCoins,BF/WK/TJ/SF -Big Boo's Balcony,BBH:Roof,3626032,Star -Eye to Eye in the Secret Room,BBH:ThirdFloor,3626033,Star,VC -100 Coins Star,BBH,3626034,100Coins -1-Up Block on Top of the Mansion,BBH:Roof,3626218,MushBlock -Swimming Beast in the Cavern,HMC,3626035,Star -Elevate for 8 Red Coins,HMC:RedCoinArea,3626036,RedCoins -Metal-Head Mario Can Move!,HMC,3626037,Star,LJ MC | CAPLESS LJ TJ | CAPLESS MOVELESS LJ/TJ/WK -Navigating the Toxic Maze,HMC,3626038,Star,WK/SF/BF/TJ -A-Maze-Ing Emergency Exit,HMC:PitIslands,3626039,Star -Watch for Rolling Rocks,HMC,3626040,Star,WK -100 Coins Star,HMC:RedCoinArea,3626041,100Coins,GP -1-Up Block Above the Pit,HMC:PitIslands,3626219,MushBlock -1-Up Block Past Rolling Rocks,HMC,3626220,MushBlock -Boil the Big Bully,LLL,3626042,Star -Bully the Bullies,LLL,3626043,Star -8-Coin Puzzle with 15 Pieces,LLL,3626044,RedCoins -Red-Hot Log Rolling,LLL,3626045,Star -Hot-Foot-It into the Volcano,LLL:UpperVolcano,3626046,Star -Elevator Tour in the Volcano,LLL:UpperVolcano,3626047,Star -100 Coins Star,LLL,3626048,100Coins -In the Talons of the Big Bird,SSL,3626049,Star -Shining Atop the Pyramid,SSL,3626050,Star -Inside the Ancient Pyramid,SSL:UpperPyramid,3626051,Star -Stand Tall on the Four Pillars,SSL:UpperPyramid,3626052,Star,TJ WC GP | CANN WC GP | CAPLESS TJ/SF/BF | MOVELESS -Free Flying for 8 Red Coins,SSL,3626053,RedCoins,TJ WC | CANN WC | CAPLESS TJ/SF/BF | CAPLESS MOVELESS -Pyramid Puzzle,SSL:UpperPyramid,3626054,Star -100 Coins Star,SSL,3626055,100Coins,GP | CL TJ/BF/SF/LG | MOVELESS -Bob-omb Buddy,SSL,3626207,Buddy -1-Up Block Outside Pyramid,SSL,3626221,MushBlock -1-Up Block in the Pyramid's Left Path,SSL,3626222,MushBlock, -1-Up Block in the Pyramid's Back,SSL,3626223,MushBlock -Board Bowser's Sub,DDD,3626056,Star -Chests in the Current,DDD,3626057,Star -Pole-Jumping for Red Coins,DDD,3626058,RedCoins,CL BOWSER2 | MOVELESS TJ DV LG WK -Through the Jet Stream,DDD,3626059,Star,MC | CAPLESS -The Manta Ray's Reward,DDD,3626060,Star -Collect the Caps...,DDD,3626061,Star,VC MC | CAPLESS VC -100 Coins Star,DDD,3626062,100Coins,CL GP BOWSER2 | MOVELESS TJ DV LG WK GP -Snowman's Big Head,SL,3626063,Star,BF/SF/TJ | CANN -Chill with the Bully,SL,3626064,Star -In the Deep Freeze,SL,3626065,Star,WK/SF/LG/BF/TJ | CANN -Whirl from the Freezing Pond,SL,3626066,Star -Shell Shreddin' for Red Coins,SL,3626067,RedCoins -Into the Igloo,SL,3626068,Star,VC TJ/SF/BF/WK/LG | MOVELESS VC -100 Coins Star,SL,3626069,100Coins,VC | CAPLESS -Bob-omb Buddy,SL,3626209,Buddy -1-Up Block Near Moneybags,SL,3626224,MushBlock -1-Up Block Inside the Igloo,SL,3626225,MushBlock -Shocking Arrow Lifts!,WDW:Top,3626070,Star -Top o' the Town,WDW:Top,3626071,Star -Secrets in the Shallows Sky,WDW:Top,3626072,Star -Express Elevator--Hurry Up!,WDW,3626073,Star -Go to Town for Red Coins,WDW:Downtown,3626074,RedCoins,WK | MOVELESS TJ -Quick Race Through Downtown!,WDW:Downtown,3626075,Star,VC WK/BF | VC TJ LG | MOVELESS VC TJ -100 Coins Star,WDW:Top,3626076,100Coins,GP | NAR LG TJ/SF/BF | CANN | MOVELESS TJ DV -Bob-omb Buddy,WDW:Top,3626210,Buddy,TJ | SF LG | NAR BF/SF -1-Up Block in the Downtown,WDW:Downtown,3626226,MushBlock -Scale the Mountain,TTM:Top,3626077,Star -Mystery of the Monkey Cage,TTM:Top,3626078,Star -"Scary 'Shrooms, Red Coins",TTM,3626079,RedCoins -Mysterious Mountainside,TTM:Top,3626080,Star -Breathtaking View from Bridge,TTM:Top,3626081,Star -Blast to the Lonely Mushroom,TTM,3626082,Star,CANN | CANNLESS LJ | MOVELESS CANNLESS -100 Coins Star,TTM:Top,3626083,100Coins -Bob-omb Buddy,TTM,3626211,Buddy -1-Up Block on the Red Mushroom,TTM,3626227,MushBlock -Pluck the Piranha Flower,THI:Pipes,3626084,Star -The Tip Top of the Huge Island,THI:Pipes,3626085,Star -Rematch with Koopa the Quick,THI:Pipes,3626086,Star -Five Itty Bitty Secrets,THI:Pipes,3626087,Star -Wiggler's Red Coins,THI:Pipes,3626088,RedCoins,WK -Make Wiggler Squirm,THI:LargeTop,3626089,Star,GP | MOVELESS DV -100 Coins Star,THI:LargeTop,3626090,100Coins,GP -Bob-omb Buddy,THI:Pipes,3626212,Buddy -1-Up Block Near Tiny Start,THI:Pipes,3626228,MushBlock -1-Up Block Near Huge Start,THI:Pipes,3626229,MushBlock -1-Up Block in the Windy Area,THI:Pipes,3626230,MushBlock -Roll into the Cage,TTC:Lower,3626091,Star -The Pit and the Pendulums,TTC:Upper,3626092,Star -Get a Hand,TTC:Lower,3626093,Star -Stomp on the Thwomp,TTC:Top,3626094,Star -Timed Jumps on Moving Bars,TTC:Upper,3626095,Star -Stop Time for Red Coins,TTC,3626096,RedCoins,NAR | LG/TJ/SF/BF/WK -100 Coins Star,TTC,3626097,100Coins,GP -1-Up Block Midway Up,TTC:Top,3626231,MushBlock -1-Up Block at the Top,TTC:Top,3626232,MushBlock -Cruiser Crossing the Rainbow,RR:Cruiser,3626098,Star -The Big House in the Sky,RR:House,3626099,Star -Coins Amassed in a Maze,RR:Maze,3626100,RedCoins -Swingin' in the Breeze,RR,3626101,Star,LG/TJ/BF/SF | MOVELESS -Tricky Triangles!,RR,3626102,Star,LG/TJ/BF/SF | MOVELESS -Somewhere over the Rainbow,RR:Cruiser,3626103,Star,CANN -100 Coins Star,RR:Maze,3626104,100Coins,GP WK -Bob-omb Buddy,RR,3626214,Buddy -1-Up Block Above the Red Coin Maze,RR,3626233,MushBlock -1-Up Block Under Fly Guy,RR,3626234,MushBlock -1-Up Block on the House in the Sky,RR:House,3626235,MushBlock -End of the Slide Block,PSS,3626126,Star -Finish under 21 Seconds,PSS,3626127,Star -The Aquarium Red Coins,SA,3626161,RedCoins -First Bowser's Key,BitDW,3626178,BowserKey -Dark World Red Coins,BitDW,3626105,RedCoins -1-Up Block on the Tower,BitDW,3626236,MushBlock -1-Up Block Near the Goombas,BitDW,3626237,MushBlock -Second Bowser's Key,BitFS:Upper,3626179,BowserKey -Fire Sea Red Coins,BitFS:Upper,3626112,RedCoins -1-Up Block on the Swaying Stairs,BitFS:Upper,3626238,MushBlock -1-Up Block Near the Poles,BitFS:Upper,3626239,MushBlock -Sky Red Coins,BitS:Top,3626119,RedCoins, -1-Up Block on the Rotating Platform,BitS,3626240,MushBlock -Wing Cap Switch,TotWC,3626181,RedSwitch -Tower Red Coins,TotWC,3626140,RedCoins -Metal Cap Switch,CotMC,3626182,GreenSwitch -Cavern Red Coins,CotMC,3626133,RedCoins,MC | CAPLESS -1-Up Block Above the Rushing River,CotMC,3626241,MushBlock -Vanish Cap Switch,VCutM,3626183,BlueSwitch,WK/TJ/BF/SF/LG | MOVELESS -Moat Red Coins,VCutM,3626147,RedCoins,WK/TJ/BF/SF/LG VC | CAPLESS WK -1-Up Block on the Slope Platform,VCutM,3626242,MushBlock -Rainbow Red Coins,WMotR,3626154,RedCoins,WC TJ -Rainbow 1-Up Block,WMotR,3626243,MushBlock,WC TJ -Basement Toad's Gift,PPC,3626168,Star,ACCESS:B1 STARS:12 -Second Floor Toad's Gift,PPC,3626169,Star,ACCESS:F2 STARS:25 -Third Floor Toad's Gift,PPC,3626170,Star,ACCESS:F3 STARS:35 -MIPS the Rabbit,PPC,3626171,Star,ACCESS:B1 STARS:MIPS1 -MIPS the Rabbit II,PPC,3626172,Star,ACCESS:B1 STARS:MIPS2 diff --git a/data/locations.tsv b/data/locations.tsv new file mode 100644 index 0000000..d63c688 --- /dev/null +++ b/data/locations.tsv @@ -0,0 +1,165 @@ +LOCATION REGION ADDRESS TYPE RULES +Big Bob-omb on the Summit BoB 3626000 Star +Footrace with Koopa the Quick BoB 3626001 Star +Shoot to the Island in the Sky BoB:Island 3626002 Star +Find the 8 Red Coins BoB:Island 3626003 RedCoins +Mario Wings to the Sky BoB 3626004 Star CANN WC | CAPLESS CANN +Behind Chain Chomp's Gate BoB 3626005 Star GP | MOVELESS +100 Coins Star BoB 3626006 100Coins CANN WC | CANNLESS WC TJ +Bob-omb Buddy BoB 3626200 Buddy +Chip off Whomp's Block WF 3626007 Star GP +To the Top of the Fortress WF:Tower 3626008 Star +Shoot into the Wild Blue WF 3626009 Star WK TJ/SF | CANN +Red Coins on the Floating Isle WF 3626010 RedCoins +Fall onto the Caged Island WF 3626011 Star CL GP | MOVELESS TJ | MOVELESS LJ | MOVELESS CANN +Blast Away the Wall WF 3626012 Star CANN | CANNLESS LG +100 Coins Star WF 3626013 100Coins GP | MOVELESS +Bob-omb Buddy WF:Tower 3626201 Buddy +Plunder in the Sunken Ship JRB 3626014 Star +Can the Eel Come out to Play? JRB 3626015 Star +Treasure of the Ocean Cave JRB 3626016 Star +Red Coins on the Ship Afloat JRB:Upper 3626017 RedCoins CANN | CL/TJ | MOVELESS BF/WK +Blast to the Stone Pillar JRB 3626018 Star CANN CL | CANN MOVELESS | CANNLESS MOVELESS +Through the Jet Stream JRB 3626019 Star MC | CAPLESS +100 Coins Star JRB:Upper 3626020 100Coins GP +Bob-omb Buddy JRB 3626202 Buddy +Slip Slidin' Away CCM 3626021 Star +Li'l Penguin Lost CCM 3626022 Star +Big Penguin Race CCM 3626023 Star +Frosty Slide for 8 Red Coins CCM 3626024 RedCoins +Snowman's Lost his Head CCM 3626025 Star +Wall Kicks will Work CCM 3626026 Star CANN TJ/WK | CANNLESS TJ/WK | MOVELESS +100 Coins Star CCM 3626027 100Coins +Bob-omb Buddy CCM 3626203 Buddy +1-Up Block Near Snowman CCM 3626215 MushBlock +1-Up Block Near Ice Pillar CCM 3626216 MushBlock +1-Up Block in Secret Slide CCM 3626217 MushBlock +Go on a Ghost Hunt BBH 3626028 Star +Ride Big Boo's Merry-Go-Round BBH 3626029 Star +Secret of the Haunted Books BBH 3626030 Star KI | MOVELESS +Seek the 8 Red Coins BBH 3626031 RedCoins BF/WK/TJ/SF +Big Boo's Balcony BBH:Roof 3626032 Star +Eye to Eye in the Secret Room BBH:ThirdFloor 3626033 Star VC +100 Coins Star BBH 3626034 100Coins +1-Up Block on Top of the Mansion BBH:Roof 3626218 MushBlock +Swimming Beast in the Cavern HMC 3626035 Star +Elevate for 8 Red Coins HMC:RedCoinArea 3626036 RedCoins +Metal-Head Mario Can Move! HMC 3626037 Star LJ MC | CAPLESS LJ TJ | CAPLESS MOVELESS LJ/TJ/WK +Navigating the Toxic Maze HMC 3626038 Star WK/SF/BF/TJ +A-Maze-Ing Emergency Exit HMC:PitIslands 3626039 Star +Watch for Rolling Rocks HMC 3626040 Star WK +100 Coins Star HMC:RedCoinArea 3626041 100Coins GP +1-Up Block Above the Pit HMC:PitIslands 3626219 MushBlock +1-Up Block Past Rolling Rocks HMC 3626220 MushBlock +Boil the Big Bully LLL 3626042 Star +Bully the Bullies LLL 3626043 Star +8-Coin Puzzle with 15 Pieces LLL 3626044 RedCoins +Red-Hot Log Rolling LLL 3626045 Star +Hot-Foot-It into the Volcano LLL:UpperVolcano 3626046 Star +Elevator Tour in the Volcano LLL:UpperVolcano 3626047 Star +100 Coins Star LLL 3626048 100Coins +In the Talons of the Big Bird SSL 3626049 Star +Shining Atop the Pyramid SSL 3626050 Star +Inside the Ancient Pyramid SSL:UpperPyramid 3626051 Star +Stand Tall on the Four Pillars SSL:UpperPyramid 3626052 Star TJ WC GP | CANN WC GP | CAPLESS TJ/SF/BF | MOVELESS +Free Flying for 8 Red Coins SSL 3626053 RedCoins TJ WC | CANN WC | CAPLESS TJ/SF/BF | CAPLESS MOVELESS +Pyramid Puzzle SSL:UpperPyramid 3626054 Star +100 Coins Star SSL 3626055 100Coins GP | CL TJ/BF/SF/LG | MOVELESS +Bob-omb Buddy SSL 3626207 Buddy +1-Up Block Outside Pyramid SSL 3626221 MushBlock +1-Up Block in the Pyramid's Left Path SSL 3626222 MushBlock +1-Up Block in the Pyramid's Back SSL 3626223 MushBlock +Board Bowser's Sub DDD 3626056 Star +Chests in the Current DDD 3626057 Star +Pole-Jumping for Red Coins DDD 3626058 RedCoins CL BOWSER2 | MOVELESS TJ DV LG WK +Through the Jet Stream DDD 3626059 Star MC | CAPLESS +The Manta Ray's Reward DDD 3626060 Star +Collect the Caps... DDD 3626061 Star VC MC | CAPLESS VC +100 Coins Star DDD 3626062 100Coins CL GP BOWSER2 | MOVELESS TJ DV LG WK GP +Snowman's Big Head SL 3626063 Star BF/SF/TJ | CANN +Chill with the Bully SL 3626064 Star +In the Deep Freeze SL 3626065 Star WK/SF/LG/BF/TJ | CANN +Whirl from the Freezing Pond SL 3626066 Star +Shell Shreddin' for Red Coins SL 3626067 RedCoins +Into the Igloo SL 3626068 Star VC TJ/SF/BF/WK/LG | MOVELESS VC +100 Coins Star SL 3626069 100Coins VC | CAPLESS +Bob-omb Buddy SL 3626209 Buddy +1-Up Block Near Moneybags SL 3626224 MushBlock +1-Up Block Inside the Igloo SL 3626225 MushBlock +Shocking Arrow Lifts! WDW:Top 3626070 Star +Top o' the Town WDW:Top 3626071 Star +Secrets in the Shallows Sky WDW:Top 3626072 Star +Express Elevator--Hurry Up! WDW 3626073 Star +Go to Town for Red Coins WDW:Downtown 3626074 RedCoins WK | MOVELESS TJ +Quick Race Through Downtown! WDW:Downtown 3626075 Star VC WK/BF | VC TJ LG | MOVELESS VC TJ +100 Coins Star WDW:Top 3626076 100Coins GP | NAR LG TJ/SF/BF | CANN | MOVELESS TJ DV +Bob-omb Buddy WDW:Top 3626210 Buddy TJ | SF LG | NAR BF/SF +1-Up Block in the Downtown WDW:Downtown 3626226 MushBlock +Scale the Mountain TTM:Top 3626077 Star +Mystery of the Monkey Cage TTM:Top 3626078 Star +Scary 'Shrooms, Red Coins TTM 3626079 RedCoins +Mysterious Mountainside TTM:Top 3626080 Star +Breathtaking View from Bridge TTM:Top 3626081 Star +Blast to the Lonely Mushroom TTM 3626082 Star CANN | CANNLESS LJ | MOVELESS CANNLESS +100 Coins Star TTM:Top 3626083 100Coins +Bob-omb Buddy TTM 3626211 Buddy +1-Up Block on the Red Mushroom TTM 3626227 MushBlock +Pluck the Piranha Flower THI:Pipes 3626084 Star +The Tip Top of the Huge Island THI:Pipes 3626085 Star +Rematch with Koopa the Quick THI:Pipes 3626086 Star +Five Itty Bitty Secrets THI:Pipes 3626087 Star +Wiggler's Red Coins THI:Pipes 3626088 RedCoins WK +Make Wiggler Squirm THI:LargeTop 3626089 Star GP | MOVELESS DV +100 Coins Star THI:LargeTop 3626090 100Coins GP +Bob-omb Buddy THI:Pipes 3626212 Buddy +1-Up Block Near Tiny Start THI:Pipes 3626228 MushBlock +1-Up Block Near Huge Start THI:Pipes 3626229 MushBlock +1-Up Block in the Windy Area THI:Pipes 3626230 MushBlock +Roll into the Cage TTC:Lower 3626091 Star +The Pit and the Pendulums TTC:Upper 3626092 Star +Get a Hand TTC:Lower 3626093 Star +Stomp on the Thwomp TTC:Top 3626094 Star +Timed Jumps on Moving Bars TTC:Upper 3626095 Star +Stop Time for Red Coins TTC 3626096 RedCoins NAR | LG/TJ/SF/BF/WK +100 Coins Star TTC 3626097 100Coins GP +1-Up Block Midway Up TTC:Top 3626231 MushBlock +1-Up Block at the Top TTC:Top 3626232 MushBlock +Cruiser Crossing the Rainbow RR:Cruiser 3626098 Star +The Big House in the Sky RR:House 3626099 Star +Coins Amassed in a Maze RR:Maze 3626100 RedCoins +Swingin' in the Breeze RR 3626101 Star LG/TJ/BF/SF | MOVELESS +Tricky Triangles! RR 3626102 Star LG/TJ/BF/SF | MOVELESS +Somewhere over the Rainbow RR:Cruiser 3626103 Star CANN +100 Coins Star RR:Maze 3626104 100Coins GP WK +Bob-omb Buddy RR 3626214 Buddy +1-Up Block Above the Red Coin Maze RR 3626233 MushBlock +1-Up Block Under Fly Guy RR 3626234 MushBlock +1-Up Block on the House in the Sky RR:House 3626235 MushBlock +End of the Slide Block PSS 3626126 Star +Finish under 21 Seconds PSS 3626127 Star +The Aquarium Red Coins SA 3626161 RedCoins +First Bowser's Key BitDW 3626178 BowserKey +Dark World Red Coins BitDW 3626105 RedCoins +1-Up Block on the Tower BitDW 3626236 MushBlock +1-Up Block Near the Goombas BitDW 3626237 MushBlock +Second Bowser's Key BitFS:Upper 3626179 BowserKey +Fire Sea Red Coins BitFS:Upper 3626112 RedCoins +1-Up Block on the Swaying Stairs BitFS:Upper 3626238 MushBlock +1-Up Block Near the Poles BitFS:Upper 3626239 MushBlock +Sky Red Coins BitS:Top 3626119 RedCoins +1-Up Block on the Rotating Platform BitS 3626240 MushBlock +Wing Cap Switch TotWC 3626181 RedSwitch +Tower Red Coins TotWC 3626140 RedCoins +Metal Cap Switch CotMC 3626182 GreenSwitch +Cavern Red Coins CotMC 3626133 RedCoins MC | CAPLESS +1-Up Block Above the Rushing River CotMC 3626241 MushBlock +Vanish Cap Switch VCutM 3626183 BlueSwitch WK/TJ/BF/SF/LG | MOVELESS +Moat Red Coins VCutM 3626147 RedCoins WK/TJ/BF/SF/LG VC | CAPLESS WK +1-Up Block on the Slope Platform VCutM 3626242 MushBlock +Rainbow Red Coins WMotR 3626154 RedCoins WC TJ +Rainbow 1-Up Block WMotR 3626243 MushBlock WC TJ +Basement Toad's Gift PPC 3626168 Star ACCESS:B1 STARS:12 +Second Floor Toad's Gift PPC 3626169 Star ACCESS:F2 STARS:25 +Third Floor Toad's Gift PPC 3626170 Star ACCESS:F3 STARS:35 +MIPS the Rabbit PPC 3626171 Star ACCESS:B1 STARS:MIPS1 +MIPS the Rabbit II PPC 3626172 Star ACCESS:B1 STARS:MIPS2 diff --git a/data/regions.csv b/data/regions.csv deleted file mode 100644 index 817832e..0000000 --- a/data/regions.csv +++ /dev/null @@ -1,23 +0,0 @@ -REGION,PARENT,RULES -BoB:Island,BoB,CANN | CANNLESS WC TJ | CAPLESS CANNLESS LJ -WF:Tower,WF,GP -JRB:Upper,JRB,TJ/BF/SF/WK | MOVELESS LG -BBH:ThirdFloor,BBH,WK LG | MOVELESS WK -BBH:Roof,BBH:ThirdFloor,LJ | MOVELESS -HMC:RedCoinArea,HMC,CL WK/LG/BF/SF/TJ | MOVELESS WK -HMC:PitIslands,HMC,TJ CL | MOVELESS WK TJ/LJ | MOVELESS WK SF LG -LLL:UpperVolcano,LLL,CL -SSL:UpperPyramid,SSL,CL TJ/BF/SF/LG | MOVELESS -WDW:Top,WDW,WK/TJ/SF/BF | MOVELESS -WDW:Downtown,WDW,NAR LG TJ/SF/BF | CANN | MOVELESS TJ DV -TTM:Top,TTM,LJ/DV LG/KI | MOVELESS TJ | MOVELESS WK SF/LG | MOVELESS KI/DV -THI:Pipes,THI,NAR | LJ/TJ/DV/LG | MOVELESS BF/SF/KI -THI:LargeTop,THI:Pipes,NAR | LJ/TJ/DV | MOVELESS -TTC:Lower,TTC,LG/TJ/SF/BF/WK -TTC:Upper,TTC:Lower,CL | MOVELESS WK -TTC:Top,TTC:Upper,TJ LG | MOVELESS WK/TJ -RR:Maze,RR,WK | LJ SF/BF/TJ | MOVELESS LG/TJ -RR:Cruiser,RR,WK/SF/BF/LG/TJ -RR:House,RR,TJ/SF/BF/LG -BitFS:Upper,BitFS,CL -BitS:Top,BitS,CL TJ | CL SF LG | MOVELESS TJ WK LG diff --git a/data/regions.tsv b/data/regions.tsv new file mode 100644 index 0000000..56386b8 --- /dev/null +++ b/data/regions.tsv @@ -0,0 +1,23 @@ +REGION PARENT RULES +BoB:Island BoB CANN | CANNLESS WC TJ | CAPLESS CANNLESS LJ +WF:Tower WF GP +JRB:Upper JRB TJ/BF/SF/WK | MOVELESS LG +BBH:ThirdFloor BBH WK LG | MOVELESS WK +BBH:Roof BBH:ThirdFloor LJ | MOVELESS +HMC:RedCoinArea HMC CL WK/LG/BF/SF/TJ | MOVELESS WK +HMC:PitIslands HMC TJ CL | MOVELESS WK TJ/LJ | MOVELESS WK SF LG +LLL:UpperVolcano LLL CL +SSL:UpperPyramid SSL CL TJ/BF/SF/LG | MOVELESS +WDW:Top WDW WK/TJ/SF/BF | MOVELESS +WDW:Downtown WDW NAR LG TJ/SF/BF | CANN | MOVELESS TJ DV +TTM:Top TTM LJ/DV LG/KI | MOVELESS TJ | MOVELESS WK SF/LG | MOVELESS KI/DV +THI:Pipes THI NAR | LJ/TJ/DV/LG | MOVELESS BF/SF/KI +THI:LargeTop THI:Pipes NAR | LJ/TJ/DV | MOVELESS +TTC:Lower TTC LG/TJ/SF/BF/WK +TTC:Upper TTC:Lower CL | MOVELESS WK +TTC:Top TTC:Upper TJ LG | MOVELESS WK/TJ +RR:Maze RR WK | LJ SF/BF/TJ | MOVELESS LG/TJ +RR:Cruiser RR WK/SF/BF/LG/TJ +RR:House RR TJ/SF/BF/LG +BitFS:Upper BitFS CL +BitS:Top BitS CL TJ | CL SF LG | MOVELESS TJ WK LG From e680689f0b132a7e737059426f677bb58221e910 Mon Sep 17 00:00:00 2001 From: Zach Parks Date: Wed, 2 Oct 2024 20:14:43 -0500 Subject: [PATCH 03/20] More restructuring and also basic rewrite of Phakager.py --- .idea/codeStyles/codeStyleConfig (copy 1).xml | 5 - .idea/csv-editor.xml | 12 +- Phakager.ts | 268 ++++++++++++++++++ {src => packager}/entrance.ts | 24 +- {src => packager}/location.ts | 153 +++------- packager/region.ts | 47 +++ {src => packager}/rules.ts | 0 packager/versioning.ts | 33 +++ src/index.ts | 199 ------------- src/types.ts | 34 --- tsconfig.json | 3 +- 11 files changed, 402 insertions(+), 376 deletions(-) delete mode 100644 .idea/codeStyles/codeStyleConfig (copy 1).xml create mode 100644 Phakager.ts rename {src => packager}/entrance.ts (81%) rename {src => packager}/location.ts (51%) create mode 100644 packager/region.ts rename {src => packager}/rules.ts (100%) create mode 100644 packager/versioning.ts delete mode 100644 src/index.ts delete mode 100644 src/types.ts diff --git a/.idea/codeStyles/codeStyleConfig (copy 1).xml b/.idea/codeStyles/codeStyleConfig (copy 1).xml deleted file mode 100644 index a55e7a1..0000000 --- a/.idea/codeStyles/codeStyleConfig (copy 1).xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/csv-editor.xml b/.idea/csv-editor.xml index cea8333..6d5fbd8 100644 --- a/.idea/csv-editor.xml +++ b/.idea/csv-editor.xml @@ -3,24 +3,24 @@