Cleanup/Housekeeping (#242)

This commit is contained in:
Kamron Batman 2020-09-12 15:31:21 -07:00 committed by GitHub
parent 90ede0659f
commit 741e8d8300
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
228 changed files with 6292 additions and 2690 deletions

View file

@ -1,23 +1,3 @@
/***************************************************************************
* ClientVersion.cs
* -------------------
* begin : May 1, 2002
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* 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 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
@ -58,7 +38,9 @@ namespace Server
var br3 = br2 + 1;
while (br3 < fmt.Length && char.IsDigit(fmt, br3))
{
br3++;
}
Major = Utility.ToInt32(fmt.Substring(0, br1));
Minor = Utility.ToInt32(fmt.Substring(br1 + 1, br2 - br1 - 1));
@ -69,7 +51,9 @@ namespace Server
if (Major <= 5 && Minor <= 0 && Revision <= 6) // Anything before 5.0.7
{
if (!char.IsWhiteSpace(fmt, br3))
{
Patch = fmt[br3] - 'a' + 1;
}
}
else
{
@ -78,12 +62,18 @@ namespace Server
}
if (fmt.IndexOf("god") >= 0 || fmt.IndexOf("gq") >= 0)
{
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)
{
Type = ClientType.UOTD;
}
else
{
Type = ClientType.Regular;
}
}
catch
{
@ -110,24 +100,50 @@ namespace Server
public int CompareTo(ClientVersion o)
{
if (o == null)
{
return 1;
}
if (Major > o.Major)
{
return 1;
}
if (Major < o.Major)
{
return -1;
}
if (Minor > o.Minor)
{
return 1;
}
if (Minor < o.Minor)
{
return -1;
}
if (Revision > o.Revision)
{
return 1;
}
if (Revision < o.Revision)
{
return -1;
}
if (Patch > o.Patch)
{
return 1;
}
if (Patch < o.Patch)
{
return -1;
}
return 0;
}
@ -171,7 +187,9 @@ namespace Server
if (Major <= 5 && Minor <= 0 && Revision <= 6) // Anything before 5.0.7
{
if (Patch > 0)
{
builder.Append((char)('a' + (Patch - 1)));
}
}
else
{
@ -195,11 +213,19 @@ namespace Server
public static int Compare(ClientVersion a, ClientVersion b)
{
if (IsNull(a) && IsNull(b))
{
return 0;
}
if (IsNull(a))
{
return -1;
}
if (IsNull(b))
{
return 1;
}
return a.CompareTo(b);
}