private static (long characterId, DestinyItemComponent item) FindItemToLock( DestinyProfileResponse profile) { string selectedCharacterId = default; DestinyItemComponent selectedItem = default; foreach (var(characterId, characterInventory) in profile.CharacterEquipment.Data) { foreach (var item in characterInventory.Items) { if (item.ItemInstanceId == 0 || (item.BucketHash != BucketShips && item.BucketHash != BucketSparrows)) { continue; } selectedCharacterId = characterId; selectedItem = item; break; } if (selectedCharacterId != null) { break; } } return(characterId : Convert.ToInt64(selectedCharacterId), item : selectedItem); }
internal DestinyComponentItemResponse( long?characterId, DestinyItemComponent item, DestinyItemInstanceComponent instance, DestinyItemObjectivesComponent objectives, DestinyItemPerksComponent perks, DestinyItemRenderComponent renderData, DestinyItemStatsComponent stats, DestinyItemTalentGridComponent talentGrid, DestinyItemSocketsComponent sockets, DestinyItemReusablePlugsComponent reusablePlugs, DestinyItemPlugObjectivesComponent plugObjectives) { CharacterId = characterId; _item = item; _instance = instance; _objectives = objectives; _perks = perks; _renderData = renderData; _stats = stats; _talentGrid = talentGrid; _sockets = sockets; _reusablePlugs = reusablePlugs; _plugObjectives = plugObjectives; }
public static async Task <Item> BuildItem(DestinyItemComponent itemComponent) { var manifest = App.provider.GetService(typeof(IManifest)) as IManifest; var item = await manifest.LoadInventoryItem(itemComponent.ItemHash); var categories = await manifest.LoadItemCategories(item.ItemCategoryHashes); return(new Item(itemComponent.ItemInstanceId, itemComponent.ItemHash, item.DisplayProperties.Name, item.Equippable, item.Inventory.TierType, BuildType(categories), BuildSubType(categories))); }
public static TrackedEntry FromInventoryItemComponent(DestinyItemComponent item, long characterId) { return(new TrackedEntry { Type = TrackedEntryType.Item, Hash = item.ItemHash, InstanceId = item.ItemInstanceId, OwnerId = characterId }); }
public Item(string baseUrl, DestinyItemComponent itemComponent, DestinyInventoryItemDefinition itemDef, DestinyInventoryBucketDefinition bucket, DestinyItemInstanceComponent instance = null, string overrideIconUrl = null) { Name = itemDef.DisplayProperties.Name; PowerLevel = instance?.PrimaryStat?.Value ?? 0; Slot = new ItemSlot(bucket); Tier = itemDef.Inventory.TierType; ClassType = itemDef.ClassType; Icon = baseUrl + (overrideIconUrl ?? itemDef.DisplayProperties.Icon); }
public static async Task <Item> ItemFromItemComponent(DestinyItemComponent item, DestinyProfileResponse profile, Character ownerCharacter = default) { var uninstancedObjectivesData = ownerCharacter == null ? new Dictionary <string, DestinyItemObjectivesComponent>() : profile.CharacterUninstancedItemComponents[ownerCharacter.CharacterComponent.CharacterId.ToString()].Objectives.Data; var objectives = new List <DestinyObjectiveProgress>(); var itemInstanceId = item.ItemInstanceId.ToString(); var itemHash = item.ItemHash.ToString(); if (profile.ItemComponents.Objectives.Data.ContainsKey(itemInstanceId)) { objectives.AddRange(profile.ItemComponents.Objectives.Data[itemInstanceId]?.Objectives); } if (item.ItemInstanceId.Equals(0) && uninstancedObjectivesData.ContainsKey(itemHash)) { objectives.AddRange(uninstancedObjectivesData[itemHash].Objectives); } if (objectives.Count == 0) { return(new Item()); } var bounty = new Item() { ItemHash = item.ItemHash, ItemInstanceId = item.ItemInstanceId, BucketHash = item.BucketHash, OwnerCharacter = ownerCharacter, Objectives = new List <Objective>() }; await bounty.PopulateDefinition(); foreach (var destinyQuestsDestinyObjectiveProgress in objectives) { var obj = new Objective { Progress = destinyQuestsDestinyObjectiveProgress }; await obj.PopulateDefinition(); bounty.Objectives.Add(obj); } return(bounty); }
public Item(string baseUrl, DestinyItemComponent itemComponent, DestinyInventoryItemDefinition itemDef, DestinyInventoryBucketDefinition bucket, DestinyItemInstanceComponent instance = null, string overrideIconUrl = null, string watermark = null) { Name = itemDef.DisplayProperties.Name; PowerLevel = GetPowerLevel(instance, bucket); Slot = new ItemSlot(bucket); Tier = itemDef.Inventory.TierType; ClassType = itemDef.ClassType; Icon = baseUrl + (overrideIconUrl ?? itemDef.DisplayProperties.Icon); if (!string.IsNullOrEmpty(watermark)) { Watermark = baseUrl + watermark; } }
public bool TryGetItem(out DestinyItemComponent data) { data = _item; return(data != null); }