Jump to content

[Xpath] Modify windows.xml for number of perklines.


Recommended Posts

Hi,

 

i'm working on a little mod that add new book collection. It's working fine but i wanted to do a collection of 9 and the UI doesn't show the 9th because there's 8 lines max in the perk book screeen.

 

Found grid rows in windows xml but how can i modify that with an xpath file ?

 

 

<configs>
	<config name="XUi/windows">   
		<set xpath="/windows/window[@name='windowSkillBookInfo']/rect[@name='content']/rect[@name='tableBox']/grid/@rows">9</set>
	</config>
  </configs>


Is getting me patch element does not have an xpath attribute

I think it's around the /grid/ but i'm unsure

EDit : Second try does the same thing

 

<configs>
	<config name="XUi/windows">   
		<set xpath="/windows/window[@name='windowSkillBookInfo']/rect[@name='content']//grid[1]@rows">9</set>
	</config>
</configs>

 

Link to comment
Share on other sites

  • FFW_Rude changed the title to [Xpath] Modify windows.xml for number of perklines.

There are a couple things wrong.

 

The first thing is that the XPath commands (set, insertAfter, etc.) need to be tags that are an immediate child of the root node. (The root node in this case is the "configs" tag.) So it's looking for an XPath command named "config" (which doesn't exist), and there is no "xpath" attribute on it (only "name" which is irrelevant to XPath command tags).

 

7D2D automatically modifies the XML that matches the filename, and path, relative to the modlet's root directory. So to modify the vanilla "Data/Config/XUi/windows.xml" file, your modlet needs to have the XPath command XML in a file called "[your modlet name]/Config/XUi/windows.xml". If it doesn't exactly match a vanilla file and path it will be ignored.

 

You might also want to look at the XPath string itself. First, you need to put a "/" between "grid[1]" and "@rows". But also, it's looking for the first "grid" child tag in the entire "content" rect node. For me that's in the one in the "tableBox" rect, but that could change at any time.

Link to comment
Share on other sites

Thank you.

 

So i kinda need to combined both strings. xpath string i'll figure out. That was the message that baffled me. Now that you mention it i did have <configs>then xPath directly after on all my other files.  Now i kinda not see that all of them were different.

 

i have this

 

<modName name='items.xml'>
  	<!-- Stuff -->
</modName>

 

And also this

 

<configs>
  	<!-- Stuff -->
</configs>

 

Should i go modName ? or generic "configs" ? Also i believe name attribute on <modName> is only for readability ? 'cause it's not parsed right ?

Link to comment
Share on other sites

The root node of the XPath XML files does not make any difference. It's only there so the file will be valid XML (there can only be one root XML node in a document).

 

I personally use "configs" but I've seen other people that use the name of the mod/modlet. Up to you.

 

The "name" attribute you have does not make any difference. All attributes on the root node are ignored. I've never seen anyone use attributes on the root node.

 

If you're trying to use one XML file in your modlet to target multiple vanilla XML files, then that won't work. You need one file in your modlet per vanilla file, and their paths and filenames much match the vanilla XML paths and filenames.

 

EDIT: Maybe an example with comments would help.

 

<!-- This is the root node, it's present only because XML can have only one root node -->
<config name="This is totally ignored, in fact I've never seen anyone use attributes on this tag">
  <!-- Only tags at this level are tags that represent XPath, and they must have an "xpath" attribute -->
  <insertAfter xpath="/path/to/selected/nodes/or/@attributes">
    <!-- Nothing in here is parsed as an XPath command -->
    <property name="whatever" value="something" />
    <!-- ...in fact it's not parsed at all when inserted -->
    Hello! This text will be inserted into the final XML even though it's not XML at all.
    Obviously it'll cause an error when reading the XML afterwards.
  </insertAfter>
</config>

 

Link to comment
Share on other sites

Another example (this is from the mod I am working on and is the progression file)


 

<config>

