- Pokete is a small terminal based game in the style of a very popular and old game by Gamefreak. Imagine you're a Pokete-Trainer and your goal is it to run around in the world and catch/train as many Poketes as possible and to get the best trainer. -
-Quite a lot of bugs were fixed: Added more documentation. #278: Fixed random dor in flowytown arena. #279: Fixed warnings at startup due to new python versions. #281: Fixed trainer name conflicts
-Quite a lot happened until this release: Moved some NPCs out of the way. Fixed a small bug with `gen_wiki.py` on windows. Added new `first evolution` achievement. Added new Poketes (Pavous, Uberpavous, Kartmen, Kakraholt, Bablbam). Volume settings with a funky new volumeslider. A new `--no_audio` commandline option to supress all audio. Stats for Poketes. Infos about the effect an attack has. The complete game is now resizable. Reduced stack traces. This release now requires `scrap_engine` on v1.4.0. Many thanks to @ondrejmyska for your many contributions.
-Version 0.8.2 fixes a display bug of the release notes on flatpak. Version 0.8.1 on the other hand brought the following improvements: This version brings a new cross-platform implementation of how the audio is played, written in go. This makes the installation size of pokete significantly smaller, as less dependencies are required. The first map has been reworked, to make it easier for new players to understand the game.
-This version brings a new cross-platform implementation of how the audio is played, written in go. This makes the installation size of pokete significantly smaller, as less dependencies are required. The first map has been reworked, to make it easier for new players to understand the game.
-We are constantly developing pokete further and with version 0.8.0 added a low of improvements and new features, such as music and sound effects. Running away from wild poketes can now fail and trainers can now have more than one pokete. Controls and hotkeys can now be remapped for different keyboard layouts. The default safe-file location has been moved to .local/share and some minor bugs have been fixed as well!
-Preparation release for flatpaks. Includes: A svg image of the pokete logo, A metainfo.xml file for pokete -
-Pokete is a small terminal based game in the style of a very popular and old game by Gamefreak. Imagine you're a Pokete-Trainer and your goal is it to run around in the world and catch/train as many Poketes as possible and to get the best trainer.
+Quite a lot of bugs were fixed:
+Quite a lot happened until this release:
+gen_wiki.py
+ on windows
+ first evolution
+ achievement
+ --no_audio
+ commandline option to supress all audio
+
+ This release now requires
+ scrap_engine
+ on v1.4.0
+
Many thanks to @ondrejmyska for your many contributions.
+Fixes a small bug in the representation of pokete on flathub.
+The distribution size was shrinked extremely compared to 0.8.0
+yzcv
+ so the attackamenu can be skipped
+ Many thanks to everybody who contributed to this release!
+Preparation release for flatpaks. Includes:
+Crucial bugfix related to natures and pokete dex.
+Just some small bugfixes.
+Under the hood
+PeriodicEventManager
+ , introducing a centralized approach to handling periodically occurring events
+ Game design and behaviour
+This article summarises the changes further.
+Again very special thanks to @MaFeLP for supporting me!
+What changed until this release?
+Again special thanks to MaFeLP
+Some minor changes due to API changes in scrap_engine v1.0.0.
+scrap_engine v1.0.0 is now required.
+What changed until this release?
+What changed until this release?
+What changed until this release?
+What changed until this release?
+What changed until this release?
+What changed until this release?
+What changed until this release?
+What changed until this release?
+What changed until this release?
+What changed until this release?
+What changed until this release?
+This is the first real release of Pokete, because at this point most of the key game mechanics are implemented and most
+stuff that's still missing is just game content.
+"
+ in_code_block = True
+ elif segment == "[":
+ illegal_link += segment
+ elif illegal_link:
+ if segment == ")" and "]" in illegal_link:
+ this_segment += illegal_link.split("[")[1].split("]")[0]
+ illegal_link = ""
+ elif segment != "(" and illegal_link[-1] == "]":
+ this_segment += illegal_link
+ illegal_link = ""
+ else:
+ illegal_link += segment
+ else:
+ this_segment += segment
+
+ return (this_segment + __parse_line(
+ line, idx + 1, in_code_block, illegal_link
+ )).replace("
", "")
+
+
+def __parse_markup(
+ lines: list[str], idx: int = 0, ul_depth: int = 0,
+ curr_ul_sep="", curr_line_depth=0
+) -> str:
+ if idx == len(lines):
+ return ""
+ parsed_line = ""
+ line = lines[idx].lstrip()
+ line_depth = len(lines[idx]) - len(line)
+ if line.startswith(LIST_STARTERS):
+ ul_sep = line[0:2]
+ if curr_ul_sep == "":
+ curr_ul_sep = ul_sep
+ ul_depth += 1
+ parsed_line += ""
+ '''if ul_sep != curr_ul_sep:
+ curr_ul_sep = ul_sep
+ if line_depth >= curr_line_depth:
+ ul_depth += 1
+ parsed_line += ""
+ else:
+ ul_depth -= 1
+ parsed_line += "
"
+ # Since Appstream does not support nested lists ind their standart, this is left out
+ '''
+ parsed_line += f"- {__parse_line(line.lstrip(ul_sep))}
"
+ elif line_depth == curr_line_depth + 2 and curr_ul_sep != "":
+ parsed_line += f"{__parse_line(line)}"
+ else:
+ line = line.lstrip("#")
+ if ul_depth != 0:
+ parsed_line += "
" * ul_depth
+ ul_depth = 0
+ curr_ul_sep = ""
+ if line.strip() != "":
+ parsed_line += f"{__parse_line(line)}
"
+
+ return (
+ parsed_line +
+ __parse_markup(
+ lines, idx + 1, ul_depth,
+ curr_ul_sep, line_depth
+ )
+ ).replace("", "")
+
+
+def __parse_version_date(heading: str) -> tuple[str, str]:
+ heading = heading.strip("##").strip()
+ version_sub, date = heading.split(" - ")
+
+ return version_sub.split("[")[1].split("]")[0].strip(), date.strip()
+
+
+def __parse_release_xml(release: tuple[str, list[str]]) -> str:
+ version, date = __parse_version_date(release[0])
+
+ markup = __parse_markup(release[1])
+
+ urgency = "medium" if version.endswith(".0") else "low"
+
+ return f"""
+
+ {markup}
+
+ https://github.com/lxgr-linux/pokete/releases/tag/{version}
+ """
+
+
+def __get_full_releases(releases: list[str]):
+ return f"""
+ {"\n".join(releases)}
+ """
+
+
+def check_versions(tag: str, raw_releases: RawReleases):
+ all_versions = [__parse_version_date(release[0])[0]
+ for release in raw_releases]
+ if tag.lstrip("v") not in all_versions:
+ print(f":: Warning: release tag `{tag}` has no changelog entry!")
+
+
+def write_changelog(tag: str):
+ with open("Changelog.md", "r") as changelog_file:
+ changelog_content = changelog_file.read()
+ raw_releases = __get_raw_releases(changelog_content)
+ check_versions(tag, raw_releases)
+ releases = [__parse_release_xml(r) for r in raw_releases]
+ full_releases = __get_full_releases(releases)
+ with open("assets/pokete.metainfo.xml", "r") as metainfo_file:
+ content = metainfo_file.read()
+ new_content = re.sub(r'.*? ', full_releases,
+ content, flags=re.DOTALL)
+ with open("assets/pokete.metainfo.xml", "w") as metainfo_file:
+ metainfo_file.write(
+ "\n".join(
+ line for line in xml.dom.minidom.parseString(
+ new_content.replace("\n", "")
+ )
+ .toprettyxml(encoding="UTF-8")
+ .decode("UTF-8")
+ .split("\n")
+ if line.strip()
+ )
+ )
diff --git a/util/release/release_py.py b/util/release/release_py.py
new file mode 100644
index 00000000..03967d07
--- /dev/null
+++ b/util/release/release_py.py
@@ -0,0 +1,11 @@
+def write_release_py(tag: str):
+ with open("release.py", "r") as f:
+ content = f.readlines()
+
+ for idx, line in enumerate(content):
+ if line.startswith('VERSION = "'):
+ content[idx] = f'VERSION = "{tag.lstrip("v")}"\n'
+ break
+
+ with open("release.py", "w") as f:
+ f.writelines(content)
diff --git a/util/versions.py b/util/versions.py
new file mode 100644
index 00000000..9fa7f6bc
--- /dev/null
+++ b/util/versions.py
@@ -0,0 +1,8 @@
+def sort_vers(vers):
+ """Sorts versions
+ ARGS:
+ vers: List of versions
+ RETURNS:
+ Sorted list"""
+ return [k[-1] for k in
+ sorted([([int(j) for j in i.split(".")], i) for i in vers])]
diff --git a/gen_wiki.py b/util/wiki.py
similarity index 93%
rename from gen_wiki.py
rename to util/wiki.py
index 4a1e037f..5c867e2b 100755
--- a/gen_wiki.py
+++ b/util/wiki.py
@@ -7,6 +7,7 @@
import release
from pokete_classes.effects import effects, effect_list
from pokete_data import pokes, attacks, types, items, maps
+from util.command import Flag
SILENT = False
QUIET = False
@@ -28,9 +29,9 @@ def start() -> str:
# Pokete Wiki
This wiki/documentation is a compilation of all Poketes, attacks, and types present in the Pokete game.
-The wiki can be generated using ```$ ./gen_wiki.py```.
+The wiki can be generated using ```$ ./util.py wiki```.
-Use ```$ ./gen_wiki.py help``` to get more information about different wikis.
+Use ```$ ./util.py wiki --help``` to get more information about different wikis.
You can find different versions of this wiki:
@@ -591,51 +592,34 @@ def gen_pics():
file.write(md_str)
-if __name__ == "__main__":
- if len(sys.argv) == 1:
+def gen(ex: str, options: list[str],
+ flags: dict[str, list[str]]):
+ global SILENT, QUIET, VERBOSE
+ if len(flags) == 0:
SILENT, QUIET, VERBOSE = False, True, False
Wiki.single()
gen_pics()
else:
- for arg in sys.argv[1:]:
- if arg.lower() in ["silent", "quite", "verbose"]:
- SILENT, QUIET, VERBOSE = False, False, False
- if arg.lower() == "silent":
- SILENT = True
- elif arg.lower() == "quite":
- QUIET = True
- else:
- VERBOSE = True
- elif arg.lower() == "single":
+ for flag in flags:
+ if silent_flag.is_flag(flag):
+ SILENT, QUIET, VERBOSE = True, False, False
+ elif quiet_flag.is_flag(flag):
+ SILENT, QUIET, VERBOSE = False, True, False
+ elif silent_flag.is_flag(flag):
+ SILENT, QUIET, VERBOSE = False, False, True
+ elif single_flag.is_flag(flag):
Wiki.single()
- elif arg.lower() == "multi":
+ elif multi_flag.is_flag(flag):
Wiki.multi("wiki")
- elif arg.lower() == "pics":
+ elif pics_flag.is_flag(flag):
gen_pics()
- else:
- print(f"""gen_wiki.py:
-
-Usage:
-------
-{sys.argv[0]} OPTION1 (OPTION2 OPTION3 ...)
-
-Options:
---------
-silent:\t\tPrints no statements at all
-quite:\t\tPrints only some minimal statements
-verbose:\tPrints everything that it's doing
-single:\t\tGenerated the `wiki.md` as a single file
-multi:\t\tGenerates a folder `wiki` with the wiki files
-\t\t(Warning: Links are for html pages, not markdown pages!)
-pics:\t\tGenerates the `assets/pics.md` file with all sample pictures
-
-Examples:
----------
-- {sys.argv[0]} silent single verbose multi
-\t`-> Creates wiki.md silently and the multi-wiki verbosely
-- {sys.argv[0]} quite single multi pics
-\t`-> Creates wiki.md, the multi-page wiki and pics.md quitely
-
-Copyright (c) lxgr-linux 2021""")
- if arg.lower() not in ["-h", "--help", "help"]:
- sys.exit(2)
+
+
+silent_flag = Flag(["--silent"], "Prints no statements at all")
+quiet_flag = Flag(["--quiet"], "Prints only some minimal statements")
+verbose_flag = Flag(["--verbose"], "Prints everything it's doing")
+single_flag = Flag(["--single"], "Generates the `wiki.md` as a single file")
+multi_flag = Flag(["--multi"],
+ "Generates a folder `wiki` with the wiki files")
+pics_flag = Flag(["--pics"],
+ "Generates the `assets/pics.md` file with all sample pictures")
diff --git a/wiki.md b/wiki.md
index a7abfead..78e4142b 100644
--- a/wiki.md
+++ b/wiki.md
@@ -2,9 +2,9 @@ v0.9.2
# Pokete Wiki
This wiki/documentation is a compilation of all Poketes, attacks, and types present in the Pokete game.
-The wiki can be generated using ```$ ./gen_wiki.py```.
+The wiki can be generated using ```$ ./util.py wiki```.
-Use ```$ ./gen_wiki.py help``` to get more information about different wikis.
+Use ```$ ./util.py wiki --help``` to get more information about different wikis.
You can find different versions of this wiki: