Skip to content

Commit

Permalink
Merge pull request #194 from devFelicity/develop
Browse files Browse the repository at this point in the history
feat(season): season of the wish update
  • Loading branch information
MoonieGZ authored Dec 12, 2023
2 parents 7e2b5b2 + d150c8f commit 0ba8edb
Show file tree
Hide file tree
Showing 64 changed files with 241 additions and 148 deletions.
2 changes: 1 addition & 1 deletion Felicity/Controllers/BungieAuthController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ await _bungieClient.ApiAccess.Destiny2.GetLinkedProfiles(BungieMembershipType.Bu

return RedirectPermanent("https://tryfelicity.one/auth_success");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@ public async Task Checkpoint(

await FollowupAsync(embed: embed.Build());
}
}
}
11 changes: 8 additions & 3 deletions Felicity/DiscordCommands/Interactions/CraftingCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ public async Task Recipes(
user.DestinyMembershipType, user.DestinyMembershipId, user.GetTokenData(),
request.Response.Characters.Data.Keys.First());

var wishDeepsight = await IsDeepsightAvailable(1251298789,
user.DestinyMembershipType, user.DestinyMembershipId, user.GetTokenData(),
request.Response.Characters.Data.Keys.First());

var invDescription = false;
var buyDescription = false;

Expand Down Expand Up @@ -222,7 +226,7 @@ public async Task Recipes(
field.Value += $"\n > `{obj.Progress}/{obj.CompletionValue}`";
}

if (keyValuePair.Key is "Deep" && deepDeepsight)
if ((keyValuePair.Key is "Deep" && deepDeepsight) || (keyValuePair.Key is "Wish" && wishDeepsight))
{
if (field.Value.ToString()!.Contains("⚠️"))
field.Value += "💰 ";
Expand All @@ -235,7 +239,7 @@ public async Task Recipes(

if (!obj.IsComplete || showAll)
field.Value +=
$" - [{manifestRecord.DisplayProperties.Name}]({MiscUtils.GetLightGgLink(Craftables.GetWeaponId(manifestRecord.Hash))})";
$" - [{manifestRecord.DisplayProperties.Name}](https://d2foundry.gg/w/{Craftables.GetWeaponId(manifestRecord.Hash)})";
}

i++;
Expand Down Expand Up @@ -299,6 +303,7 @@ private async Task<bool> IsDeepsightAvailable(uint vendorId, BungieMembershipTyp
var categoryIndex = vendorId switch
{
8721509 => 1,
1251298789 => 1,
_ => 0
};

Expand Down Expand Up @@ -351,4 +356,4 @@ private static int GetItemCount(BungieResponse<DestinyProfileResponse> request,
return allItems.Where(destinyItemComponent => destinyItemComponent.Item.Hash == goodHash)
.Count(destinyItemComponent => destinyItemComponent.State.HasFlag(ItemState.HighlightedObjective));
}
}
}
50 changes: 24 additions & 26 deletions Felicity/DiscordCommands/Interactions/EmblemCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
using DotNetBungieAPI.Models.Destiny.Responses;
using DotNetBungieAPI.Service.Abstractions;
using Felicity.Models;
using Felicity.Options;
using Felicity.Util;
using Felicity.Util.Enums;
using Microsoft.Extensions.Options;

