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