Modernization Fixes & Updates to Default Values (#3)

This commit is contained in:
Kamron Batman 2018-10-28 00:33:16 -07:00 • committed by GitHub
parent 445eddff68
commit dcf64091b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
768 changed files with 10507 additions and 14196 deletions

View file

@ -11,7 +11,6 @@ namespace Server.Engines.MyRunUO
private string m_ConnectionString;
private Queue m_Queue;
private ManualResetEvent m_Sync;
private Thread m_Thread;
public DatabaseCommandQueue(string completionString, string threadName) : this(Config.CompileConnectionString(),
completionString, threadName)
@ -35,10 +34,9 @@ namespace Server.Engines.MyRunUO
m_Sync = new ManualResetEvent(true);
m_Thread = new Thread(Thread_Start);
m_Thread.Name = threadName; //"MyRunUO Database Command Queue";
m_Thread.Priority = Config.DatabaseThreadPriority;
m_Thread.Start();
// MyRunUO Database Command Queue;
Thread thread = new Thread(Thread_Start) { Name = threadName, Priority = Config.DatabaseThreadPriority };
thread.Start();
}
public bool HasCompleted{ get; private set; }
@ -54,6 +52,7 @@ namespace Server.Engines.MyRunUO
}
catch
{
// ignored
}
}
}
@ -111,6 +110,7 @@ namespace Server.Engines.MyRunUO
}
catch
{
// ignored
}
try
@ -119,6 +119,7 @@ namespace Server.Engines.MyRunUO
}
catch
{
// ignored
}
try
@ -127,6 +128,7 @@ namespace Server.Engines.MyRunUO
}
catch
{
// ignored
}
try
@ -135,6 +137,7 @@ namespace Server.Engines.MyRunUO
}
catch
{
// ignored
}
Console.WriteLine(m_CompletionString, (DateTime.UtcNow - start).TotalSeconds);
@ -164,6 +167,7 @@ namespace Server.Engines.MyRunUO
}
catch
{
// ignored
}
try
@ -172,6 +176,7 @@ namespace Server.Engines.MyRunUO
}
catch
{
// ignored
}
try
@ -180,6 +185,7 @@ namespace Server.Engines.MyRunUO
}
catch
{
// ignored
}
try
@ -188,6 +194,7 @@ namespace Server.Engines.MyRunUO
}
catch
{
// ignored
}
try
@ -196,6 +203,7 @@ namespace Server.Engines.MyRunUO
}
catch
{
// ignored
}
Console.WriteLine("MyRunUO: Unable to connect to the database");

View file