// ReSharper disable UnusedMember.Global
// ReSharper disable UnusedType.Global
Expand All @@ -24,8 +22,8 @@ namespace Felicity.DiscordCommands.Interactions;
public class EmblemCommands : InteractionModuleBase<ShardedInteractionContext>
{
private readonly IBungieClient _bungieClient;
private readonly UserDb _userDb;
private readonly IConfiguration _configuration;
private readonly UserDb _userDb;

public EmblemCommands(IBungieClient bungieClient, UserDb userDb, IConfiguration configuration)
{
Expand Down Expand Up @@ -109,21 +107,21 @@ public async Task EmblemShares(
}

foreach (var collectible in from collectible in manifestCollectibles
where !collectible.Redacted
where !string.IsNullOrEmpty(collectible.DisplayProperties.Name)
from manifestCollectibleParentNodeHash in collectible.ParentNodes
where EmblemCats.EmblemCatList.Contains((EmblemCat)manifestCollectibleParentNodeHash.Hash!)
select collectible)
where !collectible.Redacted
where !string.IsNullOrEmpty(collectible.DisplayProperties.Name)
from manifestCollectibleParentNodeHash in collectible.ParentNodes
where EmblemCats.EmblemCatList.Contains((EmblemCat)manifestCollectibleParentNodeHash.Hash!)
select collectible)
{
emblemCount++;

var value = profile.Response.ProfileCollectibles.Data.Collectibles[collectible.Hash];

foreach (var unused in from emblem in manifestInventoryItems
where emblem.Collectible.Hash == collectible.Hash
where value.State.HasFlag(DestinyCollectibleState.NotAcquired)
where !emblemList.Contains(collectible)
select emblem) emblemList.Add(collectible);
where emblem.Collectible.Hash == collectible.Hash
where value.State.HasFlag(DestinyCollectibleState.NotAcquired)
where !emblemList.Contains(collectible)
select emblem) emblemList.Add(collectible);

if (value.State.HasFlag(DestinyCollectibleState.Invisible) &&
!value.State.HasFlag(DestinyCollectibleState.NotAcquired))
Expand Down Expand Up @@ -269,8 +267,8 @@ public async Task EmblemRarest(

if (!result.Redacted && !string.IsNullOrEmpty(result.DisplayProperties.Name))
manifestCollectibles.AddRange(from definitionParentNode in result.ParentNodes
where EmblemCats.EmblemCatList.Contains((EmblemCat)definitionParentNode.Hash!)
select result);
where EmblemCats.EmblemCatList.Contains((EmblemCat)definitionParentNode.Hash!)
select result);
}

string jsonString;
Expand Down Expand Up @@ -365,21 +363,21 @@ private static List<DefinitionHashPointer<DestinyCollectibleDefinition>> AddEmbl
{
var manifestCollectibleIDs =
(from destinyCollectibleComponent in profileResponse.ProfileCollectibles.Data.Collectibles
where !destinyCollectibleComponent.Value.State.HasFlag(DestinyCollectibleState.UniquenessViolation) ||
!destinyCollectibleComponent.Value.State.HasFlag(DestinyCollectibleState.NotAcquired)
where !destinyCollectibleComponent.Value.State.HasFlag(DestinyCollectibleState.Invisible) ||
destinyCollectibleComponent.Value.State.HasFlag(DestinyCollectibleState.NotAcquired)
where !destinyCollectibleComponent.Value.State.HasFlag(DestinyCollectibleState.NotAcquired)
select destinyCollectibleComponent.Key).ToList();
where !destinyCollectibleComponent.Value.State.HasFlag(DestinyCollectibleState.UniquenessViolation) ||
!destinyCollectibleComponent.Value.State.HasFlag(DestinyCollectibleState.NotAcquired)
where !destinyCollectibleComponent.Value.State.HasFlag(DestinyCollectibleState.Invisible) ||
destinyCollectibleComponent.Value.State.HasFlag(DestinyCollectibleState.NotAcquired)
where !destinyCollectibleComponent.Value.State.HasFlag(DestinyCollectibleState.NotAcquired)
select destinyCollectibleComponent.Key).ToList();

foreach (var destinyCollectibleComponent in profileResponse.CharacterCollectibles.Data)
manifestCollectibleIDs.AddRange(from collectibleComponent in destinyCollectibleComponent.Value.Collectibles
where !collectibleComponent.Value.State.HasFlag(DestinyCollectibleState.UniquenessViolation) ||
!collectibleComponent.Value.State.HasFlag(DestinyCollectibleState.NotAcquired)
where !collectibleComponent.Value.State.HasFlag(DestinyCollectibleState.Invisible) ||
collectibleComponent.Value.State.HasFlag(DestinyCollectibleState.NotAcquired)
where !collectibleComponent.Value.State.HasFlag(DestinyCollectibleState.NotAcquired)
select collectibleComponent.Key);
where !collectibleComponent.Value.State.HasFlag(DestinyCollectibleState.UniquenessViolation) ||
!collectibleComponent.Value.State.HasFlag(DestinyCollectibleState.NotAcquired)
where !collectibleComponent.Value.State.HasFlag(DestinyCollectibleState.Invisible) ||
collectibleComponent.Value.State.HasFlag(DestinyCollectibleState.NotAcquired)
where !collectibleComponent.Value.State.HasFlag(DestinyCollectibleState.NotAcquired)
select collectibleComponent.Key);

