Account for crayon losses

master
trémeur 3 weeks ago
parent 45e1425e01
commit 06164ae6cf

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

Loading…
Cancel
Save