diff --git a/gcsim_pypi/availability/.gitkeep b/gcsim_pypi/availability/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/gcsim_pypi/availability/__init__.py b/gcsim_pypi/availability/__init__.py new file mode 100644 index 0000000..bc3eb39 --- /dev/null +++ b/gcsim_pypi/availability/__init__.py @@ -0,0 +1,9 @@ +from .artifacts import * +from .characters import * +from .weapons import * + +__all__ = [ + "AVAILABLE_ARTIFACTS", + "AVAILABLE_CHARACTERS", + "AVAILABLE_WEAPONS", +] \ No newline at end of file diff --git a/gcsim_pypi/availability/artifacts.py b/gcsim_pypi/availability/artifacts.py new file mode 100644 index 0000000..f120e46 --- /dev/null +++ b/gcsim_pypi/availability/artifacts.py @@ -0,0 +1,107 @@ +AVAILABLE_ARTIFACTS = { + "adventurer", + "ap", + "archaicpetra", + "berserker", + "blizzard", + "blizzardstrayer", + "bloodstained", + "bloodstainedchivalry", + "bolide", + "brave", + "braveheart", + "bs", + "bsc", + "clam", + "crimson", + "crimsonwitchofflames", + "cw", + "cwof", + "deepwood", + "deepwoodmemories", + "defender", + "defenders", + "defenderswill", + "desertpavilion", + "desertpavilionchronicle", + "dpc", + "echoes", + "echoesofanoffering", + "emblem", + "emblemofseveredfate", + "eosf", + "esf", + "exile", + "flowerofparadiselost", + "fopl", + "gambler", + "gd", + "gilded", + "gildeddreams", + "glad", + "gladiators", + "gladiatorsfinale", + "goldentroupe", + "gt", + "heartofdepth", + "hod", + "hood", + "husk", + "huskofopulentdreams", + "ins", + "instructor", + "lavawalker", + "luckydog", + "lw", + "maiden", + "maidenbeloved", + "marechausseehunter", + "martialartist", + "mb", + "mh", + "millelith", + "no", + "noblesse", + "noblesseoblige", + "nymphsdream", + "oceanhuedclam", + "ohc", + "paleflame", + "paradiselost", + "pf", + "prayersfordestiny", + "prayersforillumination", + "prayersforwisdom", + "prayerstospringtime", + "resolutionofsojourner", + "retracingbolide", + "scholar", + "shim", + "shime", + "shimenawa", + "shimenawasreminiscence", + "sojourner", + "sr", + "tenacity", + "tenacityofthemillelith", + "tf", + "theexile", + "thunderingfury", + "thundersoother", + "tinymiracle", + "tom", + "totm", + "travelingdoctor", + "ts", + "vermillion", + "vermillionhereafter", + "vh", + "viridescent", + "viridescentvenerer", + "vourukashasglow", + "vv", + "wanderers", + "wandererstroupe", + "witch", + "wt", +} \ No newline at end of file diff --git a/gcsim_pypi/availability/characters.py b/gcsim_pypi/availability/characters.py new file mode 100644 index 0000000..a01f34c --- /dev/null +++ b/gcsim_pypi/availability/characters.py @@ -0,0 +1,139 @@ +AVAILABLE_CHARACTERS = { + "aetheranemo", + "aethercryo", + "aetherdendro", + "aetherelectro", + "aethergeo", + "aetherhydro", + "aetherpyro", + "albedo", + "alhaitham", + "aloy", + "amber", + "amy", + "aratakiitto", + "aratakitheoneandoniitto", + "ayaka", + "ayato", + "baizhu", + "barb", + "barbara", + "beidou", + "belial", + "bennett", + "candace", + "childe", + "chong", + "chongyun", + "collei", + "cyno", + "dehya", + "dendrokeqing", + "diluc", + "diona", + "dionarework", + "discountorochimaru", + "dori", + "eula", + "faru", + "faruzan", + "fischl", + "fish", + "ganyu", + "gorou", + "haitham", + "hatsunemiku", + "heizou", + "herexcellencythealmightynarukamiogoshogodofthunder", + "ht", + "hutao", + "itto", + "jean", + "kabukimono", + "kaedeharakazuha", + "kaeya", + "kamisatoayaka", + "kamisatoayato", + "kaveh", + "kaz", + "kazuha", + "keq", + "keqing", + "kirara", + "klee", + "koko", + "kokomi", + "kujosara", + "kujousara", + "kuki", + "kukishinobu", + "kuni", + "kunikuzushi", + "kusanali", + "layla", + "lesserlordkusanali", + "lisa", + "lumineanemo", + "luminecryo", + "luminedendro", + "lumineelectro", + "luminegeo", + "luminehydro", + "luminepyro", + "lynette", + "lyney", + "mika", + "mona", + "nahida", + "nilou", + "ning", + "ningguang", + "noelle", + "qiqi", + "raiden", + "raidenshogun", + "razor", + "razorrework", + "rosa", + "rosaria", + "sangonomiyakokomi", + "sara", + "sayu", + "scara", + "scaramouche", + "shenhe", + "shikanoinheizou", + "sucrose", + "tao", + "tartaglia", + "thoma", + "tighnari", + "traveleranemo", + "travelercryo", + "travelerdendro", + "travelerelectro", + "travelergeo", + "travelerhydro", + "travelerpyro", + "venti", + "wanderer", + "xiangling", + "xiao", + "xingqiu", + "xinyan", + "xinyansidegrade", + "xl", + "xq", + "yae", + "yaemiko", + "yanfei", + "yangu", + "yaoyao", + "yelan", + "yoi", + "yoimiya", + "yunjin", + "zhong", + "zhongli", + "zl", +} \ No newline at end of file diff --git a/gcsim_pypi/availability/weapons.py b/gcsim_pypi/availability/weapons.py new file mode 100644 index 0000000..bd0d1f3 --- /dev/null +++ b/gcsim_pypi/availability/weapons.py @@ -0,0 +1,305 @@ +AVAILABLE_WEAPONS = { + "ak", + "akuoumaru", + "alleyflash", + "alleyhunter", + "amenoma", + "amenomakageuchi", + "amos", + "amosbow", + "apprentice", + "apprentices", + "apprenticesnotes", + "aqua", + "aquamarine", + "aquasimulacra", + "aquila", + "aquilafavonia", + "archaic", + "athousandfloatingdreams", + "atlas", + "ballad", + "balladofthefjords", + "beacon", + "beaconofthereedsea", + "beginner", + "beginners", + "beginnersprotector", + "bell", + "blackcliffagate", + "blackclifflongsword", + "blackcliffpole", + "blackcliffslasher", + "blackcliffwarbow", + "blacksword", + "blacktassel", + "bloodtainted", + "bloodtaintedgreatsword", + "calamity", + "calamityqueller", + "catch", + "cinnabar", + "cinnabarspindle", + "compound", + "compoundbow", + "coolsteel", + "cpike", + "crescent", + "crescentpike", + "darkironsword", + "deathmatch", + "debateclub", + "descension", + "dockhand", + "dodocotales", + "donut", + "dragonsbane", + "dragonspinespear", + "dullblade", + "elegy", + "elegyfortheend", + "emeraldorb", + "endoftheline", + "engulfing", + "engulfinglightning", + "eternalflow", + "evenstar", + "everlastingmoonglow", + "eyeofperception", + "fadingtwilight", + "favbow", + "favcodex", + "favgs", + "favlance", + "favoniuscodex", + "favoniusgreatsword", + "favoniuslance", + "favoniussword", + "favoniuswarbow", + "favspear", + "favsword", + "favwarbow", + "ferrousshadow", + "festering", + "festeringdesire", + "fgm", + "filletblade", + "finaleofthedeep", + "firstgreatmagic", + "fleuve", + "fleuvecendreferryman", + "flowingpurity", + "flute", + "fof", + "foliar", + "foliarincision", + "forestregalia", + "freedom", + "freedomsworn", + "frostbearer", + "fruit", + "fruitoffulfillment", + "gravestone", + "hakushin", + "hakushinring", + "halberd", + "hamayumi", + "haran", + "harangeppakufutsu", + "harbinger", + "harbingerofdawn", + "harp", + "homa", + "huntersbow", + "hunterspath", + "ibis", + "ibispiercer", + "incision", + "ironpoint", + "ironsting", + "isshin", + "jadecutter", + "jadefall", + "jadefallssplendor", + "jadespear", + "kagotsurubeisshin", + "kagura", + "kagurasverity", + "katsuragikirinagamasa", + "key", + "keyofkhajnisut", + "khajnisut", + "kingssquire", + "kitain", + "kitaincrossspear", + "lightoffoliarincision", + "lionsroar", + "lithicblade", + "lithicspear", + "lostprayer", + "lostprayertothesacredwinds", + "luxurioussealord", + "magicguide", + "mailed", + "mailedflower", + "makhairaaquamarine", + "mappa", + "mappamare", + "memoryofdust", + "messenger", + "missive", + "missivewindspear", + "mistsplitter", + "mistsplitterreforged", + "mitternacht", + "mitternachts", + "mitternachtswaltz", + "moonglow", + "moonpiercer", + "mouun", + "mouuns", + "mouunsmoon", + "nagamasa", + "oathsworn", + "oathsworneye", + "ode", + "oldmercspal", + "otherworldly", + "otherworldlystory", + "pamber", + "pike", + "pines", + "pjc", + "pjws", + "pocket", + "pocketgrimoire", + "polar", + "polarstar", + "portablepowersaw", + "powersaw", + "predator", + "pride", + "primordialjadecutter", + "primordialjadewingedspear", + "prototypeamber", + "prototypearchaic", + "prototypecrescent", + "prototyperancour", + "prototypestarglitter", + "rainslasher", + "rancour", + "raven", + "ravenbow", + "recurve", + "recurvebow", + "redhorn", + "redhornstonethresher", + "regalia", + "rightfulreward", + "royalbow", + "royalgreatsword", + "royalgrimoire", + "royallongsword", + "royalspear", + "rust", + "sacbow", + "sacfrag", + "sacfragments", + "sacfrags", + "sacgs", + "sacjade", + "sacrificialbow", + "sacrificialfragments", + "sacrificialgreatsword", + "sacrificialjade", + "sacrificialsword", + "sacsword", + "sapwood", + "sapwoodblade", + "scarlet", + "scarletsands", + "scion", + "scionoftheblazingsun", + "sealord", + "seasoned", + "seasonedhuntersbow", + "serpent", + "serpentspine", + "sharpshooter", + "sharpshooters", + "sharpshootersoath", + "shigure", + "silversword", + "skyridergreatsword", + "skyridersword", + "skywardatlas", + "skywardblade", + "skywardharp", + "skywardpride", + "skywardspine", + "slingshot", + "snowtombed", + "snowtombedstarsilver", + "sobp", + "solarpearl", + "songofbrokenpines", + "songofstillness", + "sss", + "staffofhoma", + "staffofthescarletsands", + "starglitter", + "starsilver", + "stringless", + "summit", + "summitshaper", + "swordofdescension", + "talkingstick", + "tfd", + "thealleyflash", + "thebell", + "theblacksword", + "thecatch", + "thedockhandsassistant", + "thefirstgreatmagic", + "theflute", + "thestringless", + "theunforged", + "theviridescenthunt", + "thewidsith", + "thousandfloatingdreams", + "thrillingtalesofdragonslayers", + "thunderingpulse", + "tidalshadow", + "tomeoftheeternalflow", + "toukaboushigure", + "tpulse", + "travelershandysword", + "ttds", + "tula", + "tulaytullah", + "tulaytullahsremembrance", + "twilight", + "twinnephrite", + "umbrella", + "unforged", + "vhunt", + "viridescenthunt", + "vortex", + "vortexvanquisher", + "waltz", + "wanderingevenstar", + "wastergreatsword", + "wavebreaker", + "wavebreakersfin", + "wgs", + "whiteblind", + "whiteirongreatsword", + "whitetassel", + "widsith", + "windblumeode", + "wineandsong", + "wolffang", + "wolfsgravestone", + "xiphos", + "xiphosmoonlight", +} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 4088838..6654e66 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,15 +8,15 @@ readme = "README.md" packages = [{include = "gcsim_pypi"}] include = [ { path = "gcsim_pypi/bin/*", format = ["sdist", "wheel"] }, - { path = "gcsim_pypi/availability/*.json", format = ["sdist", "wheel"] } ] [tool.poetry.dependencies] python = "^3.6" -[tool.poetry-dynamic-versioning] -enable = true +[tool.poetry.build] +generate-setup-file = false +script = "scripts.py" [build-system] -requires = ["poetry-core", "poetry-dynamic-versioning>=1.0.0,<2.0.0"] -build-backend = "poetry_dynamic_versioning.backend" \ No newline at end of file +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" \ No newline at end of file diff --git a/scripts.py b/scripts.py index 7debda3..ef314cb 100644 --- a/scripts.py +++ b/scripts.py @@ -1,17 +1,21 @@ +import re import json from pathlib import Path -with open( - Path(__file__) - .parent.joinpath("gcsim_pypi") - .joinpath("availability") - .joinpath("characters.json"), - "w", -) as f: - json.dump( - list( - set( - [ +GCSIM_PATH = Path(__file__).parent.joinpath("gcsim") +GCSIM_PYPI_PATH = Path(__file__).parent.joinpath("gcsim_pypi") + + +def generate_availability(): + print("Generating character availability...") + with open( + GCSIM_PYPI_PATH.joinpath("availability").joinpath("characters.py"), + "w", + ) as f: + f.write("AVAILABLE_CHARACTERS = {\n") + for character in sorted( + list( + set( next( filter( lambda line: line.startswith("key:"), @@ -22,60 +26,79 @@ .split(" ")[-1] .strip('"') for f in ( - Path(__file__) - .parent.joinpath("gcsim") - .joinpath("internal") - .joinpath("characters") + GCSIM_PATH.joinpath("internal").joinpath("characters") ).rglob("config.yml") - ] + ).union( + match + for match in re.findall( + r"\"(\w+)\":[ ]*keys", + GCSIM_PATH.joinpath("pkg") + .joinpath("shortcut") + .joinpath("characters.go") + .read_text(), + ) + ) ) - ), - f, - ) + ): + f.write(f' "{character}",\n') + f.write("}") -with open( - Path(__file__) - .parent.joinpath("gcsim_pypi") - .joinpath("availability") - .joinpath("artifacts.json"), - "w", -) as f: - json.dump( - list( - set( - [ - next( - filter( - lambda line: line.startswith("key:"), - f.read_text().split("\n"), - ), - f.parent.stem, + print("Generating artifact availability...") + with open( + Path(__file__) + .parent.joinpath("gcsim_pypi") + .joinpath("availability") + .joinpath("artifacts.py"), + "w", + ) as f: + f.write("AVAILABLE_ARTIFACTS = {\n") + for art in sorted( + list( + set( + [ + next( + filter( + lambda line: line.startswith("key:"), + f.read_text().split("\n"), + ), + f.parent.stem, + ) + .split(" ")[-1] + .strip('"') + for f in ( + Path(__file__) + .parent.joinpath("gcsim") + .joinpath("internal") + .joinpath("artifacts") + ).rglob("config.yml") + ] + ).union( + match + for match in re.findall( + r"\"(\w+)\":[ ]*keys", + GCSIM_PATH.joinpath("pkg") + .joinpath("shortcut") + .joinpath("artifacts.go") + .read_text(), ) - .split(" ")[-1] - .strip('"') - for f in ( - Path(__file__) - .parent.joinpath("gcsim") - .joinpath("internal") - .joinpath("artifacts") - ).rglob("config.yml") - ] + ) ) - ), - f, - ) + ): + f.write(f' "{art}",\n') + f.write("}") -with open( - Path(__file__) - .parent.joinpath("gcsim_pypi") - .joinpath("availability") - .joinpath("weapons.json"), - "w", -) as f: - json.dump( - list( - set( - [ + print("Generating weapon availability...") + with open( + Path(__file__) + .parent.joinpath("gcsim_pypi") + .joinpath("availability") + .joinpath("weapons.py"), + "w", + ) as f: + f.write("AVAILABLE_WEAPONS = {\n") + for weapon in sorted( + list( + set( next( filter( lambda line: line.startswith("key:"), @@ -91,8 +114,21 @@ .joinpath("internal") .joinpath("weapons") ).rglob("config.yml") - ] + ).union( + match + for match in re.findall( + r"\"(\w+)\":[ ]*keys", + GCSIM_PATH.joinpath("pkg") + .joinpath("shortcut") + .joinpath("weapons.go") + .read_text(), + ) + ) ) - ), - f, - ) + ): + f.write(f' "{weapon}",\n') + f.write("}") + + +if __name__ == "__main__": + generate_availability()