14
14
// You should have received a copy of the GNU General Public License
15
15
// along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
17
+ using System ;
17
18
using System . Collections . Generic ;
18
19
using System . IO ;
19
20
using System . Linq ;
@@ -97,16 +98,15 @@ await Task.Run(() => Parallel.ForEach(itemDictionary, (item) =>
97
98
// This checks whether there is any model data present in the current item
98
99
if ( item . Value [ modelDataCheckOffset ] <= 0 && item . Value [ modelDataCheckOffset + 1 ] <= 0 ) return ;
99
100
100
- // Gear can have 2 separate models (MNK weapons for example)
101
- var primaryMi = new XivModelInfo ( ) ;
102
- var secondaryMi = new XivModelInfo ( ) ;
101
+ var primaryMi = new XivGearModelInfo ( ) ;
102
+ var secondaryMi = new XivGearModelInfo ( ) ;
103
+ var hasSecondary = false ;
103
104
104
105
var xivGear = new XivGear
105
106
{
106
107
ExdID = item . Key ,
107
108
PrimaryCategory = XivStrings . Gear ,
108
109
ModelInfo = primaryMi ,
109
- SecondaryModelInfo = secondaryMi
110
110
} ;
111
111
112
112
/* Used to determine if the given model is a weapon
@@ -140,6 +140,7 @@ await Task.Run(() => Parallel.ForEach(itemDictionary, (item) =>
140
140
if ( weaponVariant != 0 )
141
141
{
142
142
primaryMi . ImcSubsetID = weaponVariant ;
143
+ primaryMi . IsWeapon = true ;
143
144
isWeapon = true ;
144
145
}
145
146
@@ -170,6 +171,7 @@ await Task.Run(() => Parallel.ForEach(itemDictionary, (item) =>
170
171
if ( weaponVariant != 0 )
171
172
{
172
173
secondaryMi . ImcSubsetID = weaponVariant ;
174
+ secondaryMi . IsWeapon = true ;
173
175
isWeapon = true ;
174
176
}
175
177
@@ -208,9 +210,29 @@ await Task.Run(() => Parallel.ForEach(itemDictionary, (item) =>
208
210
xivGear . Name = new string ( nameString . Where ( c => ! char . IsControl ( c ) ) . ToArray ( ) ) ;
209
211
xivGear . Name = xivGear . Name . Trim ( ) ;
210
212
213
+ // If we have a secondary model
214
+
215
+ XivGear secondaryItem = null ;
216
+ if ( secondaryMi . PrimaryID != 0 )
217
+ {
218
+ // Make a new item for it.
219
+ secondaryItem = ( XivGear ) xivGear . Clone ( ) ;
220
+ secondaryItem . ModelInfo = secondaryMi ;
221
+ xivGear . Name += " - " + XivStrings . Main_Hand ;
222
+ secondaryItem . Name += " - " + XivStrings . Off_Hand ;
223
+ xivGear . PairedItem = secondaryItem ;
224
+ secondaryItem . PairedItem = xivGear ;
225
+ xivGear . SecondaryCategory = XivStrings . Dual_Wield ;
226
+ secondaryItem . SecondaryCategory = XivStrings . Dual_Wield ;
227
+ }
228
+
211
229
lock ( _gearLock )
212
230
{
213
231
xivGearList . Add ( xivGear ) ;
232
+ if ( secondaryItem != null )
233
+ {
234
+ xivGearList . Add ( secondaryItem ) ;
235
+ }
214
236
}
215
237
}
216
238
} ) ) ;
@@ -233,7 +255,7 @@ private List<XivGear> GetMissingGear()
233
255
Name = "SmallClothes Body" ,
234
256
PrimaryCategory = XivStrings . Gear ,
235
257
SecondaryCategory = _slotNameDictionary [ 4 ] ,
236
- ModelInfo = new XivModelInfo { PrimaryID = 0 , ImcSubsetID = 1 , SecondaryID = 0 }
258
+ ModelInfo = new XivGearModelInfo { PrimaryID = 0 , ImcSubsetID = 1 , SecondaryID = 0 }
237
259
} ;
238
260
239
261
xivGearList . Add ( xivGear ) ;
@@ -243,7 +265,7 @@ private List<XivGear> GetMissingGear()
243
265
Name = "SmallClothes Hands" ,
244
266
PrimaryCategory = XivStrings . Gear ,
245
267
SecondaryCategory = _slotNameDictionary [ 5 ] ,
246
- ModelInfo = new XivModelInfo { PrimaryID = 0 , ImcSubsetID = 1 , SecondaryID = 0 }
268
+ ModelInfo = new XivGearModelInfo { PrimaryID = 0 , ImcSubsetID = 1 , SecondaryID = 0 }
247
269
} ;
248
270
249
271
xivGearList . Add ( xivGear ) ;
@@ -253,7 +275,7 @@ private List<XivGear> GetMissingGear()
253
275
Name = "SmallClothes Legs" ,
254
276
PrimaryCategory = XivStrings . Gear ,
255
277
SecondaryCategory = _slotNameDictionary [ 7 ] ,
256
- ModelInfo = new XivModelInfo { PrimaryID = 0 , ImcSubsetID = 1 , SecondaryID = 0 }
278
+ ModelInfo = new XivGearModelInfo { PrimaryID = 0 , ImcSubsetID = 1 , SecondaryID = 0 }
257
279
} ;
258
280
259
281
xivGearList . Add ( xivGear ) ;
@@ -263,7 +285,7 @@ private List<XivGear> GetMissingGear()
263
285
Name = "SmallClothes Feet" ,
264
286
PrimaryCategory = XivStrings . Gear ,
265
287
SecondaryCategory = _slotNameDictionary [ 8 ] ,
266
- ModelInfo = new XivModelInfo { PrimaryID = 0 , ImcSubsetID = 1 , SecondaryID = 0 }
288
+ ModelInfo = new XivGearModelInfo { PrimaryID = 0 , ImcSubsetID = 1 , SecondaryID = 0 }
267
289
} ;
268
290
269
291
xivGearList . Add ( xivGear ) ;
@@ -273,7 +295,7 @@ private List<XivGear> GetMissingGear()
273
295
Name = "SmallClothes Body (NPC)" ,
274
296
PrimaryCategory = XivStrings . Gear ,
275
297
SecondaryCategory = _slotNameDictionary [ 4 ] ,
276
- ModelInfo = new XivModelInfo { PrimaryID = 9903 , ImcSubsetID = 1 , SecondaryID = 0 }
298
+ ModelInfo = new XivGearModelInfo { PrimaryID = 9903 , ImcSubsetID = 1 , SecondaryID = 0 }
277
299
} ;
278
300
279
301
xivGearList . Add ( xivGear ) ;
@@ -283,7 +305,7 @@ private List<XivGear> GetMissingGear()
283
305
Name = "SmallClothes Hands (NPC)" ,
284
306
PrimaryCategory = XivStrings . Gear ,
285
307
SecondaryCategory = _slotNameDictionary [ 5 ] ,
286
- ModelInfo = new XivModelInfo { PrimaryID = 9903 , ImcSubsetID = 1 , SecondaryID = 0 }
308
+ ModelInfo = new XivGearModelInfo { PrimaryID = 9903 , ImcSubsetID = 1 , SecondaryID = 0 }
287
309
} ;
288
310
289
311
xivGearList . Add ( xivGear ) ;
@@ -293,7 +315,7 @@ private List<XivGear> GetMissingGear()
293
315
Name = "SmallClothes Legs (NPC)" ,
294
316
PrimaryCategory = XivStrings . Gear ,
295
317
SecondaryCategory = _slotNameDictionary [ 7 ] ,
296
- ModelInfo = new XivModelInfo { PrimaryID = 9903 , ImcSubsetID = 1 , SecondaryID = 0 }
318
+ ModelInfo = new XivGearModelInfo { PrimaryID = 9903 , ImcSubsetID = 1 , SecondaryID = 0 }
297
319
} ;
298
320
299
321
xivGearList . Add ( xivGear ) ;
@@ -303,7 +325,7 @@ private List<XivGear> GetMissingGear()
303
325
Name = "SmallClothes Feet (NPC)" ,
304
326
PrimaryCategory = XivStrings . Gear ,
305
327
SecondaryCategory = _slotNameDictionary [ 8 ] ,
306
- ModelInfo = new XivModelInfo { PrimaryID = 9903 , ImcSubsetID = 1 , SecondaryID = 0 }
328
+ ModelInfo = new XivGearModelInfo { PrimaryID = 9903 , ImcSubsetID = 1 , SecondaryID = 0 }
307
329
} ;
308
330
309
331
xivGearList . Add ( xivGear ) ;
@@ -313,7 +335,7 @@ private List<XivGear> GetMissingGear()
313
335
Name = "SmallClothes Feet 2 (NPC)" ,
314
336
PrimaryCategory = XivStrings . Gear ,
315
337
SecondaryCategory = _slotNameDictionary [ 8 ] ,
316
- ModelInfo = new XivModelInfo { PrimaryID = 9901 , ImcSubsetID = 1 , SecondaryID = 0 }
338
+ ModelInfo = new XivGearModelInfo { PrimaryID = 9901 , ImcSubsetID = 1 , SecondaryID = 0 }
317
339
} ;
318
340
319
341
xivGearList . Add ( xivGear ) ;
@@ -372,10 +394,10 @@ public async Task<List<XivRace>> GetRacesForTextures(XivGear xivGear, XivDataFil
372
394
switch ( itemType )
373
395
{
374
396
case XivItemType . equipment :
375
- mtrlFile = $ "mt_c{ ID } e{ modelID } _{ SlotAbbreviationDictionary [ xivGear . SecondaryCategory ] } _a.mtrl";
397
+ mtrlFile = $ "mt_c{ ID } e{ modelID } _{ xivGear . GetItemSlotAbbreviation ( ) } _a.mtrl";
376
398
break ;
377
399
case XivItemType . accessory :
378
- mtrlFile = $ "mt_c{ ID } a{ modelID } _{ SlotAbbreviationDictionary [ xivGear . SecondaryCategory ] } _a.mtrl";
400
+ mtrlFile = $ "mt_c{ ID } a{ modelID } _{ xivGear . GetItemSlotAbbreviation ( ) } _a.mtrl";
379
401
break ;
380
402
default :
381
403
mtrlFile = "" ;
@@ -451,10 +473,10 @@ public async Task<List<XivRace>> GetRacesForModels(XivGear xivGear, XivDataFile
451
473
switch ( itemType )
452
474
{
453
475
case XivItemType . equipment :
454
- mdlFile = $ "c{ ID } e{ modelID } _{ SlotAbbreviationDictionary [ xivGear . SecondaryCategory ] } .mdl";
476
+ mdlFile = $ "c{ ID } e{ modelID } _{ xivGear . GetItemSlotAbbreviation ( ) } .mdl";
455
477
break ;
456
478
case XivItemType . accessory :
457
- mdlFile = $ "c{ ID } a{ modelID } _{ SlotAbbreviationDictionary [ xivGear . SecondaryCategory ] } .mdl";
479
+ mdlFile = $ "c{ ID } a{ modelID } _{ xivGear . GetItemSlotAbbreviation ( ) } .mdl";
458
480
break ;
459
481
default :
460
482
mdlFile = "" ;
0 commit comments