|
10 | 10 |
|
11 | 11 | namespace UncomplicatedEscapeZones.Managers; |
12 | 12 |
|
13 | | -public class EscapeManager |
| 13 | +public static class EscapeManager |
14 | 14 | { |
15 | 15 | public static KeyValuePair<bool, object?>? ParseEscapeRole( |
16 | 16 | Dictionary<string, List<Dictionary<string, string>>> roleAfterEscape, Player player) |
@@ -103,22 +103,33 @@ public class EscapeManager |
103 | 103 |
|
104 | 104 | LogManager.Debug($"Parsing escape condition: {kvp.Key} -> {kvp.Value}"); |
105 | 105 |
|
106 | | - switch (elements[2]) |
| 106 | + switch (elements[2].ToLowerInvariant()) |
107 | 107 | { |
108 | | - case "InternalFaction" or "IF" when Enum.TryParse(elements[3], out Faction faction): |
109 | | - asCuffedByInternalFaction.TryAdd(faction, data); |
| 108 | + case "internalfaction" or "if": |
| 109 | + if (Enum.TryParse(elements[3], true, out Faction faction)) |
| 110 | + asCuffedByInternalFaction.TryAdd(faction, data); |
| 111 | + else |
| 112 | + LogManager.Warn($"Failed to parse faction '{elements[3]}' for escape condition '{kvp.Key}'."); |
110 | 113 | break; |
111 | | - case "InternalTeam" or "IT" when Enum.TryParse(elements[3], out Team team): |
112 | | - asCuffedByInternalTeam.TryAdd(team, data); |
| 114 | + case "internalteam" or "it": |
| 115 | + if (Enum.TryParse(elements[3], true, out Team team)) |
| 116 | + asCuffedByInternalTeam.TryAdd(team, data); |
| 117 | + else |
| 118 | + LogManager.Warn($"Failed to parse team '{elements[3]}' for escape condition '{kvp.Key}'."); |
113 | 119 | break; |
114 | | - case "InternalRole" or "IR" when Enum.TryParse(elements[3], out RoleTypeId id): |
115 | | - asCuffedByInternalRole.TryAdd(id, data); |
| 120 | + case "internalrole" or "ir": |
| 121 | + if (Enum.TryParse(elements[3], true, out RoleTypeId id)) |
| 122 | + asCuffedByInternalRole.TryAdd(id, data); |
| 123 | + else |
| 124 | + LogManager.Warn($"Failed to parse role '{elements[3]}' for escape condition '{kvp.Key}'."); |
116 | 125 | break; |
117 | | - case "CustomRole" or "CR" |
118 | | - when int.TryParse(elements[3], out int id) && UCR.TryGetCustomRole(id, out _): |
119 | | - asCuffedByCustomRole.TryAdd(id, data); |
| 126 | + case "customrole" or "cr": |
| 127 | + if (int.TryParse(elements[3], out int cid) && UCR.TryGetCustomRole(cid, out _)) |
| 128 | + asCuffedByCustomRole.TryAdd(cid, data); |
| 129 | + else |
| 130 | + LogManager.Warn($"Failed to parse custom role id '{elements[3]}' for escape condition '{kvp.Key}'."); |
120 | 131 | break; |
121 | | - case "all" or "ALL": |
| 132 | + case "all": |
122 | 133 | defaultCuffedValue = data; |
123 | 134 | break; |
124 | 135 | default: |
|
0 commit comments