Starting to implement gen
This commit is contained in:
parent
ee51947439
commit
97bbea1bef
139
cyberpnk.txt
139
cyberpnk.txt
|
|
@ -1,13 +1,126 @@
|
|||
@ Compétences
|
||||
+ Sub section
|
||||
- Competence 1
|
||||
- Competence 2
|
||||
. Repeating 1
|
||||
+ Sub section 2
|
||||
+ Sub section 3
|
||||
+ Sub section 4
|
||||
@ Magie
|
||||
+ Subsection 2
|
||||
@ Combat
|
||||
+ Subsection 2
|
||||
- Competence2
|
||||
@ Physique
|
||||
+ Compétences de combat
|
||||
- : Armes à feu
|
||||
- : Armes d'assaut
|
||||
- : Armes de poing
|
||||
- Armes Lourdes
|
||||
- : Projectiles autopropulsés
|
||||
- : Armement laser
|
||||
- Artillerie
|
||||
: Guidage de missiles
|
||||
: Systemes de défences
|
||||
: Balistique superlative
|
||||
- Combat à Mains Nues
|
||||
: Neo Kwon Do
|
||||
: Zero-G
|
||||
- Combat Armé
|
||||
: Armes Contandantes
|
||||
: Armes Tranchantes
|
||||
- Maniement des Explosifs
|
||||
|
||||
+ Compétences physiques
|
||||
- Athlétisme
|
||||
- : Aerien
|
||||
- : Terrestre
|
||||
- : Maritime
|
||||
- : Zero G
|
||||
- Survie
|
||||
- : Environnement Sauvage
|
||||
- : Environnement Urbain
|
||||
- : Environnement Spacial
|
||||
|
||||
+ Utilisation d’implants
|
||||
- Utilisation de Cyberware
|
||||
- : Utilisation de Neuro Accelerateurs
|
||||
- : Utilisation d'Interfaces de tir
|
||||
- : Overdrive Physique
|
||||
|
||||
+ Compétences de Pilotage
|
||||
- Pilotage athmosphérique
|
||||
- : Pilotage de Chasseurs
|
||||
- : Pilotage de Navettes
|
||||
- Vehicules Terestres
|
||||
- : Vehicules Legers
|
||||
- : Vehicules Lourds
|
||||
- : Véhicules de Course
|
||||
- Vaisseaux Spatiaux
|
||||
- : Batiments légers
|
||||
- : Batiments lourds
|
||||
- : Batiments super lourds
|
||||
|
||||
@ Intelectuelles
|
||||
|
||||
+ Compétences Techniques
|
||||
- Biotech
|
||||
- : Chirurgie d’implants
|
||||
- Electronique
|
||||
- : Interconnection des systèmes
|
||||
- : Verrous magnétiques
|
||||
- Informatique
|
||||
- : Hardware
|
||||
- : Software
|
||||
- : Systèmes embarqués
|
||||
- Mecanique
|
||||
- : Réacteurs à Fusion
|
||||
- : Réacteurs à Fission
|
||||
- : Compensateurs d'Inertie
|
||||
- : Technologie Lightfold
|
||||
- : Systèmes de Survie
|
||||
- : Systemes de Propultion
|
||||
- Prospection stellaire
|
||||
- : Corps stellaires
|
||||
- : Excavation planetaire
|
||||
|
||||
+ Connaissances
|
||||
- Bioware
|
||||
- : Implants Céphaliens
|
||||
- : Implants Corporels
|
||||
- Médecine
|
||||
- : Soins Intensifs
|
||||
- : Cybernetisation
|
||||
- Sciences
|
||||
- : Astromathématiques
|
||||
- : Biologie
|
||||
- : Xenobiologie
|
||||
- : Mathématiques
|
||||
- : Physique/Chimie
|
||||
- : Lightfold
|
||||
- : Sociologie
|
||||
|
||||
+ Culture Générale
|
||||
- Instruction Civique
|
||||
- : Administratif/Politique/Droit
|
||||
- : Finances
|
||||
- : Psychologie
|
||||
- Théorie Militaire
|
||||
- : Tactique
|
||||
- : Stratégie
|
||||
|
||||
@ Social
|
||||
+ Compétences Sociales
|
||||
- Etiquette
|
||||
- : Alpha Centauri
|
||||
- : Eridani
|
||||
- : Banard
|
||||
- : Tau
|
||||
- : Sirius
|
||||
- : C.I.C.
|
||||
- : Sol
|
||||
- : Pègre
|
||||
- Interrogation
|
||||
- : Intimidation
|
||||
- Commandement
|
||||
- Négociation
|
||||
- Baratin
|
||||
|
||||
+ Competences Clandestines
|
||||
- Discretion
|
||||
- Crochetage
|
||||
- Informations
|
||||
- Larcin
|
||||
- Marchés noirs
|
||||
- : Acquisition d’Objets
|
||||
- : Acquisition d’Informations
|
||||
|
||||
+ Contacts et Réputations
|
||||
. Contacts
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
div.sheet-tab-content { display: none; }
|
||||
input.sheet-tab1:checked ~ div.sheet-tab1,
|
||||
input.sheet-tab2:checked ~ div.sheet-tab2,
|
||||
input.sheet-tab3:checked ~ div.sheet-tab3
|
||||
{display: block;}
|
||||
|
||||
input.sheet-physique1:checked ~ div.sheet-physique1,
|
||||
input.sheet-physique2:checked ~ div.sheet-physique2,
|
||||
input.sheet-physique3:checked ~ div.sheet-physique3,
|
||||
input.sheet-physique4:checked ~ div.sheet-physique4
|
||||
{display: block;}
|
||||
|
||||
input.sheet-intelectuelles1:checked ~ div.sheet-intelectuelles1,
|
||||
input.sheet-intelectuelles2:checked ~ div.sheet-intelectuelles2,
|
||||
input.sheet-intelectuelles3:checked ~ div.sheet-intelectuelles3
|
||||
{display: block;}
|
||||
|
||||
input.sheet-social1:checked ~ div.sheet-social1,
|
||||
input.sheet-social2:checked ~ div.sheet-social2,
|
||||
input.sheet-social3:checked ~ div.sheet-social3
|
||||
{display: block;}
|
||||
101
generator.py
101
generator.py
|
|
@ -1,19 +1,24 @@
|
|||
#ENCODING UTF-8
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
# content skills sections and others from a file, on the long run, it should be able to content the whole sheet
|
||||
|
||||
import argparse, sys, os
|
||||
from unidecode import unidecode
|
||||
# import unicode
|
||||
|
||||
def remove_non_ascii(text):
|
||||
return unidecode(text)
|
||||
|
||||
class Node(object):
|
||||
"""Generic Node."""
|
||||
def __init__(self, name,nb):
|
||||
self.name = name.strip(" ")
|
||||
self.name = name#name.strip(" ")
|
||||
self.number=nb
|
||||
self.children=[]
|
||||
self.checked=""
|
||||
self.parent=None
|
||||
self.pname=name.replace(" ","").lower()
|
||||
self.pname=u""+remove_non_ascii(self.name.replace(" ","")).lower()
|
||||
if nb==1:
|
||||
self.checked='checked="checked"'
|
||||
|
||||
|
|
@ -28,9 +33,7 @@ class Node(object):
|
|||
|
||||
def addchild(self,child):
|
||||
self.children+=[child]
|
||||
|
||||
# def printable(self,name):
|
||||
# return
|
||||
child.parent=self
|
||||
|
||||
class Root(Node):
|
||||
"""docstring for Root."""
|
||||
|
|
@ -52,11 +55,13 @@ class Root(Node):
|
|||
|
||||
def css(self):
|
||||
"Return the whole css, printable"
|
||||
ret="""div.sheet-tab-content { display: none; }"""
|
||||
ret="div.sheet-tab-content { display: none; }"
|
||||
for child in self.children:
|
||||
ret+="input.sheet-tab{}:checked ~ div.sheet-tab{},\n".format(child.number)
|
||||
ret+="\ninput.sheet-tab{node.number}:checked ~ div.sheet-tab{node.number},".format(node=child)
|
||||
ret=ret[:-1]
|
||||
ret+="{display: block;}"
|
||||
ret+="\n{display: block;}\n"
|
||||
for child in self.children:
|
||||
ret+=child.css()
|
||||
return ret
|
||||
|
||||
class Tab(Node):
|
||||
|
|
@ -76,47 +81,56 @@ class Tab(Node):
|
|||
for child in self.children:
|
||||
ret+=child.content()
|
||||
return ret
|
||||
|
||||
def css(self):
|
||||
ret=" "
|
||||
for child in self.children:
|
||||
ret+="\ninput.sheet-{node.pname}{child.number}:checked ~ div.sheet-{node.pname}{child.number},".format(child=child,node=self)
|
||||
ret=ret[:-1]
|
||||
ret+="\n{display: block;}\n"
|
||||
return ret
|
||||
class SubTab(Node):
|
||||
def __init__(self,name,nb):
|
||||
super(SubTab,self).__init__(name,nb)
|
||||
|
||||
def header(self):
|
||||
return """ <input type="radio" name="secondary_skills_tab" class="small_tab secondary_skills_tab{self.number}" {self.checked} value="{self.number}" title="{self.name}" />\n""".format(self=self)
|
||||
return """ <input type="radio" name="secondary_tab_{self.parent.pname}" class="small_tab secondary_tab_{self.parent.pname}{self.number}" {self.checked} value="{self.number}" title="{self.name}" />\n""".format(self=self)
|
||||
|
||||
def content(self):
|
||||
ret= ' <div class="sheet-tab-content sheet-secondary_skills_tab{self.number}">\n'.format(self=self)
|
||||
ret= ' <div class="sheet-tab-content sheet-secondary_tab_{self.parent.pname}{self.number}">\n'.format(self=self)
|
||||
ret+=" <!-- {self.name} -->\n <h3>{self.name}</h3>\n".format(self=self)
|
||||
for child in self.children:
|
||||
ret+=child.content()
|
||||
ret+=" </div>\n"
|
||||
return ret
|
||||
def css(self):
|
||||
return ""
|
||||
|
||||
class Skill(Node):
|
||||
"""Print a skill."""
|
||||
def __init__(self, name,nb):
|
||||
super(Skill, self).__init__(name,nb)
|
||||
|
||||
def content(self):
|
||||
def content(self): # {self.parent.pname} is not needed, else _skilllevel_ cause a confict, legacy keeping I guess ?
|
||||
ret=""" <!--{self.name} -->
|
||||
<input class="sheet-skill_name" style="margin-right: 4px;" type="text" name="attr_general_skill_{self.pname}" disabled="true" value="{self.name}" />
|
||||
<input class="sheet-skill_name" style="margin-right: 4px;" type="text" name="attr_{self.parent.pname}_skill_{self.pname}" disabled="true" value="{self.name}" />
|
||||
<input type="number" min="0" value="0" name="attr_skillcost_Fauchage" title="Coût de la compétence" />
|
||||
<input class="sheet-skill_name" value="0" style="margin-right: 4px;" type="number" min="0" max="10" name="attr_general_skilllevel_{self.pname}" title="Niveau dans la compétence" />
|
||||
<select class="sheet-skill_select" style="margin-right:4px" name="attr_Skill_general_attribute_select_{self.pname}">
|
||||
<option value="@{base-Force} + @{exal-Force}">For</option>
|
||||
<option value="@{base-Agilite} + @{exal-Agilite}">Agi</option>
|
||||
<option value="@{base-Perception} + @{exal-Perception}">Per</option>
|
||||
<option value="@{base-Charisme} + @{exal-Charisme}">Cha</option>
|
||||
<option value="@{base-Intelligence} + @{exal-Intelligence}">Int</option>
|
||||
<option value="@{base-Perception} + @{exal-Perception}">Per</option>
|
||||
<option value="@{base-Volonte} + @{exal-Volonte}">Vol</option>
|
||||
<option value="@{base-Psyche} + @{exal-Psyche}">Psy</option>
|
||||
<option value="@{base-Chance} + @{exal-Chance}">Chn</option>
|
||||
<input class="sheet-skill_name" value="0" style="margin-right: 4px;" type="number" min="0" max="10" name="attr_{self.parent.pname}_skilllevel_{self.pname}" title="Niveau dans la compétence" />
|
||||
<select class="sheet-skill_select" style="margin-right:4px" name="attr_skill_{self.parent.pname}_attribute_select_{self.pname}">
|
||||
<option value="@{{base-Force}} + @{{exal-Force}}">For</option>
|
||||
<option value="@{{base-Agilite}} + @{{exal-Agilite}}">Agi</option>
|
||||
<option value="@{{base-Perception}} + @{{exal-Perception}}">Per</option>
|
||||
<option value="@{{base-Charisme}} + @{{exal-Charisme}}">Cha</option>
|
||||
<option value="@{{base-Intelligence}} + @{{exal-Intelligence}}">Int</option>
|
||||
<option value="@{{base-Perception}} + @{{exal-Perception}}">Per</option>
|
||||
<option value="@{{base-Volonte}} + @{{exal-Volonte}}">Vol</option>
|
||||
<option value="@{{base-Psyche}} + @{{exal-Psyche}}">Psy</option>
|
||||
<option value="@{{base-Chance}} + @{{exal-Chance}}">Chn</option>
|
||||
</select>
|
||||
<button type='roll' class="sheet-skillbutton" value="&{template:d10skillcheck}{{name=@{character_name}}} {{roll_name=@{general_skill_{self.pname}}}} {{dice_name=@{dice}}} {{result=[[@{general_skilllevel_{self.pname}}+(@{Skill_general_attribute_select_{self.pname}})-d@{dice}cs1cf@{dice}]]}} {{threshold=[[@{general_skilllevel_{self.pname}}+(@{Skill_general_attribute_select_{self.pname}})]]}} "></button>
|
||||
<br/>""".format(self=self)
|
||||
|
||||
<button type='roll' class="sheet-skillbutton" value="&{{template:d10skillcheck}} {{{{name=@{{character_name}}}}}} {{{{roll_name=@{{{self.parent.pname}_skill_{self.pname}}}}}}} {{{{dice_name=@{{dice}}}}}} {{{{result=[[@{{{self.parent.pname}_skilllevel_{self.pname}}}+(@{{skill_{self.parent.pname}_attribute_select_{self.pname}}})-d@{{{{dice}}cs1cf@{{dice}}]]}}}} {{{{threshold=[[@{{{self.parent.pname}_skilllevel_{self.pname}}}+(@{{skill_{self.parent.pname}_attribute_select_{self.pname}}})]]}}}}"></button>
|
||||
<br/>\n""".format(self=self)
|
||||
return ret
|
||||
|
||||
#
|
||||
# <!--INTELECTUELLES -->
|
||||
# <h3>Compétences Intellectuelles</h3>
|
||||
# <fieldset class="repeating_intelect-skills">
|
||||
|
|
@ -124,31 +138,33 @@ class Skill(Node):
|
|||
# <input type="number" name="attr_intelect_skillcost" title="Coût de la compétence" />
|
||||
# <input type="number" min="-10" max="10" name="attr_intelect_skilllevel" title="Niveau dans la compétence" />
|
||||
# <select class="sheet-skill_select" name="attr_intelect_attribute_select">
|
||||
# <option value="@{base-Force} + @{exal-Force}">For</option>
|
||||
# <option value="@{base-Agilite} + @{exal-Agilite}">Agi</option>
|
||||
# <option value="@{base-Perception} + @{exal-Perception}">Per</option>
|
||||
# <option value="@{base-Charisme} + @{exal-Charisme}">Cha</option>
|
||||
# <option value="@{base-Intelligence} + @{exal-Intelligence}">Int</option>
|
||||
# <option value="@{base-Perception} + @{exal-Perception}">Per</option>
|
||||
# <option value="@{base-Volonte} + @{exal-Volonte}">Vol</option>
|
||||
# <option value="@{base-Psyche} + @{exal-Psyche}">Psy</option>
|
||||
# <option value="@{base-Chance} + @{exal-Chance}">Chn</option>
|
||||
# <option value="@{{base-Force}} + @{{exal-Force}}">For</option>
|
||||
# <option value="@{{base-Agilite}} + @{{exal-Agilite}}">Agi</option>
|
||||
# <option value="@{{base-Perception}} + @{{exal-Perception}}">Per</option>
|
||||
# <option value="@{{base-Charisme}} + @{{exal-Charisme}}">Cha</option>
|
||||
# <option value="@{{base-Intelligence}} + @{{exal-Intelligence}}">Int</option>
|
||||
# <option value="@{{base-Perception}} + @{{exal-Perception}}">Per</option>
|
||||
# <option value="@{{base-Volonte}} + @{{exal-Volonte}}">Vol</option>
|
||||
# <option value="@{{base-Psyche}} + @{{exal-Psyche}}">Psy</option>
|
||||
# <option value="@{{base-Chance}} + @{{exal-Chance}}">Chn</option>
|
||||
# </select>
|
||||
# <button type='roll' class="sheet-skillbutton" value="&{template:d10skillcheck}{{name=@{character_name}}} {{roll_name=@{intelect_skillname}}} {{dice_name=@{dice}}} {{result=[[@{intelect_skilllevel}+(@{intelect_attribute_select})-d@{dice}cs1cf@{dice}]]}} {{threshold=[[@{intelect_skilllevel}+(@{intelect_attribute_select})]]}}"></button>
|
||||
# <button type='roll' class="sheet-skillbutton" value="&{template:d10skillcheck}{{name=@{{character_name}}}} {{roll_name=@{{intelect_skillname}}}} {{dice_name=@{{dice}}}} {{result=[[@{{intelect_skilllevel}}+(@{{intelect_attribute_select}})-d@{{dice}}cs1cf@{{dice}}]]}} {{threshold=[[@{{intelect_skilllevel}}+(@{{intelect_attribute_select}})]]}}"></button>
|
||||
# </fieldset>
|
||||
# </div>
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# filen=sys.argv[1]
|
||||
# filen="light.txt"
|
||||
filen="cyberpnk.txt"
|
||||
|
||||
output="gen.html"
|
||||
outcss="gencss.css"
|
||||
def parse(filen):
|
||||
root=Root()
|
||||
active_tab,active_subtab=None,None
|
||||
tab_nb,subtab_nb,skill_nb=1,1,1
|
||||
try:
|
||||
with open(filen) as f:
|
||||
with open(filen,encoding="utf-8") as f:
|
||||
for line in f.readlines():
|
||||
if line[0]=="@": # Tab
|
||||
active_tab=Tab(line[1:-1],tab_nb)
|
||||
|
|
@ -168,4 +184,7 @@ if __name__ == '__main__':
|
|||
print(filen,"was not found")
|
||||
return root
|
||||
root=parse(filen)
|
||||
print(root.content())
|
||||
with open(output,"w",encoding="utf-8") as f:
|
||||
f.write(root.content())
|
||||
with open(outcss,"w",encoding="utf-8") as f:
|
||||
f.write(root.css())
|
||||
|
|
|
|||
Loading…
Reference in New Issue