tmnam20 commited on
Commit
dddd4c5
1 Parent(s): c1dc85e

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +154 -0
app.py ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from PIL import Image
2
+ import streamlit as st
3
+ import math
4
+ import time
5
+ import datetime
6
+
7
+ # img = Image.open(
8
+ # "https://cdn.idle-mmo.com/uploaded/icons/01J305JYQ75MXXV2C3Z4D19SAV.png"
9
+ # )
10
+ logo = Image.open("images/helmet-solo.png")
11
+
12
+
13
+ st.set_page_config(
14
+ page_title="IdleMMO - Moonlit Festival Campaign Calculator",
15
+ page_icon="https://cdn.idle-mmo.com/uploaded/icons/01J305JYQ75MXXV2C3Z4D19SAV.png",
16
+ layout="wide",
17
+ )
18
+ st.logo(
19
+ "https://cdn.idle-mmo.com/cdn-cgi/image/height=250,width=250/global/helmet-solo.png"
20
+ )
21
+
22
+
23
+ TARGET_POINT = 26_070
24
+ st.title("IdleMMO - Moonlit Festival Campaign Calculator")
25
+
26
+
27
+ with st.form("Player Statistics", border=False):
28
+
29
+ with st.container(border=True):
30
+ st.header("Base Information")
31
+
32
+ col1, _, col2, _, col3 = st.columns([8, 1, 8, 1, 8])
33
+ with col1:
34
+ has_membership = st.checkbox("Membership")
35
+
36
+ with col2:
37
+ current_point = st.number_input("Current Point", min_value=0)
38
+
39
+ with col3:
40
+ col31, mid3, col32 = st.columns([1, 1, 16])
41
+ col31.image(
42
+ "https://cdn.idle-mmo.com/cdn-cgi/image/width=150,height=150/uploaded/skins/01J30HD3FTAN0WGHEKRAPPRS4C.png",
43
+ width=64,
44
+ )
45
+ lunar_ticket = col32.number_input("Lunar Ticket", min_value=0)
46
+
47
+ col1, _, col2 = st.columns([8, 1, 8])
48
+ with col1:
49
+ playtime_per_day = st.slider(
50
+ "Play Hour(s) per Day", min_value=1, max_value=17, value=1
51
+ )
52
+
53
+ with col2:
54
+ current_tier = st.slider("Current Tier", min_value=1, max_value=10, value=1)
55
+ if playtime_per_day > 16:
56
+ st.warning(
57
+ "There is a 4-hour 50% performance penalty for playing more than 16 hours a day."
58
+ )
59
+
60
+ with st.container(border=True):
61
+ st.subheader("Collected Resources")
62
+
63
+ st.write("Skill Resources")
64
+ col1, _, col2, _, col3 = st.columns([8, 1, 8, 1, 8])
65
+
66
+ with col1:
67
+ col11, mid1, col12 = st.columns([1, 1, 16])
68
+ # with col11:
69
+ col11.image(
70
+ "https://cdn.idle-mmo.com/cdn-cgi/image/width=150,height=150/uploaded/skins/01J30CDE8XEVDVB91FHT7HQR7Z.png",
71
+ width=64,
72
+ )
73
+ starlight_gem = col12.number_input("Starlight Gem", min_value=0)
74
+
75
+ with col2:
76
+ col21, mid2, col22 = st.columns([1, 1, 16])
77
+ col21.image(
78
+ "https://cdn.idle-mmo.com/cdn-cgi/image/width=150,height=150/uploaded/skins/01J30CCHESG0XADBJ1PB7VPN3B.png",
79
+ width=64,
80
+ )
81
+ moonlit_chalice = col22.number_input("Moonlit Chalice", min_value=0)
82
+
83
+ with col3:
84
+ col31, mid3, col32 = st.columns([1, 1, 16])
85
+ col31.image(
86
+ "https://cdn.idle-mmo.com/cdn-cgi/image/width=200,height=200/uploaded/skins/01J30CC0VYJB7E0BKVB06A2R6V.png",
87
+ width=64,
88
+ )
89
+ moonlight_essence = col32.number_input("Moonlight Essence", min_value=0)
90
+
91
+ st.divider()
92
+
93
+ st.write("Battle Resources")
94
+ col1, _, col2, _, col3 = st.columns([8, 1, 8, 1, 8])
95
+
96
+ # ancient_parchment,ethereal_gem,lunar_stone
97
+ with col1:
98
+ col11, mid1, col12 = st.columns([1, 1, 16])
99
+ col11.image(
100
+ "https://cdn.idle-mmo.com/cdn-cgi/image/width=150,height=150/uploaded/skins/01J30CA49KTAY88AKKFKAVTPP3.png",
101
+ width=64,
102
+ )
103
+ ancient_parchment = col12.number_input("Ancient Parchment", min_value=0)
104
+
105
+ with col2:
106
+ col21, mid2, col22 = st.columns([1, 1, 16])
107
+ col21.image(
108
+ "https://cdn.idle-mmo.com/cdn-cgi/image/width=150,height=150/uploaded/skins/01J30CB0A8GSCTNN57DBQQ0KHR.png",
109
+ width=64,
110
+ )
111
+ ethereal_gem = col22.number_input("Ethereal Gem", min_value=0)
112
+
113
+ with col3:
114
+ col31, mid3, col32 = st.columns([1, 1, 16])
115
+ col31.image(
116
+ "https://cdn.idle-mmo.com/cdn-cgi/image/width=150,height=150/uploaded/skins/01J30CBA0B2JF8Y6BEEYWCBE9S.png",
117
+ width=64,
118
+ )
119
+ lunar_stone = col32.number_input("Lunar Stone", min_value=0)
120
+
121
+ button = st.form_submit_button("Submit")
122
+ if button:
123
+ time_to_complete = (
124
+ TARGET_POINT
125
+ - current_point
126
+ - lunar_ticket
127
+ - ancient_parchment // 10
128
+ - ethereal_gem // 10
129
+ - lunar_stone // 10
130
+ ) * (10 + 6 + 10)
131
+ time_to_complete -= starlight_gem * 10
132
+ time_to_complete -= moonlit_chalice * (6 + 10)
133
+ time_to_complete -= moonlight_essence * (10 + 6 + 10)
134
+
135
+ if has_membership:
136
+ time_to_complete = math.ceil(time_to_complete * 0.9)
137
+
138
+ if playtime_per_day > 16:
139
+ playtime_per_day = 16 + (playtime_per_day - 16) * 0.5
140
+
141
+ # st.write(f"Time to complete: {time_to_complete // 60 // 60} minutes")
142
+ # print time to complete in day, hour, minute
143
+ day = time_to_complete // 60 // 60 // playtime_per_day
144
+ hour = (time_to_complete - day * playtime_per_day * 60 * 60) // 60 // 60
145
+ minute = (
146
+ time_to_complete - day * playtime_per_day * 60 * 60 - hour * 60 * 60
147
+ ) // 60
148
+ st.info(f"Time to complete: {day} days {hour} hours {minute} minutes")
149
+
150
+ # add the time to complete to the current time and display the end time
151
+ current_time = datetime.datetime.now()
152
+ end_time = current_time + datetime.timedelta(seconds=time_to_complete)
153
+
154
+ st.info(f"Estimated End Time: {end_time.strftime('%Y-%m-%d %H:%M:%S')}")