<!-- *************************Perception Tree Changes***********************************************************  -->
<!-- Rifles  -->
    <remove xpath="/progression/perks/perk[@name='perkDeadEye']/effect_group/passive_effect[@name='CraftingTier']"/>
    <remove xpath="/progression/perks/perk[@name='perkDeadEye']/effect_group/passive_effect[@name='RecipeTagUnlocked']"/>
    
    <insertBefore xpath="/progression/perks/perk[@name='perkDeadEye']/effect_group/passive_effect[@name='EntityDamage']">
        <passive_effect name="CraftingTier" operation="base_add" level="1,2,3,4,5" value="1,1,1,1,1" tags="PipeRifle"/>        
        <passive_effect name="CraftingTier" operation="base_add" level="1,2,3,4,5" value="1,2,3,3,3" tags="T1Rifle"/>
        <passive_effect name="CraftingTier" operation="base_add" level="1,2,3,4,5" value="1,2,2,2,2" tags="T2Rifle"/>    
        <passive_effect name="CraftingTier" operation="base_add" level="1,2,3,4,5" value="1,1,1,1,1" tags="T3Rifle"/>
    </insertBefore>

<!--  Demolitions  -->
    <remove xpath="/progression/perks/perk[@name='perkDemolitionsExpert']/effect_group/passive_effect[@name='RecipeTagUnlocked']"/>

    <set xpath="/progression/perks/perk[@name='perkDemolitionsExpert']/effect_group/passive_effect[@name='CraftingTier']/@value">0,0,0,0,0</set>
    <set xpath="/progression/perks/perk[@name='perkDemolitionsExpert']/effect_group/passive_effect[@name='CraftingTier']/@tags">T3Rocket</set>

<!--  Spears  -->
    <remove xpath="/progression/perks/perk[@name='perkJavelinMaster']/effect_group/passive_effect[@name='CraftingTier']"/>
    <remove xpath="/progression/perks/perk[@name='perkJavelinMaster']/effect_group/passive_effect[@name='RecipeTagUnlocked']"/>

    <insertBefore xpath="/progression/perks/perk[@name='perkJavelinMaster']/effect_group/passive_effect[@name='BlockDamage']">
        <passive_effect name="CraftingTier" operation="base_add" level="1,2,3,4,5" value="1,1,1,1,1" tags="StoneSpear"/>    
        <passive_effect name="CraftingTier" operation="base_add" level="1,2,3,4,5" value="1,2,3,3,3" tags="T1Spear"/>
        <passive_effect name="CraftingTier" operation="base_add" level="1,2,3,4,5" value="1,1,1,1,1" tags="T3Spear"/>
    </insertBefore>    

<!-- Salvage Operations  -->
    <remove xpath="/progression/perks/perk[@name='perkSalvageOperations']/effect_group/passive_effect[@name='CraftingTier']"/>
    <remove xpath="/progression/perks/perk[@name='perkSalvageOperations']/effect_group/passive_effect[@name='RecipeTagUnlocked']"/>

    <insertBefore xpath="/progression/perks/perk[@name='perkSalvageOperations']/effect_group/passive_effect[@name='CraftingTime']">
        <passive_effect name="CraftingTier" operation="base_add" level="1,2,3,4,5" value="1,2,3,3,3" tags="T1Salvage"/>
        <passive_effect name="CraftingTier" operation="base_add" level="1,2,3,4,5" value="1,2,2,2,2" tags="T2Salvage"/>    
        <passive_effect name="CraftingTier" operation="base_add" level="1,2,3,4,5" value="1,1,1,1,1" tags="T3Salvage"/>
    </insertBefore>    


