Skip to content

Commit

Permalink
increased event size
Browse files Browse the repository at this point in the history
  • Loading branch information
MizaGBF committed Nov 20, 2024
1 parent 3c8a297 commit 47db5e5
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 5 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<body onload="init()">
<a href="index.html"><img id="titleheader" src="assets/ui/header.png" alt="header"></a>
<div id="header">
<div>v9.15</div>
<div>v9.16</div>
<div id="timestamp"></div>
</div>
<div id="issues" style="display:none">
Expand Down
5 changes: 5 additions & 0 deletions js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -2088,6 +2088,11 @@ function loadAssets(id, data, target, indexed = true)
{name:"Chapter 13", paths:[["sp/quest/scene/character/body/", "png"]], index:17, icon:"assets/ui/result_icon/scene.png"},
{name:"Chapter 14", paths:[["sp/quest/scene/character/body/", "png"]], index:18, icon:"assets/ui/result_icon/scene.png"},
{name:"Chapter 15", paths:[["sp/quest/scene/character/body/", "png"]], index:19, icon:"assets/ui/result_icon/scene.png"},
{name:"Chapter 16", paths:[["sp/quest/scene/character/body/", "png"]], index:20, icon:"assets/ui/result_icon/scene.png"},
{name:"Chapter 17", paths:[["sp/quest/scene/character/body/", "png"]], index:21, icon:"assets/ui/result_icon/scene.png"},
{name:"Chapter 18", paths:[["sp/quest/scene/character/body/", "png"]], index:22, icon:"assets/ui/result_icon/scene.png"},
{name:"Chapter 19", paths:[["sp/quest/scene/character/body/", "png"]], index:23, icon:"assets/ui/result_icon/scene.png"},
{name:"Chapter 20", paths:[["sp/quest/scene/character/body/", "png"]], index:24, icon:"assets/ui/result_icon/scene.png"},
{name:"Ending", paths:[["sp/quest/scene/character/body/", "png"]], index:3, icon:"assets/ui/result_icon/scene.png"},
{name:"Arts", paths:[["sp/quest/scene/character/body/", "png"]], index:4, icon:"assets/ui/result_icon/art.png", open:true}
];
Expand Down
41 changes: 37 additions & 4 deletions updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class Updater():
EVENT_ED = 3
EVENT_INT = 4
EVENT_CHAPTER_START = 5
EVENT_MAX_CHAPTER = 15
EVENT_MAX_CHAPTER = 20
EVENT_SKY = EVENT_CHAPTER_START+EVENT_MAX_CHAPTER
EVENT_UPDATE_COUNT = 20
# story update
Expand Down Expand Up @@ -2786,6 +2786,30 @@ async def get_event_list(self) -> list:
def ev2daycount(self, ev : str) -> int:
return (int(ev[:2]) * 12 + int(ev[2:4])) * 31 + int(ev[4:6])

# update old event entries
def update_event_container(self, old : list) -> list:
if len(old) != self.EVENT_CHAPTER_START + self.EVENT_MAX_CHAPTER + 1:
l = [old[self.EVENT_CHAPTER_COUNT], old[self.EVENT_THUMB], old[self.EVENT_OP], old[self.EVENT_ED], old[self.EVENT_INT]]
for i in range(self.EVENT_MAX_CHAPTER):
if i + self.EVENT_CHAPTER_START < len(old) - 1:
l.append(old[i + self.EVENT_CHAPTER_START])
else:
l.append([])
l.append(old[-1])
return l
else:
return old

# create the array containing the event data
def create_event_container(self) -> list:
l = [-1, None]
while len(l) < self.EVENT_CHAPTER_START:
l.append([])
for i in range(self.EVENT_MAX_CHAPTER):
l.append([])
l.append([])
return l

# Call get_event_list() and check the current time to determine if new events have been added. If so, check if they got voice lines to determine if they got chapters, and then call update_event()
async def check_new_event(self, init_list : Optional[list] = None) -> None:
now = datetime.now(timezone.utc).replace(tzinfo=None) + timedelta(seconds=32400)
Expand Down Expand Up @@ -2834,7 +2858,8 @@ async def check_new_event(self, init_list : Optional[list] = None) -> None:
if ev not in self.data["events"]:
if check[ev] >= 0:
print("Event", ev, "has been added (", check[ev], "chapters )")
self.data["events"][ev] = [check[ev], None, [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []] # 15+3+sky
self.data["events"][ev] = self.create_event_container()
self.data["events"][ev][0] = check[ev]
self.modified = True
# check thumbnail
if len(thumbnail_check) > 0:
Expand Down Expand Up @@ -2881,7 +2906,7 @@ async def update_event(self, events : list, full : bool = False, skip : int = 0)
self.progress = Progress(self)
for ev in events:
if full and ev not in self.data["events"]:
self.data["events"][ev] = [-1, None, [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []] # 15+3+sky
self.data["events"][ev] = self.create_event_container()
if ev in self.data["events"] and (full or (not full and self.data["events"][ev][self.EVENT_CHAPTER_COUNT] >= 0)):
new_format = int(ev) == 241017 # keep in min for later if we need to improve this (only used by halloween 2024 for now)
known_assets = set()
Expand Down Expand Up @@ -3091,6 +3116,7 @@ async def event_edit(self) -> None:
print("[4] Update SkyCompass")
print("[5] Add Events")
print("[6] Check new thumbnails")
print("[7] Update event containers")
print("[Any] Quit")
s = input().lower()
match s:
Expand Down Expand Up @@ -3170,6 +3196,13 @@ async def event_edit(self) -> None:
case "6":
s = input("Input a list of Event dates to associate (Leave blank to continue):")
await self.event_thumbnail_association(s.split(" "))
case "7":
for ev in self.data["events"]:
l = self.update_event_container(self.data["events"][ev])
if len(l) != len(self.data["events"][ev]):
self.data["events"][ev] = l
self.modified = True
self.save()
case _:
break

Expand Down Expand Up @@ -3518,7 +3551,7 @@ def print_help(self) -> None:
async def boot(self, argv : list) -> None:
try:
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=50)) as self.client:
print("GBFAL updater v2.46\n")
print("GBFAL updater v2.47\n")
self.use_wiki = await self.test_wiki()
if not self.use_wiki: print("Use of gbf.wiki is currently impossible")
start_flags = set(["-debug_scene", "-debug_wpn", "-wait", "-nochange", "-stats"])
Expand Down

0 comments on commit 47db5e5

Please sign in to comment.