Skip to content

Commit c508155

Browse files
committed
Beta 2.3.2.2
2 parents 075dddc + 7e0fc06 commit c508155

File tree

14 files changed

+559
-139
lines changed

14 files changed

+559
-139
lines changed

xivModdingFramework/Cache/XivDependencyGraph.cs

Lines changed: 14 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@ public enum XivDependencyFileType
132132
invalid,
133133
root,
134134
meta,
135-
eqp,
136-
eqdp,
137-
imc,
138135
mdl,
139136
mtrl,
140137
tex
@@ -787,16 +784,6 @@ public async Task<List<string>> GetImcEntryPaths()
787784
return imcEntries;
788785
}
789786

790-
private static readonly Dictionary<XivItemType, string> EqdpFolder= new Dictionary<XivItemType, string>()
791-
{
792-
{ XivItemType.equipment, "chara/xls/charadb/equipmentdeformerparameter/" },
793-
{ XivItemType.accessory, "chara/xls/charadb/accessorydeformerparameter/" }
794-
};
795-
796-
private static readonly Dictionary<XivItemType, string> EqpPaths = new Dictionary<XivItemType, string>()
797-
{
798-
{ XivItemType.equipment, "chara/xls/equipmentparameter/equipmentparameter.eqp" }
799-
};
800787

801788

802789

