From 0bec97639f41500cc0f19fc8ca9906ee661c9a11 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Mon, 18 Sep 2023 23:53:18 -0700 Subject: [PATCH] feat: Adds KR/EC client versions (No actual support yet). (#1506) ### Summary - Adds KR/EC client versions to ClientVersion - Adds distinction for enhanced versions in the page queue - Adds KR Expansion flags - Adds ProtocolChange enum support - Adds missing Moongate checks for TerMur - Adds better message for why a client version is not supported, and which ones are supported. --- .../Tests/Client/ClientVersionTests.cs | 35 ++++++ Projects/Server/Client/ClientType.cs | 28 +++++ Projects/Server/Client/ClientVersion.cs | 117 ++++++++++++------ .../Server/Client/ClientVersionExtensions.cs | 31 +++++ Projects/Server/Effects.cs | 2 +- Projects/Server/ExpansionInfo.cs | 4 +- .../NetState/NetState.ClientVersion.cs | 40 ++---- .../UOContent/Engines/Help/PageQueueGump.cs | 43 +++++-- Projects/UOContent/Gumps/ClientGump.cs | 2 +- .../Items/Games/Mahjong/MahjongPackets.cs | 2 +- .../Skill Items/Magical/Misc/Moongate.cs | 3 +- Projects/UOContent/Misc/ClientVerification.cs | 76 +++++++++--- Projects/UOContent/Spells/Base/Spell.cs | 4 +- 13 files changed, 284 insertions(+), 103 deletions(-) create mode 100644 Projects/Server.Tests/Tests/Client/ClientVersionTests.cs create mode 100644 Projects/Server/Client/ClientType.cs create mode 100644 Projects/Server/Client/ClientVersionExtensions.cs diff --git a/Projects/Server.Tests/Tests/Client/ClientVersionTests.cs b/Projects/Server.Tests/Tests/Client/ClientVersionTests.cs new file mode 100644 index 000000000..5f8ddc5b9 --- /dev/null +++ b/Projects/Server.Tests/Tests/Client/ClientVersionTests.cs @@ -0,0 +1,35 @@ +using Xunit; + +namespace Server.Tests.Network; + +public class ClientVersionTests +{ + [Theory] + [InlineData("7.0.33.1", "67.0.33", false, 0)] + [InlineData("7.0.45.65", "67.0.33", false, 1)] + [InlineData("6.0.0.0", "67.0.33", false, -1)] + public void TestCCAndECStringCtor(string ccVersion, string ecVersion, bool equal, int comparison) + { + var cc = new ClientVersion(ccVersion); + var ec = new ClientVersion(ecVersion); + + Assert.Equal(equal, cc == ec); + Assert.Equal(comparison, cc.CompareTo(ec)); + } + + [Theory] + [InlineData(7, 0, 33, 1, 67, 0, 33, 0, false, 0)] + [InlineData(7, 0, 45, 65, 67, 0, 33, 0, false, 1)] + [InlineData(6, 0, 0, 0, 67, 0, 33, 0, false, -1)] + public void TestCCAndECCtor( + int ccMaj, int ccMin, int ccRev, int ccPatch, int ecMaj, int ecMin, int ecRev, int ecPatch, + bool equal, int comparison + ) + { + var cc = new ClientVersion(ccMaj, ccMin, ccRev, ccPatch); + var ec = new ClientVersion(ecMaj, ecMin, ecRev, ecPatch); + + Assert.Equal(equal, cc == ec); + Assert.Equal(comparison, cc.CompareTo(ec)); + } +} diff --git a/Projects/Server/Client/ClientType.cs b/Projects/Server/Client/ClientType.cs new file mode 100644 index 000000000..f7cab9168 --- /dev/null +++ b/Projects/Server/Client/ClientType.cs @@ -0,0 +1,28 @@ +/************************************************************************* + * ModernUO * + * Copyright 2019-2023 - ModernUO Development Team * + * Email: hi@modernuo.com * + * File: ClientType.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; + +namespace Server; + +[Flags] +public enum ClientType +{ + None = 0x00, + Classic = 0x01, + UOTD = 0x02, + KR = 0x04, + SA = 0x08 +} diff --git a/Projects/Server/Client/ClientVersion.cs b/Projects/Server/Client/ClientVersion.cs index effcac920..ef71865f1 100644 --- a/Projects/Server/Client/ClientVersion.cs +++ b/Projects/Server/Client/ClientVersion.cs @@ -16,29 +16,24 @@ using System; using System.Collections.Generic; using System.Runtime.CompilerServices; +using Server.Network; using Server.Text; namespace Server; -public enum ClientType -{ - Regular, - UOTD, - God, - SA -} - -public class ClientVersion : IComparable, IComparer +public class ClientVersion : IComparable, IComparer, IEquatable { public static readonly ClientVersion Version400a = new("4.0.0a"); public static readonly ClientVersion Version407a = new("4.0.7a"); public static readonly ClientVersion Version500a = new("5.0.0a"); public static readonly ClientVersion Version502b = new("5.0.2b"); - public static readonly ClientVersion Version6000 = new("6.0.0.0"); // Map & Static diffs are no longer loaded + public static readonly ClientVersion Version6000 = new("6.0.0.0"); + public static readonly ClientVersion Version6000KR = new("66.55.38"); // KR 2.44.0.15 (First release) public static readonly ClientVersion Version6017 = new("6.0.1.7"); public static readonly ClientVersion Version60142 = new("6.0.14.2"); + public static readonly ClientVersion Version60142KR = new("66.55.53"); // KR 2.59.0.2 public static readonly ClientVersion Version7000 = new("7.0.0.0"); - public static readonly ClientVersion Version7090 = new("7.0.9.0"); // HS File format change + public static readonly ClientVersion Version7090 = new("7.0.9.0"); public static readonly ClientVersion Version70120 = new("7.0.12.0"); // Plant localization change public static readonly ClientVersion Version70130 = new("7.0.13.0"); public static readonly ClientVersion Version70160 = new("7.0.16.0"); @@ -47,14 +42,24 @@ public class ClientVersion : IComparable, IComparer= 67) + { + Major = maj - 60; + Type = ClientType.SA; + } + else + { + Major = maj; + Type = maj == 66 ? ClientType.KR : type; + } + Minor = min; Revision = rev; Patch = pat; - Type = type; SourceString = ToStringImpl().Intern(); } @@ -62,7 +67,7 @@ public class ClientVersion : IComparable, IComparer, IComparer 66) + { + Major -= 60; + Type = ClientType.SA; } else if (fmt.InsensitiveContains("third dawn") || fmt.InsensitiveContains("uo:td") || @@ -106,10 +116,6 @@ public class ClientVersion : IComparable, IComparer, IComparer, IComparer o.Patch) { return 1; @@ -185,10 +197,6 @@ public class ClientVersion : IComparable, IComparer.Compare(ClientVersion x, ClientVersion y) => Compare(x, y); - public static bool operator ==(ClientVersion l, ClientVersion r) => Compare(l, r) == 0; - - public static bool operator !=(ClientVersion l, ClientVersion r) => Compare(l, r) != 0; - public static bool operator >=(ClientVersion l, ClientVersion r) => Compare(l, r) >= 0; public static bool operator >(ClientVersion l, ClientVersion r) => Compare(l, r) > 0; @@ -197,25 +205,19 @@ public class ClientVersion : IComparable, IComparer Compare(l, r) < 0; - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public override int GetHashCode() => HashCode.Combine(Major, Minor, Revision, Patch, Type); + public static bool operator ==(ClientVersion l, ClientVersion r) => Equals(l, r); - public override bool Equals(object obj) - { - var v = obj as ClientVersion; - - return Major == v?.Major - && Minor == v.Minor - && Revision == v.Revision - && Patch == v.Patch - && Type == v.Type; - } + public static bool operator !=(ClientVersion l, ClientVersion r) => !Equals(l, r); private string ToStringImpl() { using var builder = ValueStringBuilder.Create(); - if (Major > 5 || Minor > 0 || Revision > 6) + if (Type == ClientType.SA) + { + builder.Append($"{Major + 60:00}.{Minor:00}.{Revision:00}"); + } + else if (Major > 5 || Minor > 0 || Revision > 6) { builder.Append($"{Major}.{Minor}.{Revision}.{Patch}"); } @@ -259,4 +261,41 @@ public class ClientVersion : IComparable, IComparer this switch + { + var v when v.Type is ClientType.KR && v >= Version60142KR => ProtocolChanges.Version60142, + var v when v.Type is ClientType.KR => ProtocolChanges.Version6000, + var v when v >= Version70610 => ProtocolChanges.Version70610, + var v when v >= Version70500 => ProtocolChanges.Version70500, + var v when v >= Version704565 => ProtocolChanges.Version704565, + var v when v >= Version70331 => ProtocolChanges.Version70331, + var v when v >= Version70300 => ProtocolChanges.Version70300, + var v when v >= Version70160 => ProtocolChanges.Version70160, + var v when v >= Version70130 => ProtocolChanges.Version70130, + var v when v >= Version7090 => ProtocolChanges.Version7090, + var v when v >= Version7000 => ProtocolChanges.Version7000, + var v when v >= Version60142 => ProtocolChanges.Version60142, + var v when v >= Version6017 => ProtocolChanges.Version6017, + var v when v >= Version6000 => ProtocolChanges.Version6000, + var v when v >= Version502b => ProtocolChanges.Version502b, + var v when v >= Version500a => ProtocolChanges.Version500a, + var v when v >= Version407a => ProtocolChanges.Version407a, + var v when v >= Version400a => ProtocolChanges.Version400a, + _ => ProtocolChanges.None + }; + } + + public bool Equals(ClientVersion other) => + !ReferenceEquals(null, other) && (ReferenceEquals(this, other) || Major == other.Major && + Minor == other.Minor && Revision == other.Revision && Patch == other.Patch && Type == other.Type); + + public override bool Equals(object obj) => + !ReferenceEquals(null, obj) && + (ReferenceEquals(this, obj) || obj.GetType() == GetType() && Equals((ClientVersion)obj)); + + public override int GetHashCode() => HashCode.Combine(Major, Minor, Revision, Patch); } diff --git a/Projects/Server/Client/ClientVersionExtensions.cs b/Projects/Server/Client/ClientVersionExtensions.cs new file mode 100644 index 000000000..0c008205a --- /dev/null +++ b/Projects/Server/Client/ClientVersionExtensions.cs @@ -0,0 +1,31 @@ +/************************************************************************* + * ModernUO * + * Copyright 2019-2023 - ModernUO Development Team * + * Email: hi@modernuo.com * + * File: ClientVersionExtensions.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.Runtime.CompilerServices; + +namespace Server; + +public static class ClientVersionExtensions +{ + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static string TypeName(this ClientType type) => + type switch + { + ClientType.UOTD => "UO:TD", + ClientType.KR => "UO:KR", + ClientType.SA => "UO:SA", + _ => "classic", + }; +} diff --git a/Projects/Server/Effects.cs b/Projects/Server/Effects.cs index d3fb40272..3adf9cb75 100644 --- a/Projects/Server/Effects.cs +++ b/Projects/Server/Effects.cs @@ -59,7 +59,7 @@ public static class Effects public static bool SendParticlesTo(NetState state) => ParticleSupportType == ParticleSupportType.Full || - ParticleSupportType == ParticleSupportType.Detect && state.IsUOTDClient; + ParticleSupportType == ParticleSupportType.Detect && (state.IsUOTDClient || state.IsEnhancedClient); public static void PlaySound(IEntity e, int soundID) => PlaySound(e.Location, e.Map, soundID); diff --git a/Projects/Server/ExpansionInfo.cs b/Projects/Server/ExpansionInfo.cs index 288a89e6a..48020fdea 100644 --- a/Projects/Server/ExpansionInfo.cs +++ b/Projects/Server/ExpansionInfo.cs @@ -47,7 +47,7 @@ public enum ClientFlags Malas = 0x00000008, Tokuno = 0x00000010, TerMur = 0x00000020, - Unk1 = 0x00000040, + KR = 0x00000040, Unk2 = 0x00000080, UOTD = 0x00000100 } @@ -108,7 +108,7 @@ public enum CharacterListFlags SixthCharacterSlot = 0x00000040, SE = 0x00000080, ML = 0x00000100, - Unk2 = 0x00000200, + KR = 0x00000200, UO3DClientType = 0x00000400, Unk3 = 0x00000800, SeventhCharacterSlot = 0x00001000, diff --git a/Projects/Server/Network/NetState/NetState.ClientVersion.cs b/Projects/Server/Network/NetState/NetState.ClientVersion.cs index 33ca6ddce..b852dbe4d 100644 --- a/Projects/Server/Network/NetState/NetState.ClientVersion.cs +++ b/Projects/Server/Network/NetState/NetState.ClientVersion.cs @@ -28,32 +28,9 @@ public partial class NetState public ClientVersion Version { get => _version; - set => ProtocolChanges = ProtocolChangesByVersion(_version = value); + set => ProtocolChanges = (_version = value)?.ProtocolChanges ?? ProtocolChanges.None; } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ProtocolChanges ProtocolChangesByVersion(ClientVersion version) => - version switch - { - var v when v >= ClientVersion.Version70610 => ProtocolChanges.Version70610, - var v when v >= ClientVersion.Version70500 => ProtocolChanges.Version70500, - var v when v >= ClientVersion.Version704565 => ProtocolChanges.Version704565, - var v when v >= ClientVersion.Version70331 => ProtocolChanges.Version70331, - var v when v >= ClientVersion.Version70300 => ProtocolChanges.Version70300, - var v when v >= ClientVersion.Version70160 => ProtocolChanges.Version70160, - var v when v >= ClientVersion.Version70130 => ProtocolChanges.Version70130, - var v when v >= ClientVersion.Version7090 => ProtocolChanges.Version7090, - var v when v >= ClientVersion.Version7000 => ProtocolChanges.Version7000, - var v when v >= ClientVersion.Version60142 => ProtocolChanges.Version60142, - var v when v >= ClientVersion.Version6017 => ProtocolChanges.Version6017, - var v when v >= ClientVersion.Version6000 => ProtocolChanges.Version6000, - var v when v >= ClientVersion.Version502b => ProtocolChanges.Version502b, - var v when v >= ClientVersion.Version500a => ProtocolChanges.Version500a, - var v when v >= ClientVersion.Version407a => ProtocolChanges.Version407a, - var v when v >= ClientVersion.Version400a => ProtocolChanges.Version400a, - _ => ProtocolChanges.None - }; - [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool HasProtocolChanges(ProtocolChanges changes) => (ProtocolChanges & changes) != 0; @@ -72,10 +49,10 @@ public partial class NetState public bool NewMobileIncoming => HasProtocolChanges(ProtocolChanges.NewMobileIncoming); public bool NewSecureTrading => HasProtocolChanges(ProtocolChanges.NewSecureTrading); - public bool IsUOTDClient => - (Flags & ClientFlags.UOTD) != 0 || _version?.Type == ClientType.UOTD; - + public bool IsUOTDClient => HasFlag(ClientFlags.UOTD) || _version?.Type == ClientType.UOTD; + public bool IsKRClient => _version?.Type == ClientType.KR; public bool IsSAClient => _version?.Type == ClientType.SA; + public bool IsEnhancedClient => _version?.Type is ClientType.KR or ClientType.SA; private ExpansionInfo m_Expansion; @@ -89,7 +66,14 @@ public partial class NetState { var info = ExpansionInfo.Table[i]; - if (info.RequiredClient != null && Version >= info.RequiredClient || (Flags & info.ClientFlags) != 0) + // KR sends same client flags as EC + if (IsKRClient && (info.ClientFlags & ClientFlags.TerMur) != 0) + { + continue; + } + + if ((info.RequiredClient == null || !IsKRClient) && + Version >= info.RequiredClient || HasFlag(info.ClientFlags)) { m_Expansion = info; break; diff --git a/Projects/UOContent/Engines/Help/PageQueueGump.cs b/Projects/UOContent/Engines/Help/PageQueueGump.cs index 2289e0ad9..878a546f5 100644 --- a/Projects/UOContent/Engines/Help/PageQueueGump.cs +++ b/Projects/UOContent/Engines/Help/PageQueueGump.cs @@ -24,8 +24,15 @@ namespace Server.Engines.Help AddBackground(0, 0, 92, 75, 0xA3C); - AddImageTiled(5, 7, 82, 61, 0xA40); - AddAlphaRegion(5, 7, 82, 61); + if (mobile?.NetState?.IsEnhancedClient == true) + { + AddBackground(5, 7, 82, 61, 9300); + } + else + { + AddImageTiled(5, 7, 82, 61, 0xA40); + AddAlphaRegion(5, 7, 82, 61); + } AddImageTiled(9, 11, 21, 53, 0xBBC); @@ -230,8 +237,15 @@ namespace Server.Engines.Help if (response == null) { - AddImageTiled(0, 0, 410, 448, 0xA40); - AddAlphaRegion(1, 1, 408, 446); + if (from.NetState?.IsEnhancedClient == true) + { + AddBackground(1, 1, 408, 446, 9300); + } + else + { + AddImageTiled(0, 0, 410, 448, 0xA40); + AddAlphaRegion(1, 1, 408, 446); + } AddHtml(10, 10, 390, 20, Color(Center("Predefined Responses"), LabelColor32)); @@ -300,7 +314,15 @@ namespace Server.Engines.Help else if (canEdit) { AddImageTiled(0, 0, 410, 250, 0xA40); - AddAlphaRegion(1, 1, 408, 248); + + if (from.NetState?.IsEnhancedClient == true) + { + AddBackground(1, 1, 408, 248, 9300); + } + else + { + AddAlphaRegion(1, 1, 408, 248); + } AddHtml(10, 10, 390, 20, Color(Center("Predefined Response Editor"), LabelColor32)); @@ -472,8 +494,15 @@ namespace Server.Engines.Help AddPage(0); - AddImageTiled(0, 0, 410, 456, 0xA40); - AddAlphaRegion(1, 1, 408, 454); + if (m.NetState?.IsEnhancedClient == true) + { + AddBackground(1, 1, 408, 454, 9300); + } + else + { + AddImageTiled(0, 0, 410, 456, 0xA40); + AddAlphaRegion(1, 1, 408, 454); + } AddPage(1); diff --git a/Projects/UOContent/Gumps/ClientGump.cs b/Projects/UOContent/Gumps/ClientGump.cs index d8e1a2a54..28cb10b80 100644 --- a/Projects/UOContent/Gumps/ClientGump.cs +++ b/Projects/UOContent/Gumps/ClientGump.cs @@ -44,7 +44,7 @@ namespace Server.Gumps 36 + line++ * 20, 200, 20, - Color(state.Version?.SourceString ?? "(null)", LabelColor32) + Color(state.Version?.ToString().DefaultIfNullOrEmpty("(null)"), LabelColor32) ); AddHtml(14, 36 + line * 20, 200, 20, Color("Assistant:", LabelColor32)); diff --git a/Projects/UOContent/Items/Games/Mahjong/MahjongPackets.cs b/Projects/UOContent/Items/Games/Mahjong/MahjongPackets.cs index ae9550811..16bfd75b7 100644 --- a/Projects/UOContent/Items/Games/Mahjong/MahjongPackets.cs +++ b/Projects/UOContent/Items/Games/Mahjong/MahjongPackets.cs @@ -242,7 +242,7 @@ namespace Server.Engines.Mahjong int number = reader.ReadByte(); - if (number < 0 || number >= game.Tiles.Length) + if (number >= game.Tiles.Length) { return; } diff --git a/Projects/UOContent/Items/Skill Items/Magical/Misc/Moongate.cs b/Projects/UOContent/Items/Skill Items/Magical/Misc/Moongate.cs index 7ee010cca..fc2c816ec 100644 --- a/Projects/UOContent/Items/Skill Items/Magical/Misc/Moongate.cs +++ b/Projects/UOContent/Items/Skill Items/Magical/Misc/Moongate.cs @@ -99,7 +99,8 @@ public partial class Moongate : Item else if (m.Kills >= 5 && TargetMap != Map.Felucca || TargetMap == Map.Tokuno && (flags & ClientFlags.Tokuno) == 0 || TargetMap == Map.Malas && (flags & ClientFlags.Malas) == 0 || - TargetMap == Map.Ilshenar && (flags & ClientFlags.Ilshenar) == 0) + TargetMap == Map.Ilshenar && (flags & ClientFlags.Ilshenar) == 0 || + TargetMap == Map.TerMur && (flags & ClientFlags.TerMur) == 0) { m.SendLocalizedMessage(1019004); // You are not allowed to travel there. } diff --git a/Projects/UOContent/Misc/ClientVerification.cs b/Projects/UOContent/Misc/ClientVerification.cs index 8a1e30610..af7555796 100644 --- a/Projects/UOContent/Misc/ClientVerification.cs +++ b/Projects/UOContent/Misc/ClientVerification.cs @@ -1,4 +1,5 @@ using System; +using System.Numerics; using Server.Gumps; using Server.Logging; using Server.Mobiles; @@ -17,12 +18,17 @@ namespace Server.Misc private static TimeSpan _ageLeniency; private static TimeSpan _gameTimeLeniency; + private static string _allowedClientsMessage; + + public static ClientType AllowedClientTypes { get; private set; } + + public static bool AllowClassic => (AllowedClientTypes & ClientType.Classic) != 0; + public static bool AllowUOTD => (AllowedClientTypes & ClientType.UOTD) != 0; + public static bool AllowKR => (AllowedClientTypes & ClientType.KR) != 0; + public static bool AllowSA => (AllowedClientTypes & ClientType.SA) != 0; public static ClientVersion MinRequired { get; private set; } public static ClientVersion MaxRequired { get; private set; } - - public static bool AllowRegular => true; - public static bool AllowUOTD => false; public static TimeSpan KickDelay { get; private set; } public static void Configure() @@ -39,6 +45,8 @@ namespace Server.Misc TimeSpan.FromHours(25) ); KickDelay = ServerConfiguration.GetOrUpdateSetting("clientVerification.kickDelay", TimeSpan.FromSeconds(20.0)); + AllowedClientTypes = ServerConfiguration.GetSetting("clientVerification.allowedClientTypes", ClientType.Classic | ClientType.SA); + _allowedClientsMessage = GetAllowedClientsString(AllowedClientTypes); } public static void Initialize() @@ -81,6 +89,34 @@ namespace Server.Misc return _versionExpression; } + private static string GetAllowedClientsString(ClientType allowedClients) + { + // Get total number of allowed clients + var totalAllowedClients = BitOperations.PopCount((uint)allowedClients) - 1; + if (totalAllowedClients == 0) + { + return "There are no clients supported at this time."; + } + + using var builder = ValueStringBuilder.Create(); + builder.Append("Please connect with a "); + uint flags = 0; + var i = 0; + while (flags < (uint)allowedClients) + { + flags = 1u << i; + if (i > 0) + { + builder.Append(i == totalAllowedClients ? " or " : ", "); + } + + builder.Append(((ClientType)flags).TypeName()); + i++; + } + + return builder.ToString(); + } + private static void EventSink_ClientVersionReceived(NetState state, ClientVersion version) { var sb = ValueStringBuilder.Create(); @@ -97,22 +133,23 @@ namespace Server.Misc mobile.GameTime > _gameTimeLeniency; bool shouldKick = false; + bool isKRClient = version.Type == ClientType.KR; - if (MinRequired != null && version < MinRequired) + if (!isKRClient && MinRequired != null && version < MinRequired) { sb.Append($"This server doesn't support clients older than {MinRequired}."); shouldKick = strictRequirement; } - else if (MaxRequired != null && version > MaxRequired) + else if (!isKRClient && MaxRequired != null && version > MaxRequired) { sb.Append($"This server doesn't support clients newer than {MaxRequired}."); shouldKick = strictRequirement; } - else if (!AllowRegular || !AllowUOTD) + else { - if (!AllowRegular && version.Type == ClientType.Regular) + if (!AllowClassic && version.Type == ClientType.Classic) { - sb.Append("This server does not allow regular clients to connect."); + sb.Append("This server does not allow classic clients to connect."); shouldKick = true; } else if (!AllowUOTD && state.IsUOTDClient) @@ -120,21 +157,20 @@ namespace Server.Misc sb.Append("This server does not allow UO:TD clients to connect."); shouldKick = true; } + else if (!AllowKR && version.Type == ClientType.KR) + { + sb.Append("This server does not allow UO:KR clients to connect."); + shouldKick = true; + } + else if (!AllowSA && version.Type == ClientType.SA) + { + sb.Append("This server does not allow UO:SA clients to connect."); + shouldKick = true; + } if (sb.Length > 0) { - if (AllowRegular && AllowUOTD) - { - sb.Append(" You can use regular or UO:TD clients."); - } - else if (AllowRegular) - { - sb.Append(" You can use regular clients."); - } - else if (AllowUOTD) - { - sb.Append(" You can use UO:TD clients."); - } + sb.Append(_allowedClientsMessage); } } diff --git a/Projects/UOContent/Spells/Base/Spell.cs b/Projects/UOContent/Spells/Base/Spell.cs index 3f50ee9d4..8b03d34c0 100644 --- a/Projects/UOContent/Spells/Base/Spell.cs +++ b/Projects/UOContent/Spells/Base/Spell.cs @@ -455,8 +455,6 @@ namespace Server.Spells } } - private static ClientVersion _insufficientManaClientChange = new ClientVersion("7.0.65.4"); - public bool Cast() { StartCastTime = Core.TickCount; @@ -577,7 +575,7 @@ namespace Server.Spells return true; } } - else if (Caster.NetState?.Version >= _insufficientManaClientChange) + else if (Caster.NetState?.IsKRClient != true && Caster.NetState?.Version >= ClientVersion.Version70654) { // Insufficient mana. You must have at least ~1_MANA_REQUIREMENT~ Mana to use this spell. Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625, requiredMana.ToString());