Moves more outgoing packets (#152)

This commit is contained in:
Kamron Batman 2020-05-28 19:15:34 -07:00 • committed by GitHub
parent 4499ac30b0
commit 69ebb45e59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 1778 additions and 1754 deletions

View file

@ -25,6 +25,7 @@ using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Runtime.CompilerServices;
using System.Text;
using System.Xml;
@ -763,18 +764,6 @@ namespace Server
? uint.TryParse(value.Substring(2), NumberStyles.HexNumber, null, out i)
: uint.TryParse(value, out i);
public static double GetXMLDouble(string doubleString, double defaultValue)
{
try
{
return XmlConvert.ToDouble(doubleString);
}
catch
{
return double.TryParse(doubleString, out var val) ? val : defaultValue;
}
}
public static int GetXMLInt32(string intString, int defaultValue)
{
try
@ -811,18 +800,6 @@ namespace Server
}
}
public static DateTimeOffset GetXMLDateTimeOffset(string dateTimeOffsetString, DateTimeOffset defaultValue)
{
try
{
return XmlConvert.ToDateTimeOffset(dateTimeOffsetString);
}
catch
{
return DateTimeOffset.TryParse(dateTimeOffsetString, out var d) ? d : defaultValue;
}
}
public static TimeSpan GetXMLTimeSpan(string timeSpanString, TimeSpan defaultValue)
{
try
@ -868,13 +845,15 @@ namespace Server
&& p1.Y >= p2.Y - 18
&& p1.Y <= p2.Y + 18;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int Coerce(int number, int min, int max) => number < min ? min : number > max ? max : number;
// 4d6+8 would be: Utility.Dice( 4, 6, 8 )
public static int Dice(uint numDice, uint numSides, int bonus)
public static int Dice(uint amount, uint sides, int bonus)
{
var total = 0;
var sides = numSides;
for (var i = 0; i < numDice; ++i)
for (var i = 0; i < amount; ++i)
total += (int)RandomProviders.Provider.Next(sides) + 1;
return total + bonus;