Skip to content

Commit

Permalink
refactor: move obvious conditionals to the start
Browse files Browse the repository at this point in the history
  • Loading branch information
winstxnhdw committed Feb 13, 2024
1 parent fc8a001 commit 4d620d7
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions lc-hax/Scripts/Commands/ExperienceCommand.cs
Original file line number Diff line number Diff line change
@@ -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 <amount>");
return;
Expand All @@ -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 {
Expand Down

0 comments on commit 4d620d7

Please sign in to comment.