diff --git a/Helpers/Characters/God.ini b/Helpers/Characters/God.ini index 6b93747..f26603c 100644 --- a/Helpers/Characters/God.ini +++ b/Helpers/Characters/God.ini @@ -1,13 +1,13 @@ [Base] - fo = (@{base-Force}+{exal-Force}) - ag = (@{base-Agilite}+{exal-Agilite}) - pe = (@{base-Perception}+{exal-Perception}) - ca = (@{base-Charisme}+{exal-Charisme}) - in = (@{base-Intelligence}+{exal-Intelligence}) - vo = (@{base-Volonte}+{exal-Volonte}) - ps = (@{base-Psyche}+{exal-Psyche}) - cn = (@{base-Chance}+{exal-Chance}) - sp = (@{base-special}+{exal-special}) + fo = (@{base-Force}+@{exal-Force}) + ag = (@{base-Agilite}+@{exal-Agilite}) + pe = (@{base-Perception}+@{exal-Perception}) + ca = (@{base-Charisme}+@{exal-Charisme}) + in = (@{base-Intelligence}+@{exal-Intelligence}) + vo = (@{base-Volonte}+@{exal-Volonte}) + ps = (@{base-Psyche}+@{exal-Psyche}) + cn = (@{base-Chance}+@{exal-Chance}) + sp = (@{base-special}+@{exal-special}) [Type] big = changes [God] diff --git a/Helpers/Characters/Julien.ini b/Helpers/Characters/Julien.ini index 0049f44..bedae8e 100644 --- a/Helpers/Characters/Julien.ini +++ b/Helpers/Characters/Julien.ini @@ -1,10 +1,8 @@ [Sceau du Phenix] - niveau = Ultime + level = Ultime display_name = Sceau du Phénix - description = - self = - others = - _vars = - macro = xhanges -[Sceau du Ninix] - elno=test + description = a + self =n + others = n + _vars =n + macro = changes diff --git a/Helpers/Characters/exemple.ini b/Helpers/Characters/exemple.ini index a1ba301..1ea7f91 100644 --- a/Helpers/Characters/exemple.ini +++ b/Helpers/Characters/exemple.ini @@ -1,5 +1,5 @@ [Nom technique] - niveau = Ultime/Avancée/Simple + level = Ultime/Avancée/Simple display_name = Nom de la technique description = Description pour dev/balance/concept self = Message complet pour l'utilisateur lors de l'utilisation diff --git a/Helpers/macro.py b/Helpers/macro.py index 783702f..cfe3c5e 100755 --- a/Helpers/macro.py +++ b/Helpers/macro.py @@ -1,5 +1,5 @@ import sys,os,traceback -import re,argparse +import re,argparse,configparser from os import listdir from os.path import isfile, join @@ -7,7 +7,7 @@ import blessings term=blessings.Terminal() parser = argparse.ArgumentParser(description='Macro generator') -parser.add_argument('command',choices=["macro","varnames","diff"],help="The selected command") +parser.add_argument('command',choices=["macro","varnames","diff",'show'],help="The selected command") parser.add_argument('characters',default=["all"],help="Name of the characters to list, all by default",nargs="*") parser.add_argument("-o",metavar="output",default="tty",help="File for the output command, tty by default",nargs="?") parser.add_argument("-v",default=False,action='store_true',help="Default") @@ -19,13 +19,43 @@ def dprint(text): reserved_chars=["exemple.ini","God.ini"] errors={ - "notfound":term.red("Couldn't find {char} in the Character directory") + "notfound":term.red("Couldn't find {char} in the Character directory"), + "sectionnotfound":term.red("Coulnd't find section {section} in {where}") } def macro(e): pass +def show(characters,output,version): + list_files=get_char(characters) + if not list_files: + return + ret="" + for file in list_files: + ret+=show_one(file,output,version) + if output=="tty": + print(ret) + else: + with open(output,"r") as f: + f.write(ret) + +def show_one(character,output,version): + config=configparser.ConfigParser() + config.read(character) + ret="" + for sect in config.sections(): + text="" + text+=term.bold_green("[{level}] {title}\n").format(title=config[sect]["display_name"],level=config[sect]["level"]) + for dname,sname in (('Description',"description"),("Description personelle",'self'),("Description publique","others"),("Spécial","special")): + try: + adden=" {t}\n {c}\n".format(t=term.green_underline(dname),c=config[sect][sname].replace("\n","\n ")) + text+=adden + except: + dprint(errors["sectionnotfound"].format(section=sname,where=sect)) + ret+=text + return ret + def varnames(e): pass @@ -69,5 +99,5 @@ if __name__ == '__main__': parser.print_help() sys.exit() #print(args) - commands={"macro":macro,"varnames":varnames,"diff":diff} + commands={"macro":macro,"varnames":varnames,"diff":diff,"show":show} commands[args.command](args.characters,args.o,args.version) diff --git a/Helpers/test.html b/Helpers/test.html deleted file mode 100644 index 02f744b..0000000 --- a/Helpers/test.html +++ /dev/null @@ -1,333 +0,0 @@ - -
- - - - - --diff --git a/Helpers/Characters/God.ini b/Helpers/Characters/God.ini -index 05b1e42..6b93747 100644 ---- a/Helpers/Characters/God.ini -+++ b/Helpers/Characters/God.ini -@@ -1,13 +1,13 @@ -[Base] - fo = (@{base-Force}+{exal-Force}) - ag = (@{base-Agilite}+{exal-Agilite}) - pe = (@{base-Perception}+{exal-Perception}) - ca = (@{base-Charisme}+{exal-Charisme}) - in = (@{base-Intelligence}+{exal-Intelligence}) - vo = (@{base-Volonte}+{exal-Volonte}) - ps = (@{base-Psyche}+{exal-Psyche}) - cn = (@{base-Chance}+{exal-Chance}) - sp = (@{base-special}+{exal-special}) -[Type] -big = changes -[God] -diff --git a/Helpers/Characters/Julien.ini b/Helpers/Characters/Julien.ini -index cd431e0..0049f44 100644 ---- a/Helpers/Characters/Julien.ini -+++ b/Helpers/Characters/Julien.ini -@@ -1,9 +1,10 @@ -[Sceau du Phenix] - niveau = Ultime - display_name = Sceau du Phénix - description = - self = - others = - _vars = - macro = xhanges -[Sceau du Ninix] - elno=test -- -