Dynamic Content¶
Copy Existing Nodes¶
117 & 1800
<ModOp Replace="@1500010225/Building/InfluencedVariationDirection">
<ModValue Insert="@1500010200/Building/InfluencedVariationDirection">
</ModOp>
<ModOp Replace="@1500010225/Building/InfluencedVariationDirection"
Content="@1500010200/Building/InfluencedVariationDirection" />
<ModOp Type="replace" GUID="1500010225"
Path="/Values/Building/InfluencedVariationDirection"
Content="@1500010200/Building/InfluencedVariationDirection" />
Wrap Copied Nodes¶
117 & 1800
<ModOp Replace="@1010399/AssetPool/AssetList">
<ModValue Insert="@120055/ProductStorageList/ProductList/Item/Product/text()">
<Item>
<Asset>
<ModValueContent />
</Asset>
</Item>
</ModValue>
</ModOp>
<ModOp Replace="@1010399/AssetPool/AssetList"
Content="@120055/ProductStorageList/ProductList/Item/Product/text()">
<Item>
<Asset>
<ModOpContent />
</Asset>
</Item>
</ModOp>
<ModOp Type="replace" GUID="1010399"
Path="/Values/AssetPool/AssetList"
Content="@120055/ProductStorageList/ProductList/Item/Product/text()">
<Item>
<Asset>
<ModOpContent />
</Asset>
</Item>
</ModOp>
<ProductList>
<Item>
<Product>120008</Product>
</Item>
<!-- ... -->
</ProductList>
<AssetList>
<Item>
<Asset>120008</Asset>
</Item>
<!-- ... -->
</AssetList>
Insert Local Content¶
117
Use <ModValue Insert="<local path>" /> to copy data from a local path without specifying GUID.
<ModOp Merge="@123">
<Inline><ModValue Insert="../Standard/GUID/text()" /></Inline>
</ModOp>
<ModOp Property="ItemSocketSet" Merge="../ExpeditionAttribute">
<FluffText><ModValue Insert="../../ItemSocketSet/SetBuff/text()" /></FluffText>
</ModOp>
Previously, copying local content was only possible in combination with a specific GUID.
<ModOp Type="add" GUID="123" Content="Standard/GUID/text()">
<GUID><ModOpContent /></GUID>
</ModOp>
Merge Flags¶
117
Use <ModValue Merge="Your;Flags" /> to insert one or more flags if not already present, instead of overwriting the existing flags value.
Similarily use Remove to remove flags.
<ModOp GUID="114365" Merge="Product">
<AssociatedRegion><ModValue Merge="Moderate" /></AssociatedRegion>
</ModOp>
<ModOp GUID="114365" Merge="Product">
<AssociatedRegion><ModValue Remove="Moderate" /></AssociatedRegion>
</ModOp>
<ModOp Merge="@114365/Product">
<AssociatedRegion><ModValue Merge="Moderate" /></AssociatedRegion>
</ModOp>
<ModOp Merge="@114365/Product">
<AssociatedRegion><ModValue Remove="Moderate" /></AssociatedRegion>
</ModOp>
<ModOp Type="add" GUID="114365"
Condition="!/Values/Product/AssociatedRegion[contains(text(), 'Moderate')]"
Path="/Values/Product/AssociatedRegion">;Moderate</ModOp>
<!-- a generic remove was not possible -->
Insert Calculations¶
117
<ModValue Insert/> and <ModOp Content/> support XPath 1.0 functions.
For example use number() to add to a number instead of replacing it.
<ModOp GUID="1010343"
Replace="Residence7/ResidentMax"
Content="number(Residence7/ResidentMax) + 2">
<ResidentMax><ModOpContent /></ResidentMax>
</ModOp>
<!-- number table -->
<ModOp Type="add" GUID="1010343" Path="/Values">
<Number>1</Number>
<!-- ... -->
<Number>100</Number>
</ModOp>
<!-- add your value and pick from the table -->
<ModOp Type="replace" GUID="1010343"
Path="/Values/Residence7/ResidentMax"
Content="~/Values/Number[number(../Residence7/ResidentMax) + 2]/text()">
<ResidentMax><ModOpContent /></ResidentMax>
</ModOp>
<!-- remove table -->
<ModOp Type="remove" GUID="1010343" Path="/Values/Number" />
More examples with ModValue.
<!-- addition -->
<ModOp Property="Maintenance" Merge="Workforce">
<Workforce><ModValue Insert="self::node() + 10" /><!-- (1)! --></Workforce>
</ModOp>
<!-- division -->
<ModOp Property="Storage" Merge="Amount">
<Amount><ModValue Insert="round(self::node() div 2)" /><!-- (2)! --></Amount>
</ModOp>
-
Or shorter:
Insert=". + 10". -
Make sure to round to full numbers.
Available operators: +, -, *, div, mod.
Available calculation related XPath functions: number(), count(), position(), round().
Checkout the XPath Cheatsheet to learn more about XPath.
Insert Options¶
117
Option values can be used in <ModValue Insert/> and <ModOp Content/> as values to insert.
<ModOp Merge="@123">
<PublicServiceRange><ModValue Insert="$mod-id.range"/></PublicServiceRange>
</ModOp>
{
"mod-id": {
"range": "10"
}
}
<Values>
<Standard>
<GUID>123</GUID>
</Standard>
- <PublicServiceRange>20</PublicServiceRange>
+ <PublicServiceRange>10</PublicServiceRange>
</Values>