Hello,
I'm using CloudScript on Azure Functions to grant an item to a player.
The item instance should have custom data associated with it. This custom data does not come from the catalog item custom data.
The user get the item in its inventory, but there is no custom data associated with it (for example, in this case it should be, Lvl = 5, HP = 50).
Thank you for your help!
Here is my function on Azure:
[FunctionName("GrantMonsterToUser")] public static async Task<dynamic> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req, ILogger log) { FunctionExecutionContext<dynamic> context = JsonConvert.DeserializeObject<FunctionExecutionContext<dynamic>>(await req.ReadAsStringAsync()); dynamic args = context.FunctionArgument; string itemId = args["id"]; string lvl = args["lvl"]; string hp = args ["hp"]; List<string> itemIds = new List<string> { itemId }; Dictionary<string, string> customData = new Dictionary<string, string> { {"Lvl", lvl}, {"HP", hp} }; PlayFabSettings.staticSettings.DeveloperSecretKey = Environment.GetEnvironmentVariable("PLAYFAB_DEV_SECRET_KEY", EnvironmentVariableTarget.Process); PlayFabSettings.staticSettings.TitleId = context.TitleAuthenticationContext.Id; var authContext = new PlayFabAuthenticationContext { EntityToken = context.TitleAuthenticationContext.EntityToken }; var request = new GrantItemsToUserRequest { PlayFabId = context.CallerEntityProfile.Lineage.MasterPlayerAccountId, AuthenticationContext = authContext, ItemIds = itemIds }; return await PlayFabServerAPI.GrantItemsToUserAsync(request, customData); }