From 3e4734e89e14a3f1d3d5d59b61113ae460181913 Mon Sep 17 00:00:00 2001 From: MSWS Date: Tue, 17 Dec 2024 15:54:58 -0800 Subject: [PATCH 1/2] Close smoke menu if explicitly closed --- src/GangsImpl/Stats/Perk/Smoke/SmokeColorMenu.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GangsImpl/Stats/Perk/Smoke/SmokeColorMenu.cs b/src/GangsImpl/Stats/Perk/Smoke/SmokeColorMenu.cs index f83fe9c..494f58b 100644 --- a/src/GangsImpl/Stats/Perk/Smoke/SmokeColorMenu.cs +++ b/src/GangsImpl/Stats/Perk/Smoke/SmokeColorMenu.cs @@ -41,8 +41,9 @@ override protected Task> GetItems(PlayerWrapper player) { override protected Task HandleItemSelection(PlayerWrapper player, List items, int selectedIndex) { - commands.ProcessCommand(player, CommandCallingContext.Chat, "css_gang", - "smokecolor", items[selectedIndex].ToString()); + if (selectedIndex > 0) + commands.ProcessCommand(player, CommandCallingContext.Chat, "css_gang", + "smokecolor", items[selectedIndex].ToString()); Close(player); return Task.CompletedTask; } From 9907a80f06c501309c7977ac331cae997b5981ed Mon Sep 17 00:00:00 2001 From: MSWS Date: Tue, 17 Dec 2024 21:38:36 -0800 Subject: [PATCH 2/2] Fix SD smoke color --- src/GangsImpl/AbstractDB/AbstractInstanceManager.cs | 2 +- src/GangsImpl/Stats/Perk/Smoke/SmokeListener.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GangsImpl/AbstractDB/AbstractInstanceManager.cs b/src/GangsImpl/AbstractDB/AbstractInstanceManager.cs index 440b5ad..55309cb 100644 --- a/src/GangsImpl/AbstractDB/AbstractInstanceManager.cs +++ b/src/GangsImpl/AbstractDB/AbstractInstanceManager.cs @@ -26,7 +26,7 @@ public abstract class AbstractInstanceManager(string connectionString, $"SELECT {(typeof(TV).IsBasicallyPrimitive() ? statId : GetFieldNames())} FROM {table_prefix}_{statId} WHERE {PrimaryKey} = @{PrimaryKey}", dynamic); if (result == null) return (true, result); - if (!cache.ContainsKey(statId)) cache[statId] = new(); + if (!cache.ContainsKey(statId)) cache[statId] = new Dictionary(); cache[statId][key] = result; return (true, result); } catch (InvalidOperationException e) { diff --git a/src/GangsImpl/Stats/Perk/Smoke/SmokeListener.cs b/src/GangsImpl/Stats/Perk/Smoke/SmokeListener.cs index 8a25451..c542839 100644 --- a/src/GangsImpl/Stats/Perk/Smoke/SmokeListener.cs +++ b/src/GangsImpl/Stats/Perk/Smoke/SmokeListener.cs @@ -72,7 +72,7 @@ await gangStats.GetForGang(gang, continue; } - color = data.Equipped.GetColor() ?? data.Equipped.PickRandom(); + color = data.Equipped.GetColor() ?? data.Unlocked.PickRandom(); cachedGangs.Add(player.GangId.Value, color); }