Hi all,
I'm obviously spending a lot of time trying to learn C# and Playfab and i struggle to get the remaining uses of an item with a cloud script.
The cloud script is :
handlers.OnStatUpgrade = function(args){
var getPlayerInv = server.GetUserInventory
({
PlayFabId: currentPlayerId
});
var getPlayerInvItem = getPlayerInv.Inventory;
var getItemStats = JSON.parse(JSON.stringify(getPlayerInvItem));
if (getItemStats.ItemId = "LingotFer" ) {
return getItemStats.RemainingUses;
}
}
That doesn't works obviously. Yet getItemStats is equal to : {"ItemId":"LingotFer","ItemInstanceId":"46B41216B525616F","ItemClass":"CBSDefaultData","PurchaseDate":"2024-01-29T16:50:02.881Z","RemainingUses":4,"CatalogVersion":"CBSItems","DisplayName":"Plaque d'acier","UnitPrice":0},{"ItemId":"MetalBar","ItemInstanceId":"AC7ADEA8AFDB97CB","ItemClass":"CBSDefaultData","PurchaseDate":"2024-01-28T18:18:50.018Z","RemainingUses":10,"Annotation":"Granted via Game Manager","CatalogVersion":"CBSItems","DisplayName":"Barre de métal","UnitPrice":0},{"ItemId":"GemShard","ItemInstanceId":"CDD457783C0F1009","ItemClass":"CBSDefaultData","PurchaseDate":"2024-01-28T18:18:37.053Z","RemainingUses":5,"Annotation":"Granted via Game Manager","CatalogVersion":"CBSItems","DisplayName":"Eclats de gemme","UnitPrice":0},{"ItemId":"Chaine","ItemInstanceId":"497A0FD4CC3664DD","ItemClass":"CBSDefaultData","PurchaseDate":"2024-01-28T14:36:54.53Z","RemainingUses":2,"Annotation":"Granted via Game Manager","CatalogVersion":"CBSItems","DisplayName":"Chaîne d'acier","UnitPrice":0},{"ItemId":"Rouage","ItemInstanceId":"A3320B768796F7EA","ItemClass":"CBSDefaultData","PurchaseDate":"2024-01-28T12:54:48.156Z","RemainingUses":8,"Annotation":"Granted via Game Manager","CatalogVersion":"CBSItems","DisplayName":"Rouage","UnitPrice":0}]
I would like to be able to retrieve the item remaining uses for a specific itemId, here "LingotFer". Do you know how to proceed ?
Best regards,
Mikael