WTS/game/scripts/interface/calendar.rpy
LoafyLemon 8aba361ea9 Refactoring + Environment
* Partially sunset `game` var store and move relevant special variables inside `states` store.
* Replace `game.daytime` -> `states.env.daytime`
2024-04-25 19:49:09 +01:00

99 lines
2.8 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 (game.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 letters
letters = mailbox.get_letters(True)
for i in letters:
if (day := game.day+i.wait) < span+1:
contents[day] += "✉️"
# Add parcels
parcels = mailbox.get_parcels(True)
for i in parcels:
if (day := game.day+i.wait) < span+1:
contents[day] += "📦"
return contents
@staticmethod
def get_weekday(n=None):
if n is None:
n = game.day
return Calendar.weekdays[n % 7]
@staticmethod
def get_period(n=None):
if n is None:
n = game.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 == (game.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)