Skip to content

Commit 443bb52

Browse files
authored
Merge pull request #637 from monkeyman192/mxml_fixes
Improve mxml format compatibility
2 parents 56bb86b + f6007c2 commit 443bb52

23 files changed

+313
-293
lines changed

Tools/auto_extract/extractor.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,9 @@ def field_type(self):
328328
)
329329

330330
@property
331-
def has_space_in_name(self):
332-
return " " in self._field_name
331+
def has_mxml_name(self):
332+
if " " in self._field_name or self._field_name[0].isdigit():
333+
return True
333334

334335
@property
335336
def field_name(self):

Tools/auto_extract/templates/default/class_template.j2

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
{{ enum_val[1] }}{% if field.requires_values %} = {{ enum_val[0] }}{% endif %},
1717
{%- endfor %}
1818
}
19-
[NMS(Index = {{ field.field_index }}{% if field.has_space_in_name %}, MxmlName = "{{ field._field_name }}"{% endif %})]
19+
[NMS(Index = {{ field.field_index }}{% if field.has_mxml_name %}, MxmlName = "{{ field._field_name }}"{% endif %})]
2020
/* {{ field.field_offset }} */ public {{ field.field_name }}Enum {{ field.field_name }};
2121
{%- elif field._is_array_field %}{# End of enum chunk, start of array chunk #}
2222
{%- if field.local_enum %}
@@ -27,16 +27,16 @@
2727
{%- endfor %}
2828
}
2929
{%- endif %}
30-
[NMS(Index = {{ field.field_index }}, Size = {{ field.array_size }}{% if field.array_enum_type is not none %}, EnumType = typeof({{ field.array_enum_type }}){% endif %}{% if field.has_space_in_name %}, MxmlName = "{{ field._field_name }}"{% endif %})]
30+
[NMS(Index = {{ field.field_index }}, Size = {{ field.array_size }}{% if field.array_enum_type is not none %}, EnumType = typeof({{ field.array_enum_type }}){% endif %}{% if field.has_mxml_name %}, MxmlName = "{{ field._field_name }}"{% endif %})]
3131
/* {{ field.field_offset }} */ public {{ field.field_type }}[] {{ field.field_name }};
3232
{%- elif field._is_list_field %}{# End of array chunk, start of list chunk #}
33-
[NMS(Index = {{ field.field_index }}{% if field.has_space_in_name %}, MxmlName = "{{ field._field_name }}"{% endif %})]
33+
[NMS(Index = {{ field.field_index }}{% if field.has_mxml_name %}, MxmlName = "{{ field._field_name }}"{% endif %})]
3434
/* {{ field.field_offset }} */ public List<{{ field.field_type }}> {{ field.field_name }};
3535
{%- elif field._is_hash_map_field %}{# End of array chunk, start of HashMap chunk #}
36-
[NMS(Index = {{ field.field_index }}{% if field.has_space_in_name %}, MxmlName = "{{ field._field_name }}"{% endif %})]
36+
[NMS(Index = {{ field.field_index }}{% if field.has_mxml_name %}, MxmlName = "{{ field._field_name }}"{% endif %})]
3737
/* {{ field.field_offset }} */ public HashMap<{{ field.field_type }}> {{ field.field_name }};
3838
{%- else %}{# End of array chunk, start of normal field chunk #}
39-
[NMS(Index = {{ field.field_index }}{% if field.has_space_in_name %}, MxmlName = "{{ field._field_name }}"{% endif %})]
39+
[NMS(Index = {{ field.field_index }}{% if field.has_mxml_name %}, MxmlName = "{{ field._field_name }}"{% endif %})]
4040
/* {{ field.field_offset }} */ public {{ field.field_type }} {{ field.field_name }};
4141
{%- endif %}
4242
{%- endfor %}

libMBIN/Source/NMS/GameComponents/GcBehaviourMaintainRangeFromTargetData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class GcBehaviourMaintainRangeFromTargetData : NMSTemplate
1515
/* 0x40 */ public float AvoidCreaturesStrength;
1616
[NMS(Index = 5)]
1717
/* 0x44 */ public float SpeedModifier;
18-
[NMS(Index = 3)]
18+
[NMS(Index = 3, MxmlName = "2D")]
1919
/* 0x48 */ public bool _2D;
2020
[NMS(Index = 4)]
2121
/* 0x49 */ public bool SucceedWhenInRange;

libMBIN/Source/NMS/GameComponents/GcDestructableComponentData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace libMBIN.NMS.GameComponents
66
{
7-
[NMS(GUID = 0x3786C6A187936C27, NameHash = 0xFC70ABE3)]
7+
[NMS(GUID = 0x736C051B1E5187B3, NameHash = 0xFC70ABE3)]
88
public class GcDestructableComponentData : NMSTemplate
99
{
1010
[NMS(Index = 31, Size = 0x3, EnumType = typeof(GcRarity.RarityEnum))]

libMBIN/Source/NMS/GameComponents/GcGenericMissionSequence.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace libMBIN.NMS.GameComponents
66
{
7-
[NMS(GUID = 0xE0D3CBC490E48AF6, NameHash = 0x7FD50C85)]
7+
[NMS(GUID = 0x3D2B98ABA8CC85E3, NameHash = 0x7FD50C85)]
88
public class GcGenericMissionSequence : NMSTemplate
99
{
1010
[NMS(Index = 24)]
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
namespace libMBIN.NMS.GameComponents
22
{
3-
[NMS(GUID = 0xABA81E6AF4F4DEA1, NameHash = 0xD86CF6EA)]
3+
[NMS(GUID = 0x939BB1F09370CB2B, NameHash = 0xD86CF6EA)]
44
public class GcMissionConditionCanRenameDiscovery : NMSTemplate
55
{
6+
[NMS(Index = 0)]
7+
/* 0x0 */ public bool ValueToReturnWhileSearchActive;
68
}
79
}

libMBIN/Source/NMS/GameComponents/GcMissionConditionStatLevel.cs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,30 @@
22

33
namespace libMBIN.NMS.GameComponents
44
{
5-
[NMS(GUID = 0xF5241BD44B6627B2, NameHash = 0xFBADBD2)]
5+
[NMS(GUID = 0x232C28E1E4FDF816, NameHash = 0xFBADBD2)]
66
public class GcMissionConditionStatLevel : NMSTemplate
77
{
88
[NMS(Index = 7)]
99
/* 0x00 */ public NMSString0x10 CompareStat;
10+
[NMS(Index = 10)]
11+
/* 0x10 */ public NMSString0x10 FormatItemNameIntoText;
1012
[NMS(Index = 0)]
11-
/* 0x10 */ public NMSString0x10 Stat;
13+
/* 0x20 */ public NMSString0x10 Stat;
1214
[NMS(Index = 1)]
13-
/* 0x20 */ public NMSString0x10 StatGroup;
15+
/* 0x30 */ public NMSString0x10 StatGroup;
1416
[NMS(Index = 8)]
15-
/* 0x30 */ public int DisplayMilestoneNumber;
17+
/* 0x40 */ public int DisplayMilestoneNumber;
1618
[NMS(Index = 2)]
17-
/* 0x34 */ public int Level;
19+
/* 0x44 */ public int Level;
1820
[NMS(Index = 3)]
19-
/* 0x38 */ public int LevelledStatRank;
21+
/* 0x48 */ public int LevelledStatRank;
2022
[NMS(Index = 9)]
21-
/* 0x3C */ public TkEqualityEnum Test;
23+
/* 0x4C */ public TkEqualityEnum Test;
2224
[NMS(Index = 5)]
23-
/* 0x40 */ public bool ForceIgnoreLevelledStat;
25+
/* 0x50 */ public bool ForceIgnoreLevelledStat;
2426
[NMS(Index = 6)]
25-
/* 0x41 */ public bool MulAmountBySeasonTier;
27+
/* 0x51 */ public bool MulAmountBySeasonTier;
2628
[NMS(Index = 4)]
27-
/* 0x42 */ public bool TakeLevelFromSeasonData;
29+
/* 0x52 */ public bool TakeLevelFromSeasonData;
2830
}
2931
}

libMBIN/Source/NMS/GameComponents/GcMissionTable.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace libMBIN.NMS.GameComponents
55
{
6-
[NMS(GUID = 0xD0A9D7F4019B983D, NameHash = 0x4E2556EB)]
6+
[NMS(GUID = 0xC0F37F4F313F0B8D, NameHash = 0x4E2556EB)]
77
public class GcMissionTable : NMSTemplate
88
{
99
[NMS(Index = 0)]

libMBIN/Source/NMS/GameComponents/GcPlayerCommonStateData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace libMBIN.NMS.GameComponents
55
{
6-
[NMS(GUID = 0x4E2BF7822A5EF19C, NameHash = 0xC7D918F3)]
6+
[NMS(GUID = 0x4A21B3B24D86A472, NameHash = 0xC7D918F3)]
77
public class GcPlayerCommonStateData : NMSTemplate
88
{
99
[NMS(Index = 5)]

libMBIN/Source/NMS/GameComponents/GcScanEventData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace libMBIN.NMS.GameComponents
66
{
7-
[NMS(GUID = 0xEC28FD565252D1FD, NameHash = 0x37EE71BB)]
7+
[NMS(GUID = 0xA9034A06B133F687, NameHash = 0x37EE71BB)]
88
public class GcScanEventData : NMSTemplate
99
{
1010
[NMS(Index = 41)]

0 commit comments

Comments
 (0)