You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How it works now
GetTimeStamp always return UTC timestamp no matter what tz you gave
How I want it works
Because FGO response timestamp always be UTC timestamp, I think return int(datetime.now().timestamp()) should be enough
Additional context
You can determine the time of the next FP free draw and total act you have now through the login response.
Like this:
importmathfromdatetimeimportdatetime, timedelta, timezoneclassMyTime:
@classmethoddefget_timestamp(cls):
returnint(datetime.now().timestamp()) # FGO use UTC time@classmethoddefis_Free_FP_draw_available(cls, last_free_draw_timestamp_utc: int):
JST=timezone(timedelta(hours=+9))
# get last free draw time in GTM+0 and convert to GTM+9 to the next daydt_utc=datetime.fromtimestamp(last_free_draw_timestamp_utc, timezone.utc)
dt_japan=dt_utc.astimezone(JST)
next_midnight=datetime(dt_japan.year, dt_japan.month, dt_japan.day, tzinfo=JST) +timedelta(days=1)
# Convert next_midnight back to UTC to compare with the current timenext_midnight_utc=next_midnight.astimezone(timezone.utc)
next_midnight_timestamp=next_midnight_utc.timestamp()
# Returns True if the current time has passed the midnight of the day following the last draw datereturncls.get_timestamp() >=next_midnight_timestamp@classmethoddefget_used_act_ammount(cls, full_recover_at: int):
returnmax(0, math.ceil((full_recover_at-cls.get_timestamp() /300)))
And then get last_free_draw_timestamp_utc in login_response['cache']['replaced']['userGacha'][0]['freeDrawAt']
After that you can call is_Free_FP_draw_available in your drawFP
is_available=MyTime.is_Free_FP_draw_available(self.last_free_friend_point_draw)
ifis_available:
# Get subId and drawelse:
# Log next free draw time is not reached
If you want to buy apple
act_now=act_now-MyTime.get_used_act_ammount(player_info.act_full_recover_time)
buy_count=int(act_now/40)
actual_count=0ifblue_apple_sapling>0:
# Log doesn't have blue apple saplingelifblue_apple_sapling<buy_count:
# Set actual_count to blue_apple_sapling else:
# Set actual_count to buy_count #Buy blue apple by actual_count
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
How it works now
GetTimeStamp always return UTC timestamp no matter what tz you gave
How I want it works
Because FGO response timestamp always be UTC timestamp, I think
return int(datetime.now().timestamp())
should be enoughAdditional context
You can determine the time of the next FP free draw and total act you have now through the login response.
Like this:
And then get
last_free_draw_timestamp_utc
inlogin_response['cache']['replaced']['userGacha'][0]['freeDrawAt']
After that you can call
is_Free_FP_draw_available
in yourdrawFP
If you want to buy apple
Beta Was this translation helpful? Give feedback.
All reactions