From 4d620d73c1bd92044aa34b1b1799138f295f28ec Mon Sep 17 00:00:00 2001 From: Winston H <56998716+winstxnhdw@users.noreply.github.com> Date: Wed, 14 Feb 2024 01:40:21 +0800 Subject: [PATCH] refactor: move obvious conditionals to the start --- lc-hax/Scripts/Commands/ExperienceCommand.cs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lc-hax/Scripts/Commands/ExperienceCommand.cs b/lc-hax/Scripts/Commands/ExperienceCommand.cs index b5090b59..93774451 100644 --- a/lc-hax/Scripts/Commands/ExperienceCommand.cs +++ b/lc-hax/Scripts/Commands/ExperienceCommand.cs @@ -1,16 +1,17 @@ using Hax; enum Rank { - INTERN = 0, - PART_TIME = 1, - EMPLOYEE = 2, - LEADER = 3, - BOSS = 4 + INTERN, + PART_TIME, + EMPLOYEE, + LEADER, + BOSS } [Command("xp")] internal class ExperienceCommand { public void Execute(StringArray args) { + if (Helper.HUDManager is not HUDManager hudManager) return; if (args.Length is 0) { Chat.Print("Usage: xp "); return; @@ -21,11 +22,6 @@ public void Execute(StringArray args) { return; } - if (Helper.HUDManager is not HUDManager hudManager) { - Chat.Print("HUDManager is not found"); - return; - } - hudManager.localPlayerXP += amount; Rank rank = hudManager.localPlayerXP switch {