return manifestCollectibleIDs;
}
Expand Down
8 changes: 5 additions & 3 deletions Felicity/DiscordCommands/Interactions/LookupCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ private static async Task<Embed> GenerateLookupEmbed(BungieResponse<DestinyProfi
embed.Url = $"https://www.bungie.net/7/en/User/Profile/{memTypeAndId}";

embed.AddField("Current Season Rank",
$"> {playerResponse.Response.Metrics.Data.Metrics[DefinitionHashes.Metrics.SeasonoftheWitchRank].ObjectiveProgress.Progress:n0}",
$"> {playerResponse.Response.Metrics.Data.Metrics[DefinitionHashes.Metrics.SeasonoftheWishRank].ObjectiveProgress.Progress:n0}",
true);
embed.AddField("Raid Completions", $"> {GetRaidCompletions(playerResponse.Response.Metrics.Data):n0}", true);
embed.AddField("Triumph Score",
Expand Down Expand Up @@ -345,7 +345,9 @@ private static int GetRaidCompletions(DestinyMetricsComponent metricsData)
DefinitionHashes.Metrics.DeepStoneCryptCompletions,
DefinitionHashes.Metrics.VaultofGlassCompletions,
DefinitionHashes.Metrics.VowoftheDiscipleCompletions,
DefinitionHashes.Metrics.KingsFallCompletions
DefinitionHashes.Metrics.KingsFallCompletions,
DefinitionHashes.Metrics.RootofNightmaresCompletions,
DefinitionHashes.Metrics.CrotasEndCompletions
};

return raidList.Where(u => metricsData.Metrics[u].ObjectiveProgress.Progress is not null)
Expand Down Expand Up @@ -376,4 +378,4 @@ private static string GetReportLink(BungieMembershipType membershipType, long me

return $"https://{reportType}.report/{platform}/{membershipId}";
}
}
}
2 changes: 1 addition & 1 deletion Felicity/DiscordCommands/Interactions/LootCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@ private static string BuildDrops(IBungieClient bungieClient, List<uint> tableLoo

return result;
}
}
}
2 changes: 1 addition & 1 deletion Felicity/DiscordCommands/Interactions/MementoCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,4 @@ private static string GetMementoSourceString(MementoSource memSource)

return goodSource;
}
}
}
2 changes: 1 addition & 1 deletion Felicity/DiscordCommands/Interactions/MetricsCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ public async Task Metrics(

await FollowupAsync(embed: embed.Build());
}
}
}
2 changes: 1 addition & 1 deletion Felicity/DiscordCommands/Interactions/NewsCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,4 @@ private async Task<IEnumerable<ContentItemPublicContract>> FillTwabList(string q

return twabList;
}
}
}
2 changes: 1 addition & 1 deletion Felicity/DiscordCommands/Interactions/PbCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ public async Task PbRaids()

await FollowupAsync(embed: embed.Build());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,4 @@ private string GetPerkList(Roll requestedRoll)

return perkList.ToString();
}
}
}
7 changes: 3 additions & 4 deletions Felicity/DiscordCommands/Interactions/ServerCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Discord.Interactions;
using Discord.WebSocket;
using Felicity.Models;
using Felicity.Services;
using Felicity.Util;

// ReSharper disable StringLiteralTypo
Expand Down Expand Up @@ -101,7 +100,7 @@ private static string GetChannel(SocketGuild guild, ulong? channelId)
return channelId == null ? "not set." : guild.GetTextChannel((ulong)channelId).Mention;
}

[RequireContext(ContextType.Guild)]
/*[RequireContext(ContextType.Guild)]
[Preconditions.RequireBotModerator]
[Group("twitch", "Manage Twitch stream notifications for this server.")]
public class TwitchNotifications : InteractionModuleBase<ShardedInteractionContext>
Expand Down Expand Up @@ -172,5 +171,5 @@ public async Task ServerTwitchRemove(
await FollowupAsync($"Successfully removed {Format.Bold(stream.TwitchName)}'s stream from server.",
ephemeral: true);
}
}
}
}*/
}
2 changes: 1 addition & 1 deletion Felicity/DiscordCommands/Interactions/StaffCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ namespace Felicity.DiscordCommands.Interactions;
[Preconditions.RequireBotModerator]
public class StaffCommands : InteractionModuleBase<ShardedInteractionContext>
{
}
}
2 changes: 1 addition & 1 deletion Felicity/DiscordCommands/Interactions/SupportCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ public async Task Support()

