robertjanetzko / LegendsBrowser

Legends Browser is an multi-platform, open source, java-based legends viewer for dwarf fortress 0.42.
MIT License
63 stars 19 forks source link

Throws exception when I open some historical figures with legends_plus.xml (DF 0.47.04, DFHack 0.47.04-r1) #65

Closed ereterer closed 4 years ago

ereterer commented 4 years ago

When I try to look up any necromancer, vampire or werebeast this shows up instead of hf page:

org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getShortDescription' in class legends.model.events.HfLearnsSecretEvent threw exception java.lang.ArrayIndexOutOfBoundsException: 1 at events.vm[line 29, column 40]

or

org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getShortDescription' in class legends.model.events.HfDoesInteractionEvent threw exception java.lang.NullPointerException at events.vm[line 29, column 40]

This wasn't a problem with dfhack 0.47.04-beta1, I noticed changes in legend_plus.xml:

this <secret_text>[IS_NAME:the secrets of life and death]</secret_text> became <secret_text>the secrets of life and death</secret_text>,

this <interaction_action>[IS_HIST_STRING_2:, passing on the anteater monster curse]</interaction_action> <interaction_string>[I_TARGET:A:CREATURE]</interaction_string> became <interaction_action>bit, passing on the gila monster monster curse</interaction_action>,

this <interaction_action>[IS_HIST_STRING_1: cursed ]</interaction_action> <interaction_string>[IS_HIST_STRING_2: to prowl the night in search of blood]</interaction_string> became <interaction_action>cursed to prowl the night in search of blood</interaction_action>

So this may be the cause of this problem, I think.

Example xml's: New dfhack, not working: legends_new.zip legends.zip Old, working: legends_old.zip

lethosor commented 4 years ago

I suspect this is the part that's failing due to : being removed: https://github.com/robertjanetzko/LegendsBrowser/blob/152b3c860d752f8121c3560a789ba6ad45e991be/src/main/java/legends/model/events/HfLearnsSecretEvent.java#L80 Hopefully the new version is simpler to parse, but this is a compatibility break on DFHack's end that might not have been made clear.

McArcady commented 4 years ago

Thanks @ereterer @lethosor for the analysis. Fixed by #66