repl.it
@mat1/

skyblock time

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# year = (irl) 5 days + 4 hours
# year = (ig) 372 days

# 446400 seconds in a year
# 1200 seconds in a day
# 50 seconds in an hour

import time

month_names = (
	'Early Spring',
	'Spring',
	'Late Spring',

	'Early Summer',
	'Summer',
	'Late Summer',

	'Early Autumn',
	'Autumn',
	'Late Autumn',

	'Early Winter',
	'Winter',
	'Late Winter'
)

while True:
	t = time.time()
	# t = 1575240904.3513227 # day 10 month 7
	time_of_day_raw = t % 1200
	game_hour_raw = time_of_day_raw / 50 + 6
	game_minute_raw = game_hour_raw * 60 % 60
	# 150 = 9am
	# 175 = 9:30
	# 200 = 10am

	game_hour = int(game_hour_raw)
	game_hour12 = int(game_hour_raw - 1) % 12 + 1
	game_minute = int(game_minute_raw)
	ampm = 'pm' if game_hour >= 12 else 'am'

	game_minute_str = ('0' if game_minute < 10 else '') + str(game_minute)

	time_of_year_raw = (t + (1200 * 4.25)) % 446400


	day_of_year_raw = ((time_of_year_raw) / 1200)
	day_of_month = int((day_of_year_raw - 1) % 31) + 1
	month_number = (int(day_of_year_raw // 31 - 1) % 12) + 1

	game_month_name = month_names[month_number - 1]

	day_of_month_extension = 'th'

	if day_of_month % 10 == 1:
		day_of_month_extension = 'st'
	elif day_of_month % 10 == 2:
		day_of_month_extension = 'nd'
	elif day_of_month % 10 == 3:
		day_of_month_extension = 'rd'
	
	if day_of_month % 100 == 11:
		day_of_month_extension = 'th'
	elif day_of_month % 100 == 12:
		day_of_month_extension = 'th'
	elif day_of_month % 100 == 13:
		day_of_month_extension = 'th'

	game_day_of_month = str(day_of_month) + day_of_month_extension

	print('\033[2J\033[H', end='')
	print(game_month_name, game_day_of_month)
	print(f'{game_hour12}:{game_minute_str} {ampm}')

	# print(t)

	# exit()
	time.sleep(1)