From f630ec2a2da4576cd94b3ae5b062d067c852c406 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Sun, 18 May 2025 20:16:04 -0700 Subject: [PATCH] fix: Fixes command conditional comparisons (#2191) --- .../Compilers/ConditionalCompiler.cs | 49 +++---------------- 1 file changed, 7 insertions(+), 42 deletions(-) diff --git a/Projects/UOContent/Commands/Generic/Extensions/Compilers/ConditionalCompiler.cs b/Projects/UOContent/Commands/Generic/Extensions/Compilers/ConditionalCompiler.cs index 18e2a6505..416d4bc46 100644 --- a/Projects/UOContent/Commands/Generic/Extensions/Compilers/ConditionalCompiler.cs +++ b/Projects/UOContent/Commands/Generic/Extensions/Compilers/ConditionalCompiler.cs @@ -279,53 +279,25 @@ namespace Server.Commands.Generic } case StringOperator.Equal: { - if (m_IgnoreCase) - { - methodName = "InsensitiveEquals"; - } - else - { - methodName = "EqualsOrdinal"; - } + methodName = m_IgnoreCase ? "InsensitiveEquals" : "EqualsOrdinal"; break; } case StringOperator.Contains: { - if (m_IgnoreCase) - { - methodName = "InsensitiveContains"; - } - else - { - methodName = "ContainsOrdinal"; - } + methodName = m_IgnoreCase ? "InsensitiveContains" : "ContainsOrdinal"; break; } case StringOperator.StartsWith: { - if (m_IgnoreCase) - { - methodName = "InsensitiveStartsWith"; - } - else - { - methodName = "StartsWithOrdinal"; - } + methodName = m_IgnoreCase ? "InsensitiveStartsWith" : "StartsWithOrdinal"; break; } case StringOperator.EndsWith: { - if (m_IgnoreCase) - { - methodName = "InsensitiveEndsWith"; - } - else - { - methodName = "EndsWithOrdinal"; - } + methodName = m_IgnoreCase ? "InsensitiveEndsWith" : "EndsWithOrdinal"; break; } @@ -342,11 +314,7 @@ namespace Server.Commands.Generic methodName, BindingFlags.Public | BindingFlags.Static, null, - new[] - { - typeof(string), - typeof(string) - }, + [typeof(string), typeof(string)], null ) ); @@ -380,12 +348,9 @@ namespace Server.Commands.Generic emitter.BeginCall( type.GetMethod( methodName, - BindingFlags.Public | BindingFlags.Instance, + BindingFlags.Public | BindingFlags.Static, null, - new[] - { - typeof(string) - }, + [typeof(string), typeof(string)], null ) );