浏览代码

Update HTML

master
Noëlle 4 年前
父节点
当前提交
3e81329cfd
共有 2 个文件被更改,包括 72 次插入16 次删除
  1. 1
    0
      .gitignore
  2. 71
    16
      koboldgen.py

+ 1
- 0
.gitignore 查看文件

@@ -2,3 +2,4 @@ koboldstitle.png
koboldstitle.png.kra
koboldstitle.png~
koboldstitle.png-autosave.kra
koboldbody.html

+ 71
- 16
koboldgen.py 查看文件

@@ -186,15 +186,30 @@ class Character:
print(charText)

def print(self, html=False):
self.print_name(html)
if html:
endc = "<br>\n"
out = (
f"<div class='kobold'>\n"
f" <span class='koboldname'>\n"
f" {self.name} (Kobold {self.career})\n"
f" </span>\n"
f" <br>\n"
f" <span class='koboldstats'>\n"
f" <ul>\n"
f" <li>Order: {self.stats[0]}</li>\n"
f" <li>Chaos: {self.stats[1]}</li>\n"
f" <li>Brain: {self.stats[2]}</li>\n"
f" <li>Body: {self.stats[3]}</li>\n"
f" </ul>\n"
f" </span>\n"
f"</div>\n"
)
print(out)
else:
endc = "\n"
print(f"Order: {self.stats[0]}", end=endc)
print(f"Chaos: {self.stats[1]}", end=endc)
print(f"Brain: {self.stats[2]}", end=endc)
print(f"Body: {self.stats[3]}", end=endc)
self.print_name()
print(f"Order: {self.stats[0]}")
print(f"Chaos: {self.stats[1]}")
print(f"Brain: {self.stats[2]}")
print(f"Body: {self.stats[3]}")

class Ship:
def __init__(self):
@@ -245,15 +260,53 @@ class Campaign:
lines.append(f"The stats of the {self.params.thirdProblem['shortname']}")
lines.append("{pst}")
if html:
print(f"<h2>{lines[0]}</h2>")
print(f"<p>{lines[1]} <strong>{lines[2]}</strong> --</p>")
print(f"<p><em>{lines[3]}</em></p>")
print(f"<p>{lines[4]}: {lines[5]}")
out = (
f"<div id='theship'>\n"
f" <span id='shipname'>\n"
f" The {self.ship.fullname}!\n"
f" </span>\n"
f" <br>\n"
f" <span id='shipquality1'>\n"
f" It {self.ship.gqual}\n"
f" </span><br>\n"
f" But...<br>\n"
f" <span id='shipquality2'>\n"
f" {self.ship.bqual}\n"
f" </span>\n"
f"</div>\n"
f"<div id='themission'>\n"
f" <span id='missionloc'>\n"
f" The kobolds have been sent to {self.art} {self.params.loc_desc} {self.params.location}\n"
f" </span><br>\n"
f" <span id='missiontarget'>\n"
f" in order {self.params.mission}.\n"
f" </span>\n"
f"</div>\n"
f"<div id='theadversary'>\n"
f" They're challenged by <span id='advname'>{self.params.fullProblem}</span>!\n"
f" <br>\n"
f" <span id='problemstats'>\n"
f" The stats of the {self.params.problem['shortname']}:<br>\n"
f" {cst}\n"
f" </span>\n"
)
if self.params.secProblem:
print(f"<p style='padding-left: 10px;'>{lines[6]}: {lines[7]}</p>")
out += (
f" <span id='secprobstats'>\n"
f" The stats of the {self.params.secProblem['shortname']}:<br>\n"
f" {mst}\n"
f" </span>\n"
)
if self.params.thirdProblem:
print(f"<p style='padding-left: 20px;'>{lines[8]}: {lines[9]}</p>")
print("</p>")
out += (
f" <span id='thirdprobstats'>\n"
f" The stats of the {self.params.thirdProblem['shortname']}:<br>\n"
f" {pst}\n"
f" </span>\n"
)
out += f"</div>\n"
print(out)
print(f"<br clear='all'>\n")
else:
print(f"{lines[0]} {lines[1]} {lines[2]} -- {lines[3]}")
print(f"{lines[4]}: {lines[5]}")
@@ -262,15 +315,17 @@ class Campaign:
if self.params.thirdProblem:
print(f"- - {lines[8]}: {lines[9]}")
print()
self.ship.print(html=html)
self.ship.print(html=html)

def print_chars(self, html=False):
if html:
print("<h3>The kobolds:</h3>")
print(f"<div id='thekobolds'>\n")
else:
print("The kobolds:")
for k in self.characters:
k.print(html=html)
if html:
print(f"</div>\n")

if __name__ == "__main__":
parser = argparse.ArgumentParser()

正在加载...
取消
保存