| 1 | #########################################################################################
|
|---|
| 2 | ############################## XmlTools Patch File Example ##############################
|
|---|
| 3 | #########################################################################################
|
|---|
| 4 |
|
|---|
| 5 | ########## Comments in patch files begin with '#'
|
|---|
| 6 |
|
|---|
| 7 | ########## You can comment and uncomment commands to see their effect
|
|---|
| 8 | ########## in BINACJBOCharacter.xml file
|
|---|
| 9 |
|
|---|
| 10 | # The following row is always required in a XmlTools patch.
|
|---|
| 11 | # It defines the minimum version of XmlTools executable that it requires.
|
|---|
| 12 | @XML_TOOLS Version "2.0"
|
|---|
| 13 |
|
|---|
| 14 | # This command adds a new XML node (inside of <xml></xml> tags) to all OSD named nodes.
|
|---|
| 15 | @ADD_INSIDE_NODES ElementName "OSD" Files "BINACJBOCharacter.xml"
|
|---|
| 16 | <xml>
|
|---|
| 17 | <Attack>
|
|---|
| 18 | <Start>0</Start>
|
|---|
| 19 | <End>30</End>
|
|---|
| 20 | <Bones>Pelvis Chest Neck Head LeftShoulder LeftArm LeftWrist LeftFist RightShoulder RightArm RightWrist RightFist</Bones>
|
|---|
| 21 | <Flags>Unblockable</Flags>
|
|---|
| 22 | <Knockback>0</Knockback>
|
|---|
| 23 | <HitPoints>10</HitPoints>
|
|---|
| 24 | <HitType>KnockdownBody</HitType>
|
|---|
| 25 | <HitLength>0</HitLength>
|
|---|
| 26 | <StunLength>0</StunLength>
|
|---|
| 27 | <StaggerLength>0</StaggerLength>
|
|---|
| 28 | <Extents/>
|
|---|
| 29 | </Attack>
|
|---|
| 30 | </xml>
|
|---|
| 31 |
|
|---|
| 32 | # This command removes the nodes inserted in the previous command using ElementName and ParentElementName.
|
|---|
| 33 | @REMOVE_NODES ElementName "Attack" ParentElementName "OSD" Files "BINACJBOCharacter.xml"
|
|---|
| 34 |
|
|---|
| 35 | # This command adds a new XML node (inside of <xml></xml> tags) to the nodes that matches the XPathExpression.
|
|---|
| 36 | @ADD_INSIDE_NODES XPathExpression "/Oni/Objects/CHAR/OSD" Files "BINACJBOCharacter.xml"
|
|---|
| 37 | <xml>
|
|---|
| 38 | <Attack>
|
|---|
| 39 | <Start>0</Start>
|
|---|
| 40 | <End>30</End>
|
|---|
| 41 | <Bones>Pelvis Chest Neck Head LeftShoulder LeftArm LeftWrist LeftFist RightShoulder RightArm RightWrist RightFist</Bones>
|
|---|
| 42 | <Flags>Unblockable</Flags>
|
|---|
| 43 | <Knockback>0</Knockback>
|
|---|
| 44 | <HitPoints>10</HitPoints>
|
|---|
| 45 | <HitType>KnockdownBody</HitType>
|
|---|
| 46 | <HitLength>0</HitLength>
|
|---|
| 47 | <StunLength>0</StunLength>
|
|---|
| 48 | <StaggerLength>0</StaggerLength>
|
|---|
| 49 | <Extents/>
|
|---|
| 50 | </Attack>
|
|---|
| 51 | </xml>
|
|---|
| 52 |
|
|---|
| 53 | # This command removes the nodes inserted in the previous command using an XPathExpression.
|
|---|
| 54 | @REMOVE_NODES XPathExpression "/Oni/Objects/CHAR/OSD/Attack" Files "BINACJBOCharacter.xml"
|
|---|
| 55 |
|
|---|
| 56 | # This command executes any of the XmlTools commands (see all possible command using XmlTools --help)
|
|---|
| 57 | @COMMAND Options "--files 'BINACJBOCharacter.xml' --element-name 'Position' --invert-elements"
|
|---|
| 58 |
|
|---|
| 59 | # This command executes the javascript inside the (inside of <code></code> tags)
|
|---|
| 60 |
|
|---|
| 61 | # The current javascript code first gets the element name "CHAR" with an attribute Id=11565
|
|---|
| 62 | # then it gets the child element "OSD" and set its Weapon element value to "MyAwesomeOniWeapon"
|
|---|
| 63 | @CUSTOM_CODE Files "BINACJBOCharacter.xml"
|
|---|
| 64 | <code>
|
|---|
| 65 | var myBuilder = new JSXMLBuilder();
|
|---|
| 66 | myBuilder.load($xmlData);
|
|---|
| 67 |
|
|---|
| 68 | var elements = myBuilder.elements;
|
|---|
| 69 |
|
|---|
| 70 | for (var i = 0; i < elements.length; i++) {
|
|---|
| 71 | if(elements[i].name=="CHAR" && elements[i].attributeString==" Id=\"11565\""){
|
|---|
| 72 | elements[i].childElement("OSD").childElement("Weapon").text="MyAwesomeOniWeapon";
|
|---|
| 73 | break;
|
|---|
| 74 | }
|
|---|
| 75 | }
|
|---|
| 76 |
|
|---|
| 77 | $xmlData=myBuilder.generateXML(); // update the global variable with the new XML
|
|---|
| 78 | </code>
|
|---|