Rev | Line | |
---|
[950] | 1 | @XML_TOOLS Version "2.0"
|
---|
[965] | 2 |
|
---|
| 3 | @CUSTOM_CODE
|
---|
| 4 | <code>
|
---|
| 5 | var myBuilder = new JSXMLBuilder();
|
---|
| 6 | myBuilder.load($xmlData);
|
---|
| 7 | var elements = myBuilder.elements[0];
|
---|
| 8 |
|
---|
[966] | 9 | // If ONCP doesn't exist, ignore it
|
---|
| 10 | if (!elements.childElement("ONCP"))
|
---|
| 11 | return;
|
---|
| 12 |
|
---|
[965] | 13 | // If there are no attacks in this TRAM, ignore it
|
---|
| 14 | if (!elements.childElement("ONCP").childElement("Particles"))
|
---|
| 15 | return;
|
---|
| 16 |
|
---|
| 17 | // Check if glass_break is already registered for the character
|
---|
| 18 | var particles = elements.childElement("ONCP").childElement("Particles");
|
---|
| 19 | for (var i = 0; (particles.childElement(i)); i++)
|
---|
| 20 | {
|
---|
| 21 | var particle = particles.childElement(i);
|
---|
| 22 | if (particle.childElement("Name").text == "glass_break")
|
---|
| 23 | return;
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | // If we're still here, register glass_break
|
---|
| 27 | myBuilder.addElementAt("ONCPParticle",
|
---|
| 28 | "",
|
---|
| 29 | "<Name>glass_break</Name>\
|
---|
| 30 | <Type>glass_break</Type>\
|
---|
| 31 | <BodyPart>None</BodyPart>",
|
---|
| 32 | particles.index + 1,
|
---|
[966] | 33 | particles.level + 1);
|
---|
| 34 |
|
---|
| 35 | // Update the global variable with the new XML
|
---|
| 36 | $xmlData = myBuilder.generateXML();
|
---|
[965] | 37 | </code>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.