From 6234cfa6ba0c10315d7f1f1b60b6cc94328797c9 Mon Sep 17 00:00:00 2001 From: Marvin Klein Date: Fri, 22 Mar 2024 00:51:44 +0100 Subject: [PATCH] Fixed sorting gencode --- CSGencodes.Core/Models/Weapon.cs | 6 +++++- CSGencodes/Pages/Index.razor | 8 +++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CSGencodes.Core/Models/Weapon.cs b/CSGencodes.Core/Models/Weapon.cs index 2d74fa74..45d94b5a 100644 --- a/CSGencodes.Core/Models/Weapon.cs +++ b/CSGencodes.Core/Models/Weapon.cs @@ -53,6 +53,9 @@ public string GetGencode(decimal @float, int pattern, List stick var sortedStickers = stickers.OrderBy(x => x.PosId).ToList(); + // We have two stickers, both same position + + int addedStickers = 0; int currentPos = 0; foreach (var sticker in sortedStickers) { @@ -61,7 +64,7 @@ public string GetGencode(decimal @float, int pattern, List stick break; } - while (sticker.PosId != currentPos) + while (sticker.PosId != (currentPos - addedStickers)) { sb.Append(" 0 0.00"); currentPos++; @@ -69,6 +72,7 @@ public string GetGencode(decimal @float, int pattern, List stick sb.Append($" {sticker.gen_id} {sticker.Scratched.ToString("0.00", CultureInfo.InvariantCulture)}"); currentPos++; + addedStickers++; } string gencode = sb.ToString(); diff --git a/CSGencodes/Pages/Index.razor b/CSGencodes/Pages/Index.razor index f1e4fc69..a8a1cb25 100644 --- a/CSGencodes/Pages/Index.razor +++ b/CSGencodes/Pages/Index.razor @@ -15,12 +15,14 @@ @if (SelectedWeapon is not null) { var inspectLink = inspectService.GenerateInspectLink(SelectedWeapon, Float, Pattern, SelectedStickers); - +
+
+ @if (!inspectLink.commandMode) { Inspect @@ -32,7 +34,7 @@
- + if (inspectLink.commandMode) { @@ -40,7 +42,7 @@