From c31bf20d0e96dcc93c4c0f8737eaeb9cae40aa90 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Sat, 13 Nov 2021 13:38:01 -0800 Subject: [PATCH 01/16] feat: Updates to .NET 6 (#843) * Fixes an issue with moving directories across volumes * Removes usages of WebClient * Removes usages of Cryptographic Providers Note: Even though .NET 6 introduces Xoshiro RNG, there is no way to control the seed. I'll do some reconciliation of Xoshiro so it functions closer to the built in one. For the most part, it has parity though. Benchmarks show there is nothing odd about the implementations, they are within 1ns of each other. --- .github/workflows/build-test.yml | 4 +- Directory.Build.props | 4 +- Projects/Benchmarks/Benchmarks.csproj | 2 +- .../Collections/BenchmarkOrderedHashSet.cs | 2 +- .../FeatureFlags/BenchmarkFeatureFlags.cs | 90 ------------------- .../Benchmarks/FeatureFlags/FeatureFlag.cs | 9 -- .../Logging/BenchmarkConsoleLogging.cs | 2 +- .../Packets/BenchmarkOutgoingGumpPacket.cs | 2 +- .../Packets/BenchmarkPacketBroadcast.cs | 2 +- .../Benchmarks/Rng/BenchmarkXoshiro.cs | 46 ++++++++++ .../Benchmarks/Text/BenchmarkTextEncoding.cs | 2 +- .../Utilities/BenchmarkStringHelpers.cs | 2 +- Projects/Benchmarks/Program.cs | 4 +- .../SerializableMigrationSchema.cs | 3 +- .../Application.cs | 3 +- Projects/Server.Tests/Server.Tests.csproj | 2 +- Projects/Server/Json/JsonConfig.cs | 2 +- Projects/Server/Random/SecureRandom.cs | 4 +- Projects/Server/Utilities/PathUtility.cs | 19 ++++ Projects/Server/World/World.cs | 2 +- .../Security/PasswordProtectionTest.cs | 55 +++++++++--- .../UOContent.Tests/UOContent.Tests.csproj | 2 +- .../Accounting/Security/AccountSecurity.cs | 6 +- ....cs => HashAlgorithmPasswordProtection.cs} | 16 ++-- .../Security/MD5PasswordProtection.cs | 38 -------- .../Security/SHA1PasswordProtection.cs | 38 -------- Projects/UOContent/Compression/TarArchive.cs | 17 +++- Projects/UOContent/Compression/ZstdArchive.cs | 1 + Projects/UOContent/Misc/ProfessionInfo.cs | 2 +- Projects/UOContent/Misc/ServerList.cs | 10 ++- Projects/UOContent/Mobiles/Townfolk/Noble.cs | 1 - Projects/UOContent/UOContent.csproj | 2 +- Projects/UOContent/World Saves/AutoArchive.cs | 4 +- README.md | 11 ++- azure-pipelines.yml | 14 ++- 35 files changed, 192 insertions(+), 231 deletions(-) delete mode 100644 Projects/Benchmarks/Benchmarks/FeatureFlags/BenchmarkFeatureFlags.cs delete mode 100644 Projects/Benchmarks/Benchmarks/FeatureFlags/FeatureFlag.cs create mode 100644 Projects/Benchmarks/Benchmarks/Rng/BenchmarkXoshiro.cs rename Projects/UOContent/Accounting/Security/{SHA2PasswordProtection.cs => HashAlgorithmPasswordProtection.cs} (64%) delete mode 100644 Projects/UOContent/Accounting/Security/MD5PasswordProtection.cs delete mode 100644 Projects/UOContent/Accounting/Security/SHA1PasswordProtection.cs diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index cf746c82e..3a2b28871 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -23,10 +23,10 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 # avoid shallow clone so nbgv can do its work. - - name: Setup .NET 5 + - name: Setup .NET 6 uses: actions/setup-dotnet@v1 with: - dotnet-version: 5.0.401 + dotnet-version: 6.0.100 - name: Build run: ./publish.cmd - name: Test diff --git a/Directory.Build.props b/Directory.Build.props index 0ac231599..7ebed0b53 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -4,7 +4,7 @@ Kamron Batman ModernUO 2019-2020 - net5.0 + net6.0 x64 x64 preview @@ -58,7 +58,7 @@ - 3.4.240 + 3.4.244 all diff --git a/Projects/Benchmarks/Benchmarks.csproj b/Projects/Benchmarks/Benchmarks.csproj index 2ed8e89fd..eff9ed660 100644 --- a/Projects/Benchmarks/Benchmarks.csproj +++ b/Projects/Benchmarks/Benchmarks.csproj @@ -1,7 +1,7 @@ Exe - net5.0 + net6.0 x64 x64 9 diff --git a/Projects/Benchmarks/Benchmarks/Collections/BenchmarkOrderedHashSet.cs b/Projects/Benchmarks/Benchmarks/Collections/BenchmarkOrderedHashSet.cs index 1414c571e..b9ec3d676 100644 --- a/Projects/Benchmarks/Benchmarks/Collections/BenchmarkOrderedHashSet.cs +++ b/Projects/Benchmarks/Benchmarks/Collections/BenchmarkOrderedHashSet.cs @@ -6,7 +6,7 @@ using Server.Collections; namespace Benchmarks { [MemoryDiagnoser] - [SimpleJob(RuntimeMoniker.NetCoreApp50)] + [SimpleJob(RuntimeMoniker.Net60)] public class BenchmarkOrderedHashSet { private readonly string[] _iterations = new string[16]; diff --git a/Projects/Benchmarks/Benchmarks/FeatureFlags/BenchmarkFeatureFlags.cs b/Projects/Benchmarks/Benchmarks/FeatureFlags/BenchmarkFeatureFlags.cs deleted file mode 100644 index fcfffebbe..000000000 --- a/Projects/Benchmarks/Benchmarks/FeatureFlags/BenchmarkFeatureFlags.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using System.Buffers.Binary; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Runtime.Loader; -using System.Security.Cryptography; -using BenchmarkDotNet.Attributes; -using BenchmarkDotNet.Jobs; -using Server; -using Server.Items; - -namespace Benchmarks -{ - [SimpleJob(RuntimeMoniker.NetCoreApp50)] - public class BenchmarkFeatureFlags - { - public Dictionary> m_Dictionary; - public ILookup> m_Lookup; - - public Type[] m_TypesToLookUp; - - [GlobalSetup] - public void Setup() - { - RNGCryptoServiceProvider csp = new RNGCryptoServiceProvider(); - - string file = Path.Join(AppDomain.CurrentDomain.BaseDirectory, "UOContent.dll"); - Assembly assembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(file); - - m_Dictionary = new Dictionary>(); - List> m_Types = new List>(); - m_TypesToLookUp = new Type[100]; - - foreach (var type in assembly.GetTypes()) - { - if (typeof(Item).IsAssignableFrom(type)) - { - m_Dictionary.Add(type, new FeatureFlag()); - m_Types.Add(new FeatureFlag{Type = type}); - } - } - - Console.WriteLine("Dictionary Size: {0}", m_Dictionary.Count); - Console.WriteLine("Lookup Size: {0}", m_Types.Count); - - m_Dictionary.TrimExcess(); - m_Lookup = m_Types.ToLookup(f => f.Type); - Span bytes = stackalloc byte[4]; - - for (int i = 0; i < 100; i++) - { - csp.GetBytes(bytes); - m_TypesToLookUp[i] = m_Types[(int)(BinaryPrimitives.ReadUInt32BigEndian(bytes) % m_Types.Count)].Type; - } - } - - [Benchmark] - public FeatureFlag TestDictionary() - { - for (int i = 0; i < 100; i++) - { - m_Dictionary.TryGetValue(typeof(ExplosionPotion), out var ff); - if (i == 99) - { - return ff; - } - } - - return null; - } - - [Benchmark] - public FeatureFlag TestLookup() - { - FeatureFlag ff; - for (int i = 0; i < 100; i++) - { - ff = m_Lookup[typeof(ExplosionPotion)].GetEnumerator().Current; - if (i == 99) - { - return ff; - } - } - - return null; - } - } -} diff --git a/Projects/Benchmarks/Benchmarks/FeatureFlags/FeatureFlag.cs b/Projects/Benchmarks/Benchmarks/FeatureFlags/FeatureFlag.cs deleted file mode 100644 index f8b04716c..000000000 --- a/Projects/Benchmarks/Benchmarks/FeatureFlags/FeatureFlag.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace Server -{ - public class FeatureFlag where T : Item - { - public Type Type { get; set; } - } -} diff --git a/Projects/Benchmarks/Benchmarks/Logging/BenchmarkConsoleLogging.cs b/Projects/Benchmarks/Benchmarks/Logging/BenchmarkConsoleLogging.cs index 62bc428fa..f794d64b4 100644 --- a/Projects/Benchmarks/Benchmarks/Logging/BenchmarkConsoleLogging.cs +++ b/Projects/Benchmarks/Benchmarks/Logging/BenchmarkConsoleLogging.cs @@ -6,7 +6,7 @@ using Serilog.Core; namespace Benchmarks { - [SimpleJob(RuntimeMoniker.NetCoreApp50)] + [SimpleJob(RuntimeMoniker.Net60)] public class BenchmarkConsoleLogging { private const string text = "Sample message"; diff --git a/Projects/Benchmarks/Benchmarks/Packets/BenchmarkOutgoingGumpPacket.cs b/Projects/Benchmarks/Benchmarks/Packets/BenchmarkOutgoingGumpPacket.cs index 0225af652..114cac192 100644 --- a/Projects/Benchmarks/Benchmarks/Packets/BenchmarkOutgoingGumpPacket.cs +++ b/Projects/Benchmarks/Benchmarks/Packets/BenchmarkOutgoingGumpPacket.cs @@ -12,7 +12,7 @@ using Server.Tests.Network; namespace Benchmarks { [MemoryDiagnoser] - [SimpleJob(RuntimeMoniker.NetCoreApp50)] + [SimpleJob(RuntimeMoniker.Net60)] public class OutgoingGumpPacketBenchmarks { private static readonly byte[] _layoutBuffer = GC.AllocateUninitializedArray(0x20000); diff --git a/Projects/Benchmarks/Benchmarks/Packets/BenchmarkPacketBroadcast.cs b/Projects/Benchmarks/Benchmarks/Packets/BenchmarkPacketBroadcast.cs index 2535dca0f..4db59d432 100644 --- a/Projects/Benchmarks/Benchmarks/Packets/BenchmarkPacketBroadcast.cs +++ b/Projects/Benchmarks/Benchmarks/Packets/BenchmarkPacketBroadcast.cs @@ -7,7 +7,7 @@ using Server.Network; namespace Benchmarks { - [SimpleJob(RuntimeMoniker.NetCoreApp50)] + [SimpleJob(RuntimeMoniker.Net60)] public class BenchmarkPacketBroadcast { public static int SendUnicodeMessage( diff --git a/Projects/Benchmarks/Benchmarks/Rng/BenchmarkXoshiro.cs b/Projects/Benchmarks/Benchmarks/Rng/BenchmarkXoshiro.cs new file mode 100644 index 000000000..caced76b3 --- /dev/null +++ b/Projects/Benchmarks/Benchmarks/Rng/BenchmarkXoshiro.cs @@ -0,0 +1,46 @@ +using System; +using BenchmarkDotNet.Attributes; +using BenchmarkDotNet.Jobs; +using Server.Random; + +namespace Benchmarks.Benchmarks.Rng +{ + [MemoryDiagnoser] + [SimpleJob(RuntimeMoniker.Net60)] + public class BenchmarkXoshiro + { + private Random _random; + private Xoshiro256PlusPlus _xoshiro256PlusPlus; + + [GlobalSetup] + public void Setup() + { + _xoshiro256PlusPlus = new Xoshiro256PlusPlus(); + _random = new Random(); + } + + [Benchmark] + public int SystemRandomULong() => _random.Next(10000); + + [Benchmark] + public int XoshiroRandomULong() => _xoshiro256PlusPlus.Next(10000); + + [Benchmark] + public double SystemRandomDouble() => _random.NextDouble(); + + [Benchmark] + public double XoshiroRandomDouble() => _xoshiro256PlusPlus.NextDouble(); + + [Benchmark] + public int SystemRandomMinMax() => _random.Next(5000, 85000); + + [Benchmark] + public int XoshiroRandomMinMax() + { + const int min = 5000; + const int max = 85000; + + return min + (int)_xoshiro256PlusPlus.Next((uint)(max - min + 1)); + } + } +} diff --git a/Projects/Benchmarks/Benchmarks/Text/BenchmarkTextEncoding.cs b/Projects/Benchmarks/Benchmarks/Text/BenchmarkTextEncoding.cs index 5594bf937..b2f716861 100644 --- a/Projects/Benchmarks/Benchmarks/Text/BenchmarkTextEncoding.cs +++ b/Projects/Benchmarks/Benchmarks/Text/BenchmarkTextEncoding.cs @@ -5,7 +5,7 @@ using Server.Text; namespace Benchmarks.BenchmarkText { [MemoryDiagnoser] - [SimpleJob(RuntimeMoniker.NetCoreApp50)] + [SimpleJob(RuntimeMoniker.Net60)] public class BenchmarkTextEncoding { private const string text = diff --git a/Projects/Benchmarks/Benchmarks/Utilities/BenchmarkStringHelpers.cs b/Projects/Benchmarks/Benchmarks/Utilities/BenchmarkStringHelpers.cs index 01cf5bb3c..55e4fd289 100644 --- a/Projects/Benchmarks/Benchmarks/Utilities/BenchmarkStringHelpers.cs +++ b/Projects/Benchmarks/Benchmarks/Utilities/BenchmarkStringHelpers.cs @@ -7,7 +7,7 @@ using Server.Buffers; namespace Benchmarks.BenchmarkUtilities { [MemoryDiagnoser] - [SimpleJob(RuntimeMoniker.NetCoreApp50)] + [SimpleJob(RuntimeMoniker.Net60)] public class BenchmarkStringHelpers { private readonly string[] names = diff --git a/Projects/Benchmarks/Program.cs b/Projects/Benchmarks/Program.cs index f28cc3e6f..845354d56 100644 --- a/Projects/Benchmarks/Program.cs +++ b/Projects/Benchmarks/Program.cs @@ -1,4 +1,5 @@ using BenchmarkDotNet.Running; +using Benchmarks.Benchmarks.Rng; namespace Benchmarks { @@ -10,10 +11,11 @@ namespace Benchmarks // var packetConstruction = BenchmarkRunner.Run(); // var broadcast = BenchmarkRunner.Run(); // var stringHelpers = BenchmarkRunner.Run(); - var indexList = BenchmarkRunner.Run(); + // var indexList = BenchmarkRunner.Run(); // var textEncoding = BenchmarkRunner.Run(); // var logging = BenchmarkRunner.Run(); // var gumpPacket = BenchmarkRunner.Run(); + var rngTest = BenchmarkRunner.Run(); } } } diff --git a/Projects/SerializationGenerator/SerializableMigration/SerializableMigrationSchema.cs b/Projects/SerializationGenerator/SerializableMigration/SerializableMigrationSchema.cs index 52b94d505..2f8613456 100644 --- a/Projects/SerializationGenerator/SerializableMigration/SerializableMigrationSchema.cs +++ b/Projects/SerializationGenerator/SerializableMigration/SerializableMigrationSchema.cs @@ -18,6 +18,7 @@ using System.IO; using System.Linq; using System.Text; using System.Text.Json; +using System.Text.Json.Serialization; using System.Text.RegularExpressions; using Microsoft.CodeAnalysis; @@ -30,7 +31,7 @@ namespace SerializableMigration { WriteIndented = true, AllowTrailingCommas = true, - IgnoreNullValues = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, ReadCommentHandling = JsonCommentHandling.Skip }; diff --git a/Projects/SerializationSchemaGenerator/Application.cs b/Projects/SerializationSchemaGenerator/Application.cs index e8634aab7..eb6946787 100644 --- a/Projects/SerializationSchemaGenerator/Application.cs +++ b/Projects/SerializationSchemaGenerator/Application.cs @@ -17,6 +17,7 @@ using System; using System.Collections.Immutable; using System.IO; using System.Text.Json; +using System.Text.Json.Serialization; using System.Threading.Tasks; using SerializationGenerator; @@ -61,7 +62,7 @@ namespace SerializationSchemaGenerator { WriteIndented = true, AllowTrailingCommas = true, - IgnoreNullValues = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, ReadCommentHandling = JsonCommentHandling.Skip }; diff --git a/Projects/Server.Tests/Server.Tests.csproj b/Projects/Server.Tests/Server.Tests.csproj index b6339a9a0..46a5a0981 100644 --- a/Projects/Server.Tests/Server.Tests.csproj +++ b/Projects/Server.Tests/Server.Tests.csproj @@ -3,7 +3,7 @@ false - + diff --git a/Projects/Server/Json/JsonConfig.cs b/Projects/Server/Json/JsonConfig.cs index 163776d84..7bddd24c8 100644 --- a/Projects/Server/Json/JsonConfig.cs +++ b/Projects/Server/Json/JsonConfig.cs @@ -34,7 +34,7 @@ namespace Server.Json { WriteIndented = true, AllowTrailingCommas = true, - IgnoreNullValues = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, ReadCommentHandling = JsonCommentHandling.Skip, Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping }; diff --git a/Projects/Server/Random/SecureRandom.cs b/Projects/Server/Random/SecureRandom.cs index 284502d1b..30006b871 100644 --- a/Projects/Server/Random/SecureRandom.cs +++ b/Projects/Server/Random/SecureRandom.cs @@ -25,13 +25,13 @@ namespace Server { private RandomNumberGenerator m_Random; - public RandomNumberGenerator Generator => m_Random ??= new RNGCryptoServiceProvider(); + public RandomNumberGenerator Generator => m_Random ??= RandomNumberGenerator.Create(); [MethodImpl(MethodImplOptions.AggressiveInlining)] public override ulong NextULong() { Span buffer = stackalloc byte[sizeof(ulong)]; - Generator.GetBytes(buffer); + NextBytes(buffer); return BinaryPrimitives.ReadUInt64BigEndian(buffer); } diff --git a/Projects/Server/Utilities/PathUtility.cs b/Projects/Server/Utilities/PathUtility.cs index d2206143d..6f22c46db 100644 --- a/Projects/Server/Utilities/PathUtility.cs +++ b/Projects/Server/Utilities/PathUtility.cs @@ -63,5 +63,24 @@ namespace Server Utility.RandomBytes(bytes); return EnsureDirectory(Path.Combine(basePath, bytes.ToHexString())); } + + public static void CopyDirectory(string sourcePath, string destinationPath, bool recursive = true) + { + var searchOptions = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly; + foreach (var file in Directory.EnumerateFiles(sourcePath, "*", searchOptions)) + { + var fi = new FileInfo(file); + var relativePath = Path.GetRelativePath(sourcePath, fi.DirectoryName!); + var destFolder = Path.Combine(destinationPath, relativePath); + EnsureDirectory(destFolder); + fi.CopyTo(Path.Combine(destFolder, fi.Name)); + } + } + + public static void MoveDirectory(string sourcePath, string destinationPath) + { + CopyDirectory(sourcePath, destinationPath); + Directory.Delete(sourcePath, true); + } } } diff --git a/Projects/Server/World/World.cs b/Projects/Server/World/World.cs index 02b3013d5..72d21ac2b 100644 --- a/Projects/Server/World/World.cs +++ b/Projects/Server/World/World.cs @@ -421,7 +421,7 @@ namespace Server try { EventSink.InvokeWorldSavePostSnapshot(SavePath, tempPath); - Directory.Move(tempPath, SavePath); + PathUtility.MoveDirectory(tempPath, SavePath); } catch (Exception ex) { diff --git a/Projects/UOContent.Tests/Tests/Accounting/Security/PasswordProtectionTest.cs b/Projects/UOContent.Tests/Tests/Accounting/Security/PasswordProtectionTest.cs index e69e8db6c..380ab8954 100644 --- a/Projects/UOContent.Tests/Tests/Accounting/Security/PasswordProtectionTest.cs +++ b/Projects/UOContent.Tests/Tests/Accounting/Security/PasswordProtectionTest.cs @@ -1,4 +1,5 @@ using System; +using System.Security.Cryptography; using Server.Accounting; using Server.Accounting.Security; using Xunit; @@ -9,12 +10,29 @@ namespace Server.Tests.Accounting.Security { private const string plainPassword = "hello-good-sir"; - [Theory, InlineData(typeof(Argon2PasswordProtection)), InlineData(typeof(PBKDF2PasswordProtection)), - InlineData(typeof(SHA2PasswordProtection)), InlineData(typeof(SHA1PasswordProtection)), - InlineData(typeof(MD5PasswordProtection))] - public void TestValidates(Type protectionType) + [Theory] + [InlineData(typeof(Argon2PasswordProtection), null)] + [InlineData(typeof(PBKDF2PasswordProtection), null)] + [InlineData(typeof(HashAlgorithmPasswordProtection), "MD5")] + [InlineData(typeof(HashAlgorithmPasswordProtection), "SHA1")] + [InlineData(typeof(HashAlgorithmPasswordProtection), "SHA2")] + public void TestValidates(Type protectionType, string algorithmType) { - var passwordProtection = Activator.CreateInstance(protectionType) as IPasswordProtection; + IPasswordProtection passwordProtection; + if (protectionType == typeof(HashAlgorithmPasswordProtection)) + { + passwordProtection = algorithmType switch + { + "SHA1" => HashAlgorithmPasswordProtection.SHA1Instance, + "SHA2" => HashAlgorithmPasswordProtection.SHA2Instance, + _ => HashAlgorithmPasswordProtection.MD5Instance, + }; + } + else + { + passwordProtection = Activator.CreateInstance(protectionType) as IPasswordProtection; + } + if (passwordProtection == null) { Assert.False(true, $"{protectionType.Name} is not an IPasswordProtection."); @@ -25,12 +43,29 @@ namespace Server.Tests.Accounting.Security Assert.True(passwordProtection.ValidatePassword(encryptedPassword, plainPassword)); } - [Theory, InlineData(typeof(Argon2PasswordProtection)), InlineData(typeof(PBKDF2PasswordProtection)), - InlineData(typeof(SHA2PasswordProtection)), InlineData(typeof(SHA1PasswordProtection)), - InlineData(typeof(MD5PasswordProtection))] - public void TestPasswordDoesNotValidate(Type protectionType) + [Theory] + [InlineData(typeof(Argon2PasswordProtection), null)] + [InlineData(typeof(PBKDF2PasswordProtection), null)] + [InlineData(typeof(HashAlgorithmPasswordProtection), "MD5")] + [InlineData(typeof(HashAlgorithmPasswordProtection), "SHA1")] + [InlineData(typeof(HashAlgorithmPasswordProtection), "SHA2")] + public void TestPasswordDoesNotValidate(Type protectionType, string algorithmType) { - var passwordProtection = Activator.CreateInstance(protectionType) as IPasswordProtection; + IPasswordProtection passwordProtection; + if (protectionType == typeof(HashAlgorithmPasswordProtection)) + { + passwordProtection = algorithmType switch + { + "SHA1" => HashAlgorithmPasswordProtection.SHA1Instance, + "SHA2" => HashAlgorithmPasswordProtection.SHA2Instance, + _ => HashAlgorithmPasswordProtection.MD5Instance, + }; + } + else + { + passwordProtection = Activator.CreateInstance(protectionType) as IPasswordProtection; + } + if (passwordProtection == null) { Assert.False(true, $"{protectionType.Name} is not an IPasswordProtection."); diff --git a/Projects/UOContent.Tests/UOContent.Tests.csproj b/Projects/UOContent.Tests/UOContent.Tests.csproj index baa2a972e..fc960bae1 100644 --- a/Projects/UOContent.Tests/UOContent.Tests.csproj +++ b/Projects/UOContent.Tests/UOContent.Tests.csproj @@ -3,7 +3,7 @@ false - + diff --git a/Projects/UOContent/Accounting/Security/AccountSecurity.cs b/Projects/UOContent/Accounting/Security/AccountSecurity.cs index 0725b3af8..b6d697f6a 100644 --- a/Projects/UOContent/Accounting/Security/AccountSecurity.cs +++ b/Projects/UOContent/Accounting/Security/AccountSecurity.cs @@ -55,9 +55,9 @@ namespace Server.Accounting.Security { var passwordProtection = algorithm switch { - PasswordProtectionAlgorithm.MD5 => MD5PasswordProtection.Instance, - PasswordProtectionAlgorithm.SHA1 => SHA1PasswordProtection.Instance, - PasswordProtectionAlgorithm.SHA2 => SHA2PasswordProtection.Instance, + PasswordProtectionAlgorithm.MD5 => HashAlgorithmPasswordProtection.MD5Instance, + PasswordProtectionAlgorithm.SHA1 => HashAlgorithmPasswordProtection.SHA1Instance, + PasswordProtectionAlgorithm.SHA2 => HashAlgorithmPasswordProtection.SHA2Instance, PasswordProtectionAlgorithm.PBKDF2 => PBKDF2PasswordProtection.Instance, PasswordProtectionAlgorithm.Argon2 => Argon2PasswordProtection.Instance, PasswordProtectionAlgorithm.None => throw new Exception("Do not use PasswordProtectionAlgorithm.None"), diff --git a/Projects/UOContent/Accounting/Security/SHA2PasswordProtection.cs b/Projects/UOContent/Accounting/Security/HashAlgorithmPasswordProtection.cs similarity index 64% rename from Projects/UOContent/Accounting/Security/SHA2PasswordProtection.cs rename to Projects/UOContent/Accounting/Security/HashAlgorithmPasswordProtection.cs index 02d333aa2..5a689b3ce 100644 --- a/Projects/UOContent/Accounting/Security/SHA2PasswordProtection.cs +++ b/Projects/UOContent/Accounting/Security/HashAlgorithmPasswordProtection.cs @@ -1,8 +1,8 @@ /************************************************************************* * ModernUO * - * Copyright 2019-2020 - ModernUO Development Team * + * Copyright 2019-2021 - ModernUO Development Team * * Email: hi@modernuo.com * - * File: SHA2PasswordProtection.cs * + * File: HashAlgorithmPasswordProtection.cs * * * * This program is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -19,15 +19,19 @@ using Server.Text; namespace Server.Accounting.Security { - public class SHA2PasswordProtection : IPasswordProtection + public class HashAlgorithmPasswordProtection : IPasswordProtection { - public static IPasswordProtection Instance = new SHA2PasswordProtection(); - private readonly SHA512CryptoServiceProvider m_SHA2HashProvider = new(); + public static IPasswordProtection MD5Instance = new HashAlgorithmPasswordProtection(MD5.Create()); + public static IPasswordProtection SHA1Instance = new HashAlgorithmPasswordProtection(SHA1.Create()); + public static IPasswordProtection SHA2Instance = new HashAlgorithmPasswordProtection(SHA512.Create()); + private readonly HashAlgorithm _hashAlgorithm; + + public HashAlgorithmPasswordProtection(HashAlgorithm hashAlgorithm) => _hashAlgorithm = hashAlgorithm; public string EncryptPassword(string plainPassword) { byte[] bytes = plainPassword.AsSpan(0, Math.Min(256, plainPassword.Length)).GetBytesAscii(); - return m_SHA2HashProvider.ComputeHash(bytes).ToHexString(); + return _hashAlgorithm.ComputeHash(bytes).ToHexString(); } public bool ValidatePassword(string encryptedPassword, string plainPassword) => diff --git a/Projects/UOContent/Accounting/Security/MD5PasswordProtection.cs b/Projects/UOContent/Accounting/Security/MD5PasswordProtection.cs deleted file mode 100644 index ba69522d3..000000000 --- a/Projects/UOContent/Accounting/Security/MD5PasswordProtection.cs +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************************* - * ModernUO * - * Copyright 2019-2020 - ModernUO Development Team * - * Email: hi@modernuo.com * - * File: MD5PasswordProtection.cs * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - *************************************************************************/ - -using System; -using System.Security.Cryptography; -using Server.Text; - -namespace Server.Accounting.Security -{ - public class MD5PasswordProtection : IPasswordProtection - { - public static IPasswordProtection Instance = new MD5PasswordProtection(); -#pragma warning disable CA5351 - private readonly MD5CryptoServiceProvider m_MD5HashProvider = new(); -#pragma warning restore CA5351 - - public string EncryptPassword(string plainPassword) - { - byte[] bytes = plainPassword.AsSpan(0, Math.Min(256, plainPassword.Length)).GetBytesAscii(); - return m_MD5HashProvider.ComputeHash(bytes).ToHexString(); - } - - public bool ValidatePassword(string encryptedPassword, string plainPassword) => - EncryptPassword(plainPassword) == encryptedPassword; - } -} diff --git a/Projects/UOContent/Accounting/Security/SHA1PasswordProtection.cs b/Projects/UOContent/Accounting/Security/SHA1PasswordProtection.cs deleted file mode 100644 index fb2fa0ea5..000000000 --- a/Projects/UOContent/Accounting/Security/SHA1PasswordProtection.cs +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************************* - * ModernUO * - * Copyright 2019-2020 - ModernUO Development Team * - * Email: hi@modernuo.com * - * File: SHA1PasswordProtection.cs * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - *************************************************************************/ - -using System; -using System.Security.Cryptography; -using Server.Text; - -namespace Server.Accounting.Security -{ - public class SHA1PasswordProtection : IPasswordProtection - { - public static IPasswordProtection Instance = new SHA1PasswordProtection(); -#pragma warning disable CA5350 - private readonly SHA1CryptoServiceProvider m_SHA1HashProvider = new(); -#pragma warning restore CA5350 - - public string EncryptPassword(string plainPassword) - { - byte[] bytes = plainPassword.AsSpan(0, Math.Min(256, plainPassword.Length)).GetBytesAscii(); - return m_SHA1HashProvider.ComputeHash(bytes).ToHexString(); - } - - public bool ValidatePassword(string encryptedPassword, string plainPassword) => - EncryptPassword(plainPassword) == encryptedPassword; - } -} diff --git a/Projects/UOContent/Compression/TarArchive.cs b/Projects/UOContent/Compression/TarArchive.cs index 0e5889e4a..69083e509 100755 --- a/Projects/UOContent/Compression/TarArchive.cs +++ b/Projects/UOContent/Compression/TarArchive.cs @@ -5,6 +5,10 @@ using System.Diagnostics; using System.IO; using System.IO.Compression; using System.Net; +using System.Net.Http; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; using Server.Buffers; namespace Server.Compression @@ -53,13 +57,18 @@ namespace Server.Compression var tempDir = PathUtility.EnsureRandomPath(Path.GetTempPath()); var libarchiveFile = Path.Combine(tempDir, "libarchive.zip"); - using WebClient wc = new WebClient(); - wc.DownloadFile (new Uri(_libArchiveWindowsUrl), libarchiveFile); + // This isn't called often so we don't need to optimize + using (HttpClient hc = new HttpClient()) + { + var result = hc.Send(new HttpRequestMessage(HttpMethod.Get, new Uri(_libArchiveWindowsUrl))); + using var stream = result.Content.ReadAsStream(); + using FileStream fs = new FileStream(libarchiveFile, FileMode.Create, FileAccess.Write, FileShare.None); + stream.CopyTo(fs); + } ZipFile.ExtractToDirectory(libarchiveFile, tempDir); var libArchivePath = Path.Combine(tempDir, "libarchive"); - Directory.Move(Path.Combine(libArchivePath, "bin"), "bsdtar"); - Directory.Delete(libArchivePath, true); + PathUtility.MoveDirectory(Path.Combine(libArchivePath, "bin"), Path.Combine(Core.BaseDirectory, "bsdtar")); File.Delete(libarchiveFile); return Path.Combine(Core.BaseDirectory, "bsdtar/bsdtar.exe"); diff --git a/Projects/UOContent/Compression/ZstdArchive.cs b/Projects/UOContent/Compression/ZstdArchive.cs index 35fd533d5..a1f1fee2c 100755 --- a/Projects/UOContent/Compression/ZstdArchive.cs +++ b/Projects/UOContent/Compression/ZstdArchive.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; diff --git a/Projects/UOContent/Misc/ProfessionInfo.cs b/Projects/UOContent/Misc/ProfessionInfo.cs index 9eda06bd9..6a2902d20 100644 --- a/Projects/UOContent/Misc/ProfessionInfo.cs +++ b/Projects/UOContent/Misc/ProfessionInfo.cs @@ -43,7 +43,7 @@ namespace Server } }; - var file = Core.FindDataFile("prof.txt"); + var file = Core.FindDataFile("prof.txt", false); if (!File.Exists(file)) { var parent = Path.Combine(Core.BaseDirectory, "Data/Professions"); diff --git a/Projects/UOContent/Misc/ServerList.cs b/Projects/UOContent/Misc/ServerList.cs index 031f44bc8..7d3a95194 100644 --- a/Projects/UOContent/Misc/ServerList.cs +++ b/Projects/UOContent/Misc/ServerList.cs @@ -1,5 +1,7 @@ using System; +using System.IO; using System.Net; +using System.Net.Http; using System.Net.NetworkInformation; using System.Net.Sockets; using Server.Logging; @@ -165,12 +167,16 @@ namespace Server.Misc Utility.IPMatch("169.254.*", ip) || Utility.IPMatch("100.64-127.*", ip)); + private const string _ipifyUrl = "https://api.ipify.org"; + private static IPAddress FindPublicAddress() { try { - using WebClient wc = new WebClient(); - return IPAddress.Parse(wc.DownloadString("https://api.ipify.org")); + // This isn't called often so we don't need to optimize + using HttpClient hc = new HttpClient(); + var ipAddress = hc.GetStringAsync(_ipifyUrl).Result; + return IPAddress.Parse(ipAddress); } catch { diff --git a/Projects/UOContent/Mobiles/Townfolk/Noble.cs b/Projects/UOContent/Mobiles/Townfolk/Noble.cs index 85af8457d..46cbe227b 100644 --- a/Projects/UOContent/Mobiles/Townfolk/Noble.cs +++ b/Projects/UOContent/Mobiles/Townfolk/Noble.cs @@ -25,7 +25,6 @@ namespace Server.Mobiles { return Utility.Random(6) switch { - 0 => 0, 1 => Utility.RandomBlueHue(), 2 => Utility.RandomGreenHue(), 3 => Utility.RandomRedHue(), diff --git a/Projects/UOContent/UOContent.csproj b/Projects/UOContent/UOContent.csproj index aab3a5561..5f322c829 100755 --- a/Projects/UOContent/UOContent.csproj +++ b/Projects/UOContent/UOContent.csproj @@ -39,7 +39,7 @@ false - + diff --git a/Projects/UOContent/World Saves/AutoArchive.cs b/Projects/UOContent/World Saves/AutoArchive.cs index 7d46d6168..b7cf2d50b 100755 --- a/Projects/UOContent/World Saves/AutoArchive.cs +++ b/Projects/UOContent/World Saves/AutoArchive.cs @@ -97,7 +97,7 @@ namespace Server.Saves Directory.CreateDirectory(AutomaticBackupPath); var backupPath = Path.Combine(AutomaticBackupPath, Utility.GetTimeStamp()); - Directory.Move(args.OldSavePath, backupPath); + PathUtility.MoveDirectory(args.OldSavePath, backupPath); logger.Information($"Created backup at {backupPath}"); @@ -150,7 +150,7 @@ namespace Server.Saves Directory.Delete(savePath, true); var dirInfo = new DirectoryInfo(folder); logger.Information($"Restoring backup {dirInfo.Name}"); - Directory.Move(folder, savePath); + PathUtility.MoveDirectory(folder, savePath); break; } diff --git a/README.md b/README.md index 9cd03b05e..b37e7ef2e 100644 --- a/README.md +++ b/README.md @@ -24,16 +24,19 @@ ModernUO [![Discord](https://img.shields.io/discord/751317910504603701?logo=disc [![RedHat 7/8](https://img.shields.io/badge/-8-BE0000?logo=red%20hat&logoColor=white)](https://access.redhat.com/downloads) #### Running the server -[![.NET](https://img.shields.io/badge/.NET-%205.0-5C2D91)](https://dotnet.microsoft.com/download/dotnet/5.0) +[![.NET](https://img.shields.io/badge/.NET-%206.0-5C2D91)](https://dotnet.microsoft.com/download/dotnet/6.0) #### Development [![git](https://img.shields.io/badge/-git-F05032?logo=git&logoColor=white)](https://git-scm.com/downloads) -[![.NET](https://img.shields.io/badge/.NET-%205.0.10%20SDK-5C2D91)](https://dotnet.microsoft.com/download/dotnet/5.0) +[![.NET](https://img.shields.io/badge/.NET-%206.0%20SDK-5C2D91)](https://dotnet.microsoft.com/download/dotnet/6.0) #### Supported IDEs -[Jetbrains Rider 2021.2](https://www.jetbrains.com/rider/download) -[Visual Studio 2019](https://visualstudio.microsoft.com/downloads) +  +[Jetbrains Rider 2021.3](https://www.jetbrains.com/rider/download) +                     +[Visual Studio 2022](https://visualstudio.microsoft.com/downloads)
+Rider 2021.3+             Visual Studio 2022+ ###### Note: VS Code is not currently supported. ## Getting Started diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4f721fc49..db3ef8f9a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -18,7 +18,12 @@ jobs: displayName: 'Install .NET 5' inputs: packageType: sdk - version: 5.0.401 + version: 5.0.403 + - task: UseDotNet@2 + displayName: 'Install .NET 6' + inputs: + packageType: sdk + version: 6.0.100 - task: NuGetAuthenticate@0 - script: ./publish.cmd Release win displayName: 'Build' @@ -62,7 +67,12 @@ jobs: displayName: 'Install .NET 5' inputs: packageType: sdk - version: 5.0.401 + version: 5.0.403 + - task: UseDotNet@2 + displayName: 'Install .NET 6' + inputs: + packageType: sdk + version: 6.0.100 - task: NuGetAuthenticate@0 - script: ./publish.cmd Release $(os) displayName: 'Build' From 78f587f49604484aef7b60ea0006f73d07267715 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Sat, 13 Nov 2021 16:18:16 -0800 Subject: [PATCH 02/16] fix: Fixes dictionary codegen (#844) * Fixes code gen with .net 6 by not using .net 6 * Fixes dictionary codegen * Fixes kvp codegen --- .github/workflows/build-test.yml | 2 +- Directory.Build.props | 2 +- .../Rules/DictionaryMigrationRule.cs | 96 +++++++++++-------- .../Rules/KeyValuePairMigrationRule.cs | 74 +++++++++----- .../SerializationGenerator.csproj | 2 +- azure-pipelines.yml | 4 +- publish.cmd | 8 +- 7 files changed, 112 insertions(+), 76 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 3a2b28871..8e8872f94 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -30,4 +30,4 @@ jobs: - name: Build run: ./publish.cmd - name: Test - run: dotnet test --no-restore + run: dotnet test --no-restore --framework net6.0 diff --git a/Directory.Build.props b/Directory.Build.props index 7ebed0b53..27ca9d899 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -4,7 +4,7 @@ Kamron Batman ModernUO 2019-2020 - net6.0 + net5.0;net6.0 x64 x64 preview diff --git a/Projects/SerializationGenerator/SerializableMigration/Rules/DictionaryMigrationRule.cs b/Projects/SerializationGenerator/SerializableMigration/Rules/DictionaryMigrationRule.cs index 632fa61fd..309e4c461 100644 --- a/Projects/SerializationGenerator/SerializableMigration/Rules/DictionaryMigrationRule.cs +++ b/Projects/SerializationGenerator/SerializableMigration/Rules/DictionaryMigrationRule.cs @@ -15,7 +15,6 @@ using System; using System.Collections.Immutable; -using System.IO; using System.Linq; using System.Text; using Microsoft.CodeAnalysis; @@ -25,7 +24,6 @@ namespace SerializableMigration { public class DictionaryMigrationRule : ISerializableMigrationRule { - private const string KEY_VALUE_PAIR_DELIMITER = "----"; public string RuleName => nameof(DictionaryMigrationRule); public bool GenerateRuleState( @@ -78,25 +76,29 @@ namespace SerializableMigration extraOptions += "@Tidy"; } - var keyPropertyLength = serializableKeyProperty.RuleArguments?.Length ?? 0; - var valuePropertyLength = serializableValueProperty.RuleArguments?.Length ?? 0; - ruleArguments = new string[keyPropertyLength + valuePropertyLength + 6]; - ruleArguments[0] = extraOptions; - ruleArguments[1] = keySymbolType.ToDisplayString(); - ruleArguments[2] = serializableKeyProperty.Rule; + var keyArgumentsLength = serializableKeyProperty.RuleArguments?.Length ?? 0; + var valueArgumentsLength = serializableValueProperty.RuleArguments?.Length ?? 0; + var index = 0; - if (keyPropertyLength > 0) + ruleArguments = new string[7 + keyArgumentsLength + valueArgumentsLength]; + ruleArguments[index++] = extraOptions; + ruleArguments[index++] = keySymbolType.ToDisplayString(); + ruleArguments[index++] = serializableKeyProperty.Rule; + ruleArguments[index++] = keyArgumentsLength.ToString(); + + if (keyArgumentsLength > 0) { - Array.Copy(serializableKeyProperty.RuleArguments!, 0, ruleArguments, 3, keyPropertyLength); + Array.Copy(serializableKeyProperty.RuleArguments!, 0, ruleArguments, index, keyArgumentsLength); + index += keyArgumentsLength; } - ruleArguments[3 + keyPropertyLength] = KEY_VALUE_PAIR_DELIMITER; - ruleArguments[4 + keyPropertyLength] = valueSymbolType.ToDisplayString(); - ruleArguments[5 + keyPropertyLength] = serializableValueProperty.Rule; + ruleArguments[index++] = valueSymbolType.ToDisplayString(); + ruleArguments[index++] = serializableValueProperty.Rule; + ruleArguments[index++] = valueArgumentsLength.ToString(); - if (valuePropertyLength > 0) + if (valueArgumentsLength > 0) { - Array.Copy(serializableValueProperty.RuleArguments!, 0, ruleArguments, 6 + keyPropertyLength, valuePropertyLength); + Array.Copy(serializableValueProperty.RuleArguments!, 0, ruleArguments, index, valueArgumentsLength); } return true; @@ -112,20 +114,26 @@ namespace SerializableMigration } var ruleArguments = property.RuleArguments; + var index = 1; + var keyType = ruleArguments![index++]; - var keyElementRule = SerializableMigrationRulesEngine.Rules[ruleArguments![2]]; - var valueRuleIndex = Array.IndexOf(ruleArguments, KEY_VALUE_PAIR_DELIMITER, 4); - if (valueRuleIndex == -1) + var keyElementRule = SerializableMigrationRulesEngine.Rules[ruleArguments[index++]]; + var keyRuleArguments = new string[int.Parse(ruleArguments[index++])]; + + if (keyRuleArguments.Length > 0) { - throw new InvalidDataException($"Cannot find key-value delimiter in arguments for {property.Name}"); + Array.Copy(ruleArguments, index, keyRuleArguments, 0, keyRuleArguments.Length); + index += keyRuleArguments.Length; } - var keyRuleArguments = new string[valueRuleIndex - 3]; - Array.Copy(ruleArguments, 3, keyRuleArguments, 0, keyRuleArguments.Length); + var valueType = ruleArguments[index++]; + var valueElementRule = SerializableMigrationRulesEngine.Rules[ruleArguments[index++]]; + var valueRuleArguments = new string[int.Parse(ruleArguments[index++])]; - var valueElementRule = SerializableMigrationRulesEngine.Rules[ruleArguments[valueRuleIndex + 2]]; - var valueRuleArguments = new string[ruleArguments.Length - valueRuleIndex - 2]; - Array.Copy(ruleArguments, 2 + valueRuleIndex, valueRuleArguments, 0, valueRuleArguments.Length); + if (valueRuleArguments.Length > 0) + { + Array.Copy(ruleArguments, index, valueRuleArguments, 0, valueRuleArguments.Length); + } var propertyName = property.Name; var propertyVarPrefix = $"{char.ToLower(propertyName[0])}{propertyName.Substring(1, propertyName.Length - 1)}"; @@ -135,16 +143,16 @@ namespace SerializableMigration var propertyCount = $"{propertyVarPrefix}Count"; source.AppendLine($"{indent}{ruleArguments[1]} {propertyKeyEntry};"); - source.AppendLine($"{indent}{ruleArguments[valueRuleIndex + 1]} {propertyValueEntry};"); + source.AppendLine($"{indent}{valueType} {propertyValueEntry};"); source.AppendLine($"{indent}var {propertyCount} = reader.ReadEncodedInt();"); - source.AppendLine($"{indent}{propertyName} = new System.Collections.Generic.Dictionary<{ruleArguments[1]}, {ruleArguments[valueRuleIndex + 1]}>({propertyCount});"); + source.AppendLine($"{indent}{propertyName} = new System.Collections.Generic.Dictionary<{keyType}, {valueType}>({propertyCount});"); source.AppendLine($"{indent}for (var {propertyIndex} = 0; {propertyIndex} < {propertyCount}; {propertyIndex}++)"); source.AppendLine($"{indent}{{"); var serializableKeyElement = new SerializableProperty { Name = propertyKeyEntry, - Type = ruleArguments[1], + Type = keyType, Rule = keyElementRule.RuleName, RuleArguments = keyRuleArguments }; @@ -154,7 +162,7 @@ namespace SerializableMigration var serializableValueElement = new SerializableProperty { Name = propertyValueEntry, - Type = ruleArguments[valueRuleIndex + 1], + Type = valueType, Rule = valueElementRule.RuleName, RuleArguments = valueRuleArguments }; @@ -175,21 +183,27 @@ namespace SerializableMigration } var ruleArguments = property.RuleArguments; - var shouldTidy = ruleArguments![0].Contains("@Tidy"); + var index = 0; + var shouldTidy = ruleArguments![index++].Contains("@Tidy"); + var keyType = ruleArguments![index++]; - var keyElementRule = SerializableMigrationRulesEngine.Rules[ruleArguments[2]]; - var valueRuleIndex = Array.IndexOf(ruleArguments, KEY_VALUE_PAIR_DELIMITER, 3); - if (valueRuleIndex == -1) + var keyElementRule = SerializableMigrationRulesEngine.Rules[ruleArguments![index++]]; + var keyRuleArguments = new string[int.Parse(ruleArguments[index++])]; + + if (keyRuleArguments.Length > 0) { - throw new InvalidDataException($"Cannot find key-value delimiter in arguments for {property.Name}"); + Array.Copy(ruleArguments, index, keyRuleArguments, 0, keyRuleArguments.Length); + index += keyRuleArguments.Length; } - var keyRuleArguments = new string[valueRuleIndex - 3]; - Array.Copy(ruleArguments, 3, keyRuleArguments, 0, keyRuleArguments.Length); + var valueType = ruleArguments[index++]; + var valueElementRule = SerializableMigrationRulesEngine.Rules[ruleArguments[index++]]; + var valueRuleArguments = new string[int.Parse(ruleArguments[index++])]; - var valueElementRule = SerializableMigrationRulesEngine.Rules[ruleArguments[valueRuleIndex + 2]]; - var valueRuleArguments = new string[ruleArguments.Length - valueRuleIndex - 2]; - Array.Copy(ruleArguments, 2 + valueRuleIndex, valueRuleArguments, 0, valueRuleArguments.Length); + if (valueRuleArguments.Length > 0) + { + Array.Copy(ruleArguments, index, valueRuleArguments, 0, valueRuleArguments.Length); + } var propertyName = property.Name; var propertyVarPrefix = $"{char.ToLower(propertyName[0])}{propertyName.Substring(1, propertyName.Length - 1)}"; @@ -211,7 +225,7 @@ namespace SerializableMigration var serializableKeyElement = new SerializableProperty { Name = propertyKeyEntry, - Type = ruleArguments[1], + Type = keyType, Rule = keyElementRule.RuleName, RuleArguments = keyRuleArguments }; @@ -221,12 +235,12 @@ namespace SerializableMigration var serializableValueElement = new SerializableProperty { Name = propertyValueEntry, - Type = ruleArguments[valueRuleIndex + 1], + Type = valueType, Rule = valueElementRule.RuleName, RuleArguments = valueRuleArguments }; - keyElementRule.GenerateSerializationMethod(source, $"{indent} ", serializableValueElement); + valueElementRule.GenerateSerializationMethod(source, $"{indent} ", serializableValueElement); source.AppendLine($"{indent} }}"); source.AppendLine($"{indent}}}"); diff --git a/Projects/SerializationGenerator/SerializableMigration/Rules/KeyValuePairMigrationRule.cs b/Projects/SerializationGenerator/SerializableMigration/Rules/KeyValuePairMigrationRule.cs index 7ebdf064d..1797764c1 100644 --- a/Projects/SerializationGenerator/SerializableMigration/Rules/KeyValuePairMigrationRule.cs +++ b/Projects/SerializationGenerator/SerializableMigration/Rules/KeyValuePairMigrationRule.cs @@ -41,12 +41,12 @@ namespace SerializableMigration return false; } - var typeArguments = namedTypeSymbol.TypeArguments; + var keySymbolType = namedTypeSymbol.TypeArguments[0]; var keySerializedProperty = SerializableMigrationRulesEngine.GenerateSerializableProperty( compilation, "key", - typeArguments[0], + keySymbolType, 0, attributes, serializableTypes, @@ -55,10 +55,12 @@ namespace SerializableMigration null ); + var valueSymbolType = namedTypeSymbol.TypeArguments[1]; + var valueSerializedProperty = SerializableMigrationRulesEngine.GenerateSerializableProperty( compilation, "value", - typeArguments[1], + valueSymbolType, 1, attributes, serializableTypes, @@ -72,17 +74,19 @@ namespace SerializableMigration var index = 0; // Key - ruleArguments = new string[5 + keyArgumentsLength + valueArgumentsLength]; - ruleArguments[index++] = typeArguments[0].ToDisplayString(); + ruleArguments = new string[6 + keyArgumentsLength + valueArgumentsLength]; + ruleArguments[index++] = ""; // Extra options + ruleArguments[index++] = keySymbolType.ToDisplayString(); ruleArguments[index++] = keySerializedProperty.Rule; ruleArguments[index++] = keyArgumentsLength.ToString(); if (keyArgumentsLength > 0) { Array.Copy(keySerializedProperty.RuleArguments!, 0, ruleArguments, index, keyArgumentsLength); + index += keyArgumentsLength; } // Value - ruleArguments[index++] = typeArguments[1].ToDisplayString(); + ruleArguments[index++] = valueSymbolType.ToDisplayString(); ruleArguments[index++] = valueSerializedProperty.Rule; if (valueArgumentsLength > 0) @@ -103,10 +107,16 @@ namespace SerializableMigration } var ruleArguments = property.RuleArguments; - var keyType = ruleArguments![0]; - var keyRule = SerializableMigrationRulesEngine.Rules[ruleArguments[1]]; - var keyRuleArguments = new string[int.Parse(ruleArguments[2])]; - Array.Copy(ruleArguments, 3, keyRuleArguments, 0, keyRuleArguments.Length); + var index = 1; // skip extra options + var keyType = ruleArguments![index++]; + var keyRule = SerializableMigrationRulesEngine.Rules[ruleArguments[index++]]; + var keyRuleArguments = new string[int.Parse(ruleArguments[index++])]; + + if (keyRuleArguments.Length > 0) + { + Array.Copy(ruleArguments, index, keyRuleArguments, 0, keyRuleArguments.Length); + index += keyRuleArguments.Length; + } var serializableKeyProperty = new SerializableProperty { @@ -123,11 +133,14 @@ namespace SerializableMigration parentReference ); - var valueIndex = 3 + keyRuleArguments.Length; - var valueType = ruleArguments[valueIndex++]; - var valueRule = SerializableMigrationRulesEngine.Rules[ruleArguments[valueIndex++]]; - var valueRuleArguments = new string[ruleArguments.Length - valueIndex]; - Array.Copy(ruleArguments, valueIndex, valueRuleArguments, 0, valueRuleArguments.Length); + var valueType = ruleArguments[index++]; + var valueRule = SerializableMigrationRulesEngine.Rules[ruleArguments[index++]]; + var valueRuleArguments = new string[int.Parse(ruleArguments[index++])]; + + if (valueRuleArguments.Length > 0) + { + Array.Copy(ruleArguments, index, valueRuleArguments, 0, valueRuleArguments.Length); + } var serializableValueProperty = new SerializableProperty { @@ -137,7 +150,7 @@ namespace SerializableMigration RuleArguments = valueRuleArguments }; - keyRule.GenerateDeserializationMethod( + valueRule.GenerateDeserializationMethod( source, indent, serializableValueProperty, @@ -159,10 +172,16 @@ namespace SerializableMigration } var ruleArguments = property.RuleArguments; - var keyType = ruleArguments![0]; - var keyRule = SerializableMigrationRulesEngine.Rules[ruleArguments[1]]; - var keyRuleArguments = new string[int.Parse(ruleArguments[2])]; - Array.Copy(ruleArguments, 3, keyRuleArguments, 0, keyRuleArguments.Length); + var index = 1; // skip extra options + var keyType = ruleArguments![index++]; + var keyRule = SerializableMigrationRulesEngine.Rules[ruleArguments[index++]]; + var keyRuleArguments = new string[int.Parse(ruleArguments[index++])]; + + if (keyRuleArguments.Length > 0) + { + Array.Copy(ruleArguments, index, keyRuleArguments, 0, keyRuleArguments.Length); + index += keyRuleArguments.Length; + } var serializableKeyProperty = new SerializableProperty { @@ -178,11 +197,14 @@ namespace SerializableMigration serializableKeyProperty ); - var valueIndex = 3 + keyRuleArguments.Length; - var valueType = ruleArguments[valueIndex++]; - var valueRule = SerializableMigrationRulesEngine.Rules[ruleArguments[valueIndex++]]; - var valueRuleArguments = new string[ruleArguments.Length - valueIndex]; - Array.Copy(ruleArguments, valueIndex, valueRuleArguments, 0, valueRuleArguments.Length); + var valueType = ruleArguments[index++]; + var valueRule = SerializableMigrationRulesEngine.Rules[ruleArguments[index++]]; + var valueRuleArguments = new string[int.Parse(ruleArguments[index++])]; + + if (valueRuleArguments.Length > 0) + { + Array.Copy(ruleArguments, index, valueRuleArguments, 0, valueRuleArguments.Length); + } var serializableValueProperty = new SerializableProperty { @@ -192,7 +214,7 @@ namespace SerializableMigration RuleArguments = valueRuleArguments }; - keyRule.GenerateSerializationMethod( + valueRule.GenerateSerializationMethod( source, indent, serializableValueProperty diff --git a/Projects/SerializationGenerator/SerializationGenerator.csproj b/Projects/SerializationGenerator/SerializationGenerator.csproj index 1839dfeb3..03b5a5bdb 100755 --- a/Projects/SerializationGenerator/SerializationGenerator.csproj +++ b/Projects/SerializationGenerator/SerializationGenerator.csproj @@ -1,6 +1,6 @@ - netstandard2.0 + netstandard2.0 preview analyzers diff --git a/azure-pipelines.yml b/azure-pipelines.yml index db3ef8f9a..6923ed2ae 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -27,7 +27,7 @@ jobs: - task: NuGetAuthenticate@0 - script: ./publish.cmd Release win displayName: 'Build' - - script: dotnet test --no-restore + - script: dotnet test --no-restore --framework net6.0 displayName: 'Test' - job: BuildLinux @@ -76,5 +76,5 @@ jobs: - task: NuGetAuthenticate@0 - script: ./publish.cmd Release $(os) displayName: 'Build' - - script: dotnet test --no-restore + - script: dotnet test --no-restore --framework net6.0 displayName: 'Test' diff --git a/publish.cmd b/publish.cmd index 140dd547c..e0f9fe6df 100755 --- a/publish.cmd +++ b/publish.cmd @@ -32,8 +32,8 @@ dotnet clean --verbosity quiet echo dotnet restore --force-evaluate --source https://api.nuget.org/v3/index.json dotnet restore --force-evaluate --source https://api.nuget.org/v3/index.json -echo dotnet publish ${config} ${os} --no-restore --self-contained=false -o Distribution/Assemblies Projects/UOContent/UOContent.csproj -dotnet publish ${config} ${os} --no-restore --self-contained=false -o Distribution/Assemblies Projects/UOContent/UOContent.csproj +echo dotnet publish ${config} ${os} --framework net6.0 --no-restore --self-contained=false -o Distribution/Assemblies Projects/UOContent/UOContent.csproj +dotnet publish ${config} ${os} --framework net6.0 --no-restore --self-contained=false -o Distribution/Assemblies Projects/UOContent/UOContent.csproj echo dotnet build -c Release Projects/SerializationSchemaGenerator/SerializationSchemaGenerator.csproj dotnet build -c Release Projects/SerializationSchemaGenerator/SerializationSchemaGenerator.csproj @@ -65,8 +65,8 @@ dotnet clean --verbosity quiet echo dotnet restore --force-evaluate --source https://api.nuget.org/v3/index.json dotnet restore --force-evaluate --source https://api.nuget.org/v3/index.json -echo dotnet publish %config% %os% --no-restore --self-contained=false -o Distribution\Assemblies Projects\UOContent\UOContent.csproj -dotnet publish %config% %os% --no-restore --self-contained=false -o Distribution\Assemblies Projects\UOContent\UOContent.csproj +echo dotnet publish %config% %os% --framework net6.0 --no-restore --self-contained=false -o Distribution\Assemblies Projects\UOContent\UOContent.csproj +dotnet publish %config% %os% --framework net6.0 --no-restore --self-contained=false -o Distribution\Assemblies Projects\UOContent\UOContent.csproj echo dotnet build -c Release Projects/SerializationSchemaGenerator/SerializationSchemaGenerator.csproj dotnet build -c Release Projects/SerializationSchemaGenerator/SerializationSchemaGenerator.csproj From ecaf8ca98a6814f21fef082ab17c77affbf8ec6b Mon Sep 17 00:00:00 2001 From: Arthrutus <75637913+Arthrutus@users.noreply.github.com> Date: Sat, 13 Nov 2021 18:18:46 -0600 Subject: [PATCH 03/16] fix: Fixes door location at hedge maze (#841) --- .../Data/Decoration/Britannia/_hedgemaze.cfg | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Distribution/Data/Decoration/Britannia/_hedgemaze.cfg b/Distribution/Data/Decoration/Britannia/_hedgemaze.cfg index 127f363c9..25a7f712f 100644 --- a/Distribution/Data/Decoration/Britannia/_hedgemaze.cfg +++ b/Distribution/Data/Decoration/Britannia/_hedgemaze.cfg @@ -133,8 +133,13 @@ LocalizedSign 0x1F28 (LabelNumber=1016109) # wooden gate DarkWoodGate 0x0866 (Facing=WestCW) -1131 2237 40 -1131 2237 50 +1132 2237 40 +1132 2237 50 + +# wooden gate +DarkWoodGate 0x0868 (Facing=EastCCW) +1133 2237 40 +1133 2237 50 # candelabra CandelabraStand 0x0B26 @@ -148,11 +153,6 @@ FancyArmoire 0x0A51 1132 2231 40 1132 2230 40 -# wooden gate -DarkWoodGate 0x0868 (Facing=EastCCW) -1132 2237 40 -1132 2237 50 - # book Static 0x1E20 1133 2235 24 From 38c4d09028cb3219c64d29490b767eea9f5230f4 Mon Sep 17 00:00:00 2001 From: nullptr-w8 <79784082+nullptr-w8@users.noreply.github.com> Date: Sun, 14 Nov 2021 05:19:34 +0500 Subject: [PATCH 04/16] fix: Fixes animal taming timeout in case target is cancelled. (#842) --- Projects/UOContent/Skills/AnimalTaming.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projects/UOContent/Skills/AnimalTaming.cs b/Projects/UOContent/Skills/AnimalTaming.cs index 99833a41e..99b1293ef 100644 --- a/Projects/UOContent/Skills/AnimalTaming.cs +++ b/Projects/UOContent/Skills/AnimalTaming.cs @@ -33,7 +33,7 @@ namespace Server.SkillHandlers m.SendLocalizedMessage(502789); // Tame which animal? } - return TimeSpan.FromHours(6.0); + return TimeSpan.FromSeconds(30); } public static bool CheckMastery(Mobile tamer, BaseCreature creature) => From 91493f7f274c080a976c11781cc20cb82aecd219 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Sat, 13 Nov 2021 16:31:10 -0800 Subject: [PATCH 05/16] fix: Fixes guild assignment (#846) --- Projects/Server/World/World.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projects/Server/World/World.cs b/Projects/Server/World/World.cs index 72d21ac2b..a5d57436a 100644 --- a/Projects/Server/World/World.cs +++ b/Projects/Server/World/World.cs @@ -666,7 +666,7 @@ namespace Server T entity; // Add to this list when creating new serializable types - if (typeof(BaseGuild).IsAssignableTo(typeT)) + if (typeof(BaseGuild).IsAssignableFrom(typeT)) { entity = FindGuild(serial) as T; } From e5f55a424aec658481ef471ab4cb588d715cd51d Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Sun, 14 Nov 2021 18:31:32 -0800 Subject: [PATCH 06/16] fix: Cleans up spell info variable (#848) --- Projects/UOContent/Spells/Base/MagerySpell.cs | 3 +-- Projects/UOContent/Spells/Base/SpellHelper.cs | 9 +++------ Projects/UOContent/Spells/Bushido/Confidence.cs | 4 ++-- Projects/UOContent/Spells/Bushido/CounterAttack.cs | 4 ++-- Projects/UOContent/Spells/Bushido/Evasion.cs | 5 ++--- Projects/UOContent/Spells/Bushido/HonorableExecution.cs | 4 ++-- Projects/UOContent/Spells/Chivalry/CleanseByFire.cs | 4 ++-- Projects/UOContent/Spells/Chivalry/CloseWounds.cs | 4 ++-- Projects/UOContent/Spells/Chivalry/ConsecrateWeapon.cs | 4 ++-- Projects/UOContent/Spells/Chivalry/DispelEvil.cs | 4 ++-- Projects/UOContent/Spells/Chivalry/DivineFury.cs | 4 ++-- Projects/UOContent/Spells/Chivalry/EnemyOfOne.cs | 4 ++-- Projects/UOContent/Spells/Chivalry/HolyLight.cs | 4 ++-- Projects/UOContent/Spells/Chivalry/NobleSacrifice.cs | 4 ++-- Projects/UOContent/Spells/Chivalry/RemoveCurse.cs | 4 ++-- Projects/UOContent/Spells/Chivalry/SacredJourney.cs | 4 ++-- Projects/UOContent/Spells/Eighth/AirElemental.cs | 4 ++-- Projects/UOContent/Spells/Eighth/EarthElemental.cs | 4 ++-- Projects/UOContent/Spells/Eighth/Earthquake.cs | 4 ++-- Projects/UOContent/Spells/Eighth/EnergyVortex.cs | 4 ++-- Projects/UOContent/Spells/Eighth/FireElemental.cs | 4 ++-- Projects/UOContent/Spells/Eighth/Resurrection.cs | 4 ++-- Projects/UOContent/Spells/Eighth/SummonDaemon.cs | 4 ++-- Projects/UOContent/Spells/Eighth/WaterElemental.cs | 4 ++-- Projects/UOContent/Spells/Fifth/BladeSpirits.cs | 4 ++-- Projects/UOContent/Spells/Fifth/DispelField.cs | 4 ++-- Projects/UOContent/Spells/Fifth/Incognito.cs | 4 ++-- Projects/UOContent/Spells/Fifth/MagicReflect.cs | 4 ++-- Projects/UOContent/Spells/Fifth/MindBlast.cs | 6 +++--- Projects/UOContent/Spells/Fifth/Paralyze.cs | 4 ++-- Projects/UOContent/Spells/Fifth/PoisonField.cs | 4 ++-- Projects/UOContent/Spells/Fifth/SummonCreature.cs | 4 ++-- Projects/UOContent/Spells/First/Clumsy.cs | 4 ++-- Projects/UOContent/Spells/First/CreateFood.cs | 4 ++-- Projects/UOContent/Spells/First/Feeblemind.cs | 4 ++-- Projects/UOContent/Spells/First/Heal.cs | 4 ++-- Projects/UOContent/Spells/First/MagicArrow.cs | 4 ++-- Projects/UOContent/Spells/First/NightSight.cs | 4 ++-- Projects/UOContent/Spells/First/ReactiveArmor.cs | 4 ++-- Projects/UOContent/Spells/First/Weaken.cs | 4 ++-- Projects/UOContent/Spells/Fourth/ArchCure.cs | 4 ++-- Projects/UOContent/Spells/Fourth/ArchProtection.cs | 4 ++-- Projects/UOContent/Spells/Fourth/Curse.cs | 4 ++-- Projects/UOContent/Spells/Fourth/FireField.cs | 4 ++-- Projects/UOContent/Spells/Fourth/GreaterHeal.cs | 4 ++-- Projects/UOContent/Spells/Fourth/Lightning.cs | 4 ++-- Projects/UOContent/Spells/Fourth/ManaDrain.cs | 4 ++-- Projects/UOContent/Spells/Fourth/Recall.cs | 4 ++-- .../Spells/Gargoyle/SpellDefinitions/FlySpell.cs | 4 ++-- .../UOContent/Spells/Mysticism/AnimatedWeaponSpell.cs | 4 ++-- Projects/UOContent/Spells/Mysticism/EagleStrikeSpell.cs | 4 ++-- Projects/UOContent/Spells/Mysticism/HailStormSpell.cs | 4 ++-- .../UOContent/Spells/Mysticism/NetherCycloneSpell.cs | 4 ++-- Projects/UOContent/Spells/Mysticism/SpellPlagueSpell.cs | 4 ++-- Projects/UOContent/Spells/Mysticism/StoneFormSpell.cs | 4 ++-- Projects/UOContent/Spells/Necromancy/AnimateDeadSpell.cs | 4 ++-- Projects/UOContent/Spells/Necromancy/BloodOathSpell.cs | 4 ++-- Projects/UOContent/Spells/Necromancy/CorpseSkin.cs | 4 ++-- Projects/UOContent/Spells/Necromancy/CurseWeapon.cs | 4 ++-- Projects/UOContent/Spells/Necromancy/EvilOmen.cs | 4 ++-- Projects/UOContent/Spells/Necromancy/Exorcism.cs | 4 ++-- Projects/UOContent/Spells/Necromancy/HorrificBeast.cs | 4 ++-- Projects/UOContent/Spells/Necromancy/LichForm.cs | 4 ++-- Projects/UOContent/Spells/Necromancy/MindRot.cs | 4 ++-- Projects/UOContent/Spells/Necromancy/PainSpike.cs | 4 ++-- Projects/UOContent/Spells/Necromancy/PoisonStrike.cs | 4 ++-- Projects/UOContent/Spells/Necromancy/Strangle.cs | 4 ++-- Projects/UOContent/Spells/Necromancy/SummonFamiliar.cs | 4 ++-- Projects/UOContent/Spells/Necromancy/VampiricEmbrace.cs | 4 ++-- Projects/UOContent/Spells/Necromancy/VengefulSpirit.cs | 4 ++-- Projects/UOContent/Spells/Necromancy/Wither.cs | 4 ++-- Projects/UOContent/Spells/Necromancy/WraithForm.cs | 4 ++-- Projects/UOContent/Spells/Ninjitsu/AnimalForm.cs | 4 ++-- Projects/UOContent/Spells/Ninjitsu/MirrorImage.cs | 4 ++-- Projects/UOContent/Spells/Ninjitsu/ShadowJump.cs | 4 ++-- Projects/UOContent/Spells/Second/Agility.cs | 4 ++-- Projects/UOContent/Spells/Second/Cunning.cs | 4 ++-- Projects/UOContent/Spells/Second/Cure.cs | 4 ++-- Projects/UOContent/Spells/Second/Harm.cs | 4 ++-- Projects/UOContent/Spells/Second/MagicTrap.cs | 4 ++-- Projects/UOContent/Spells/Second/Protection.cs | 4 ++-- Projects/UOContent/Spells/Second/RemoveTrap.cs | 4 ++-- Projects/UOContent/Spells/Second/Strength.cs | 4 ++-- Projects/UOContent/Spells/Seventh/ChainLightning.cs | 4 ++-- Projects/UOContent/Spells/Seventh/EnergyField.cs | 4 ++-- Projects/UOContent/Spells/Seventh/FlameStrike.cs | 4 ++-- Projects/UOContent/Spells/Seventh/GateTravel.cs | 4 ++-- Projects/UOContent/Spells/Seventh/ManaVampire.cs | 4 ++-- Projects/UOContent/Spells/Seventh/MassDispel.cs | 4 ++-- Projects/UOContent/Spells/Seventh/MeteorSwarm.cs | 4 ++-- Projects/UOContent/Spells/Seventh/Polymorph.cs | 4 ++-- Projects/UOContent/Spells/Sixth/Dispel.cs | 4 ++-- Projects/UOContent/Spells/Sixth/EnergyBolt.cs | 4 ++-- Projects/UOContent/Spells/Sixth/Explosion.cs | 5 ++--- Projects/UOContent/Spells/Sixth/Invisibility.cs | 4 ++-- Projects/UOContent/Spells/Sixth/Mark.cs | 4 ++-- Projects/UOContent/Spells/Sixth/MassCurse.cs | 4 ++-- Projects/UOContent/Spells/Sixth/ParalyzeField.cs | 4 ++-- Projects/UOContent/Spells/Sixth/Reveal.cs | 4 ++-- Projects/UOContent/Spells/Spellweaving/ArcaneCircle.cs | 4 ++-- Projects/UOContent/Spells/Spellweaving/AttuneWeapon.cs | 4 ++-- Projects/UOContent/Spells/Spellweaving/EssenceOfWind.cs | 4 ++-- Projects/UOContent/Spells/Spellweaving/EtherealVoyage.cs | 4 ++-- Projects/UOContent/Spells/Spellweaving/GiftOfLife.cs | 4 ++-- Projects/UOContent/Spells/Spellweaving/GiftOfRenewal.cs | 4 ++-- .../UOContent/Spells/Spellweaving/ImmolatingWeapon.cs | 4 ++-- Projects/UOContent/Spells/Spellweaving/NatureFury.cs | 4 ++-- Projects/UOContent/Spells/Spellweaving/ReaperForm.cs | 4 ++-- Projects/UOContent/Spells/Spellweaving/SummonFey.cs | 4 ++-- Projects/UOContent/Spells/Spellweaving/SummonFiend.cs | 4 ++-- Projects/UOContent/Spells/Spellweaving/Thunderstorm.cs | 4 ++-- Projects/UOContent/Spells/Spellweaving/WordOfDeath.cs | 4 ++-- Projects/UOContent/Spells/Third/Bless.cs | 4 ++-- Projects/UOContent/Spells/Third/Fireball.cs | 4 ++-- Projects/UOContent/Spells/Third/MagicLock.cs | 4 ++-- Projects/UOContent/Spells/Third/Poison.cs | 4 ++-- Projects/UOContent/Spells/Third/Telekinesis.cs | 4 ++-- Projects/UOContent/Spells/Third/Teleport.cs | 4 ++-- Projects/UOContent/Spells/Third/Unlock.cs | 4 ++-- Projects/UOContent/Spells/Third/WallOfStone.cs | 4 ++-- 120 files changed, 241 insertions(+), 247 deletions(-) diff --git a/Projects/UOContent/Spells/Base/MagerySpell.cs b/Projects/UOContent/Spells/Base/MagerySpell.cs index d496cf100..c42d60954 100644 --- a/Projects/UOContent/Spells/Base/MagerySpell.cs +++ b/Projects/UOContent/Spells/Base/MagerySpell.cs @@ -9,8 +9,7 @@ namespace Server.Spells private static readonly int[] m_ManaTable = { 4, 6, 9, 11, 14, 20, 40, 50 }; - public MagerySpell(Mobile caster, Item scroll, SpellInfo info) - : base(caster, scroll, info) + public MagerySpell(Mobile caster, Item scroll, SpellInfo info) : base(caster, scroll, info) { } diff --git a/Projects/UOContent/Spells/Base/SpellHelper.cs b/Projects/UOContent/Spells/Base/SpellHelper.cs index 6b7cb8a24..cbf225459 100644 --- a/Projects/UOContent/Spells/Base/SpellHelper.cs +++ b/Projects/UOContent/Spells/Base/SpellHelper.cs @@ -33,8 +33,7 @@ namespace Server { private readonly Mobile m_Mobile; - public InternalTimer(Mobile m) - : base(TimeSpan.FromMinutes(1.0)) + public InternalTimer(Mobile m) : base(TimeSpan.FromMinutes(1.0)) { m_Mobile = m; } @@ -1128,8 +1127,7 @@ namespace Server.Spells private readonly Mobile m_Target; private int m_Damage; - public SpellDamageTimer(Spell s, Mobile target, Mobile from, int damage, TimeSpan delay) - : base(delay) + public SpellDamageTimer(Spell s, Mobile target, Mobile from, int damage, TimeSpan delay) : base(delay) { m_Target = target; m_From = from; @@ -1170,8 +1168,7 @@ namespace Server.Spells public SpellDamageTimerAOS( Spell s, TimeSpan delay, Mobile target, Mobile from, int damage, int phys, int fire, int cold, int pois, int nrgy, int chaos, DFAlgorithm dfa - ) - : base(delay) + ) : base(delay) { m_Target = target; m_From = from; diff --git a/Projects/UOContent/Spells/Bushido/Confidence.cs b/Projects/UOContent/Spells/Bushido/Confidence.cs index a846088f1..be3313cf8 100644 --- a/Projects/UOContent/Spells/Bushido/Confidence.cs +++ b/Projects/UOContent/Spells/Bushido/Confidence.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Bushido { public class Confidence : SamuraiSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Confidence", null, -1, @@ -15,7 +15,7 @@ namespace Server.Spells.Bushido private static readonly Dictionary m_Table = new(); private static readonly Dictionary m_RegenTable = new(); - public Confidence(Mobile caster, Item scroll) : base(caster, scroll, m_Info) + public Confidence(Mobile caster, Item scroll) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Bushido/CounterAttack.cs b/Projects/UOContent/Spells/Bushido/CounterAttack.cs index 04eb1ebcb..ba546fa5b 100644 --- a/Projects/UOContent/Spells/Bushido/CounterAttack.cs +++ b/Projects/UOContent/Spells/Bushido/CounterAttack.cs @@ -6,7 +6,7 @@ namespace Server.Spells.Bushido { public class CounterAttack : SamuraiSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "CounterAttack", null, -1, @@ -15,7 +15,7 @@ namespace Server.Spells.Bushido private static readonly Dictionary m_Table = new(); - public CounterAttack(Mobile caster, Item scroll) : base(caster, scroll, m_Info) + public CounterAttack(Mobile caster, Item scroll) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Bushido/Evasion.cs b/Projects/UOContent/Spells/Bushido/Evasion.cs index 6c1c37b5c..d39b43194 100644 --- a/Projects/UOContent/Spells/Bushido/Evasion.cs +++ b/Projects/UOContent/Spells/Bushido/Evasion.cs @@ -6,7 +6,7 @@ namespace Server.Spells.Bushido { public class Evasion : SamuraiSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Evasion", null, -1, @@ -15,8 +15,7 @@ namespace Server.Spells.Bushido private static readonly Dictionary m_Table = new(); - public Evasion(Mobile caster, Item scroll) - : base(caster, scroll, m_Info) + public Evasion(Mobile caster, Item scroll) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Bushido/HonorableExecution.cs b/Projects/UOContent/Spells/Bushido/HonorableExecution.cs index 0df746862..35da3b3d8 100644 --- a/Projects/UOContent/Spells/Bushido/HonorableExecution.cs +++ b/Projects/UOContent/Spells/Bushido/HonorableExecution.cs @@ -98,8 +98,8 @@ namespace Server.Spells.Bushido } public HonorableExecutionTimer( - TimeSpan duration, Mobile from, int swingBonus, List mods = null, bool penalty = false) - : base(duration) + TimeSpan duration, Mobile from, int swingBonus, List mods = null, bool penalty = false + ) : base(duration) { m_Mobile = from; m_SwingBonus = swingBonus; diff --git a/Projects/UOContent/Spells/Chivalry/CleanseByFire.cs b/Projects/UOContent/Spells/Chivalry/CleanseByFire.cs index f5ef5332a..952dd7ce9 100644 --- a/Projects/UOContent/Spells/Chivalry/CleanseByFire.cs +++ b/Projects/UOContent/Spells/Chivalry/CleanseByFire.cs @@ -6,14 +6,14 @@ namespace Server.Spells.Chivalry { public class CleanseByFireSpell : PaladinSpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Cleanse By Fire", "Expor Flamus", -1, 9002 ); - public CleanseByFireSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public CleanseByFireSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Chivalry/CloseWounds.cs b/Projects/UOContent/Spells/Chivalry/CloseWounds.cs index b3211b5d5..615fc8202 100644 --- a/Projects/UOContent/Spells/Chivalry/CloseWounds.cs +++ b/Projects/UOContent/Spells/Chivalry/CloseWounds.cs @@ -9,14 +9,14 @@ namespace Server.Spells.Chivalry { public class CloseWoundsSpell : PaladinSpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Close Wounds", "Obsu Vulni", -1, 9002 ); - public CloseWoundsSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public CloseWoundsSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Chivalry/ConsecrateWeapon.cs b/Projects/UOContent/Spells/Chivalry/ConsecrateWeapon.cs index def2f58b2..4033ce18c 100644 --- a/Projects/UOContent/Spells/Chivalry/ConsecrateWeapon.cs +++ b/Projects/UOContent/Spells/Chivalry/ConsecrateWeapon.cs @@ -6,7 +6,7 @@ namespace Server.Spells.Chivalry { public class ConsecrateWeaponSpell : PaladinSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Consecrate Weapon", "Consecrus Arma", -1, @@ -15,7 +15,7 @@ namespace Server.Spells.Chivalry private static readonly Dictionary m_Table = new(); - public ConsecrateWeaponSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public ConsecrateWeaponSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Chivalry/DispelEvil.cs b/Projects/UOContent/Spells/Chivalry/DispelEvil.cs index 71b48ee72..d70ef6859 100644 --- a/Projects/UOContent/Spells/Chivalry/DispelEvil.cs +++ b/Projects/UOContent/Spells/Chivalry/DispelEvil.cs @@ -8,14 +8,14 @@ namespace Server.Spells.Chivalry { public class DispelEvilSpell : PaladinSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Dispel Evil", "Dispiro Malas", -1, 9002 ); - public DispelEvilSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public DispelEvilSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Chivalry/DivineFury.cs b/Projects/UOContent/Spells/Chivalry/DivineFury.cs index c29ac7959..405d60064 100644 --- a/Projects/UOContent/Spells/Chivalry/DivineFury.cs +++ b/Projects/UOContent/Spells/Chivalry/DivineFury.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Chivalry { public class DivineFurySpell : PaladinSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Divine Fury", "Divinum Furis", -1, @@ -14,7 +14,7 @@ namespace Server.Spells.Chivalry private static readonly Dictionary m_Table = new(); - public DivineFurySpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public DivineFurySpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Chivalry/EnemyOfOne.cs b/Projects/UOContent/Spells/Chivalry/EnemyOfOne.cs index 5e58b04cc..b41410fed 100644 --- a/Projects/UOContent/Spells/Chivalry/EnemyOfOne.cs +++ b/Projects/UOContent/Spells/Chivalry/EnemyOfOne.cs @@ -6,7 +6,7 @@ namespace Server.Spells.Chivalry { public class EnemyOfOneSpell : PaladinSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Enemy of One", "Forul Solum", -1, @@ -15,7 +15,7 @@ namespace Server.Spells.Chivalry private static readonly Dictionary m_Table = new(); - public EnemyOfOneSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public EnemyOfOneSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Chivalry/HolyLight.cs b/Projects/UOContent/Spells/Chivalry/HolyLight.cs index ddb1896fb..ae0b79d25 100644 --- a/Projects/UOContent/Spells/Chivalry/HolyLight.cs +++ b/Projects/UOContent/Spells/Chivalry/HolyLight.cs @@ -5,14 +5,14 @@ namespace Server.Spells.Chivalry { public class HolyLightSpell : PaladinSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Holy Light", "Augus Luminos", -1, 9002 ); - public HolyLightSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public HolyLightSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Chivalry/NobleSacrifice.cs b/Projects/UOContent/Spells/Chivalry/NobleSacrifice.cs index f17e2df88..8009e46de 100644 --- a/Projects/UOContent/Spells/Chivalry/NobleSacrifice.cs +++ b/Projects/UOContent/Spells/Chivalry/NobleSacrifice.cs @@ -8,14 +8,14 @@ namespace Server.Spells.Chivalry { public class NobleSacrificeSpell : PaladinSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Noble Sacrifice", "Dium Prostra", -1, 9002 ); - public NobleSacrificeSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public NobleSacrificeSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Chivalry/RemoveCurse.cs b/Projects/UOContent/Spells/Chivalry/RemoveCurse.cs index 10436d6de..21357ec64 100644 --- a/Projects/UOContent/Spells/Chivalry/RemoveCurse.cs +++ b/Projects/UOContent/Spells/Chivalry/RemoveCurse.cs @@ -9,14 +9,14 @@ namespace Server.Spells.Chivalry { public class RemoveCurseSpell : PaladinSpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Remove Curse", "Extermo Vomica", -1, 9002 ); - public RemoveCurseSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public RemoveCurseSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Chivalry/SacredJourney.cs b/Projects/UOContent/Spells/Chivalry/SacredJourney.cs index 3c56bb4c0..0b8667796 100644 --- a/Projects/UOContent/Spells/Chivalry/SacredJourney.cs +++ b/Projects/UOContent/Spells/Chivalry/SacredJourney.cs @@ -8,7 +8,7 @@ namespace Server.Spells.Chivalry { public class SacredJourneySpell : PaladinSpell, IRecallSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Sacred Journey", "Sanctum Viatas", -1, @@ -21,7 +21,7 @@ namespace Server.Spells.Chivalry public SacredJourneySpell( Mobile caster, RunebookEntry entry = null, Runebook book = null, Item scroll = null - ) : base(caster, scroll, m_Info) + ) : base(caster, scroll, _info) { m_Entry = entry; m_Book = book; diff --git a/Projects/UOContent/Spells/Eighth/AirElemental.cs b/Projects/UOContent/Spells/Eighth/AirElemental.cs index 40107272a..a70a940e6 100644 --- a/Projects/UOContent/Spells/Eighth/AirElemental.cs +++ b/Projects/UOContent/Spells/Eighth/AirElemental.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Eighth { public class AirElementalSpell : MagerySpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Air Elemental", "Kal Vas Xen Hur", 269, @@ -16,7 +16,7 @@ namespace Server.Spells.Eighth Reagent.SpidersSilk ); - public AirElementalSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public AirElementalSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Eighth/EarthElemental.cs b/Projects/UOContent/Spells/Eighth/EarthElemental.cs index 5c06991ef..9bad3b1ec 100644 --- a/Projects/UOContent/Spells/Eighth/EarthElemental.cs +++ b/Projects/UOContent/Spells/Eighth/EarthElemental.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Eighth { public class EarthElementalSpell : MagerySpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Earth Elemental", "Kal Vas Xen Ylem", 269, @@ -16,7 +16,7 @@ namespace Server.Spells.Eighth Reagent.SpidersSilk ); - public EarthElementalSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public EarthElementalSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Eighth/Earthquake.cs b/Projects/UOContent/Spells/Eighth/Earthquake.cs index 80bd47bee..ffa480feb 100644 --- a/Projects/UOContent/Spells/Eighth/Earthquake.cs +++ b/Projects/UOContent/Spells/Eighth/Earthquake.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Eighth { public class EarthquakeSpell : MagerySpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Earthquake", "In Vas Por", 233, @@ -17,7 +17,7 @@ namespace Server.Spells.Eighth Reagent.SulfurousAsh ); - public EarthquakeSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public EarthquakeSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Eighth/EnergyVortex.cs b/Projects/UOContent/Spells/Eighth/EnergyVortex.cs index c61d0dbaa..812f67bf0 100644 --- a/Projects/UOContent/Spells/Eighth/EnergyVortex.cs +++ b/Projects/UOContent/Spells/Eighth/EnergyVortex.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Eighth { public class EnergyVortexSpell : MagerySpell, ISpellTargetingPoint3D { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Energy Vortex", "Vas Corp Por", 260, @@ -17,7 +17,7 @@ namespace Server.Spells.Eighth Reagent.Nightshade ); - public EnergyVortexSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public EnergyVortexSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Eighth/FireElemental.cs b/Projects/UOContent/Spells/Eighth/FireElemental.cs index 790d34527..2f99f35f0 100644 --- a/Projects/UOContent/Spells/Eighth/FireElemental.cs +++ b/Projects/UOContent/Spells/Eighth/FireElemental.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Eighth { public class FireElementalSpell : MagerySpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Fire Elemental", "Kal Vas Xen Flam", 269, @@ -17,7 +17,7 @@ namespace Server.Spells.Eighth Reagent.SulfurousAsh ); - public FireElementalSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public FireElementalSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Eighth/Resurrection.cs b/Projects/UOContent/Spells/Eighth/Resurrection.cs index 04f7023bf..77fcc0afb 100644 --- a/Projects/UOContent/Spells/Eighth/Resurrection.cs +++ b/Projects/UOContent/Spells/Eighth/Resurrection.cs @@ -6,7 +6,7 @@ namespace Server.Spells.Eighth { public class ResurrectionSpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Resurrection", "An Corp", 245, @@ -16,7 +16,7 @@ namespace Server.Spells.Eighth Reagent.Ginseng ); - public ResurrectionSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public ResurrectionSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Eighth/SummonDaemon.cs b/Projects/UOContent/Spells/Eighth/SummonDaemon.cs index 8dcb1d367..10f393fd3 100644 --- a/Projects/UOContent/Spells/Eighth/SummonDaemon.cs +++ b/Projects/UOContent/Spells/Eighth/SummonDaemon.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Eighth { public class SummonDaemonSpell : MagerySpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Summon Daemon", "Kal Vas Xen Corp", 269, @@ -17,7 +17,7 @@ namespace Server.Spells.Eighth Reagent.SulfurousAsh ); - public SummonDaemonSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public SummonDaemonSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Eighth/WaterElemental.cs b/Projects/UOContent/Spells/Eighth/WaterElemental.cs index 597bc919e..92b332c96 100644 --- a/Projects/UOContent/Spells/Eighth/WaterElemental.cs +++ b/Projects/UOContent/Spells/Eighth/WaterElemental.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Eighth { public class WaterElementalSpell : MagerySpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Water Elemental", "Kal Vas Xen An Flam", 269, @@ -16,7 +16,7 @@ namespace Server.Spells.Eighth Reagent.SpidersSilk ); - public WaterElementalSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public WaterElementalSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Fifth/BladeSpirits.cs b/Projects/UOContent/Spells/Fifth/BladeSpirits.cs index 3128673d9..296752d60 100644 --- a/Projects/UOContent/Spells/Fifth/BladeSpirits.cs +++ b/Projects/UOContent/Spells/Fifth/BladeSpirits.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Fifth { public class BladeSpiritsSpell : MagerySpell, ISpellTargetingPoint3D { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Blade Spirits", "In Jux Hur Ylem", 266, @@ -16,7 +16,7 @@ namespace Server.Spells.Fifth Reagent.Nightshade ); - public BladeSpiritsSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public BladeSpiritsSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Fifth/DispelField.cs b/Projects/UOContent/Spells/Fifth/DispelField.cs index 055eff7be..e05b2718c 100644 --- a/Projects/UOContent/Spells/Fifth/DispelField.cs +++ b/Projects/UOContent/Spells/Fifth/DispelField.cs @@ -6,7 +6,7 @@ namespace Server.Spells.Fifth { public class DispelFieldSpell : MagerySpell, ISpellTargetingItem { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Dispel Field", "An Grav", 206, @@ -17,7 +17,7 @@ namespace Server.Spells.Fifth Reagent.Garlic ); - public DispelFieldSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public DispelFieldSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Fifth/Incognito.cs b/Projects/UOContent/Spells/Fifth/Incognito.cs index a0eb9b041..58dc05fb3 100644 --- a/Projects/UOContent/Spells/Fifth/Incognito.cs +++ b/Projects/UOContent/Spells/Fifth/Incognito.cs @@ -9,7 +9,7 @@ namespace Server.Spells.Fifth { public class IncognitoSpell : MagerySpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Incognito", "Kal In Ex", 206, @@ -21,7 +21,7 @@ namespace Server.Spells.Fifth private static readonly Dictionary m_Table = new(); - public IncognitoSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public IncognitoSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Fifth/MagicReflect.cs b/Projects/UOContent/Spells/Fifth/MagicReflect.cs index 814887828..a00100674 100644 --- a/Projects/UOContent/Spells/Fifth/MagicReflect.cs +++ b/Projects/UOContent/Spells/Fifth/MagicReflect.cs @@ -4,7 +4,7 @@ namespace Server.Spells.Fifth { public class MagicReflectSpell : MagerySpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Magic Reflection", "In Jux Sanct", 242, @@ -16,7 +16,7 @@ namespace Server.Spells.Fifth private static readonly Dictionary m_Table = new(); - public MagicReflectSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public MagicReflectSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Fifth/MindBlast.cs b/Projects/UOContent/Spells/Fifth/MindBlast.cs index cc19f0743..7f1b6945d 100644 --- a/Projects/UOContent/Spells/Fifth/MindBlast.cs +++ b/Projects/UOContent/Spells/Fifth/MindBlast.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Fifth { public class MindBlastSpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Mind Blast", "Por Corp Wis", 218, @@ -16,11 +16,11 @@ namespace Server.Spells.Fifth Reagent.SulfurousAsh ); - public MindBlastSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public MindBlastSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { if (Core.AOS) { - m_Info.LeftHandEffect = m_Info.RightHandEffect = 9002; + _info.LeftHandEffect = _info.RightHandEffect = 9002; } } diff --git a/Projects/UOContent/Spells/Fifth/Paralyze.cs b/Projects/UOContent/Spells/Fifth/Paralyze.cs index 5ff2a3d72..b7dc8c20d 100644 --- a/Projects/UOContent/Spells/Fifth/Paralyze.cs +++ b/Projects/UOContent/Spells/Fifth/Paralyze.cs @@ -7,7 +7,7 @@ namespace Server.Spells.Fifth { public class ParalyzeSpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Paralyze", "An Ex Por", 218, @@ -17,7 +17,7 @@ namespace Server.Spells.Fifth Reagent.SpidersSilk ); - public ParalyzeSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public ParalyzeSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Fifth/PoisonField.cs b/Projects/UOContent/Spells/Fifth/PoisonField.cs index 4d4216a20..f08d8ca42 100644 --- a/Projects/UOContent/Spells/Fifth/PoisonField.cs +++ b/Projects/UOContent/Spells/Fifth/PoisonField.cs @@ -9,7 +9,7 @@ namespace Server.Spells.Fifth { public class PoisonFieldSpell : MagerySpell, ISpellTargetingPoint3D { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Poison Field", "In Nox Grav", 230, @@ -20,7 +20,7 @@ namespace Server.Spells.Fifth Reagent.SpidersSilk ); - public PoisonFieldSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public PoisonFieldSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Fifth/SummonCreature.cs b/Projects/UOContent/Spells/Fifth/SummonCreature.cs index 93c147c72..b8a4103e1 100644 --- a/Projects/UOContent/Spells/Fifth/SummonCreature.cs +++ b/Projects/UOContent/Spells/Fifth/SummonCreature.cs @@ -6,7 +6,7 @@ namespace Server.Spells.Fifth { public class SummonCreatureSpell : MagerySpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Summon Creature", "Kal Xen", 16, @@ -40,7 +40,7 @@ namespace Server.Spells.Fifth typeof(Rabbit) }; - public SummonCreatureSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public SummonCreatureSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/First/Clumsy.cs b/Projects/UOContent/Spells/First/Clumsy.cs index d63d16b67..e47ddbe16 100644 --- a/Projects/UOContent/Spells/First/Clumsy.cs +++ b/Projects/UOContent/Spells/First/Clumsy.cs @@ -4,7 +4,7 @@ namespace Server.Spells.First { public class ClumsySpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Clumsy", "Uus Jux", 212, @@ -13,7 +13,7 @@ namespace Server.Spells.First Reagent.Nightshade ); - public ClumsySpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public ClumsySpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/First/CreateFood.cs b/Projects/UOContent/Spells/First/CreateFood.cs index 720ec2d37..ab98b5ec0 100644 --- a/Projects/UOContent/Spells/First/CreateFood.cs +++ b/Projects/UOContent/Spells/First/CreateFood.cs @@ -6,7 +6,7 @@ namespace Server.Spells.First { public class CreateFoodSpell : MagerySpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Create Food", "In Mani Ylem", 224, @@ -30,7 +30,7 @@ namespace Server.Spells.First new(typeof(Peach), "a peach") }; - public CreateFoodSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public CreateFoodSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/First/Feeblemind.cs b/Projects/UOContent/Spells/First/Feeblemind.cs index 277cffb32..22a06ef38 100644 --- a/Projects/UOContent/Spells/First/Feeblemind.cs +++ b/Projects/UOContent/Spells/First/Feeblemind.cs @@ -4,7 +4,7 @@ namespace Server.Spells.First { public class FeeblemindSpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Feeblemind", "Rel Wis", 212, @@ -13,7 +13,7 @@ namespace Server.Spells.First Reagent.Nightshade ); - public FeeblemindSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public FeeblemindSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/First/Heal.cs b/Projects/UOContent/Spells/First/Heal.cs index 395b69674..efde53803 100644 --- a/Projects/UOContent/Spells/First/Heal.cs +++ b/Projects/UOContent/Spells/First/Heal.cs @@ -8,7 +8,7 @@ namespace Server.Spells.First { public class HealSpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Heal", "In Mani", 224, @@ -18,7 +18,7 @@ namespace Server.Spells.First Reagent.SpidersSilk ); - public HealSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public HealSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/First/MagicArrow.cs b/Projects/UOContent/Spells/First/MagicArrow.cs index e8cdb0c0b..e8922739d 100644 --- a/Projects/UOContent/Spells/First/MagicArrow.cs +++ b/Projects/UOContent/Spells/First/MagicArrow.cs @@ -4,7 +4,7 @@ namespace Server.Spells.First { public class MagicArrowSpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Magic Arrow", "In Por Ylem", 212, @@ -12,7 +12,7 @@ namespace Server.Spells.First Reagent.SulfurousAsh ); - public MagicArrowSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public MagicArrowSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/First/NightSight.cs b/Projects/UOContent/Spells/First/NightSight.cs index daa618c97..39bee6514 100644 --- a/Projects/UOContent/Spells/First/NightSight.cs +++ b/Projects/UOContent/Spells/First/NightSight.cs @@ -5,7 +5,7 @@ namespace Server.Spells.First { public class NightSightSpell : MagerySpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Night Sight", "In Lor", 236, @@ -14,7 +14,7 @@ namespace Server.Spells.First Reagent.SpidersSilk ); - public NightSightSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public NightSightSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/First/ReactiveArmor.cs b/Projects/UOContent/Spells/First/ReactiveArmor.cs index 4e85f0e02..b60167b13 100644 --- a/Projects/UOContent/Spells/First/ReactiveArmor.cs +++ b/Projects/UOContent/Spells/First/ReactiveArmor.cs @@ -5,7 +5,7 @@ namespace Server.Spells.First { public class ReactiveArmorSpell : MagerySpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Reactive Armor", "Flam Sanct", 236, @@ -17,7 +17,7 @@ namespace Server.Spells.First private static readonly Dictionary m_Table = new(); - public ReactiveArmorSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public ReactiveArmorSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/First/Weaken.cs b/Projects/UOContent/Spells/First/Weaken.cs index 4ff913447..3fcaf4bbe 100644 --- a/Projects/UOContent/Spells/First/Weaken.cs +++ b/Projects/UOContent/Spells/First/Weaken.cs @@ -4,7 +4,7 @@ namespace Server.Spells.First { public class WeakenSpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Weaken", "Des Mani", 212, @@ -13,7 +13,7 @@ namespace Server.Spells.First Reagent.Nightshade ); - public WeakenSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public WeakenSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Fourth/ArchCure.cs b/Projects/UOContent/Spells/Fourth/ArchCure.cs index 55e031045..f2b2bf95e 100644 --- a/Projects/UOContent/Spells/Fourth/ArchCure.cs +++ b/Projects/UOContent/Spells/Fourth/ArchCure.cs @@ -8,7 +8,7 @@ namespace Server.Spells.Fourth { public class ArchCureSpell : MagerySpell, ISpellTargetingPoint3D { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Arch Cure", "Vas An Nox", 215, @@ -18,7 +18,7 @@ namespace Server.Spells.Fourth Reagent.MandrakeRoot ); - public ArchCureSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public ArchCureSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Fourth/ArchProtection.cs b/Projects/UOContent/Spells/Fourth/ArchProtection.cs index 2f1923f3f..916c9643e 100644 --- a/Projects/UOContent/Spells/Fourth/ArchProtection.cs +++ b/Projects/UOContent/Spells/Fourth/ArchProtection.cs @@ -9,7 +9,7 @@ namespace Server.Spells.Fourth { public class ArchProtectionSpell : MagerySpell, ISpellTargetingPoint3D { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Arch Protection", "Vas Uus Sanct", Core.AOS ? 239 : 215, @@ -22,7 +22,7 @@ namespace Server.Spells.Fourth private static readonly Dictionary _Table = new(); - public ArchProtectionSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public ArchProtectionSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Fourth/Curse.cs b/Projects/UOContent/Spells/Fourth/Curse.cs index 73bff2c02..a78c32e76 100644 --- a/Projects/UOContent/Spells/Fourth/Curse.cs +++ b/Projects/UOContent/Spells/Fourth/Curse.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Fourth { public class CurseSpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Curse", "Des Sanct", 227, @@ -17,7 +17,7 @@ namespace Server.Spells.Fourth private static readonly HashSet m_UnderEffect = new(); - public CurseSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public CurseSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Fourth/FireField.cs b/Projects/UOContent/Spells/Fourth/FireField.cs index df1ea840c..cd4934744 100644 --- a/Projects/UOContent/Spells/Fourth/FireField.cs +++ b/Projects/UOContent/Spells/Fourth/FireField.cs @@ -9,7 +9,7 @@ namespace Server.Spells.Fourth { public class FireFieldSpell : MagerySpell, ISpellTargetingPoint3D { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Fire Field", "In Flam Grav", 215, @@ -20,7 +20,7 @@ namespace Server.Spells.Fourth Reagent.SulfurousAsh ); - public FireFieldSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public FireFieldSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Fourth/GreaterHeal.cs b/Projects/UOContent/Spells/Fourth/GreaterHeal.cs index fd1fcc010..36647df92 100644 --- a/Projects/UOContent/Spells/Fourth/GreaterHeal.cs +++ b/Projects/UOContent/Spells/Fourth/GreaterHeal.cs @@ -8,7 +8,7 @@ namespace Server.Spells.Fourth { public class GreaterHealSpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Greater Heal", "In Vas Mani", 204, @@ -19,7 +19,7 @@ namespace Server.Spells.Fourth Reagent.SpidersSilk ); - public GreaterHealSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public GreaterHealSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Fourth/Lightning.cs b/Projects/UOContent/Spells/Fourth/Lightning.cs index e0f2b8745..badf7db64 100644 --- a/Projects/UOContent/Spells/Fourth/Lightning.cs +++ b/Projects/UOContent/Spells/Fourth/Lightning.cs @@ -4,7 +4,7 @@ namespace Server.Spells.Fourth { public class LightningSpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Lightning", "Por Ort Grav", 239, @@ -13,7 +13,7 @@ namespace Server.Spells.Fourth Reagent.SulfurousAsh ); - public LightningSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public LightningSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Fourth/ManaDrain.cs b/Projects/UOContent/Spells/Fourth/ManaDrain.cs index 342b4aed4..e06997783 100644 --- a/Projects/UOContent/Spells/Fourth/ManaDrain.cs +++ b/Projects/UOContent/Spells/Fourth/ManaDrain.cs @@ -6,7 +6,7 @@ namespace Server.Spells.Fourth { public class ManaDrainSpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Mana Drain", "Ort Rel", 215, @@ -18,7 +18,7 @@ namespace Server.Spells.Fourth private static readonly HashSet m_Table = new(); - public ManaDrainSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public ManaDrainSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Fourth/Recall.cs b/Projects/UOContent/Spells/Fourth/Recall.cs index 4ffa32f60..c2f556e33 100644 --- a/Projects/UOContent/Spells/Fourth/Recall.cs +++ b/Projects/UOContent/Spells/Fourth/Recall.cs @@ -8,7 +8,7 @@ namespace Server.Spells.Fourth { public class RecallSpell : MagerySpell, IRecallSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Recall", "Kal Ort Por", 239, @@ -25,7 +25,7 @@ namespace Server.Spells.Fourth public RecallSpell(Mobile caster, RunebookEntry entry = null, Runebook book = null, Item scroll = null) : base( caster, scroll, - m_Info + _info ) { m_Entry = entry; diff --git a/Projects/UOContent/Spells/Gargoyle/SpellDefinitions/FlySpell.cs b/Projects/UOContent/Spells/Gargoyle/SpellDefinitions/FlySpell.cs index 3ead16edf..d6769c25f 100644 --- a/Projects/UOContent/Spells/Gargoyle/SpellDefinitions/FlySpell.cs +++ b/Projects/UOContent/Spells/Gargoyle/SpellDefinitions/FlySpell.cs @@ -4,11 +4,11 @@ namespace Server.Spells { public class FlySpell : Spell { - private static readonly SpellInfo m_Info = new("Gargoyle Flight", null, -1, 9002); + private static readonly SpellInfo _info = new("Gargoyle Flight", null, -1, 9002); private bool m_Stop; public FlySpell(Mobile caster) - : base(caster, null, m_Info) + : base(caster, null, _info) { } diff --git a/Projects/UOContent/Spells/Mysticism/AnimatedWeaponSpell.cs b/Projects/UOContent/Spells/Mysticism/AnimatedWeaponSpell.cs index 341d06697..740ee09c8 100644 --- a/Projects/UOContent/Spells/Mysticism/AnimatedWeaponSpell.cs +++ b/Projects/UOContent/Spells/Mysticism/AnimatedWeaponSpell.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Mysticism { public class AnimatedWeaponSpell : MysticSpell, ISpellTargetingPoint3D { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Animated Weapon", "In Jux Por Ylem", -1, @@ -17,7 +17,7 @@ namespace Server.Spells.Mysticism ); public AnimatedWeaponSpell(Mobile caster, Item scroll = null) - : base(caster, scroll, m_Info) + : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Mysticism/EagleStrikeSpell.cs b/Projects/UOContent/Spells/Mysticism/EagleStrikeSpell.cs index 408ce92c1..30e263db6 100644 --- a/Projects/UOContent/Spells/Mysticism/EagleStrikeSpell.cs +++ b/Projects/UOContent/Spells/Mysticism/EagleStrikeSpell.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Mysticism { public class EagleStrikeSpell : MysticSpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Eagle Strike", "Kal Por Xen", -1, @@ -17,7 +17,7 @@ namespace Server.Spells.Mysticism ); public EagleStrikeSpell(Mobile caster, Item scroll = null) - : base(caster, scroll, m_Info) + : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Mysticism/HailStormSpell.cs b/Projects/UOContent/Spells/Mysticism/HailStormSpell.cs index 9030619cb..586833388 100644 --- a/Projects/UOContent/Spells/Mysticism/HailStormSpell.cs +++ b/Projects/UOContent/Spells/Mysticism/HailStormSpell.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Mysticism { public class HailStormSpell : MysticSpell, ISpellTargetingPoint3D { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Hail Storm", "Kal Des Ylem", -1, @@ -17,7 +17,7 @@ namespace Server.Spells.Mysticism ); public HailStormSpell(Mobile caster, Item scroll = null) - : base(caster, scroll, m_Info) + : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Mysticism/NetherCycloneSpell.cs b/Projects/UOContent/Spells/Mysticism/NetherCycloneSpell.cs index f927aba56..15a79e752 100644 --- a/Projects/UOContent/Spells/Mysticism/NetherCycloneSpell.cs +++ b/Projects/UOContent/Spells/Mysticism/NetherCycloneSpell.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Mysticism { public class NetherCycloneSpell : MysticSpell, ISpellTargetingPoint3D { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Nether Cyclone", "Grav Hur", -1, @@ -17,7 +17,7 @@ namespace Server.Spells.Mysticism ); public NetherCycloneSpell(Mobile caster, Item scroll = null) - : base(caster, scroll, m_Info) + : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Mysticism/SpellPlagueSpell.cs b/Projects/UOContent/Spells/Mysticism/SpellPlagueSpell.cs index 8daac52e0..a5f47d3c4 100644 --- a/Projects/UOContent/Spells/Mysticism/SpellPlagueSpell.cs +++ b/Projects/UOContent/Spells/Mysticism/SpellPlagueSpell.cs @@ -6,7 +6,7 @@ namespace Server.Spells.Mysticism { public class SpellPlagueSpell : MysticSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Spell Plague", "Vas Rel Jux Ort", -1, @@ -20,7 +20,7 @@ namespace Server.Spells.Mysticism private static readonly Dictionary m_Table = new(); public SpellPlagueSpell(Mobile caster, Item scroll = null) - : base(caster, scroll, m_Info) + : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Mysticism/StoneFormSpell.cs b/Projects/UOContent/Spells/Mysticism/StoneFormSpell.cs index 5cdfa8198..a707caecb 100644 --- a/Projects/UOContent/Spells/Mysticism/StoneFormSpell.cs +++ b/Projects/UOContent/Spells/Mysticism/StoneFormSpell.cs @@ -9,7 +9,7 @@ namespace Server.Spells.Mysticism { public class StoneFormSpell : MysticSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Stone Form", "In Rel Ylem", -1, @@ -22,7 +22,7 @@ namespace Server.Spells.Mysticism private static readonly Dictionary m_Table = new(); public StoneFormSpell(Mobile caster, Item scroll = null) - : base(caster, scroll, m_Info) + : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Necromancy/AnimateDeadSpell.cs b/Projects/UOContent/Spells/Necromancy/AnimateDeadSpell.cs index d4e14cfe5..5363f8cb6 100644 --- a/Projects/UOContent/Spells/Necromancy/AnimateDeadSpell.cs +++ b/Projects/UOContent/Spells/Necromancy/AnimateDeadSpell.cs @@ -11,7 +11,7 @@ namespace Server.Spells.Necromancy { public class AnimateDeadSpell : NecromancerSpell, ISpellTargetingItem { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Animate Dead", "Uus Corp", 203, @@ -110,7 +110,7 @@ namespace Server.Spells.Necromancy private static readonly Dictionary> m_Table = new(); - public AnimateDeadSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public AnimateDeadSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Necromancy/BloodOathSpell.cs b/Projects/UOContent/Spells/Necromancy/BloodOathSpell.cs index d68d5c997..dd05819ff 100644 --- a/Projects/UOContent/Spells/Necromancy/BloodOathSpell.cs +++ b/Projects/UOContent/Spells/Necromancy/BloodOathSpell.cs @@ -7,7 +7,7 @@ namespace Server.Spells.Necromancy { public class BloodOathSpell : NecromancerSpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Blood Oath", "In Jux Mani Xen", 203, @@ -18,7 +18,7 @@ namespace Server.Spells.Necromancy private static readonly Dictionary m_OathTable = new(); private static readonly Dictionary m_Table = new(); - public BloodOathSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public BloodOathSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Necromancy/CorpseSkin.cs b/Projects/UOContent/Spells/Necromancy/CorpseSkin.cs index 11fa13137..e39f33118 100644 --- a/Projects/UOContent/Spells/Necromancy/CorpseSkin.cs +++ b/Projects/UOContent/Spells/Necromancy/CorpseSkin.cs @@ -6,7 +6,7 @@ namespace Server.Spells.Necromancy { public class CorpseSkinSpell : NecromancerSpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Corpse Skin", "In Agle Corp Ylem", 203, @@ -17,7 +17,7 @@ namespace Server.Spells.Necromancy private static readonly Dictionary m_Table = new(); - public CorpseSkinSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public CorpseSkinSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Necromancy/CurseWeapon.cs b/Projects/UOContent/Spells/Necromancy/CurseWeapon.cs index eb1ec7582..61062abe6 100644 --- a/Projects/UOContent/Spells/Necromancy/CurseWeapon.cs +++ b/Projects/UOContent/Spells/Necromancy/CurseWeapon.cs @@ -6,7 +6,7 @@ namespace Server.Spells.Necromancy { public class CurseWeaponSpell : NecromancerSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Curse Weapon", "An Sanct Gra Char", 203, @@ -16,7 +16,7 @@ namespace Server.Spells.Necromancy private static readonly Dictionary m_Table = new(); - public CurseWeaponSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public CurseWeaponSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Necromancy/EvilOmen.cs b/Projects/UOContent/Spells/Necromancy/EvilOmen.cs index 789110ffe..686db22ff 100644 --- a/Projects/UOContent/Spells/Necromancy/EvilOmen.cs +++ b/Projects/UOContent/Spells/Necromancy/EvilOmen.cs @@ -7,7 +7,7 @@ namespace Server.Spells.Necromancy { public class EvilOmenSpell : NecromancerSpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Evil Omen", "Pas Tym An Sanct", 203, @@ -19,7 +19,7 @@ namespace Server.Spells.Necromancy private static readonly Dictionary m_Table = new(); public EvilOmenSpell(Mobile caster, Item scroll = null) - : base(caster, scroll, m_Info) + : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Necromancy/Exorcism.cs b/Projects/UOContent/Spells/Necromancy/Exorcism.cs index 37602bf04..4f1c8980a 100644 --- a/Projects/UOContent/Spells/Necromancy/Exorcism.cs +++ b/Projects/UOContent/Spells/Necromancy/Exorcism.cs @@ -10,7 +10,7 @@ namespace Server.Spells.Necromancy { public class ExorcismSpell : NecromancerSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Exorcism", "Ort Corp Grav", 203, @@ -57,7 +57,7 @@ namespace Server.Spells.Necromancy new(295, 712, 55) }; - public ExorcismSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public ExorcismSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Necromancy/HorrificBeast.cs b/Projects/UOContent/Spells/Necromancy/HorrificBeast.cs index 8a2335baa..cfc56e308 100644 --- a/Projects/UOContent/Spells/Necromancy/HorrificBeast.cs +++ b/Projects/UOContent/Spells/Necromancy/HorrificBeast.cs @@ -4,7 +4,7 @@ namespace Server.Spells.Necromancy { public class HorrificBeastSpell : TransformationSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Horrific Beast", "Rel Xen Vas Bal", 203, @@ -13,7 +13,7 @@ namespace Server.Spells.Necromancy Reagent.DaemonBlood ); - public HorrificBeastSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public HorrificBeastSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Necromancy/LichForm.cs b/Projects/UOContent/Spells/Necromancy/LichForm.cs index 42676075e..d53a6b2b2 100644 --- a/Projects/UOContent/Spells/Necromancy/LichForm.cs +++ b/Projects/UOContent/Spells/Necromancy/LichForm.cs @@ -4,7 +4,7 @@ namespace Server.Spells.Necromancy { public class LichFormSpell : TransformationSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Lich Form", "Rel Xen Corp Ort", 203, @@ -14,7 +14,7 @@ namespace Server.Spells.Necromancy Reagent.NoxCrystal ); - public LichFormSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public LichFormSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Necromancy/MindRot.cs b/Projects/UOContent/Spells/Necromancy/MindRot.cs index 44a70e316..3aaeda206 100644 --- a/Projects/UOContent/Spells/Necromancy/MindRot.cs +++ b/Projects/UOContent/Spells/Necromancy/MindRot.cs @@ -6,7 +6,7 @@ namespace Server.Spells.Necromancy { public class MindRotSpell : NecromancerSpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Mind Rot", "Wis An Ben", 203, @@ -18,7 +18,7 @@ namespace Server.Spells.Necromancy private static readonly Dictionary m_Table = new(); - public MindRotSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public MindRotSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Necromancy/PainSpike.cs b/Projects/UOContent/Spells/Necromancy/PainSpike.cs index 7a8646016..632c2af6b 100644 --- a/Projects/UOContent/Spells/Necromancy/PainSpike.cs +++ b/Projects/UOContent/Spells/Necromancy/PainSpike.cs @@ -7,7 +7,7 @@ namespace Server.Spells.Necromancy { public class PainSpikeSpell : NecromancerSpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Pain Spike", "In Sar", 203, @@ -18,7 +18,7 @@ namespace Server.Spells.Necromancy private static readonly Dictionary m_Table = new(); - public PainSpikeSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public PainSpikeSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Necromancy/PoisonStrike.cs b/Projects/UOContent/Spells/Necromancy/PoisonStrike.cs index 79d88a9d7..a978d9834 100644 --- a/Projects/UOContent/Spells/Necromancy/PoisonStrike.cs +++ b/Projects/UOContent/Spells/Necromancy/PoisonStrike.cs @@ -8,7 +8,7 @@ namespace Server.Spells.Necromancy { public class PoisonStrikeSpell : NecromancerSpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Poison Strike", "In Vas Nox", 203, @@ -17,7 +17,7 @@ namespace Server.Spells.Necromancy ); public PoisonStrikeSpell(Mobile caster, Item scroll = null) - : base(caster, scroll, m_Info) + : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Necromancy/Strangle.cs b/Projects/UOContent/Spells/Necromancy/Strangle.cs index f92943b7d..c221e1dac 100644 --- a/Projects/UOContent/Spells/Necromancy/Strangle.cs +++ b/Projects/UOContent/Spells/Necromancy/Strangle.cs @@ -6,7 +6,7 @@ namespace Server.Spells.Necromancy { public class StrangleSpell : NecromancerSpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Strangle", "In Bal Nox", 209, @@ -17,7 +17,7 @@ namespace Server.Spells.Necromancy private static readonly Dictionary m_Table = new(); - public StrangleSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public StrangleSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Necromancy/SummonFamiliar.cs b/Projects/UOContent/Spells/Necromancy/SummonFamiliar.cs index 9bff30d79..59dc363fb 100644 --- a/Projects/UOContent/Spells/Necromancy/SummonFamiliar.cs +++ b/Projects/UOContent/Spells/Necromancy/SummonFamiliar.cs @@ -9,7 +9,7 @@ namespace Server.Spells.Necromancy { public class SummonFamiliarSpell : NecromancerSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Summon Familiar", "Kal Xen Bal", 203, @@ -19,7 +19,7 @@ namespace Server.Spells.Necromancy Reagent.DaemonBlood ); - public SummonFamiliarSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public SummonFamiliarSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Necromancy/VampiricEmbrace.cs b/Projects/UOContent/Spells/Necromancy/VampiricEmbrace.cs index 968e63e3c..31baa8533 100644 --- a/Projects/UOContent/Spells/Necromancy/VampiricEmbrace.cs +++ b/Projects/UOContent/Spells/Necromancy/VampiricEmbrace.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Necromancy { public class VampiricEmbraceSpell : TransformationSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Vampiric Embrace", "Rel Xen An Sanct", 203, @@ -15,7 +15,7 @@ namespace Server.Spells.Necromancy Reagent.PigIron ); - public VampiricEmbraceSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public VampiricEmbraceSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Necromancy/VengefulSpirit.cs b/Projects/UOContent/Spells/Necromancy/VengefulSpirit.cs index 017c12fe0..ea6428845 100644 --- a/Projects/UOContent/Spells/Necromancy/VengefulSpirit.cs +++ b/Projects/UOContent/Spells/Necromancy/VengefulSpirit.cs @@ -6,7 +6,7 @@ namespace Server.Spells.Necromancy { public class VengefulSpiritSpell : NecromancerSpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Vengeful Spirit", "Kal Xen Bal Beh", 203, @@ -16,7 +16,7 @@ namespace Server.Spells.Necromancy Reagent.PigIron ); - public VengefulSpiritSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public VengefulSpiritSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Necromancy/Wither.cs b/Projects/UOContent/Spells/Necromancy/Wither.cs index 25f548644..64329bf17 100644 --- a/Projects/UOContent/Spells/Necromancy/Wither.cs +++ b/Projects/UOContent/Spells/Necromancy/Wither.cs @@ -7,7 +7,7 @@ namespace Server.Spells.Necromancy { public class WitherSpell : NecromancerSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Wither", "Kal Vas An Flam", 203, @@ -18,7 +18,7 @@ namespace Server.Spells.Necromancy ); public WitherSpell(Mobile caster, Item scroll = null) - : base(caster, scroll, m_Info) + : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Necromancy/WraithForm.cs b/Projects/UOContent/Spells/Necromancy/WraithForm.cs index 48f847330..a866e58be 100644 --- a/Projects/UOContent/Spells/Necromancy/WraithForm.cs +++ b/Projects/UOContent/Spells/Necromancy/WraithForm.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Necromancy { public class WraithFormSpell : TransformationSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Wraith Form", "Rel Xen Um", 203, @@ -14,7 +14,7 @@ namespace Server.Spells.Necromancy Reagent.PigIron ); - public WraithFormSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public WraithFormSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Ninjitsu/AnimalForm.cs b/Projects/UOContent/Spells/Ninjitsu/AnimalForm.cs index 78a16e8bf..c07995af0 100644 --- a/Projects/UOContent/Spells/Ninjitsu/AnimalForm.cs +++ b/Projects/UOContent/Spells/Ninjitsu/AnimalForm.cs @@ -18,7 +18,7 @@ namespace Server.Spells.Ninjitsu NoSkill } - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Animal Form", null, -1, @@ -31,7 +31,7 @@ namespace Server.Spells.Ninjitsu private bool m_WasMoving; public AnimalForm(Mobile caster, Item scroll) - : base(caster, scroll, m_Info) + : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Ninjitsu/MirrorImage.cs b/Projects/UOContent/Spells/Ninjitsu/MirrorImage.cs index d01b7b60e..4444a19c0 100644 --- a/Projects/UOContent/Spells/Ninjitsu/MirrorImage.cs +++ b/Projects/UOContent/Spells/Ninjitsu/MirrorImage.cs @@ -12,14 +12,14 @@ namespace Server.Spells.Ninjitsu { private static readonly Dictionary m_CloneCount = new(); - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Mirror Image", null, -1, 9002 ); - public MirrorImage(Mobile caster, Item scroll) : base(caster, scroll, m_Info) + public MirrorImage(Mobile caster, Item scroll) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Ninjitsu/ShadowJump.cs b/Projects/UOContent/Spells/Ninjitsu/ShadowJump.cs index 008132b42..e8dab71e9 100644 --- a/Projects/UOContent/Spells/Ninjitsu/ShadowJump.cs +++ b/Projects/UOContent/Spells/Ninjitsu/ShadowJump.cs @@ -11,14 +11,14 @@ namespace Server.Spells.Ninjitsu { public class Shadowjump : NinjaSpell, ISpellTargetingPoint3D { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Shadowjump", null, -1, 9002 ); - public Shadowjump(Mobile caster, Item scroll) : base(caster, scroll, m_Info) + public Shadowjump(Mobile caster, Item scroll) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Second/Agility.cs b/Projects/UOContent/Spells/Second/Agility.cs index 56380d476..fbe8fa473 100644 --- a/Projects/UOContent/Spells/Second/Agility.cs +++ b/Projects/UOContent/Spells/Second/Agility.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Second { public class AgilitySpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Agility", "Ex Uus", 212, @@ -14,7 +14,7 @@ namespace Server.Spells.Second Reagent.MandrakeRoot ); - public AgilitySpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public AgilitySpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Second/Cunning.cs b/Projects/UOContent/Spells/Second/Cunning.cs index e3ad7c701..ad966c643 100644 --- a/Projects/UOContent/Spells/Second/Cunning.cs +++ b/Projects/UOContent/Spells/Second/Cunning.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Second { public class CunningSpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Cunning", "Uus Wis", 212, @@ -14,7 +14,7 @@ namespace Server.Spells.Second Reagent.Nightshade ); - public CunningSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public CunningSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Second/Cure.cs b/Projects/UOContent/Spells/Second/Cure.cs index 1b02a0240..1b0bc413e 100644 --- a/Projects/UOContent/Spells/Second/Cure.cs +++ b/Projects/UOContent/Spells/Second/Cure.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Second { public class CureSpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Cure", "An Nox", 212, @@ -14,7 +14,7 @@ namespace Server.Spells.Second Reagent.Ginseng ); - public CureSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public CureSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Second/Harm.cs b/Projects/UOContent/Spells/Second/Harm.cs index 3960d2b54..fd1d58adc 100644 --- a/Projects/UOContent/Spells/Second/Harm.cs +++ b/Projects/UOContent/Spells/Second/Harm.cs @@ -4,7 +4,7 @@ namespace Server.Spells.Second { public class HarmSpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Harm", "An Mani", 212, @@ -13,7 +13,7 @@ namespace Server.Spells.Second Reagent.SpidersSilk ); - public HarmSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public HarmSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Second/MagicTrap.cs b/Projects/UOContent/Spells/Second/MagicTrap.cs index 5dfbc66ac..c8b2a37ec 100644 --- a/Projects/UOContent/Spells/Second/MagicTrap.cs +++ b/Projects/UOContent/Spells/Second/MagicTrap.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Second { public class MagicTrapSpell : MagerySpell, ISpellTargetingItem { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Magic Trap", "In Jux", 212, @@ -15,7 +15,7 @@ namespace Server.Spells.Second Reagent.SulfurousAsh ); - public MagicTrapSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public MagicTrapSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Second/Protection.cs b/Projects/UOContent/Spells/Second/Protection.cs index 430df38b6..30fe8d194 100644 --- a/Projects/UOContent/Spells/Second/Protection.cs +++ b/Projects/UOContent/Spells/Second/Protection.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Second { public class ProtectionSpell : MagerySpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Protection", "Uus Sanct", 236, @@ -18,7 +18,7 @@ namespace Server.Spells.Second private static readonly Dictionary> m_Table = new(); - public ProtectionSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public ProtectionSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Second/RemoveTrap.cs b/Projects/UOContent/Spells/Second/RemoveTrap.cs index a573cada7..7ff0c0005 100644 --- a/Projects/UOContent/Spells/Second/RemoveTrap.cs +++ b/Projects/UOContent/Spells/Second/RemoveTrap.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Second { public class RemoveTrapSpell : MagerySpell, ISpellTargetingItem { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Remove Trap", "An Jux", 212, @@ -14,7 +14,7 @@ namespace Server.Spells.Second Reagent.SulfurousAsh ); - public RemoveTrapSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public RemoveTrapSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Second/Strength.cs b/Projects/UOContent/Spells/Second/Strength.cs index 749c624e9..536662cbd 100644 --- a/Projects/UOContent/Spells/Second/Strength.cs +++ b/Projects/UOContent/Spells/Second/Strength.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Second { public class StrengthSpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Strength", "Uus Mani", 212, @@ -14,7 +14,7 @@ namespace Server.Spells.Second Reagent.Nightshade ); - public StrengthSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public StrengthSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Seventh/ChainLightning.cs b/Projects/UOContent/Spells/Seventh/ChainLightning.cs index 7823ba97b..f036fab6d 100644 --- a/Projects/UOContent/Spells/Seventh/ChainLightning.cs +++ b/Projects/UOContent/Spells/Seventh/ChainLightning.cs @@ -6,7 +6,7 @@ namespace Server.Spells.Seventh { public class ChainLightningSpell : MagerySpell, ISpellTargetingPoint3D { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Chain Lightning", "Vas Ort Grav", 209, @@ -18,7 +18,7 @@ namespace Server.Spells.Seventh Reagent.SulfurousAsh ); - public ChainLightningSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public ChainLightningSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Seventh/EnergyField.cs b/Projects/UOContent/Spells/Seventh/EnergyField.cs index 0562fd4b0..5bee0d18c 100644 --- a/Projects/UOContent/Spells/Seventh/EnergyField.cs +++ b/Projects/UOContent/Spells/Seventh/EnergyField.cs @@ -8,7 +8,7 @@ namespace Server.Spells.Seventh { public class EnergyFieldSpell : MagerySpell, ISpellTargetingPoint3D { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Energy Field", "In Sanct Grav", 221, @@ -20,7 +20,7 @@ namespace Server.Spells.Seventh Reagent.SulfurousAsh ); - public EnergyFieldSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public EnergyFieldSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Seventh/FlameStrike.cs b/Projects/UOContent/Spells/Seventh/FlameStrike.cs index 81e1c4af2..e307f9be7 100644 --- a/Projects/UOContent/Spells/Seventh/FlameStrike.cs +++ b/Projects/UOContent/Spells/Seventh/FlameStrike.cs @@ -4,7 +4,7 @@ namespace Server.Spells.Seventh { public class FlameStrikeSpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Flame Strike", "Kal Vas Flam", 245, @@ -13,7 +13,7 @@ namespace Server.Spells.Seventh Reagent.SulfurousAsh ); - public FlameStrikeSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public FlameStrikeSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Seventh/GateTravel.cs b/Projects/UOContent/Spells/Seventh/GateTravel.cs index 709b6d42a..258dce8a3 100644 --- a/Projects/UOContent/Spells/Seventh/GateTravel.cs +++ b/Projects/UOContent/Spells/Seventh/GateTravel.cs @@ -8,7 +8,7 @@ namespace Server.Spells.Seventh { public class GateTravelSpell : MagerySpell, IRecallSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Gate Travel", "Vas Rel Por", 263, @@ -21,7 +21,7 @@ namespace Server.Spells.Seventh private readonly RunebookEntry m_Entry; public GateTravelSpell(Mobile caster, RunebookEntry entry = null, Item scroll = null) : - base(caster, scroll, m_Info) => m_Entry = entry; + base(caster, scroll, _info) => m_Entry = entry; public override SpellCircle Circle => SpellCircle.Seventh; diff --git a/Projects/UOContent/Spells/Seventh/ManaVampire.cs b/Projects/UOContent/Spells/Seventh/ManaVampire.cs index d7ec16654..15d99f19d 100644 --- a/Projects/UOContent/Spells/Seventh/ManaVampire.cs +++ b/Projects/UOContent/Spells/Seventh/ManaVampire.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Seventh { public class ManaVampireSpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Mana Vampire", "Ort Sanct", 221, @@ -16,7 +16,7 @@ namespace Server.Spells.Seventh Reagent.SpidersSilk ); - public ManaVampireSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public ManaVampireSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Seventh/MassDispel.cs b/Projects/UOContent/Spells/Seventh/MassDispel.cs index 63b4109e7..8ba30654d 100644 --- a/Projects/UOContent/Spells/Seventh/MassDispel.cs +++ b/Projects/UOContent/Spells/Seventh/MassDispel.cs @@ -6,7 +6,7 @@ namespace Server.Spells.Seventh { public class MassDispelSpell : MagerySpell, ISpellTargetingPoint3D { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Mass Dispel", "Vas An Ort", 263, @@ -17,7 +17,7 @@ namespace Server.Spells.Seventh Reagent.SulfurousAsh ); - public MassDispelSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public MassDispelSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Seventh/MeteorSwarm.cs b/Projects/UOContent/Spells/Seventh/MeteorSwarm.cs index cfc11ee54..594afccc7 100644 --- a/Projects/UOContent/Spells/Seventh/MeteorSwarm.cs +++ b/Projects/UOContent/Spells/Seventh/MeteorSwarm.cs @@ -6,7 +6,7 @@ namespace Server.Spells.Seventh { public class MeteorSwarmSpell : MagerySpell, ISpellTargetingPoint3D { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Meteor Swarm", "Flam Kal Des Ylem", 233, @@ -18,7 +18,7 @@ namespace Server.Spells.Seventh Reagent.SpidersSilk ); - public MeteorSwarmSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public MeteorSwarmSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Seventh/Polymorph.cs b/Projects/UOContent/Spells/Seventh/Polymorph.cs index a473a7e04..f53deedcd 100644 --- a/Projects/UOContent/Spells/Seventh/Polymorph.cs +++ b/Projects/UOContent/Spells/Seventh/Polymorph.cs @@ -9,7 +9,7 @@ namespace Server.Spells.Seventh { public class PolymorphSpell : MagerySpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Polymorph", "Vas Ylem Rel", 221, @@ -23,7 +23,7 @@ namespace Server.Spells.Seventh private readonly int m_NewBody; - public PolymorphSpell(Mobile caster, Item scroll, int body = 0) : base(caster, scroll, m_Info) => m_NewBody = body; + public PolymorphSpell(Mobile caster, Item scroll, int body = 0) : base(caster, scroll, _info) => m_NewBody = body; public override SpellCircle Circle => SpellCircle.Seventh; diff --git a/Projects/UOContent/Spells/Sixth/Dispel.cs b/Projects/UOContent/Spells/Sixth/Dispel.cs index d67753515..f4cfbd8fc 100644 --- a/Projects/UOContent/Spells/Sixth/Dispel.cs +++ b/Projects/UOContent/Spells/Sixth/Dispel.cs @@ -6,7 +6,7 @@ namespace Server.Spells.Sixth { public class DispelSpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Dispel", "An Ort", 218, @@ -16,7 +16,7 @@ namespace Server.Spells.Sixth Reagent.SulfurousAsh ); - public DispelSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public DispelSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Sixth/EnergyBolt.cs b/Projects/UOContent/Spells/Sixth/EnergyBolt.cs index 6026fceaf..9ebcb415b 100644 --- a/Projects/UOContent/Spells/Sixth/EnergyBolt.cs +++ b/Projects/UOContent/Spells/Sixth/EnergyBolt.cs @@ -4,7 +4,7 @@ namespace Server.Spells.Sixth { public class EnergyBoltSpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Energy Bolt", "Corp Por", 230, @@ -13,7 +13,7 @@ namespace Server.Spells.Sixth Reagent.Nightshade ); - public EnergyBoltSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public EnergyBoltSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Sixth/Explosion.cs b/Projects/UOContent/Spells/Sixth/Explosion.cs index 407699b5b..88acce5b2 100644 --- a/Projects/UOContent/Spells/Sixth/Explosion.cs +++ b/Projects/UOContent/Spells/Sixth/Explosion.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Sixth { public class ExplosionSpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Explosion", "Vas Ort Flam", 230, @@ -14,8 +14,7 @@ namespace Server.Spells.Sixth Reagent.MandrakeRoot ); - public ExplosionSpell(Mobile caster, Item scroll = null) - : base(caster, scroll, m_Info) + public ExplosionSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Sixth/Invisibility.cs b/Projects/UOContent/Spells/Sixth/Invisibility.cs index ae69a58fe..aeb42f8d0 100644 --- a/Projects/UOContent/Spells/Sixth/Invisibility.cs +++ b/Projects/UOContent/Spells/Sixth/Invisibility.cs @@ -9,7 +9,7 @@ namespace Server.Spells.Sixth { public class InvisibilitySpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Invisibility", "An Lor Xen", 206, @@ -20,7 +20,7 @@ namespace Server.Spells.Sixth private static readonly Dictionary m_Table = new(); - public InvisibilitySpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public InvisibilitySpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Sixth/Mark.cs b/Projects/UOContent/Spells/Sixth/Mark.cs index 076998990..b35a25784 100644 --- a/Projects/UOContent/Spells/Sixth/Mark.cs +++ b/Projects/UOContent/Spells/Sixth/Mark.cs @@ -6,7 +6,7 @@ namespace Server.Spells.Sixth { public class MarkSpell : MagerySpell, ISpellTargetingItem { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Mark", "Kal Por Ylem", 218, @@ -16,7 +16,7 @@ namespace Server.Spells.Sixth Reagent.MandrakeRoot ); - public MarkSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public MarkSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Sixth/MassCurse.cs b/Projects/UOContent/Spells/Sixth/MassCurse.cs index 3130a9817..375789e41 100644 --- a/Projects/UOContent/Spells/Sixth/MassCurse.cs +++ b/Projects/UOContent/Spells/Sixth/MassCurse.cs @@ -4,7 +4,7 @@ namespace Server.Spells.Sixth { public class MassCurseSpell : MagerySpell, ISpellTargetingPoint3D { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Mass Curse", "Vas Des Sanct", 218, @@ -16,7 +16,7 @@ namespace Server.Spells.Sixth Reagent.SulfurousAsh ); - public MassCurseSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public MassCurseSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Sixth/ParalyzeField.cs b/Projects/UOContent/Spells/Sixth/ParalyzeField.cs index 73110b457..cea6f4e50 100644 --- a/Projects/UOContent/Spells/Sixth/ParalyzeField.cs +++ b/Projects/UOContent/Spells/Sixth/ParalyzeField.cs @@ -8,7 +8,7 @@ namespace Server.Spells.Sixth { public class ParalyzeFieldSpell : MagerySpell, ISpellTargetingPoint3D { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Paralyze Field", "In Ex Grav", 230, @@ -19,7 +19,7 @@ namespace Server.Spells.Sixth Reagent.SpidersSilk ); - public ParalyzeFieldSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public ParalyzeFieldSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Sixth/Reveal.cs b/Projects/UOContent/Spells/Sixth/Reveal.cs index 86576fa0b..a6793b1e5 100644 --- a/Projects/UOContent/Spells/Sixth/Reveal.cs +++ b/Projects/UOContent/Spells/Sixth/Reveal.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Sixth { public class RevealSpell : MagerySpell, ISpellTargetingPoint3D { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Reveal", "Wis Quas", 206, @@ -14,7 +14,7 @@ namespace Server.Spells.Sixth Reagent.SulfurousAsh ); - public RevealSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public RevealSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Spellweaving/ArcaneCircle.cs b/Projects/UOContent/Spells/Spellweaving/ArcaneCircle.cs index b55588a0e..5399efdec 100644 --- a/Projects/UOContent/Spells/Spellweaving/ArcaneCircle.cs +++ b/Projects/UOContent/Spells/Spellweaving/ArcaneCircle.cs @@ -7,14 +7,14 @@ namespace Server.Spells.Spellweaving { public class ArcaneCircleSpell : ArcanistSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Arcane Circle", "Myrshalee", -1 ); public ArcaneCircleSpell(Mobile caster, Item scroll = null) - : base(caster, scroll, m_Info) + : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Spellweaving/AttuneWeapon.cs b/Projects/UOContent/Spells/Spellweaving/AttuneWeapon.cs index ce1db2da5..fcd22bc9b 100644 --- a/Projects/UOContent/Spells/Spellweaving/AttuneWeapon.cs +++ b/Projects/UOContent/Spells/Spellweaving/AttuneWeapon.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Spellweaving { public class AttuneWeaponSpell : ArcanistSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Attune Weapon", "Haeldril", -1 @@ -14,7 +14,7 @@ namespace Server.Spells.Spellweaving private static readonly Dictionary m_Table = new(); public AttuneWeaponSpell(Mobile caster, Item scroll = null) - : base(caster, scroll, m_Info) + : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Spellweaving/EssenceOfWind.cs b/Projects/UOContent/Spells/Spellweaving/EssenceOfWind.cs index 0292dea1d..7f676a578 100644 --- a/Projects/UOContent/Spells/Spellweaving/EssenceOfWind.cs +++ b/Projects/UOContent/Spells/Spellweaving/EssenceOfWind.cs @@ -5,11 +5,11 @@ namespace Server.Spells.Spellweaving { public class EssenceOfWindSpell : ArcanistSpell { - private static readonly SpellInfo m_Info = new("Essence of Wind", "Anathrae", -1); + private static readonly SpellInfo _info = new("Essence of Wind", "Anathrae", -1); private static readonly Dictionary m_Table = new(); - public EssenceOfWindSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public EssenceOfWindSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Spellweaving/EtherealVoyage.cs b/Projects/UOContent/Spells/Spellweaving/EtherealVoyage.cs index a68b50207..de9fbaf2b 100644 --- a/Projects/UOContent/Spells/Spellweaving/EtherealVoyage.cs +++ b/Projects/UOContent/Spells/Spellweaving/EtherealVoyage.cs @@ -4,14 +4,14 @@ namespace Server.Spells.Spellweaving { public class EtherealVoyageSpell : ArcaneForm { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Ethereal Voyage", "Orlavdra", -1 ); public EtherealVoyageSpell(Mobile caster, Item scroll = null) - : base(caster, scroll, m_Info) + : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Spellweaving/GiftOfLife.cs b/Projects/UOContent/Spells/Spellweaving/GiftOfLife.cs index 8d27cd5c6..9f0b2247b 100644 --- a/Projects/UOContent/Spells/Spellweaving/GiftOfLife.cs +++ b/Projects/UOContent/Spells/Spellweaving/GiftOfLife.cs @@ -8,7 +8,7 @@ namespace Server.Spells.Spellweaving { public class GiftOfLifeSpell : ArcanistSpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Gift of Life", "Illorae", -1 @@ -17,7 +17,7 @@ namespace Server.Spells.Spellweaving private static readonly Dictionary m_Table = new(); public GiftOfLifeSpell(Mobile caster, Item scroll = null) - : base(caster, scroll, m_Info) + : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Spellweaving/GiftOfRenewal.cs b/Projects/UOContent/Spells/Spellweaving/GiftOfRenewal.cs index 692c909a4..5bf8db8ac 100644 --- a/Projects/UOContent/Spells/Spellweaving/GiftOfRenewal.cs +++ b/Projects/UOContent/Spells/Spellweaving/GiftOfRenewal.cs @@ -6,7 +6,7 @@ namespace Server.Spells.Spellweaving { public class GiftOfRenewalSpell : ArcanistSpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Gift of Renewal", "Olorisstra", -1 @@ -15,7 +15,7 @@ namespace Server.Spells.Spellweaving private static readonly Dictionary m_Table = new(); public GiftOfRenewalSpell(Mobile caster, Item scroll = null) - : base(caster, scroll, m_Info) + : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Spellweaving/ImmolatingWeapon.cs b/Projects/UOContent/Spells/Spellweaving/ImmolatingWeapon.cs index 929f077f8..10ce95d8d 100644 --- a/Projects/UOContent/Spells/Spellweaving/ImmolatingWeapon.cs +++ b/Projects/UOContent/Spells/Spellweaving/ImmolatingWeapon.cs @@ -6,7 +6,7 @@ namespace Server.Spells.Spellweaving { public class ImmolatingWeaponSpell : ArcanistSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Immolating Weapon", "Thalshara", -1 @@ -15,7 +15,7 @@ namespace Server.Spells.Spellweaving private static readonly Dictionary m_Table = new(); public ImmolatingWeaponSpell(Mobile caster, Item scroll = null) - : base(caster, scroll, m_Info) + : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Spellweaving/NatureFury.cs b/Projects/UOContent/Spells/Spellweaving/NatureFury.cs index 4216be3e1..bd8fe059d 100644 --- a/Projects/UOContent/Spells/Spellweaving/NatureFury.cs +++ b/Projects/UOContent/Spells/Spellweaving/NatureFury.cs @@ -7,7 +7,7 @@ namespace Server.Spells.Spellweaving { public class NatureFurySpell : ArcanistSpell, ISpellTargetingPoint3D { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Nature's Fury", "Rauvvrae", -1, @@ -15,7 +15,7 @@ namespace Server.Spells.Spellweaving ); public NatureFurySpell(Mobile caster, Item scroll = null) - : base(caster, scroll, m_Info) + : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Spellweaving/ReaperForm.cs b/Projects/UOContent/Spells/Spellweaving/ReaperForm.cs index a98eeeb66..3486393a2 100644 --- a/Projects/UOContent/Spells/Spellweaving/ReaperForm.cs +++ b/Projects/UOContent/Spells/Spellweaving/ReaperForm.cs @@ -5,9 +5,9 @@ namespace Server.Spells.Spellweaving { public class ReaperFormSpell : ArcaneForm { - private static readonly SpellInfo m_Info = new("Reaper Form", "Tarisstree", -1); + private static readonly SpellInfo _info = new("Reaper Form", "Tarisstree", -1); - public ReaperFormSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public ReaperFormSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Spellweaving/SummonFey.cs b/Projects/UOContent/Spells/Spellweaving/SummonFey.cs index 5e2b13f3f..d9daf6210 100644 --- a/Projects/UOContent/Spells/Spellweaving/SummonFey.cs +++ b/Projects/UOContent/Spells/Spellweaving/SummonFey.cs @@ -6,14 +6,14 @@ namespace Server.Spells.Spellweaving { public class SummonFeySpell : ArcaneSummon { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Summon Fey", "Alalithra", -1 ); public SummonFeySpell(Mobile caster, Item scroll = null) - : base(caster, scroll, m_Info) + : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Spellweaving/SummonFiend.cs b/Projects/UOContent/Spells/Spellweaving/SummonFiend.cs index a4341304d..1e1d35c60 100644 --- a/Projects/UOContent/Spells/Spellweaving/SummonFiend.cs +++ b/Projects/UOContent/Spells/Spellweaving/SummonFiend.cs @@ -6,14 +6,14 @@ namespace Server.Spells.Spellweaving { public class SummonFiendSpell : ArcaneSummon { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Summon Fiend", "Nylisstra", -1 ); public SummonFiendSpell(Mobile caster, Item scroll = null) - : base(caster, scroll, m_Info) + : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Spellweaving/Thunderstorm.cs b/Projects/UOContent/Spells/Spellweaving/Thunderstorm.cs index 38fa38cff..c69e01f50 100644 --- a/Projects/UOContent/Spells/Spellweaving/Thunderstorm.cs +++ b/Projects/UOContent/Spells/Spellweaving/Thunderstorm.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Spellweaving { public class ThunderstormSpell : ArcanistSpell { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Thunderstorm", "Erelonia", -1 @@ -14,7 +14,7 @@ namespace Server.Spells.Spellweaving private static readonly Dictionary m_Table = new(); public ThunderstormSpell(Mobile caster, Item scroll = null) - : base(caster, scroll, m_Info) + : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Spellweaving/WordOfDeath.cs b/Projects/UOContent/Spells/Spellweaving/WordOfDeath.cs index bed32e92f..7cdd76846 100644 --- a/Projects/UOContent/Spells/Spellweaving/WordOfDeath.cs +++ b/Projects/UOContent/Spells/Spellweaving/WordOfDeath.cs @@ -5,9 +5,9 @@ namespace Server.Spells.Spellweaving { public class WordOfDeathSpell : ArcanistSpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new("Word of Death", "Nyraxle", -1); + private static readonly SpellInfo _info = new("Word of Death", "Nyraxle", -1); - public WordOfDeathSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public WordOfDeathSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Third/Bless.cs b/Projects/UOContent/Spells/Third/Bless.cs index 89862201e..3c694cc69 100644 --- a/Projects/UOContent/Spells/Third/Bless.cs +++ b/Projects/UOContent/Spells/Third/Bless.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Third { public class BlessSpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Bless", "Rel Sanct", 203, @@ -14,7 +14,7 @@ namespace Server.Spells.Third Reagent.MandrakeRoot ); - public BlessSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public BlessSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Third/Fireball.cs b/Projects/UOContent/Spells/Third/Fireball.cs index 4c650115d..298dc2f0a 100644 --- a/Projects/UOContent/Spells/Third/Fireball.cs +++ b/Projects/UOContent/Spells/Third/Fireball.cs @@ -4,7 +4,7 @@ namespace Server.Spells.Third { public class FireballSpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Fireball", "Vas Flam", 203, @@ -12,7 +12,7 @@ namespace Server.Spells.Third Reagent.BlackPearl ); - public FireballSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public FireballSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Third/MagicLock.cs b/Projects/UOContent/Spells/Third/MagicLock.cs index 13a7ca597..040976001 100644 --- a/Projects/UOContent/Spells/Third/MagicLock.cs +++ b/Projects/UOContent/Spells/Third/MagicLock.cs @@ -7,7 +7,7 @@ namespace Server.Spells.Third { public class MagicLockSpell : MagerySpell, ISpellTargetingItem { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Magic Lock", "An Por", 215, @@ -17,7 +17,7 @@ namespace Server.Spells.Third Reagent.SulfurousAsh ); - public MagicLockSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public MagicLockSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Third/Poison.cs b/Projects/UOContent/Spells/Third/Poison.cs index 24180f5cb..71cd43495 100644 --- a/Projects/UOContent/Spells/Third/Poison.cs +++ b/Projects/UOContent/Spells/Third/Poison.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Third { public class PoisonSpell : MagerySpell, ISpellTargetingMobile { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Poison", "In Nox", 203, @@ -13,7 +13,7 @@ namespace Server.Spells.Third Reagent.Nightshade ); - public PoisonSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public PoisonSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Third/Telekinesis.cs b/Projects/UOContent/Spells/Third/Telekinesis.cs index 94728d372..37d92c4d9 100644 --- a/Projects/UOContent/Spells/Third/Telekinesis.cs +++ b/Projects/UOContent/Spells/Third/Telekinesis.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Third { public class TelekinesisSpell : MagerySpell, ISpellTargetingItem { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Telekinesis", "Ort Por Ylem", 203, @@ -14,7 +14,7 @@ namespace Server.Spells.Third Reagent.MandrakeRoot ); - public TelekinesisSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public TelekinesisSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Third/Teleport.cs b/Projects/UOContent/Spells/Third/Teleport.cs index 2ea13dfa7..2e1981525 100644 --- a/Projects/UOContent/Spells/Third/Teleport.cs +++ b/Projects/UOContent/Spells/Third/Teleport.cs @@ -11,7 +11,7 @@ namespace Server.Spells.Third { public class TeleportSpell : MagerySpell, ISpellTargetingPoint3D { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Teleport", "Rel Por", 215, @@ -20,7 +20,7 @@ namespace Server.Spells.Third Reagent.MandrakeRoot ); - public TeleportSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public TeleportSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Third/Unlock.cs b/Projects/UOContent/Spells/Third/Unlock.cs index 284e6693a..d303b3151 100644 --- a/Projects/UOContent/Spells/Third/Unlock.cs +++ b/Projects/UOContent/Spells/Third/Unlock.cs @@ -7,7 +7,7 @@ namespace Server.Spells.Third { public class UnlockSpell : MagerySpell, ISpellTargetingPoint3D { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Unlock Spell", "Ex Por", 215, @@ -16,7 +16,7 @@ namespace Server.Spells.Third Reagent.SulfurousAsh ); - public UnlockSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public UnlockSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } diff --git a/Projects/UOContent/Spells/Third/WallOfStone.cs b/Projects/UOContent/Spells/Third/WallOfStone.cs index c03f403e5..f0f1ec926 100644 --- a/Projects/UOContent/Spells/Third/WallOfStone.cs +++ b/Projects/UOContent/Spells/Third/WallOfStone.cs @@ -7,7 +7,7 @@ namespace Server.Spells.Third { public class WallOfStoneSpell : MagerySpell, ISpellTargetingPoint3D { - private static readonly SpellInfo m_Info = new( + private static readonly SpellInfo _info = new( "Wall of Stone", "In Sanct Ylem", 227, @@ -17,7 +17,7 @@ namespace Server.Spells.Third Reagent.Garlic ); - public WallOfStoneSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info) + public WallOfStoneSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { } From 5df7bf6a7572fb0011a0f65408e1bc3f138af3cc Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Sun, 14 Nov 2021 18:45:16 -0800 Subject: [PATCH 07/16] fix: Removes duplicative spell checks (#849) --- Projects/Server/Targeting/Target.cs | 55 +++++++++---------- Projects/UOContent/Commands/Handlers.cs | 2 - Projects/UOContent/Compression/TarArchive.cs | 5 -- Projects/UOContent/Compression/ZstdArchive.cs | 1 - .../UOContent/Spells/Eighth/Resurrection.cs | 11 +--- .../UOContent/Spells/Fifth/DispelField.cs | 10 +--- Projects/UOContent/Spells/Fifth/MindBlast.cs | 11 +--- Projects/UOContent/Spells/Fifth/Paralyze.cs | 12 +--- .../UOContent/Spells/Fifth/PoisonField.cs | 6 +- Projects/UOContent/Spells/First/Clumsy.cs | 11 +--- Projects/UOContent/Spells/First/Feeblemind.cs | 11 +--- Projects/UOContent/Spells/First/Heal.cs | 11 +--- Projects/UOContent/Spells/First/MagicArrow.cs | 11 +--- Projects/UOContent/Spells/First/Weaken.cs | 11 +--- Projects/UOContent/Spells/Fourth/ArchCure.cs | 6 +- .../UOContent/Spells/Fourth/ArchProtection.cs | 6 +- Projects/UOContent/Spells/Fourth/Curse.cs | 15 +---- Projects/UOContent/Spells/Fourth/FireField.cs | 6 +- .../UOContent/Spells/Fourth/GreaterHeal.cs | 11 +--- Projects/UOContent/Spells/Fourth/Lightning.cs | 11 +--- Projects/UOContent/Spells/Fourth/ManaDrain.cs | 11 +--- .../Spells/Mysticism/SpellPlagueSpell.cs | 6 +- Projects/UOContent/Spells/Second/Agility.cs | 11 +--- Projects/UOContent/Spells/Second/Cunning.cs | 11 +--- Projects/UOContent/Spells/Second/Cure.cs | 11 +--- Projects/UOContent/Spells/Second/Harm.cs | 11 +--- Projects/UOContent/Spells/Second/MagicTrap.cs | 4 -- .../UOContent/Spells/Second/RemoveTrap.cs | 8 +-- Projects/UOContent/Spells/Second/Strength.cs | 11 +--- .../Spells/Seventh/ChainLightning.cs | 6 +- .../UOContent/Spells/Seventh/EnergyField.cs | 6 +- .../UOContent/Spells/Seventh/FlameStrike.cs | 11 +--- .../UOContent/Spells/Seventh/ManaVampire.cs | 11 +--- .../UOContent/Spells/Seventh/MassDispel.cs | 6 +- .../UOContent/Spells/Seventh/MeteorSwarm.cs | 6 +- Projects/UOContent/Spells/Sixth/Dispel.cs | 11 +--- Projects/UOContent/Spells/Sixth/EnergyBolt.cs | 11 +--- Projects/UOContent/Spells/Sixth/Explosion.cs | 11 +--- .../UOContent/Spells/Sixth/Invisibility.cs | 11 +--- Projects/UOContent/Spells/Sixth/Mark.cs | 17 ++---- Projects/UOContent/Spells/Sixth/MassCurse.cs | 6 +- .../UOContent/Spells/Sixth/ParalyzeField.cs | 6 +- Projects/UOContent/Spells/Sixth/Reveal.cs | 6 +- .../Spells/Spellweaving/GiftOfLife.cs | 10 +--- .../Spells/Spellweaving/GiftOfRenewal.cs | 11 +--- .../Spells/Spellweaving/WordOfDeath.cs | 11 +--- Projects/UOContent/Spells/Third/Bless.cs | 11 +--- Projects/UOContent/Spells/Third/Fireball.cs | 11 +--- Projects/UOContent/Spells/Third/Poison.cs | 11 +--- .../UOContent/Spells/Third/WallOfStone.cs | 6 +- 50 files changed, 78 insertions(+), 425 deletions(-) diff --git a/Projects/Server/Targeting/Target.cs b/Projects/Server/Targeting/Target.cs index d0035ed3b..e60231322 100644 --- a/Projects/Server/Targeting/Target.cs +++ b/Projects/Server/Targeting/Target.cs @@ -164,36 +164,33 @@ namespace Server.Targeting { OnTargetOutOfRange(from, targeted); } - else + else if (!from.CanSee(targeted)) { - if (!from.CanSee(targeted)) - { - OnCantSeeTarget(from, targeted); - } - else if (CheckLOS && !from.InLOS(targeted)) - { - OnTargetOutOfLOS(from, targeted); - } - else if (item?.InSecureTrade == true) - { - OnTargetInSecureTrade(from, targeted); - } - else if (item?.IsAccessibleTo(from) == false) - { - OnTargetNotAccessible(from, targeted); - } - else if (item?.CheckTarget(from, this, targeted) == false) - { - OnTargetUntargetable(from, targeted); - } - else if (mobile?.CheckTarget(from, this, mobile) == false) - { - OnTargetUntargetable(from, mobile); - } - else if (from.Region.OnTarget(from, this, targeted)) - { - OnTarget(from, targeted); - } + OnCantSeeTarget(from, targeted); + } + else if (CheckLOS && !from.InLOS(targeted)) + { + OnTargetOutOfLOS(from, targeted); + } + else if (item?.InSecureTrade == true) + { + OnTargetInSecureTrade(from, targeted); + } + else if (item?.IsAccessibleTo(from) == false) + { + OnTargetNotAccessible(from, targeted); + } + else if (item?.CheckTarget(from, this, targeted) == false) + { + OnTargetUntargetable(from, targeted); + } + else if (mobile?.CheckTarget(from, this, mobile) == false) + { + OnTargetUntargetable(from, mobile); + } + else if (from.Region.OnTarget(from, this, targeted)) + { + OnTarget(from, targeted); } OnTargetFinish(from); diff --git a/Projects/UOContent/Commands/Handlers.cs b/Projects/UOContent/Commands/Handlers.cs index 867ed68d6..b289f9acd 100644 --- a/Projects/UOContent/Commands/Handlers.cs +++ b/Projects/UOContent/Commands/Handlers.cs @@ -7,11 +7,9 @@ using Server.Gumps; using Server.Items; using Server.Menus.ItemLists; using Server.Menus.Questions; -using Server.Misc; using Server.Mobiles; using Server.Multis; using Server.Network; -using Server.Saves; using Server.Spells; using Server.Targeting; using Server.Targets; diff --git a/Projects/UOContent/Compression/TarArchive.cs b/Projects/UOContent/Compression/TarArchive.cs index 69083e509..4905a3683 100755 --- a/Projects/UOContent/Compression/TarArchive.cs +++ b/Projects/UOContent/Compression/TarArchive.cs @@ -1,14 +1,9 @@ using System; -using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.IO.Compression; -using System.Net; using System.Net.Http; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; using Server.Buffers; namespace Server.Compression diff --git a/Projects/UOContent/Compression/ZstdArchive.cs b/Projects/UOContent/Compression/ZstdArchive.cs index a1f1fee2c..35fd533d5 100755 --- a/Projects/UOContent/Compression/ZstdArchive.cs +++ b/Projects/UOContent/Compression/ZstdArchive.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; diff --git a/Projects/UOContent/Spells/Eighth/Resurrection.cs b/Projects/UOContent/Spells/Eighth/Resurrection.cs index 77fcc0afb..c485850fa 100644 --- a/Projects/UOContent/Spells/Eighth/Resurrection.cs +++ b/Projects/UOContent/Spells/Eighth/Resurrection.cs @@ -24,16 +24,7 @@ namespace Server.Spells.Eighth public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (m == Caster) + if (m == Caster) { Caster.SendLocalizedMessage(501039); // Thou can not resurrect thyself. } diff --git a/Projects/UOContent/Spells/Fifth/DispelField.cs b/Projects/UOContent/Spells/Fifth/DispelField.cs index e05b2718c..cd7c3240c 100644 --- a/Projects/UOContent/Spells/Fifth/DispelField.cs +++ b/Projects/UOContent/Spells/Fifth/DispelField.cs @@ -25,15 +25,7 @@ namespace Server.Spells.Fifth public void Target(Item item) { - if (item == null) - { - Caster.SendLocalizedMessage(1005049); // That cannot be dispelled. - } - else if (!Caster.CanSee(item)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (!item.GetType().IsDefined(typeof(DispellableFieldAttribute), false)) + if (!item.GetType().IsDefined(typeof(DispellableFieldAttribute), false)) { Caster.SendLocalizedMessage(1005049); // That cannot be dispelled. } diff --git a/Projects/UOContent/Spells/Fifth/MindBlast.cs b/Projects/UOContent/Spells/Fifth/MindBlast.cs index 7f1b6945d..a5e2644e0 100644 --- a/Projects/UOContent/Spells/Fifth/MindBlast.cs +++ b/Projects/UOContent/Spells/Fifth/MindBlast.cs @@ -30,16 +30,7 @@ namespace Server.Spells.Fifth public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (Core.AOS) + if (Core.AOS) { if (Caster.CanBeHarmful(m) && CheckSequence()) { diff --git a/Projects/UOContent/Spells/Fifth/Paralyze.cs b/Projects/UOContent/Spells/Fifth/Paralyze.cs index b7dc8c20d..fcc12f643 100644 --- a/Projects/UOContent/Spells/Fifth/Paralyze.cs +++ b/Projects/UOContent/Spells/Fifth/Paralyze.cs @@ -25,17 +25,7 @@ namespace Server.Spells.Fifth public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (Core.AOS && (m.Frozen || m.Paralyzed || - m.Spell?.IsCasting == true && !(m.Spell is PaladinSpell))) + if (Core.AOS && (m.Frozen || m.Paralyzed || m.Spell?.IsCasting == true && m.Spell is not PaladinSpell)) { Caster.SendLocalizedMessage(1061923); // The target is already frozen. } diff --git a/Projects/UOContent/Spells/Fifth/PoisonField.cs b/Projects/UOContent/Spells/Fifth/PoisonField.cs index f08d8ca42..1c7ceb92a 100644 --- a/Projects/UOContent/Spells/Fifth/PoisonField.cs +++ b/Projects/UOContent/Spells/Fifth/PoisonField.cs @@ -28,11 +28,7 @@ namespace Server.Spells.Fifth public void Target(IPoint3D p) { - if (!Caster.CanSee(p)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) + if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) { SpellHelper.Turn(Caster, p); diff --git a/Projects/UOContent/Spells/First/Clumsy.cs b/Projects/UOContent/Spells/First/Clumsy.cs index e47ddbe16..e777ea455 100644 --- a/Projects/UOContent/Spells/First/Clumsy.cs +++ b/Projects/UOContent/Spells/First/Clumsy.cs @@ -21,16 +21,7 @@ namespace Server.Spells.First public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (CheckHSequence(m)) + if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); diff --git a/Projects/UOContent/Spells/First/Feeblemind.cs b/Projects/UOContent/Spells/First/Feeblemind.cs index 22a06ef38..ac339bca6 100644 --- a/Projects/UOContent/Spells/First/Feeblemind.cs +++ b/Projects/UOContent/Spells/First/Feeblemind.cs @@ -21,16 +21,7 @@ namespace Server.Spells.First public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (CheckHSequence(m)) + if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); diff --git a/Projects/UOContent/Spells/First/Heal.cs b/Projects/UOContent/Spells/First/Heal.cs index efde53803..1379759c5 100644 --- a/Projects/UOContent/Spells/First/Heal.cs +++ b/Projects/UOContent/Spells/First/Heal.cs @@ -26,16 +26,7 @@ namespace Server.Spells.First public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (m.IsDeadBondedPet) + if (m.IsDeadBondedPet) { Caster.SendLocalizedMessage(1060177); // You cannot heal a creature that is already dead! } diff --git a/Projects/UOContent/Spells/First/MagicArrow.cs b/Projects/UOContent/Spells/First/MagicArrow.cs index e8922739d..02f4de6e7 100644 --- a/Projects/UOContent/Spells/First/MagicArrow.cs +++ b/Projects/UOContent/Spells/First/MagicArrow.cs @@ -24,16 +24,7 @@ namespace Server.Spells.First public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (CheckHSequence(m)) + if (CheckHSequence(m)) { var source = Caster; diff --git a/Projects/UOContent/Spells/First/Weaken.cs b/Projects/UOContent/Spells/First/Weaken.cs index 3fcaf4bbe..cdac84af0 100644 --- a/Projects/UOContent/Spells/First/Weaken.cs +++ b/Projects/UOContent/Spells/First/Weaken.cs @@ -21,16 +21,7 @@ namespace Server.Spells.First public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (CheckHSequence(m)) + if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); diff --git a/Projects/UOContent/Spells/Fourth/ArchCure.cs b/Projects/UOContent/Spells/Fourth/ArchCure.cs index f2b2bf95e..9b618138f 100644 --- a/Projects/UOContent/Spells/Fourth/ArchCure.cs +++ b/Projects/UOContent/Spells/Fourth/ArchCure.cs @@ -29,11 +29,7 @@ namespace Server.Spells.Fourth public void Target(IPoint3D p) { - if (!Caster.CanSee(p)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (CheckSequence()) + if (CheckSequence()) { SpellHelper.Turn(Caster, p); diff --git a/Projects/UOContent/Spells/Fourth/ArchProtection.cs b/Projects/UOContent/Spells/Fourth/ArchProtection.cs index 916c9643e..a9ae7f7bb 100644 --- a/Projects/UOContent/Spells/Fourth/ArchProtection.cs +++ b/Projects/UOContent/Spells/Fourth/ArchProtection.cs @@ -30,11 +30,7 @@ namespace Server.Spells.Fourth public void Target(IPoint3D p) { - if (!Caster.CanSee(p)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (CheckSequence()) + if (CheckSequence()) { SpellHelper.Turn(Caster, p); diff --git a/Projects/UOContent/Spells/Fourth/Curse.cs b/Projects/UOContent/Spells/Fourth/Curse.cs index a78c32e76..84a076e3d 100644 --- a/Projects/UOContent/Spells/Fourth/Curse.cs +++ b/Projects/UOContent/Spells/Fourth/Curse.cs @@ -25,16 +25,7 @@ namespace Server.Spells.Fourth public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (CheckHSequence(m)) + if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); @@ -46,8 +37,8 @@ namespace Server.Spells.Fourth SpellHelper.AddStatCurse(Caster, m, StatType.Int); SpellHelper.DisableSkillCheck = false; - if (Caster.Player && m.Player /*&& Caster != m */ && !UnderEffect(m) - ) // On OSI you CAN curse yourself and get this effect. + // On OSI you CAN curse yourself and get this effect. + if (Caster.Player && m.Player /*&& Caster != m */ && !UnderEffect(m)) { var duration = SpellHelper.GetDuration(Caster, m); m_UnderEffect.Add(m); diff --git a/Projects/UOContent/Spells/Fourth/FireField.cs b/Projects/UOContent/Spells/Fourth/FireField.cs index cd4934744..c06739a78 100644 --- a/Projects/UOContent/Spells/Fourth/FireField.cs +++ b/Projects/UOContent/Spells/Fourth/FireField.cs @@ -28,11 +28,7 @@ namespace Server.Spells.Fourth public void Target(IPoint3D p) { - if (!Caster.CanSee(p)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) + if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) { SpellHelper.Turn(Caster, p); diff --git a/Projects/UOContent/Spells/Fourth/GreaterHeal.cs b/Projects/UOContent/Spells/Fourth/GreaterHeal.cs index 36647df92..4c02942f4 100644 --- a/Projects/UOContent/Spells/Fourth/GreaterHeal.cs +++ b/Projects/UOContent/Spells/Fourth/GreaterHeal.cs @@ -27,16 +27,7 @@ namespace Server.Spells.Fourth public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (m is BaseCreature creature && creature.IsAnimatedDead) + if (m is BaseCreature creature && creature.IsAnimatedDead) { Caster.SendLocalizedMessage(1061654); // You cannot heal that which is not alive. } diff --git a/Projects/UOContent/Spells/Fourth/Lightning.cs b/Projects/UOContent/Spells/Fourth/Lightning.cs index badf7db64..63eb3455c 100644 --- a/Projects/UOContent/Spells/Fourth/Lightning.cs +++ b/Projects/UOContent/Spells/Fourth/Lightning.cs @@ -23,16 +23,7 @@ namespace Server.Spells.Fourth public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (CheckHSequence(m)) + if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); diff --git a/Projects/UOContent/Spells/Fourth/ManaDrain.cs b/Projects/UOContent/Spells/Fourth/ManaDrain.cs index e06997783..52bd11a8e 100644 --- a/Projects/UOContent/Spells/Fourth/ManaDrain.cs +++ b/Projects/UOContent/Spells/Fourth/ManaDrain.cs @@ -26,16 +26,7 @@ namespace Server.Spells.Fourth public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (CheckHSequence(m)) + if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); diff --git a/Projects/UOContent/Spells/Mysticism/SpellPlagueSpell.cs b/Projects/UOContent/Spells/Mysticism/SpellPlagueSpell.cs index a5f47d3c4..a02032856 100644 --- a/Projects/UOContent/Spells/Mysticism/SpellPlagueSpell.cs +++ b/Projects/UOContent/Spells/Mysticism/SpellPlagueSpell.cs @@ -41,11 +41,7 @@ namespace Server.Spells.Mysticism public void Target(Mobile targeted) { - if (!Caster.CanSee(targeted)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (CheckHSequence(targeted)) + if (CheckHSequence(targeted)) { SpellHelper.Turn(Caster, targeted); diff --git a/Projects/UOContent/Spells/Second/Agility.cs b/Projects/UOContent/Spells/Second/Agility.cs index fbe8fa473..c7843437f 100644 --- a/Projects/UOContent/Spells/Second/Agility.cs +++ b/Projects/UOContent/Spells/Second/Agility.cs @@ -22,16 +22,7 @@ namespace Server.Spells.Second public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (CheckBSequence(m)) + if (CheckBSequence(m)) { SpellHelper.Turn(Caster, m); diff --git a/Projects/UOContent/Spells/Second/Cunning.cs b/Projects/UOContent/Spells/Second/Cunning.cs index ad966c643..353ff9715 100644 --- a/Projects/UOContent/Spells/Second/Cunning.cs +++ b/Projects/UOContent/Spells/Second/Cunning.cs @@ -22,16 +22,7 @@ namespace Server.Spells.Second public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (CheckBSequence(m)) + if (CheckBSequence(m)) { SpellHelper.Turn(Caster, m); diff --git a/Projects/UOContent/Spells/Second/Cure.cs b/Projects/UOContent/Spells/Second/Cure.cs index 1b0bc413e..895f9eb89 100644 --- a/Projects/UOContent/Spells/Second/Cure.cs +++ b/Projects/UOContent/Spells/Second/Cure.cs @@ -22,16 +22,7 @@ namespace Server.Spells.Second public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (CheckBSequence(m)) + if (CheckBSequence(m)) { SpellHelper.Turn(Caster, m); diff --git a/Projects/UOContent/Spells/Second/Harm.cs b/Projects/UOContent/Spells/Second/Harm.cs index fd1d58adc..25735664e 100644 --- a/Projects/UOContent/Spells/Second/Harm.cs +++ b/Projects/UOContent/Spells/Second/Harm.cs @@ -23,16 +23,7 @@ namespace Server.Spells.Second public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (CheckHSequence(m)) + if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); diff --git a/Projects/UOContent/Spells/Second/MagicTrap.cs b/Projects/UOContent/Spells/Second/MagicTrap.cs index c8b2a37ec..259cfcad0 100644 --- a/Projects/UOContent/Spells/Second/MagicTrap.cs +++ b/Projects/UOContent/Spells/Second/MagicTrap.cs @@ -27,10 +27,6 @@ namespace Server.Spells.Second { Caster.SendLocalizedMessage(502942); // You can't trap this! } - else if (!Caster.CanSee(item)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } else if (cont.TrapType != TrapType.None && cont.TrapType != TrapType.MagicTrap) { DoFizzle(); diff --git a/Projects/UOContent/Spells/Second/RemoveTrap.cs b/Projects/UOContent/Spells/Second/RemoveTrap.cs index 7ff0c0005..c684e603c 100644 --- a/Projects/UOContent/Spells/Second/RemoveTrap.cs +++ b/Projects/UOContent/Spells/Second/RemoveTrap.cs @@ -22,13 +22,9 @@ namespace Server.Spells.Second public void Target(Item item) { - if (!(item is TrappableContainer cont)) + if (item is not TrappableContainer cont) { - Caster.SendMessage("You can't disarm that"); // TODO: Localization? - } - else if (!Caster.CanSee(item)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. + Caster.SendLocalizedMessage(502373); // That doesn't appear to be trapped } else if (cont.TrapType != TrapType.None && cont.TrapType != TrapType.MagicTrap) { diff --git a/Projects/UOContent/Spells/Second/Strength.cs b/Projects/UOContent/Spells/Second/Strength.cs index 536662cbd..0896c0402 100644 --- a/Projects/UOContent/Spells/Second/Strength.cs +++ b/Projects/UOContent/Spells/Second/Strength.cs @@ -22,16 +22,7 @@ namespace Server.Spells.Second public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (CheckBSequence(m)) + if (CheckBSequence(m)) { SpellHelper.Turn(Caster, m); diff --git a/Projects/UOContent/Spells/Seventh/ChainLightning.cs b/Projects/UOContent/Spells/Seventh/ChainLightning.cs index f036fab6d..7251597aa 100644 --- a/Projects/UOContent/Spells/Seventh/ChainLightning.cs +++ b/Projects/UOContent/Spells/Seventh/ChainLightning.cs @@ -28,11 +28,7 @@ namespace Server.Spells.Seventh public void Target(IPoint3D p) { - if (!Caster.CanSee(p)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) + if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) { SpellHelper.Turn(Caster, p); diff --git a/Projects/UOContent/Spells/Seventh/EnergyField.cs b/Projects/UOContent/Spells/Seventh/EnergyField.cs index 5bee0d18c..8e6489779 100644 --- a/Projects/UOContent/Spells/Seventh/EnergyField.cs +++ b/Projects/UOContent/Spells/Seventh/EnergyField.cs @@ -28,11 +28,7 @@ namespace Server.Spells.Seventh public void Target(IPoint3D p) { - if (!Caster.CanSee(p)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) + if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) { SpellHelper.Turn(Caster, p); diff --git a/Projects/UOContent/Spells/Seventh/FlameStrike.cs b/Projects/UOContent/Spells/Seventh/FlameStrike.cs index e307f9be7..6a53b053a 100644 --- a/Projects/UOContent/Spells/Seventh/FlameStrike.cs +++ b/Projects/UOContent/Spells/Seventh/FlameStrike.cs @@ -23,16 +23,7 @@ namespace Server.Spells.Seventh public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (CheckHSequence(m)) + if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); diff --git a/Projects/UOContent/Spells/Seventh/ManaVampire.cs b/Projects/UOContent/Spells/Seventh/ManaVampire.cs index 15d99f19d..02b07b385 100644 --- a/Projects/UOContent/Spells/Seventh/ManaVampire.cs +++ b/Projects/UOContent/Spells/Seventh/ManaVampire.cs @@ -24,16 +24,7 @@ namespace Server.Spells.Seventh public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (CheckHSequence(m)) + if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); diff --git a/Projects/UOContent/Spells/Seventh/MassDispel.cs b/Projects/UOContent/Spells/Seventh/MassDispel.cs index 8ba30654d..fad116d3d 100644 --- a/Projects/UOContent/Spells/Seventh/MassDispel.cs +++ b/Projects/UOContent/Spells/Seventh/MassDispel.cs @@ -25,11 +25,7 @@ namespace Server.Spells.Seventh public void Target(IPoint3D p) { - if (!Caster.CanSee(p)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (CheckSequence()) + if (CheckSequence()) { SpellHelper.Turn(Caster, p); diff --git a/Projects/UOContent/Spells/Seventh/MeteorSwarm.cs b/Projects/UOContent/Spells/Seventh/MeteorSwarm.cs index 594afccc7..10e3d5530 100644 --- a/Projects/UOContent/Spells/Seventh/MeteorSwarm.cs +++ b/Projects/UOContent/Spells/Seventh/MeteorSwarm.cs @@ -28,11 +28,7 @@ namespace Server.Spells.Seventh public void Target(IPoint3D p) { - if (!Caster.CanSee(p)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) + if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) { SpellHelper.Turn(Caster, p); diff --git a/Projects/UOContent/Spells/Sixth/Dispel.cs b/Projects/UOContent/Spells/Sixth/Dispel.cs index f4cfbd8fc..b1ab2dbf3 100644 --- a/Projects/UOContent/Spells/Sixth/Dispel.cs +++ b/Projects/UOContent/Spells/Sixth/Dispel.cs @@ -24,16 +24,7 @@ namespace Server.Spells.Sixth public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (!(m is BaseCreature bc && bc.IsDispellable)) + if (m is not BaseCreature { IsDispellable: true } bc) { Caster.SendLocalizedMessage(1005049); // That cannot be dispelled. } diff --git a/Projects/UOContent/Spells/Sixth/EnergyBolt.cs b/Projects/UOContent/Spells/Sixth/EnergyBolt.cs index 9ebcb415b..d7723204b 100644 --- a/Projects/UOContent/Spells/Sixth/EnergyBolt.cs +++ b/Projects/UOContent/Spells/Sixth/EnergyBolt.cs @@ -23,16 +23,7 @@ namespace Server.Spells.Sixth public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (CheckHSequence(m)) + if (CheckHSequence(m)) { var source = Caster; diff --git a/Projects/UOContent/Spells/Sixth/Explosion.cs b/Projects/UOContent/Spells/Sixth/Explosion.cs index 88acce5b2..16b0f69b3 100644 --- a/Projects/UOContent/Spells/Sixth/Explosion.cs +++ b/Projects/UOContent/Spells/Sixth/Explosion.cs @@ -26,16 +26,7 @@ namespace Server.Spells.Sixth public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (Caster.CanBeHarmful(m) && CheckSequence()) + if (Caster.CanBeHarmful(m) && CheckSequence()) { Mobile attacker = Caster, defender = m; diff --git a/Projects/UOContent/Spells/Sixth/Invisibility.cs b/Projects/UOContent/Spells/Sixth/Invisibility.cs index aeb42f8d0..1fd01bfcd 100644 --- a/Projects/UOContent/Spells/Sixth/Invisibility.cs +++ b/Projects/UOContent/Spells/Sixth/Invisibility.cs @@ -28,16 +28,7 @@ namespace Server.Spells.Sixth public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (m is BaseVendor || m is PlayerVendor || m.AccessLevel > Caster.AccessLevel) + if (m is BaseVendor or PlayerVendor || m.AccessLevel > Caster.AccessLevel) { Caster.SendLocalizedMessage(501857); // This spell won't work on that! } diff --git a/Projects/UOContent/Spells/Sixth/Mark.cs b/Projects/UOContent/Spells/Sixth/Mark.cs index b35a25784..7a4fb4e36 100644 --- a/Projects/UOContent/Spells/Sixth/Mark.cs +++ b/Projects/UOContent/Spells/Sixth/Mark.cs @@ -24,7 +24,7 @@ namespace Server.Spells.Sixth public void Target(Item item) { - if (!(item is RecallRune rune)) + if (item is not RecallRune rune) { Caster.NetState.SendMessageLocalized( Caster.Serial, @@ -32,13 +32,9 @@ namespace Server.Spells.Sixth MessageType.Regular, 0x3B2, 3, - 501797, + 501797, // I cannot mark that object. Caster.Name - ); // I cannot mark that object. - } - else if (!Caster.CanSee(rune)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. + ); } else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.Mark)) { @@ -49,11 +45,8 @@ namespace Server.Spells.Sixth } else if (!rune.IsChildOf(Caster.Backpack)) { - Caster.LocalOverheadMessage( - MessageType.Regular, - 0x3B2, - 1062422 - ); // You must have this rune in your backpack in order to mark it. + // You must have this rune in your backpack in order to mark it. + Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1062422); } else if (CheckSequence()) { diff --git a/Projects/UOContent/Spells/Sixth/MassCurse.cs b/Projects/UOContent/Spells/Sixth/MassCurse.cs index 375789e41..ee2e8ba38 100644 --- a/Projects/UOContent/Spells/Sixth/MassCurse.cs +++ b/Projects/UOContent/Spells/Sixth/MassCurse.cs @@ -24,11 +24,7 @@ namespace Server.Spells.Sixth public void Target(IPoint3D p) { - if (!Caster.CanSee(p)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) + if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) { SpellHelper.Turn(Caster, p); diff --git a/Projects/UOContent/Spells/Sixth/ParalyzeField.cs b/Projects/UOContent/Spells/Sixth/ParalyzeField.cs index cea6f4e50..0cff8699c 100644 --- a/Projects/UOContent/Spells/Sixth/ParalyzeField.cs +++ b/Projects/UOContent/Spells/Sixth/ParalyzeField.cs @@ -27,11 +27,7 @@ namespace Server.Spells.Sixth public void Target(IPoint3D p) { - if (!Caster.CanSee(p)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) + if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) { SpellHelper.Turn(Caster, p); diff --git a/Projects/UOContent/Spells/Sixth/Reveal.cs b/Projects/UOContent/Spells/Sixth/Reveal.cs index a6793b1e5..c95539c77 100644 --- a/Projects/UOContent/Spells/Sixth/Reveal.cs +++ b/Projects/UOContent/Spells/Sixth/Reveal.cs @@ -22,11 +22,7 @@ namespace Server.Spells.Sixth public void Target(IPoint3D p) { - if (!Caster.CanSee(p)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (CheckSequence()) + if (CheckSequence()) { SpellHelper.Turn(Caster, p); SpellHelper.GetSurfaceTop(ref p); diff --git a/Projects/UOContent/Spells/Spellweaving/GiftOfLife.cs b/Projects/UOContent/Spells/Spellweaving/GiftOfLife.cs index 9f0b2247b..55623c555 100644 --- a/Projects/UOContent/Spells/Spellweaving/GiftOfLife.cs +++ b/Projects/UOContent/Spells/Spellweaving/GiftOfLife.cs @@ -30,15 +30,7 @@ namespace Server.Spells.Spellweaving public void Target(Mobile m) { - if (m == null) - { - Caster.SendLocalizedMessage(1072077); // You may only cast this spell on yourself or a bonded pet. - } - else if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (m.IsDeadBondedPet || !m.Alive) + if (m.IsDeadBondedPet || !m.Alive) { // As per Osi: Nothing happens. } diff --git a/Projects/UOContent/Spells/Spellweaving/GiftOfRenewal.cs b/Projects/UOContent/Spells/Spellweaving/GiftOfRenewal.cs index 5bf8db8ac..e99471fcd 100644 --- a/Projects/UOContent/Spells/Spellweaving/GiftOfRenewal.cs +++ b/Projects/UOContent/Spells/Spellweaving/GiftOfRenewal.cs @@ -26,16 +26,7 @@ namespace Server.Spells.Spellweaving public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (m_Table.ContainsKey(m)) + if (m_Table.ContainsKey(m)) { Caster.SendLocalizedMessage(501775); // This spell is already in effect. } diff --git a/Projects/UOContent/Spells/Spellweaving/WordOfDeath.cs b/Projects/UOContent/Spells/Spellweaving/WordOfDeath.cs index 7cdd76846..572b68073 100644 --- a/Projects/UOContent/Spells/Spellweaving/WordOfDeath.cs +++ b/Projects/UOContent/Spells/Spellweaving/WordOfDeath.cs @@ -18,16 +18,7 @@ namespace Server.Spells.Spellweaving public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (CheckHSequence(m)) + if (CheckHSequence(m)) { var loc = m.Location; loc.Z += 50; diff --git a/Projects/UOContent/Spells/Third/Bless.cs b/Projects/UOContent/Spells/Third/Bless.cs index 3c694cc69..8bf3803ed 100644 --- a/Projects/UOContent/Spells/Third/Bless.cs +++ b/Projects/UOContent/Spells/Third/Bless.cs @@ -22,16 +22,7 @@ namespace Server.Spells.Third public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (CheckBSequence(m)) + if (CheckBSequence(m)) { SpellHelper.Turn(Caster, m); diff --git a/Projects/UOContent/Spells/Third/Fireball.cs b/Projects/UOContent/Spells/Third/Fireball.cs index 298dc2f0a..aa5ca6941 100644 --- a/Projects/UOContent/Spells/Third/Fireball.cs +++ b/Projects/UOContent/Spells/Third/Fireball.cs @@ -22,16 +22,7 @@ namespace Server.Spells.Third public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (CheckHSequence(m)) + if (CheckHSequence(m)) { var source = Caster; diff --git a/Projects/UOContent/Spells/Third/Poison.cs b/Projects/UOContent/Spells/Third/Poison.cs index 71cd43495..584d3a20e 100644 --- a/Projects/UOContent/Spells/Third/Poison.cs +++ b/Projects/UOContent/Spells/Third/Poison.cs @@ -21,16 +21,7 @@ namespace Server.Spells.Third public void Target(Mobile m) { - if (m == null) - { - return; - } - - if (!Caster.CanSee(m)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (CheckHSequence(m)) + if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); diff --git a/Projects/UOContent/Spells/Third/WallOfStone.cs b/Projects/UOContent/Spells/Third/WallOfStone.cs index f0f1ec926..271455d05 100644 --- a/Projects/UOContent/Spells/Third/WallOfStone.cs +++ b/Projects/UOContent/Spells/Third/WallOfStone.cs @@ -25,11 +25,7 @@ namespace Server.Spells.Third public void Target(IPoint3D p) { - if (!Caster.CanSee(p)) - { - Caster.SendLocalizedMessage(500237); // Target can not be seen. - } - else if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) + if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) { SpellHelper.Turn(Caster, p); From 15b2d08ea25c448059abb515675b013cd9866277 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Sun, 14 Nov 2021 18:48:44 -0800 Subject: [PATCH 08/16] fix: More spell variable cleanup (#850) --- Projects/UOContent/Spells/Base/SpellHelper.cs | 8 ++++---- Projects/UOContent/Spells/Bushido/Confidence.cs | 8 ++++---- .../UOContent/Spells/Bushido/CounterAttack.cs | 8 ++++---- Projects/UOContent/Spells/Bushido/Evasion.cs | 8 ++++---- .../Spells/Bushido/HonorableExecution.cs | 10 +++++----- .../Spells/Chivalry/ConsecrateWeapon.cs | 8 ++++---- Projects/UOContent/Spells/Chivalry/DivineFury.cs | 8 ++++---- Projects/UOContent/Spells/Chivalry/EnemyOfOne.cs | 6 +++--- Projects/UOContent/Spells/Fifth/Incognito.cs | 6 +++--- Projects/UOContent/Spells/Fifth/MagicReflect.cs | 8 ++++---- Projects/UOContent/Spells/First/ReactiveArmor.cs | 8 ++++---- Projects/UOContent/Spells/Fourth/ManaDrain.cs | 8 ++++---- .../Spells/Mysticism/SpellPlagueSpell.cs | 16 ++++++++-------- .../UOContent/Spells/Mysticism/StoneFormSpell.cs | 8 ++++---- .../Spells/Necromancy/AnimateDeadSpell.cs | 10 +++++----- .../Spells/Necromancy/BloodOathSpell.cs | 10 +++++----- .../UOContent/Spells/Necromancy/CorpseSkin.cs | 10 +++++----- .../UOContent/Spells/Necromancy/CurseWeapon.cs | 8 ++++---- Projects/UOContent/Spells/Necromancy/EvilOmen.cs | 8 ++++---- Projects/UOContent/Spells/Necromancy/MindRot.cs | 12 ++++++------ .../UOContent/Spells/Necromancy/PainSpike.cs | 8 ++++---- Projects/UOContent/Spells/Necromancy/Strangle.cs | 12 ++++++------ Projects/UOContent/Spells/Ninjitsu/AnimalForm.cs | 10 +++++----- .../UOContent/Spells/Ninjitsu/DeathStrike.cs | 8 ++++---- Projects/UOContent/Spells/Ninjitsu/KiAttack.cs | 10 +++++----- .../UOContent/Spells/Ninjitsu/SurpriseAttack.cs | 8 ++++---- Projects/UOContent/Spells/Second/Protection.cs | 8 ++++---- Projects/UOContent/Spells/Seventh/Polymorph.cs | 6 +++--- Projects/UOContent/Spells/Sixth/Invisibility.cs | 8 ++++---- .../Spells/Spellweaving/AttuneWeapon.cs | 12 ++++++------ .../Spells/Spellweaving/EssenceOfWind.cs | 14 +++++++------- .../UOContent/Spells/Spellweaving/GiftOfLife.cs | 14 +++++++------- .../Spells/Spellweaving/GiftOfRenewal.cs | 10 +++++----- .../Spells/Spellweaving/ImmolatingWeapon.cs | 12 ++++++------ .../Spells/Spellweaving/Thunderstorm.cs | 8 ++++---- 35 files changed, 162 insertions(+), 162 deletions(-) diff --git a/Projects/UOContent/Spells/Base/SpellHelper.cs b/Projects/UOContent/Spells/Base/SpellHelper.cs index cbf225459..f855ad5ac 100644 --- a/Projects/UOContent/Spells/Base/SpellHelper.cs +++ b/Projects/UOContent/Spells/Base/SpellHelper.cs @@ -1226,7 +1226,7 @@ namespace Server.Spells public static class TransformationSpellHelper { - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public static bool CheckCast(Mobile caster, Spell spell) { @@ -1360,7 +1360,7 @@ namespace Server.Spells public static void AddContext(Mobile m, TransformContext context) { - m_Table[m] = context; + _table[m] = context; } public static void RemoveContext(Mobile m, bool resetGraphics) @@ -1375,7 +1375,7 @@ namespace Server.Spells public static void RemoveContext(Mobile m, TransformContext context, bool resetGraphics) { - if (!m_Table.Remove(m)) + if (!_table.Remove(m)) { return; } @@ -1399,7 +1399,7 @@ namespace Server.Spells public static TransformContext GetContext(Mobile m) { - m_Table.TryGetValue(m, out var context); + _table.TryGetValue(m, out var context); return context; } diff --git a/Projects/UOContent/Spells/Bushido/Confidence.cs b/Projects/UOContent/Spells/Bushido/Confidence.cs index be3313cf8..e8eab62dc 100644 --- a/Projects/UOContent/Spells/Bushido/Confidence.cs +++ b/Projects/UOContent/Spells/Bushido/Confidence.cs @@ -12,7 +12,7 @@ namespace Server.Spells.Bushido 9002 ); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); private static readonly Dictionary m_RegenTable = new(); public Confidence(Mobile caster, Item scroll) : base(caster, scroll, _info) @@ -49,7 +49,7 @@ namespace Server.Spells.Bushido FinishSequence(); } - public static bool IsConfident(Mobile m) => m_Table.ContainsKey(m); + public static bool IsConfident(Mobile m) => _table.ContainsKey(m); public static void BeginConfidence(Mobile m) { @@ -64,12 +64,12 @@ namespace Server.Spells.Bushido out var timerToken ); - m_Table[m] = timerToken; + _table[m] = timerToken; } private static bool StopConfidenceTimer(Mobile m) { - if (m_Table.Remove(m, out var timerToken)) + if (_table.Remove(m, out var timerToken)) { timerToken.Cancel(); return true; diff --git a/Projects/UOContent/Spells/Bushido/CounterAttack.cs b/Projects/UOContent/Spells/Bushido/CounterAttack.cs index ba546fa5b..ea3c07e22 100644 --- a/Projects/UOContent/Spells/Bushido/CounterAttack.cs +++ b/Projects/UOContent/Spells/Bushido/CounterAttack.cs @@ -13,7 +13,7 @@ namespace Server.Spells.Bushido 9002 ); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public CounterAttack(Mobile caster, Item scroll) : base(caster, scroll, _info) { @@ -71,11 +71,11 @@ namespace Server.Spells.Bushido FinishSequence(); } - public static bool IsCountering(Mobile m) => m_Table.ContainsKey(m); + public static bool IsCountering(Mobile m) => _table.ContainsKey(m); private static bool StopCounterTimer(Mobile m) { - if (m_Table.Remove(m, out var timerToken)) + if (_table.Remove(m, out var timerToken)) { timerToken.Cancel(); return true; @@ -97,7 +97,7 @@ namespace Server.Spells.Bushido out var timerToken ); - m_Table[m] = timerToken; + _table[m] = timerToken; } public static void StopCountering(Mobile m) diff --git a/Projects/UOContent/Spells/Bushido/Evasion.cs b/Projects/UOContent/Spells/Bushido/Evasion.cs index d39b43194..a5eab88e2 100644 --- a/Projects/UOContent/Spells/Bushido/Evasion.cs +++ b/Projects/UOContent/Spells/Bushido/Evasion.cs @@ -13,7 +13,7 @@ namespace Server.Spells.Bushido 9002 ); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public Evasion(Mobile caster, Item scroll) : base(caster, scroll, _info) { @@ -138,7 +138,7 @@ namespace Server.Spells.Bushido FinishSequence(); } - public static bool IsEvading(Mobile m) => m_Table.ContainsKey(m); + public static bool IsEvading(Mobile m) => _table.ContainsKey(m); public static TimeSpan GetEvadeDuration(Mobile m) { @@ -216,12 +216,12 @@ namespace Server.Spells.Bushido out var timerToken ); - m_Table[m] = timerToken; + _table[m] = timerToken; } private static bool StopEvasionTimer(Mobile m) { - if (m_Table.Remove(m, out var timer)) + if (_table.Remove(m, out var timer)) { timer.Cancel(); return true; diff --git a/Projects/UOContent/Spells/Bushido/HonorableExecution.cs b/Projects/UOContent/Spells/Bushido/HonorableExecution.cs index 35da3b3d8..266644850 100644 --- a/Projects/UOContent/Spells/Bushido/HonorableExecution.cs +++ b/Projects/UOContent/Spells/Bushido/HonorableExecution.cs @@ -5,7 +5,7 @@ namespace Server.Spells.Bushido { public class HonorableExecution : SamuraiMove { - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public override int BaseMana => 0; public override double RequiredSkill => 25.0; @@ -63,20 +63,20 @@ namespace Server.Spells.Bushido timer = new HonorableExecutionTimer(attacker, mods); } - m_Table[attacker] = timer; + _table[attacker] = timer; timer.Start(); attacker.Delta(MobileDelta.WeaponDamage); CheckGain(attacker); } - public static int GetSwingBonus(Mobile target) => m_Table.TryGetValue(target, out var info) ? info.m_SwingBonus : 0; + public static int GetSwingBonus(Mobile target) => _table.TryGetValue(target, out var info) ? info.m_SwingBonus : 0; - public static bool IsUnderPenalty(Mobile target) => m_Table.TryGetValue(target, out var info) && info.m_Penalty; + public static bool IsUnderPenalty(Mobile target) => _table.TryGetValue(target, out var info) && info.m_Penalty; public static void RemovePenalty(Mobile target) { - if (m_Table.Remove(target, out var timer)) + if (_table.Remove(target, out var timer)) { timer.Clear(); } diff --git a/Projects/UOContent/Spells/Chivalry/ConsecrateWeapon.cs b/Projects/UOContent/Spells/Chivalry/ConsecrateWeapon.cs index 4033ce18c..01eea62a2 100644 --- a/Projects/UOContent/Spells/Chivalry/ConsecrateWeapon.cs +++ b/Projects/UOContent/Spells/Chivalry/ConsecrateWeapon.cs @@ -13,7 +13,7 @@ namespace Server.Spells.Chivalry 9002 ); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public ConsecrateWeaponSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { @@ -86,12 +86,12 @@ namespace Server.Spells.Chivalry var duration = TimeSpan.FromSeconds(seconds); - m_Table.TryGetValue(weapon, out var timer); + _table.TryGetValue(weapon, out var timer); timer?.Stop(); weapon.Consecrated = true; - m_Table[weapon] = timer = new ExpireTimer(weapon, duration); + _table[weapon] = timer = new ExpireTimer(weapon, duration); timer.Start(); } @@ -112,7 +112,7 @@ namespace Server.Spells.Chivalry { m_Weapon.Consecrated = false; Effects.PlaySound(m_Weapon.GetWorldLocation(), m_Weapon.Map, 0x1F8); - m_Table.Remove(m_Weapon); + _table.Remove(m_Weapon); } } } diff --git a/Projects/UOContent/Spells/Chivalry/DivineFury.cs b/Projects/UOContent/Spells/Chivalry/DivineFury.cs index 405d60064..6716c7d66 100644 --- a/Projects/UOContent/Spells/Chivalry/DivineFury.cs +++ b/Projects/UOContent/Spells/Chivalry/DivineFury.cs @@ -12,7 +12,7 @@ namespace Server.Spells.Chivalry 9002 ); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public DivineFurySpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { @@ -46,7 +46,7 @@ namespace Server.Spells.Chivalry out var timerToken ); - m_Table[Caster] = timerToken; + _table[Caster] = timerToken; Caster.Delta(MobileDelta.WeaponDamage); @@ -61,7 +61,7 @@ namespace Server.Spells.Chivalry private static void RemoveTimer(Mobile m) { - if (m_Table.Remove(m, out var timerToken)) + if (_table.Remove(m, out var timerToken)) { timerToken.Cancel(); } @@ -74,6 +74,6 @@ namespace Server.Spells.Chivalry m.PlaySound(0xF8); } - public static bool UnderEffect(Mobile m) => m_Table.ContainsKey(m); + public static bool UnderEffect(Mobile m) => _table.ContainsKey(m); } } diff --git a/Projects/UOContent/Spells/Chivalry/EnemyOfOne.cs b/Projects/UOContent/Spells/Chivalry/EnemyOfOne.cs index b41410fed..5014eab26 100644 --- a/Projects/UOContent/Spells/Chivalry/EnemyOfOne.cs +++ b/Projects/UOContent/Spells/Chivalry/EnemyOfOne.cs @@ -13,7 +13,7 @@ namespace Server.Spells.Chivalry 9002 ); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public EnemyOfOneSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { @@ -42,7 +42,7 @@ namespace Server.Spells.Chivalry Timer.StartTimer(TimeSpan.FromMinutes(delay), () => Expire_Callback(Caster), out var timerToken); - m_Table[Caster] = timerToken; + _table[Caster] = timerToken; if (Caster is PlayerMobile mobile) { @@ -61,7 +61,7 @@ namespace Server.Spells.Chivalry private static void RemoveTimer(Mobile m) { - if (m_Table.Remove(m, out var timerToken)) + if (_table.Remove(m, out var timerToken)) { timerToken.Cancel(); } diff --git a/Projects/UOContent/Spells/Fifth/Incognito.cs b/Projects/UOContent/Spells/Fifth/Incognito.cs index 58dc05fb3..978af3dfa 100644 --- a/Projects/UOContent/Spells/Fifth/Incognito.cs +++ b/Projects/UOContent/Spells/Fifth/Incognito.cs @@ -19,7 +19,7 @@ namespace Server.Spells.Fifth Reagent.Nightshade ); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public IncognitoSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { @@ -112,7 +112,7 @@ namespace Server.Spells.Fifth var length = TimeSpan.FromSeconds(timeVal); Timer.StartTimer(length, () => EndIncognito(Caster), out var timerToken); - m_Table[Caster] = timerToken; + _table[Caster] = timerToken; BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.Incognito, 1075819, length, Caster)); } @@ -127,7 +127,7 @@ namespace Server.Spells.Fifth public static void StopTimer(Mobile m) { - if (m_Table.Remove(m, out var timerToken)) + if (_table.Remove(m, out var timerToken)) { timerToken.Cancel(); } diff --git a/Projects/UOContent/Spells/Fifth/MagicReflect.cs b/Projects/UOContent/Spells/Fifth/MagicReflect.cs index a00100674..d83582374 100644 --- a/Projects/UOContent/Spells/Fifth/MagicReflect.cs +++ b/Projects/UOContent/Spells/Fifth/MagicReflect.cs @@ -14,7 +14,7 @@ namespace Server.Spells.Fifth Reagent.SpidersSilk ); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public MagicReflectSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { @@ -59,7 +59,7 @@ namespace Server.Spells.Fifth { var targ = Caster; - if (m_Table.Remove(targ, out var mods)) + if (_table.Remove(targ, out var mods)) { targ.PlaySound(0x1ED); targ.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist); @@ -88,7 +88,7 @@ namespace Server.Spells.Fifth new ResistanceMod(ResistanceType.Energy, otherMod) }; - m_Table[targ] = mods; + _table[targ] = mods; for (var i = 0; i < mods.Length; ++i) { @@ -137,7 +137,7 @@ namespace Server.Spells.Fifth public static void EndReflect(Mobile m) { - if (!m_Table.Remove(m, out var mods)) + if (!_table.Remove(m, out var mods)) { return; } diff --git a/Projects/UOContent/Spells/First/ReactiveArmor.cs b/Projects/UOContent/Spells/First/ReactiveArmor.cs index b60167b13..8659c1253 100644 --- a/Projects/UOContent/Spells/First/ReactiveArmor.cs +++ b/Projects/UOContent/Spells/First/ReactiveArmor.cs @@ -15,7 +15,7 @@ namespace Server.Spells.First Reagent.SulfurousAsh ); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public ReactiveArmorSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { @@ -61,7 +61,7 @@ namespace Server.Spells.First { var targ = Caster; - if (m_Table.Remove(targ, out var mods)) + if (_table.Remove(targ, out var mods)) { targ.PlaySound(0x1ED); targ.FixedParticles(0x376A, 9, 32, 5008, EffectLayer.Waist); @@ -90,7 +90,7 @@ namespace Server.Spells.First new ResistanceMod(ResistanceType.Energy, -5) }; - m_Table[targ] = mods; + _table[targ] = mods; for (var i = 0; i < mods.Length; ++i) { @@ -144,7 +144,7 @@ namespace Server.Spells.First public static void EndArmor(Mobile m) { - if (!m_Table.Remove(m, out var mods)) + if (!_table.Remove(m, out var mods)) { return; } diff --git a/Projects/UOContent/Spells/Fourth/ManaDrain.cs b/Projects/UOContent/Spells/Fourth/ManaDrain.cs index 52bd11a8e..d3dc42e78 100644 --- a/Projects/UOContent/Spells/Fourth/ManaDrain.cs +++ b/Projects/UOContent/Spells/Fourth/ManaDrain.cs @@ -16,7 +16,7 @@ namespace Server.Spells.Fourth Reagent.SpidersSilk ); - private static readonly HashSet m_Table = new(); + private static readonly HashSet _table = new(); public ManaDrainSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { @@ -40,7 +40,7 @@ namespace Server.Spells.Fourth { var toDrain = Math.Clamp(40 + (int)(GetDamageSkill(Caster) - GetResistSkill(m)), 0, m.Mana); - if (m_Table.Contains(m)) + if (_table.Contains(m)) { toDrain = 0; } @@ -52,7 +52,7 @@ namespace Server.Spells.Fourth { m.Mana -= toDrain; - m_Table.Add(m); + _table.Add(m); Timer.StartTimer(TimeSpan.FromSeconds(5.0), () => AosDelay_Callback(m, toDrain)); } } @@ -96,7 +96,7 @@ namespace Server.Spells.Fourth m.PlaySound(0x28E); } - m_Table.Remove(m); + _table.Remove(m); } public override double GetResistPercent(Mobile target) => 99.0; diff --git a/Projects/UOContent/Spells/Mysticism/SpellPlagueSpell.cs b/Projects/UOContent/Spells/Mysticism/SpellPlagueSpell.cs index a02032856..23c991a4d 100644 --- a/Projects/UOContent/Spells/Mysticism/SpellPlagueSpell.cs +++ b/Projects/UOContent/Spells/Mysticism/SpellPlagueSpell.cs @@ -17,7 +17,7 @@ namespace Server.Spells.Mysticism Reagent.SulfurousAsh ); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public SpellPlagueSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) @@ -64,13 +64,13 @@ namespace Server.Spells.Mysticism var timer = new SpellPlagueTimer(this, targeted); - if (m_Table.TryGetValue(targeted, out var oldtimer)) + if (_table.TryGetValue(targeted, out var oldtimer)) { oldtimer.SetNext(timer); } else { - m_Table[targeted] = timer; + _table[targeted] = timer; timer.StartPlague(); } } @@ -78,11 +78,11 @@ namespace Server.Spells.Mysticism FinishSequence(); } - public static bool UnderEffect(Mobile m) => m_Table.ContainsKey(m); + public static bool UnderEffect(Mobile m) => _table.ContainsKey(m); public static void RemoveEffect(Mobile m) { - if (m_Table.TryGetValue(m, out var context)) + if (_table.TryGetValue(m, out var context)) { context.EndPlague(false); } @@ -90,7 +90,7 @@ namespace Server.Spells.Mysticism public static void CheckPlague(Mobile m) { - if (m_Table.TryGetValue(m, out var context)) + if (_table.TryGetValue(m, out var context)) { context.OnDamage(); } @@ -183,12 +183,12 @@ namespace Server.Spells.Mysticism { if (restart && m_Next != null) { - m_Table[m_Target] = m_Next; + _table[m_Target] = m_Next; m_Next.StartPlague(); } else { - m_Table.Remove(m_Target); + _table.Remove(m_Target); BuffInfo.RemoveBuff(m_Target, BuffIcon.SpellPlague); } } diff --git a/Projects/UOContent/Spells/Mysticism/StoneFormSpell.cs b/Projects/UOContent/Spells/Mysticism/StoneFormSpell.cs index a707caecb..fa2e83169 100644 --- a/Projects/UOContent/Spells/Mysticism/StoneFormSpell.cs +++ b/Projects/UOContent/Spells/Mysticism/StoneFormSpell.cs @@ -19,7 +19,7 @@ namespace Server.Spells.Mysticism Reagent.Garlic ); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public StoneFormSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) @@ -36,7 +36,7 @@ namespace Server.Spells.Mysticism EventSink.PlayerDeath += OnPlayerDeath; } - public static bool UnderEffect(Mobile m) => m_Table.ContainsKey(m); + public static bool UnderEffect(Mobile m) => _table.ContainsKey(m); public override bool CheckCast() { @@ -118,7 +118,7 @@ namespace Server.Spells.Mysticism Caster.AddResistanceMod(mods[i]); } - m_Table[Caster] = mods; + _table[Caster] = mods; Caster.PlaySound(0x65A); Caster.Delta(MobileDelta.Resistances); @@ -145,7 +145,7 @@ namespace Server.Spells.Mysticism public static void RemoveEffects(Mobile m) { - if (!m_Table.Remove(m, out var mods)) + if (!_table.Remove(m, out var mods)) { return; } diff --git a/Projects/UOContent/Spells/Necromancy/AnimateDeadSpell.cs b/Projects/UOContent/Spells/Necromancy/AnimateDeadSpell.cs index 5363f8cb6..dc2740166 100644 --- a/Projects/UOContent/Spells/Necromancy/AnimateDeadSpell.cs +++ b/Projects/UOContent/Spells/Necromancy/AnimateDeadSpell.cs @@ -108,7 +108,7 @@ namespace Server.Spells.Necromancy ) }; - private static readonly Dictionary> m_Table = new(); + private static readonly Dictionary> _table = new(); public AnimateDeadSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { @@ -235,7 +235,7 @@ namespace Server.Spells.Necromancy public static void Unregister(Mobile master, Mobile summoned) { - if (master == null || !m_Table.TryGetValue(master, out var list)) + if (master == null || !_table.TryGetValue(master, out var list)) { return; } @@ -244,7 +244,7 @@ namespace Server.Spells.Necromancy if (list.Count == 0) { - m_Table.Remove(master); + _table.Remove(master); } } @@ -255,9 +255,9 @@ namespace Server.Spells.Necromancy return; } - if (!m_Table.TryGetValue(master, out var list)) + if (!_table.TryGetValue(master, out var list)) { - m_Table[master] = list = new List(); + _table[master] = list = new List(); } for (var i = list.Count - 1; i >= 0; --i) diff --git a/Projects/UOContent/Spells/Necromancy/BloodOathSpell.cs b/Projects/UOContent/Spells/Necromancy/BloodOathSpell.cs index dd05819ff..0d7969f7d 100644 --- a/Projects/UOContent/Spells/Necromancy/BloodOathSpell.cs +++ b/Projects/UOContent/Spells/Necromancy/BloodOathSpell.cs @@ -16,7 +16,7 @@ namespace Server.Spells.Necromancy ); private static readonly Dictionary m_OathTable = new(); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public BloodOathSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { @@ -65,7 +65,7 @@ namespace Server.Spells.Necromancy * ((ss-rm)/8)+8 */ - m_Table.TryGetValue(m, out var timer); + _table.TryGetValue(m, out var timer); timer?.DoExpire(); m_OathTable[Caster] = Caster; @@ -90,7 +90,7 @@ namespace Server.Spells.Necromancy BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.BloodOathCaster, 1075659, duration, Caster, m.Name)); BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.BloodOathCurse, 1075661, duration, m, Caster.Name)); - m_Table[m] = timer; + _table[m] = timer; HarmfulSpell(m); } @@ -104,7 +104,7 @@ namespace Server.Spells.Necromancy public static void RemoveCurse(Mobile m) { - m_Table.TryGetValue(m, out var t); + _table.TryGetValue(m, out var t); t?.DoExpire(); } @@ -153,7 +153,7 @@ namespace Server.Spells.Necromancy BuffInfo.RemoveBuff(m_Caster, BuffIcon.BloodOathCaster); BuffInfo.RemoveBuff(m_Target, BuffIcon.BloodOathCurse); - m_Table.Remove(m_Caster); + _table.Remove(m_Caster); } } } diff --git a/Projects/UOContent/Spells/Necromancy/CorpseSkin.cs b/Projects/UOContent/Spells/Necromancy/CorpseSkin.cs index e39f33118..fb5909bd7 100644 --- a/Projects/UOContent/Spells/Necromancy/CorpseSkin.cs +++ b/Projects/UOContent/Spells/Necromancy/CorpseSkin.cs @@ -15,7 +15,7 @@ namespace Server.Spells.Necromancy Reagent.GraveDust ); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public CorpseSkinSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { @@ -49,7 +49,7 @@ namespace Server.Spells.Necromancy * NOTE: Resistance is not checked if targeting yourself */ - if (m_Table.TryGetValue(m, out var timer)) + if (_table.TryGetValue(m, out var timer)) { timer.DoExpire(); } @@ -82,7 +82,7 @@ namespace Server.Spells.Necromancy BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.CorpseSkin, 1075663, duration, m)); - m_Table[m] = timer; + _table[m] = timer; for (var i = 0; i < mods.Length; ++i) { @@ -102,7 +102,7 @@ namespace Server.Spells.Necromancy public static bool RemoveCurse(Mobile m) { - if (!m_Table.TryGetValue(m, out var t)) + if (!_table.TryGetValue(m, out var t)) { return false; } @@ -132,7 +132,7 @@ namespace Server.Spells.Necromancy Stop(); BuffInfo.RemoveBuff(m_Mobile, BuffIcon.CorpseSkin); - m_Table.Remove(m_Mobile); + _table.Remove(m_Mobile); } protected override void OnTick() diff --git a/Projects/UOContent/Spells/Necromancy/CurseWeapon.cs b/Projects/UOContent/Spells/Necromancy/CurseWeapon.cs index 61062abe6..96b5fd3ea 100644 --- a/Projects/UOContent/Spells/Necromancy/CurseWeapon.cs +++ b/Projects/UOContent/Spells/Necromancy/CurseWeapon.cs @@ -14,7 +14,7 @@ namespace Server.Spells.Necromancy Reagent.PigIron ); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public CurseWeaponSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { @@ -50,11 +50,11 @@ namespace Server.Spells.Necromancy var duration = TimeSpan.FromSeconds(Caster.Skills.SpiritSpeak.Value / 3.4 + 1.0); - m_Table.TryGetValue(weapon, out var timer); + _table.TryGetValue(weapon, out var timer); timer?.Stop(); weapon.Cursed = true; - m_Table[weapon] = timer = new ExpireTimer(weapon, duration); + _table[weapon] = timer = new ExpireTimer(weapon, duration); timer.Start(); } @@ -75,7 +75,7 @@ namespace Server.Spells.Necromancy { m_Weapon.Cursed = false; Effects.PlaySound(m_Weapon.GetWorldLocation(), m_Weapon.Map, 0xFA); - m_Table.Remove(m_Weapon); + _table.Remove(m_Weapon); } } diff --git a/Projects/UOContent/Spells/Necromancy/EvilOmen.cs b/Projects/UOContent/Spells/Necromancy/EvilOmen.cs index 686db22ff..ea3cd5335 100644 --- a/Projects/UOContent/Spells/Necromancy/EvilOmen.cs +++ b/Projects/UOContent/Spells/Necromancy/EvilOmen.cs @@ -16,7 +16,7 @@ namespace Server.Spells.Necromancy Reagent.NoxCrystal ); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public EvilOmenSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) @@ -52,7 +52,7 @@ namespace Server.Spells.Necromancy m.FixedParticles(0x3728, 1, 13, 9912, 1150, 7, EffectLayer.Head); m.FixedParticles(0x3779, 1, 15, 9502, 67, 7, EffectLayer.Head); - if (!m_Table.ContainsKey(m)) + if (!_table.ContainsKey(m)) { var mod = new DefaultSkillMod(SkillName.MagicResist, false, 50.0); @@ -61,7 +61,7 @@ namespace Server.Spells.Necromancy m.AddSkillMod(mod); } - m_Table[m] = mod; + _table[m] = mod; } var duration = TimeSpan.FromSeconds(Caster.Skills.SpiritSpeak.Value / 12 + 1.0); @@ -83,7 +83,7 @@ namespace Server.Spells.Necromancy public static bool TryEndEffect(Mobile m) { - if (!m_Table.Remove(m, out var mod)) + if (!_table.Remove(m, out var mod)) { return false; } diff --git a/Projects/UOContent/Spells/Necromancy/MindRot.cs b/Projects/UOContent/Spells/Necromancy/MindRot.cs index 3aaeda206..784fcaa11 100644 --- a/Projects/UOContent/Spells/Necromancy/MindRot.cs +++ b/Projects/UOContent/Spells/Necromancy/MindRot.cs @@ -16,7 +16,7 @@ namespace Server.Spells.Necromancy Reagent.DaemonBlood ); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public MindRotSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { @@ -73,7 +73,7 @@ namespace Server.Spells.Necromancy public static void ClearMindRotScalar(Mobile m) { - if (m_Table.Remove(m, out var tmpB)) + if (_table.Remove(m, out var tmpB)) { tmpB.m_MRExpireTimer.Stop(); m.SendLocalizedMessage(1060872); // Your mind feels normal again. @@ -82,11 +82,11 @@ namespace Server.Spells.Necromancy BuffInfo.RemoveBuff(m, BuffIcon.Mindrot); } - public static bool HasMindRotScalar(Mobile m) => m_Table.ContainsKey(m); + public static bool HasMindRotScalar(Mobile m) => _table.ContainsKey(m); public static bool GetMindRotScalar(Mobile m, ref double scalar) { - if (m_Table.TryGetValue(m, out var tmpB)) + if (_table.TryGetValue(m, out var tmpB)) { scalar = tmpB.m_Scalar; return true; @@ -97,10 +97,10 @@ namespace Server.Spells.Necromancy public static void SetMindRotScalar(Mobile caster, Mobile target, double scalar, TimeSpan duration) { - if (!m_Table.ContainsKey(target)) + if (!_table.ContainsKey(target)) { var tmpB = new MRBucket(scalar, new MRExpireTimer(target, duration)); - m_Table.Add(target, tmpB); + _table.Add(target, tmpB); BuffInfo.AddBuff(target, new BuffInfo(BuffIcon.Mindrot, 1075665, duration, target)); tmpB.m_MRExpireTimer.Start(); target.SendLocalizedMessage(1074384); diff --git a/Projects/UOContent/Spells/Necromancy/PainSpike.cs b/Projects/UOContent/Spells/Necromancy/PainSpike.cs index 632c2af6b..e270c144c 100644 --- a/Projects/UOContent/Spells/Necromancy/PainSpike.cs +++ b/Projects/UOContent/Spells/Necromancy/PainSpike.cs @@ -16,7 +16,7 @@ namespace Server.Spells.Necromancy Reagent.PigIron ); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public PainSpikeSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { @@ -56,9 +56,9 @@ namespace Server.Spells.Necromancy var buffTime = TimeSpan.FromSeconds(10.0); - if (!m_Table.TryGetValue(m, out var timer)) + if (!_table.TryGetValue(m, out var timer)) { - m_Table[m] = timer = new InternalTimer(m, damage); + _table[m] = timer = new InternalTimer(m, damage); timer.Start(); } else @@ -102,7 +102,7 @@ namespace Server.Spells.Necromancy protected override void OnTick() { - m_Table.Remove(m_Mobile); + _table.Remove(m_Mobile); if (m_Mobile.Alive && !m_Mobile.IsDeadBondedPet) { diff --git a/Projects/UOContent/Spells/Necromancy/Strangle.cs b/Projects/UOContent/Spells/Necromancy/Strangle.cs index c221e1dac..a7aeab5dd 100644 --- a/Projects/UOContent/Spells/Necromancy/Strangle.cs +++ b/Projects/UOContent/Spells/Necromancy/Strangle.cs @@ -15,7 +15,7 @@ namespace Server.Spells.Necromancy Reagent.NoxCrystal ); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public StrangleSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { @@ -60,9 +60,9 @@ namespace Server.Spells.Necromancy m.FixedParticles(0x36CB, 1, 9, 9911, 67, 5, EffectLayer.Head); m.FixedParticles(0x374A, 1, 17, 9502, 1108, 4, (EffectLayer)255); - if (!m_Table.TryGetValue(m, out var timer)) + if (!_table.TryGetValue(m, out var timer)) { - m_Table[m] = timer = new InternalTimer(m, Caster); + _table[m] = timer = new InternalTimer(m, Caster); timer.Start(); } @@ -118,7 +118,7 @@ namespace Server.Spells.Necromancy public static bool RemoveCurse(Mobile m) { - if (!m_Table.Remove(m, out var timer)) + if (!_table.Remove(m, out var timer)) { return false; } @@ -168,7 +168,7 @@ namespace Server.Spells.Necromancy { if (!m_Target.Alive) { - m_Table.Remove(m_Target); + _table.Remove(m_Target); Stop(); } @@ -203,7 +203,7 @@ namespace Server.Spells.Necromancy if (m_Count == 0) { m_Target.SendLocalizedMessage(1061687); // You can breath normally again. - m_Table.Remove(m_Target); + _table.Remove(m_Target); Stop(); } else diff --git a/Projects/UOContent/Spells/Ninjitsu/AnimalForm.cs b/Projects/UOContent/Spells/Ninjitsu/AnimalForm.cs index c07995af0..041a10eab 100644 --- a/Projects/UOContent/Spells/Ninjitsu/AnimalForm.cs +++ b/Projects/UOContent/Spells/Ninjitsu/AnimalForm.cs @@ -26,7 +26,7 @@ namespace Server.Spells.Ninjitsu ); private static readonly Dictionary m_LastAnimalForms = new(); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); private bool m_WasMoving; @@ -272,7 +272,7 @@ namespace Server.Spells.Ninjitsu public static void AddContext(Mobile m, AnimalFormContext context) { - m_Table[m] = context; + _table[m] = context; if (context.Type == typeof(BakeKitsune) || context.Type == typeof(GreyWolf)) { @@ -292,7 +292,7 @@ namespace Server.Spells.Ninjitsu public static void RemoveContext(Mobile m, AnimalFormContext context, bool resetGraphics) { - m_Table.Remove(m); + _table.Remove(m); if (context.SpeedBoost) { @@ -324,9 +324,9 @@ namespace Server.Spells.Ninjitsu context.Timer.Stop(); } - public static AnimalFormContext GetContext(Mobile m) => m_Table.TryGetValue(m, out var context) ? context : null; + public static AnimalFormContext GetContext(Mobile m) => _table.TryGetValue(m, out var context) ? context : null; - public static bool UnderTransformation(Mobile m) => m_Table.ContainsKey(m); + public static bool UnderTransformation(Mobile m) => _table.ContainsKey(m); public static bool UnderTransformation(Mobile m, Type type) => GetContext(m)?.Type == type; diff --git a/Projects/UOContent/Spells/Ninjitsu/DeathStrike.cs b/Projects/UOContent/Spells/Ninjitsu/DeathStrike.cs index dab80c215..ca4ef48a3 100644 --- a/Projects/UOContent/Spells/Ninjitsu/DeathStrike.cs +++ b/Projects/UOContent/Spells/Ninjitsu/DeathStrike.cs @@ -8,7 +8,7 @@ namespace Server.Spells.Ninjitsu { public class DeathStrike : NinjaMove { - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public override int BaseMana => 30; public override double RequiredSkill => 85.0; @@ -51,7 +51,7 @@ namespace Server.Spells.Ninjitsu var damageBonus = 0; - if (m_Table.Remove(defender, out var timer)) + if (_table.Remove(defender, out var timer)) { defender.SendLocalizedMessage(1063092); // Your opponent lands another Death Strike! @@ -74,7 +74,7 @@ namespace Server.Spells.Ninjitsu var t = new DeathStrikeTimer(defender, attacker, damageBonus, isRanged); - m_Table[defender] = t; + _table[defender] = t; t.Start(); @@ -83,7 +83,7 @@ namespace Server.Spells.Ninjitsu public static void AddStep(Mobile m) { - if (m_Table.TryGetValue(m, out var timer) && ++timer.Steps >= 5) + if (_table.TryGetValue(m, out var timer) && ++timer.Steps >= 5) { timer.ProcessDeathStrike(); } diff --git a/Projects/UOContent/Spells/Ninjitsu/KiAttack.cs b/Projects/UOContent/Spells/Ninjitsu/KiAttack.cs index c957c7ae0..ba573e3aa 100644 --- a/Projects/UOContent/Spells/Ninjitsu/KiAttack.cs +++ b/Projects/UOContent/Spells/Ninjitsu/KiAttack.cs @@ -6,7 +6,7 @@ namespace Server.Spells.Ninjitsu { public class KiAttack : NinjaMove { - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public override int BaseMana => 25; public override double RequiredSkill => 80.0; @@ -22,7 +22,7 @@ namespace Server.Spells.Ninjitsu } var t = new KiAttackTimer(from); - m_Table[from] = t; + _table[from] = t; t.Start(); } @@ -86,7 +86,7 @@ namespace Server.Spells.Ninjitsu public override void OnClearMove(Mobile from) { - if (m_Table.Remove(from, out var t)) + if (_table.Remove(from, out var t)) { t.Stop(); } @@ -94,7 +94,7 @@ namespace Server.Spells.Ninjitsu public static double GetBonus(Mobile from) { - if (!m_Table.TryGetValue(from, out var t)) + if (!_table.TryGetValue(from, out var t)) { return 0; } @@ -121,7 +121,7 @@ namespace Server.Spells.Ninjitsu ClearCurrentMove(m_Mobile); m_Mobile.SendLocalizedMessage(1063102); // You failed to complete your Ki Attack in time. - m_Table.Remove(m_Mobile); + _table.Remove(m_Mobile); } } } diff --git a/Projects/UOContent/Spells/Ninjitsu/SurpriseAttack.cs b/Projects/UOContent/Spells/Ninjitsu/SurpriseAttack.cs index d918509bd..e66df4db9 100644 --- a/Projects/UOContent/Spells/Ninjitsu/SurpriseAttack.cs +++ b/Projects/UOContent/Spells/Ninjitsu/SurpriseAttack.cs @@ -7,7 +7,7 @@ namespace Server.Spells.Ninjitsu public class SurpriseAttack : NinjaMove { private static readonly Dictionary - m_Table = new(); + _table = new(); public override int BaseMana => 20; public override double RequiredSkill => Core.ML ? 60.0 : 30.0; @@ -62,7 +62,7 @@ namespace Server.Spells.Ninjitsu var info = new SurpriseAttackInfo(defender, malus); Timer.StartTimer(TimeSpan.FromSeconds(8.0), () => EndSurprise(info), out info._timerToken); - m_Table[defender] = info; + _table[defender] = info; CheckGain(attacker); } @@ -78,7 +78,7 @@ namespace Server.Spells.Ninjitsu public static bool GetMalus(Mobile target, ref int malus) { - if (!m_Table.TryGetValue(target, out var info)) + if (!_table.TryGetValue(target, out var info)) { return false; } @@ -89,7 +89,7 @@ namespace Server.Spells.Ninjitsu private static void StopTimer(Mobile m) { - if (m_Table.Remove(m, out var info)) + if (_table.Remove(m, out var info)) { info._timerToken.Cancel(); } diff --git a/Projects/UOContent/Spells/Second/Protection.cs b/Projects/UOContent/Spells/Second/Protection.cs index 30fe8d194..38f1342c7 100644 --- a/Projects/UOContent/Spells/Second/Protection.cs +++ b/Projects/UOContent/Spells/Second/Protection.cs @@ -15,7 +15,7 @@ namespace Server.Spells.Second Reagent.SulfurousAsh ); - private static readonly Dictionary> m_Table = + private static readonly Dictionary> _table = new(); public ProtectionSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) @@ -60,7 +60,7 @@ namespace Server.Spells.Second * even after dying�until you �turn them off� by casting them again. */ - if (m_Table.Remove(target, out var mods)) + if (_table.Remove(target, out var mods)) { target.PlaySound(0x1ED); target.FixedParticles(0x375A, 9, 20, 5016, EffectLayer.Waist); @@ -89,7 +89,7 @@ namespace Server.Spells.Second ) ); - m_Table[target] = mods; + _table[target] = mods; Registry[target] = 1000; // 100.0% protection from disruption target.AddResistanceMod(mods.Item1); @@ -104,7 +104,7 @@ namespace Server.Spells.Second public static void EndProtection(Mobile m) { - if (!m_Table.Remove(m, out var mods)) + if (!_table.Remove(m, out var mods)) { return; } diff --git a/Projects/UOContent/Spells/Seventh/Polymorph.cs b/Projects/UOContent/Spells/Seventh/Polymorph.cs index f53deedcd..e4631aec0 100644 --- a/Projects/UOContent/Spells/Seventh/Polymorph.cs +++ b/Projects/UOContent/Spells/Seventh/Polymorph.cs @@ -19,7 +19,7 @@ namespace Server.Spells.Seventh Reagent.MandrakeRoot ); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); private readonly int m_NewBody; @@ -170,7 +170,7 @@ namespace Server.Spells.Seventh var duration = Math.Max((int)caster.Skills.Magery.Value, 120); Timer.StartTimer(TimeSpan.FromSeconds(duration), () => EndPolymorph(caster), out var timerToken); - m_Table[caster] = timerToken; + _table[caster] = timerToken; } } } @@ -185,7 +185,7 @@ namespace Server.Spells.Seventh public static void StopTimer(Mobile m) { - if (m_Table.Remove(m, out var timer)) + if (_table.Remove(m, out var timer)) { timer.Cancel(); } diff --git a/Projects/UOContent/Spells/Sixth/Invisibility.cs b/Projects/UOContent/Spells/Sixth/Invisibility.cs index 1fd01bfcd..f7d545538 100644 --- a/Projects/UOContent/Spells/Sixth/Invisibility.cs +++ b/Projects/UOContent/Spells/Sixth/Invisibility.cs @@ -18,7 +18,7 @@ namespace Server.Spells.Sixth Reagent.Nightshade ); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public InvisibilitySpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { @@ -65,7 +65,7 @@ namespace Server.Spells.Sixth out var timerToken ); - m_Table[m] = timerToken; + _table[m] = timerToken; } FinishSequence(); @@ -87,11 +87,11 @@ namespace Server.Spells.Sixth Caster.Target = new SpellTargetMobile(this, TargetFlags.Beneficial, Core.ML ? 10 : 12); } - public static bool HasTimer(Mobile m) => m_Table.ContainsKey(m); + public static bool HasTimer(Mobile m) => _table.ContainsKey(m); public static void StopTimer(Mobile m) { - if (m_Table.Remove(m, out var timerToken)) + if (_table.Remove(m, out var timerToken)) { timerToken.Cancel(); } diff --git a/Projects/UOContent/Spells/Spellweaving/AttuneWeapon.cs b/Projects/UOContent/Spells/Spellweaving/AttuneWeapon.cs index fcd22bc9b..1adc28c12 100644 --- a/Projects/UOContent/Spells/Spellweaving/AttuneWeapon.cs +++ b/Projects/UOContent/Spells/Spellweaving/AttuneWeapon.cs @@ -11,7 +11,7 @@ namespace Server.Spells.Spellweaving -1 ); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public AttuneWeaponSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) @@ -25,7 +25,7 @@ namespace Server.Spells.Spellweaving public override bool CheckCast() { - if (m_Table.ContainsKey(Caster)) + if (_table.ContainsKey(Caster)) { Caster.SendLocalizedMessage(501775); // This spell is already in effect. return false; @@ -58,7 +58,7 @@ namespace Server.Spells.Spellweaving var t = new ExpireTimer(Caster, duration); t.Start(); - m_Table[Caster] = t; + _table[Caster] = t; Caster.BeginAction(); @@ -94,11 +94,11 @@ namespace Server.Spells.Spellweaving } } - public static bool IsAbsorbing(Mobile m) => m_Table.ContainsKey(m); + public static bool IsAbsorbing(Mobile m) => _table.ContainsKey(m); public static void StopAbsorbing(Mobile m, bool message) { - if (m_Table.TryGetValue(m, out var t)) + if (_table.TryGetValue(m, out var t)) { t.DoExpire(message); } @@ -129,7 +129,7 @@ namespace Server.Spells.Spellweaving m_Mobile.PlaySound(0x1F8); } - m_Table.Remove(m_Mobile); + _table.Remove(m_Mobile); StartTimer(TimeSpan.FromSeconds(120), m_Mobile.EndAction); BuffInfo.RemoveBuff(m_Mobile, BuffIcon.AttuneWeapon); diff --git a/Projects/UOContent/Spells/Spellweaving/EssenceOfWind.cs b/Projects/UOContent/Spells/Spellweaving/EssenceOfWind.cs index 7f676a578..c5f2c4698 100644 --- a/Projects/UOContent/Spells/Spellweaving/EssenceOfWind.cs +++ b/Projects/UOContent/Spells/Spellweaving/EssenceOfWind.cs @@ -7,7 +7,7 @@ namespace Server.Spells.Spellweaving { private static readonly SpellInfo _info = new("Essence of Wind", "Anathrae", -1); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public EssenceOfWindSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) { @@ -56,7 +56,7 @@ namespace Server.Spells.Spellweaving var t = new EssenceOfWindTimer(m, fcMalus, ssiMalus, duration); t.Start(); - m_Table[m] = t; + _table[m] = t; BuffInfo.AddBuff( m, @@ -76,15 +76,15 @@ namespace Server.Spells.Spellweaving FinishSequence(); } - public static int GetFCMalus(Mobile m) => m_Table.TryGetValue(m, out var timer) ? timer._fcMalus : 0; + public static int GetFCMalus(Mobile m) => _table.TryGetValue(m, out var timer) ? timer._fcMalus : 0; - public static int GetSSIMalus(Mobile m) => m_Table.TryGetValue(m, out var timer) ? timer._ssiMalus : 0; + public static int GetSSIMalus(Mobile m) => _table.TryGetValue(m, out var timer) ? timer._ssiMalus : 0; - public static bool IsDebuffed(Mobile m) => m_Table.ContainsKey(m); + public static bool IsDebuffed(Mobile m) => _table.ContainsKey(m); public static void StopDebuffing(Mobile m, bool message) { - if (m_Table.TryGetValue(m, out var timer)) + if (_table.TryGetValue(m, out var timer)) { timer.DoExpire(message); } @@ -111,7 +111,7 @@ namespace Server.Spells.Spellweaving internal void DoExpire(bool message = true) { Stop(); - m_Table.Remove(_defender); + _table.Remove(_defender); BuffInfo.RemoveBuff(_defender, BuffIcon.EssenceOfWind); } diff --git a/Projects/UOContent/Spells/Spellweaving/GiftOfLife.cs b/Projects/UOContent/Spells/Spellweaving/GiftOfLife.cs index 55623c555..3367d4c3e 100644 --- a/Projects/UOContent/Spells/Spellweaving/GiftOfLife.cs +++ b/Projects/UOContent/Spells/Spellweaving/GiftOfLife.cs @@ -14,7 +14,7 @@ namespace Server.Spells.Spellweaving -1 ); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public GiftOfLifeSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) @@ -38,7 +38,7 @@ namespace Server.Spells.Spellweaving { Caster.SendLocalizedMessage(1072077); // You may only cast this spell on yourself or a bonded pet. } - else if (m_Table.ContainsKey(m)) + else if (_table.ContainsKey(m)) { Caster.SendLocalizedMessage(501775); // This spell is already in effect. } @@ -65,7 +65,7 @@ namespace Server.Spells.Spellweaving var t = new ExpireTimer(m, duration, this); t.Start(); - m_Table[m] = t; + _table[m] = t; BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.GiftOfLife, 1031615, 1075807, duration, m, null, true)); } @@ -85,7 +85,7 @@ namespace Server.Spells.Spellweaving public static void HandleDeath(Mobile m) { - if (m_Table.ContainsKey(m)) + if (_table.ContainsKey(m)) { Timer.StartTimer(TimeSpan.FromSeconds(Utility.RandomMinMax(2, 4)), () => HandleDeath_OnCallback(m)); } @@ -93,7 +93,7 @@ namespace Server.Spells.Spellweaving private static void HandleDeath_OnCallback(Mobile m) { - if (!m_Table.TryGetValue(m, out var timer)) + if (!_table.TryGetValue(m, out var timer)) { return; } @@ -138,7 +138,7 @@ namespace Server.Spells.Spellweaving public static void OnLogin(Mobile m) { - if (m?.Alive != false || m_Table[m] == null) + if (m?.Alive != false || _table[m] == null) { return; } @@ -169,7 +169,7 @@ namespace Server.Spells.Spellweaving Stop(); m_Mobile.SendLocalizedMessage(1074776); // You are no longer protected with Gift of Life. - m_Table.Remove(m_Mobile); + _table.Remove(m_Mobile); BuffInfo.RemoveBuff(m_Mobile, BuffIcon.GiftOfLife); } diff --git a/Projects/UOContent/Spells/Spellweaving/GiftOfRenewal.cs b/Projects/UOContent/Spells/Spellweaving/GiftOfRenewal.cs index e99471fcd..26b2917f8 100644 --- a/Projects/UOContent/Spells/Spellweaving/GiftOfRenewal.cs +++ b/Projects/UOContent/Spells/Spellweaving/GiftOfRenewal.cs @@ -12,7 +12,7 @@ namespace Server.Spells.Spellweaving -1 ); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public GiftOfRenewalSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) @@ -26,7 +26,7 @@ namespace Server.Spells.Spellweaving public void Target(Mobile m) { - if (m_Table.ContainsKey(m)) + if (_table.ContainsKey(m)) { Caster.SendLocalizedMessage(501775); // This spell is already in effect. } @@ -54,7 +54,7 @@ namespace Server.Spells.Spellweaving var t = new GiftOfRenewalTimer(Caster, m, hitsPerRound, duration); - m_Table[m] = t; + _table[m] = t; t.Start(); @@ -79,7 +79,7 @@ namespace Server.Spells.Spellweaving { BuffInfo.RemoveBuff(m, BuffIcon.GiftOfRenewal); - if (m_Table.Remove(m, out var timer)) + if (_table.Remove(m, out var timer)) { timer.Stop(); Timer.StartTimer(TimeSpan.FromSeconds(60), timer.m_Caster.EndAction); @@ -115,7 +115,7 @@ namespace Server.Spells.Spellweaving var m = m_Mobile; - if (!m_Table.ContainsKey(m)) + if (!_table.ContainsKey(m)) { Stop(); return; diff --git a/Projects/UOContent/Spells/Spellweaving/ImmolatingWeapon.cs b/Projects/UOContent/Spells/Spellweaving/ImmolatingWeapon.cs index 10ce95d8d..33b1a58cc 100644 --- a/Projects/UOContent/Spells/Spellweaving/ImmolatingWeapon.cs +++ b/Projects/UOContent/Spells/Spellweaving/ImmolatingWeapon.cs @@ -12,7 +12,7 @@ namespace Server.Spells.Spellweaving -1 ); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public ImmolatingWeaponSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) @@ -54,7 +54,7 @@ namespace Server.Spells.Spellweaving var damage = 5 + (int)(skill / 24) + FocusLevel; var t = new ImmolatingWeaponTimer(TimeSpan.FromSeconds(duration), damage, Caster, weapon); - m_Table[weapon] = t; + _table[weapon] = t; t.Start(); weapon.InvalidateProperties(); @@ -64,14 +64,14 @@ namespace Server.Spells.Spellweaving FinishSequence(); } - public static bool IsImmolating(BaseWeapon weapon) => m_Table.ContainsKey(weapon); + public static bool IsImmolating(BaseWeapon weapon) => _table.ContainsKey(weapon); public static int GetImmolatingDamage(BaseWeapon weapon) => - m_Table.TryGetValue(weapon, out var entry) ? entry._damage : 0; + _table.TryGetValue(weapon, out var entry) ? entry._damage : 0; public static void DoEffect(BaseWeapon weapon, Mobile target) { - if (m_Table.Remove(weapon, out var timer)) + if (_table.Remove(weapon, out var timer)) { timer.Stop(); @@ -86,7 +86,7 @@ namespace Server.Spells.Spellweaving public static void StopImmolating(BaseWeapon weapon) { - if (m_Table.Remove(weapon, out var timer)) + if (_table.Remove(weapon, out var timer)) { timer._caster?.PlaySound(0x27); timer.Stop(); diff --git a/Projects/UOContent/Spells/Spellweaving/Thunderstorm.cs b/Projects/UOContent/Spells/Spellweaving/Thunderstorm.cs index c69e01f50..8b198a2f9 100644 --- a/Projects/UOContent/Spells/Spellweaving/Thunderstorm.cs +++ b/Projects/UOContent/Spells/Spellweaving/Thunderstorm.cs @@ -11,7 +11,7 @@ namespace Server.Spells.Spellweaving -1 ); - private static readonly Dictionary m_Table = new(); + private static readonly Dictionary _table = new(); public ThunderstormSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info) @@ -66,7 +66,7 @@ namespace Server.Spells.Spellweaving StopTimer(m); Timer.StartTimer(duration, () => DoExpire(m), out var timerToken); - m_Table[m] = timerToken; + _table[m] = timerToken; BuffInfo.AddBuff( m, @@ -80,11 +80,11 @@ namespace Server.Spells.Spellweaving FinishSequence(); } - public static int GetCastRecoveryMalus(Mobile m) => m_Table.ContainsKey(m) ? 6 : 0; + public static int GetCastRecoveryMalus(Mobile m) => _table.ContainsKey(m) ? 6 : 0; private static void StopTimer(Mobile m) { - if (m_Table.Remove(m, out var timerToken)) + if (_table.Remove(m, out var timerToken)) { timerToken.Cancel(); } From 239dda4b3bf8c35ff936f98b7bcde4d175e1a1c8 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Sun, 14 Nov 2021 21:07:54 -0800 Subject: [PATCH 09/16] fix: Cleans up spell targeting (#851) --- Projects/UOContent/Spells/Base/Spell.cs | 25 ++++++------------- .../UOContent/Spells/Eighth/EnergyVortex.cs | 2 +- .../UOContent/Spells/Fifth/BladeSpirits.cs | 2 +- .../UOContent/Spells/Fifth/DispelField.cs | 2 +- .../UOContent/Spells/Fifth/PoisonField.cs | 2 +- Projects/UOContent/Spells/Fourth/ArchCure.cs | 2 +- .../UOContent/Spells/Fourth/ArchProtection.cs | 2 +- Projects/UOContent/Spells/Fourth/FireField.cs | 2 +- .../Spells/Necromancy/AnimateDeadSpell.cs | 2 +- Projects/UOContent/Spells/Second/MagicTrap.cs | 2 +- .../UOContent/Spells/Second/RemoveTrap.cs | 2 +- .../Spells/Seventh/ChainLightning.cs | 2 +- .../UOContent/Spells/Seventh/EnergyField.cs | 2 +- .../UOContent/Spells/Seventh/MassDispel.cs | 2 +- .../UOContent/Spells/Seventh/MeteorSwarm.cs | 2 +- Projects/UOContent/Spells/Sixth/Mark.cs | 2 +- Projects/UOContent/Spells/Sixth/MassCurse.cs | 2 +- .../UOContent/Spells/Sixth/ParalyzeField.cs | 2 +- Projects/UOContent/Spells/Sixth/Reveal.cs | 2 +- .../Spells/Targeting/RecallSpellTarget.cs | 16 ++++++------ .../Spells/Targeting/SpellTargetItem.cs | 12 ++++----- .../Spells/Targeting/SpellTargetMobile.cs | 10 ++++---- .../Spells/Targeting/SpellTargetPoint3D.cs | 22 ++++++++-------- Projects/UOContent/Spells/Third/MagicLock.cs | 2 +- .../UOContent/Spells/Third/Telekinesis.cs | 2 +- Projects/UOContent/Spells/Third/Teleport.cs | 2 +- Projects/UOContent/Spells/Third/Unlock.cs | 2 +- .../UOContent/Spells/Third/WallOfStone.cs | 2 +- 28 files changed, 61 insertions(+), 70 deletions(-) diff --git a/Projects/UOContent/Spells/Base/Spell.cs b/Projects/UOContent/Spells/Base/Spell.cs index 4be93b9b3..85c8c4ceb 100644 --- a/Projects/UOContent/Spells/Base/Spell.cs +++ b/Projects/UOContent/Spells/Base/Spell.cs @@ -377,20 +377,19 @@ namespace Server.Spells return; } + if (!firstCircle && !Core.AOS && (this as MagerySpell)?.Circle == SpellCircle.First) + { + return; + } + + State = SpellState.None; + Caster.Spell = null; + if (State == SpellState.Casting) { - if (!firstCircle && !Core.AOS && this is MagerySpell && ((MagerySpell)this).Circle == SpellCircle.First) - { - return; - } - - State = SpellState.None; - Caster.Spell = null; - OnDisturb(type, true); m_CastTimer?.Stop(); - m_AnimTimer?.Stop(); if (Core.AOS && Caster.Player && type == DisturbType.Hurt) @@ -402,14 +401,6 @@ namespace Server.Spells } else if (State == SpellState.Sequencing) { - if (!firstCircle && !Core.AOS && this is MagerySpell && ((MagerySpell)this).Circle == SpellCircle.First) - { - return; - } - - State = SpellState.None; - Caster.Spell = null; - OnDisturb(type, false); Target.Cancel(Caster); diff --git a/Projects/UOContent/Spells/Eighth/EnergyVortex.cs b/Projects/UOContent/Spells/Eighth/EnergyVortex.cs index 812f67bf0..f2d917b61 100644 --- a/Projects/UOContent/Spells/Eighth/EnergyVortex.cs +++ b/Projects/UOContent/Spells/Eighth/EnergyVortex.cs @@ -70,7 +70,7 @@ namespace Server.Spells.Eighth public override void OnCast() { - Caster.Target = new SpellTargetPoint3D(this); + Caster.Target = new SpellTargetPoint3D(this, retryOnLOS: true); } } } diff --git a/Projects/UOContent/Spells/Fifth/BladeSpirits.cs b/Projects/UOContent/Spells/Fifth/BladeSpirits.cs index 296752d60..6bf8cf6a0 100644 --- a/Projects/UOContent/Spells/Fifth/BladeSpirits.cs +++ b/Projects/UOContent/Spells/Fifth/BladeSpirits.cs @@ -79,7 +79,7 @@ namespace Server.Spells.Fifth public override void OnCast() { - Caster.Target = new SpellTargetPoint3D(this); + Caster.Target = new SpellTargetPoint3D(this, retryOnLOS: true); } } } diff --git a/Projects/UOContent/Spells/Fifth/DispelField.cs b/Projects/UOContent/Spells/Fifth/DispelField.cs index cd7c3240c..ff0241410 100644 --- a/Projects/UOContent/Spells/Fifth/DispelField.cs +++ b/Projects/UOContent/Spells/Fifth/DispelField.cs @@ -54,7 +54,7 @@ namespace Server.Spells.Fifth public override void OnCast() { - Caster.Target = new SpellTargetItem(this, TargetFlags.None, Core.ML ? 10 : 12); + Caster.Target = new SpellTargetItem(this, range: Core.ML ? 10 : 12); } } } diff --git a/Projects/UOContent/Spells/Fifth/PoisonField.cs b/Projects/UOContent/Spells/Fifth/PoisonField.cs index 1c7ceb92a..bbc26fb85 100644 --- a/Projects/UOContent/Spells/Fifth/PoisonField.cs +++ b/Projects/UOContent/Spells/Fifth/PoisonField.cs @@ -55,7 +55,7 @@ namespace Server.Spells.Fifth public override void OnCast() { - Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, Core.ML ? 10 : 12, false); + Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12); } [DispellableField] diff --git a/Projects/UOContent/Spells/Fourth/ArchCure.cs b/Projects/UOContent/Spells/Fourth/ArchCure.cs index 9b618138f..f7be3f3e9 100644 --- a/Projects/UOContent/Spells/Fourth/ArchCure.cs +++ b/Projects/UOContent/Spells/Fourth/ArchCure.cs @@ -100,7 +100,7 @@ namespace Server.Spells.Fourth public override void OnCast() { - Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, Core.ML ? 10 : 12); + Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12); } private bool AreaCanTarget(Mobile target, bool feluccaRules) diff --git a/Projects/UOContent/Spells/Fourth/ArchProtection.cs b/Projects/UOContent/Spells/Fourth/ArchProtection.cs index a9ae7f7bb..a798ad83b 100644 --- a/Projects/UOContent/Spells/Fourth/ArchProtection.cs +++ b/Projects/UOContent/Spells/Fourth/ArchProtection.cs @@ -103,7 +103,7 @@ namespace Server.Spells.Fourth public override void OnCast() { - Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, Core.ML ? 10 : 12); + Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12); } private static void AddEntry(Mobile m, int v) diff --git a/Projects/UOContent/Spells/Fourth/FireField.cs b/Projects/UOContent/Spells/Fourth/FireField.cs index c06739a78..e685fd6c0 100644 --- a/Projects/UOContent/Spells/Fourth/FireField.cs +++ b/Projects/UOContent/Spells/Fourth/FireField.cs @@ -64,7 +64,7 @@ namespace Server.Spells.Fourth public override void OnCast() { - Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, Core.ML ? 10 : 12); + Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12); } [DispellableField] diff --git a/Projects/UOContent/Spells/Necromancy/AnimateDeadSpell.cs b/Projects/UOContent/Spells/Necromancy/AnimateDeadSpell.cs index dc2740166..47448544b 100644 --- a/Projects/UOContent/Spells/Necromancy/AnimateDeadSpell.cs +++ b/Projects/UOContent/Spells/Necromancy/AnimateDeadSpell.cs @@ -206,7 +206,7 @@ namespace Server.Spells.Necromancy public override void OnCast() { - Caster.Target = new SpellTargetItem(this, TargetFlags.None, Core.ML ? 10 : 12); + Caster.Target = new SpellTargetItem(this, range: Core.ML ? 10 : 12); Caster.SendLocalizedMessage(1061083); // Animate what corpse? } diff --git a/Projects/UOContent/Spells/Second/MagicTrap.cs b/Projects/UOContent/Spells/Second/MagicTrap.cs index 259cfcad0..13200240f 100644 --- a/Projects/UOContent/Spells/Second/MagicTrap.cs +++ b/Projects/UOContent/Spells/Second/MagicTrap.cs @@ -85,7 +85,7 @@ namespace Server.Spells.Second public override void OnCast() { - Caster.Target = new SpellTargetItem(this, TargetFlags.None, Core.ML ? 10 : 12); + Caster.Target = new SpellTargetItem(this, range: Core.ML ? 10 : 12); } } } diff --git a/Projects/UOContent/Spells/Second/RemoveTrap.cs b/Projects/UOContent/Spells/Second/RemoveTrap.cs index c684e603c..3850205c0 100644 --- a/Projects/UOContent/Spells/Second/RemoveTrap.cs +++ b/Projects/UOContent/Spells/Second/RemoveTrap.cs @@ -55,7 +55,7 @@ namespace Server.Spells.Second public override void OnCast() { - Caster.Target = new SpellTargetItem(this, TargetFlags.None, Core.ML ? 10 : 12); + Caster.Target = new SpellTargetItem(this, range: Core.ML ? 10 : 12); Caster.SendMessage("What do you wish to untrap?"); // TODO: Localization? } } diff --git a/Projects/UOContent/Spells/Seventh/ChainLightning.cs b/Projects/UOContent/Spells/Seventh/ChainLightning.cs index 7251597aa..0286729fe 100644 --- a/Projects/UOContent/Spells/Seventh/ChainLightning.cs +++ b/Projects/UOContent/Spells/Seventh/ChainLightning.cs @@ -119,7 +119,7 @@ namespace Server.Spells.Seventh public override void OnCast() { - Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, Core.ML ? 10 : 12); + Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12); } } } diff --git a/Projects/UOContent/Spells/Seventh/EnergyField.cs b/Projects/UOContent/Spells/Seventh/EnergyField.cs index 8e6489779..98177d63f 100644 --- a/Projects/UOContent/Spells/Seventh/EnergyField.cs +++ b/Projects/UOContent/Spells/Seventh/EnergyField.cs @@ -82,7 +82,7 @@ namespace Server.Spells.Seventh public override void OnCast() { - Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, Core.ML ? 10 : 12); + Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12); } [DispellableField] diff --git a/Projects/UOContent/Spells/Seventh/MassDispel.cs b/Projects/UOContent/Spells/Seventh/MassDispel.cs index fad116d3d..8a1b3b164 100644 --- a/Projects/UOContent/Spells/Seventh/MassDispel.cs +++ b/Projects/UOContent/Spells/Seventh/MassDispel.cs @@ -77,7 +77,7 @@ namespace Server.Spells.Seventh public override void OnCast() { - Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, Core.ML ? 10 : 12); + Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12); } } } diff --git a/Projects/UOContent/Spells/Seventh/MeteorSwarm.cs b/Projects/UOContent/Spells/Seventh/MeteorSwarm.cs index 10e3d5530..1d6e56825 100644 --- a/Projects/UOContent/Spells/Seventh/MeteorSwarm.cs +++ b/Projects/UOContent/Spells/Seventh/MeteorSwarm.cs @@ -119,7 +119,7 @@ namespace Server.Spells.Seventh public override void OnCast() { - Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, Core.ML ? 10 : 12); + Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12); } } } diff --git a/Projects/UOContent/Spells/Sixth/Mark.cs b/Projects/UOContent/Spells/Sixth/Mark.cs index 7a4fb4e36..0f8d7d6a1 100644 --- a/Projects/UOContent/Spells/Sixth/Mark.cs +++ b/Projects/UOContent/Spells/Sixth/Mark.cs @@ -61,7 +61,7 @@ namespace Server.Spells.Sixth public override void OnCast() { - Caster.Target = new SpellTargetItem(this, TargetFlags.None, Core.ML ? 10 : 12); + Caster.Target = new SpellTargetItem(this, range: Core.ML ? 10 : 12); } public override bool CheckCast() => base.CheckCast() && SpellHelper.CheckTravel(Caster, TravelCheckType.Mark); diff --git a/Projects/UOContent/Spells/Sixth/MassCurse.cs b/Projects/UOContent/Spells/Sixth/MassCurse.cs index ee2e8ba38..bbd7e183e 100644 --- a/Projects/UOContent/Spells/Sixth/MassCurse.cs +++ b/Projects/UOContent/Spells/Sixth/MassCurse.cs @@ -67,7 +67,7 @@ namespace Server.Spells.Sixth public override void OnCast() { - Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, Core.ML ? 10 : 12); + Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12); } } } diff --git a/Projects/UOContent/Spells/Sixth/ParalyzeField.cs b/Projects/UOContent/Spells/Sixth/ParalyzeField.cs index 0cff8699c..475bc4406 100644 --- a/Projects/UOContent/Spells/Sixth/ParalyzeField.cs +++ b/Projects/UOContent/Spells/Sixth/ParalyzeField.cs @@ -68,7 +68,7 @@ namespace Server.Spells.Sixth public override void OnCast() { - Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, Core.ML ? 10 : 12); + Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12); } [DispellableField] diff --git a/Projects/UOContent/Spells/Sixth/Reveal.cs b/Projects/UOContent/Spells/Sixth/Reveal.cs index c95539c77..653594d25 100644 --- a/Projects/UOContent/Spells/Sixth/Reveal.cs +++ b/Projects/UOContent/Spells/Sixth/Reveal.cs @@ -60,7 +60,7 @@ namespace Server.Spells.Sixth public override void OnCast() { - Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, Core.ML ? 10 : 12); + Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12); } // Reveal uses magery and detect hidden vs. hide and stealth diff --git a/Projects/UOContent/Spells/Targeting/RecallSpellTarget.cs b/Projects/UOContent/Spells/Targeting/RecallSpellTarget.cs index 2a43e6ea4..4e6b61090 100644 --- a/Projects/UOContent/Spells/Targeting/RecallSpellTarget.cs +++ b/Projects/UOContent/Spells/Targeting/RecallSpellTarget.cs @@ -7,14 +7,14 @@ namespace Server.Spells { public class RecallSpellTarget : Target { - private readonly IRecallSpell m_Spell; + private readonly IRecallSpell _spell; private readonly bool m_ToBoat; public RecallSpellTarget(IRecallSpell spell, bool toBoat = true) : base(Core.ML ? 10 : 12, false, TargetFlags.None) { - m_Spell = spell; + _spell = spell; m_ToBoat = toBoat; - m_Spell.Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501029); // Select Marked item. + _spell.Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501029); // Select Marked item. } protected override void OnTarget(Mobile from, object o) @@ -23,7 +23,7 @@ namespace Server.Spells { if (rune.Marked) { - m_Spell.Effect(rune.Target, rune.TargetMap, true); + _spell.Effect(rune.Target, rune.TargetMap, true); } else { @@ -36,7 +36,7 @@ namespace Server.Spells if (e != null) { - m_Spell.Effect(e.Location, e.Map, true); + _spell.Effect(e.Location, e.Map, true); } else { @@ -47,7 +47,7 @@ namespace Server.Spells { if (!boat.Deleted && boat.CheckKey(key.KeyValue)) { - m_Spell.Effect(boat.GetMarkedLocation(), boat.Map, false); + _spell.Effect(boat.GetMarkedLocation(), boat.Map, false); } else { @@ -64,7 +64,7 @@ namespace Server.Spells } else if (o is HouseRaffleDeed deed && deed.ValidLocation()) { - m_Spell.Effect(deed.PlotLocation, deed.PlotFacet, true); + _spell.Effect(deed.PlotLocation, deed.PlotFacet, true); } else { @@ -86,7 +86,7 @@ namespace Server.Spells protected override void OnTargetFinish(Mobile from) { - m_Spell?.FinishSequence(); + _spell?.FinishSequence(); } } } diff --git a/Projects/UOContent/Spells/Targeting/SpellTargetItem.cs b/Projects/UOContent/Spells/Targeting/SpellTargetItem.cs index 0130beda4..0bab04b1d 100644 --- a/Projects/UOContent/Spells/Targeting/SpellTargetItem.cs +++ b/Projects/UOContent/Spells/Targeting/SpellTargetItem.cs @@ -9,24 +9,24 @@ namespace Server.Spells public class SpellTargetItem : Target, ISpellTarget { - private readonly ISpellTargetingItem m_Spell; + private readonly ISpellTargetingItem _spell; - public SpellTargetItem(ISpellTargetingItem spell, TargetFlags flags, int range = 12) : base(range, false, flags) => - m_Spell = spell; + public SpellTargetItem(ISpellTargetingItem spell, TargetFlags flags = TargetFlags.None, int range = 12) + : base(range, false, flags) => _spell = spell; - public ISpell Spell => m_Spell; + public ISpell Spell => _spell; protected override void OnTarget(Mobile from, object o) { if (o is Item item) { - m_Spell.Target(item); + _spell.Target(item); } } protected override void OnTargetFinish(Mobile from) { - m_Spell?.FinishSequence(); + _spell?.FinishSequence(); } } } diff --git a/Projects/UOContent/Spells/Targeting/SpellTargetMobile.cs b/Projects/UOContent/Spells/Targeting/SpellTargetMobile.cs index e5758e734..b8e245cf7 100644 --- a/Projects/UOContent/Spells/Targeting/SpellTargetMobile.cs +++ b/Projects/UOContent/Spells/Targeting/SpellTargetMobile.cs @@ -9,21 +9,21 @@ namespace Server.Spells public class SpellTargetMobile : Target, ISpellTarget { - private readonly ISpellTargetingMobile m_Spell; + private readonly ISpellTargetingMobile _spell; public SpellTargetMobile(ISpellTargetingMobile spell, TargetFlags flags, int range = 12) : - base(range, false, flags) => m_Spell = spell; + base(range, false, flags) => _spell = spell; - public ISpell Spell => m_Spell; + public ISpell Spell => _spell; protected override void OnTarget(Mobile from, object o) { - m_Spell.Target(o as Mobile); + _spell.Target(o as Mobile); } protected override void OnTargetFinish(Mobile from) { - m_Spell?.FinishSequence(); + _spell?.FinishSequence(); } } } diff --git a/Projects/UOContent/Spells/Targeting/SpellTargetPoint3D.cs b/Projects/UOContent/Spells/Targeting/SpellTargetPoint3D.cs index 8c9a03283..40da7d383 100644 --- a/Projects/UOContent/Spells/Targeting/SpellTargetPoint3D.cs +++ b/Projects/UOContent/Spells/Targeting/SpellTargetPoint3D.cs @@ -9,43 +9,43 @@ namespace Server.Spells public class SpellTargetPoint3D : Target, ISpellTarget { - private readonly bool m_CheckLOS; - private ISpellTargetingPoint3D m_Spell; + private readonly bool _retryOnLos; + private ISpellTargetingPoint3D _spell; public SpellTargetPoint3D( - ISpellTargetingPoint3D spell, TargetFlags flags = TargetFlags.None, int range = 12, bool checkLOS = true + ISpellTargetingPoint3D spell, TargetFlags flags = TargetFlags.None, int range = 12, bool retryOnLOS = false ) : base(range, true, flags) { - m_Spell = spell; - m_CheckLOS = checkLOS; + _spell = spell; + _retryOnLos = retryOnLOS; } - public ISpell Spell => m_Spell; + public ISpell Spell => _spell; protected override void OnTarget(Mobile from, object o) { if (o is IPoint3D p) { - m_Spell.Target(p); + _spell.Target(p); } } protected override void OnTargetOutOfLOS(Mobile from, object o) { - if (!m_CheckLOS) + if (!_retryOnLos) { return; } from.SendLocalizedMessage(501943); // Target cannot be seen. Try again. - from.Target = new SpellTargetPoint3D(m_Spell); + from.Target = new SpellTargetPoint3D(_spell); from.Target.BeginTimeout(from, TimeoutTime - Core.TickCount); - m_Spell = null; // Needed? + _spell = null; // Needed? } protected override void OnTargetFinish(Mobile from) { - m_Spell?.FinishSequence(); + _spell?.FinishSequence(); } } } diff --git a/Projects/UOContent/Spells/Third/MagicLock.cs b/Projects/UOContent/Spells/Third/MagicLock.cs index 040976001..55da042cc 100644 --- a/Projects/UOContent/Spells/Third/MagicLock.cs +++ b/Projects/UOContent/Spells/Third/MagicLock.cs @@ -69,7 +69,7 @@ namespace Server.Spells.Third public override void OnCast() { - Caster.Target = new SpellTargetItem(this, TargetFlags.None, Core.ML ? 10 : 12); + Caster.Target = new SpellTargetItem(this, range: Core.ML ? 10 : 12); } } } diff --git a/Projects/UOContent/Spells/Third/Telekinesis.cs b/Projects/UOContent/Spells/Third/Telekinesis.cs index 37d92c4d9..f41be5a7f 100644 --- a/Projects/UOContent/Spells/Third/Telekinesis.cs +++ b/Projects/UOContent/Spells/Third/Telekinesis.cs @@ -75,7 +75,7 @@ namespace Server.Spells.Third public override void OnCast() { - Caster.Target = new SpellTargetItem(this, TargetFlags.None, Core.ML ? 10 : 12); + Caster.Target = new SpellTargetItem(this, range: Core.ML ? 10 : 12); } } } diff --git a/Projects/UOContent/Spells/Third/Teleport.cs b/Projects/UOContent/Spells/Third/Teleport.cs index 2e1981525..c2797f9f4 100644 --- a/Projects/UOContent/Spells/Third/Teleport.cs +++ b/Projects/UOContent/Spells/Third/Teleport.cs @@ -131,7 +131,7 @@ namespace Server.Spells.Third public override void OnCast() { - Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, Core.ML ? 10 : 12); + Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12); } } } diff --git a/Projects/UOContent/Spells/Third/Unlock.cs b/Projects/UOContent/Spells/Third/Unlock.cs index d303b3151..6476bd0c7 100644 --- a/Projects/UOContent/Spells/Third/Unlock.cs +++ b/Projects/UOContent/Spells/Third/Unlock.cs @@ -96,7 +96,7 @@ namespace Server.Spells.Third public override void OnCast() { - Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, Core.ML ? 10 : 12); + Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12); } } } diff --git a/Projects/UOContent/Spells/Third/WallOfStone.cs b/Projects/UOContent/Spells/Third/WallOfStone.cs index 271455d05..fd4bd0b2d 100644 --- a/Projects/UOContent/Spells/Third/WallOfStone.cs +++ b/Projects/UOContent/Spells/Third/WallOfStone.cs @@ -60,7 +60,7 @@ namespace Server.Spells.Third public override void OnCast() { - Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, Core.ML ? 10 : 12); + Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12); } [DispellableField] From 8c66be9090ce26026dd9d63798897ea9cd8b19ba Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Sat, 20 Nov 2021 11:34:46 -0800 Subject: [PATCH 10/16] fix: Cleans up protection (#854) --- .../UOContent/Spells/Second/Protection.cs | 25 ++++++------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/Projects/UOContent/Spells/Second/Protection.cs b/Projects/UOContent/Spells/Second/Protection.cs index 38f1342c7..cecab823d 100644 --- a/Projects/UOContent/Spells/Second/Protection.cs +++ b/Projects/UOContent/Spells/Second/Protection.cs @@ -77,27 +77,18 @@ namespace Server.Spells.Second target.PlaySound(0x1E9); target.FixedParticles(0x375A, 9, 20, 5016, EffectLayer.Waist); - mods = new Tuple( - new ResistanceMod( - ResistanceType.Physical, - -15 + Math.Min((int)(caster.Skills.Inscribe.Value / 20), 15) - ), - new DefaultSkillMod( - SkillName.MagicResist, - true, - -35 + Math.Min((int)(caster.Skills.Inscribe.Value / 20), 35) - ) - ); + var physLoss = Math.Max(0, -15 + (int)(caster.Skills.Inscribe.Value / 20)); + var resistLoss = Math.Max(0, -35 + (int)(caster.Skills.Inscribe.Value / 20)); + var physMod = new ResistanceMod(ResistanceType.Physical, physLoss); + var resistMod = new DefaultSkillMod(SkillName.MagicResist, true, resistLoss); - _table[target] = mods; + _table[target] = Tuple.Create(physMod, resistMod); Registry[target] = 1000; // 100.0% protection from disruption - target.AddResistanceMod(mods.Item1); - target.AddSkillMod(mods.Item2); + target.AddResistanceMod(physmod); + target.AddSkillMod(resistmod); - var physloss = -15 + (int)(caster.Skills.Inscribe.Value / 20); - var resistloss = -35 + (int)(caster.Skills.Inscribe.Value / 20); - var args = $"{physloss}\t{resistloss}"; + var args = $"{physLoss}\t{resistLoss}"; BuffInfo.AddBuff(target, new BuffInfo(BuffIcon.Protection, 1075814, 1075815, args)); } } From 8806d6d7a7a41c90e2eb82d4cadbe2e161f11425 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Sat, 20 Nov 2021 11:37:13 -0800 Subject: [PATCH 11/16] fix: Fixes compiling (#855) --- Projects/UOContent/Spells/Second/Protection.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Projects/UOContent/Spells/Second/Protection.cs b/Projects/UOContent/Spells/Second/Protection.cs index cecab823d..7944e3015 100644 --- a/Projects/UOContent/Spells/Second/Protection.cs +++ b/Projects/UOContent/Spells/Second/Protection.cs @@ -85,8 +85,8 @@ namespace Server.Spells.Second _table[target] = Tuple.Create(physMod, resistMod); Registry[target] = 1000; // 100.0% protection from disruption - target.AddResistanceMod(physmod); - target.AddSkillMod(resistmod); + target.AddResistanceMod(physMod); + target.AddSkillMod(resistMod); var args = $"{physLoss}\t{resistLoss}"; BuffInfo.AddBuff(target, new BuffInfo(BuffIcon.Protection, 1075814, 1075815, args)); From 09613e253631a3ca15af3e22b0437bbcfe876ef5 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Sat, 20 Nov 2021 14:26:52 -0800 Subject: [PATCH 12/16] fix: Fixes crash in mass dispel (#856) --- Projects/UOContent/Spells/Seventh/MassDispel.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Projects/UOContent/Spells/Seventh/MassDispel.cs b/Projects/UOContent/Spells/Seventh/MassDispel.cs index 8a1b3b164..9e40a0930 100644 --- a/Projects/UOContent/Spells/Seventh/MassDispel.cs +++ b/Projects/UOContent/Spells/Seventh/MassDispel.cs @@ -1,3 +1,4 @@ +using Server.Collections; using Server.Items; using Server.Mobiles; using Server.Targeting; @@ -37,6 +38,8 @@ namespace Server.Spells.Seventh { var eable = map.GetMobilesInRange(new Point3D(p), 8); + using var queue = PooledRefQueue.Create(); + foreach (var bc in eable) { if (!(bc.IsDispellable && Caster.CanBeHarmful(bc, false))) @@ -58,17 +61,21 @@ namespace Server.Spells.Seventh ); Effects.PlaySound(bc, 0x201); - bc.Delete(); + queue.Enqueue(bc); } else { Caster.DoHarmful(bc); - bc.FixedEffect(0x3779, 10, 20); } } eable.Free(); + + while (queue.Count > 0) + { + queue.Dequeue().Delete(); + } } } From 43db0d09c90e78a5d527ccbc0f710d77ea355b32 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Sun, 21 Nov 2021 09:19:09 -0800 Subject: [PATCH 13/16] fix: Weapons cleanup (#857) * Removes linq * Removes list allocation for area effect * Removes redundant swing overload * Cleans up code --- Projects/Server/Interfaces.cs | 3 +- .../UOContent/Items/Weapons/BaseWeapon.cs | 381 ++++++++---------- Projects/UOContent/Items/Weapons/Fists.cs | 2 +- .../Items/Weapons/Ranged/BaseRanged.cs | 2 +- 4 files changed, 173 insertions(+), 215 deletions(-) diff --git a/Projects/Server/Interfaces.cs b/Projects/Server/Interfaces.cs index 587abead0..3e46e8bb2 100644 --- a/Projects/Server/Interfaces.cs +++ b/Projects/Server/Interfaces.cs @@ -22,8 +22,7 @@ namespace Server { int MaxRange { get; } void OnBeforeSwing(Mobile attacker, Mobile defender); - TimeSpan OnSwing(Mobile attacker, Mobile defender); - TimeSpan OnSwing(Mobile attacker, Mobile defender, double damageBonus); + TimeSpan OnSwing(Mobile attacker, Mobile defender, double damageBonus = 1.0); void GetStatusDamage(Mobile from, out int min, out int max); } diff --git a/Projects/UOContent/Items/Weapons/BaseWeapon.cs b/Projects/UOContent/Items/Weapons/BaseWeapon.cs index b50b97f32..8e183a7b9 100644 --- a/Projects/UOContent/Items/Weapons/BaseWeapon.cs +++ b/Projects/UOContent/Items/Weapons/BaseWeapon.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Linq; +using Server.Collections; using Server.Engines.Craft; using Server.Ethics; using Server.Factions; @@ -695,8 +695,6 @@ namespace Server.Items } } - public virtual TimeSpan OnSwing(Mobile attacker, Mobile defender) => OnSwing(attacker, defender, 1.0); - public virtual void GetStatusDamage(Mobile from, out int min, out int max) { GetBaseDamageRange(from, out var baseMin, out var baseMax); @@ -713,7 +711,7 @@ namespace Server.Items } } - public virtual TimeSpan OnSwing(Mobile attacker, Mobile defender, double damageBonus) + public virtual TimeSpan OnSwing(Mobile attacker, Mobile defender, double damageBonus = 1.0) { var canSwing = true; @@ -723,12 +721,12 @@ namespace Server.Items if (canSwing) { - canSwing = !(attacker.Spell is Spell sp) || !sp.IsCasting || !sp.BlocksMovement; + canSwing = attacker.Spell is not Spell sp || !sp.IsCasting || !sp.BlocksMovement; } if (canSwing) { - canSwing = !(attacker is PlayerMobile p) || p.PeacedUntil <= Core.Now; + canSwing = attacker is not PlayerMobile p || p.PeacedUntil <= Core.Now; } } @@ -786,7 +784,7 @@ namespace Server.Items public override void OnAfterDuped(Item newItem) { - if (!(newItem is BaseWeapon weap)) + if (newItem is not BaseWeapon weap) { return; } @@ -877,8 +875,8 @@ namespace Server.Items return true; } - if (Layer == Layer.OneHanded && layer == Layer.TwoHanded && !(item is BaseShield) && - !(item is BaseEquipableLight)) + if (Layer == Layer.OneHanded && layer == Layer.TwoHanded && item is not BaseShield && + item is not BaseEquipableLight) { m.SendLocalizedMessage(500215); // You can only wield one weapon at a time. return true; @@ -1096,7 +1094,6 @@ namespace Server.Items var defWeapon = defender.Weapon as BaseWeapon; var atkSkill = attacker.Skills[atkWeapon?.Skill ?? SkillName.Wrestling]; - // Skill defSkill = defender.Skills[defWeapon.Skill]; var atkValue = atkWeapon?.GetAttackSkillValue(attacker, defender) ?? 0.0; var defValue = defWeapon?.GetDefendSkillValue(attacker, defender) ?? 0.0; @@ -1209,23 +1206,11 @@ namespace Server.Items } else { - if (atkValue <= -50.0) - { - atkValue = -49.9; - } - - if (defValue <= -50.0) - { - defValue = -49.9; - } - - ourValue = atkValue + 50.0; - theirValue = defValue + 50.0; + ourValue = Math.Max(0.1, atkValue + 50.0); + theirValue = Math.Max(0.1, defValue + 50.0); } - var chance = ourValue / (theirValue * 2.0); - - chance *= 1.0 + (double)bonus / 100; + var chance = ourValue / (theirValue * 2.0) * 1.0 + (double)bonus / 100; if (Core.AOS && chance < 0.02) { @@ -1418,7 +1403,7 @@ namespace Server.Items return defender.CheckSkill(SkillName.Parry, chance); } - if (defender.Weapon is Fists || defender.Weapon is BaseRanged) + if (defender.Weapon is Server.Items.Fists or BaseRanged) { return false; } @@ -1459,9 +1444,8 @@ namespace Server.Items return defender.CheckSkill(SkillName.Parry, chance); } - return - aosChance > Utility - .RandomDouble(); // Only skillcheck if wielding a shield & there's no effect from Bushido + // Only skillcheck if wielding a shield & there's no effect from Bushido + return aosChance > Utility.RandomDouble(); } public virtual int AbsorbDamageAOS(Mobile attacker, Mobile defender, int damage) @@ -1493,9 +1477,8 @@ namespace Server.Items if (Confidence.IsConfident(defender)) { - defender.SendLocalizedMessage( - 1063117 - ); // Your confidence reassures you as you successfully block your opponent's blow. + // Your confidence reassures you as you successfully block your opponent's blow. + defender.SendLocalizedMessage(1063117); var bushido = defender.Skills.Bushido.Value; @@ -1590,7 +1573,7 @@ namespace Server.Items return 0; } - if (!(attacker is BaseCreature bc) || bc.PackInstinct == PackInstinct.None || !bc.Controlled && !bc.Summoned) + if (attacker is not BaseCreature bc || bc.PackInstinct == PackInstinct.None || !bc.Controlled && !bc.Summoned) { return 0; } @@ -1603,16 +1586,26 @@ namespace Server.Items } var eable = defender.GetMobilesInRange(1); - var inPack = 1 + eable - .Where(m => m != attacker && (m.PackInstinct & bc.PackInstinct) != 0 && (m.Controlled || m.Summoned)) - .Count(m => master == (m.ControlMaster ?? m.SummonMaster) && m.Combatant == defender); + var inPack = 1; + foreach (var m in eable) + { + if (m != attacker && (m.PackInstinct & bc.PackInstinct) != 0 && (m.Controlled || m.Summoned) && + master == (m.ControlMaster ?? m.SummonMaster) && m.Combatant == defender) + { + inPack++; + } + } eable.Free(); - return inPack >= 5 ? 100 : - inPack >= 4 ? 75 : - inPack >= 3 ? 50 : - inPack >= 2 ? 25 : 0; + return inPack switch + { + >= 5 => 100, + 4 => 75, + 3 => 50, + 2 => 25, + _ => 0 + }; } public virtual void OnHit(Mobile attacker, Mobile defender, double damageBonus = 1.0) @@ -1688,12 +1681,9 @@ namespace Server.Items if (!attacker.Player) { - if (defender is PlayerMobile pm) + if (defender is PlayerMobile pm && pm.EnemyOfOneType != null && pm.EnemyOfOneType != attacker.GetType()) { - if (pm.EnemyOfOneType != null && pm.EnemyOfOneType != attacker.GetType()) - { - percentageBonus += 100; - } + percentageBonus += 100; } } else if (!defender.Player) @@ -1769,16 +1759,14 @@ namespace Server.Items { damage = 1; } - else if (Core.AOS && damage == 0) // parried + // Parried + else if (Core.AOS && damage == 0 && a?.Validate(attacker) == true) { - if (a?.Validate(attacker) == true) /*&& a.CheckMana( attacker, true )*/ - // Parried special moves have no mana cost - { - a = null; - WeaponAbility.ClearCurrentAbility(attacker); - - attacker.SendLocalizedMessage(1061140); // Your attack was parried! - } + /*&& a.CheckMana( attacker, true )*/ + // Parried special moves have no mana cost + a = null; + WeaponAbility.ClearCurrentAbility(attacker); + attacker.SendLocalizedMessage(1061140); // Your attack was parried! } AddBlood(attacker, defender, damage); @@ -1936,9 +1924,8 @@ namespace Server.Items if (context?.Type == typeof(WraithFormSpell)) { - wraithLeech = - 5 + (int)(15 * attacker.Skills.SpiritSpeak.Value / - 100); // Wraith form gives an additional 5-20% mana leech + // Wraith form gives an additional 5-20% mana leech + wraithLeech = 5 + (int)(15 * attacker.Skills.SpiritSpeak.Value / 100); // Mana leeched by the Wraith Form spell is actually stolen, not just leeched. defender.Mana -= AOS.Scale(damageGiven, wraithLeech); @@ -1967,10 +1954,10 @@ namespace Server.Items } } - if (m_MaxHits > 0 && (MaxRange <= 1 && (defender is Slime || defender is AcidElemental) || - Utility.RandomDouble() < .04)) // Stratics says 50% chance, seems more like 4%.. + // Stratics says 50% chance, seems more like 4%.. + if (m_MaxHits > 0 && MaxRange <= 1 && defender is Slime or AcidElemental |Utility.RandomDouble() < .04) { - if (MaxRange <= 1 && (defender is Slime || defender is AcidElemental)) + if (MaxRange <= 1 && defender is Slime or AcidElemental) { attacker.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500263); // *Acid blood scars your weapon!* } @@ -1979,29 +1966,23 @@ namespace Server.Items { HitPoints += 2; } + else if (m_Hits > 0) + { + --HitPoints; + } + else if (m_MaxHits > 1) + { + --MaxHitPoints; + + if (Parent is Mobile mobile) + { + // Your equipment is severely damaged. + mobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061121); + } + } else { - if (m_Hits > 0) - { - --HitPoints; - } - else if (m_MaxHits > 1) - { - --MaxHitPoints; - - if (Parent is Mobile mobile) - { - mobile.LocalOverheadMessage( - MessageType.Regular, - 0x3B2, - 1061121 // Your equipment is severely damaged. - ); - } - } - else - { - Delete(); - } + Delete(); } } @@ -2021,16 +2002,20 @@ namespace Server.Items if (Core.AOS) { - var physChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitPhysicalArea) * - propertyBonus); + var physChance = + (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitPhysicalArea) * propertyBonus); + var fireChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitFireArea) * propertyBonus); + var coldChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitColdArea) * propertyBonus); - var poisChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitPoisonArea) * - propertyBonus); - var nrgyChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitEnergyArea) * - propertyBonus); + + var poisChance = + (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitPoisonArea) * propertyBonus); + + var nrgyChance = + (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitEnergyArea) * propertyBonus); if (physChance != 0 && physChance > Utility.Random(100)) { @@ -2092,10 +2077,10 @@ namespace Server.Items DoDispel(attacker, defender); } - var laChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitLowerAttack) * - propertyBonus); - var ldChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitLowerDefend) * - propertyBonus); + var laChance = + (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitLowerAttack) * propertyBonus); + var ldChance = + (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitLowerDefend) * propertyBonus); if (laChance != 0 && laChance > Utility.Random(100)) { @@ -2121,7 +2106,7 @@ namespace Server.Items it.ReceivedHonorContext?.OnTargetHit(attacker); } - if (!(this is BaseRanged)) + if (this is not BaseRanged) { if (AnimalForm.UnderTransformation(attacker, typeof(GiantSerpent))) { @@ -2157,7 +2142,7 @@ namespace Server.Items // SDI bonus damageBonus += AosAttributes.GetValue(attacker, AosAttribute.SpellDamage); - if(PsychicAttack.Registry.TryGetValue(attacker,out var timer)) + if (PsychicAttack.Registry.TryGetValue(attacker,out var timer)) { damageBonus -= timer.SpellDamageMalus; } @@ -2319,13 +2304,8 @@ namespace Server.Items attacker.PlaySound(GetMissAttackSound(attacker, defender)); defender.PlaySound(GetMissDefendSound(attacker, defender)); - var ability = WeaponAbility.GetCurrentAbility(attacker); - - ability?.OnMiss(attacker, defender); - - var move = SpecialMove.GetCurrentMove(attacker); - - move?.OnMiss(attacker, defender); + WeaponAbility.GetCurrentAbility(attacker)?.OnMiss(attacker, defender); + SpecialMove.GetCurrentMove(attacker)?.OnMiss(attacker, defender); if (defender is IHonorTarget target) { @@ -2417,56 +2397,38 @@ namespace Server.Items { var bonus = VirtualDamageBonus; - switch (m_Quality) + bonus += m_Quality switch { - case WeaponQuality.Low: - bonus -= 20; - break; - case WeaponQuality.Exceptional: - bonus += 20; - break; - } + WeaponQuality.Low => -20, + WeaponQuality.Exceptional => 20, + _ => 0 + }; - switch (m_DamageLevel) + return bonus + m_DamageLevel switch { - case WeaponDamageLevel.Ruin: - bonus += 15; - break; - case WeaponDamageLevel.Might: - bonus += 20; - break; - case WeaponDamageLevel.Force: - bonus += 25; - break; - case WeaponDamageLevel.Power: - bonus += 30; - break; - case WeaponDamageLevel.Vanq: - bonus += 35; - break; - } - - return bonus; + WeaponDamageLevel.Ruin => 15, + WeaponDamageLevel.Might => 20, + WeaponDamageLevel.Force => 25, + WeaponDamageLevel.Power => 30, + WeaponDamageLevel.Vanq => 35, + _ => bonus + }; } public virtual double ScaleDamageAOS(Mobile attacker, double damage, bool checkSkills) { if (checkSkills) { - attacker.CheckSkill( - SkillName.Tactics, - 0.0, - attacker.Skills.Tactics.Cap - ); // Passively check tactics for gain - attacker.CheckSkill( - SkillName.Anatomy, - 0.0, - attacker.Skills.Anatomy.Cap - ); // Passively check Anatomy for gain + // Passively check tactics for gain + attacker.CheckSkill(SkillName.Tactics, 0.0, attacker.Skills.Tactics.Cap); + + // Passively check Anatomy for gain + attacker.CheckSkill(SkillName.Anatomy, 0.0, attacker.Skills.Anatomy.Cap); if (Type == WeaponType.Axe) { - attacker.CheckSkill(SkillName.Lumberjacking, 0.0, 100.0); // Passively check Lumberjacking for gain + // Passively check Lumberjacking for gain + attacker.CheckSkill(SkillName.Lumberjacking, 0.0, 100.0); } } @@ -2536,20 +2498,16 @@ namespace Server.Items { if (checkSkills) { - attacker.CheckSkill( - SkillName.Tactics, - 0.0, - attacker.Skills.Tactics.Cap - ); // Passively check tactics for gain - attacker.CheckSkill( - SkillName.Anatomy, - 0.0, - attacker.Skills.Anatomy.Cap - ); // Passively check Anatomy for gain + // Passively check tactics for gain + attacker.CheckSkill(SkillName.Tactics, 0.0, attacker.Skills.Tactics.Cap); + + // Passively check Anatomy for gain + attacker.CheckSkill(SkillName.Anatomy, 0.0, attacker.Skills.Anatomy.Cap); if (Type == WeaponType.Axe) { - attacker.CheckSkill(SkillName.Lumberjacking, 0.0, 100.0); // Passively check Lumberjacking for gain + // Passively check Lumberjacking for gain + attacker.CheckSkill(SkillName.Lumberjacking, 0.0, 100.0); } } @@ -2633,9 +2591,9 @@ namespace Server.Items var damage = (int)ScaleDamageOld(attacker, GetBaseDamage(attacker), true); // pre-AOS, halve damage if the defender is a player or the attacker is not a player - if (defender is PlayerMobile || !(attacker is PlayerMobile)) + if (defender is PlayerMobile || attacker is not PlayerMobile) { - damage = (int)(damage / 2.0); + damage /= 2; } return damage; @@ -2643,6 +2601,11 @@ namespace Server.Items public virtual void PlayHurtAnimation(Mobile from) { + if (from.Mounted) + { + return; + } + int action; int frames; @@ -2667,12 +2630,10 @@ namespace Server.Items frames = 5; break; } - default: return; - } - - if (from.Mounted) - { - return; + default: + { + return; + } } from.Animate(action, frames, 1, true, false, 0); @@ -2695,10 +2656,18 @@ namespace Server.Items switch (Animation) { default: - action = Utility.Random(4, 3); - break; - case WeaponAnimation.ShootBow: return; // 7 - case WeaponAnimation.ShootXBow: return; // 8 + { + action = Utility.Random(4, 3); + break; + } + case WeaponAnimation.ShootBow: + { + return; // 7 + } + case WeaponAnimation.ShootXBow: + { + return; // 8 + } } break; @@ -2728,7 +2697,10 @@ namespace Server.Items break; } - default: return; + default: + { + return; + } } from.Animate(action, 7, 1, true, false, 0); @@ -2739,11 +2711,11 @@ namespace Server.Items public int GetElementalDamageHue() { GetDamageTypes(null, out _, out var fire, out var cold, out var pois, out var nrgy, out _, out _); - // Order is Cold, Energy, Fire, Poison, Physical left var currentMax = 50; var hue = 0; + // Order is Cold, Energy, Fire, Poison, Physical if (pois >= currentMax) { hue = 1267 + (pois - 50) / 10; @@ -2812,7 +2784,7 @@ namespace Server.Items * formatting show, and remove CLILOCs embedded: more like OSI * did with the books that had markup, etc. * - * This will have a negative effect on a few event things imgame + * This will have a negative effect on a few event things in-game * as is. * * If we cant find a more OSI-ish way to clean it up, we can @@ -2828,29 +2800,10 @@ namespace Server.Items /* list.Add( 1062613, Utility.FixHtml( m_EngravedText ) ); */ } - public override bool AllowEquippedCast(Mobile from) - { - if (base.AllowEquippedCast(from)) - { - return true; - } + public override bool AllowEquippedCast(Mobile from) => + base.AllowEquippedCast(from) || Attributes.SpellChanneling != 0; - return Attributes.SpellChanneling != 0; - } - - public virtual int GetLuckBonus() - { - var resInfo = CraftResources.GetInfo(m_Resource); - - var attrInfo = resInfo?.AttributeInfo; - - if (attrInfo == null) - { - return 0; - } - - return attrInfo.WeaponLuck; - } + public virtual int GetLuckBonus() => CraftResources.GetInfo(m_Resource)?.AttributeInfo?.WeaponLuck ?? 0; public override void GetProperties(ObjectPropertyList list) { @@ -3235,17 +3188,25 @@ namespace Server.Items switch (Skill) { case SkillName.Swords: - list.Add(1061172); - break; // skill required: swordsmanship + { + list.Add(1061172); // skill required: swordsmanship + break; + } case SkillName.Macing: - list.Add(1061173); - break; // skill required: mace fighting + { + list.Add(1061173); // skill required: mace fighting + break; + } case SkillName.Fencing: - list.Add(1061174); - break; // skill required: fencing + { + list.Add(1061174); // skill required: fencing + break; + } case SkillName.Archery: - list.Add(1061175); - break; // skill required: archery + { + list.Add(1061175); // skill required: archery + break; + } } } @@ -3351,13 +3312,7 @@ namespace Server.Items public virtual int GetHitAttackSound(Mobile attacker, Mobile defender) { var sound = attacker.GetAttackSound(); - - if (sound == -1) - { - sound = HitSound; - } - - return sound; + return sound == -1 ? HitSound : sound; } public virtual int GetHitDefendSound(Mobile attacker, Mobile defender) => defender.GetHurtSound(); @@ -3518,33 +3473,37 @@ namespace Server.Items var range = Core.ML ? 5 : 10; var eable = from.GetMobilesInRange(range); - var list = eable.Where( - m => - from != m && defender != m && SpellHelper.ValidIndirectTarget(from, m) - && from.CanBeHarmful(m, false) && (!Core.ML || from.InLOS(m)) - ) - .ToList(); + using var queue = PooledRefQueue.Create(); + foreach (var m in eable) + { + if (from != m && defender != m && SpellHelper.ValidIndirectTarget(from, m) + && from.CanBeHarmful(m, false) && (!Core.ML || from.InLOS(m))) + { + queue.Enqueue(m); + } + } eable.Free(); - if (list.Count == 0) + if (queue.Count == 0) { return; } Effects.PlaySound(from.Location, map, sound); - for (var i = 0; i < list.Count; ++i) + while (queue.Count > 0) { - var m = list[i]; + var m = queue.Dequeue(); var scalar = Core.ML ? 1.0 : (11 - from.GetDistanceToSqrt(m)) / 10; - var damage = GetBaseDamage(from); if (scalar <= 0) { continue; } + var damage = GetBaseDamage(from); + if (scalar < 1.0) { damage *= (11 - from.GetDistanceToSqrt(m)) / 10; diff --git a/Projects/UOContent/Items/Weapons/Fists.cs b/Projects/UOContent/Items/Weapons/Fists.cs index 8be6fe5ac..b2fe3fc93 100644 --- a/Projects/UOContent/Items/Weapons/Fists.cs +++ b/Projects/UOContent/Items/Weapons/Fists.cs @@ -157,7 +157,7 @@ namespace Server.Items } } - public override TimeSpan OnSwing(Mobile attacker, Mobile defender) + public override TimeSpan OnSwing(Mobile attacker, Mobile defender, double damageBonus = 1.0) { if (!Core.AOS) { diff --git a/Projects/UOContent/Items/Weapons/Ranged/BaseRanged.cs b/Projects/UOContent/Items/Weapons/Ranged/BaseRanged.cs index 2c66dd3f2..a3a393a33 100644 --- a/Projects/UOContent/Items/Weapons/Ranged/BaseRanged.cs +++ b/Projects/UOContent/Items/Weapons/Ranged/BaseRanged.cs @@ -37,7 +37,7 @@ namespace Server.Items public override SkillName AccuracySkill => SkillName.Archery; - public override TimeSpan OnSwing(Mobile attacker, Mobile defender) + public override TimeSpan OnSwing(Mobile attacker, Mobile defender, double damageBonus = 1.0) { // WeaponAbility a = WeaponAbility.GetCurrentAbility( attacker ); From 1bec4feb0d54b9486a6bf31239248eb5537f4979 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Sun, 21 Nov 2021 09:43:09 -0800 Subject: [PATCH 14/16] fix: BaseCreature cleanup (#858) * Removes LINQ * Removes some list allocations --- Projects/UOContent/Mobiles/BaseCreature.cs | 454 +++++++++------------ 1 file changed, 198 insertions(+), 256 deletions(-) diff --git a/Projects/UOContent/Mobiles/BaseCreature.cs b/Projects/UOContent/Mobiles/BaseCreature.cs index f846378ac..1debdd3cd 100644 --- a/Projects/UOContent/Mobiles/BaseCreature.cs +++ b/Projects/UOContent/Mobiles/BaseCreature.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Linq; +using Server.Collections; using Server.ContextMenus; using Server.Engines.ConPVP; using Server.Engines.MLQuests; @@ -512,11 +512,11 @@ namespace Server.Mobiles public virtual bool DeathAdderCharmable => false; // TODO: Find the pub 31 tweaks to the DispelDifficulty and apply them of course. - public virtual double DispelDifficulty // at this skill level we dispel 50% chance - => 0.0; + // at this skill level we dispel 50% chance + public virtual double DispelDifficulty => 0.0; - public virtual double DispelFocus // at difficulty - focus we have 0%, at difficulty + focus we have 100% - => 20.0; + // at difficulty - focus we have 0%, at difficulty + focus we have 100% + public virtual double DispelFocus => 20.0; public virtual bool DisplayWeight => Backpack is StrongBackpack; @@ -1169,9 +1169,8 @@ namespace Server.Mobiles if (m_MLQuests == null) { - return - MLQuestSystem - .EmptyList; // return EmptyList, but don't cache it (run construction again next time) + // return EmptyList, but don't cache it (run construction again next time) + return MLQuestSystem.EmptyList; } } @@ -1211,7 +1210,7 @@ namespace Server.Mobiles return false; } - if (!(m is BaseCreature c) || m is MilitiaFighter) + if (m is not BaseCreature c || m is MilitiaFighter) { return true; } @@ -2153,11 +2152,8 @@ namespace Server.Mobiles // even if they can't offer you anything at the moment if (MLQuestSystem.Enabled && CanGiveMLQuest && from is PlayerMobile mobile) { - MLQuestSystem.Tell( - this, - mobile, - 1074893 - ); // You need to mark your quest items so I don't take the wrong object. Then speak to me. + // You need to mark your quest items so I don't take the wrong object. Then speak to me. + MLQuestSystem.Tell(this, mobile, 1074893); return false; } @@ -2536,8 +2532,8 @@ namespace Server.Mobiles public override bool IsHarmfulCriminal(Mobile target) => (!Controlled || target != m_ControlMaster) && (!Summoned || target != m_SummonMaster) && - (!(target is BaseCreature creature) || !creature.InitialInnocent || creature.Controlled) && - (!(target is PlayerMobile mobile) || mobile.PermaFlags.Count <= 0) && base.IsHarmfulCriminal(target); + (target is not BaseCreature { InitialInnocent: true } creature || creature.Controlled) && + (target is not PlayerMobile mobile || mobile.PermaFlags.Count <= 0) && base.IsHarmfulCriminal(target); public override void CriminalAction(bool message) { @@ -2837,18 +2833,6 @@ namespace Server.Mobiles return null; } - public static void Cap(ref int val, int min, int max) - { - if (val < min) - { - val = min; - } - else if (val > max) - { - val = max; - } - } - public override void OnDoubleClick(Mobile from) { if (from.AccessLevel >= AccessLevel.GameMaster && !Body.IsHuman) @@ -2903,7 +2887,8 @@ namespace Server.Mobiles } else if (Controlled && Commandable) { - if (IsBonded) // Intentional difference (showing ONLY bonded when bonded instead of bonded & tame) + // Intentional difference (showing ONLY bonded when bonded instead of bonded & tame) + if (IsBonded) { list.Add(1049608); // (bonded) } @@ -3028,7 +3013,7 @@ namespace Server.Mobiles { var de = list[i]; - if (de.Damager == m || !(de.Damager is BaseCreature bc)) + if (de.Damager == m || de.Damager is not BaseCreature bc) { continue; } @@ -3144,10 +3129,8 @@ namespace Server.Mobiles if (rights.Count > 0) { - rights[0].m_Damage = - (int)(rights[0].m_Damage * - 1.25 - ); // This would be the first valid person attacking it. Gets a 25% bonus. Per 1/19/07 Five on Friday + // This would be the first valid person attacking it. Gets a 25% bonus. Per 1/19/07 Five on Friday + rights[0].m_Damage = (int)(rights[0].m_Damage * 1.25); if (rights.Count > 1) { @@ -3155,24 +3138,14 @@ namespace Server.Mobiles } var topDamage = rights[0].m_Damage; - int minDamage; - if (hitsMax >= 3000) + int minDamage = hitsMax switch { - minDamage = topDamage / 16; - } - else if (hitsMax >= 1000) - { - minDamage = topDamage / 8; - } - else if (hitsMax >= 200) - { - minDamage = topDamage / 4; - } - else - { - minDamage = topDamage / 2; - } + >= 3000 => topDamage / 16, + >= 1000 => topDamage / 8, + >= 200 => topDamage / 4, + _ => topDamage / 2 + }; for (var i = 0; i < rights.Count; ++i) { @@ -3271,127 +3244,126 @@ namespace Server.Mobiles GiftOfLifeSpell.HandleDeath(this); CheckStatTimers(); + return; } - else - { - if (!Summoned && !NoKillAwards) - { - var totalFame = Fame / 100; - var totalKarma = -Karma / 100; - if (Map == Map.Felucca) + if (!Summoned && !NoKillAwards) + { + var totalFame = Fame / 100; + var totalKarma = -Karma / 100; + + if (Map == Map.Felucca) + { + totalFame += totalFame / 10 * 3; + totalKarma += totalKarma / 10 * 3; + } + + var list = GetLootingRights(DamageEntries, HitsMax); + var titles = new List(); + var fame = new List(); + var karma = new List(); + + var givenQuestKill = false; + var givenFactionKill = false; + var givenToTKill = false; + + for (var i = 0; i < list.Count; ++i) + { + var ds = list[i]; + + if (!ds.m_HasRight) { - totalFame += totalFame / 10 * 3; - totalKarma += totalKarma / 10 * 3; + continue; } - var list = GetLootingRights(DamageEntries, HitsMax); - var titles = new List(); - var fame = new List(); - var karma = new List(); + var party = Engines.PartySystem.Party.Get(ds.m_Mobile); - var givenQuestKill = false; - var givenFactionKill = false; - var givenToTKill = false; - - for (var i = 0; i < list.Count; ++i) + if (party != null) { - var ds = list[i]; + var divedFame = totalFame / party.Members.Count; + var divedKarma = totalKarma / party.Members.Count; - if (!ds.m_HasRight) + for (var j = 0; j < party.Members.Count; ++j) + { + var info = party.Members[j]; + + if (info?.Mobile != null) + { + var index = titles.IndexOf(info.Mobile); + + if (index == -1) + { + titles.Add(info.Mobile); + fame.Add(divedFame); + karma.Add(divedKarma); + } + else + { + fame[index] += divedFame; + karma[index] += divedKarma; + } + } + } + } + else + { + titles.Add(ds.m_Mobile); + fame.Add(totalFame); + karma.Add(totalKarma); + } + + OnKilledBy(ds.m_Mobile); + + if (!givenFactionKill) + { + givenFactionKill = true; + Faction.HandleDeath(this, ds.m_Mobile); + } + + var region = ds.m_Mobile.Region; + + if (!givenToTKill && (Map == Map.Tokuno || region.IsPartOf("Yomotsu Mines") || + region.IsPartOf("Fan Dancer's Dojo"))) + { + givenToTKill = true; + TreasuresOfTokuno.HandleKill(this, ds.m_Mobile); + } + + if (ds.m_Mobile is PlayerMobile pm) + { + if (MLQuestSystem.Enabled) + { + MLQuestSystem.HandleKill(pm, this); + } + + if (givenQuestKill) { continue; } - var party = Engines.PartySystem.Party.Get(ds.m_Mobile); + var qs = pm.Quest; - if (party != null) + if (qs != null) { - var divedFame = totalFame / party.Members.Count; - var divedKarma = totalKarma / party.Members.Count; - - for (var j = 0; j < party.Members.Count; ++j) - { - var info = party.Members[j]; - - if (info?.Mobile != null) - { - var index = titles.IndexOf(info.Mobile); - - if (index == -1) - { - titles.Add(info.Mobile); - fame.Add(divedFame); - karma.Add(divedKarma); - } - else - { - fame[index] += divedFame; - karma[index] += divedKarma; - } - } - } + qs.OnKill(this, c); + givenQuestKill = true; } - else - { - titles.Add(ds.m_Mobile); - fame.Add(totalFame); - karma.Add(totalKarma); - } - - OnKilledBy(ds.m_Mobile); - - if (!givenFactionKill) - { - givenFactionKill = true; - Faction.HandleDeath(this, ds.m_Mobile); - } - - var region = ds.m_Mobile.Region; - - if (!givenToTKill && (Map == Map.Tokuno || region.IsPartOf("Yomotsu Mines") || - region.IsPartOf("Fan Dancer's Dojo"))) - { - givenToTKill = true; - TreasuresOfTokuno.HandleKill(this, ds.m_Mobile); - } - - if (ds.m_Mobile is PlayerMobile pm) - { - if (MLQuestSystem.Enabled) - { - MLQuestSystem.HandleKill(pm, this); - } - - if (givenQuestKill) - { - continue; - } - - var qs = pm.Quest; - - if (qs != null) - { - qs.OnKill(this, c); - givenQuestKill = true; - } - } - } - - for (var i = 0; i < titles.Count; ++i) - { - Titles.AwardFame(titles[i], fame[i], true); - Titles.AwardKarma(titles[i], karma[i], true); } } - base.OnDeath(c); - - if (DeleteCorpseOnDeath) + for (var i = 0; i < titles.Count; ++i) { - c.Delete(); + Titles.AwardFame(titles[i], fame[i], true); + Titles.AwardKarma(titles[i], karma[i], true); } } + + base.OnDeath(c); + + if (DeleteCorpseOnDeath) + { + c.Delete(); + } } public override void OnDelete() @@ -3642,17 +3614,25 @@ namespace Server.Mobiles public virtual bool Rummage() { - var eable = GetItemsInRange(2); - var toRummage = eable.FirstOrDefault(item => item.Items.Count > 0); - - eable.Free(); - - if (toRummage == null) + if (Backpack == null) { return false; } - if (Backpack == null) + var eable = GetItemsInRange(2); + Corpse toRummage = null; + foreach (var c in eable) + { + if (c.Items.Count > 0) + { + toRummage = c; + break; + } + } + + eable.Free(); + + if (toRummage == null) { return false; } @@ -3788,27 +3768,24 @@ namespace Server.Mobiles public static void TeleportPets(Mobile master, Point3D loc, Map map, bool onlyBonded = false) { - var move = new List(); + using var queue = PooledRefQueue.Create(); - foreach (var m in master.GetMobilesInRange(3)) + var eable = master.GetMobilesInRange(3); + foreach (var m in eable) { - if ( - m is BaseCreature { - Controlled: true, - ControlOrder: OrderType.Guard or OrderType.Follow or OrderType.Come - } pet - ) + if (m is BaseCreature + { Controlled: true, ControlOrder: OrderType.Guard or OrderType.Follow or OrderType.Come } pet && + pet.ControlMaster == master && (!onlyBonded || pet.IsBonded)) { - if (pet.ControlMaster == master && (!onlyBonded || pet.IsBonded)) - { - move.Add(pet); - } + queue.Enqueue(pet); } } - foreach (var m in move) + eable.Free(); + + while (queue.Count > 0) { - m.MoveToWorld(loc, map); + queue.Dequeue().MoveToWorld(loc, map); } } @@ -3844,18 +3821,14 @@ namespace Server.Mobiles var owner = ControlMaster; - if (owner?.Deleted != false || owner.Map != Map || !owner.InRange(this, 12) || !CanSee(owner) || - !InLOS(owner)) - { - if (OwnerAbandonTime == DateTime.MinValue) - { - OwnerAbandonTime = Core.Now; - } - } - else + if (owner?.Deleted == false && owner.Map == Map && owner.InRange(this, 12) && CanSee(owner) && InLOS(owner)) { OwnerAbandonTime = DateTime.MinValue; } + else if (OwnerAbandonTime == DateTime.MinValue) + { + OwnerAbandonTime = Core.Now; + } CheckStatTimers(); } @@ -3961,7 +3934,7 @@ namespace Server.Mobiles public void BeginDeleteTimer() { - if (!(this is BaseEscortable) && !Summoned && !Deleted && !IsStabled) + if (this is not BaseEscortable && !Summoned && !Deleted && !IsStabled) { StopDeleteTimer(); m_DeleteTimer = new DeleteTimer(this, TimeSpan.FromDays(3.0)); @@ -4261,40 +4234,13 @@ namespace Server.Mobiles { } - public virtual bool CheckFoodPreference(Item f) - { - if (CheckFoodPreference(f, FoodType.Eggs, m_Eggs)) - { - return true; - } - - if (CheckFoodPreference(f, FoodType.Fish, m_Fish)) - { - return true; - } - - if (CheckFoodPreference(f, FoodType.GrainsAndHay, m_GrainsAndHay)) - { - return true; - } - - if (CheckFoodPreference(f, FoodType.Meat, m_Meat)) - { - return true; - } - - if (CheckFoodPreference(f, FoodType.FruitsAndVegies, m_FruitsAndVegies)) - { - return true; - } - - if (CheckFoodPreference(f, FoodType.Gold, m_Gold)) - { - return true; - } - - return false; - } + public virtual bool CheckFoodPreference(Item f) => + CheckFoodPreference(f, FoodType.Eggs, m_Eggs) || + CheckFoodPreference(f, FoodType.Fish, m_Fish) || + CheckFoodPreference(f, FoodType.GrainsAndHay, m_GrainsAndHay) || + CheckFoodPreference(f, FoodType.Meat, m_Meat) || + CheckFoodPreference(f, FoodType.FruitsAndVegies, m_FruitsAndVegies) || + CheckFoodPreference(f, FoodType.Gold, m_Gold); public virtual bool CheckFoodPreference(Item fed, FoodType type, Type[] types) { @@ -4396,9 +4342,8 @@ namespace Server.Mobiles } else if (Core.ML) { - from.SendLocalizedMessage( - 1075268 - ); // Your pet cannot form a bond with you until your animal taming ability has risen. + // Your pet cannot form a bond with you until your animal taming ability has risen. + from.SendLocalizedMessage(1075268); } } } @@ -4454,12 +4399,7 @@ namespace Server.Mobiles return false; } - if (!Core.AOS && (skill == SkillName.Focus || skill == SkillName.Chivalry || skill == SkillName.Necromancy)) - { - return false; - } - - return true; + return Core.AOS || skill != SkillName.Focus && skill != SkillName.Chivalry && skill != SkillName.Necromancy; } public virtual TeachResult CheckTeachSkills( @@ -5033,8 +4973,8 @@ namespace Server.Mobiles return false; } - Cap(ref minLevel, 0, 5); - Cap(ref maxLevel, 0, 5); + minLevel = Math.Clamp(minLevel, 0, 5); + maxLevel = Math.Clamp(maxLevel, 0, 5); if (Core.AOS) { @@ -5121,9 +5061,7 @@ namespace Server.Mobiles if (min > max) { - var hold = min; - min = max; - max = hold; + (min, max) = (max, min); } /* Example: @@ -5204,8 +5142,8 @@ namespace Server.Mobiles return false; } - Cap(ref minLevel, 0, 5); - Cap(ref maxLevel, 0, 5); + minLevel = Math.Clamp(minLevel, 0, 5); + maxLevel = Math.Clamp(maxLevel, 0, 5); if (Core.AOS) { @@ -5481,15 +5419,21 @@ namespace Server.Mobiles } var eable = GetMobilesInRange(AuraRange); - - var list = eable.Where( - m => - m != this && CanBeHarmful(m, false) && (Core.AOS || InLOS(m)) && - (m is BaseCreature bc && (bc.Controlled || bc.Summoned || bc.Team != Team) || m.Player) - ); - - foreach (var m in list) + using var queue = PooledRefQueue.Create(); + foreach (var m in eable) { + if (m != this && CanBeHarmful(m, false) && (Core.AOS || InLOS(m)) && + (m is BaseCreature bc && (bc.Controlled || bc.Summoned || bc.Team != Team) || m.Player)) + { + queue.Enqueue(m); + } + } + eable.Free(); + + while (queue.Count > 0) + { + var m = queue.Dequeue(); + AOS.Damage( m, this, @@ -5503,8 +5447,6 @@ namespace Server.Mobiles ); AuraEffect(m); } - - eable.Free(); } public virtual void AuraEffect(Mobile m) @@ -5599,10 +5541,8 @@ namespace Server.Mobiles private DateTime m_NextHourlyCheck; - public LoyaltyTimer() : base(InternalDelay, InternalDelay) - { + public LoyaltyTimer() : base(InternalDelay, InternalDelay) => m_NextHourlyCheck = Core.Now + TimeSpan.FromHours(1.0); - } public static void Initialize() { @@ -5618,14 +5558,14 @@ namespace Server.Mobiles m_NextHourlyCheck = Core.Now + TimeSpan.FromHours(1.0); - var toRelease = new List(); + using var toRelease = PooledRefQueue.Create(); // added array for wild creatures in house regions to be removed - var toRemove = new List(); + using var toRemove = PooledRefQueue.Create(); foreach (var m in World.Mobiles.Values) { - if (!(m is BaseCreature c)) + if (m is not BaseCreature c) { continue; } @@ -5649,7 +5589,7 @@ namespace Server.Mobiles } else if (c.OwnerAbandonTime + c.BondingAbandonDelay <= Core.Now) { - toRemove.Add(c); + toRemove.Enqueue(c); } } else @@ -5673,7 +5613,7 @@ namespace Server.Mobiles if (c.Loyalty <= 0) { - toRelease.Add(c); + toRelease.Enqueue(c); } } } @@ -5686,7 +5626,7 @@ namespace Server.Mobiles if (c.RemoveStep >= 20) { - toRemove.Add(c); + toRemove.Enqueue(c); } } else @@ -5695,22 +5635,24 @@ namespace Server.Mobiles } } - foreach (var c in toRelease) + while (toRelease.Count > 0) { - c.Say(1043255, c.Name); // ~1_NAME~ appears to have decided that is better off without a master! + var c = toRelease.Dequeue(); + + c.Say(1043255, c.Name); // ~1_NAME~ appears to have decided that is better off without a master! c.Loyalty = BaseCreature.MaxLoyalty; // Wonderfully Happy c.IsBonded = false; c.BondingBegin = DateTime.MinValue; c.OwnerAbandonTime = DateTime.MinValue; c.ControlTarget = null; - c.AIObject - .DoOrderRelease(); // this will prevent no release of creatures left alone with AI disabled (and consequent bug of Followers) + // This will prevent no release of creatures left alone with AI disabled (and consequent bug of Followers) + c.AIObject.DoOrderRelease(); c.DropBackpack(); } - foreach (var c in toRemove) + while (toRemove.Count > 0) { - c.Delete(); + toRemove.Dequeue().Delete(); } } } From c8043e8dd299c50a0dcc5a4da59648353ce28583 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Sun, 21 Nov 2021 10:45:07 -0800 Subject: [PATCH 15/16] fix: Codegens remaining construction items (#859) --- .../UOContent/Items/Construction/Ankhs.cs | 181 +++++------------- .../Items/Construction/Tables/Tables.cs | 120 +----------- .../Items/Construction/Tables/WritingTable.cs | 26 +-- .../Items/Construction/Walls/BaseWall.cs | 21 +- .../Items/Construction/Walls/DarkWoodWall.cs | 21 +- .../Construction/Walls/ThickGrayStoneWall.cs | 21 +- .../Items/Construction/Walls/ThinBrickWall.cs | 21 +- .../Items/Construction/Walls/ThinStoneWall.cs | 21 +- .../Construction/Walls/WhiteStoneWall.cs | 21 +- ...erver.Items.AnkhNorth.InternalItem.v0.json | 11 ++ .../Migrations/Server.Items.AnkhNorth.v0.json | 11 ++ ...Server.Items.AnkhWest.InternalItem.v0.json | 11 ++ .../Migrations/Server.Items.AnkhWest.v0.json | 11 ++ .../Migrations/Server.Items.BaseWall.v0.json | 4 + .../Server.Items.DarkWoodWall.v0.json | 4 + .../Server.Items.ElegantLowTable.v0.json | 4 + .../Server.Items.LargeTable.v0.json | 4 + .../Server.Items.Nightstand.v0.json | 4 + .../Server.Items.PlainLowTable.v0.json | 4 + .../Server.Items.ThickGrayStoneWall.v0.json | 4 + .../Server.Items.ThinBrickWall.v0.json | 4 + .../Server.Items.ThinStoneWall.v0.json | 4 + .../Server.Items.WhiteStoneWall.v0.json | 4 + .../Server.Items.WritingTable.v0.json | 4 + .../Server.Items.YewWoodTable.v0.json | 4 + 25 files changed, 164 insertions(+), 381 deletions(-) create mode 100644 Projects/UOContent/Migrations/Server.Items.AnkhNorth.InternalItem.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.AnkhNorth.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.AnkhWest.InternalItem.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.AnkhWest.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.BaseWall.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.DarkWoodWall.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.ElegantLowTable.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.LargeTable.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.Nightstand.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.PlainLowTable.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.ThickGrayStoneWall.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.ThinBrickWall.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.ThinStoneWall.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.WhiteStoneWall.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.WritingTable.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.YewWoodTable.v0.json diff --git a/Projects/UOContent/Items/Construction/Ankhs.cs b/Projects/UOContent/Items/Construction/Ankhs.cs index 2e3202048..a9993b5df 100644 --- a/Projects/UOContent/Items/Construction/Ankhs.cs +++ b/Projects/UOContent/Items/Construction/Ankhs.cs @@ -80,9 +80,8 @@ namespace Server.Items if (m_Mobile.KarmaLocked) { - m_Mobile.SendLocalizedMessage( - 1060192 - ); // Your karma has been locked. Your karma can no longer be raised. + // Your karma has been locked. Your karma can no longer be raised. + m_Mobile.SendLocalizedMessage(1060192); } else { @@ -112,20 +111,17 @@ namespace Server.Items } } - public class AnkhWest : Item + [Serializable(0, false)] + public partial class AnkhWest : Item { - private InternalItem m_Item; + [SerializableField(0)] + private InternalItem _item; [Constructible] public AnkhWest(bool bloodied = false) : base(bloodied ? 0x1D98 : 0x3) { Movable = false; - - m_Item = new InternalItem(bloodied, this); - } - - public AnkhWest(Serial serial) : base(serial) - { + _item = new InternalItem(bloodied, this); } public override bool HandlesOnMovement => true; // Tell the core that we implement OnMovement @@ -138,9 +134,9 @@ namespace Server.Items set { base.Hue = value; - if (m_Item.Hue != value) + if (_item.Hue != value) { - m_Item.Hue = value; + _item.Hue = value; } } } @@ -166,17 +162,17 @@ namespace Server.Items public override void OnLocationChange(Point3D oldLocation) { - if (m_Item != null) + if (_item != null) { - m_Item.Location = new Point3D(X, Y + 1, Z); + _item.Location = new Point3D(X, Y + 1, Z); } } public override void OnMapChange() { - if (m_Item != null) + if (_item != null) { - m_Item.Map = Map; + _item.Map = Map; } } @@ -184,40 +180,19 @@ namespace Server.Items { base.OnAfterDelete(); - m_Item?.Delete(); - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - - writer.Write(m_Item); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - m_Item = reader.ReadEntity(); + _item?.Delete(); } + [Serializable(0, false)] private class InternalItem : Item { - private AnkhWest m_Item; + [SerializableField(0)] + private AnkhWest _item; public InternalItem(bool bloodied, AnkhWest item) : base(bloodied ? 0x1D97 : 0x2) { Movable = false; - - m_Item = item; - } - - public InternalItem(Serial serial) : base(serial) - { + _item = item; } public override bool HandlesOnMovement => true; // Tell the core that we implement OnMovement @@ -230,26 +205,26 @@ namespace Server.Items set { base.Hue = value; - if (m_Item.Hue != value) + if (_item.Hue != value) { - m_Item.Hue = value; + _item.Hue = value; } } } public override void OnLocationChange(Point3D oldLocation) { - if (m_Item != null) + if (_item != null) { - m_Item.Location = new Point3D(X, Y - 1, Z); + _item.Location = new Point3D(X, Y - 1, Z); } } public override void OnMapChange() { - if (m_Item != null) + if (_item != null) { - m_Item.Map = Map; + _item.Map = Map; } } @@ -257,7 +232,7 @@ namespace Server.Items { base.OnAfterDelete(); - m_Item?.Delete(); + _item?.Delete(); } public override void OnMovement(Mobile m, Point3D oldLocation) @@ -278,43 +253,22 @@ namespace Server.Items { Ankhs.Resurrect(m, this); } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - - writer.Write(m_Item); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - m_Item = reader.ReadEntity(); - } } } [TypeAlias("Server.Items.AnkhEast")] - public class AnkhNorth : Item + [Serializable(0, false)] + public partial class AnkhNorth : Item { - private InternalItem m_Item; + [SerializableField(0)] + private InternalItem _item; [Constructible] public AnkhNorth(bool bloodied = false) : base(bloodied ? 0x1E5D : 0x4) { Movable = false; - m_Item = new InternalItem(bloodied, this); - } - - public AnkhNorth(Serial serial) - : base(serial) - { + _item = new InternalItem(bloodied, this); } public override bool HandlesOnMovement => true; // Tell the core that we implement OnMovement @@ -327,9 +281,9 @@ namespace Server.Items set { base.Hue = value; - if (m_Item.Hue != value) + if (_item.Hue != value) { - m_Item.Hue = value; + _item.Hue = value; } } } @@ -355,17 +309,17 @@ namespace Server.Items public override void OnLocationChange(Point3D oldLocation) { - if (m_Item != null) + if (_item != null) { - m_Item.Location = new Point3D(X + 1, Y, Z); + _item.Location = new Point3D(X + 1, Y, Z); } } public override void OnMapChange() { - if (m_Item != null) + if (_item != null) { - m_Item.Map = Map; + _item.Map = Map; } } @@ -373,42 +327,21 @@ namespace Server.Items { base.OnAfterDelete(); - m_Item?.Delete(); - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - - writer.Write(m_Item); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - m_Item = reader.ReadEntity(); + _item?.Delete(); } [TypeAlias("Server.Items.AnkhEast+InternalItem")] + [Serializable(0, false)] private class InternalItem : Item { - private AnkhNorth m_Item; + [SerializableField(0)] + private AnkhNorth _item; public InternalItem(bool bloodied, AnkhNorth item) : base(bloodied ? 0x1E5C : 0x5) { Movable = false; - - m_Item = item; - } - - public InternalItem(Serial serial) : base(serial) - { + _item = item; } public override bool HandlesOnMovement => true; // Tell the core that we implement OnMovement @@ -421,26 +354,26 @@ namespace Server.Items set { base.Hue = value; - if (m_Item.Hue != value) + if (_item.Hue != value) { - m_Item.Hue = value; + _item.Hue = value; } } } public override void OnLocationChange(Point3D oldLocation) { - if (m_Item != null) + if (_item != null) { - m_Item.Location = new Point3D(X - 1, Y, Z); + _item.Location = new Point3D(X - 1, Y, Z); } } public override void OnMapChange() { - if (m_Item != null) + if (_item != null) { - m_Item.Map = Map; + _item.Map = Map; } } @@ -448,7 +381,7 @@ namespace Server.Items { base.OnAfterDelete(); - m_Item?.Delete(); + _item?.Delete(); } public override void OnMovement(Mobile m, Point3D oldLocation) @@ -469,24 +402,6 @@ namespace Server.Items { Ankhs.Resurrect(m, this); } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - - writer.Write(m_Item); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - m_Item = reader.ReadEntity(); - } } } } diff --git a/Projects/UOContent/Items/Construction/Tables/Tables.cs b/Projects/UOContent/Items/Construction/Tables/Tables.cs index eef852237..65f1bdbf1 100644 --- a/Projects/UOContent/Items/Construction/Tables/Tables.cs +++ b/Projects/UOContent/Items/Construction/Tables/Tables.cs @@ -1,145 +1,45 @@ namespace Server.Items { [Furniture] - public class ElegantLowTable : Item + [Serializable(0, false)] + public partial class ElegantLowTable : Item { [Constructible] public ElegantLowTable() : base(0x2819) => Weight = 1.0; - - public ElegantLowTable(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } } [Furniture] - public class PlainLowTable : Item + [Serializable(0, false)] + public partial class PlainLowTable : Item { [Constructible] public PlainLowTable() : base(0x281A) => Weight = 1.0; - - public PlainLowTable(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } } [Furniture] [Flippable(0xB90, 0xB7D)] - public class LargeTable : Item + [Serializable(0, false)] + public partial class LargeTable : Item { [Constructible] public LargeTable() : base(0xB90) => Weight = 1.0; - - public LargeTable(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - if (Weight == 4.0) - { - Weight = 1.0; - } - } } [Furniture] [Flippable(0xB35, 0xB34)] - public class Nightstand : Item + [Serializable(0, false)] + public partial class Nightstand : Item { [Constructible] public Nightstand() : base(0xB35) => Weight = 1.0; - - public Nightstand(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - if (Weight == 4.0) - { - Weight = 1.0; - } - } } [Furniture] [Flippable(0xB8F, 0xB7C)] - public class YewWoodTable : Item + [Serializable(0, false)] + public partial class YewWoodTable : Item { [Constructible] public YewWoodTable() : base(0xB8F) => Weight = 1.0; - - public YewWoodTable(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - if (Weight == 4.0) - { - Weight = 1.0; - } - } } } diff --git a/Projects/UOContent/Items/Construction/Tables/WritingTable.cs b/Projects/UOContent/Items/Construction/Tables/WritingTable.cs index a711392b7..35ec06c37 100644 --- a/Projects/UOContent/Items/Construction/Tables/WritingTable.cs +++ b/Projects/UOContent/Items/Construction/Tables/WritingTable.cs @@ -2,32 +2,10 @@ namespace Server.Items { [Furniture] [Flippable(0xB4A, 0xB49, 0xB4B, 0xB4C)] - public class WritingTable : Item + [Serializable(0, false)] + public partial class WritingTable : Item { [Constructible] public WritingTable() : base(0xB4A) => Weight = 1.0; - - public WritingTable(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - if (Weight == 4.0) - { - Weight = 1.0; - } - } } } diff --git a/Projects/UOContent/Items/Construction/Walls/BaseWall.cs b/Projects/UOContent/Items/Construction/Walls/BaseWall.cs index d7ab25c27..6b5914a07 100644 --- a/Projects/UOContent/Items/Construction/Walls/BaseWall.cs +++ b/Projects/UOContent/Items/Construction/Walls/BaseWall.cs @@ -1,25 +1,8 @@ namespace Server.Items { - public abstract class BaseWall : Item + [Serializable(0, false)] + public abstract partial class BaseWall : Item { public BaseWall(int itemID) : base(itemID) => Movable = false; - - public BaseWall(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } } } diff --git a/Projects/UOContent/Items/Construction/Walls/DarkWoodWall.cs b/Projects/UOContent/Items/Construction/Walls/DarkWoodWall.cs index 282863781..a1e6e4077 100644 --- a/Projects/UOContent/Items/Construction/Walls/DarkWoodWall.cs +++ b/Projects/UOContent/Items/Construction/Walls/DarkWoodWall.cs @@ -24,29 +24,12 @@ namespace Server.Items EastWallVShort } - public class DarkWoodWall : BaseWall + [Serializable(0, false)] + public partial class DarkWoodWall : BaseWall { [Constructible] public DarkWoodWall(DarkWoodWallTypes type) : base(0x0006 + (int)type) { } - - public DarkWoodWall(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } } } diff --git a/Projects/UOContent/Items/Construction/Walls/ThickGrayStoneWall.cs b/Projects/UOContent/Items/Construction/Walls/ThickGrayStoneWall.cs index 044af3bc8..17514de42 100644 --- a/Projects/UOContent/Items/Construction/Walls/ThickGrayStoneWall.cs +++ b/Projects/UOContent/Items/Construction/Walls/ThickGrayStoneWall.cs @@ -34,29 +34,12 @@ namespace Server.Items EastWindow2 } - public class ThickGrayStoneWall : BaseWall + [Serializable(0, false)] + public partial class ThickGrayStoneWall : BaseWall { [Constructible] public ThickGrayStoneWall(ThickGrayStoneWallTypes type) : base(0x007A + (int)type) { } - - public ThickGrayStoneWall(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } } } diff --git a/Projects/UOContent/Items/Construction/Walls/ThinBrickWall.cs b/Projects/UOContent/Items/Construction/Walls/ThinBrickWall.cs index a7636cccf..f69a3cda3 100644 --- a/Projects/UOContent/Items/Construction/Walls/ThinBrickWall.cs +++ b/Projects/UOContent/Items/Construction/Walls/ThinBrickWall.cs @@ -40,29 +40,12 @@ namespace Server.Items EastWallVShort } - public class ThinBrickWall : BaseWall + [Serializable(0, false)] + public partial class ThinBrickWall : BaseWall { [Constructible] public ThinBrickWall(ThinBrickWallTypes type) : base(0x0033 + (int)type) { } - - public ThinBrickWall(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } } } diff --git a/Projects/UOContent/Items/Construction/Walls/ThinStoneWall.cs b/Projects/UOContent/Items/Construction/Walls/ThinStoneWall.cs index 49794458c..7754c7b10 100644 --- a/Projects/UOContent/Items/Construction/Walls/ThinStoneWall.cs +++ b/Projects/UOContent/Items/Construction/Walls/ThinStoneWall.cs @@ -29,29 +29,12 @@ namespace Server.Items EastWallShort2 } - public class ThinStoneWall : BaseWall + [Serializable(0, false)] + public partial class ThinStoneWall : BaseWall { [Constructible] public ThinStoneWall(ThinStoneWallTypes type) : base(0x001A + (int)type) { } - - public ThinStoneWall(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } } } diff --git a/Projects/UOContent/Items/Construction/Walls/WhiteStoneWall.cs b/Projects/UOContent/Items/Construction/Walls/WhiteStoneWall.cs index 093892d15..07a6f0d16 100644 --- a/Projects/UOContent/Items/Construction/Walls/WhiteStoneWall.cs +++ b/Projects/UOContent/Items/Construction/Walls/WhiteStoneWall.cs @@ -47,29 +47,12 @@ namespace Server.Items EastWallVVShort } - public class WhiteStoneWall : BaseWall + [Serializable(0, false)] + public partial class WhiteStoneWall : BaseWall { [Constructible] public WhiteStoneWall(WhiteStoneWallTypes type) : base(0x0057 + (int)type) { } - - public WhiteStoneWall(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } } } diff --git a/Projects/UOContent/Migrations/Server.Items.AnkhNorth.InternalItem.v0.json b/Projects/UOContent/Migrations/Server.Items.AnkhNorth.InternalItem.v0.json new file mode 100644 index 000000000..f0bb8bf9d --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.AnkhNorth.InternalItem.v0.json @@ -0,0 +1,11 @@ +{ + "version": 0, + "type": "Server.Items.AnkhNorth.InternalItem", + "properties": [ + { + "name": "Item", + "type": "Server.Items.AnkhNorth", + "rule": "SerializableInterfaceMigrationRule" + } + ] +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.AnkhNorth.v0.json b/Projects/UOContent/Migrations/Server.Items.AnkhNorth.v0.json new file mode 100644 index 000000000..e6276daa9 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.AnkhNorth.v0.json @@ -0,0 +1,11 @@ +{ + "version": 0, + "type": "Server.Items.AnkhNorth", + "properties": [ + { + "name": "Item", + "type": "Server.Items.AnkhNorth.InternalItem", + "rule": "SerializableInterfaceMigrationRule" + } + ] +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.AnkhWest.InternalItem.v0.json b/Projects/UOContent/Migrations/Server.Items.AnkhWest.InternalItem.v0.json new file mode 100644 index 000000000..ce8487ea3 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.AnkhWest.InternalItem.v0.json @@ -0,0 +1,11 @@ +{ + "version": 0, + "type": "Server.Items.AnkhWest.InternalItem", + "properties": [ + { + "name": "Item", + "type": "Server.Items.AnkhWest", + "rule": "SerializableInterfaceMigrationRule" + } + ] +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.AnkhWest.v0.json b/Projects/UOContent/Migrations/Server.Items.AnkhWest.v0.json new file mode 100644 index 000000000..4d2c54228 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.AnkhWest.v0.json @@ -0,0 +1,11 @@ +{ + "version": 0, + "type": "Server.Items.AnkhWest", + "properties": [ + { + "name": "Item", + "type": "Server.Items.AnkhWest.InternalItem", + "rule": "SerializableInterfaceMigrationRule" + } + ] +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.BaseWall.v0.json b/Projects/UOContent/Migrations/Server.Items.BaseWall.v0.json new file mode 100644 index 000000000..6d0cdab23 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.BaseWall.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.BaseWall" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.DarkWoodWall.v0.json b/Projects/UOContent/Migrations/Server.Items.DarkWoodWall.v0.json new file mode 100644 index 000000000..f520f6f5d --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.DarkWoodWall.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.DarkWoodWall" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.ElegantLowTable.v0.json b/Projects/UOContent/Migrations/Server.Items.ElegantLowTable.v0.json new file mode 100644 index 000000000..2ea3c2834 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.ElegantLowTable.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.ElegantLowTable" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.LargeTable.v0.json b/Projects/UOContent/Migrations/Server.Items.LargeTable.v0.json new file mode 100644 index 000000000..238f1c5c9 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.LargeTable.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.LargeTable" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Nightstand.v0.json b/Projects/UOContent/Migrations/Server.Items.Nightstand.v0.json new file mode 100644 index 000000000..96a1d9f80 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Nightstand.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Nightstand" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.PlainLowTable.v0.json b/Projects/UOContent/Migrations/Server.Items.PlainLowTable.v0.json new file mode 100644 index 000000000..f11168e93 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.PlainLowTable.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.PlainLowTable" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.ThickGrayStoneWall.v0.json b/Projects/UOContent/Migrations/Server.Items.ThickGrayStoneWall.v0.json new file mode 100644 index 000000000..783cf62be --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.ThickGrayStoneWall.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.ThickGrayStoneWall" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.ThinBrickWall.v0.json b/Projects/UOContent/Migrations/Server.Items.ThinBrickWall.v0.json new file mode 100644 index 000000000..a91f76dfa --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.ThinBrickWall.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.ThinBrickWall" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.ThinStoneWall.v0.json b/Projects/UOContent/Migrations/Server.Items.ThinStoneWall.v0.json new file mode 100644 index 000000000..a10bfd271 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.ThinStoneWall.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.ThinStoneWall" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.WhiteStoneWall.v0.json b/Projects/UOContent/Migrations/Server.Items.WhiteStoneWall.v0.json new file mode 100644 index 000000000..e8172178e --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.WhiteStoneWall.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.WhiteStoneWall" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.WritingTable.v0.json b/Projects/UOContent/Migrations/Server.Items.WritingTable.v0.json new file mode 100644 index 000000000..14728f82e --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.WritingTable.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.WritingTable" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.YewWoodTable.v0.json b/Projects/UOContent/Migrations/Server.Items.YewWoodTable.v0.json new file mode 100644 index 000000000..72738fa69 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.YewWoodTable.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.YewWoodTable" +} \ No newline at end of file From c8a6d4c696134b3d5d37e7847d6e321b0ea44ae5 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Sun, 21 Nov 2021 18:06:39 -0800 Subject: [PATCH 16/16] fix: Fixes .net 6 compilation (#860) --- Directory.Build.props | 4 ++-- .../SerializationGenerator.csproj | 14 ++++++++------ .../SerializationSchemaGenerator.csproj | 8 +++++--- Projects/Server/Server.csproj | 2 +- Projects/Server/Utilities/Utility.cs | 15 +++++++++++++++ Projects/UOContent/Items/Construction/Ankhs.cs | 8 ++++---- Projects/UOContent/UOContent.csproj | 2 +- 7 files changed, 36 insertions(+), 17 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 27ca9d899..c48855eab 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -4,7 +4,7 @@ Kamron Batman ModernUO 2019-2020 - net5.0;net6.0 + net6.0 x64 x64 preview @@ -56,7 +56,7 @@ - + 3.4.244 all diff --git a/Projects/SerializationGenerator/SerializationGenerator.csproj b/Projects/SerializationGenerator/SerializationGenerator.csproj index 03b5a5bdb..f74e5e965 100755 --- a/Projects/SerializationGenerator/SerializationGenerator.csproj +++ b/Projects/SerializationGenerator/SerializationGenerator.csproj @@ -1,16 +1,17 @@ - netstandard2.0 + netstandard2.0 preview analyzers - - - - - + + + + + + @@ -22,6 +23,7 @@ + diff --git a/Projects/SerializationSchemaGenerator/SerializationSchemaGenerator.csproj b/Projects/SerializationSchemaGenerator/SerializationSchemaGenerator.csproj index 31e89d561..d3d1a168e 100755 --- a/Projects/SerializationSchemaGenerator/SerializationSchemaGenerator.csproj +++ b/Projects/SerializationSchemaGenerator/SerializationSchemaGenerator.csproj @@ -1,7 +1,6 @@ Exe - net5.0 Output @@ -14,7 +13,10 @@ - - + + + + + diff --git a/Projects/Server/Server.csproj b/Projects/Server/Server.csproj index cf357a582..f2cc0ec7a 100755 --- a/Projects/Server/Server.csproj +++ b/Projects/Server/Server.csproj @@ -34,7 +34,7 @@ - + diff --git a/Projects/Server/Utilities/Utility.cs b/Projects/Server/Utilities/Utility.cs index a184d4b23..d3a780a4f 100644 --- a/Projects/Server/Utilities/Utility.cs +++ b/Projects/Server/Utilities/Utility.cs @@ -1049,6 +1049,21 @@ namespace Server return min + (int)RandomSources.Source.Next((uint)(max - min + 1)); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static long RandomMinMax(long min, long max) + { + if (min > max) + { + (min, max) = (max, min); + } + else if (min == max) + { + return min; + } + + return min + RandomSources.Source.Next(max - min + 1); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int Random(int from, int count) => RandomSources.Source.Next(from, count); diff --git a/Projects/UOContent/Items/Construction/Ankhs.cs b/Projects/UOContent/Items/Construction/Ankhs.cs index a9993b5df..d75e968f5 100644 --- a/Projects/UOContent/Items/Construction/Ankhs.cs +++ b/Projects/UOContent/Items/Construction/Ankhs.cs @@ -114,7 +114,7 @@ namespace Server.Items [Serializable(0, false)] public partial class AnkhWest : Item { - [SerializableField(0)] + [SerializableField(0, getter: "private", setter: "private")] private InternalItem _item; [Constructible] @@ -184,7 +184,7 @@ namespace Server.Items } [Serializable(0, false)] - private class InternalItem : Item + private partial class InternalItem : Item { [SerializableField(0)] private AnkhWest _item; @@ -260,7 +260,7 @@ namespace Server.Items [Serializable(0, false)] public partial class AnkhNorth : Item { - [SerializableField(0)] + [SerializableField(0, getter: "private", setter: "private")] private InternalItem _item; [Constructible] @@ -332,7 +332,7 @@ namespace Server.Items [TypeAlias("Server.Items.AnkhEast+InternalItem")] [Serializable(0, false)] - private class InternalItem : Item + private partial class InternalItem : Item { [SerializableField(0)] private AnkhNorth _item; diff --git a/Projects/UOContent/UOContent.csproj b/Projects/UOContent/UOContent.csproj index 5f322c829..2ef0f6dfc 100755 --- a/Projects/UOContent/UOContent.csproj +++ b/Projects/UOContent/UOContent.csproj @@ -40,7 +40,7 @@ - +