Skip to content

Instantly share code, notes, and snippets.

@woctezuma
Last active Jun 20, 2021
Embed
What would you like to do?
Fix Roguebook
# References:
# - https://gist.github.com/woctezuma/f4faef1210e49ed06cf4725bac60998f
# - https://steamcommunity.com/app/1076200/discussions/0/3070873501572457641/
from collections import Counter
from pathlib import Path
import glob
import os
game_path = "C:/Applis/Steam/steamapps/common/Roguebook/"
card_path = "Roguebook_Data/StreamingAssets/GameBoxResources/cards_scripts/"
file_path = game_path + card_path
print(file_path)
files = glob.glob(file_path + '*.xlb')
ids = [Path(fname).name.split('.')[0] for fname in files]
c = Counter(ids)
duplicates = [id for id in c if c[id]>1]
for id in duplicates:
files = glob.glob(file_path + id + '*.xlb')
files.sort(key=os.path.getmtime)
for fname in files[:-1]:
print(fname)
Path(fname).rename(fname + '.old')
@woctezuma
Copy link
Author

woctezuma commented Jun 17, 2021

This fixes errors such as:

2021-06-17@22.15,37 ERROR [logError@66] Received unhandled exception with code 0x00000015:
Multiple files match the format for script of entity id 9:
	C:\Applis\Steam\steamapps\common\Roguebook\Roguebook_Data\StreamingAssets\GameBoxResources\cards_scripts\0009.blood_gift.xlb
	C:\Applis\Steam\steamapps\common\Roguebook\Roguebook_Data\StreamingAssets\GameBoxResources\cards_scripts\0009.grim_siphon.xlb

@woctezuma
Copy link
Author

woctezuma commented Jun 17, 2021

However, there is another error:

2021-06-17@23.02,07 COMPILATION ERROR [GameBox::EntityInfoLibraryServiceImpl::readEntityInfoLibrary@48] Error(s) while reading entity with id 94 from json:
2021-06-17@23.02,07 ERROR [logError@66] Received unhandled parse exception with code 0x00000000:
0x0000000c: Semantic Error - Could not find getter 'bearer' on type 'entity<creature>' - Candidates are:
	cardId
	tags
        [...]
	heroType

 line 2:
    if (castToDeckCard(event.target.killer).heroType == this.bearer.heroType) INDENT
                                                             ^

@woctezuma
Copy link
Author

woctezuma commented Jun 20, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment