[Bug] XML Typos in 1.03.3 (Tooltips added)

Discuss problems related to FTL here. If you are having a problem or experiencing a bug PLEASE READ THE "MUST READ" POST.
Vhati
Posts: 792
Joined: Thu Oct 25, 2012 12:01 pm

[Bug] XML Typos in 1.03.3 (Tooltips added)

Postby Vhati » Sat Jan 26, 2013 12:55 pm

Mainly incorrect/missing closing tags.

Misc

tooltips.xml
<energyShieldDisplay>...</energyShieldDIsplay>

<autofire>Toggle to active/deactive weapons automatically firing.</autoFire>
(closing tag, and "Toggle weapons automatically firing.")

sounds.xml
<environWarning>...</warning>
<healBomb>...</explosion3>
<fireBomb>...</explosion3>
<crewLaser2>...</crewLaser1>
<crewLaser3>...</crewLaser1>
<miss>...</sound>

<brawling> appears in both the "sound loops" section and the "crew sounds" section?


Blueprints

blueprints.xml
DEFAULT shipBlueprint: <shipBlueprint>...</ship>
PLAYER_SHIP_HARD_2 shipBlueprint: <shields>...</slot>
PLAYER_SHIP_STEALTH shipBlueprint: "blah"img="blah"
PLAYER_SHIP_ROCK shipBlueprint: "blah"img="blah"
PLAYER_SHIP_ROCK_2 shipBlueprint: "blah"img="blah"
LONG_ELITE_MED shipBlueprint: img="rebel_long_hard" should be "rebel_long_elite"
LONG_ELITE_HARD shipBlueprint: img="rebel_long_hard" should be "rebel_long_elite"

<!-- sardonyx: Missing closing tag
<?xml ... ?>: This declaration must be the first line, or absent altogether.

autoBlueprints.xml
AUTO_BASIC: <shipBlueprint>...</ship>
AUTO_ASSAULT: <shipBlueprint>...</ship>
JELLY_CROISSANT: "blah"room="blah"

All the following shipBlueprints: "blah"max="blah"
JELLY_TRUFFLE
ROCK_SCOUT, ROCK_FIGHT, ROCK_ASSAULT, ROCK_ASSAULT_ELITE
MANTIS_SCOUT, MANTIS_FIGHTER, MANTIS_BOMBER
FED_SCOUT, FED_BOMBER
CIRCLE_SCOUT, CIRCLE_BOMBER
ZOLTAN_FIGHTER, ZOLTAN_BOMBER, ZOLTAN_PEACE
CRYSTAL_SCOUT, CRYSTAL_BOMBER


Events

events.xml
PIRATE_CIVILIAN_BEACON: <choice hidden="true" hidden="true">
STORE_TEXT: <textList>...</text>

<!-- QUESTS: Missing closing tag
<!-- Neutral: Missing closing tag

I'm not sure if these are valid, needing a space, or worth removing altogether.
REBEL_VS_FEDERATION: <!---->
REBEL_VS_FEDERATION_SAVED_LIST: <!---->
HIDDEN_FEDERATION_BASE_LIST: <!---->

events_fuel.xml
FUEL_ON_MANTIS_ATTACK: <textList>...</event>
FUEL_ON_REBEL_ATTACK: <textList>...</event>

events_engi.xml
DISTRESS_ENGI_REACTOR: <event>...</choice>
DISTRESS_ENGI_REACTOR_LIST1: <text>...</event>
ENGI_UNLOCK_2REAL_SURRENDER: <event>...</missing closing tag>

events_mantis.xml
MANTIS_NAMED_THIEF: <event>...</text>
MANTIS_NAMED_THIEF_DEFEAT: <text>...</event>

events_slug.xml
NEBULA_SLUG_CHOOSE_DEATH: <choice>...</event>

events_zoltan.xml
ZOLTAN_LIFERAFT_HIRE: <eventList>...</event>

events_pirate.xml
PIRATE_ASTEROID: <choice>...</missing closing tag>

events_nebula.xml
NEBULA_REBEL_UNDETECTED: <choice hidden="true" hidden="true">

events_ships.xml
REBEL_AUTO_HACKSHIELDS: <deadCrew>...</destroyed>

events_boss.xml
events_crystal.xml
events_rock.xml
events_rebel.xml

sector_data.xml
MANTIS_SECTOR: <name>...</text>
MANTIS_HOME: <name>...</text>
Almost every sector: <sectorDescription>...</sectorDescrption>

All event files and sector_data
Section comment blocks: W3C: <!-- No other dashes should touch. -->


Historically, FTL 1.02.6 had them all too - as well as a bunch in blueprints.xml: itemBlueprints (<title>...</ship>), weaponBlueprints (<speed>...</image>), systemBlueprints (<title>...</type>), and an augBlueprint (extra title) - which were fixed at some point.

Further back, FTL 1.01 had those, plus two typos in events_crystal.xml: CRYSTAL_CACHE_BREAK (<text>...</event>).


Edit: Moved FUEL_ON_REBEL_ATTACK to events_fuel.xml. (2013-01-27)
Edit: Added events_ships.xml and blueprints typos. (2013-02-03)
Edit: Relabelled historical glitches that persisted through 1.02.6. (2013-02-21)
Edit: Added sector_data.xml typos under events. (2013-03-04)
Edit: Added sounds.xml under Misc. (2013-03-12)
Edit: Added tooltips.xml under Misc. (2013-03-15)
Last edited by Vhati on Tue Aug 27, 2013 1:41 pm, edited 18 times in total.
thashepherd
Posts: 194
Joined: Fri Nov 16, 2012 11:45 pm

Re: [Bug] Event XML Typos

