Code cleanup (#195)
This commit is contained in:
parent
b476bcfd24
commit
0926b5abaa
86 changed files with 740 additions and 1635 deletions
|
|
@ -830,12 +830,7 @@ namespace Server.Misc
|
|||
|
||||
private static void FixStat(ref int stat, int diff, int max)
|
||||
{
|
||||
stat += diff;
|
||||
|
||||
if (stat < 0)
|
||||
stat = 0;
|
||||
else if (stat > max)
|
||||
stat = max;
|
||||
stat = Math.Clamp(stat + diff, 0, max);
|
||||
}
|
||||
|
||||
private static void SetStats(Mobile m, NetState state, int str, int dex, int intel)
|
||||
|
|
|
|||
|
|
@ -163,12 +163,12 @@ namespace Server.Misc
|
|||
|
||||
using (StreamWriter op = new StreamWriter(filePath))
|
||||
{
|
||||
Version ver = Core.Assembly.GetName().Version;
|
||||
Version ver = Core.Assembly.GetName().Version ?? new Version("0.0.0.0");
|
||||
|
||||
op.WriteLine("Server Crash Report");
|
||||
op.WriteLine("===================");
|
||||
op.WriteLine();
|
||||
op.WriteLine("ModernUO Version {0}.{1}, Build {2}.{3}", ver.Major, ver.Minor, ver.Build, ver.Revision);
|
||||
op.WriteLine($"ModernUO Version {ver.Major}.{ver.Minor}, Build {ver.Build}.{ver.Revision}");
|
||||
op.WriteLine("Operating System: {0}", Environment.OSVersion);
|
||||
op.WriteLine(".NET Framework: {0}", Environment.Version);
|
||||
op.WriteLine("Time: {0}", DateTime.UtcNow);
|
||||
|
|
|
|||
|
|
@ -607,16 +607,11 @@ namespace Server
|
|||
|
||||
public void BeginCall(MethodInfo method)
|
||||
{
|
||||
Type type;
|
||||
|
||||
if ((method.CallingConvention & CallingConventions.HasThis) != 0)
|
||||
type = m_Stack.Peek();
|
||||
else
|
||||
type = method.DeclaringType;
|
||||
var type = (method.CallingConvention & CallingConventions.HasThis) != 0 ? m_Stack.Peek() : method.DeclaringType;
|
||||
|
||||
m_Calls.Push(new CallInfo(type, method));
|
||||
|
||||
if (type.IsValueType)
|
||||
if (type!.IsValueType)
|
||||
{
|
||||
LocalBuilder temp = AcquireTemp(type);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,11 +21,7 @@ namespace Server.Misc
|
|||
{
|
||||
int sideA, sideB;
|
||||
|
||||
if (angle < 0)
|
||||
angle = 0;
|
||||
|
||||
if (angle > 90)
|
||||
angle = 90;
|
||||
angle = Math.Clamp(angle, 0, 90);
|
||||
|
||||
sideA = (int)Math.Round(radius * Math.Sin(DegreesToRadians(angle)));
|
||||
sideB = (int)Math.Round(radius * Math.Cos(DegreesToRadians(angle)));
|
||||
|
|
@ -218,4 +214,4 @@ namespace Server.Misc
|
|||
public int Quadrant { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ namespace Server
|
|||
|
||||
int val = 0;
|
||||
|
||||
if (body >= 0 && body < m_Table.Length)
|
||||
if (body >= 0 && body < m_Table!.Length)
|
||||
val = m_Table[body];
|
||||
|
||||
if (val == 0)
|
||||
|
|
|
|||
|
|
@ -114,20 +114,14 @@ namespace Server.Misc
|
|||
if (m.Fame >= MaxFame)
|
||||
return;
|
||||
|
||||
offset -= m.Fame / 100;
|
||||
|
||||
if (offset < 0)
|
||||
offset = 0;
|
||||
offset = Math.Max(offset - m.Fame / 100, 0);
|
||||
}
|
||||
else if (offset < 0)
|
||||
{
|
||||
if (m.Fame <= MinFame)
|
||||
return;
|
||||
|
||||
offset -= m.Fame / 100;
|
||||
|
||||
if (offset > 0)
|
||||
offset = 0;
|
||||
offset = Math.Min(offset - m.Fame / 100, 0);
|
||||
}
|
||||
|
||||
if (m.Fame + offset > MaxFame)
|
||||
|
|
@ -170,20 +164,14 @@ namespace Server.Misc
|
|||
if (m.Karma >= MaxKarma)
|
||||
return;
|
||||
|
||||
offset -= m.Karma / 100;
|
||||
|
||||
if (offset < 0)
|
||||
offset = 0;
|
||||
offset = Math.Max(offset - m.Karma / 100, 0);
|
||||
}
|
||||
else if (offset < 0)
|
||||
{
|
||||
if (m.Karma <= MinKarma)
|
||||
return;
|
||||
|
||||
offset -= m.Karma / 100;
|
||||
|
||||
if (offset > 0)
|
||||
offset = 0;
|
||||
offset = Math.Min(offset - m.Karma / 100, 0);
|
||||
}
|
||||
|
||||
if (m.Karma + offset > MaxKarma)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue