public Mod(string baseUrl, bool isSelected, DestinyInventoryItemDefinition mod, IEnumerable <DestinyItemCategoryDefinition> categories, int quantity) : base(baseUrl, isSelected, mod, categories) { Quantity = quantity; }
public Perk(string baseUrl, bool isSelected, DestinyInventoryItemDefinition plug, IEnumerable <DestinyItemCategoryDefinition> categories) : base(baseUrl, plug) { IsSelected = isSelected; CategoryHash = plug.Plug.PlugCategoryHash; Categories = categories; }
private string GetIconUrl(DestinyInventoryItemDefinition itemDefinition) { if (!itemDefinition.DisplayProperties.HasIcon) { return(string.Empty); } return(_bungie.BaseUrl + itemDefinition.DisplayProperties.Icon); }
private static string GetWatermarkIcon(DestinyInventoryItemDefinition itemDef) { if (itemDef.Quality.CurrentVersion < 0) { return(string.Empty); } return(itemDef.Quality.DisplayVersionWatermarkIcons.Skip(itemDef.Quality.CurrentVersion) .FirstOrDefault()); }
public DestinyInventoryItemDefinition GetItemDefTable(string id) { using (var conn = new SQLiteConnection(dbPath)) { string query = "SELECT json FROM DestinyInventoryItemDefinition WHERE id = " + id; DestinyInventoryItemDefinition result = conn.Query <DestinyInventoryItemDefinition>(query, id).FirstOrDefault(); conn.Close(); return(result); } }
public Item(DestinyInventoryItemDefinition apiItem) { Name = apiItem.DisplayProperties.Name; Description = apiItem.DisplayProperties.Description; ItemTierAndDisplayName = apiItem.ItemTypeAndTierDisplayName; IconPath = apiItem.DisplayProperties.Icon; ItemType = apiItem.ItemType; ItemSubType = apiItem.ItemSubType; TierType = apiItem.Inventory.TierType; Statistics = new List <ItemStatistic>(); }
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); }
private IEnumerable <DestinySandboxPerkDefinition> GetModPerks(DestinyInventoryItemDefinition mod, IDictionary <uint, DestinySandboxPerkDefinition> perks) { var perkHashes = mod.Perks.Select(perk => perk.PerkHash); foreach (var perkHash in perkHashes) { if (perks.TryGetValue(perkHash, out var perk)) { yield return(perk); } } }
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 Item(string baseUrl, DestinyInventoryItemDefinition itemDef, DestinyInventoryBucketDefinition bucket, long instanceId = 0, DestinyItemInstanceComponent instance = null, IEnumerable <Stat> stats = null, IEnumerable <SocketCategory> socketCategories = null) : base(baseUrl, itemDef) { PowerLevel = instance?.PrimaryStat?.Value ?? 0; Slot = new ItemSlot(bucket); Tier = itemDef.Inventory.TierType; ClassType = itemDef.ClassType; InstanceId = instanceId; SocketCategories = socketCategories?.ToList() ?? Enumerable.Empty <SocketCategory>(); Stats = stats?.ToList() ?? Enumerable.Empty <Stat>(); }
private string BuildIconUrl(DestinyInventoryItemDefinition item) { if (!item.DisplayProperties.HasIcon) { return(string.Empty); } // The second icon in the sequence is the small icon. var smallIconUrl = item.DisplayProperties.IconSequences?.ElementAtOrDefault(1) ?.Frames.FirstOrDefault(); if (string.IsNullOrEmpty(smallIconUrl)) { return(_baseUrl + item.DisplayProperties.Icon); } return(_baseUrl + smallIconUrl); }
private ModElement LoadStat(IDictionary <uint, DestinyStatDefinition> cache, DestinyInventoryItemDefinition item) { // assume mods have 1 investment stat var investmentStat = item.InvestmentStats.FirstOrDefault(); if (investmentStat == null) { return(ModElement.General); } var stat = cache[investmentStat.StatTypeHash]; return(stat.DisplayProperties.Name switch { "Arc Cost" => ModElement.Arc, "Solar Cost" => ModElement.Solar, "Void Cost" => ModElement.Void, _ => ModElement.General });
public async Task <DestinyInventoryItemDefinition> PopulateDefinition() { Definition = await Definitions.GetInventoryItem(ItemHash); return(Definition); }