From 588c128dfd825a140bec28100681931d489c4361 Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Wed, 26 May 2021 14:58:32 +0200 Subject: [PATCH] rctfile will now generate, for Race_?.szs --- source/create_lecode_config.py | 35 ++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/source/create_lecode_config.py b/source/create_lecode_config.py index 500dd7c..8c5e280 100644 --- a/source/create_lecode_config.py +++ b/source/create_lecode_config.py @@ -4,24 +4,39 @@ import json def create_lecode_config(self): with open("./ct_config.json") as f: ctconfig = json.load(f) - with open("./file/CTFILE.txt", "w") as ctfile: - ctfile.write( - "#CT-CODE\n" + - "[RACING-TRACK-LIST]\n" + - "%LE-FLAGS=1\n" + - "%WIIMM-CUP=1\n" + - "N N$SWAP | N$F_WII\n\n") + with open("./file/CTFILE.txt", "w") as ctfile, open("./file/RCTFILE.txt", "w") as rctfile: + + header = "#CT-CODE\n" +\ + "[RACING-TRACK-LIST]\n" +\ + "%LE-FLAGS=1\n" +\ + "%WIIMM-CUP=1\n" +\ + "N N$SWAP | N$F_WII\n\n" + ctfile.write(header) + rctfile.write(header) for cup in ctconfig["cup"]: _cup_config = ctconfig["cup"][cup] if int(cup) >= 9: # Course qui ne sont ni les originales, ni les courses aléatoires. - ctfile.write(f'\nC "{_cup_config["name"]}"\n') + cup = f'\nC "{_cup_config["name"]}"\n' + ctfile.write(cup) + rctfile.write(cup) for course in _cup_config["courses"]: _course_config = _cup_config["courses"][course] - ctfile.write(f'T {_course_config["music"]}; ' + + star = "" + if "score" in _course_config: + if _course_config["score"] > 0: + star = "★"*_course_config["score"]+"☆"*(3-_course_config["score"])+" " + + ctfile.write(f' T {_course_config["music"]}; ' + f'{_course_config["special"]}; ' + f'{"0x01" if _course_config["new"] else "0x00"}; ' + f'"{_course_config["name"]}"; ' + - f'"{_course_config["name"]}"; ' + + f'"{star}{_course_config["name"]}"; ' + f'"-"\n') + + rctfile.write(f' T {_course_config["music"]}; ' + + f'{_course_config["special"]}; ' + + f'{"0x01" if _course_config["new"] else "0x00"}; ' + + f'"{star}{_course_config["name"]}\\n{_course_config["author"]}"; ' + + f'"-"\n') \ No newline at end of file