Postby thashepherd » Sat Jan 26, 2013 11:07 pm

Vhati, how'd you find those?
You are the weak, and I am the tyranny of evil men - but I'm trying, I'm trying real hard to be the shepherd.

"Wow, that Kieve guy is one angsty nerd eh."
Sonata - "Best use of Common Lisp in an indie space roguelike!"
Vhati
Posts: 792
Joined: Thu Oct 25, 2012 12:01 pm

Re: [Bug] Event XML Typos

Postby Vhati » Sun Jan 27, 2013 4:54 am

thashepherd wrote:Vhati, how'd you find those?

I'm teaching the Profile/SavedGame Editor to add/modify quest events on the sector map.

But in order to read FTL's resources, I have to fix the XML at runtime to make it parsable, with regexes.
That's the list of things that made my parser cry.*
Each time I hit one, I added a regex to correct it. Then I'd hit another, correct it, and so on until it parsed.

* I only eyeballed the comment typos, because lazily stripping lines between <!-- and --> beforehand (based on which one was last seen) was working well enough.


For the footnote, I used WinMerge to compare extracted resources from 1.01 vs 1.03.1.
thashepherd
Posts: 194
Joined: Fri Nov 16, 2012 11:45 pm

Re: [Bug] Event XML Typos

Postby thashepherd » Sun Jan 27, 2013 8:12 pm

Was more asking about your parser - and yeah, WinMerge is a godsend. Did you just do it programmatically? I've been lazy...
You are the weak, and I am the tyranny of evil men - but I'm trying, I'm trying real hard to be the shepherd.

"Wow, that Kieve guy is one angsty nerd eh."
Sonata - "Best use of Common Lisp in an indie space roguelike!"
Vhati
Posts: 792
Joined: Thu Oct 25, 2012 12:01 pm

Re: [Bug] Event XML Typos

Postby Vhati » Mon Jan 28, 2013 1:16 pm

thashepherd wrote:Was more asking about your parser [...]. Did you just do it programmatically?


  • I read an events file into a buffer. Then turn it into Java classes with JAXB.
  • When I get an error, I have the logger report the line, and dump the buffer (the XML document as it existed at the time of parsing).
  • I open the log in a text editor and manually look at nearby lines to find what made it invalid.
  • Then, above the code that starts the parsing, I add a regex describing the bad block of text, and how part of it should be replaced to make it valid.
  • Repeat.

I try to make the pattern specific enough that it won't accidentally try to 'fix' modders' tags (or if it does, only tags that needed fixing). If a modder alters one of these typoed events such that the pattern wouldn't recognize it, I'll just expect him/her to correct the tags while they're at it.

Code: Select all

      StringBuilder sb = new StringBuilder();
      String ptn; Pattern p; Matcher m;

[... Map a region of data.dat to an input stream as if it were a file; read into sb buffer...]

      if ( "events_fuel.xml".equals(fileName) ) {
         // events_fuel.xml: FUEL_ON_MANTIS_ATTACK (FTL 1.03.1)
         // events_fuel.xml: FUEL_ON_REBEL_ATTACK (FTL 1.03.1)
         ptn = "";
         ptn += "(<textList *(?: [^>]*)?>\\s*";
         ptn += "(?:<text *(?: [^>]*)?>[^<]*</text>\\s*)*)";
         ptn += "</event>"; // Wrong closing tag.

         p = Pattern.compile(ptn);
         m = p.matcher(sb);
         while ( m.find() ) {
            sb.replace(m.start(), m.end(), m.group(1)+"</textList>");
            m.reset();
         }
      }
[...]
      // Parse cleaned XML
      Encounters evts = (Encounters)unmarshalFromSequence( Encounters.class, sb );


To make an exhaustive typo list, I change that while loop, to only replace the first N matches. Where N is the number of that error I'm aware of. If parsing fails, I check the log for another event name to add to the list, increment N, and repeat.
Vhati
Posts: 792
Joined: Thu Oct 25, 2012 12:01 pm

Re: [Bug] Event XML Typos

Postby Vhati » Fri Feb 01, 2013 3:16 am

thashepherd wrote:Was more asking about your parser - and yeah, WinMerge is a godsend. Did you just do it programmatically? I've been lazy...

If you're still curious, the class I'm using to map and clean dats is on github here.
thashepherd
Posts: 194
Joined: Fri Nov 16, 2012 11:45 pm

Re: [Bug] Event XML Typos

Postby thashepherd » Sat Feb 02, 2013 12:15 am

Thanks a lot!
You are the weak, and I am the tyranny of evil men - but I'm trying, I'm trying real hard to be the shepherd.

"Wow, that Kieve guy is one angsty nerd eh."
Sonata - "Best use of Common Lisp in an indie space roguelike!"
Vhati
Posts: 792
Joined: Thu Oct 25, 2012 12:01 pm

Re: [Bug] XML Typos in 1.03.1 (Events+Blueprints)

Postby Vhati » Sun Feb 03, 2013 6:15 am

I revisited my older regexes and catalogued the blueprint typos that patches have missed so far.
(See first post.)
Vhati
Posts: 792
Joined: Thu Oct 25, 2012 12:01 pm

Re: [Bug] XML Typos in 1.03.1 (Blueprints+Events+SectorData)

Postby Vhati » Tue Mar 05, 2013 4:49 am

Added sector_data.xml to the first post, under events.
Vhati
Posts: 792
Joined: Thu Oct 25, 2012 12:01 pm

Re: [Bug] XML Typos in 1.03.1 (Sounds added)

Postby Vhati » Tue Mar 12, 2013 10:14 am

Added sounds.xml to the first post.