Star System.

This commit is contained in:
Jeison Yehuda Amihud (Blender Dumbass) 2023-02-04 17:52:33 +00:00
parent 9735919c2d
commit 0b916edadc
2 changed files with 86 additions and 15 deletions

View file

@ -73,6 +73,8 @@ def get_legacy(project_location):
"duration" : 0, # Amount in days between startdate and deadline
"timepassed" : 0.0, # Percentage of how much time had passed
"dayspassed" : 0, # Amount of days since the startdate
"needed" : 0, # Needed % per day
"star" : 0, # If star is reached
"chr_factor" : 1, # Importance factor for Characters
"veh_factor" : 1, # Importance factor for Vehicles
"loc_factor" : 1, # Importance factor for Locations
@ -690,6 +692,8 @@ def load(project_location):
"timepassed" : 0.0, # Percentage of how much time had passed
"dayspassed" : 0, # Amount of days since the startdate
"chr_factor" : 1, # Importance factor for Characters
"needed" : 0, # Needed % to do today
"star" : 0, # Did you get needed
"veh_factor" : 1, # Importance factor for Vehicles
"loc_factor" : 1, # Importance factor for Locations
"obj_factor" : 1, # Importance factor for Objects (Other)
@ -823,5 +827,20 @@ def load(project_location):
}
return data
# Needed
try:
data["needed"] = ( 1 - data["fraction"] ) / ( data["duration"] - data["dayspassed"] )
except:
data["needed"] = 0
prev_star = data.get("star", 0)
try:
prev_frac = data["dates"][list(reversed(data["dates"].keys()))[1]].get("fractions", {}).get("project", data["fraction"])
data["star"] = (data["fraction"] - prev_frac) / data["needed"]
except:
data["star"] = 0
if data["star"] >= 1 and not prev_star >= 1:
talk.alert("⭐ Today's Requirement is Finished!")
return data

View file

@ -181,9 +181,8 @@ def layer(win):
# MAIN PROGRESS
# Icon
UI_elements.image(layer, win, "settings/themes/"\
+win.settings["Theme"]+"/icons/analytics.png",
+win.settings["Theme"]+"/icons/star.png",
win.current["w"]/4+10,
15,
40,
@ -197,20 +196,47 @@ def layer(win):
win.current["w"]/2-80,
20,
10,
tip=str(round(projectdone*100, 1))+"%")
tip="Today's requirement is: "+str(round(win.analytics.get("needed", 0)*100, 1))+"% ( "+str(round(win.analytics.get("star", 0)*100, 1))+"% of which is done )")
# Project Done
UI_color.set(layer, win, "progress_active")
UI_color.set(layer, win, "text_link")
UI_elements.roundrect(layer, win,
win.current["w"]/4+60,
25,
(win.current["w"]/2-80)*projectdone,
(win.current["w"]/2-80)*min(win.analytics.get("star", 0), 1),
20,
10)
# # Icon
# UI_elements.image(layer, win, "settings/themes/"\
# +win.settings["Theme"]+"/icons/analytics.png",
# win.current["w"]/4+10,
# 15,
# 40,
# 40)
# # Progressbar
# UI_color.set(layer, win, "progress_background")
# UI_elements.roundrect(layer, win,
# win.current["w"]/4+60,
# 25,
# win.current["w"]/2-80,
# 20,
# 10,
# tip=str(round(projectdone*100, 1))+"%")
# # Project Done
# UI_color.set(layer, win, "progress_active")
# UI_elements.roundrect(layer, win,
# win.current["w"]/4+60,
# 25,
# (win.current["w"]/2-80)*projectdone,
# 20,
# 10)
# TIME PASSED
# Icon
@ -228,7 +254,7 @@ def layer(win):
win.current["w"]/2-80,
20,
10,
tip=str(round(timepassed*100, 1))+"%")
tip="Time: "+str(round(timepassed*100, 1))+"% Project: "+str(round(projectdone*100, 1))+"%")
# Timepassed
UI_color.set(layer, win, "progress_time")
@ -239,6 +265,16 @@ def layer(win):
20,
10)
# Project Done
UI_color.set(layer, win, "progress_active")
UI_elements.roundrect(layer, win,
win.current["w"]/4+60,
65,
(win.current["w"]/2-80)*projectdone,
20,
10)
# SCENES DONE ( RND )
# Icon
@ -1090,6 +1126,22 @@ def layer(win):
40,
40)
# Stars! If the day was exceptional.
try:
if win.analytics["needed"] <= fracs.get("project", 0) - Pfracs.get("project", 0) and theday <= today:
UI_elements.image(node, win, "settings/themes/"\
+win.settings["Theme"]+"/icons/star.png",
6+current_X+win.scroll["days"],
height-(50*nicon)-150,
40,
40)
except:
pass
# Schedules
sch = []
if theday in win.analytics["dates"]:
date = win.analytics["dates"][theday]