@@ -1010,7 +997,7 @@ internal static class XivDependencyGraph
1010997
*
1011998
*
1012999
* ROOT - [SET AND SLOT] - Theoretical/Just a number/prefix, no associated file.
1013-
* META - [EQP/EQDP/IMC] - Binary entries. - Not all of these entries are available for all types, but at least one always is.
1000+
* META - [META] - Binary entries.
10141001
* MODEL - [MDL] - Files for each racial model.
10151002
* MATERIAL - [MTRL] - Files for each Racial Model x Material Variant, roughly.
10161003
* TEXTURE - [TEX] - Files For each Material. May be used by multiple.
@@ -1044,7 +1031,7 @@ internal static class XivDependencyGraph
10441031
/// </summary>
10451032
public static readonly Dictionary<XivDependencyLevel, List<XivDependencyFileType>> DependencyLevelGroups = new Dictionary<XivDependencyLevel, List<XivDependencyFileType>>()
10461033
{
1047-
{ XivDependencyLevel.Root, new List<XivDependencyFileType>() { XivDependencyFileType.root, XivDependencyFileType.meta, XivDependencyFileType.eqp, XivDependencyFileType.eqdp, XivDependencyFileType.imc } },
1034+
{ XivDependencyLevel.Root, new List<XivDependencyFileType>() { XivDependencyFileType.root, XivDependencyFileType.meta } },
10481035
{ XivDependencyLevel.Model, new List<XivDependencyFileType>() { XivDependencyFileType.mdl } },
10491036
{ XivDependencyLevel.Material, new List<XivDependencyFileType>() { XivDependencyFileType.mtrl } },
10501037
{ XivDependencyLevel.Texture, new List<XivDependencyFileType>() { XivDependencyFileType.tex} },
@@ -1071,12 +1058,6 @@ internal static class XivDependencyGraph
10711058
// Captures the binary offset of a file.
10721059
private static readonly Regex _binaryOffsetRegex = new Regex(Constants.BinaryOffsetMarker + "([0-9]+)$");
10731060

1074-
// Regex for identifying EQP files and extracting the offset.
1075-
private static readonly Regex EqpRegex = new Regex("^chara\\/xls\\/equipmentparameter\\/equipmentparameter\\.eqp" + Constants.BinaryOffsetMarker + "([0-9]+)$");
1076-
1077-
// Regex for identifying EQDP files and extracting the type and offset.
1078-
private static readonly Regex EqdpRegex = new Regex("^chara\\/xls\\/charadb\\/(equipment|accessory)deformerparameter\\/c[0-9]{4}\\.eqdp" + Constants.BinaryOffsetMarker + "([0-9]+)$");
1079-
10801061
private static readonly Regex MtrlRegex = new Regex("^.*\\.mtrl$");
10811062

10821063
// Group 0 == Full File path
@@ -1303,19 +1284,6 @@ public static XivDependencyFileType GetDependencyFileType(string internalFilePat
13031284
return XivDependencyFileType.root;
13041285
case "meta":
13051286
return XivDependencyFileType.meta;
1306-
case "imc":
1307-
// Do not allow dependency crawling for meta files that do not have proper binary offsets.
1308-
if (!internalFilePath.Contains(Constants.BinaryOffsetMarker))
1309-
return XivDependencyFileType.invalid;
1310-
return XivDependencyFileType.imc;
1311-
case "eqp":
1312-
if (!internalFilePath.Contains(Constants.BinaryOffsetMarker))
1313-
return XivDependencyFileType.invalid;
1314-
return XivDependencyFileType.eqp;
1315-
case "eqdp":
1316-
if (!internalFilePath.Contains(Constants.BinaryOffsetMarker))
1317-
return XivDependencyFileType.invalid;
1318-
return XivDependencyFileType.eqdp;
13191287
case "mdl":
13201288
return XivDependencyFileType.mdl;
13211289
case "mtrl":
@@ -1559,106 +1527,33 @@ public static async Task<List<XivDependencyRoot>> GetDependencyRoots(string inte
15591527
{
15601528
var roots = new HashSet<XivDependencyRoot>();
15611529

1530+
1531+
// First root should always be the path-extracted root.
1532+
var info = ExtractRootInfo(internalFilePath);
1533+
var root = CreateDependencyRoot(info);
1534+
if(root != null)
1535+
{
1536+
roots.Add(root);
1537+
}
1538+
15621539
// Tex files require special handling, because they can be referenced by modded items
15631540
// outside of their own dependency chain potentially.
15641541
var match = _extensionRegex.Match(internalFilePath);
15651542
var suffix = "";
1566-
if(match.Success)
1543+
if (match.Success)
15671544
{
15681545
suffix = match.Groups[1].Value;
15691546
}
1570-
if(suffix == "tex")
1547+
if (suffix == "tex")
15711548
{
15721549
// Oh boy. Here we have to scrape the cache to find any custom modded roots(plural) we may have.
15731550
var customRoots = await GetModdedRoots(internalFilePath);
1574-
foreach(var r in customRoots)
1551+
foreach (var r in customRoots)
15751552
{
15761553
roots.Add(r);
15771554
}
15781555
}
15791556

1580-
var info = ExtractRootInfo(internalFilePath);
1581-
var root = CreateDependencyRoot(info);
1582-
if(root != null)
1583-
{
1584-
roots.Add(root);
1585-
}
1586-
1587-
1588-
if(roots.Count == 0)
1589-
{
1590-
// See if this is a binary offset file.
1591-
match = _binaryOffsetRegex.Match(internalFilePath);
1592-
if(match.Success)
1593-
{
1594-
long offset = Int64.Parse(match.Groups[1].Value);
1595-
1596-
if (suffix == "imc")
1597-
{
1598-
// IMCs mostly parse out correctly above, but need to have slot information pulled from their binary offset.
1599-
const int ImcHeaderSize = 4;
1600-
const int ImcSubEntrySize = 6;
1601-
const int IMcFullEntrySize = 30;
1602-
1603-
offset /= 8;
1604-
offset -= ImcHeaderSize;
1605-
offset = offset % IMcFullEntrySize;
1606-
var index = offset / ImcSubEntrySize;
1607-
if (info.PrimaryType == XivItemType.equipment || info.PrimaryType == XivItemType.demihuman)
1608-
{
1609-
info.Slot = Imc.EquipmentSlotOffsetDictionary.First(x => x.Value == index).Key;
1610-
}
1611-
else // accesory
1612-
{
1613-
info.Slot = Imc.AccessorySlotOffsetDictionary.First(x => x.Value == index).Key;
1614-
}
1615-
1616-
root = CreateDependencyRoot(info);
1617-
if (root != null)
1618-
{
1619-
roots.Add(root);
1620-
}
1621-
}
1622-
else if (suffix == "eqp")
1623-
{
1624-
var entrySize = Eqp.EquipmentParameterEntrySize * 8;
1625-
var setId = (int)(offset / entrySize);
1626-
1627-
var subOffset = (offset % entrySize) / 8;
1628-
var slot = EquipmentParameterSet.EntryOffsets.First(x => x.Value == subOffset).Key;
1629-
1630-
root = CreateDependencyRoot(XivItemType.equipment, setId, null, null, slot);
1631-
if (root != null)
1632-
{
1633-
roots.Add(root);
1634-
}
1635-
1636-
} else if(suffix == "eqdp")
1637-
{
1638-
// For EQDPs, this is 16 bits per set, then within that, we can determine the slot based on the offset internally within the full set.
1639-
match = EqdpRegex.Match(internalFilePath);
1640-
if (match.Success)
1641-
{
1642-
var type = (XivItemType)Enum.Parse(typeof(XivItemType), match.Groups[1].Value);
1643-
var entrySize = Eqp.EquipmentDeformerParameterEntrySize * 8;
1644-
var setId = (int)(offset / entrySize);
1645-
1646-
1647-
var slotOffset = offset % entrySize;
1648-
var slotIndex = (int)(slotOffset / 2); // 2 Bits per slot.
1649-
1650-
var slots = EquipmentDeformationParameterSet.SlotsAsList(type == XivItemType.accessory);
1651-
var slot = slots[slotIndex];
1652-
1653-
// Ok, now we have everything we need to create the root object.
1654-
return new List<XivDependencyRoot>() { CreateDependencyRoot(type, setId, null, null, slot) };
1655-
1656-
}
1657-
1658-
}
1659-
1660-
}
1661-
}
16621557

16631558
return roots.ToList();
16641559
}

xivModdingFramework/Items/DataContainers/XivCharacter.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,23 @@ internal static IItemModel FromDependencyRoot(XivDependencyRoot root)
9494
return item;
9595
}
9696

97+
/// <summary>
98+
/// Gets the item's name as it should be written to the modlist/modpack files.
99+
/// </summary>
100+
/// <returns></returns>
101+
public string GetModlistItemName()
102+
{
103+
return SecondaryCategory != null ? SecondaryCategory : "Unknown";
104+
}
105+
106+
/// <summary>
107+
/// Gets the item's category as it should be written to the modlist/modpack files.
108+
/// </summary>
109+
/// <returns></returns>
110+
public string GetModlistItemCategory()
111+
{
112+
return XivStrings.Character;
113+
}
97114

98115
public int CompareTo(object obj)
99116
{

xivModdingFramework/Items/DataContainers/XivFurniture.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,24 @@ internal static IItemModel FromDependencyRoot(XivDependencyRoot root)
8787
return item;
8888
}
8989

90+
/// <summary>
91+
/// Gets the item's name as it should be written to the modlist/modpack files.
92+
/// </summary>
93+
/// <returns></returns>
94+
public string GetModlistItemName()
95+
{
96+
return Name != null ? Name : "Unknown Furniture";
97+
}
98+
99+
/// <summary>
100+
/// Gets the item's category as it should be written to the modlist/modpack files.
101+
/// </summary>
102+
/// <returns></returns>
103+
public string GetModlistItemCategory()
104+
{
105+
return SecondaryCategory != null ? SecondaryCategory : XivStrings.Housing;
106+
}
107+
90108
public int CompareTo(object obj)
91109
{
92110
return string.Compare(Name, ((XivFurniture)obj).Name, StringComparison.Ordinal);

xivModdingFramework/Items/DataContainers/XivGear.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,23 @@ public class XivGear : IItemModel
9292
/// </summary>
9393
public XivGear PairedItem { get; set; }
9494

95+
/// <summary>
96+
/// Gets the item's name as it should be written to the modlist/modpack files.
97+
/// </summary>
98+
/// <returns></returns>
99+
public string GetModlistItemName()
100+
{
101+
return Name != null ? Name : "Unknown Gear";
102+
}
103+
104+
/// <summary>
105+
/// Gets the item's category as it should be written to the modlist/modpack files.
106+
/// </summary>
107+
/// <returns></returns>
108+
public string GetModlistItemCategory()
109+
{
110+
return SecondaryCategory != null ? SecondaryCategory : XivStrings.Gear;
111+
}
95112
internal static IItemModel FromDependencyRoot(XivDependencyRoot root, int imcSubset)
96113
{
97114
var item = new XivGear();

xivModdingFramework/Items/DataContainers/XivGenericItemModel.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,23 @@ public class XivGenericItemModel : IItemModel
5757
/// </summary>
5858
public XivModelInfo ModelInfo { get; set; }
5959

60+
/// <summary>
61+
/// Gets the item's name as it should be written to the modlist/modpack files.
62+
/// </summary>
63+
/// <returns></returns>
64+
public string GetModlistItemName()
65+
{
66+
return Name != null ? Name : "Unknown Item";
67+
}
68+
69+
/// <summary>
70+
/// Gets the item's category as it should be written to the modlist/modpack files.
71+
/// </summary>
72+
/// <returns></returns>
73+
public string GetModlistItemCategory()
74+
{
75+
return SecondaryCategory != null ? SecondaryCategory : "Unknown";
76+
}
6077
internal static IItemModel FromDependencyRoot(XivDependencyRoot root, int imcSubset)
6178
{
6279
var item = new XivGenericItemModel();

xivModdingFramework/Items/DataContainers/XivMinion.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
using System;
1818
using xivModdingFramework.General.Enums;
1919
using xivModdingFramework.Items.Interfaces;
20+
using xivModdingFramework.Resources;
2021

2122
namespace xivModdingFramework.Items.DataContainers
2223
{
@@ -67,6 +68,23 @@ public class XivMinion : IItemModel
6768
/// </summary>
6869
public XivModelInfo ModelInfo { get; set; }
6970

71+
/// <summary>
72+
/// Gets the item's name as it should be written to the modlist/modpack files.
73+
/// </summary>
74+
/// <returns></returns>
75+
public string GetModlistItemName()
76+
{
77+
return Name != null ? Name : "Unknown Minion";
78+
}
79+
80+
/// <summary>
81+
/// Gets the item's category as it should be written to the modlist/modpack files.
82+
/// </summary>
83+
/// <returns></returns>
84+
public string GetModlistItemCategory()
85+
{
86+
return SecondaryCategory != null ? SecondaryCategory : XivStrings.Minions;
87+
}
7088
public int CompareTo(object obj)
7189
{
7290
return string.Compare(Name, ((XivMinion)obj).Name, StringComparison.Ordinal);

xivModdingFramework/Items/DataContainers/XivMount.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,23 @@ public class XivMount : IItemModel
7171
/// </summary>
7272
public XivModelInfo ModelInfo { get; set; }
7373

74+
/// <summary>
75+
/// Gets the item's name as it should be written to the modlist/modpack files.
76+
/// </summary>
77+
/// <returns></returns>
78+
public string GetModlistItemName()
79+
{
80+
return Name != null ? Name : "Unknown Mount";
81+
}
82+
83+
/// <summary>
84+
/// Gets the item's category as it should be written to the modlist/modpack files.
85+
/// </summary>
86+
/// <returns></returns>
87+
public string GetModlistItemCategory()
88+
{
89+
return SecondaryCategory != null ? SecondaryCategory : XivStrings.Mounts;
90+
}
7491
internal static IItemModel FromDependencyRoot(XivDependencyRoot root, int imcSubset)
7592
{
7693
var item = new XivMount();

xivModdingFramework/Items/DataContainers/XivPet.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
using System;
1818
using xivModdingFramework.General.Enums;
1919
using xivModdingFramework.Items.Interfaces;
20+
using xivModdingFramework.Resources;
2021

2122
namespace xivModdingFramework.Items.DataContainers
2223
{
@@ -67,6 +68,23 @@ public class XivPet : IItemModel
6768
/// </summary>
6869
public XivModelInfo ModelInfo { get; set; }
6970

71+
/// <summary>
72+
/// Gets the item's name as it should be written to the modlist/modpack files.
73+
/// </summary>
74+
/// <returns></returns>
75+
public string GetModlistItemName()
76+
{
77+
return Name != null ? Name : "Unknown Pet";
78+
}
79+
80+
/// <summary>
81+
/// Gets the item's category as it should be written to the modlist/modpack files.
82+
/// </summary>
83+
/// <returns></returns>
84+
public string GetModlistItemCategory()
85+
{
86+
return SecondaryCategory != null ? SecondaryCategory : XivStrings.Pets;
87+
}
7088
public int CompareTo(object obj)
7189
{
7290
return string.Compare(Name, ((XivPet)obj).Name, StringComparison.Ordinal);

0 commit comments

Comments
 (0)