Skip to content

Commit 8200a9d

Browse files
AlmightyMikkelkirre-bylund
authored andcommitted
Added groups to catalogs
1 parent 478ad93 commit 8200a9d

File tree

1 file changed

+75
-2
lines changed

1 file changed

+75
-2
lines changed

Runtime/Game/Requests/CatalogRequests.cs

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using LootLocker.LootLockerEnums;
22
using System.Collections.Generic;
3+
using Unity.Plastic.Antlr3.Runtime;
34
#if UNITY_2020_2_OR_NEWER
45
using JetBrains.Annotations;
56
#endif
@@ -15,6 +16,7 @@ public enum LootLockerCatalogEntryEntityKind
1516
currency = 1,
1617
progression_points = 2,
1718
progression_reset = 3,
19+
group = 4,
1820
};
1921
}
2022

@@ -293,6 +295,59 @@ public class LootLockerCurrencyDetails
293295
public string catalog_listing_id { get; set; }
294296
}
295297

298+
public class LootLockerGroupAssociations
299+
{
300+
/// <summary>
301+
/// The kind of reward, (asset / currency / group / progression points / progression reset).
302+
/// </summary>
303+
public LootLockerCatalogEntryEntityKind kind { get; set; }
304+
/// <summary>
305+
/// The unique id of the group that this refers to
306+
/// </summary>
307+
public string id { get; set; }
308+
/// <summary>
309+
/// The catalog listing id for this group detail.
310+
/// </summary>
311+
public string catalog_listing_id { get; set; }
312+
}
313+
314+
public class LootLockerGroupMetadata
315+
{
316+
/// <summary>
317+
/// The Key of a metadata
318+
/// </summary>
319+
public string key { get; set; }
320+
/// <summary>
321+
/// the Value of a metadata
322+
/// </summary>
323+
public string value { get; set; }
324+
}
325+
326+
public class LootLockerGroupDetails
327+
{
328+
/// <summary>
329+
/// The name of the Group.
330+
/// </summary>
331+
public string name { get; set; }
332+
/// <summary>
333+
/// The description of the Group.
334+
/// </summary>
335+
public string description { get; set; }
336+
/// <summary>
337+
/// Associations for the Group reward.
338+
/// </summary>
339+
public LootLockerGroupMetadata[] metadata { get; set; }
340+
/// <summary>
341+
/// The ID of the reward.
342+
/// </summary>
343+
public string id { get; set; }
344+
/// <summary>
345+
/// Associations for the Group reward.
346+
/// </summary>
347+
public LootLockerGroupAssociations[] associations { get; set; }
348+
349+
}
350+
296351
//==================================================
297352
// Response Definitions
298353
//==================================================
@@ -349,6 +404,8 @@ public class LootLockerListCatalogPricesResponse : LootLockerResponse
349404
/// </summary>
350405
public Dictionary<string /*catalog_listing_id*/, LootLockerCurrencyDetails> currency_details { get; set; }
351406

407+
public Dictionary<string /*catalog_listing_id*/, LootLockerGroupDetails> group_details { get; set; }
408+
352409
/// <summary>
353410
/// Pagination data to use for subsequent requests
354411
/// </summary>
@@ -394,6 +451,7 @@ private class LootLockerListCatalogItemsWithArraysResponse : LootLockerResponse
394451
public LootLockerProgressionPointDetails[] progression_points_details { get; set; }
395452
public LootLockerProgressionResetDetails[] progression_resets_details { get; set; }
396453
public LootLockerCurrencyDetails[] currency_details { get; set; }
454+
public LootLockerGroupDetails[] group_details { get; set; }
397455
public LootLockerPaginationResponse<string> pagination { get; set; }
398456
}
399457

@@ -413,6 +471,7 @@ public LootLockerListCatalogPricesResponse(LootLockerResponse serverResponse)
413471
catalog = parsedResponse.catalog;
414472
entries = parsedResponse.entries;
415473
pagination = parsedResponse.pagination;
474+
416475

417476
if (parsedResponse.assets_details != null && parsedResponse.assets_details.Length > 0)
418477
{
@@ -451,6 +510,16 @@ public LootLockerListCatalogPricesResponse(LootLockerResponse serverResponse)
451510
currency_details[detail.catalog_listing_id] = detail;
452511
}
453512
}
513+
514+
if(parsedResponse.group_details != null && parsedResponse.group_details.Length > 0)
515+
{
516+
group_details = new Dictionary<string, LootLockerGroupDetails>();
517+
foreach (var detail in parsedResponse.group_details)
518+
{
519+
group_details[detail.id] = detail;
520+
}
521+
}
522+
454523
}
455524

456525
#if UNITY_2020_2_OR_NEWER
@@ -479,7 +548,9 @@ public class LootLockerInlinedCatalogEntry : LootLockerCatalogEntry
479548
[CanBeNull]
480549
public LootLockerCurrencyDetails currency_details { get; set; }
481550

482-
public LootLockerInlinedCatalogEntry(LootLockerCatalogEntry entry, [CanBeNull] LootLockerAssetDetails assetDetails, [CanBeNull] LootLockerProgressionPointDetails progressionPointDetails, [CanBeNull] LootLockerProgressionResetDetails progressionResetDetails, [CanBeNull] LootLockerCurrencyDetails currencyDetails)
551+
public LootLockerGroupDetails group_details { get; set; }
552+
553+
public LootLockerInlinedCatalogEntry(LootLockerCatalogEntry entry, [CanBeNull] LootLockerAssetDetails assetDetails, [CanBeNull] LootLockerProgressionPointDetails progressionPointDetails, [CanBeNull] LootLockerProgressionResetDetails progressionResetDetails, [CanBeNull] LootLockerCurrencyDetails currencyDetails, LootLockerGroupDetails groupDetails)
483554
{
484555
created_at = entry.created_at;
485556
entity_kind = entry.entity_kind;
@@ -493,6 +564,7 @@ public LootLockerInlinedCatalogEntry(LootLockerCatalogEntry entry, [CanBeNull] L
493564
progression_point_details = progressionPointDetails;
494565
progression_reset_details = progressionResetDetails;
495566
currency_details = currencyDetails;
567+
group_details = groupDetails;
496568
}
497569
}
498570

@@ -511,7 +583,8 @@ public LootLockerInlinedCatalogEntry[] GetLootLockerInlinedCatalogEntries()
511583
LootLockerCatalogEntryEntityKind.asset == entityKind && asset_details.ContainsKey(catalogListingID) ? asset_details[catalogListingID] : null,
512584
LootLockerCatalogEntryEntityKind.progression_points == entityKind && progression_points_details.ContainsKey(catalogListingID) ? progression_points_details[catalogListingID] : null,
513585
LootLockerCatalogEntryEntityKind.progression_reset == entityKind && progression_resets_details.ContainsKey(catalogListingID) ? progression_resets_details[catalogListingID] : null,
514-
LootLockerCatalogEntryEntityKind.currency == entityKind && currency_details.ContainsKey(catalogListingID) ? currency_details[catalogListingID] : null
586+
LootLockerCatalogEntryEntityKind.currency == entityKind && currency_details.ContainsKey(catalogListingID) ? currency_details[catalogListingID] : null,
587+
LootLockerCatalogEntryEntityKind.group == entityKind && group_details.ContainsKey(catalogListingID) ? group_details[catalogListingID] : null
515588
));
516589
}
517590
return inlinedEntries.ToArray();

0 commit comments

Comments
 (0)