Account for crayon losses

master
trémeur 2 months ago
parent 45e1425e01
commit 06164ae6cf

@ -1,5 +1,20 @@
import datetime,os
import log,skel,tcgcore
import log,skel,tcgcore,variables
def crayonlog(colour,event):
crayonno = event["crayons"][colour]
if variables.british:
if colour == "gray":
crayonrend = "grey"
else:
crayonrend = colour
else:
crayonrend = colour
if crayonno > 0:
crayonstring = "+" + str(crayonno) + " " + crayonrend
else:
crayonstring = str(crayonno) + " " + crayonrend
return crayonstring
def loggen():
if not os.path.isdir("build/log"):
@ -26,65 +41,51 @@ def loggen():
pass
try:
if event["crayons"]:
crayontypes = len(event["crayons"])
content.write("Gained crayons: ")
content.write("Crayons: ")
try:
redno = event["crayons"]["red"]
content.write(str(redno) + " red")
content.write(crayonlog("red",event))
if list(event["crayons"])[-1] != "red":
content.write(", ")
except:
pass
try:
orangeno = event["crayons"]["orange"]
content.write(str(orangeno) + " orange")
content.write(crayonlog("orange",event))
if list(event["crayons"])[-1] != "orange":
content.write(", ")
except:
pass
try:
yellowno = event["crayons"]["yellow"]
content.write(str(yellowno) + " yellow")
content.write(crayonlog("yellow",event))
if list(event["crayons"])[-1] != "yellow":
content.write(", ")
except:
pass
try:
greenno = event["crayons"]["green"]
content.write(str(greenno) + " green")
content.write(crayonlog("green",event))
if list(event["crayons"])[-1] != "green":
content.write(", ")
except:
pass
try:
blueno = event["crayons"]["blue"]
content.write(str(blueno) + " blue")
content.write(crayonlog("blue",event))
if list(event["crayons"])[-1] != "blue":
content.write(", ")
except:
pass
try:
purpleno = event["crayons"]["purple"]
content.write(str(purpleno) + " purple")
content.write(crayonlog("purple",event))
if list(event["crayons"])[-1] != "purple":
content.write(", ")
except:
pass
try:
brownno = event["crayons"]["brown"]
content.write(str(brownno) + " brown")
content.write(crayonlog("brown",event))
if list(event["crayons"])[-1] != "brown":
content.write(", ")
except:
pass
try:
grayno = event["crayons"]["gray"]
if variables.british:
content.write(str(grayno) + " grey")
else:
content.write(str(grayno) + " gray")
if list(event["crayons"])[-1] != "gray":
content.write(", ")
content.write(crayonlog("gray",event))
except:
pass
content.write(".")

Loading…
Cancel
Save