105 lines
3.0 KiB
Plaintext
105 lines
3.0 KiB
Plaintext
init python:
|
|
class Calendar():
|
|
periods = ("Janemar", "Aprimju", "Juliasep", "Octobrinde")
|
|
weekdays = ("Monday", "Tuesday", "Wednsday", "Thursday", "Friday", "Saturday", "Sunday")
|
|
_day = 0
|
|
|
|
@staticmethod
|
|
def get_schedule(span=35):
|
|
contents = {i: "" for i in range(span)}
|
|
|
|
# Add moon cycles
|
|
for i in range(span):
|
|
if (i % 7 == 0):
|
|
contents[i] += "🌕"
|
|
elif (i % 7 == 3):
|
|
contents[i] += "🌓"
|
|
# elif (states.env.day % 60 == 30) # Blood moon
|
|
|
|
forecast = Weather.forecast(span)
|
|
for i, v in forecast.items():
|
|
if v == "clear":
|
|
contents[i] += "☀️"
|
|
elif v == "cloudy":
|
|
contents[i] += "⛅"
|
|
elif v == "overcast":
|
|
contents[i] += "☁️"
|
|
elif v in ("blizzard", "snow"):
|
|
contents[i] += "🌨️"
|
|
elif v == "rain":
|
|
contents[i] += "🌧️"
|
|
elif v == "storm":
|
|
contents[i] += "🌩️"
|
|
|
|
# Add timed events
|
|
events = eventqueue.queue
|
|
for i in events:
|
|
if (day := states.env.day+i.wait) < span+1:
|
|
contents[day] += "⭐"
|
|
|
|
# Add letters
|
|
letters = mailbox.get_letters(True)
|
|
for i in letters:
|
|
if (day := states.env.day+i.wait) < span+1:
|
|
contents[day] += "✉️"
|
|
|
|
# Add parcels
|
|
parcels = mailbox.get_parcels(True)
|
|
for i in parcels:
|
|
if (day := states.env.day+i.wait) < span+1:
|
|
contents[day] += "📦"
|
|
|
|
return contents
|
|
|
|
@staticmethod
|
|
def get_weekday(n=None):
|
|
if n is None:
|
|
n = states.env.day
|
|
|
|
return Calendar.weekdays[n % 7]
|
|
|
|
@staticmethod
|
|
def get_period(n=None):
|
|
|
|
if n is None:
|
|
n = states.env.day
|
|
|
|
return Calendar.periods[(n // 30) % 4]
|
|
|
|
label calendar:
|
|
call screen calendar
|
|
jump main_room_menu
|
|
|
|
screen calendar:
|
|
default contents = Calendar.get_schedule().items()
|
|
default period = Calendar.get_period()
|
|
|
|
text "[period]" align (0.5, 0.1) color "#fff" size 24
|
|
grid 7 6:
|
|
style "empty"
|
|
align (0.5, 0.5)
|
|
|
|
for i in ("MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"):
|
|
fixed:
|
|
xysize (64, 64)
|
|
add "#fff"
|
|
text "[i]"
|
|
|
|
|
|
for i, ev in contents:
|
|
fixed:
|
|
xysize (64, 64)
|
|
if i > 29:
|
|
add "#888888"
|
|
elif i == (states.env.day % 30):
|
|
add "#ff0000ff"
|
|
else:
|
|
add "#fff"
|
|
|
|
vbox:
|
|
text "[(i % 30) + 1]" size 10 color "#000"
|
|
text "[ev]" size 12
|
|
|
|
|
|
textbutton "Close" action Return() align (0.5, 0.9)
|