XSL Transform of MasterTechDefs.xml

Also posted on steam (227Steam over there)

I wanted longer paced games and the tech/manu sliders are limited even when you adjust them in the XML. I decided to add a multiplier to all the <ResearchCost>X</ResearchCost> values in MasterTechDefs.xml and while a global replace could add a 10x/100x etc value I wanted more fine adjustments and each patch updating the core required I do it again.

 

Since I hacked thru it, I thought I would share. The below shows adding a 1.5X modifier, and you can change it by altering the number in line 15 (1.5)

 

I recommend Notepad++ and the XML tools plugin, but your fav XML whatever should do the transforms.

 

example from MasterTechDefs.xml before

<FlavorDescription>Tech_AntiMatterPowerPlants_FlavorText_Description</FlavorDescription>

<ColorDef>TechOrange</ColorDef>

<Icon>Icon_Production.png</Icon>

<Image>event_slum_Small.png</Image>

<Rarity>Uncommon</Rarity>

<ResearchCost>180</ResearchCost>

 

example from MasterTechDefs.xml after

<FlavorDescription>Tech_AntiMatterPowerPlants_FlavorText_Description</FlavorDescription>

<ColorDef>TechOrange</ColorDef>

<Icon>Icon_Production.png</Icon>

<Image>event_slum_Small.png</Image>

<Rarity>Uncommon</Rarity>

<ResearchCost>270</ResearchCost>

--------------------

Code: xml
  1. <!--?xml version="1.0" encoding="UTF-8"?-->
  2. &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  3. &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  4.  
  5.     &lt;!-- Identity transform --&gt;
  6.     &lt;xsl:template match="@*|node()"&gt;
  7.         &lt;xsl:copy&gt;
  8.             &lt;xsl:apply-templates select="@*|node()"/&gt;
  9.         &lt;/xsl:copy&gt;
  10.     &lt;/xsl:template&gt;
  11.  
  12.     &lt;!-- Template to transform ResearchCost element --&gt;
  13.     &lt;xsl:template match="ResearchCost"&gt;
  14.         &lt;xsl:copy&gt;
  15.             &lt;xsl:value-of select="format-number(., '0.##') * 1.5"/&gt;
  16.         &lt;/xsl:copy&gt;
  17.     &lt;/xsl:template&gt;
  18.  
  19. &lt;/xsl:stylesheet&gt;
  20. <!-- Identity transform --> <!-- Template to transform ResearchCost element -->

2,771 views 1 replies
Reply #1 Top

Ignore line 19, the code function adds it, and having spaces after </xsl:stylesheet> causes flakiness.