Skip to content

Commit 7f7e790

Browse files
Erik Bylundkirre-bylund
authored andcommitted
Fix bugs after initial testing of economy
1 parent eaf0eb3 commit 7f7e790

File tree

3 files changed

+138
-53
lines changed

3 files changed

+138
-53
lines changed

Runtime/Game/LootLockerSDKManager.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4990,7 +4990,6 @@ public static void GetRemovedUGCForPlayer(GetRemovedUGCForPlayerInput input, Act
49904990
/// <param name="onComplete">onComplete Action for handling the response</param>
49914991
public static void ListCurrencies(Action<LootLockerListCurrenciesResponse> onComplete)
49924992
{
4993-
LootLockerCurrency cur;
49944993
if (!CheckInitialized())
49954994
{
49964995
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerListCurrenciesResponse>());
@@ -5079,7 +5078,7 @@ public static void GetWalletByHolderId(string holderUlid, LootLockerWalletHolder
50795078
LootLockerCreateWalletRequest request = new LootLockerCreateWalletRequest()
50805079
{
50815080
holder_id = holderUlid,
5082-
holder_type = holderType
5081+
holder_type = holderType.ToString()
50835082
};
50845083
LootLockerServerRequest.CallAPI(LootLockerEndPoints.createWallet.endPoint,
50855084
LootLockerEndPoints.createWallet.httpMethod, LootLockerJson.SerializeObject(request),
@@ -5113,11 +5112,11 @@ public static void GetWalletByHolderId(string holderUlid, LootLockerWalletHolder
51135112
/// <param name="currencyId">Unique ID of the currency to credit</param>
51145113
/// <param name="amount">The amount of the given currency to credit to the given wallet</param>
51155114
/// <param name="onComplete">onComplete Action for handling the response</param>
5116-
public static void CreditBalanceToWallet(string walletId, string currencyId, string amount, Action<LootLockerBalanceForWalletResponse> onComplete)
5115+
public static void CreditBalanceToWallet(string walletId, string currencyId, string amount, Action<LootLockerCreditWalletResponse> onComplete)
51175116
{
51185117
if (!CheckInitialized())
51195118
{
5120-
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerBalanceForWalletResponse>());
5119+
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerCreditWalletResponse>());
51215120
return;
51225121
}
51235122

@@ -5133,11 +5132,11 @@ public static void CreditBalanceToWallet(string walletId, string currencyId, str
51335132
/// <param name="currencyId">Unique ID of the currency to debit</param>
51345133
/// <param name="amount">The amount of the given currency to debit from the given wallet</param>
51355134
/// <param name="onComplete">onComplete Action for handling the response</param>
5136-
public static void DebitBalanceToWallet(string walletId, string currencyId, string amount, Action<LootLockerBalanceForWalletResponse> onComplete)
5135+
public static void DebitBalanceToWallet(string walletId, string currencyId, string amount, Action<LootLockerDebitWalletResponse> onComplete)
51375136
{
51385137
if (!CheckInitialized())
51395138
{
5140-
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerBalanceForWalletResponse>());
5139+
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerDebitWalletResponse>());
51415140
return;
51425141
}
51435142

Runtime/Game/Requests/BalanceRequests.cs

Lines changed: 63 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
namespace LootLocker.LootLockerEnums
44
{
5-
/// <summary> Possible account linking process statuses. Undefined means that the object couldn't be constructed correctly
5+
/// <summary>
6+
/// Possible account linking process statuses. Undefined means that the object couldn't be constructed correctly
67
/// </summary>
78
public enum LootLockerWalletHolderTypes
89
{
9-
Character = 0,
10-
Player = 1,
10+
character = 0,
11+
player = 1,
1112
};
1213
}
1314

@@ -54,7 +55,11 @@ public class LootLockerCreateWalletRequest
5455
/// <summary>
5556
/// The type of holder that this holder id refers to
5657
/// </summary>
57-
public LootLockerWalletHolderTypes holder_type { get; set; }
58+
public string holder_type { get; set; }
59+
/// <summary>
60+
/// The id of the created wallet
61+
/// </summary>
62+
public string id { get; set; }
5863
};
5964

6065
/// <summary>
@@ -133,4 +138,58 @@ public class LootLockerGetWalletResponse : LootLockerResponse
133138
public LootLockerWalletHolderTypes type { get; set;}
134139
};
135140

141+
/// <summary>
142+
/// </summary>
143+
public class LootLockerCreditWalletResponse : LootLockerResponse
144+
{
145+
/// <summary>
146+
/// Current amount of the given currency in this wallet
147+
/// </summary>
148+
public string amount { get; set; }
149+
/// <summary>
150+
/// Information about the currency that this balance is in
151+
/// </summary>
152+
public LootLockerCurrency currency { get; set; }
153+
/// <summary>
154+
/// The id of the wallet holding this balance
155+
/// </summary>
156+
public string wallet_id { get; set; }
157+
/// <summary>
158+
/// The time that this balance was created
159+
/// </summary>
160+
public string created_at { get; set; }
161+
}
162+
163+
/// <summary>
164+
/// </summary>
165+
public class LootLockerDebitWalletResponse : LootLockerResponse
166+
{
167+
/// <summary>
168+
/// Current amount of the given currency in this wallet
169+
/// </summary>
170+
public string amount { get; set; }
171+
/// <summary>
172+
/// Information about the currency that this balance is in
173+
/// </summary>
174+
public LootLockerCurrency currency { get; set; }
175+
/// <summary>
176+
/// The id of the wallet holding this balance
177+
/// </summary>
178+
public string wallet_id { get; set; }
179+
/// <summary>
180+
/// The time that this balance was created
181+
/// </summary>
182+
public string created_at { get; set; }
183+
}
184+
185+
/// <summary>
186+
/// </summary>
187+
public class LootLockerCreateWalletResponse : LootLockerResponse
188+
{
189+
/// <summary>
190+
/// The unique id of this wallet
191+
/// </summary>
192+
public string wallet_id { get; set; }
193+
};
194+
136195
}

Runtime/Game/Requests/CatalogRequests.cs

Lines changed: 70 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -255,37 +255,50 @@ public class LootLockerListCatalogsResponse : LootLockerResponse
255255
}
256256

