Skip to content

Instantly share code, notes, and snippets.

@woctezuma
Last active June 20, 2021 07:44
Show Gist options
  • Save woctezuma/f4faef1210e49ed06cf4725bac60998f to your computer and use it in GitHub Desktop.
Save woctezuma/f4faef1210e49ed06cf4725bac60998f to your computer and use it in GitHub Desktop.
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

This fixes errors such as:

[email protected],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

However, there is another error:

[email protected],07 COMPILATION ERROR [GameBox::EntityInfoLibraryServiceImpl::readEntityInfoLibrary@48] Error(s) while reading entity with id 94 from json:
[email protected],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

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