mirror of
https://github.com/ServUO/ServUO
synced 2026-08-11 20:23:04 -04:00
+ Add MONO to Makefile compile definitions. + Update Ultima SDK to support MONO compile definition. + Rename Properties Gump parent directory to prevent VS issues. + Console error messages will now use red instead of dark red font. + Add crash state handler function to Core. + AI optimizations and housekeeping. + Context Menu optimizations and housekeeping. + Add ability to drop throttled packets. + Add string parsing support to Rectangle3D. + Optimize guild messages and chat. + IAddon implements IChopable. + Add more flexibility for altering Mobile names. + Add ability to enable or disable OPL for individual mobiles. + Optimize damaging regions and ensure timers are removed properly. + Update Welcome Timer with more intuitive message groups. + Normalize all virtue related objects to the Server.Services.Virtues namespace. + Add ability for ISpawner to append OPL and Context Menus to their spawn. + Add EventSink events for obtaining items, equipping items, context menus, and world broadcasts. + Add ability to lock a creature's direction and movement regardless of AI manipulation. + Add ability to dynamically change a creature's approach range and wait state. + Add extended enumeration features for AOS attributes. + Add ability to control whether creatures have blood, and its color. + Expose corpse flag manipulation methods. + Add ability to prevent criminal action when looting a corpse. + Corpse will now be permanently tagged as murderer at time of death if owner is a murderer. + Add TextDefinition support for Commodity Deed descriptions. + House add-on and component optimizations and housekeeping. + Item light is no longer backed by the direction property. + ITool implements IEntity. + Prevent trading of Siege Bless items. + Guards are naturally be immune to guards. + Siege Shard initialization housekeeping. + Character Creation housekeeping. + Generic commands housekeeping. + Add Mark command for staff.
313 lines
No EOL
6 KiB
C#
313 lines
No EOL
6 KiB
C#
#region References
|
|
using System;
|
|
using System.Collections;
|
|
using System.Text;
|
|
#endregion
|
|
|
|
namespace Server
|
|
{
|
|
public enum ClientType
|
|
{
|
|
Regular,
|
|
UOTD,
|
|
God,
|
|
SA
|
|
}
|
|
|
|
public class ClientVersion : IComparable, IComparer
|
|
{
|
|
private readonly int m_Major;
|
|
private readonly int m_Minor;
|
|
private readonly int m_Revision;
|
|
private readonly int m_Patch;
|
|
private readonly ClientType m_Type;
|
|
private readonly string m_SourceString;
|
|
|
|
public int Major { get { return m_Major; } }
|
|
|
|
public int Minor { get { return m_Minor; } }
|
|
|
|
public int Revision { get { return m_Revision; } }
|
|
|
|
public int Patch { get { return m_Patch; } }
|
|
|
|
public ClientType Type { get { return m_Type; } }
|
|
|
|
public string SourceString { get { return m_SourceString; } }
|
|
|
|
public ClientVersion(int maj, int min, int rev, int pat)
|
|
: this(maj, min, rev, pat, ClientType.Regular)
|
|
{ }
|
|
|
|
public ClientVersion(int maj, int min, int rev, int pat, ClientType type)
|
|
{
|
|
m_Major = maj;
|
|
m_Minor = min;
|
|
m_Revision = rev;
|
|
m_Patch = pat;
|
|
m_Type = type;
|
|
|
|
if (m_Type != ClientType.SA && m_Major >= 67)
|
|
{
|
|
m_Type = ClientType.SA;
|
|
}
|
|
|
|
m_SourceString = _ToStringImpl();
|
|
}
|
|
|
|
public static bool operator ==(ClientVersion l, ClientVersion r)
|
|
{
|
|
return (Compare(l, r) == 0);
|
|
}
|
|
|
|
public static bool operator !=(ClientVersion l, ClientVersion r)
|
|
{
|
|
return (Compare(l, r) != 0);
|
|
}
|
|
|
|
public static bool operator >=(ClientVersion l, ClientVersion r)
|
|
{
|
|
return (Compare(l, r) >= 0);
|
|
}
|
|
|
|
public static bool operator >(ClientVersion l, ClientVersion r)
|
|
{
|
|
return (Compare(l, r) > 0);
|
|
}
|
|
|
|
public static bool operator <=(ClientVersion l, ClientVersion r)
|
|
{
|
|
return (Compare(l, r) <= 0);
|
|
}
|
|
|
|
public static bool operator <(ClientVersion l, ClientVersion r)
|
|
{
|
|
return (Compare(l, r) < 0);
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return m_Major ^ m_Minor ^ m_Revision ^ m_Patch ^ (int)m_Type;
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
if (obj == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
ClientVersion v = obj as ClientVersion;
|
|
|
|
if (v == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return m_Major == v.m_Major && m_Minor == v.m_Minor && m_Revision == v.m_Revision && m_Patch == v.m_Patch &&
|
|
m_Type == v.m_Type;
|
|
}
|
|
|
|
private string _ToStringImpl()
|
|
{
|
|
StringBuilder builder = new StringBuilder(16);
|
|
|
|
builder.Append(m_Major);
|
|
builder.Append('.');
|
|
builder.Append(m_Minor);
|
|
builder.Append('.');
|
|
builder.Append(m_Revision);
|
|
|
|
if (m_Major <= 5 && m_Minor <= 0 && m_Revision <= 6) //Anything before 5.0.7
|
|
{
|
|
if (m_Patch > 0)
|
|
{
|
|
builder.Append((char)('a' + (m_Patch - 1)));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
builder.Append('.');
|
|
builder.Append(m_Patch);
|
|
}
|
|
|
|
if (m_Type != ClientType.Regular)
|
|
{
|
|
builder.Append(' ');
|
|
builder.Append(m_Type.ToString());
|
|
}
|
|
|
|
return builder.ToString();
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return _ToStringImpl();
|
|
}
|
|
|
|
public ClientVersion(string fmt)
|
|
{
|
|
m_SourceString = fmt;
|
|
|
|
try
|
|
{
|
|
fmt = fmt.ToLower();
|
|
|
|
int br1 = fmt.IndexOf('.');
|
|
int br2 = fmt.IndexOf('.', br1 + 1);
|
|
|
|
int br3 = br2 + 1;
|
|
while (br3 < fmt.Length && Char.IsDigit(fmt, br3))
|
|
{
|
|
br3++;
|
|
}
|
|
|
|
m_Major = Utility.ToInt32(fmt.Substring(0, br1));
|
|
m_Minor = Utility.ToInt32(fmt.Substring(br1 + 1, br2 - br1 - 1));
|
|
m_Revision = Utility.ToInt32(fmt.Substring(br2 + 1, br3 - br2 - 1));
|
|
|
|
if (br3 < fmt.Length)
|
|
{
|
|
if (m_Major <= 5 && m_Minor <= 0 && m_Revision <= 6) //Anything before 5.0.7
|
|
{
|
|
if (!Char.IsWhiteSpace(fmt, br3))
|
|
{
|
|
m_Patch = (fmt[br3] - 'a') + 1;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
m_Patch = Utility.ToInt32(fmt.Substring(br3 + 1, fmt.Length - br3 - 1));
|
|
}
|
|
}
|
|
|
|
if (m_Major >= 67)
|
|
{
|
|
m_Type = ClientType.SA;
|
|
}
|
|
else if(fmt.IndexOf("god") >= 0 || fmt.IndexOf("gq") >= 0)
|
|
{
|
|
m_Type = ClientType.God;
|
|
}
|
|
else if (fmt.IndexOf("third dawn") >= 0 || fmt.IndexOf("uo:td") >= 0 || fmt.IndexOf("uotd") >= 0 ||
|
|
fmt.IndexOf("uo3d") >= 0 || fmt.IndexOf("uo:3d") >= 0)
|
|
{
|
|
m_Type = ClientType.UOTD;
|
|
}
|
|
else
|
|
{
|
|
m_Type = ClientType.Regular;
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
m_Major = 0;
|
|
m_Minor = 0;
|
|
m_Revision = 0;
|
|
m_Patch = 0;
|
|
m_Type = ClientType.Regular;
|
|
}
|
|
}
|
|
|
|
public int CompareTo(object obj)
|
|
{
|
|
if (obj == null)
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
ClientVersion o = obj as ClientVersion;
|
|
|
|
if (o == null)
|
|
{
|
|
throw new ArgumentException();
|
|
}
|
|
|
|
if (m_Major > o.m_Major)
|
|
{
|
|
return 1;
|
|
}
|
|
else if (m_Major < o.m_Major)
|
|
{
|
|
return -1;
|
|
}
|
|
else if (m_Minor > o.m_Minor)
|
|
{
|
|
return 1;
|
|
}
|
|
else if (m_Minor < o.m_Minor)
|
|
{
|
|
return -1;
|
|
}
|
|
else if (m_Revision > o.m_Revision)
|
|
{
|
|
return 1;
|
|
}
|
|
else if (m_Revision < o.m_Revision)
|
|
{
|
|
return -1;
|
|
}
|
|
else if (m_Patch > o.m_Patch)
|
|
{
|
|
return 1;
|
|
}
|
|
else if (m_Patch < o.m_Patch)
|
|
{
|
|
return -1;
|
|
}
|
|
else
|
|
{
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
public static bool IsNull(object x)
|
|
{
|
|
return ReferenceEquals(x, null);
|
|
}
|
|
|
|
public int Compare(object x, object y)
|
|
{
|
|
if (IsNull(x) && IsNull(y))
|
|
{
|
|
return 0;
|
|
}
|
|
else if (IsNull(x))
|
|
{
|
|
return -1;
|
|
}
|
|
else if (IsNull(y))
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
ClientVersion a = x as ClientVersion;
|
|
ClientVersion b = y as ClientVersion;
|
|
|
|
if (IsNull(a) || IsNull(b))
|
|
{
|
|
throw new ArgumentException();
|
|
}
|
|
|
|
return a.CompareTo(b);
|
|
}
|
|
|
|
public static int Compare(ClientVersion a, ClientVersion b)
|
|
{
|
|
if (IsNull(a) && IsNull(b))
|
|
{
|
|
return 0;
|
|
}
|
|
else if (IsNull(a))
|
|
{
|
|
return -1;
|
|
}
|
|
else if (IsNull(b))
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
return a.CompareTo(b);
|
|
}
|
|
}
|
|
} |