#hard mode daily buff stuff
function zzzzdonotuse:misc/progressionbook/hardmodebuff with storage minecraft:kyuprogressionbookcalendar


#put the current and starting page into the storage. also put a page +1 variable into storage
execute store result storage minecraft:kyuprogressionbookcalendar StartPage int 1 run scoreboard players get #ProgBookStartPage KyuDummy
execute store result storage minecraft:kyuprogressionbookcalendar CurrentPage int 1 run scoreboard players get #ProgBookCurrentPage KyuDummy
scoreboard players add #ProgBookCurrentPage KyuDummy 1
execute store result storage minecraft:kyuprogressionbookcalendar CurrentPagePlusOne int 1 run scoreboard players get #ProgBookCurrentPage KyuDummy
scoreboard players remove #ProgBookCurrentPage KyuDummy 1


#make the 4 calendar page values, then put the start page value back to normal
execute store result storage minecraft:kyuprogressionbookcalendar CalendarPage1 int 1 run scoreboard players get #ProgBookStartPage KyuDummy
scoreboard players add #ProgBookStartPage KyuDummy 1
execute store result storage minecraft:kyuprogressionbookcalendar CalendarPage2 int 1 run scoreboard players get #ProgBookStartPage KyuDummy
scoreboard players add #ProgBookStartPage KyuDummy 1
execute store result storage minecraft:kyuprogressionbookcalendar CalendarPage3 int 1 run scoreboard players get #ProgBookStartPage KyuDummy
scoreboard players add #ProgBookStartPage KyuDummy 1
execute store result storage minecraft:kyuprogressionbookcalendar CalendarPage4 int 1 run scoreboard players get #ProgBookStartPage KyuDummy
scoreboard players remove #ProgBookStartPage KyuDummy 3


#sets the DayX variables inside the storage to the correct value, to be used inside the calendar like [1], [2], [3], etc
##the two unless/if commands makes the pages say [08] or [04] instead of [8] or [4], for even spacing
$execute unless entity @e[name=DayQ,scores={DayQ2=10..}] run data modify storage kyuprogressionbookcalendar Day$(DayValue) set value "[0$(DayValue)]"
$execute if entity @e[name=DayQ,scores={DayQ2=10..}] run data modify storage kyuprogressionbookcalendar Day$(DayValue) set value "[$(DayValue)]"


#sets the change_page value(used in the setcalendar function) for the current day from #ProgBookCurrentPage KyuDummy(+1). Reset it afterwards.
scoreboard players add #ProgBookCurrentPage KyuDummy 1
$execute store result storage minecraft:kyuprogressionbookcalendar Day$(DayValue)Click int 1 run scoreboard players get #ProgBookCurrentPage KyuDummy
scoreboard players remove #ProgBookCurrentPage KyuDummy 1


#handles the calendar and all of its clickevents
function zzzzdonotuse:misc/progressionbook/setcalendar with storage minecraft:kyuprogressionbookcalendar


#If mob progression is skipped, add a page with what is new
execute as @s[tag=SkipDay] run function zzzzdonotuse:misc/progressionbook/addnewpagenoprogression with storage minecraft:kyuprogressionbookcalendar


#If mob progression is NOT skipped, add a page with what is new
##also handles the calendar and all of its clickevents
execute as @s[tag=!SkipDay] run function zzzzdonotuse:misc/progressionbook/addnewpage with storage minecraft:kyuprogressionbookcalendar


#after all is done, increase CurrentPage by 1
##some pages require more than one to be added, if that day has enough progression to take up two pages of text
scoreboard players add #ProgBookCurrentPage KyuDummy 1




