@@ -147,6 +147,32 @@ public class LootLockerCatalogEntryListings
147
147
public LootLockerCatalogSteamStoreListing steam_store { get ; set ; }
148
148
}
149
149
150
+ /// <summary>
151
+ /// Class to help simply getting item details
152
+ /// </summary>
153
+ public class LootLockerItemDetailsKey
154
+ {
155
+ /// <summary>
156
+ /// The id of a catalog listing
157
+ /// </summary>
158
+ public string catalog_listing_id { get ; set ; }
159
+ /// <summary>
160
+ /// The id of the item
161
+ /// </summary>
162
+ public string item_id { get ; set ; }
163
+
164
+ public override int GetHashCode ( )
165
+ {
166
+ return catalog_listing_id . GetHashCode ( ) + item_id . GetHashCode ( ) ;
167
+ }
168
+
169
+ public override bool Equals ( object obj )
170
+ {
171
+ return obj . GetHashCode ( ) == GetHashCode ( ) ;
172
+ }
173
+
174
+ }
175
+
150
176
/// <summary>
151
177
/// </summary>
152
178
public class LootLockerCatalogEntry
@@ -183,6 +209,15 @@ public class LootLockerCatalogEntry
183
209
/// Whether this entry is currently purchasable
184
210
/// </summary>
185
211
public bool purchasable { get ; set ; }
212
+ /// <summary>
213
+ /// Function to help identify details simpler
214
+ /// </summary>
215
+ /// <returns>The identifier for looking up details</returns>
216
+ public LootLockerItemDetailsKey GetItemDetailsKey ( )
217
+ {
218
+ return new LootLockerItemDetailsKey { catalog_listing_id = catalog_listing_id , item_id = entity_id } ;
219
+ }
220
+
186
221
}
187
222
188
223
/// <summary>
@@ -217,7 +252,14 @@ public class LootLockerAssetDetails
217
252
/// The catalog listing id for this asset detail
218
253
/// </summary>
219
254
public string catalog_listing_id { get ; set ; }
220
-
255
+ /// <summary>
256
+ /// Function to help identify details simpler
257
+ /// </summary>
258
+ /// <returns>The identifier for looking up details</returns>
259
+ public LootLockerItemDetailsKey GetItemDetailsKey ( )
260
+ {
261
+ return new LootLockerItemDetailsKey { catalog_listing_id = catalog_listing_id , item_id = id } ;
262
+ }
221
263
}
222
264
223
265
/// <summary>
@@ -244,6 +286,14 @@ public class LootLockerProgressionPointDetails
244
286
/// The catalog listing id for this progression point detail
245
287
/// </summary>
246
288
public string catalog_listing_id { get ; set ; }
289
+ /// <summary>
290
+ /// Function to help identify details simpler
291
+ /// </summary>
292
+ /// <returns>The identifier for looking up details</returns>
293
+ public LootLockerItemDetailsKey GetItemDetailsKey ( )
294
+ {
295
+ return new LootLockerItemDetailsKey { catalog_listing_id = catalog_listing_id , item_id = id } ;
296
+ }
247
297
}
248
298
249
299
/// <summary>
@@ -266,6 +316,14 @@ public class LootLockerProgressionResetDetails
266
316
/// The catalog listing id for this progression reset detail
267
317
/// </summary>
268
318
public string catalog_listing_id { get ; set ; }
319
+ /// <summary>
320
+ /// Function to help identify details simpler
321
+ /// </summary>
322
+ /// <returns>The identifier for looking up details</returns>
323
+ public LootLockerItemDetailsKey GetItemDetailsKey ( )
324
+ {
325
+ return new LootLockerItemDetailsKey { catalog_listing_id = catalog_listing_id , item_id = id } ;
326
+ }
269
327
}
270
328
271
329
/// <summary>
@@ -292,9 +350,17 @@ public class LootLockerCurrencyDetails
292
350
/// The catalog listing id for this currency detail
293
351
/// </summary>
294
352
public string catalog_listing_id { get ; set ; }
353
+ /// <summary>
354
+ /// Function to help identify details simpler
355
+ /// </summary>
356
+ /// <returns>The identifier for looking up details</returns>
357
+ public LootLockerItemDetailsKey GetItemDetailsKey ( )
358
+ {
359
+ return new LootLockerItemDetailsKey { catalog_listing_id = catalog_listing_id , item_id = id } ;
360
+ }
295
361
}
296
362
297
- public class LootLockerGroupAssociations
363
+ public class LootLockerGroupAssociation
298
364
{
299
365
/// <summary>
300
366
/// The kind of reward, (asset / currency / group / progression points / progression reset).
@@ -308,6 +374,14 @@ public class LootLockerGroupAssociations
308
374
/// The catalog listing id for this group detail.
309
375
/// </summary>
310
376
public string catalog_listing_id { get ; set ; }
377
+ /// <summary>
378
+ /// Function to help identify details simpler
379
+ /// </summary>
380
+ /// <returns>The identifier for looking up details</returns>
381
+ public LootLockerItemDetailsKey GetItemDetailsKey ( )
382
+ {
383
+ return new LootLockerItemDetailsKey { catalog_listing_id = catalog_listing_id , item_id = id } ;
384
+ }
311
385
}
312
386
313
387
public class LootLockerGroupMetadata
@@ -343,7 +417,7 @@ public class LootLockerGroupDetails
343
417
/// <summary>
344
418
/// Associations for the Group reward.
345
419
/// </summary>
346
- public LootLockerGroupAssociations [ ] associations { get ; set ; }
420
+ public LootLockerGroupAssociation [ ] associations { get ; set ; }
347
421
348
422
}
349
423
@@ -378,12 +452,12 @@ public class LootLockerListCatalogPricesResponse : LootLockerResponse
378
452
/// <summary>
379
453
/// Lookup map for details about entities of entity type assets
380
454
/// </summary>
381
- public Dictionary < string /*catalog_listing_id*/ , LootLockerAssetDetails > asset_details { get ; set ; }
455
+ public Dictionary < LootLockerItemDetailsKey , LootLockerAssetDetails > asset_details { get ; set ; }
382
456
383
457
/// <summary>
384
458
/// Lookup map for details about entities of entity type progression_points
385
459
/// </summary>
386
- public Dictionary < string /*catalog_listing_id*/ , LootLockerProgressionPointDetails > progression_points_details
460
+ public Dictionary < LootLockerItemDetailsKey , LootLockerProgressionPointDetails > progression_points_details
387
461
{
388
462
get ;
389
463
set ;
@@ -392,7 +466,7 @@ public class LootLockerListCatalogPricesResponse : LootLockerResponse
392
466
/// <summary>
393
467
/// Lookup map for details about entities of entity type progression_reset
394
468
/// </summary>
395
- public Dictionary < string /*catalog_listing_id*/ , LootLockerProgressionResetDetails > progression_resets_details
469
+ public Dictionary < LootLockerItemDetailsKey , LootLockerProgressionResetDetails > progression_resets_details
396
470
{
397
471
get ;
398
472
set ;
@@ -401,9 +475,9 @@ public class LootLockerListCatalogPricesResponse : LootLockerResponse
401
475
/// <summary>
402
476
/// Lookup map for details about entities of entity type currency
403
477
/// </summary>
404
- public Dictionary < string /*catalog_listing_id*/ , LootLockerCurrencyDetails > currency_details { get ; set ; }
478
+ public Dictionary < LootLockerItemDetailsKey , LootLockerCurrencyDetails > currency_details { get ; set ; }
405
479
406
- public Dictionary < string /*catalog_listing_id*/ , LootLockerGroupDetails > group_details { get ; set ; }
480
+ public Dictionary < LootLockerItemDetailsKey , LootLockerGroupDetails > group_details { get ; set ; }
407
481
408
482
/// <summary>
409
483
/// Pagination data to use for subsequent requests
@@ -437,6 +511,12 @@ public void AppendCatalogItems(LootLockerListCatalogPricesResponse catalogPrices
437
511
{
438
512
currency_details . Add ( currencyDetail . Key , currencyDetail . Value ) ;
439
513
}
514
+
515
+ foreach ( var groupDetail in catalogPrices . group_details )
516
+ {
517
+ group_details . Add ( groupDetail . Key , groupDetail . Value ) ;
518
+ }
519
+
440
520
}
441
521
442
522
public LootLockerListCatalogPricesResponse ( ) { }
@@ -471,54 +551,55 @@ public LootLockerListCatalogPricesResponse(LootLockerResponse serverResponse)
471
551
entries = parsedResponse . entries ;
472
552
pagination = parsedResponse . pagination ;
473
553
474
-
475
554
if ( parsedResponse . assets_details != null && parsedResponse . assets_details . Length > 0 )
476
555
{
477
- asset_details = new Dictionary < string , LootLockerAssetDetails > ( ) ;
478
- foreach ( var assetDetail in parsedResponse . assets_details )
556
+ asset_details = new Dictionary < LootLockerItemDetailsKey , LootLockerAssetDetails > ( ) ;
557
+ foreach ( var detail in parsedResponse . assets_details )
479
558
{
480
- asset_details [ assetDetail . catalog_listing_id ] = assetDetail ;
559
+ asset_details [ detail . GetItemDetailsKey ( ) ] = detail ;
481
560
}
482
561
}
483
562
484
563
if ( parsedResponse . progression_points_details != null &&
485
564
parsedResponse . progression_points_details . Length > 0 )
486
565
{
487
- progression_points_details = new Dictionary < string , LootLockerProgressionPointDetails > ( ) ;
566
+ progression_points_details = new Dictionary < LootLockerItemDetailsKey , LootLockerProgressionPointDetails > ( ) ;
488
567
foreach ( var detail in parsedResponse . progression_points_details )
489
568
{
490
- progression_points_details [ detail . catalog_listing_id ] = detail ;
569
+ progression_points_details [ detail . GetItemDetailsKey ( ) ] = detail ;
491
570
}
492
571
}
493
572
494
573
if ( parsedResponse . progression_resets_details != null &&
495
574
parsedResponse . progression_resets_details . Length > 0 )
496
575
{
497
- progression_resets_details = new Dictionary < string , LootLockerProgressionResetDetails > ( ) ;
576
+ progression_resets_details = new Dictionary < LootLockerItemDetailsKey , LootLockerProgressionResetDetails > ( ) ;
498
577
foreach ( var detail in parsedResponse . progression_resets_details )
499
578
{
500
- progression_resets_details [ detail . catalog_listing_id ] = detail ;
579
+ progression_resets_details [ detail . GetItemDetailsKey ( ) ] = detail ;
501
580
}
502
581
}
503
582
504
583
if ( parsedResponse . currency_details != null && parsedResponse . currency_details . Length > 0 )
505
584
{
506
- currency_details = new Dictionary < string , LootLockerCurrencyDetails > ( ) ;
585
+ currency_details = new Dictionary < LootLockerItemDetailsKey , LootLockerCurrencyDetails > ( ) ;
507
586
foreach ( var detail in parsedResponse . currency_details )
508
587
{
509
- currency_details [ detail . catalog_listing_id ] = detail ;
588
+ currency_details [ detail . GetItemDetailsKey ( ) ] = detail ;
510
589
}
511
590
}
512
591
513
592
if ( parsedResponse . group_details != null && parsedResponse . group_details . Length > 0 )
514
593
{
515
- group_details = new Dictionary < string , LootLockerGroupDetails > ( ) ;
594
+ group_details = new Dictionary < LootLockerItemDetailsKey , LootLockerGroupDetails > ( ) ;
516
595
foreach ( var detail in parsedResponse . group_details )
517
596
{
518
- group_details [ detail . id ] = detail ;
597
+ foreach ( var association in detail . associations )
598
+ {
599
+ group_details [ association . GetItemDetailsKey ( ) ] = detail ;
600
+ }
519
601
}
520
602
}
521
-
522
603
}
523
604
524
605
#if UNITY_2020_2_OR_NEWER
@@ -575,15 +656,16 @@ public LootLockerInlinedCatalogEntry[] GetLootLockerInlinedCatalogEntries()
575
656
List < LootLockerInlinedCatalogEntry > inlinedEntries = new List < LootLockerInlinedCatalogEntry > ( ) ;
576
657
foreach ( var lootLockerCatalogEntry in entries )
577
658
{
578
- var catalogListingID = lootLockerCatalogEntry . catalog_listing_id ;
659
+
660
+ var itemDetailKey = lootLockerCatalogEntry . GetItemDetailsKey ( ) ;
579
661
var entityKind = lootLockerCatalogEntry . entity_kind ;
580
662
inlinedEntries . Add ( new LootLockerInlinedCatalogEntry (
581
663
lootLockerCatalogEntry ,
582
- LootLockerCatalogEntryEntityKind . asset == entityKind && asset_details . ContainsKey ( catalogListingID ) ? asset_details [ catalogListingID ] : null ,
583
- LootLockerCatalogEntryEntityKind . progression_points == entityKind && progression_points_details . ContainsKey ( catalogListingID ) ? progression_points_details [ catalogListingID ] : null ,
584
- LootLockerCatalogEntryEntityKind . progression_reset == entityKind && progression_resets_details . ContainsKey ( catalogListingID ) ? progression_resets_details [ catalogListingID ] : null ,
585
- LootLockerCatalogEntryEntityKind . currency == entityKind && currency_details . ContainsKey ( catalogListingID ) ? currency_details [ catalogListingID ] : null ,
586
- LootLockerCatalogEntryEntityKind . group == entityKind && group_details . ContainsKey ( catalogListingID ) ? group_details [ catalogListingID ] : null
664
+ LootLockerCatalogEntryEntityKind . asset == entityKind && asset_details . ContainsKey ( itemDetailKey ) ? asset_details [ itemDetailKey ] : null ,
665
+ LootLockerCatalogEntryEntityKind . progression_points == entityKind && progression_points_details . ContainsKey ( itemDetailKey ) ? progression_points_details [ itemDetailKey ] : null ,
666
+ LootLockerCatalogEntryEntityKind . progression_reset == entityKind && progression_resets_details . ContainsKey ( itemDetailKey ) ? progression_resets_details [ itemDetailKey ] : null ,
667
+ LootLockerCatalogEntryEntityKind . currency == entityKind && currency_details . ContainsKey ( itemDetailKey ) ? currency_details [ itemDetailKey ] : null ,
668
+ LootLockerCatalogEntryEntityKind . group == entityKind && group_details . ContainsKey ( itemDetailKey ) ? group_details [ itemDetailKey ] : null
587
669
) ) ;
588
670
}
589
671
return inlinedEntries . ToArray ( ) ;
0 commit comments