Fix contract scheduling and array events
authorJoann Mõndresku <joann@cernodile.com>
Mon, 13 May 2024 17:57:19 +0000 (20:57 +0300)
committerJoann Mõndresku <joann@cernodile.com>
Mon, 13 May 2024 17:57:19 +0000 (20:57 +0300)
contracts.py
events.py

index 17d2bbf1705eba719081bb785c9303b769a50c96..f47a63adb53e53c921f7cdf5277d7dec96e90a98 100644 (file)
@@ -56,6 +56,7 @@ def __convert_contract_to_proto(obj):
 def load_contracts():
        with open("data/contracts.json", "r") as file:
                obj = json.loads(file.read())
+               global contract_epoch
                contract_epoch = obj["epoch"]
                time_since_epoch = time.time() - contract_epoch
                i = 0
index 50634dcafd328dd44a990446835cf99501da1217..3cc34bfa2ad0b839c4d31b41a9494d7606e68a4c 100644 (file)
--- a/events.py
+++ b/events.py
@@ -77,13 +77,13 @@ def get_active_events():
                iso_calendar = date.isocalendar()
                seed = int(str(iso_calendar.year) + str(iso_calendar.week))
                srng = random.Random(seed)
-               # 50/50 chance of it being either
+               # 50/50 chance of it being either (reality is something more like 30/70 ratio, but it's our server so.. \o/)
                if srng.random() < 0.5:
                        res.append(double_prestige_event)
                else:
                        res.append(triple_prestige_event)
        if type(event_calendar[cur_day]) is list:
-               res = event_calendar[cur_day]
+               res = res + event_calendar[cur_day]
        else:
                res.append(event_calendar[cur_day])
        # Apply duration deltas