@@ -278,6 +278,22 @@ public string GetRacialModelName(XivRace race)
278
278
{
279
279
return GetRacialModelName ( Int32 . Parse ( XivRaces . GetRaceCode ( race ) ) ) ;
280
280
}
281
+
282
+ /// <summary>
283
+ /// Calculates and returns the SGD file name for this root.
284
+ /// </summary>
285
+ /// <returns></returns>
286
+ public string GetSgdName ( )
287
+ {
288
+ if ( PrimaryType != XivItemType . indoor && PrimaryType != XivItemType . outdoor )
289
+ {
290
+ throw new NotSupportedException ( "Cannot get SGB File for Non-Furniture item type." ) ;
291
+ }
292
+
293
+ var assetFile = $ "{ Slot } _b0_m{ PrimaryId . ToString ( ) . PadLeft ( 4 , '0' ) } .sgb";
294
+ return assetFile ;
295
+ }
296
+
281
297
public string GetRacialModelName ( int raceRaw )
282
298
{
283
299
if ( SecondaryType != null )
@@ -1592,29 +1608,48 @@ await Task.Run(() => {
1592
1608
1593
1609
if ( secondary == XivItemType . none )
1594
1610
{
1595
- var folder = root . GetRootFolder ( ) + "model" ;
1596
- var folderHash = HashGenerator . GetHash ( folder ) ;
1597
- var slots = XivItemTypes . GetAvailableSlots ( root . PrimaryType ) ;
1611
+ if ( primary == XivItemType . indoor || primary == XivItemType . outdoor )
1612
+ {
1613
+ // For furniture, they're valid as long as they have an SGD file we can find.
1614
+ root . Slot = primary == XivItemType . indoor ? "fun" : "gar" ;
1615
+
1616
+ var folder = root . GetRootFolder ( ) + "asset" ;
1617
+ var file = root . GetSgdName ( ) ;
1598
1618
1599
- // For these, just let the EDP module verify if there are any races availble for the item?
1600
- foreach ( var slot in slots )
1619
+ var folderHash = HashGenerator . GetHash ( folder ) ;
1620
+ var fileHash = HashGenerator . GetHash ( file ) ;
1621
+ var key = fileHash . ToString ( ) + folderHash . ToString ( ) ;
1622
+ if ( combinedHashes . ContainsKey ( key ) )
1623
+ {
1624
+ result . Add ( ( XivDependencyRootInfo ) root . Clone ( ) ) ;
1625
+ }
1626
+ }
1627
+ else
1601
1628
{
1602
- root . Slot = slot ;
1629
+ var folder = root . GetRootFolder ( ) + "model" ;
1630
+ var folderHash = HashGenerator . GetHash ( folder ) ;
1631
+ var slots = XivItemTypes . GetAvailableSlots ( root . PrimaryType ) ;
1603
1632
1604
- // Check every possible race code, not just playables?
1605
- //for (int s = 0; s < 10000; p++)
1606
- foreach ( var race in races )
1633
+ // For these, just let the EDP module verify if there are any races availble for the item?
1634
+ foreach ( var slot in slots )
1607
1635
{
1608
- //var modelName = root.GetRacialModelName(s);
1609
- var modelName = root . GetRacialModelName ( race ) ;
1610
- var fileHash = HashGenerator . GetHash ( modelName ) ;
1611
- var key = fileHash . ToString ( ) + folderHash . ToString ( ) ;
1612
- if ( combinedHashes . ContainsKey ( key ) )
1613
- {
1614
- result . Add ( ( XivDependencyRootInfo ) root . Clone ( ) ) ;
1636
+ root . Slot = slot ;
1615
1637
1616
- // We don't care how many models there are, just that there *are* any models.
1617
- break ;
1638
+ // Check every possible race code, not just playables?
1639
+ //for (int s = 0; s < 10000; p++)
1640
+ foreach ( var race in races )
1641
+ {
1642
+ //var modelName = root.GetRacialModelName(s);
1643
+ var modelName = root . GetRacialModelName ( race ) ;
1644
+ var fileHash = HashGenerator . GetHash ( modelName ) ;
1645
+ var key = fileHash . ToString ( ) + folderHash . ToString ( ) ;
1646
+ if ( combinedHashes . ContainsKey ( key ) )
1647
+ {
1648
+ result . Add ( ( XivDependencyRootInfo ) root . Clone ( ) ) ;
1649
+
1650
+ // We don't care how many models there are, just that there *are* any models.
1651
+ break ;
1652
+ }
1618
1653
}
1619
1654
}
1620
1655
}
@@ -1634,13 +1669,6 @@ await Task.Run(() => {
1634
1669
slots = XivItemTypes . GetAvailableSlots ( XivItemType . equipment ) ;
1635
1670
}
1636
1671
1637
- // For these, just let the EDP module verify if there are any races availble for the item?
1638
-
1639
- if ( root . PrimaryId == 201 && root . SecondaryId == 56 && root . PrimaryType == XivItemType . weapon )
1640
- {
1641
- var z = "d" ;
1642
- }
1643
-
1644
1672
if ( slots . Count == 0 )
1645
1673
{
1646
1674
slots . Add ( "" ) ;
@@ -1695,6 +1723,13 @@ public static async Task CacheAllRealRoots()
1695
1723
mergedDict . Add ( kv . Key , new XivDependencyRootInfo ( ) ) ;
1696
1724
}
1697
1725
1726
+ var bgcHashes = await index . GetFileDictionary ( XivDataFile . _01_Bgcommon ) ;
1727
+
1728
+ var bgcHashDict = new Dictionary < string , XivDependencyRootInfo > ( ) ;
1729
+ foreach ( var kv in bgcHashes )
1730
+ {
1731
+ bgcHashDict . Add ( kv . Key , new XivDependencyRootInfo ( ) ) ;
1732
+ }
1698
1733
1699
1734
var types = new Dictionary < XivItemType , List < XivItemType > > ( ) ;
1700
1735
foreach ( var type in DependencySupportedTypes )
@@ -1711,6 +1746,8 @@ public static async Task CacheAllRealRoots()
1711
1746
types [ XivItemType . demihuman ] . Add ( XivItemType . equipment ) ;
1712
1747
types [ XivItemType . equipment ] . Add ( XivItemType . none ) ;
1713
1748
types [ XivItemType . accessory ] . Add ( XivItemType . none ) ;
1749
+ types [ XivItemType . indoor ] . Add ( XivItemType . none ) ;
1750
+ types [ XivItemType . outdoor ] . Add ( XivItemType . none ) ;
1714
1751
1715
1752
1716
1753
@@ -1720,10 +1757,14 @@ public static async Task CacheAllRealRoots()
1720
1757
var primary = kv . Key ;
1721
1758
foreach ( var secondary in kv . Value )
1722
1759
{
1723
- // Apparently despite all documentation, Dictionary.HasKey() is not actually
1724
- // thread safe? Or at least, we'll hit random failures to find dictionary keys if
1725
- // we don't clone the dictionary here. Unsure why.
1726
- tasks . Add ( TestAllRoots ( mergedDict , primary , secondary ) ) ;
1760
+ if ( primary == XivItemType . indoor || primary == XivItemType . outdoor )
1761
+ {
1762
+ tasks . Add ( TestAllRoots ( bgcHashDict , primary , secondary ) ) ;
1763
+ }
1764
+ else
1765
+ {
1766
+ tasks . Add ( TestAllRoots ( mergedDict , primary , secondary ) ) ;
1767
+ }
1727
1768
}
1728
1769
}
1729
1770
try
0 commit comments