private static async Task AddFakeItem(DestinyProfileResponse profile, uint itemHash, long itemInstanceId) { var random = new Random(unchecked ((int)itemHash)); var itemDef = await Definitions.GetInventoryItem(itemHash); var character = profile.Characters.Data.Values.First(v => v.ClassType == itemDef.ClassType); var characterId = character.CharacterId.ToString(); profile.CharacterInventories.Data[characterId].Items.Add(new DestinyItemComponent() { ItemHash = itemHash, BucketHash = itemDef.Inventory.BucketTypeHash, ItemInstanceId = itemInstanceId, }); profile.ItemComponents.Objectives.Data[itemInstanceId.ToString()] = new DestinyItemObjectivesComponent() { Objectives = new List <DestinyObjectiveProgress>() }; foreach (var objectiveHash in itemDef.Objectives.ObjectiveHashes) { var objectiveDef = await Definitions.GetObjective(objectiveHash); profile.ItemComponents.Objectives.Data[itemInstanceId.ToString()].Objectives.Add(new DestinyObjectiveProgress() { ObjectiveHash = objectiveHash, Progress = random.Next(0, Convert.ToInt32(objectiveDef.CompletionValue)), CompletionValue = objectiveDef.CompletionValue, }); } }
public static async Task <string> GetTriumphsCompletedString( DestinyObjectiveDefinition objDefinition) { if (triumphsCompletedString?.Length > 1) { return(triumphsCompletedString); } if (objDefinition?.ProgressDescription?.Length > 1) { return(objDefinition.ProgressDescription); } var objective = await Definitions.GetObjective(triumphsCompletedObjectiveHash); triumphsCompletedString = objective?.ProgressDescription ?? "Triumphs completed"; return(triumphsCompletedString); }
public async Task <DestinyObjectiveDefinition> PopulateDefinition() { Definition = await Definitions.GetObjective(Progress.ObjectiveHash); return(Definition); }