Inital Commit

This commit is contained in:
Ubuntu
2026-07-07 13:40:15 -04:00
parent 73701ff86e
commit b491e327dc
83 changed files with 8591 additions and 6895 deletions
+2 -45
View File
@@ -4,12 +4,6 @@ using System.Resources;
using System.Runtime.InteropServices;
#endregion
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("ServUO Server")]
[assembly: AssemblyDescription("Ultima Online Server Emulator")]
[assembly: AssemblyConfiguration("")]
@@ -18,46 +12,9 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.5.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyVersion("57.4")]
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en")]
[assembly: NeutralResourcesLanguage("en")]
+1872 -716
View File
File diff suppressed because it is too large Load Diff
+1 -7
View File
@@ -183,13 +183,7 @@ namespace Server.Gumps
Add(new GumpTooltip(number));
}
public void AddTooltipText(string text)
{
Add(new GumpTooltip(text));
}
public void AddHtml(int x, int y, int width, int height, string text, bool background, bool scrollbar)
public void AddHtml(int x, int y, int width, int height, string text, bool background, bool scrollbar)
{
Add(new GumpHtml(x, y, width, height, text, background, scrollbar));
}
+24 -56
View File
@@ -23,69 +23,37 @@ using Server.Network;
namespace Server.Gumps
{
public class GumpTooltip : GumpEntry
{
private int m_Number;
private string m_Text;
public GumpTooltip(int number)
{
m_Number = number;
}
public GumpTooltip(string text)
{
m_Text = text;
}
public class GumpTooltip : GumpEntry
{
private int m_Number;
public GumpTooltip( int number )
{
m_Number = number;
}
public int Number
{
get
{
return m_Number;
}
set
{
Delta(ref m_Number, value);
}
}
public string Text
{
get
{
return m_Text;
}
set
{
Delta(ref m_Text, value);
}
}
{
get
{
return m_Number;
}
set
{
Delta( ref m_Number, value );
}
}
public override string Compile()
{
if (m_Number == 0 && !string.IsNullOrEmpty(m_Text))
{ // if given: use custom text # TODO UNCHECKED -> AppendTo( IGumpWriter disp ) was used!
return String.Format("{{ tooltip {0} @{1}@ }}", 1042971, m_Text);
}
else
{ // default use cliloc localized text
return string.Format("{{ tooltip {0} }}", m_Number);
}
{
return string.Format("{{ tooltip {0} }}", m_Number);
}
private static byte[] m_LayoutName = Gump.StringToBuffer("tooltip");
private static byte[] m_LayoutName = Gump.StringToBuffer( "tooltip" );
public override void AppendTo(IGumpWriter disp)
{
if (m_Number == 0 && !string.IsNullOrEmpty(m_Text))
{ // if given: use custom text replacing placeholder "~1_NOTHING~"
disp.AppendLayout(Gump.StringToBuffer(String.Format("tooltip {0}@{1}@", 1042971, m_Text)));
}
else
{ // default use given cliloc localized text
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_Number);
}
public override void AppendTo( IGumpWriter disp )
{
disp.AppendLayout( m_LayoutName );
disp.AppendLayout( m_Number );
}
}
}
+180 -145
View File
@@ -186,7 +186,7 @@ namespace Server
/// <summary>
/// Unused, using this layer makes you invisible to other players. Strange.
/// </summary>
///
///
Reserved_1 = 0x1E,
/// <summary>
@@ -856,7 +856,7 @@ namespace Server
}
}
}
private byte m_GridLocation = 0;
[CommandProperty(AccessLevel.GameMaster)]
@@ -1261,7 +1261,7 @@ namespace Server
public virtual void AddLootTypeProperty(ObjectPropertyList list)
{
if (DisplayLootType)
{
{
if (m_LootType == LootType.Blessed)
{
list.Add(1038021); // blessed
@@ -1610,7 +1610,7 @@ namespace Server
/// {
/// if ( from.Int &gt;= 100 )
/// return true;
///
///
/// return base.AllowEquipedCast( from );
/// }</code>
/// When placed in an Item script, the item may be cast when equiped if the <paramref name="from" /> has 100 or more intelligence. Otherwise, it will drop to their backpack.
@@ -2137,7 +2137,7 @@ namespace Server
{
return false;
}
else if (Sockets != null && item.Sockets != null)
else if (Sockets != null && item.Sockets != null)
{
if (Sockets.Any(s => !item.HasSocket(s.GetType())))
{
@@ -2515,7 +2515,18 @@ namespace Server
{ }
public virtual void OnAdded(object parent)
{ }
{
// Only enforce insurance when the item is added to a Mobile (player)
if (parent is Mobile newOwner)
{
if (Insured && InsuredBy != Serial.MinusOne && newOwner.Serial != InsuredBy)
{
Insured = false;
InsuredBy = Serial.MinusOne;
newOwner.SendMessage("The insurance on this item has been removed.");
}
}
}
[CommandProperty(AccessLevel.Counselor, AccessLevel.Decorator)]
public Map Map
@@ -2619,16 +2630,16 @@ namespace Server
// 14
writer.Write(Sockets != null ? Sockets.Count : 0);
if(Sockets != null)
{
foreach(var socket in Sockets)
{
ItemSocket.Save(socket, writer);
}
}
// 13: Merge sync
if (Sockets != null)
{
foreach (var socket in Sockets)
{
ItemSocket.Save(socket, writer);
}
}
// 13: Merge sync
// 12: Light no longer backed by Direction
// 11
@@ -3031,6 +3042,7 @@ namespace Server
OnLockDownChange();
}
}
public Serial InsuredBy;
public virtual void OnLockDownChange()
{
@@ -3125,13 +3137,13 @@ namespace Server
case 14:
var socketCount = reader.ReadInt();
for(int i = 0; i < socketCount; i++)
for (int i = 0; i < socketCount; i++)
{
ItemSocket.Load(this, reader);
}
goto case 13;
case 13:
case 13:
case 12:
case 11:
m_GridLocation = reader.ReadByte();
@@ -3185,7 +3197,7 @@ namespace Server
{
m_Light = (LightType)reader.ReadByte();
}
else if(version < 12)
else if (version < 12)
{
m_Light = (LightType)m_Direction;
}
@@ -3721,7 +3733,7 @@ namespace Server
state.Send(OPLPacket);
}
}
protected virtual Packet GetWorldPacketFor(NetState state)
{
if (state.HighSeas)
@@ -4619,7 +4631,7 @@ namespace Server
module.Delete();
}
if(Sockets != null)
if (Sockets != null)
{
Sockets.IterateReverse(socket =>
{
@@ -4722,7 +4734,7 @@ namespace Server
#region Location Location Location!
public virtual void OnLocationChange(Point3D oldLocation)
{
{
var items = Items;
if (items == null)
@@ -4746,7 +4758,7 @@ namespace Server
o.OnParentLocationChange(oldLocation);
}
}
}
}
public virtual void OnParentLocationChange(Point3D oldLocation)
{ }
@@ -4858,7 +4870,7 @@ namespace Server
int oldPileWeight = PileWeight;
m_ItemID = value;
ReleaseWorldPackets();
int newPileWeight = PileWeight;
@@ -4954,6 +4966,29 @@ namespace Server
root.Obtained(this);
}
}
// Character-bound insurance enforcement
if (!World.Loading && Parent is Mobile newOwner)
{
// Murderers cannot have insured items at all
if (newOwner.Murderer)
{
if (Insured)
{
Insured = false;
InsuredBy = Serial.MinusOne;
newOwner.SendMessage("The Insurance Agency will not cover items owned by murderers.");
}
return;
}
// Character-bound insurance enforcement
if (Insured && InsuredBy != Serial.MinusOne && newOwner.Serial != InsuredBy)
{
Insured = false;
InsuredBy = Serial.MinusOne;
newOwner.SendMessage("The insurance on this item has been removed.");
}
}
}
[CommandProperty(AccessLevel.Decorator)]
@@ -5432,12 +5467,12 @@ namespace Server
}
okay = ((m_OpenSlots >> i) & match) == match;
if (okay)
{
z += i;
break;
}
}
}
if (!okay)
{
@@ -6178,7 +6213,7 @@ namespace Server
{
m_Serial = Serial.NewItem;
m_Map = Map.Internal;
m_Light = LightType.Empty;
m_Amount = 1;
@@ -6255,17 +6290,17 @@ namespace Server
public List<ItemSocket> Sockets { get; private set; }
public void AttachSocket(ItemSocket socket)
{
if(Sockets == null)
{
Sockets = new List<ItemSocket>();
}
{
if (Sockets == null)
{
Sockets = new List<ItemSocket>();
}
Sockets.Add(socket);
socket.Owner = this;
InvalidateProperties();
}
Sockets.Add(socket);
socket.Owner = this;
InvalidateProperties();
}
public bool RemoveSocket<T>()
{
@@ -6297,26 +6332,26 @@ namespace Server
InvalidateProperties();
}
public T GetSocket<T>() where T : ItemSocket
{
public T GetSocket<T>() where T : ItemSocket
{
if (Sockets == null)
{
return null;
}
return Sockets.FirstOrDefault(s => s.GetType() == typeof(T)) as T;
}
public T GetSocket<T>(Func<T, bool> predicate) where T : ItemSocket
{
return Sockets.FirstOrDefault(s => s.GetType() == typeof(T)) as T;
}
public T GetSocket<T>(Func<T, bool> predicate) where T : ItemSocket
{
if (Sockets == null)
{
return null;
}
return Sockets.FirstOrDefault(s => s.GetType() == typeof(T) && (predicate == null || predicate(s as T))) as T;
}
return Sockets.FirstOrDefault(s => s.GetType() == typeof(T) && (predicate == null || predicate(s as T))) as T;
}
public ItemSocket GetSocket(Type type)
{
@@ -6329,14 +6364,14 @@ namespace Server
}
public bool HasSocket<T>()
{
{
if (Sockets == null)
{
return false;
}
return Sockets.Any(s => s.GetType() == typeof(T));
}
}
public bool HasSocket(Type t)
{
@@ -6351,71 +6386,71 @@ namespace Server
}
public class ItemSocket
{
[CommandProperty(AccessLevel.GameMaster)]
public Item Owner { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public DateTime Expires { get; set; }
public virtual TimeSpan TickDuration { get { return TimeSpan.FromMinutes(1); } }
public Timer Timer { get; set; }
{
[CommandProperty(AccessLevel.GameMaster)]
public Item Owner { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public DateTime Expires { get; set; }
public virtual TimeSpan TickDuration { get { return TimeSpan.FromMinutes(1); } }
public Timer Timer { get; set; }
public ItemSocket()
: this(TimeSpan.Zero)
{
}
public ItemSocket(TimeSpan duration)
{
if(duration != TimeSpan.Zero)
{
Expires = DateTime.UtcNow + duration;
BeginTimer();
}
}
protected void BeginTimer()
{
EndTimer();
Timer = Timer.DelayCall(TickDuration, TickDuration, OnTick);
public ItemSocket(TimeSpan duration)
{
if (duration != TimeSpan.Zero)
{
Expires = DateTime.UtcNow + duration;
BeginTimer();
}
}
protected void BeginTimer()
{
EndTimer();
Timer = Timer.DelayCall(TickDuration, TickDuration, OnTick);
Timer.Start();
}
protected void EndTimer()
{
if(Timer != null)
{
Timer.Stop();
Timer = null;
}
}
protected virtual void OnTick()
{
if(Expires < DateTime.UtcNow || Owner.Deleted)
{
Remove();
}
}
public virtual void Remove()
{
EndTimer();
Owner.RemoveItemSocket(this);
}
public virtual void OnRemoved()
{
}
public virtual void GetProperties(ObjectPropertyList list)
{
}
}
protected void EndTimer()
{
if (Timer != null)
{
Timer.Stop();
Timer = null;
}
}
protected virtual void OnTick()
{
if (Expires < DateTime.UtcNow || Owner.Deleted)
{
Remove();
}
}
public virtual void Remove()
{
EndTimer();
Owner.RemoveItemSocket(this);
}
public virtual void OnRemoved()
{
}
public virtual void GetProperties(ObjectPropertyList list)
{
}
public virtual void OnOwnerDuped(Item newItem)
{
@@ -6451,46 +6486,46 @@ namespace Server
{
}
public virtual void Serialize(GenericWriter writer)
{
writer.Write(0);
writer.Write(Expires);
}
public virtual void Deserialize(Item owner, GenericReader reader)
{
reader.ReadInt(); // version
Expires = reader.ReadDateTime();
if(Expires != DateTime.MinValue)
{
if(Expires < DateTime.UtcNow)
{
return;
}
else
{
BeginTimer();
}
}
owner.AttachSocket(this);
}
public static void Save(ItemSocket socket, GenericWriter writer)
{
writer.Write(socket.GetType().Name);
socket.Serialize(writer);
}
public static void Load(Item item, GenericReader reader)
{
var typeName = ScriptCompiler.FindTypeByName(reader.ReadString());
public virtual void Serialize(GenericWriter writer)
{
writer.Write(0);
writer.Write(Expires);
}
public virtual void Deserialize(Item owner, GenericReader reader)
{
reader.ReadInt(); // version
Expires = reader.ReadDateTime();
if (Expires != DateTime.MinValue)
{
if (Expires < DateTime.UtcNow)
{
return;
}
else
{
BeginTimer();
}
}
owner.AttachSocket(this);
}
public static void Save(ItemSocket socket, GenericWriter writer)
{
writer.Write(socket.GetType().Name);
socket.Serialize(writer);
}
public static void Load(Item item, GenericReader reader)
{
var typeName = ScriptCompiler.FindTypeByName(reader.ReadString());
var socket = Activator.CreateInstance(typeName) as ItemSocket;
socket.Deserialize(item, reader);
}
}
}
}
+15 -4
View File
@@ -47,8 +47,6 @@ namespace Server
private static DateTime _ProfileStart;
private static TimeSpan _ProfileTime;
public static MessagePump MessagePump { get; set; }
public static Slice Slice;
public static bool Profiling
@@ -453,6 +451,19 @@ namespace Server
Process = Process.GetCurrentProcess();
Assembly = Assembly.GetEntryAssembly();
// Disable Windows-only process priority on Linux/Mono
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
{
try
{
Process.PriorityClass = ProcessPriorityClass.High;
}
catch
{
}
}
if (Thread != null)
{
Thread.Name = "Core Thread";
@@ -641,7 +652,7 @@ namespace Server
ScriptCompiler.Invoke("Initialize");
MessagePump messagePump = MessagePump = new MessagePump();
MessagePump.Start();
_TimerThread.Start();
@@ -671,7 +682,7 @@ namespace Server
Item.ProcessDeltaQueue();
Timer.Slice();
messagePump.Slice();
MessagePump.Slice();
NetState.FlushAll();
NetState.ProcessDisposedQueue();
+4 -4
View File
@@ -268,10 +268,10 @@ namespace Server
bin.Close();
}
}
else
{
Console.WriteLine("Warning: Multi data files not found!");
}
}
else
{
Console.WriteLine("Warning: Multi data files not found!");
}
}
}
+73 -83
View File
@@ -1,108 +1,98 @@
#region References
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
#endregion
namespace Server.Network
{
public class BufferPool
{
public static List<BufferPool> Pools { get; private set; }
public class BufferPool
{
private static readonly ConcurrentDictionary<BufferPool, string> m_Pools = new ConcurrentDictionary<BufferPool, string>();
static BufferPool()
{
Pools = new List<BufferPool>();
}
public static ReadOnlyCollection<BufferPool> Pools => (ReadOnlyCollection<BufferPool>)m_Pools.Keys;
private readonly string m_Name;
private readonly string m_Name;
private readonly int m_InitialCapacity;
private readonly int m_BufferSize;
private readonly int m_InitialCapacity;
private readonly int m_BufferSize;
private int m_Misses;
private volatile int m_Misses;
private readonly Queue<byte[]> m_FreeBuffers;
private readonly ConcurrentQueue<byte[]> m_FreeBuffers = new ConcurrentQueue<byte[]>();
public int Count
{
get
{
lock (this)
return m_FreeBuffers.Count;
}
}
public int Count
{
get
{
return m_FreeBuffers.Count;
}
}
public void GetInfo(
out string name,
out int freeCount,
out int initialCapacity,
out int currentCapacity,
out int bufferSize,
out int misses)
{
lock (this)
{
name = m_Name;
freeCount = m_FreeBuffers.Count;
initialCapacity = m_InitialCapacity;
currentCapacity = m_InitialCapacity * (1 + m_Misses);
bufferSize = m_BufferSize;
misses = m_Misses;
}
}
public void GetInfo(
out string name,
out int freeCount,
out int initialCapacity,
out int currentCapacity,
out int bufferSize,
out int misses)
{
name = m_Name;
freeCount = m_FreeBuffers.Count;
initialCapacity = m_InitialCapacity;
currentCapacity = m_InitialCapacity * (1 + m_Misses);
bufferSize = m_BufferSize;
misses = m_Misses;
}
public BufferPool(string name, int initialCapacity, int bufferSize)
{
m_Name = name;
public BufferPool(string name, int initialCapacity, int bufferSize)
{
m_Name = name;
m_InitialCapacity = initialCapacity;
m_BufferSize = bufferSize;
m_InitialCapacity = initialCapacity;
m_BufferSize = bufferSize;
m_FreeBuffers = new Queue<byte[]>(initialCapacity);
while (m_FreeBuffers.Count < initialCapacity)
{
m_FreeBuffers.Enqueue(new byte[bufferSize]);
}
for (int i = 0; i < initialCapacity; ++i)
{
m_FreeBuffers.Enqueue(new byte[bufferSize]);
}
m_Pools[this] = name;
}
lock (Pools)
Pools.Add(this);
}
public byte[] AcquireBuffer()
{
if (m_FreeBuffers.TryDequeue(out var buffer))
{
return buffer;
}
public byte[] AcquireBuffer()
{
lock (this)
{
if (m_FreeBuffers.Count > 0)
{
return m_FreeBuffers.Dequeue();
}
++m_Misses;
++m_Misses;
while (m_FreeBuffers.Count < m_InitialCapacity - 1)
{
m_FreeBuffers.Enqueue(new byte[m_BufferSize]);
}
for (int i = 0; i < m_InitialCapacity; ++i)
{
m_FreeBuffers.Enqueue(new byte[m_BufferSize]);
}
return new byte[m_BufferSize];
}
return m_FreeBuffers.Dequeue();
}
}
public void ReleaseBuffer(byte[] buffer)
{
if (buffer == null || buffer.Length != m_BufferSize)
{
return;
}
public void ReleaseBuffer(byte[] buffer)
{
if (buffer == null)
{
return;
}
Array.Clear(buffer, 0, buffer.Length);
lock (this)
m_FreeBuffers.Enqueue(buffer);
}
m_FreeBuffers.Enqueue(buffer);
}
public void Free()
{
lock (Pools)
Pools.Remove(this);
}
}
}
public void Free()
{
m_Pools.TryRemove(this, out _);
}
}
}
+515 -249
View File
@@ -1,280 +1,546 @@
#region References
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Text;
using System.Threading;
#endregion
namespace Server.Network
{
public class Listener : IDisposable
{
private Socket m_Listener;
private PingListener _PingListener;
public class Listener : IDisposable
{
private static readonly byte[][] m_HttpFilters =
{
Encoding.UTF8.GetBytes("GET"),
Encoding.UTF8.GetBytes("POST"),
Encoding.UTF8.GetBytes("PUT"),
Encoding.UTF8.GetBytes("DELETE"),
Encoding.UTF8.GetBytes("HEAD"),
Encoding.UTF8.GetBytes("OPTIONS"),
Encoding.UTF8.GetBytes("PATCH"),
Encoding.UTF8.GetBytes("CONNECT"),
Encoding.UTF8.GetBytes("TRACE"),
};
private readonly Queue<Socket> m_Accepted;
private readonly object m_AcceptedSyncRoot;
private static readonly BufferPool m_ByteBufferPool = new BufferPool("Login Byte", 1024, 1);
private static readonly BufferPool m_PeekBufferPool = new BufferPool("Login Peek", 1024, 4);
private static readonly BufferPool m_SeedBufferPool = new BufferPool("Login Seed [0xEF]", 1024, PacketHandlers.LoginSeedLength);
private readonly AsyncCallback m_OnAccept;
public static IPAddress Address => Config.Get("Server.Listen", IPAddress.Any);
private static readonly Socket[] m_EmptySockets = new Socket[0];
public static int Port => Config.Get("Server.Port", 2593);
public static IPEndPoint[] EndPoints { get; set; }
public static IPEndPoint[] EndPoints { get; set; } =
{
new IPEndPoint(Address, Port)
};
public Listener(IPEndPoint ipep)
{
m_Accepted = new Queue<Socket>();
m_AcceptedSyncRoot = ((ICollection)m_Accepted).SyncRoot;
private long m_SliceTime, m_SliceCounter;
m_Listener = Bind(ipep);
private long m_Counter, m_AcceptsPerSecond;
if (m_Listener == null)
{
return;
}
public long AcceptsPerSecond => m_AcceptsPerSecond;
DisplayListener();
_PingListener = new PingListener(ipep);
private Socket m_Listener;
m_OnAccept = OnAccept;
try
{
IAsyncResult res = m_Listener.BeginAccept(m_OnAccept, m_Listener);
}
catch (SocketException ex)
{
NetState.TraceException(ex);
}
catch (ObjectDisposedException)
{ }
}
private readonly ConcurrentQueue<SocketState> m_Accepted = new ConcurrentQueue<SocketState>();
private Socket Bind(IPEndPoint ipep)
{
Socket s = new Socket(ipep.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
private readonly AutoResetEvent m_AcceptLimiter = new AutoResetEvent(true);
try
{
s.LingerState.Enabled = false;
// Default is 'false' starting Windows Vista and Server 2008. Source: https://msdn.microsoft.com/en-us/library/system.net.sockets.socket.exclusiveaddressuse(v=vs.110).aspx?f=255&MSPPError=-2147217396
s.ExclusiveAddressUse = false;
private readonly Thread m_AcceptThread;
s.Bind(ipep);
s.Listen(8);
private SocketAsyncEventArgs m_AcceptArgs;
return s;
}
catch (Exception e)
{
if (e is SocketException)
{
SocketException se = (SocketException)e;
public Listener(IPEndPoint ipep)
{
m_Listener = Bind(ipep);
if (se.ErrorCode == 10048)
{
// WSAEADDRINUSE
Utility.PushColor(ConsoleColor.Red);
Console.WriteLine("Listener Failed: {0}:{1} (In Use)", ipep.Address, ipep.Port);
Utility.PopColor();
}
else if (se.ErrorCode == 10049)
{
// WSAEADDRNOTAVAIL
Utility.PushColor(ConsoleColor.Red);
Console.WriteLine("Listener Failed: {0}:{1} (Unavailable)", ipep.Address, ipep.Port);
Utility.PopColor();
}
else
{
Utility.PushColor(ConsoleColor.Red);
Console.WriteLine("Listener Exception:");
Console.WriteLine(e);
Utility.PopColor();
}
}
m_SliceTime = Core.TickCount;
return null;
}
}
private void DisplayListener()
{
IPEndPoint ipep = m_Listener.LocalEndPoint as IPEndPoint;
if (ipep == null)
{
return;
}
if (ipep.Address.Equals(IPAddress.Any) || ipep.Address.Equals(IPAddress.IPv6Any))
{
var adapters = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface adapter in adapters)
{
IPInterfaceProperties properties = adapter.GetIPProperties();
foreach (IPAddressInformation unicast in properties.UnicastAddresses)
{
if (ipep.AddressFamily == unicast.Address.AddressFamily)
{
Utility.PushColor(ConsoleColor.Green);
Console.WriteLine("Listening: {0}:{1}", unicast.Address, ipep.Port);
Utility.PopColor();
}
}
}
/*
try {
Console.WriteLine( "Listening: {0}:{1}", IPAddress.Loopback, ipep.Port );
IPHostEntry iphe = Dns.GetHostEntry( Dns.GetHostName() );
IPAddress[] ip = iphe.AddressList;
for ( int i = 0; i < ip.Length; ++i )
Console.WriteLine( "Listening: {0}:{1}", ip[i], ipep.Port );
}
catch { }
*/
}
else
{
Utility.PushColor(ConsoleColor.Green);
Console.WriteLine("Listening: {0}:{1}", ipep.Address, ipep.Port);
Utility.PopColor();
}
Utility.PushColor(ConsoleColor.DarkGreen);
Console.WriteLine(@"----------------------------------------------------------------------");
Utility.PopColor();
}
private void OnAccept(IAsyncResult asyncResult)
{
Socket listener = (Socket)asyncResult.AsyncState;
Socket accepted = null;
try
{
accepted = listener.EndAccept(asyncResult);
}
catch (SocketException ex)
{
NetState.TraceException(ex);
}
catch (ObjectDisposedException)
{
return;
}
if (accepted != null)
{
if (VerifySocket(accepted))
{
Enqueue(accepted);
}
else
{
Release(accepted);
}
}
try
{
listener.BeginAccept(m_OnAccept, listener);
}
catch (SocketException ex)
{
NetState.TraceException(ex);
}
catch (ObjectDisposedException)
{ }
}
private bool VerifySocket(Socket socket)
{
try
{
SocketConnectEventArgs args = new SocketConnectEventArgs(socket);
EventSink.InvokeSocketConnect(args);
return args.AllowConnection;
}
catch (Exception ex)
{
NetState.TraceException(ex);
return false;
}
}
private void Enqueue(Socket socket)
{
lock (m_AcceptedSyncRoot)
{
m_Accepted.Enqueue(socket);
}
Core.Set();
}
private void Release(Socket socket)
{
try
{
socket.Shutdown(SocketShutdown.Both);
}
catch (SocketException ex)
{
NetState.TraceException(ex);
}
try
{
socket.Close();
}
catch (SocketException ex)
{
NetState.TraceException(ex);
}
}
public Socket[] Slice()
{
Socket[] array;
lock (m_AcceptedSyncRoot)
{
if (m_Accepted.Count == 0)
{
return m_EmptySockets;
}
array = m_Accepted.ToArray();
m_Accepted.Clear();
}
return array;
}
public void Dispose()
{
Socket socket = Interlocked.Exchange(ref m_Listener, null);
if (socket != null)
{
socket.Close();
}
if (_PingListener == null)
if (m_Listener == null)
{
return;
}
_PingListener.Dispose();
_PingListener = null;
DisplayListener();
m_AcceptThread = new Thread(AcceptLoop)
{
Name = $"Login Accept Processor",
Priority = ThreadPriority.AboveNormal,
};
m_AcceptThread.Start();
}
}
}
private Socket Bind(IPEndPoint ipep)
{
Socket s = new Socket(ipep.AddressFamily, SocketType.Stream, ProtocolType.Tcp)
{
SendTimeout = 1000,
ReceiveTimeout = 1000,
ExclusiveAddressUse = false,
UseOnlyOverlappedIO = false,
NoDelay = true,
LingerState =
{
Enabled = true,
LingerTime = 0,
},
};
try
{
s.Bind(ipep);
s.Listen(1000);
return s;
}
catch (Exception e)
{
if (e is SocketException se)
{
if (se.ErrorCode == 10048)
{
// WSAEADDRINUSE
Utility.PushColor(ConsoleColor.Red);
Console.WriteLine("Listener Failed: {0}:{1} (In Use)", ipep.Address, ipep.Port);
Utility.PopColor();
}
else if (se.ErrorCode == 10049)
{
// WSAEADDRNOTAVAIL
Utility.PushColor(ConsoleColor.Red);
Console.WriteLine("Listener Failed: {0}:{1} (Unavailable)", ipep.Address, ipep.Port);
Utility.PopColor();
}
else
{
Utility.PushColor(ConsoleColor.Red);
Console.WriteLine("Listener Exception:");
Console.WriteLine(e);
Utility.PopColor();
}
}
return null;
}
}
private void DisplayListener()
{
if (!(m_Listener.LocalEndPoint is IPEndPoint ipep))
{
return;
}
if (ipep.Address.Equals(IPAddress.Any) || ipep.Address.Equals(IPAddress.IPv6Any))
{
NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface adapter in adapters)
{
IPInterfaceProperties properties = adapter.GetIPProperties();
foreach (IPAddressInformation unicast in properties.UnicastAddresses)
{
if (ipep.AddressFamily == unicast.Address.AddressFamily)
{
Utility.PushColor(ConsoleColor.Green);
Console.WriteLine("Listening: {0}:{1}", unicast.Address, ipep.Port);
Utility.PopColor();
}
}
}
}
else
{
Utility.PushColor(ConsoleColor.Green);
Console.WriteLine("Listening: {0}:{1}", ipep.Address, ipep.Port);
Utility.PopColor();
}
Utility.PushColor(ConsoleColor.DarkGreen);
Console.WriteLine(@"----------------------------------------------------------------------");
Utility.PopColor();
}
private SocketAsyncEventArgs Reset(ref SocketAsyncEventArgs e)
{
if (e == null)
{
e = new SocketAsyncEventArgs();
e.Completed += OnAccept;
}
e.UserToken = this;
e.AcceptSocket = null;
e.RemoteEndPoint = null;
e.SocketFlags = 0;
e.SocketError = 0;
e.DisconnectReuseSocket = true;
return e;
}
[STAThread]
private void AcceptLoop()
{
while (m_Listener != null)
{
Accept();
}
}
private void Accept()
{
if (!m_AcceptLimiter.WaitOne(10))
{
return;
}
if (m_Listener == null)
{
return;
}
SocketAsyncEventArgs e = Reset(ref m_AcceptArgs);
bool iocp;
try
{
iocp = m_Listener.AcceptAsync(e);
}
catch
{
iocp = false;
}
if (!iocp)
{
OnAccept(e);
}
}
private void OnAccept(object sender, SocketAsyncEventArgs e)
{
OnAccept(e);
}
private void OnAccept(SocketAsyncEventArgs e)
{
try
{
Socket accepted = e.AcceptSocket;
SocketError error = e.SocketError;
m_AcceptArgs = Reset(ref e);
if (accepted == null)
{
return;
}
Interlocked.Increment(ref m_Counter);
accepted.NoDelay = true;
if (error != 0)
{
Release(false, ref accepted);
return;
}
try
{
accepted.SendTimeout = 1000;
accepted.ReceiveTimeout = 1000;
_ = ThreadPool.QueueUserWorkItem(o =>
{
Socket s = (Socket)o;
if (ValidateSequence(s, out byte[] seed))
{
Enqueue(s, seed);
}
else
{
Release(false, ref s);
}
}, accepted);
}
catch
{
Release(false, ref accepted);
}
}
finally
{
m_AcceptLimiter.Set();
}
}
private bool ValidateSequence(Socket socket, out byte[] buffer)
{
buffer = null;
byte[] peek;
try
{
peek = m_PeekBufferPool.AcquireBuffer();
}
catch
{
return false;
}
try
{
int recv = socket.Receive(peek, peek.Length, SocketFlags.None);
if (recv < peek.Length)
{
return false;
}
bool allow = false;
int index = 0;
byte packetID = peek[index++];
if (packetID == 0xEF)
{
byte[] packet = m_SeedBufferPool.AcquireBuffer();
try
{
var diff = packet.Length - peek.Length;
recv = socket.Receive(packet, peek.Length, diff, SocketFlags.None);
if (recv == diff)
{
Buffer.BlockCopy(peek, 0, packet, 0, peek.Length);
uint seed = readU32(packet, ref index);
if (seed != 0)
{
uint clientMaj = readU32(packet, ref index);
uint clientMin = readU32(packet, ref index);
uint clientRev = readU32(packet, ref index);
uint clientPat = readU32(packet, ref index);
uint version = (clientMaj << 24) | (clientMin << 16) | (clientRev << 8) | clientPat;
if (version != 0)
{
allow = true;
buffer = packet.ToArray();
}
}
}
}
finally
{
m_SeedBufferPool.ReleaseBuffer(packet);
}
}
else if (!Match(peek))
{
index = packetID = 0;
uint seed = readU32(peek, ref index);
if (seed != 0)
{
var one = m_ByteBufferPool.AcquireBuffer();
try
{
recv = socket.Receive(one, 0, one.Length, SocketFlags.None);
if (recv == one.Length)
{
packetID = one[0];
if (!MessagePump.CheckEncrypted(packetID))
{
allow = true;
buffer = new byte[peek.Length + one.Length];
Buffer.BlockCopy(peek, 0, buffer, 0, peek.Length);
Buffer.BlockCopy(one, 0, buffer, peek.Length, one.Length);
}
}
}
finally
{
m_ByteBufferPool.ReleaseBuffer(one);
}
}
}
return allow;
}
catch
{
return false;
}
finally
{
m_PeekBufferPool.ReleaseBuffer(peek);
}
uint readU32(byte[] b, ref int i)
{
return (uint)((b[i++] << 24) | (b[i++] << 16) | (b[i++] << 8) | b[i++]);
}
}
private bool Match(byte[] buffer)
{
for (int i = 0; i < m_HttpFilters.Length; i++)
{
byte[] filter = m_HttpFilters[i];
if (filter?.Length > 0)
{
IEnumerable<byte> fseq = filter;
IEnumerable<byte> pseq = buffer;
if (filter.Length > buffer.Length)
{
fseq = fseq.Take(buffer.Length);
}
else if (buffer.Length > filter.Length)
{
pseq = pseq.Take(filter.Length);
}
if (Enumerable.SequenceEqual(fseq, pseq))
{
return true;
}
}
}
return false;
}
private void Enqueue(Socket socket, byte[] seed)
{
m_Accepted.Enqueue(new SocketState(socket, seed));
Core.Set();
}
private void Release(bool graceful, ref Socket socket)
{
if (socket != null)
{
try
{
if (graceful)
{
try
{
socket.Shutdown(SocketShutdown.Both);
}
catch (SocketException ex)
{
NetState.TraceException(ex);
}
}
if (socket.LingerState != null)
{
socket.LingerState.Enabled = true;
socket.LingerState.LingerTime = graceful ? 1 : 0;
}
else
{
socket.LingerState = new LingerOption(true, graceful ? 1 : 0);
}
}
catch
{
}
finally
{
socket.Close();
socket = null;
}
}
}
public IEnumerable<SocketState> Slice()
{
long now = Core.TickCount;
if (now - m_SliceTime >= 1000)
{
var count = m_Counter;
Interlocked.Exchange(ref m_SliceTime, now);
Interlocked.Exchange(ref m_AcceptsPerSecond, count - m_SliceCounter);
Interlocked.Exchange(ref m_SliceCounter, count);
}
int limit = Math.Min(m_Accepted.Count, 100);
while (--limit >= 0 && m_Accepted.TryDequeue(out SocketState accepted))
{
Socket socket = accepted.Socket;
SocketConnectEventArgs args = new SocketConnectEventArgs(socket);
EventSink.InvokeSocketConnect(args);
if (args.AllowConnection)
{
yield return accepted;
}
else
{
Release(true, ref socket);
}
}
}
public void Dispose()
{
Socket socket = Interlocked.Exchange(ref m_Listener, null);
socket?.Close();
}
}
public readonly struct SocketState
{
public readonly Socket Socket;
public readonly byte[] Seed;
public SocketState(Socket socket, byte[] seed)
{
Socket = socket;
Seed = seed;
}
}
}
+64 -65
View File
@@ -1,7 +1,7 @@
#region References
using System;
using System.Collections.Generic;
using System.Net.Sockets;
using System.Collections.Concurrent;
using System.Linq;
using System.Threading;
using Server.Diagnostics;
@@ -9,15 +9,17 @@ using Server.Diagnostics;
namespace Server.Network
{
public class MessagePump
public static class MessagePump
{
private Queue<NetState> m_Queue;
private Queue<NetState> m_WorkingQueue;
private readonly Queue<NetState> m_Throttled;
private static readonly ConcurrentQueue<NetState> m_Queue = new ConcurrentQueue<NetState>();
public Listener[] Listeners { get; set; }
public MessagePump()
private static readonly ConcurrentQueue<NetState> m_Throttled = new ConcurrentQueue<NetState>();
public static Listener[] Listeners { get; private set; }
public static long AcceptsPerSecond => Listeners.Sum(l => l.AcceptsPerSecond);
public static void Start()
{
var ipep = Listener.EndPoints;
@@ -44,13 +46,9 @@ namespace Server.Network
}
}
while (!success);
m_Queue = new Queue<NetState>();
m_WorkingQueue = new Queue<NetState>();
m_Throttled = new Queue<NetState>();
}
public void AddListener(Listener l)
public static void AddListener(Listener l)
{
var old = Listeners;
@@ -64,15 +62,13 @@ namespace Server.Network
Listeners[old.Length] = l;
}
private void CheckListener()
private static void CheckListener()
{
foreach (Listener l in Listeners)
{
var accepted = l.Slice();
foreach (Socket s in accepted)
foreach (SocketState state in l.Slice())
{
NetState ns = new NetState(s, this);
NetState ns = new NetState(state);
ns.Start();
@@ -104,50 +100,41 @@ namespace Server.Network
private static string[] _NoDisplay =
{
"192.99.10.155",
"192.99.69.21",
"54.39.99.106",
};
public void OnReceive(NetState ns)
public static void OnReceive(NetState ns)
{
lock (this)
m_Queue.Enqueue(ns);
m_Queue.Enqueue(ns);
Core.Set();
}
public void Slice()
{
CheckListener();
public static void Slice()
{
CheckListener();
lock (this)
{
var temp = m_WorkingQueue;
m_WorkingQueue = m_Queue;
m_Queue = temp;
}
var limit = m_Queue.Count;
while (m_WorkingQueue.Count > 0)
{
NetState ns = m_WorkingQueue.Dequeue();
while (--limit >= 0 && m_Queue.TryDequeue(out NetState ns))
{
if (ns.Running)
{
HandleReceive(ns);
}
}
if (ns.Running)
{
HandleReceive(ns);
}
}
lock (this)
{
while (m_Throttled.Count > 0)
{
m_Queue.Enqueue(m_Throttled.Dequeue());
}
}
}
while (m_Throttled.TryDequeue(out NetState ns))
{
if (ns.Running)
{
m_Queue.Enqueue(ns);
}
}
}
private const int BufferSize = 4096;
private readonly BufferPool m_Buffers = new BufferPool("Processor", 4, BufferSize);
private static readonly BufferPool m_Buffers = new BufferPool("Processor", 4, BufferSize);
public static bool HandleSeed(NetState ns, ByteQueue buffer)
{
@@ -187,24 +174,36 @@ namespace Server.Network
return false;
}
public static bool CheckEncrypted(NetState ns, int packetID)
{
if (!ns.SentFirstPacket && packetID != 0xF0 && packetID != 0xF1 && packetID != 0xCF && packetID != 0x80 &&
packetID != 0x91 && packetID != 0xA4 && packetID != 0xEF && packetID != 0xE4 && packetID != 0xFF)
{
Utility.PushColor(ConsoleColor.Red);
Console.WriteLine("Client: {0}: Encrypted Client Unsupported", ns);
Utility.PopColor();
ns.Dispose();
public static bool CheckEncrypted(NetState ns, int packetID)
{
if (ns.SentFirstPacket || !CheckEncrypted(packetID))
{
return false;
}
return true;
}
Utility.PushColor(ConsoleColor.Red);
Console.WriteLine("Client: {0}: Encrypted Client Unsupported", ns);
Utility.PopColor();
return false;
ns.Dispose();
return true;
}
public static bool CheckEncrypted(int packetID)
{
return packetID != 0xF0
&& packetID != 0xF1
&& packetID != 0xCF
&& packetID != 0x80
&& packetID != 0x91
&& packetID != 0xA4
&& packetID != 0xEF
&& packetID != 0xE4
&& packetID != 0xFF;
}
public void HandleReceive(NetState ns)
public static void HandleReceive(NetState ns)
{
ByteQueue buffer = ns.Buffer;
+1108 -1102
View File
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -48,9 +48,11 @@ namespace Server.Network
private static readonly EncodedPacketHandler[] m_EncodedHandlersLow;
private static readonly Dictionary<int, EncodedPacketHandler> m_EncodedHandlersHigh;
public static PacketHandler[] Handlers { get { return m_Handlers; } }
public static PacketHandler[] Handlers { get { return m_Handlers; } }
static PacketHandlers()
public static int LoginSeedLength => Handlers[0xEF]?.Length ?? -1;
static PacketHandlers()
{
m_Handlers = new PacketHandler[0x100];
m_6017Handlers = new PacketHandler[0x100];
+76 -103
View File
@@ -1,6 +1,7 @@
#region References
using System;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.Threading;
#endregion
namespace Server.Network
@@ -9,29 +10,20 @@ namespace Server.Network
{
public class Gram
{
private static readonly Stack<Gram> _pool = new Stack<Gram>();
private static readonly ConcurrentQueue<Gram> _pool = new ConcurrentQueue<Gram>();
public static Gram Acquire()
{
lock (_pool)
{
Gram gram;
public static Gram Acquire()
{
if (!_pool.TryDequeue(out Gram gram))
{
gram = new Gram();
}
if (_pool.Count > 0)
{
gram = _pool.Pop();
}
else
{
gram = new Gram();
}
gram._buffer = AcquireBuffer();
gram._length = 0;
gram._buffer = AcquireBuffer();
gram._length = 0;
return gram;
}
}
return gram;
}
private byte[] _buffer;
private int _length;
@@ -58,14 +50,12 @@ namespace Server.Network
return write;
}
public void Release()
{
lock (_pool)
{
_pool.Push(this);
ReleaseBuffer(_buffer);
}
}
public void Release()
{
_pool.Enqueue(this);
ReleaseBuffer(_buffer);
}
}
private static int m_CoalesceBufferSize = 512;
@@ -74,77 +64,60 @@ namespace Server.Network
public static int CoalesceBufferSize
{
get { return m_CoalesceBufferSize; }
set
{
if (m_CoalesceBufferSize == value)
{
return;
}
set
{
if (m_CoalesceBufferSize == value)
{
return;
}
BufferPool old = m_UnusedBuffers;
m_UnusedBuffers?.Free();
lock (old)
{
if (m_UnusedBuffers != null)
{
m_UnusedBuffers.Free();
}
m_CoalesceBufferSize = value;
m_UnusedBuffers = new BufferPool("Coalesced", 2048, m_CoalesceBufferSize);
}
}
m_CoalesceBufferSize = value;
m_UnusedBuffers = new BufferPool("Coalesced", 2048, m_CoalesceBufferSize);
}
}
public static byte[] AcquireBuffer()
{
lock (m_UnusedBuffers)
return m_UnusedBuffers.AcquireBuffer();
return m_UnusedBuffers.AcquireBuffer();
}
public static void ReleaseBuffer(byte[] buffer)
{
lock (m_UnusedBuffers)
if (buffer != null && buffer.Length == m_CoalesceBufferSize)
{
m_UnusedBuffers.ReleaseBuffer(buffer);
}
}
public static void ReleaseBuffer(byte[] buffer)
{
if (buffer != null && buffer.Length == m_CoalesceBufferSize)
{
m_UnusedBuffers.ReleaseBuffer(buffer);
}
}
private readonly Queue<Gram> _pending;
private readonly ConcurrentQueue<Gram> _pending = new ConcurrentQueue<Gram>();
private Gram _buffered;
private volatile Gram _buffered;
public bool IsFlushReady { get { return (_pending.Count == 0 && _buffered != null); } }
public bool IsEmpty { get { return (_pending.Count == 0 && _buffered == null); } }
public SendQueue()
{
_pending = new Queue<Gram>();
}
public Gram CheckFlushReady()
{
Gram gram = _buffered;
_pending.Enqueue(_buffered);
_buffered = null;
Gram gram = Interlocked.Exchange(ref _buffered, null);
_pending.Enqueue(gram);
return gram;
}
public Gram Dequeue()
{
Gram gram = null;
if (_pending.TryDequeue(out Gram gram))
{
gram?.Release();
gram = null;
if (_pending.Count > 0)
{
_pending.Dequeue().Release();
if (_pending.Count > 0)
{
gram = _pending.Peek();
}
}
if (_pending.TryPeek(out Gram peek))
gram = peek;
}
return gram;
}
@@ -177,41 +150,41 @@ namespace Server.Network
throw new ArgumentException("Offset and length do not point to a valid segment within the buffer.");
}
int existingBytes = (_pending.Count * m_CoalesceBufferSize) + (_buffered == null ? 0 : _buffered.Length);
int existingBytes = (_pending.Count * m_CoalesceBufferSize) + (_buffered?.Length ?? 0);
if ((existingBytes + length) > PendingCap)
{
throw new CapacityExceededException();
}
Gram gram = null;
Gram gram = null;
while (length > 0)
{
if (_buffered == null)
{
// nothing yet buffered
_buffered = Gram.Acquire();
}
while (length > 0)
{
if (_buffered == null)
{
// nothing yet buffered
_buffered = Gram.Acquire();
}
int bytesWritten = _buffered.Write(buffer, offset, length);
int bytesWritten = _buffered.Write(buffer, offset, length);
offset += bytesWritten;
length -= bytesWritten;
offset += bytesWritten;
length -= bytesWritten;
if (_buffered.IsFull)
{
if (_pending.Count == 0)
{
gram = _buffered;
}
if (_buffered.IsFull)
{
if (_pending.Count == 0)
{
gram = _buffered;
}
_pending.Enqueue(_buffered);
_buffered = null;
}
}
_pending.Enqueue(_buffered);
_buffered = null;
}
}
return gram;
return gram;
}
public void Clear()
@@ -222,9 +195,9 @@ namespace Server.Network
_buffered = null;
}
while (_pending.Count > 0)
while (_pending.TryDequeue(out Gram gram))
{
_pending.Dequeue().Release();
gram?.Release();
}
}
}
@@ -236,4 +209,4 @@ namespace Server.Network
: base("Too much data pending.")
{ }
}
}
}
+584 -860
View File
File diff suppressed because it is too large Load Diff
+27 -220
View File
@@ -1,221 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{AE4A9EAA-E0EB-4DC9-9604-BE4289F9F6C3}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Server</RootNamespace>
<AssemblyName>ServUO</AssemblyName>
<ApplicationIcon>servuo.ico</ApplicationIcon>
<StartupObject>Server.Core</StartupObject>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<RuntimeIdentifiers>win7-x64;win7-x86;ubuntu.16.10-x64</RuntimeIdentifiers>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\</OutputPath>
<DefineConstants>TRACE;DEBUG;NEWTIMERS;ServUO</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<UseVSHostingProcess>false</UseVSHostingProcess>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<Prefer32Bit>false</Prefer32Bit>
<DefineConstants>TRACE;NEWTIMERS;ServUO</DefineConstants>
<UseVSHostingProcess>false</UseVSHostingProcess>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>ServUO.exe.manifest</ApplicationManifest>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ItemGroup>
<Compile Include=".\AggressorInfo.cs" />
<Compile Include=".\AssemblyInfo.cs" />
<Compile Include=".\Attributes.cs" />
<Compile Include=".\BaseVendor.cs" />
<Compile Include=".\Body.cs" />
<Compile Include=".\ClientVersion.cs" />
<Compile Include=".\Commands.cs" />
<Compile Include=".\ContextMenus\ContextMenu.cs" />
<Compile Include=".\ContextMenus\ContextMenuEntry.cs" />
<Compile Include=".\ContextMenus\OpenBackpackEntry.cs" />
<Compile Include=".\ContextMenus\PaperdollEntry.cs" />
<Compile Include=".\Customs Framework\Central Core\Base Types\BaseCore.cs" />
<Compile Include=".\Customs Framework\Central Core\Base Types\BaseModule.cs" />
<Compile Include=".\Customs Framework\Central Core\Base Types\BaseService.cs" />
<Compile Include=".\Customs Framework\Central Core\Base Types\Events.cs" />
<Compile Include=".\Customs Framework\Central Core\Base Types\SaveData.cs" />
<Compile Include=".\Customs Framework\Central Core\CustomSerial.cs" />
<Compile Include=".\Customs Framework\Central Core\Interfaces.cs" />
<Compile Include=".\Customs Framework\Custom Types\LastEditedBy.cs" />
<Compile Include=".\Customs Framework\Custom Types\Place.cs" />
<Compile Include=".\Customs Framework\Utilities\Decompressor.cs" />
<Compile Include=".\Customs Framework\Utilities\ObjectDumper.cs" />
<Compile Include=".\Customs Framework\Utilities\OutgoingPacketOverride.cs" />
<Compile Include=".\Customs Framework\Utilities\Utilities.cs" />
<Compile Include=".\Diagnostics\BaseProfile.cs" />
<Compile Include=".\Diagnostics\GumpProfile.cs" />
<Compile Include=".\Diagnostics\PacketProfile.cs" />
<Compile Include=".\Diagnostics\TargetProfile.cs" />
<Compile Include=".\Diagnostics\TimerProfile.cs" />
<Compile Include=".\Effects.cs" />
<Compile Include=".\EventLog.cs" />
<Compile Include=".\EventSink.cs" />
<Compile Include=".\ExpansionInfo.cs" />
<Compile Include=".\Geometry.cs" />
<Compile Include=".\Guild.cs" />
<Compile Include=".\HuePicker.cs" />
<Compile Include=".\IAccount.cs" />
<Compile Include=".\IEntity.cs" />
<Compile Include=".\Insensitive.cs" />
<Compile Include=".\Interfaces.cs" />
<Compile Include=".\Item.cs" />
<Compile Include=".\ItemBounds.cs" />
<Compile Include=".\Items\BaseMulti.cs" />
<Compile Include=".\Items\Container.cs" />
<Compile Include=".\Items\Containers.cs" />
<Compile Include=".\Items\SecureTradeContainer.cs" />
<Compile Include=".\Items\VirtualHair.cs" />
<Compile Include=".\KeywordList.cs" />
<Compile Include=".\Main.cs" />
<Compile Include=".\Map.cs" />
<Compile Include=".\Menus\IMenu.cs" />
<Compile Include=".\Menus\ItemListMenu.cs" />
<Compile Include=".\Menus\QuestionMenu.cs" />
<Compile Include=".\Mobile.cs" />
<Compile Include=".\Movement.cs" />
<Compile Include=".\MultiData.cs" />
<Compile Include=".\NativeReader.cs" />
<Compile Include=".\Network\BufferPool.cs" />
<Compile Include=".\Network\ByteQueue.cs" />
<Compile Include=".\Network\Compression.cs" />
<Compile Include=".\Network\EncodedPacketHandler.cs" />
<Compile Include=".\Network\EncodedReader.cs" />
<Compile Include=".\Network\Listener.cs" />
<Compile Include=".\Network\MessagePump.cs" />
<Compile Include=".\Network\NetState.cs" />
<Compile Include=".\Network\PacketHandler.cs" />
<Compile Include=".\Network\PacketHandlers.cs" />
<Compile Include=".\Network\PacketReader.cs" />
<Compile Include=".\Network\Packets.cs" />
<Compile Include=".\Network\PacketWriter.cs" />
<Compile Include=".\Network\SendQueue.cs" />
<Compile Include=".\Notoriety.cs" />
<Compile Include=".\ObjectPropertyList.cs" />
<Compile Include=".\Party.cs" />
<Compile Include=".\Persistence\BinaryMemoryWriter.cs" />
<Compile Include=".\Persistence\DualSaveStrategy.cs" />
<Compile Include=".\Persistence\DynamicSaveStrategy.cs" />
<Compile Include=".\Persistence\FileOperations.cs" />
<Compile Include=".\Persistence\FileQueue.cs" />
<Compile Include=".\Persistence\ParallelSaveStrategy.cs" />
<Compile Include=".\Persistence\QueuedMemoryWriter.cs" />
<Compile Include=".\Persistence\SaveMetrics.cs" />
<Compile Include=".\Persistence\SaveStrategy.cs" />
<Compile Include=".\Persistence\SequentialFileWriter.cs" />
<Compile Include=".\Persistence\StandardSaveStrategy.cs" />
<Compile Include=".\Point3DList.cs" />
<Compile Include=".\Poison.cs" />
<Compile Include=".\Prompt.cs" />
<Compile Include=".\QuestArrow.cs" />
<Compile Include=".\Race.cs" />
<Compile Include=".\Region.cs" />
<Compile Include=".\ScriptCompiler.cs" />
<Compile Include=".\Sector.cs" />
<Compile Include=".\SecureTrade.cs" />
<Compile Include=".\Serial.cs" />
<Compile Include=".\Serialization.cs" />
<Compile Include=".\Skills.cs" />
<Compile Include=".\Targeting\LandTarget.cs" />
<Compile Include=".\Targeting\MultiTarget.cs" />
<Compile Include=".\Targeting\StaticTarget.cs" />
<Compile Include=".\Targeting\Target.cs" />
<Compile Include=".\Targeting\TargetCancelType.cs" />
<Compile Include=".\Targeting\TargetFlags.cs" />
<Compile Include=".\TileData.cs" />
<Compile Include=".\TileList.cs" />
<Compile Include=".\TileMatrix.cs" />
<Compile Include=".\TileMatrixPatch.cs" />
<Compile Include=".\Timer.cs" />
<Compile Include=".\Utility.cs" />
<Compile Include=".\VirtueInfo.cs" />
<Compile Include=".\World.cs" />
<Compile Include="Config.cs" />
<Compile Include="Gumps\ECHandleInput.cs" />
<Compile Include="Gumps\Gump.cs" />
<Compile Include="Gumps\GumpAlphaRegion.cs" />
<Compile Include="Gumps\GumpBackground.cs" />
<Compile Include="Gumps\GumpButton.cs" />
<Compile Include="Gumps\GumpCheck.cs" />
<Compile Include="Gumps\GumpEntry.cs" />
<Compile Include="Gumps\GumpGroup.cs" />
<Compile Include="Gumps\GumpHtml.cs" />
<Compile Include="Gumps\GumpHtmlLocalized.cs" />
<Compile Include="Gumps\GumpImage.cs" />
<Compile Include="Gumps\GumpImageTileButton.cs" />
<Compile Include="Gumps\GumpImageTiled.cs" />
<Compile Include="Gumps\GumpItem.cs" />
<Compile Include="Gumps\GumpItemProperty.cs" />
<Compile Include="Gumps\GumpLabel.cs" />
<Compile Include="Gumps\GumpLabelCropped.cs" />
<Compile Include="Gumps\GumpPage.cs" />
<Compile Include="Gumps\GumpRadio.cs" />
<Compile Include="Gumps\GumpSpriteImage.cs" />
<Compile Include="Gumps\GumpTextEntry.cs" />
<Compile Include="Gumps\GumpTextEntryLimited.cs" />
<Compile Include="Gumps\GumpTooltip.cs" />
<Compile Include="Gumps\RelayInfo.cs" />
<Compile Include="Network\PacketThrottles.cs" />
<Compile Include="Network\PingListener.cs" />
<Compile Include="Persistence\Persistence.cs" />
<Compile Include="PromptExtensions.cs" />
<Compile Include="Random.cs" />
<Compile Include="Items\VirtualCheck.cs" />
<Compile Include="SpawnArea.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="servuo.ico" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Ultima\Ultima.csproj">
<Project>{e08cfbe4-e013-44ee-8829-426d05bc083f}</Project>
<Name>Ultima</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="ServUO.exe.manifest" />
</ItemGroup>
<Import Project="..\VersionSpecificSymbols.Common.prop" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<OutputType>Exe</OutputType>
<AssemblyName>ServUO</AssemblyName>
<ApplicationIcon>servuo.ico</ApplicationIcon>
<StartupObject>Server.Core</StartupObject>
<ApplicationManifest>ServUO.exe.manifest</ApplicationManifest>
<AppendTargetFrameworkToOutputPath>False</AppendTargetFrameworkToOutputPath>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<UseVSHostingProcess>False</UseVSHostingProcess>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<Platforms>x64</Platforms>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutputPath>..\</OutputPath>
<DefineConstants>TRACE;DEBUG;NEWTIMERS;ServUO</DefineConstants>
<DebugType>embedded</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutputPath>..\</OutputPath>
<DefineConstants>TRACE;NEWTIMERS;ServUO</DefineConstants>
<DebugType>none</DebugType>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Ultima\Ultima.csproj" />
</ItemGroup>
</Project>
+2 -2
View File
@@ -319,7 +319,7 @@ namespace Server
}
[CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
public double Base { get { return (m_Base / 10.0); } set { BaseFixedPoint = (int)(value * 10.0); } }
public double Base { get => m_Base / 10.0; set => BaseFixedPoint = (int)Math.Round(value * 10.0); }
public int CapFixedPoint
{
@@ -1106,4 +1106,4 @@ namespace Server
return m_Skills.Where(s => s != null).GetEnumerator();
}
}
}
}