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

@ -752,13 +752,14 @@ namespace Server.Accounting
try
{
int index = Utility.GetXMLInt32( Utility.GetAttribute( ele, "index", "0" ), 0 );
int serial = Utility.GetXMLInt32( Utility.GetText( ele, "0" ), 0 );
uint serial = Utility.GetXMLUInt32( Utility.GetText( ele, "0" ), 0 );
if ( index >= 0 && index < list.Length )
list[index] = World.FindMobile( serial );
}
catch
{
// ignored
}
}
}
@ -783,7 +784,10 @@ namespace Server.Accounting
foreach ( XmlElement comment in comments.GetElementsByTagName( "comment" ) )
{
try { list.Add( new AccountComment( comment ) ); }
catch { }
catch
{
// ignored
}
}
}
@ -807,7 +811,10 @@ namespace Server.Accounting
foreach ( XmlElement tag in tags.GetElementsByTagName( "tag" ) )
{
try { list.Add( new AccountTag( tag ) ); }
catch { }
catch
{
// ignored
}
}
}
@ -1180,8 +1187,7 @@ namespace Server.Accounting
{
if (amount <= 0) { return false; }
int gold;
int plat = Math.DivRem(amount, AccountGold.CurrencyThreshold, out gold);
int plat = Math.DivRem(amount, AccountGold.CurrencyThreshold, out int gold);
TotalPlat += plat;
TotalGold += gold;

View file

@ -80,6 +80,7 @@ namespace Server.Accounting
}
catch
{
// ignored
}
}

View file

@ -192,6 +192,7 @@ namespace Server.Misc
}
catch
{
// ignored
}
}
@ -229,7 +230,7 @@ namespace Server.Misc
state.Send(new CharacterListUpdate(acct));
}
else if (m.AccessLevel == AccessLevel.Player &&
Region.Find(m.LogoutLocation, m.LogoutMap).GetRegion(typeof(Jail)) != null
Region.Find(m.LogoutLocation, m.LogoutMap).IsPartOf<Jail>()
) //Don't need to check current location, if netstate is null, they're logged out
{
state.Send(new DeleteResult(DeleteResultType.BadRequest));

View file

@ -60,7 +60,7 @@ namespace Server.Accounting
foreach (XmlElement account in root.GetElementsByTagName("account"))
try
{
Account acct = new Account(account);
new Account(account);
}
catch
{
@ -77,11 +77,8 @@ namespace Server.Accounting
using (StreamWriter op = new StreamWriter(filePath))
{
XmlTextWriter xml = new XmlTextWriter(op);
XmlTextWriter xml = new XmlTextWriter(op) { Formatting = Formatting.Indented, IndentChar = '\t', Indentation = 1 };
xml.Formatting = Formatting.Indented;
xml.IndentChar = '\t';
xml.Indentation = 1;
xml.WriteStartDocument(true);

View file

@ -194,7 +194,8 @@ namespace Server
public override bool Equals(object obj)
{
if (obj is IPAddress) return obj.Equals(m_Address);
if (obj is IPAddress)
return obj.Equals(m_Address);
if (obj is string s)
{
if (IPAddress.TryParse(s, out IPAddress otherAddress))
@ -264,7 +265,7 @@ namespace Server
{
private string m_Entry;
private bool m_Valid = true;
private bool m_Valid;
public WildcardIPFirewallEntry(string entry)
{
@ -276,7 +277,9 @@ namespace Server
if (!m_Valid)
return false; //Why process if it's invalid? it'll return false anyway after processing it.
return Utility.IPMatch(m_Entry, address, ref m_Valid);
bool matched = Utility.IPMatch(m_Entry, address, out bool valid);
m_Valid = valid;
return matched;
}
public override string ToString()