@ -1,8 +1,8 @@
using System.Collections;
using System.Collections.Generic;
namespace Server.Engines.MyRunUO
{
public class LayerComparer : IComparer
public class LayerComparer : IComparer<Item>
{
private static Layer PlateArms = (Layer)255;
private static Layer ChainTunic = (Layer)254;
@ -36,7 +36,7 @@ namespace Server.Engines.MyRunUO
Layer.Talisman
};
public static readonly IComparer Instance = new LayerComparer();
public static readonly IComparer<Item> Instance = new LayerComparer();
static LayerComparer()
{
@ -48,16 +48,16 @@ namespace Server.Engines.MyRunUO
public static int[] TranslationTable{ get; }
public int Compare(object x, object y)
public int Compare(Item a, Item b)
{
Item a = (Item)x;
Item b = (Item)y;
Layer aLayer = a.Layer;
Layer bLayer = b.Layer;
aLayer = Fix(a.ItemID, aLayer);
bLayer = Fix(b.ItemID, bLayer);
if (a == null)
return b == null ? 0 : 1;
if (b == null)
return -1;
Layer aLayer = Fix(a.ItemID, a.Layer);
Layer bLayer = Fix(b.ItemID, b.Layer);
return TranslationTable[(int)bLayer] - TranslationTable[(int)aLayer];
}
@ -75,10 +75,7 @@ namespace Server.Engines.MyRunUO
if (itemID == 0x13BF || itemID == 0x13C4) // chainmail tunic
return ChainTunic;
if (itemID == 0x1C08 || itemID == 0x1C09) // leather skirt
return LeatherShorts;
if (itemID == 0x1C00 || itemID == 0x1C01) // leather shorts
if (itemID == 0x1C08 || itemID == 0x1C09 || itemID == 0x1C00 || itemID == 0x1C01) // leather skirt/shorts
return LeatherShorts;
return oldLayer;

View file

@ -25,11 +25,11 @@ namespace Server.Engines.MyRunUO
private static DatabaseCommandQueue m_Command;
private static ArrayList m_MobilesToUpdate = new ArrayList();
private static List<Mobile> m_MobilesToUpdate = new List<Mobile>();
private List<IAccount> m_Collecting;
private int m_Index;
private ArrayList m_Items = new ArrayList();
private List<Item> m_Items = new List<Item>();
private string m_LayersPath;
private ArrayList m_List;
private string m_MobilesPath;
@ -182,7 +182,7 @@ namespace Server.Engines.MyRunUO
protected override void OnTick()
{
bool shouldExit = false;
bool shouldExit;
try
{
@ -271,8 +271,8 @@ namespace Server.Engines.MyRunUO
}
else
{
m_List = m_MobilesToUpdate;
m_MobilesToUpdate = new ArrayList();
m_List = new ArrayList(m_MobilesToUpdate);
m_MobilesToUpdate = new List<Mobile>();
m_Stage = Stage.DumpingMobiles;
m_Index = 0;
}
@ -282,7 +282,7 @@ namespace Server.Engines.MyRunUO
{
if (m_Command == null)
{
m_Command = new DatabaseCommandQueue("MyRunUO: Characeter database updated in {0:F1} seconds",
m_Command = new DatabaseCommandQueue("MyRunUO: Character database updated in {0:F1} seconds",
"MyRunUO Character Database Thread");
if (Config.LoadDataInFile)
@ -306,7 +306,7 @@ namespace Server.Engines.MyRunUO
m_Command.Enqueue(text);
}
public void ExecuteNonQuery(string format, params string[] args)
public void ExecuteNonQuery(string format, params object[] args)
{
ExecuteNonQuery(string.Format(format, args));
}
@ -320,10 +320,7 @@ namespace Server.Engines.MyRunUO
{
if (sb == null)
{
if (charIndex > 0)
sb = new StringBuilder(input, 0, charIndex, input.Length + 20);
else
sb = new StringBuilder(input.Length + 20);
sb = charIndex > 0 ? new StringBuilder(input, 0, charIndex, input.Length + 20) : new StringBuilder(input.Length + 20);
}
sb.Append("&#");
@ -335,10 +332,7 @@ namespace Server.Engines.MyRunUO
{
if (sb == null)
{
if (charIndex > 0)
sb = new StringBuilder(input, 0, charIndex, input.Length + 20);
else
sb = new StringBuilder(input.Length + 20);
sb = charIndex > 0 ? new StringBuilder(input, 0, charIndex, input.Length + 20) : new StringBuilder(input.Length + 20);
}
sb.Append(ent);
@ -387,10 +381,7 @@ namespace Server.Engines.MyRunUO
}
}
if (sb != null)
return sb.ToString();
return input;
return sb != null ? sb.ToString() : input;
}
public void InsertMobile(Mobile mob)
@ -504,7 +495,7 @@ namespace Server.Engines.MyRunUO
public void InsertItems(Mobile mob)
{
ArrayList items = m_Items;
List<Item> items = m_Items;
items.AddRange(mob.Items);
string serial = mob.Serial.Value.ToString();
@ -518,7 +509,7 @@ namespace Server.Engines.MyRunUO
for (int i = 0; i < items.Count; ++i)
{
Item item = (Item)items[i];
Item item = items[i];
if (!LayerComparer.IsValid(item))
break;
@ -541,7 +532,7 @@ namespace Server.Engines.MyRunUO
InsertItem(serial, index++, mob.FacialHairItemID, mob.FacialHairHue);
if (mob.HairItemID != 0 && !hideHair)
InsertItem(serial, index++, mob.HairItemID, mob.HairHue);
InsertItem(serial, index, mob.HairItemID, mob.HairHue);
items.Clear();
}
@ -573,6 +564,7 @@ namespace Server.Engines.MyRunUO
}
catch
{
// ignored
}
}

View file

@ -39,7 +39,6 @@ namespace Server.Engines.MyRunUO
if (m_Command != null && !m_Command.HasCompleted)
return;
DateTime start = DateTime.UtcNow;
Console.WriteLine("MyRunUO: Updating status database");
try