Global Class "XMLData"⚓︎
Info
A public table containing all the functions related to gathering XML attributes accross the different XMLs with updated values to match the real values.
You can get this class by using the XMLData
global table.
注意:调用这些函数时,必须使用 .(句点)而非 :(冒号)!
Example Code
1 |
|
Warning
XML attributes are converted to lowercase when being parsed by REPENTOGON! This eliminates capitializtion inconsistency in vanilla tags, but might result in not being able to find attributes if they're looked up by their name as definined in the XML (e.g bossID
will return nil
, so use bossid
instead.)
Functions⚓︎
GetBossColorByTypeVarSub ()⚓︎
table GetBossColorByTypeVarSub ( EntityType Type, int Variant , int SubType)⚓︎
Returns a table containing the attributes of the bosscolor on bosscolors.xml that match the given type variant and subtype.
Table usage
print("Red Monstro's suffix:", XMLData.GetBossColorByTypeVarSub(20,0,1).suffix)
1 |
|
GetEntityByTypeVarSub ()⚓︎
table GetEntityByTypeVarSub ( EntityType Type, int Variant = 0 , int SubType = 0, boolean Strict = false)⚓︎
Child nodes are returned as tables alongside the rest of the attributes. For example, if you want to access the samples of a sound entry, you can use soundentry.sample[1]
.
print("Monstro's BossID:", XMLData.GetEntityByTypeVarSub(20).bossid)
Returns a table containing the attributes of the entity on entities2.xml that match the given type and/or variant and/or subtype. The strict parameter determines if it should only return a value when all 3 attributes(type, var and sub) match or return whatever matches the type and take the rest as maybes.
Table usage
1 |
|
GetEntryById ()⚓︎
table GetEntryById ( XMLNode NodeType, int Idx )⚓︎
Child nodes are returned as tables alongside the rest of the attributes. For example, if you want to access the samples of a sound entry, you can use soundentry.sample[1]
.
The Id usually matches the actual id of the node in question, with the exception of cases like the entities.xml where ids are not unique, on those cases, the id is the order of the node and wont correspond with the actual id. On the cases of XMLs without ids, its just the order again.
Table usage
1 2 3 4 |
|
GetEntryByName ()⚓︎
table GetEntryByName ( XMLNode NodeType, string Name )⚓︎
Child nodes are returned as tables alongside the rest of the attributes. For example, if you want to access the samples of a sound entry, you can use soundentry.sample[1]
.
Returns a table containing the attributes of the corresponding xml, the matching NodeType (Ex: XMLNode.TRINKET returns trinket nodes from pocketitems.xml) and match the given name parameter.
Table usage
1 2 |
|
GetEntryByOrder ()⚓︎
table GetEntryByOrder ( XMLNode NodeType, int Order )⚓︎
Child nodes are returned as tables alongside the rest of the attributes. For example, if you want to access the samples of a sound entry, you can use soundentry.sample[1]
.
The Id usually matches the actual id of the node in question, with the exception of cases like the entities.xml where ids are not unique, on those cases, the id is the order of the node and wont correspond with the actual id. On the cases of XMLs without ids, its just the order again.
Table usage
1 2 3 4 |
|
GetEntryFromEntity ()⚓︎
table GetEntryFromEntity ( Entity Entity, boolean AutoXMLPick = true, boolean Strict)⚓︎
Child nodes are returned as tables alongside the rest of the attributes. For example, if you want to access the samples of a sound entry, you can use soundentry.sample[1]
.
Returns a table containing the attributes of the provided entity. The AutoXMLPick
parameter determines if only entities2.xml should be used or if it should pick the xml that matches the EntityType (Ex: items.xml for pedestal collectibles) . The strict parameter determines if it should only return a value when the type,variant and subtype attributes match or return whatever matches the type and take the rest as maybes.
Table usage
1 2 |
|
GetModById ()⚓︎
table GetModById ( string modId )⚓︎
The Id usually matches the actual id of the mod in the workshop, with the exception of cases where the mod was downloaded illegally and tampered with or if its an indev mod. If the mod doesnt have an id, then the directory is used as an id.
Table usage
print("Car's mod name:", XMLData.GetModById("2788006730").name)
1 2 |
|
GetNumEntries ()⚓︎
int GetNumEntries ( XMLNode NodeType)⚓︎
Returns the number of entries a given XMLNode structure has.