<!-- New Quality 6 Crafting Perk  -->
    <insertAfter xpath="/progression/perks/perk[@name='perkGreaseMonkey']">
        <perk name="perkQualityCrafting" parent="skillIntellectCraftsmanship" name_key="perkQualityCraftingName" desc_key="perkQualityCraftingDesc" icon="ui_game_symbol_service">
            <level_requirements level="1"><requirement name="ProgressionLevel" progression_name="attIntellect" operation="GTE" value="2" desc_key="reqIntellectLevel02"/></level_requirements>
            <level_requirements level="2"><requirement name="ProgressionLevel" progression_name="attIntellect" operation="GTE" value="4" desc_key="reqIntellectLevel04"/></level_requirements>
            <level_requirements level="3"><requirement name="ProgressionLevel" progression_name="attIntellect" operation="GTE" value="6" desc_key="reqIntellectLevel06"/></level_requirements>
            <level_requirements level="4"><requirement name="ProgressionLevel" progression_name="attIntellect" operation="GTE" value="8" desc_key="reqIntellectLevel08"/></level_requirements>
            <level_requirements level="5"><requirement name="ProgressionLevel" progression_name="attIntellect" operation="GTE" value="10" desc_key="reqIntellectLevel10"/></level_requirements>

        <effect_group>
            <passive_effect name="CraftingTier" operation="base_add" level="1,2,3,4,5" value="2,2,2,2,2" tags="T1Crafting"/>
            <passive_effect name="CraftingTier" operation="base_add" level="1,2,3,4,5" value="1,2,2,3,3" tags="T2Crafting"/>
            <passive_effect name="CraftingTier" operation="base_add" level="1,2,3,4,5" value="0,1,2,3,4" tags="T3Crafting"/>

            <effect_description level="1" desc_key="perkQualityCraftingRank1Desc" long_desc_key="perkQualityCraftingRank1LongDesc"/>
            <effect_description level="2" desc_key="perkQualityCraftingRank2Desc" long_desc_key="perkQualityCraftingRank2LongDesc"/>
            <effect_description level="3" desc_key="perkQualityCraftingRank3Desc" long_desc_key="perkQualityCraftingRank3LongDesc"/>
            <effect_description level="4" desc_key="perkQualityCraftingRank4Desc" long_desc_key="perkQualityCraftingRank4LongDesc"/>
            <effect_description level="5" desc_key="perkQualityCraftingRank5Desc" long_desc_key="perkQualityCraftingRank5LongDesc"/>
        </effect_group>
    </perk>
    </insertAfter>

<!-- *************************Perk Book Changes***********************************************************  -->        
<!-- Adding recipes to perk books  -->
    <insertAfter xpath="/progression/perks/perk[@name='perkUrbanCombatLandMines']/effect_group/passive_effect[@name='LandMineImmunity']">
        <passive_effect name="RecipeTagUnlocked" operation="base_set" level="1" value="1" tags="mineCookingPot"/>
        <passive_effect name="RecipeTagUnlocked" operation="base_set" level="1" value="1" tags="rScrapIronPlateMine"/>
        <passive_effect name="RecipeTagUnlocked" operation="base_set" level="1" value="1" tags="mineHubcap"/>
        <passive_effect name="RecipeTagUnlocked" operation="base_set" level="1" value="1" tags="mineAirFilter"/>
    </insertAfter>    

</config>

 

I removed some stuff so it wouldn't be so large (and they are just the changes I made to the other perks).  Examples of removing items, inserting items, and changing the values.   I also created my own perk, though I am not yet done with it (haven't touch the localization for the description).

 

I used config at the start.  I might change it later but for now not on my priority list.

 

I do recommend comments.  I didn't go too much into details on the comments, but I am using them to separate the changes.  It makes it much easier later when I want to add items or modify things to use the comments to quickly find the code I need to look at.  My quests file is over 3k lines now .
 

Link to comment
Share on other sites

Thanks a lot for your answer. It works now.

 

Now i'm onto unity to find how to snap everything correctly but it's looking good. The idea is stupid. I just made puzzle pieces that you have to get with book perks. But it works. The only problem i had was that double node. 

 

Thanks for the example as it helps to understand the DOM mechanics of xpath.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...