257257
/// <summary>
258-
/// </summary>
258+
/// </summary>
259259
public class LootLockerListCatalogPricesResponse : LootLockerResponse
260260
{
261261
/// <summary>
262-
/// Details about the catalog that the prices is in
263-
/// </summary>
262+
/// Details about the catalog that the prices is in
263+
/// </summary>
264264
public LootLockerCatalog catalog { get; set; }
265265

266266
/// <summary>
267-
/// A list of entries available in this catalog
268-
/// </summary>
267+
/// A list of entries available in this catalog
268+
/// </summary>
269269
public LootLockerCatalogEntry[] entries { get; set; }
270+
270271
/// <summary>
271-
/// Lookup map for details about entities of entity type assets
272-
/// </summary>
272+
/// Lookup map for details about entities of entity type assets
273+
/// </summary>
273274
public Dictionary<string /*grouping_key*/, LootLockerAssetDetails> asset_details { get; set; }
275+
274276
/// <summary>
275-
/// Lookup map for details about entities of entity type progression_points
276-
/// </summary>
277-
public Dictionary<string /*grouping_key*/, LootLockerProgressionPointDetails> progression_points_details { get; set; }
277+
/// Lookup map for details about entities of entity type progression_points
278+
/// </summary>
279+
public Dictionary<string /*grouping_key*/, LootLockerProgressionPointDetails> progression_points_details
280+
{
281+
get;
282+
set;
283+
}
284+
278285
/// <summary>
279-
/// Lookup map for details about entities of entity type progression_reset
280-
/// </summary>
281-
public Dictionary<string /*grouping_key*/, LootLockerProgressionResetDetails> progression_resets_details { get; set; }
286+
/// Lookup map for details about entities of entity type progression_reset
287+
/// </summary>
288+
public Dictionary<string /*grouping_key*/, LootLockerProgressionResetDetails> progression_resets_details
289+
{
290+
get;
291+
set;
292+
}
293+
282294
/// <summary>
283-
/// Lookup map for details about entities of entity type currency
284-
/// </summary>
295+
/// Lookup map for details about entities of entity type currency
296+
/// </summary>
285297
public Dictionary<string /*grouping_key*/, LootLockerCurrencyDetails> currency_details { get; set; }
298+
286299
/// <summary>
287-
/// Pagination data to use for subsequent requests
288-
/// </summary>
300+
/// Pagination data to use for subsequent requests
301+
/// </summary>
289302
public LootLockerCatalogPagination pagination { get; set; }
290303

291304
public void AppendCatalogItems(LootLockerListCatalogPricesResponse catalogPrices)
@@ -298,32 +311,33 @@ public void AppendCatalogItems(LootLockerListCatalogPricesResponse catalogPrices
298311

299312
foreach (var assetDetail in catalogPrices.asset_details)
300313
{
301-
asset_details.Add(assetDetail.Key, assetDetail.Value);
314+
asset_details.Add(assetDetail.Key, assetDetail.Value);
302315
}
316+
303317
foreach (var progressionPointDetail in catalogPrices.progression_points_details)
304318
{
305319
progression_points_details.Add(progressionPointDetail.Key, progressionPointDetail.Value);
306320
}
321+
307322
foreach (var progressionResetDetail in catalogPrices.progression_resets_details)
308323
{
309324
progression_resets_details.Add(progressionResetDetail.Key, progressionResetDetail.Value);
310325
}
326+
311327
foreach (var currencyDetail in catalogPrices.currency_details)
312328
{
313329
currency_details.Add(currencyDetail.Key, currencyDetail.Value);
314330
}
315331
}
316332

317-
public LootLockerListCatalogPricesResponse()
318-
{
319-
}
333+
public LootLockerListCatalogPricesResponse() {}
320334

321-
/// This is the way that the response actually looks, but we don't want to expose it, hence the conversion
335+
/// This is the way that the response actually looks, but we don't want to expose it, hence the conversion
322336
private class LootLockerListCatalogItemsWithArraysResponse : LootLockerResponse
323337
{
324338
public LootLockerCatalog catalog { get; set; }
325339
public LootLockerCatalogEntry[] entries { get; set; }
326-
public LootLockerAssetDetails[] asset_details { get; set; }
340+
public LootLockerAssetDetails[] assets_details { get; set; }
327341
public LootLockerProgressionPointDetails[] progression_points_details { get; set; }
328342
public LootLockerProgressionResetDetails[] progression_resets_details { get; set; }
329343
public LootLockerCurrencyDetails[] currency_details { get; set; }
@@ -332,34 +346,47 @@ private class LootLockerListCatalogItemsWithArraysResponse : LootLockerResponse
332346

333347
public LootLockerListCatalogPricesResponse(LootLockerResponse serverResponse)
334348
{
335-
LootLockerListCatalogItemsWithArraysResponse parsedResponse = Deserialize<LootLockerListCatalogItemsWithArraysResponse>(serverResponse);
349+
LootLockerListCatalogItemsWithArraysResponse parsedResponse =
350+
Deserialize<LootLockerListCatalogItemsWithArraysResponse>(serverResponse);
351+
success = parsedResponse.success;
352+
statusCode = parsedResponse.statusCode;
353+
text = parsedResponse.text;
354+
errorData = parsedResponse.errorData;
355+
if (!success)
356+
{
357+
return;
358+
}
359+
336360
catalog = parsedResponse.catalog;
337361
entries = parsedResponse.entries;
362+
pagination = parsedResponse.pagination;
338363

339-
if (parsedResponse.asset_details != null && parsedResponse.asset_details.Length > 0)
364+
if (parsedResponse.assets_details != null && parsedResponse.assets_details.Length > 0)
340365
{
341366
asset_details = new Dictionary<string, LootLockerAssetDetails>();
342-
foreach (var assetDetail in parsedResponse.asset_details)
367+
foreach (var assetDetail in parsedResponse.assets_details)
343368
{
344-
asset_details.Add(assetDetail.id, assetDetail);
369+
asset_details[assetDetail.grouping_key] = assetDetail;
345370
}
346371
}
347372

348-
if (parsedResponse.progression_points_details != null && parsedResponse.progression_points_details.Length > 0)
373+
if (parsedResponse.progression_points_details != null &&
374+
parsedResponse.progression_points_details.Length > 0)
349375
{
350376
progression_points_details = new Dictionary<string, LootLockerProgressionPointDetails>();
351377
foreach (var detail in parsedResponse.progression_points_details)
352378
{
353-
progression_points_details.Add(detail.id, detail);
379+
progression_points_details[detail.grouping_key] = detail;
354380
}
355381
}
356382

357-
if (parsedResponse.progression_resets_details != null && parsedResponse.progression_resets_details.Length > 0)
383+
if (parsedResponse.progression_resets_details != null &&
384+
parsedResponse.progression_resets_details.Length > 0)
358385
{
359386
progression_resets_details = new Dictionary<string, LootLockerProgressionResetDetails>();
360387
foreach (var detail in parsedResponse.progression_resets_details)
361388
{
362-
progression_resets_details.Add(detail.id, detail);
389+
progression_resets_details[detail.grouping_key] = detail;
363390
}
364391
}
365392

@@ -368,31 +395,31 @@ public LootLockerListCatalogPricesResponse(LootLockerResponse serverResponse)
368395
currency_details = new Dictionary<string, LootLockerCurrencyDetails>();
369396
foreach (var detail in parsedResponse.currency_details)
370397
{
371-
currency_details.Add(detail.id, detail);
398+
currency_details[detail.grouping_key] = detail;
372399
}
373400
}
374401
}
375402

376403
#if UNITY_2020_2_OR_NEWER
377404
/// <summary>
378-
/// </summary>
405+
/// </summary>
379406
public class LootLockerInlinedCatalogEntry : LootLockerCatalogEntry
380407
{
381408
/// <summary>
382-
/// Asset details inlined for this catalog entry, will be null if the entity_kind is not asset
383-
/// </summary>
409+
/// Asset details inlined for this catalog entry, will be null if the entity_kind is not asset
410+
/// </summary>
384411
public LootLockerAssetDetails? asset_details { get; set; }
385412
/// <summary>
386-
/// Progression point details inlined for this catalog entry, will be null if the entity_kind is not progression_points
387-
/// </summary>
413+
/// Progression point details inlined for this catalog entry, will be null if the entity_kind is not progression_points
414+
/// </summary>
388415
public LootLockerProgressionPointDetails? progression_point_details { get; set; }
389416
/// <summary>
390-
/// Progression reset details inlined for this catalog entry, will be null if the entity_kind is not progression_reset
391-
/// </summary>
417+
/// Progression reset details inlined for this catalog entry, will be null if the entity_kind is not progression_reset
418+
/// </summary>
392419
public LootLockerProgressionResetDetails? progression_reset_details { get; set; }
393420
/// <summary>
394-
/// Currency details inlined for this catalog entry, will be null if the entity_kind is not currency
395-
/// </summary>
421+
/// Currency details inlined for this catalog entry, will be null if the entity_kind is not currency
422+
/// </summary>
396423
public LootLockerCurrencyDetails? currency_details { get; set; }
397424

398425
public LootLockerInlinedCatalogEntry(LootLockerCatalogEntry entry, [CanBeNull] LootLockerAssetDetails assetDetails, [CanBeNull] LootLockerProgressionPointDetails progressionPointDetails, [CanBeNull] LootLockerProgressionResetDetails progressionResetDetails, [CanBeNull] LootLockerCurrencyDetails currencyDetails)
@@ -412,8 +439,8 @@ public LootLockerInlinedCatalogEntry(LootLockerCatalogEntry entry, [CanBeNull] L
412439
}
413440

414441
/// <summary>
415-
/// Get all the entries with details inlined into the entries themselves
416-
/// </summary>
442+
/// Get all the entries with details inlined into the entries themselves
443+
/// </summary>
417444
public LootLockerInlinedCatalogEntry[] GetLootLockerInlinedCatalogEntries()
418445
{
419446
List<LootLockerInlinedCatalogEntry> inlinedEntries = new List<LootLockerInlinedCatalogEntry>();

0 commit comments

Comments
 (0)