Reorganizes Project (#41)
This commit is contained in:
parent
08bf44af9a
commit
3614a66aee
3499 changed files with 79 additions and 55 deletions
52
Projects/Scripts/Engines/MyRunUO/Config.cs
Normal file
52
Projects/Scripts/Engines/MyRunUO/Config.cs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace Server.Engines.MyRunUO
|
||||
{
|
||||
public class Config
|
||||
{
|
||||
// Details required for database connection string
|
||||
public const string DatabaseDriver = "{MySQL ODBC 5.2w Driver}";
|
||||
public const string DatabaseServer = "localhost";
|
||||
public const string DatabaseName = "MyRunUO";
|
||||
public const string DatabaseUserID = "username";
|
||||
|
||||
public const string DatabasePassword = "password";
|
||||
|
||||
// Is MyRunUO enabled?
|
||||
public static bool Enabled = false;
|
||||
|
||||
// Should the database use transactions? This is recommended
|
||||
public static bool UseTransactions = true;
|
||||
|
||||
// Use optimized table loading techniques? (LOAD DATA INFILE)
|
||||
public static bool LoadDataInFile = true;
|
||||
|
||||
// This must be enabled if the database server is on a remote machine.
|
||||
public static bool DatabaseNonLocal = DatabaseServer != "localhost";
|
||||
|
||||
// Text encoding used
|
||||
public static Encoding EncodingIO = Encoding.ASCII;
|
||||
|
||||
// Database communication is done in a separate thread. This value is the 'priority' of that thread, or, how much CPU it will try to use
|
||||
public static ThreadPriority DatabaseThreadPriority = ThreadPriority.BelowNormal;
|
||||
|
||||
// Any character with an AccessLevel equal to or higher than this will not be displayed
|
||||
public static AccessLevel HiddenAccessLevel = AccessLevel.Counselor;
|
||||
|
||||
// Export character database every 30 minutes
|
||||
public static TimeSpan CharacterUpdateInterval = TimeSpan.FromMinutes(30.0);
|
||||
|
||||
// Export online list database every 5 minutes
|
||||
public static TimeSpan StatusUpdateInterval = TimeSpan.FromMinutes(5.0);
|
||||
|
||||
public static string CompileConnectionString()
|
||||
{
|
||||
string connectionString =
|
||||
$"DRIVER={DatabaseDriver};SERVER={DatabaseServer};DATABASE={DatabaseName};UID={DatabaseUserID};PASSWORD={DatabasePassword};";
|
||||
|
||||
return connectionString;
|
||||
}
|
||||
}
|
||||
}
|
||||
84
Projects/Scripts/Engines/MyRunUO/LayerComparer.cs
Normal file
84
Projects/Scripts/Engines/MyRunUO/LayerComparer.cs
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Engines.MyRunUO
|
||||
{
|
||||
public class LayerComparer : IComparer<Item>
|
||||
{
|
||||
private static Layer PlateArms = (Layer)255;
|
||||
private static Layer ChainTunic = (Layer)254;
|
||||
private static Layer LeatherShorts = (Layer)253;
|
||||
|
||||
private static Layer[] m_DesiredLayerOrder =
|
||||
{
|
||||
Layer.Cloak,
|
||||
Layer.Bracelet,
|
||||
Layer.Ring,
|
||||
Layer.Shirt,
|
||||
Layer.Pants,
|
||||
Layer.InnerLegs,
|
||||
Layer.Shoes,
|
||||
LeatherShorts,
|
||||
Layer.Arms,
|
||||
Layer.InnerTorso,
|
||||
LeatherShorts,
|
||||
PlateArms,
|
||||
Layer.MiddleTorso,
|
||||
Layer.OuterLegs,
|
||||
Layer.Neck,
|
||||
Layer.Waist,
|
||||
Layer.Gloves,
|
||||
Layer.OuterTorso,
|
||||
Layer.OneHanded,
|
||||
Layer.TwoHanded,
|
||||
Layer.FacialHair,
|
||||
Layer.Hair,
|
||||
Layer.Helm,
|
||||
Layer.Talisman
|
||||
};
|
||||
|
||||
public static readonly IComparer<Item> Instance = new LayerComparer();
|
||||
|
||||
static LayerComparer()
|
||||
{
|
||||
TranslationTable = new int[256];
|
||||
|
||||
for (int i = 0; i < m_DesiredLayerOrder.Length; ++i)
|
||||
TranslationTable[(int)m_DesiredLayerOrder[i]] = m_DesiredLayerOrder.Length - i;
|
||||
}
|
||||
|
||||
public static int[] TranslationTable{ get; }
|
||||
|
||||
public int Compare(Item a, Item b)
|
||||
{
|
||||
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];
|
||||
}
|
||||
|
||||
public static bool IsValid(Item item)
|
||||
{
|
||||
return TranslationTable[(int)item.Layer] > 0;
|
||||
}
|
||||
|
||||
public Layer Fix(int itemID, Layer oldLayer)
|
||||
{
|
||||
if (itemID == 0x1410 || itemID == 0x1417) // platemail arms
|
||||
return PlateArms;
|
||||
|
||||
if (itemID == 0x13BF || itemID == 0x13C4) // chainmail tunic
|
||||
return ChainTunic;
|
||||
|
||||
if (itemID == 0x1C08 || itemID == 0x1C09 || itemID == 0x1C00 || itemID == 0x1C01) // leather skirt/shorts
|
||||
return LeatherShorts;
|
||||
|
||||
return oldLayer;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue