Skip to content

Commit d896155

Browse files
committed
include additional skin component information on unlocks
1 parent 8b9bb1f commit d896155

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

DataTool/DataModels/Unlock.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ public class Unlock {
5656
/// </summary>
5757
public teResourceGUID SkinThemeGUID { get; set; }
5858

59+
/// <summary>
60+
/// If the unlock is a skin component (mythic skin customization option), the GUID of the parent skin unlock
61+
/// </summary>
62+
public teResourceGUID ParentUnlockGUID { get; set; }
63+
5964
/// <summary>
6065
/// If the Unlock is a Hero, the GUID of the Hero
6166
/// </summary>
@@ -98,6 +103,7 @@ public class Unlock {
98103
public bool ShouldSerializeEsportsTeam() => IsEsportsUnlock;
99104
public bool ShouldSerializeAmount() => Amount != null;
100105
public bool ShouldSerializeHero() => Hero != null;
106+
public bool ShouldSerializeParentUnlockGUID() => ParentUnlockGUID != 0;
101107

102108
// These only really apply to "normal" unlocks and can be removed from others
103109
public bool ShouldSerializeAvailableIn() => IsTraditionalUnlock;
@@ -183,6 +189,22 @@ private void Init(STU_3021DDED? unlock, ulong key) {
183189
EsportsTeam = teamDefinition.FullName;
184190
}
185191
}
192+
193+
// skin components (mythic customization options)
194+
if (Type == UnlockType.SkinComponent && unlock is STU_3F17D547 skinComponent) {
195+
var skinUnlock = GetInstance<STUUnlock_SkinTheme>(skinComponent.m_E2A492C7);
196+
ParentUnlockGUID = skinComponent.m_E2A492C7;
197+
198+
var parentName = GetString(skinUnlock?.m_name);
199+
var skinTheme = GetInstance<STU_EF85B312>(skinUnlock?.m_skinTheme);
200+
var slot = skinTheme?.m_942A6CCA?.FirstOrDefault(x => x.m_id.GUID == skinComponent.m_slot.GUID);
201+
var itemIndex = slot?.m_57CE9041?.ToList().FindIndex(x => x.m_id.GUID == skinComponent.m_4EC40A19.GUID);
202+
203+
// overrides the name of the unlock, only override if the name is null or the same as the parent
204+
if (itemIndex != null && (Name == null || Name == parentName)) {
205+
Name = $"{GetString(slot?.m_displayText) ?? "Unknown"} {itemIndex + 1}";
206+
}
207+
}
186208
}
187209

188210
public string GetName() {

0 commit comments

Comments
 (0)