idac: added battle gift event time check

This commit is contained in:
Dniel97 2024-06-23 22:35:25 +02:00
parent 66114238a5
commit c397e4b764
Signed by untrusted user: Dniel97
GPG Key ID: 6180B3C768FB2E08

View File

@ -318,6 +318,15 @@ class IDACSeason2(IDACBase):
"story_type": special_story_type,
}
battle_gift_event = []
if self.battle_gift_event:
# check if battle gift event time is valid
start_dt = self.battle_gift_event.get("start_dt", 0)
end_dt = self.battle_gift_event.get("end_dt", 0)
if start_dt < int(datetime.now().timestamp()) < end_dt:
battle_gift_event = [self.battle_gift_event]
return {
"status_code": "0",
"free_continue_enable": 1,
@ -344,9 +353,7 @@ class IDACSeason2(IDACBase):
"domain_echo1": f"{self.core_cfg.server.hostname}:{self.game_config.server.echo1}",
"domain_echo2": f"{self.core_cfg.server.hostname}:{self.game_config.server.echo1}",
"domain_ping": f"{self.core_cfg.server.hostname}",
"battle_gift_event_master": (
[self.battle_gift_event] if self.battle_gift_event else []
),
"battle_gift_event_master": battle_gift_event,
# online battle round event
"round_event": self.round_event,
"last_round_event": self.last_round_event,