From d3c90ab59fc4e8a2a74d7b678249c98ac3ac494d Mon Sep 17 00:00:00 2001
From: Toastie <toastie@toastiet0ast.com>
Date: Tue, 1 Apr 2025 13:24:46 +1300
Subject: [PATCH] fishlb will now compare unique fish caught, instead of total
 catches

---
 src/EllieBot/Modules/Games/Fish/FishService.cs      | 9 +++++----
 src/EllieBot/Modules/Games/Fish/FishingCommands.cs  | 8 +++++++-
 src/EllieBot/strings/responses/responses.en-US.json | 1 +
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/EllieBot/Modules/Games/Fish/FishService.cs b/src/EllieBot/Modules/Games/Fish/FishService.cs
index 09deb17..90fc2e9 100644
--- a/src/EllieBot/Modules/Games/Fish/FishService.cs
+++ b/src/EllieBot/Modules/Games/Fish/FishService.cs
@@ -469,22 +469,23 @@ public sealed class FishService(
         return catches;
     }
 
-    public async Task<IReadOnlyCollection<(ulong UserId, int Catches)>> GetFishLbAsync(int page)
+    public async Task<IReadOnlyCollection<(ulong UserId, int Catches, int Unique)>> GetFishLbAsync(int page)
     {
         await using var ctx = db.GetDbContext();
 
         var result = await ctx.GetTable<FishCatch>()
             .GroupBy(x => x.UserId)
-            .OrderByDescending(x => x.Sum(x => x.Count))
+            .OrderByDescending(x => x.Count())
             .Skip(page * 10)
             .Take(10)
             .Select(x => new
             {
                 UserId = x.Key,
-                Catches = x.Sum(x => x.Count)
+                Catches = x.Sum(x => x.Count),
+                Unique = x.Count()
             })
             .ToListAsyncLinqToDB()
-            .Fmap(x => x.Map(y => (y.UserId, y.Catches)));
+            .Fmap(x => x.Map(y => (y.UserId, y.Catches, y.Unique)).ToList());
 
         return result;
     }
diff --git a/src/EllieBot/Modules/Games/Fish/FishingCommands.cs b/src/EllieBot/Modules/Games/Fish/FishingCommands.cs
index eb62b9f..fadf4bf 100644
--- a/src/EllieBot/Modules/Games/Fish/FishingCommands.cs
+++ b/src/EllieBot/Modules/Games/Fish/FishingCommands.cs
@@ -235,8 +235,14 @@ public partial class Games
                             ? ud.ToString()
                             : data.UserId.ToString();
 
+                        var text =
+                            $"""
+                             {GetText(strs.fish_unique(Format.Bold(data.Unique.ToString())))}
+                               *{GetText(strs.fish_catches(data.Catches))}*
+                             """;
+
                         eb.AddField("#" + (page * 9 + i + 1) + " | " + user,
-                            GetText(strs.fish_catches(Format.Bold(data.Catches.ToString()))),
+                            text,
                             false);
                     }
 
diff --git a/src/EllieBot/strings/responses/responses.en-US.json b/src/EllieBot/strings/responses/responses.en-US.json
index fea5dad..74d556e 100644
--- a/src/EllieBot/strings/responses/responses.en-US.json
+++ b/src/EllieBot/strings/responses/responses.en-US.json
@@ -1260,5 +1260,6 @@
   "fish_inv_title": "Fishing Inventory",
   "fish_cant_uneq_potion": "You can't unequip a potion.",
   "fish_lb_title": "Fishing Leaderboard",
+  "fish_unique": "Caught {0} unique fish",
   "fish_catches": "{0} catches"
 }
\ No newline at end of file