File size: 5,955 Bytes
dddd4c5 39fce52 dddd4c5 2cf8069 dddd4c5 39fce52 dddd4c5 5fb61de dddd4c5 5fb61de 2cf8069 dddd4c5 39fce52 dddd4c5 2cf8069 dddd4c5 2cf8069 39fce52 2cf8069 dddd4c5 2cf8069 |
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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
from PIL import Image
import streamlit as st
import math
import time
import datetime
st.set_page_config(
page_title="IdleMMO - Moonlit Festival Campaign Calculator",
page_icon="https://cdn.idle-mmo.com/uploaded/icons/01J305JYQ75MXXV2C3Z4D19SAV.png",
layout="wide",
)
# st.logo(
# "https://cdn.idle-mmo.com/cdn-cgi/image/height=250,width=250/global/helmet-solo.png"
# )
tier_point = [
55,
75,
90,
110,
135,
150,
180,
230,
260,
300,
315,
330,
345,
360,
410,
450,
550,
]
TARGET_POINT = 26_070
st.title("IdleMMO - Moonlit Festival Campaign Calculator")
st.write("Author: cloux")
with st.form("Player Statistics", border=False):
with st.container(border=True):
st.header("Base Information")
col1, _, col2, _, col3 = st.columns([8, 1, 8, 1, 8])
with col1:
has_membership = st.checkbox("Membership")
with col2:
current_point = st.number_input("Current Point", min_value=0)
with col3:
col31, mid3, col32 = st.columns([1, 1, 16])
col31.image(
"https://cdn.idle-mmo.com/cdn-cgi/image/width=150,height=150/uploaded/skins/01J30HD3FTAN0WGHEKRAPPRS4C.png",
width=64,
)
lunar_ticket = col32.number_input("Lunar Ticket", min_value=0)
col1, _, col2 = st.columns([8, 1, 8])
with col1:
playtime_per_day = st.slider(
"Play Hour(s) per Day", min_value=1, max_value=24, value=16
)
with col2:
current_tier = st.slider("Current Tier", min_value=1, max_value=17, value=1)
# subtract the current tier to convert to 0-based index
consumed_point = 0
for i in range(0, current_tier - 1):
consumed_point += tier_point[i]
with st.container(border=True):
st.subheader("Collected Resources")
st.write("Skill Resources")
col1, _, col2, _, col3 = st.columns([8, 1, 8, 1, 8])
with col1:
col11, mid1, col12 = st.columns([1, 1, 16])
# with col11:
col11.image(
"https://cdn.idle-mmo.com/cdn-cgi/image/width=150,height=150/uploaded/skins/01J30CDE8XEVDVB91FHT7HQR7Z.png",
width=64,
)
starlight_gem = col12.number_input("Starlight Gem", min_value=0)
with col2:
col21, mid2, col22 = st.columns([1, 1, 16])
col21.image(
"https://cdn.idle-mmo.com/cdn-cgi/image/width=150,height=150/uploaded/skins/01J30CCHESG0XADBJ1PB7VPN3B.png",
width=64,
)
moonlit_chalice = col22.number_input("Moonlit Chalice", min_value=0)
with col3:
col31, mid3, col32 = st.columns([1, 1, 16])
col31.image(
"https://cdn.idle-mmo.com/cdn-cgi/image/width=200,height=200/uploaded/skins/01J30CC0VYJB7E0BKVB06A2R6V.png",
width=64,
)
moonlight_essence = col32.number_input("Moonlight Essence", min_value=0)
st.divider()
st.write("Battle Resources")
col1, _, col2, _, col3 = st.columns([8, 1, 8, 1, 8])
# ancient_parchment,ethereal_gem,lunar_stone
with col1:
col11, mid1, col12 = st.columns([1, 1, 16])
col11.image(
"https://cdn.idle-mmo.com/cdn-cgi/image/width=150,height=150/uploaded/skins/01J30CA49KTAY88AKKFKAVTPP3.png",
width=64,
)
ancient_parchment = col12.number_input("Ancient Parchment", min_value=0)
with col2:
col21, mid2, col22 = st.columns([1, 1, 16])
col21.image(
"https://cdn.idle-mmo.com/cdn-cgi/image/width=150,height=150/uploaded/skins/01J30CB0A8GSCTNN57DBQQ0KHR.png",
width=64,
)
ethereal_gem = col22.number_input("Ethereal Gem", min_value=0)
with col3:
col31, mid3, col32 = st.columns([1, 1, 16])
col31.image(
"https://cdn.idle-mmo.com/cdn-cgi/image/width=150,height=150/uploaded/skins/01J30CBA0B2JF8Y6BEEYWCBE9S.png",
width=64,
)
lunar_stone = col32.number_input("Lunar Stone", min_value=0)
button = st.form_submit_button("Submit")
if button:
starlight_gem = min(starlight_gem, TARGET_POINT)
moonlit_chalice = min(moonlit_chalice, TARGET_POINT)
moonlight_essence = min(moonlight_essence, TARGET_POINT)
time_to_complete = (
TARGET_POINT
- current_point
- consumed_point
- lunar_ticket
- ancient_parchment // 10
- ethereal_gem // 10
- lunar_stone // 10
) * (10 + 6 + 10)
time_to_complete -= starlight_gem * 10
time_to_complete -= moonlit_chalice * (6 + 10)
time_to_complete -= moonlight_essence * (10 + 6 + 10)
if has_membership:
time_to_complete = math.ceil(time_to_complete * 0.9)
if playtime_per_day > 16:
playtime_per_day = 16 + (playtime_per_day - 16) * 0.5
day = time_to_complete // 60 // 60 // playtime_per_day
hour = (time_to_complete - day * playtime_per_day * 60 * 60) // 60 // 60
minute = (
time_to_complete - day * playtime_per_day * 60 * 60 - hour * 60 * 60
) // 60
st.info(
f"Time to complete: {day:.0f} days {hour:.0f} hours {minute:.0f} minutes"
+ "\n"
)
current_time = datetime.datetime.now()
end_time = current_time + datetime.timedelta(seconds=time_to_complete)
st.info(f"Estimated End Date: {end_time.strftime('%Y-%m-%d %H:%M:%S')}")
if playtime_per_day > 16:
st.warning(
"There is a 4-hour 50% performance penalty for playing more than 16 hours a day."
)
|