Added macro generator

This commit is contained in:
Maximilien Rigaut 2019-07-19 04:56:06 +02:00
parent 883f2a7eea
commit e87feed534
6 changed files with 125 additions and 18 deletions

View File

@ -1 +1,24 @@
<html><head><title>Redirect</title><meta http-equiv="refresh" content="0;URL=./19-07-18-22-29.html"></head><body></body></html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="../term.css"/>
</head>
<body class="f9 b9">
<pre>
<span class="bold">Liste des modifications</span>
<span><a style= "text-decoration:none;" href="./19-07-18-22-29.html">Modifications du 19-07-18-22-29</a></span>
<span class=""><a href="./19-07-19-03-48.html">Modifications du 19-07-19-03-48</a></span>
<span class=""><a href="./19-07-18-21-58.html">Modifications du 19-07-18-21-58</a></span>
<span class=""><a href="./19-07-19-03-43.html">Modifications du 19-07-19-03-43</a></span>
<span class=""><a href="./19-07-19-03-41.html">Modifications du 19-07-19-03-41</a></span>
<span class=""><a href="./19-07-19-03-42.html">Modifications du 19-07-19-03-42</a></span>
<span class=""><a href="./19-07-19-03-46.html">Modifications du 19-07-19-03-46</a></span>
<span class=""><a href="./19-07-19-03-49.html">Modifications du 19-07-19-03-49</a></span>
<span class=""><a href="./19-07-18-20-35.html">Modifications du 19-07-18-20-35</a></span>
<span class=""><a href="./19-07-19-03-40.html">Modifications du 19-07-19-03-40</a></span>
<span class=""><a href="./19-07-19-03-47.html">Modifications du 19-07-19-03-47</a></span>
</pre>
</body>
</html>

View File

@ -1,10 +0,0 @@
[Nom technique]
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
others = Message complet pour les autres lors de l'utilisation
var = Valeur de la variable {{var}}
macro = Macro propre de la technique, avec tout les setvars
special = Détails a prendre en compte,
les variables importantes, les stacks. (Notes pour la balance)

View File

@ -0,0 +1,13 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="../term.css"/>
</head>
<body class="f9 b9">
<pre>
<span class="bold">Characters/frene.ini</span>
</pre>
</body>
</html>

View File

@ -0,0 +1,23 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="../term.css"/>
</head>
<body class="f9 b9">
<pre>
<span class="bold">Characters/voile.ini</span>
<span class="bold"><span class="f4">[Harmony]</span></span>
Une macro sert a ajuster l'harmonie et generer tous les bonus necessaires puis afficher ces bonus
<span class="bold"><span class="f4">[Impact]</span></span>
Reset du momentum, génération du hit
<span class="bold"><span class="f4">[Adagio]</span></span>
Augmenter le momentum
<span class="bold"><span class="f4">[Tempo Martial]</span></span>
sacrifier actions et générer un hit/afficher le bonus
<span class="bold"><span class="f4">[Ire Sanglante]</span></span>
Afficher le total
</pre>
</body>
</html>

View File

@ -17,8 +17,7 @@ verbose=False
def dprint(text):
if verbose:
print(text)
notrash_chars=["exemple.ini"]
reserved_chars=["exemple.ini","God.ini"]
reserved_chars=["God.ini"]
errors={
"notfound":term.red("[Error] Couldn't find {char} in the Character directory"),
@ -29,10 +28,29 @@ god=configparser.ConfigParser(inline_comment_prefixes="#")
god.read("Characters/God.ini")
def macro(e):
pass
def write_index(output):
list=[f for f in listdir(output) if (f != "latest.html" and isfile(join(output, f)))]
towrite="""<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="../term.css"/>
</head>
<body class="f9 b9">
<pre>
<span class="bold">Liste des modifications</span>
"""
for file in list:
towrite+=' <span class="bold"><a href="./{}">Modifications du {}</a></span>\n'.format(file,file[:-5])
towrite+=""" </pre>
</body>
</html>"""
with open(join(output,"latest.html"),"w") as f:
f.write(towrite)
def save_text_ansi(foutput,ret):
pi=subprocess.Popen(("./ansi2html.sh","--palette=xterm"),stdin=subprocess.PIPE,stdout=subprocess.PIPE)
e=str.encode(ret,"utf8")
@ -46,6 +64,37 @@ def save_text_ansi(foutput,ret):
break
f.write(line)
def macro(characters,output,version):
list_files,names=get_char(characters)
if not list_files:
return
ret=""
for file,name in zip(list_files,names):
ret=macro_one(file,output,version)
if output=="tty":
print(ret)
else:
foutput=join(output,name+"_macro.html")
save_text_ansi(foutput,ret)
def macro_one(character,output,version):
config=configparser.ConfigParser(inline_comment_prefixes="#")
config.read(character)
ret=term.bold(character)+"\n"
for sect in config.sections():
try:
text=""
if (config[sect]["macro"]) != "":
text+=term.bold_blue("[{name}]\n".format(name=config[sect]["display_name"]))
text+=" "+replace_vars(config[sect]["macro"],config,god,"macro",sect,character).replace("\n","\n ")
text+="\n"
ret+=text
except KeyError:
pass # No macro found, not really important
return ret
def show(characters,output,version):
list_files,names=get_char(characters)
if not list_files:
@ -117,8 +166,7 @@ def diff(characters,output,version):
save_file=join(output,date)
with open(save_file,"wb") as file:
file.write(pi)
with open(join(output,"latest.html"),"w") as file:
file.write('<html><head><title>Redirect</title><meta http-equiv="refresh" content="0;URL=./{}"></head><body></body></html>'.format(date))
write_index(output)
def get_char(names,all=False):
if names[0]=="all":
@ -135,7 +183,9 @@ def get_char(names,all=False):
def get_all_chars(all):
if all:
reserved_chars=notrash_chars
c=[]
else:
c=reserved_chars
names=[f for f in listdir("Characters") if (f not in reserved_chars and isfile(join("Characters", f)))]
return [join("Characters", f) for f in names],[n[:-4] for n in names] # MOAR BLOBSHITCODING

View File

@ -1,3 +1,11 @@
a,a:link, a:visited {
color: #06005f;
text-decoration: none;
}
a:hover, a:active {
color: #9f99ff;;;
background-color: #666666;
}
pre { white-space: pre-wrap; }
.ef0,.f0 { color: #000000; } .eb0,.b0 { background-color: #000000; }
.ef1,.f1 { color: #CD0000; } .eb1,.b1 { background-color: #CD0000; }