await FollowupAsync(embed: embed.Build());
}
}
}
2 changes: 1 addition & 1 deletion Felicity/DiscordCommands/Interactions/UserCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ public async Task UserRemove()

await FollowupAsync(embed: embed.Build(), ephemeral: true);
}
}
}
2 changes: 1 addition & 1 deletion Felicity/DiscordCommands/Interactions/VendorCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,4 +259,4 @@ or DefinitionHashes.InventoryItems.ResetRank_1514009869

await FollowupAsync(embed: embed.Build());
}
}
}
2 changes: 1 addition & 1 deletion Felicity/DiscordCommands/Text/EmblemTextCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ private List<uint> FetchAllEmblems()

return knownEmblems;
}
}
}
2 changes: 1 addition & 1 deletion Felicity/DiscordCommands/Text/TestingTextCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -371,4 +371,4 @@ public async Task UpdateManifest()
await msg.ModifyAsync(x => x.Content = "No update found.");
}
}
}
}
2 changes: 1 addition & 1 deletion Felicity/Extensions/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ public static IServiceCollection AddDiscord(
.AddSingleton<InteractiveService>()
.AddSingleton(textCommandService);
}
}
}
22 changes: 11 additions & 11 deletions Felicity/Felicity.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Discord.Net" Version="3.12.0" />
<PackageReference Include="DotNetBungieAPI" Version="2.12.0" />
<PackageReference Include="Discord.Net" Version="3.13.0" />
<PackageReference Include="DotNetBungieAPI" Version="2.12.2" />
<PackageReference Include="DotNetBungieAPI.AspNet.Security.OAuth.Providers" Version="1.0.2" />
<PackageReference Include="DotNetBungieAPI.DefinitionProvider.Sqlite" Version="1.5.2" />
<PackageReference Include="DotNetBungieAPI.HashReferences" Version="1.21.0" />
<PackageReference Include="DotNetBungieAPI.Models" Version="2.11.2" />
<PackageReference Include="DotNetBungieAPI.Service.Abstractions" Version="2.11.0" />
<PackageReference Include="DotNetBungieAPI.DefinitionProvider.Sqlite" Version="1.5.3" />
<PackageReference Include="DotNetBungieAPI.HashReferences" Version="1.22.1" />
<PackageReference Include="DotNetBungieAPI.Models" Version="2.11.3" />
<PackageReference Include="DotNetBungieAPI.Service.Abstractions" Version="2.11.1" />
<PackageReference Include="Fergun.Interactive" Version="1.7.3" />
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.10" />
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0" />
<PackageReference Include="Sentry.AspNetCore" Version="3.39.0" />
<PackageReference Include="Sentry.Serilog" Version="3.39.0" />
<PackageReference Include="Serilog" Version="3.0.1" />
<PackageReference Include="Sentry.AspNetCore" Version="3.41.3" />
<PackageReference Include="Sentry.Serilog" Version="3.41.3" />
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="7.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="TwitchLib" Version="3.5.3" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Felicity/Models/Caches/EmoteCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ public class Emote
public string? Name { get; set; }

public ulong Id { get; set; }
}
}
2 changes: 1 addition & 1 deletion Felicity/Models/Caches/GunsmithCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ public static Embed BuildEmbed(GunsmithCache self, BaseSocketClient discordClien

return gsCache;
}
}
}
2 changes: 1 addition & 1 deletion Felicity/Models/Caches/MementoCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ public enum MementoSource
SeasonRisen,
SeasonHaunted,
ThroneWorld
}
}
2 changes: 1 addition & 1 deletion Felicity/Models/Caches/ModCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,4 @@ private static Task<ModCache> PopulateMods(IBungieClient bungieClient, ModCache

return Task.FromResult(modCache);
}
}
}
2 changes: 1 addition & 1 deletion Felicity/Models/Caches/XurCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,4 +338,4 @@ public static void ClearCache()
if (enumerateFile.StartsWith("xurCache"))
File.Delete(enumerateFile);
}
}
}
Loading

0 comments on commit 0ba8edb

Please sign in to comment.