Fixes more casting
This commit is contained in:
parent
61937d9c97
commit
e77d695684
91 changed files with 512 additions and 908 deletions
|
|
@ -180,14 +180,12 @@ namespace Server.Gumps
|
|||
|
||||
protected override void OnTarget( Mobile from, object o )
|
||||
{
|
||||
IPoint3D p = o as IPoint3D;
|
||||
|
||||
if ( p != null )
|
||||
if ( o is IPoint3D p )
|
||||
{
|
||||
if ( p is Item )
|
||||
p = ((Item)p).GetWorldTop();
|
||||
else if ( p is Mobile )
|
||||
p = ((Mobile)p).Location;
|
||||
if ( p is Item item )
|
||||
p = item.GetWorldTop();
|
||||
else if ( p is Mobile m )
|
||||
p = m.Location;
|
||||
|
||||
Server.Commands.Add.Invoke( from, new Point3D( p ), new Point3D( p ), new string[]{ m_Type.Name } );
|
||||
|
||||
|
|
@ -254,4 +252,4 @@ namespace Server.Gumps
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -543,9 +543,7 @@ namespace Server.Gumps
|
|||
|
||||
for ( int i = 0, index = (listPage * 12); i < 12 && index >= 0 && index < m_List.Count; ++i, ++index )
|
||||
{
|
||||
NetState ns = m_List[index] as NetState;
|
||||
|
||||
if ( ns == null )
|
||||
if ( !(m_List[index] is NetState ns) )
|
||||
continue;
|
||||
|
||||
Mobile m = ns.Mobile;
|
||||
|
|
@ -575,9 +573,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case AdminGumpPage.ClientInfo:
|
||||
{
|
||||
Mobile m = state as Mobile;
|
||||
|
||||
if ( m == null )
|
||||
if ( !(state is Mobile m) )
|
||||
break;
|
||||
|
||||
AddClientHeader();
|
||||
|
|
@ -764,17 +760,12 @@ namespace Server.Gumps
|
|||
|
||||
for ( int i = 0, index = (listPage * 12); i < 12 && index >= 0 && index < m_List.Count; ++i, ++index )
|
||||
{
|
||||
Account a = m_List[index] as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(m_List[index] is Account a) )
|
||||
continue;
|
||||
|
||||
int offset = 140 + (i * 20);
|
||||
|
||||
AccessLevel accessLevel;
|
||||
bool online;
|
||||
|
||||
GetAccountInfo( a, out accessLevel, out online );
|
||||
GetAccountInfo( a, out var accessLevel, out var online );
|
||||
|
||||
if ( rads == null )
|
||||
{
|
||||
|
|
@ -811,9 +802,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case AdminGumpPage.AccountDetails_ChangePassword:
|
||||
{
|
||||
Account a = state as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(state is Account a) )
|
||||
break;
|
||||
|
||||
AddHtml( 10, 125, 400, 20, Color( Center( "Change Password" ), LabelColor32 ), false, false );
|
||||
|
|
@ -833,9 +822,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case AdminGumpPage.AccountDetails_ChangeAccess:
|
||||
{
|
||||
Account a = state as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(state is Account a) )
|
||||
break;
|
||||
|
||||
AddHtml( 10, 125, 400, 20, Color( Center( "Change Access Level" ), LabelColor32 ), false, false );
|
||||
|
|
@ -868,9 +855,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case AdminGumpPage.AccountDetails_Information:
|
||||
{
|
||||
Account a = state as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(state is Account a) )
|
||||
break;
|
||||
|
||||
int charCount = 0;
|
||||
|
|
@ -892,10 +877,7 @@ namespace Server.Gumps
|
|||
AddLabel( 20, 190, LabelHue, "Status:" );
|
||||
AddLabel( 200, 190, a.Banned ? RedHue : GreenHue, a.Banned ? "Banned" : "Active" );
|
||||
|
||||
DateTime banTime;
|
||||
TimeSpan banDuration;
|
||||
|
||||
if ( a.Banned && a.GetBanTags( out banTime, out banDuration ) )
|
||||
if ( a.Banned && a.GetBanTags( out var banTime, out var banDuration ) )
|
||||
{
|
||||
if ( banDuration == TimeSpan.MaxValue )
|
||||
{
|
||||
|
|
@ -956,9 +938,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case AdminGumpPage.AccountDetails_Access:
|
||||
{
|
||||
Account a = state as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(state is Account a) )
|
||||
break;
|
||||
|
||||
AddHtml( 10, 125, 400, 20, Color( Center( "Access" ), LabelColor32 ), false, false );
|
||||
|
|
@ -970,9 +950,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case AdminGumpPage.AccountDetails_Access_ClientIPs:
|
||||
{
|
||||
Account a = state as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(state is Account a) )
|
||||
break;
|
||||
|
||||
if ( m_List == null )
|
||||
|
|
@ -1017,9 +995,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case AdminGumpPage.AccountDetails_Access_Restrictions:
|
||||
{
|
||||
Account a = state as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(state is Account a) )
|
||||
break;
|
||||
|
||||
if ( m_List == null )
|
||||
|
|
@ -1061,9 +1037,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case AdminGumpPage.AccountDetails_Characters:
|
||||
{
|
||||
Account a = state as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(state is Account a) )
|
||||
break;
|
||||
|
||||
AddHtml( 10, 125, 400, 20, Color( Center( "Characters" ), LabelColor32 ), false, false );
|
||||
|
|
@ -1103,9 +1077,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case AdminGumpPage.AccountDetails_Comments:
|
||||
{
|
||||
Account a = state as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(state is Account a) )
|
||||
break;
|
||||
|
||||
AddHtml( 10, 125, 400, 20, Color( Center( "Comments" ), LabelColor32 ), false, false );
|
||||
|
|
@ -1133,9 +1105,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case AdminGumpPage.AccountDetails_Tags:
|
||||
{
|
||||
Account a = state as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(state is Account a) )
|
||||
break;
|
||||
|
||||
AddHtml( 10, 125, 400, 20, Color( Center( "Tags" ), LabelColor32 ), false, false );
|
||||
|
|
@ -1215,8 +1185,11 @@ namespace Server.Gumps
|
|||
{
|
||||
m_List = new ArrayList();
|
||||
|
||||
foreach ( Account acct in Accounts.GetAccounts() )
|
||||
foreach ( IAccount ia in Accounts.GetAccounts() )
|
||||
{
|
||||
if (!(ia is Account acct))
|
||||
continue;
|
||||
|
||||
IPAddress[] loginList = acct.LoginIPs;
|
||||
|
||||
bool contains = false;
|
||||
|
|
@ -1256,10 +1229,7 @@ namespace Server.Gumps
|
|||
|
||||
int offset = 200 + (i * 20);
|
||||
|
||||
AccessLevel accessLevel;
|
||||
bool online;
|
||||
|
||||
GetAccountInfo( a, out accessLevel, out online );
|
||||
GetAccountInfo( a, out var accessLevel, out var online );
|
||||
|
||||
AddLabelCropped( 12, offset, 120, 20, LabelHue, a.Username );
|
||||
AddLabelCropped( 132, offset, 120, 20, LabelHue, FormatAccessLevel( accessLevel ) );
|
||||
|
|
@ -1671,9 +1641,8 @@ namespace Server.Gumps
|
|||
if ( m_PageType == AdminGumpPage.Accounts )
|
||||
{
|
||||
ArrayList list = m_List;
|
||||
ArrayList rads = m_State as ArrayList;
|
||||
|
||||
if ( list != null && rads != null )
|
||||
if ( list != null && m_State is ArrayList rads )
|
||||
{
|
||||
for ( int i = 0, v = m_ListPage*12; i < 12 && v < list.Count; ++i, ++v )
|
||||
{
|
||||
|
|
@ -1780,10 +1749,9 @@ namespace Server.Gumps
|
|||
case 210:
|
||||
case 211:
|
||||
{
|
||||
TextRelay relay = info.GetTextEntry( 0 );
|
||||
string text = ( relay == null ? null : relay.Text.Trim() );
|
||||
string text = info.GetTextEntry( 0 )?.Text.Trim();
|
||||
|
||||
if ( text == null || text.Length == 0 )
|
||||
if ( string.IsNullOrEmpty(text) )
|
||||
{
|
||||
notice = "You must enter text to broadcast it.";
|
||||
}
|
||||
|
|
@ -1956,11 +1924,10 @@ namespace Server.Gumps
|
|||
|
||||
ArrayList results = new ArrayList();
|
||||
|
||||
TextRelay matchEntry = info.GetTextEntry( 0 );
|
||||
string match = ( matchEntry == null ? null : matchEntry.Text.Trim().ToLower() );
|
||||
string match = info.GetTextEntry( 0 )?.Text.Trim().ToLower();
|
||||
string notice = null;
|
||||
|
||||
if ( match == null || match.Length == 0 )
|
||||
if ( string.IsNullOrEmpty(match) )
|
||||
{
|
||||
notice = String.Format( "You must enter {0} to search.", forName ? "a name" : "an ip address" );
|
||||
}
|
||||
|
|
@ -2022,9 +1989,7 @@ namespace Server.Gumps
|
|||
|
||||
if ( m_List != null && index >= 0 && index < m_List.Count )
|
||||
{
|
||||
NetState ns = m_List[index] as NetState;
|
||||
|
||||
if ( ns == null )
|
||||
if ( !(m_List[index] is NetState ns) )
|
||||
break;
|
||||
|
||||
Mobile m = ns.Mobile;
|
||||
|
|
@ -2057,20 +2022,17 @@ namespace Server.Gumps
|
|||
case 5: from.Prompt = new AddTagNamePrompt( m_State as Account ); from.SendMessage( "Enter the new tag name." ); break;
|
||||
case 6:
|
||||
{
|
||||
TextRelay unEntry = info.GetTextEntry( 0 );
|
||||
TextRelay pwEntry = info.GetTextEntry( 1 );
|
||||
|
||||
string un = ( unEntry == null ? null : unEntry.Text.Trim() );
|
||||
string pw = ( pwEntry == null ? null : pwEntry.Text.Trim() );
|
||||
string un = info.GetTextEntry( 0 )?.Text.Trim();
|
||||
string pw = info.GetTextEntry( 1 )?.Text.Trim();
|
||||
|
||||
Account dispAccount = null;
|
||||
string notice;
|
||||
|
||||
if ( un == null || un.Length == 0 )
|
||||
if ( string.IsNullOrEmpty(un) )
|
||||
{
|
||||
notice = "You must enter a username to add an account.";
|
||||
}
|
||||
else if ( pw == null || pw.Length == 0 )
|
||||
else if ( string.IsNullOrEmpty(pw) )
|
||||
{
|
||||
notice = "You must enter a password to add an account.";
|
||||
}
|
||||
|
|
@ -2098,10 +2060,10 @@ namespace Server.Gumps
|
|||
ArrayList results;
|
||||
|
||||
TextRelay matchEntry = info.GetTextEntry( 0 );
|
||||
string match = ( matchEntry == null ? null : matchEntry.Text.Trim().ToLower() );
|
||||
string match = matchEntry?.Text.Trim().ToLower();
|
||||
string notice = null;
|
||||
|
||||
if ( match == null || match.Length == 0 )
|
||||
if ( string.IsNullOrEmpty(match) )
|
||||
{
|
||||
results = new ArrayList( (ICollection)Accounts.GetAccounts() );
|
||||
results.Sort( AccountComparer.Instance );
|
||||
|
|
@ -2110,10 +2072,10 @@ namespace Server.Gumps
|
|||
else
|
||||
{
|
||||
results = new ArrayList();
|
||||
foreach ( Account check in Accounts.GetAccounts() )
|
||||
foreach ( IAccount acct in Accounts.GetAccounts() )
|
||||
{
|
||||
if ( check.Username.ToLower().IndexOf( match ) >= 0 )
|
||||
results.Add( check );
|
||||
if ( acct.Username.ToLower().IndexOf( match ) >= 0 )
|
||||
results.Add( acct );
|
||||
}
|
||||
|
||||
results.Sort( AccountComparer.Instance );
|
||||
|
|
@ -2130,9 +2092,7 @@ namespace Server.Gumps
|
|||
case 9: from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_ChangeAccess, 0, null, null, m_State ) ); break;
|
||||
case 10: case 11:
|
||||
{
|
||||
Account a = m_State as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(m_State is Account a) )
|
||||
break;
|
||||
|
||||
a.SetUnspecifiedBan( from );
|
||||
|
|
@ -2147,21 +2107,19 @@ namespace Server.Gumps
|
|||
}
|
||||
case 12:
|
||||
{
|
||||
Account a = m_State as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(m_State is Account a) )
|
||||
break;
|
||||
|
||||
TextRelay passwordEntry = info.GetTextEntry( 0 );
|
||||
TextRelay confirmEntry = info.GetTextEntry( 1 );
|
||||
|
||||
string password = ( passwordEntry == null ? null : passwordEntry.Text.Trim() );
|
||||
string confirm = ( confirmEntry == null ? null : confirmEntry.Text.Trim() );
|
||||
string password = passwordEntry?.Text.Trim();
|
||||
string confirm = confirmEntry?.Text.Trim();
|
||||
|
||||
string notice;
|
||||
AdminGumpPage page = AdminGumpPage.AccountDetails_ChangePassword;
|
||||
|
||||
if ( password == null || password.Length == 0 )
|
||||
if ( string.IsNullOrEmpty(password) )
|
||||
{
|
||||
notice = "You must enter the password.";
|
||||
}
|
||||
|
|
@ -2183,9 +2141,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case 16: // view shared
|
||||
{
|
||||
Account a = m_State as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(m_State is Account a) )
|
||||
break;
|
||||
|
||||
ArrayList list = GetSharedAccounts( a.LoginIPs );
|
||||
|
|
@ -2207,9 +2163,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case 17: // ban shared
|
||||
{
|
||||
Account a = m_State as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(m_State is Account a) )
|
||||
break;
|
||||
|
||||
ArrayList list = GetSharedAccounts( a.LoginIPs );
|
||||
|
|
@ -2238,9 +2192,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case 18: // firewall all
|
||||
{
|
||||
Account a = m_State as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(m_State is Account a) )
|
||||
break;
|
||||
|
||||
if ( a.LoginIPs.Length > 0 )
|
||||
|
|
@ -2256,17 +2208,15 @@ namespace Server.Gumps
|
|||
}
|
||||
case 19: // add
|
||||
{
|
||||
Account a = m_State as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(m_State is Account a) )
|
||||
break;
|
||||
|
||||
TextRelay entry = info.GetTextEntry( 0 );
|
||||
string ip = ( entry == null ? null : entry.Text.Trim() );
|
||||
string ip = entry?.Text.Trim();
|
||||
|
||||
string notice;
|
||||
|
||||
if ( ip == null || ip.Length == 0 )
|
||||
if ( string.IsNullOrEmpty(ip) )
|
||||
{
|
||||
notice = "You must enter an address to add.";
|
||||
}
|
||||
|
|
@ -2307,9 +2257,7 @@ namespace Server.Gumps
|
|||
case 23:
|
||||
case 24:
|
||||
{
|
||||
Account a = m_State as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(m_State is Account a) )
|
||||
break;
|
||||
|
||||
AccessLevel newLevel;
|
||||
|
|
@ -2338,9 +2286,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case 25:
|
||||
{
|
||||
Account a = m_State as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(m_State is Account a) )
|
||||
break;
|
||||
|
||||
from.SendGump( new WarningGump( 1060635, 30720, String.Format( "<center>Account of {0}</center><br>You are about to <em><basefont color=red>permanently delete</basefont></em> the account. Likewise, all characters on the account will be deleted, including equipped, inventory, and banked items. Any houses tied to the account will be demolished.<br><br>Do you wish to continue?", a.Username ), 0xFFC000, 420, 280, new WarningGumpCallback( AccountDelete_Callback ), m_State ) );
|
||||
|
|
@ -2354,9 +2300,8 @@ namespace Server.Gumps
|
|||
case 27: // Ban marked
|
||||
{
|
||||
ArrayList list = m_List;
|
||||
ArrayList rads = m_State as ArrayList;
|
||||
|
||||
if ( list == null || rads == null )
|
||||
if ( list == null || !(m_State is ArrayList rads) )
|
||||
break;
|
||||
|
||||
if ( rads.Count > 0 )
|
||||
|
|
@ -2369,9 +2314,8 @@ namespace Server.Gumps
|
|||
case 28: // Delete marked
|
||||
{
|
||||
ArrayList list = m_List;
|
||||
ArrayList rads = m_State as ArrayList;
|
||||
|
||||
if ( list == null || rads == null )
|
||||
if ( list == null || !(m_State is ArrayList rads) )
|
||||
break;
|
||||
|
||||
if ( rads.Count > 0 )
|
||||
|
|
@ -2384,9 +2328,8 @@ namespace Server.Gumps
|
|||
case 29: // Mark all
|
||||
{
|
||||
ArrayList list = m_List;
|
||||
ArrayList rads = m_State as ArrayList;
|
||||
|
||||
if ( list == null || rads == null )
|
||||
if ( list == null || !(m_State is ArrayList rads) )
|
||||
break;
|
||||
|
||||
from.SendGump( new AdminGump( from, AdminGumpPage.Accounts, m_ListPage, m_List, null, new ArrayList( list ) ) );
|
||||
|
|
@ -2397,7 +2340,7 @@ namespace Server.Gumps
|
|||
{
|
||||
ArrayList results = new ArrayList();
|
||||
|
||||
foreach ( Account acct in Accounts.GetAccounts() )
|
||||
foreach ( IAccount acct in Accounts.GetAccounts() )
|
||||
{
|
||||
bool empty = true;
|
||||
|
||||
|
|
@ -2419,9 +2362,9 @@ namespace Server.Gumps
|
|||
{
|
||||
ArrayList results = new ArrayList();
|
||||
|
||||
foreach ( Account acct in Accounts.GetAccounts() )
|
||||
foreach ( IAccount acct in Accounts.GetAccounts() )
|
||||
{
|
||||
if ( acct.Inactive )
|
||||
if ((acct as Account)?.Inactive == true )
|
||||
results.Add( acct );
|
||||
}
|
||||
|
||||
|
|
@ -2436,9 +2379,9 @@ namespace Server.Gumps
|
|||
{
|
||||
ArrayList results = new ArrayList();
|
||||
|
||||
foreach ( Account acct in Accounts.GetAccounts() )
|
||||
foreach ( IAccount acct in Accounts.GetAccounts() )
|
||||
{
|
||||
if ( acct.Banned )
|
||||
if ((acct as Account)?.Banned == true )
|
||||
results.Add( acct );
|
||||
}
|
||||
|
||||
|
|
@ -2500,9 +2443,7 @@ namespace Server.Gumps
|
|||
{
|
||||
index -= 50;
|
||||
|
||||
Account a = m_State as Account;
|
||||
|
||||
if ( a != null && index >= 0 && index < a.Length )
|
||||
if ( m_State is Account a && index >= 0 && index < a.Length )
|
||||
{
|
||||
Mobile m = a[index];
|
||||
|
||||
|
|
@ -2535,12 +2476,12 @@ namespace Server.Gumps
|
|||
case 0:
|
||||
{
|
||||
TextRelay matchEntry = info.GetTextEntry( 0 );
|
||||
string match = ( matchEntry == null ? null : matchEntry.Text.Trim() );
|
||||
string match = matchEntry?.Text.Trim();
|
||||
|
||||
string notice = null;
|
||||
ArrayList results = new ArrayList();
|
||||
|
||||
if ( match == null || match.Length == 0 )
|
||||
if ( string.IsNullOrEmpty(match) )
|
||||
{
|
||||
notice = "You must enter a username to search.";
|
||||
}
|
||||
|
|
@ -2676,17 +2617,14 @@ namespace Server.Gumps
|
|||
}
|
||||
case 3:
|
||||
{
|
||||
Account a = m.Account as Account;
|
||||
|
||||
if ( a != null )
|
||||
if ( m.Account is Account a )
|
||||
{
|
||||
CommandLogging.WriteLine( from, "{0} {1} {2} {3}", from.AccessLevel, CommandLogging.Format( from ), "banning", CommandLogging.Format( m ) );
|
||||
a.Banned = true;
|
||||
|
||||
NetState ns = m.NetState;
|
||||
|
||||
if ( ns != null )
|
||||
ns.Dispose();
|
||||
ns?.Dispose();
|
||||
|
||||
notice = "They have been banned.";
|
||||
}
|
||||
|
|
@ -2758,9 +2696,7 @@ namespace Server.Gumps
|
|||
{
|
||||
case 3:
|
||||
{
|
||||
Account a = m.Account as Account;
|
||||
|
||||
if ( a != null )
|
||||
if ( m.Account is Account a )
|
||||
from.SendGump( new BanDurationGump( a ) );
|
||||
|
||||
break;
|
||||
|
|
@ -2976,15 +2912,12 @@ namespace Server.Gumps
|
|||
{
|
||||
if ( x == null && y == null )
|
||||
return 0;
|
||||
else if ( x == null )
|
||||
if ( x == null )
|
||||
return -1;
|
||||
else if ( y == null )
|
||||
if ( y == null )
|
||||
return 1;
|
||||
|
||||
NetState a = x as NetState;
|
||||
NetState b = y as NetState;
|
||||
|
||||
if ( a == null || b == null )
|
||||
if ( !(x is NetState a) || !(y is NetState b) )
|
||||
throw new ArgumentException();
|
||||
|
||||
Mobile aMob = a.Mobile;
|
||||
|
|
@ -2992,17 +2925,16 @@ namespace Server.Gumps
|
|||
|
||||
if ( aMob == null && bMob == null )
|
||||
return 0;
|
||||
else if ( aMob == null )
|
||||
if ( aMob == null )
|
||||
return 1;
|
||||
else if ( bMob == null )
|
||||
if ( bMob == null )
|
||||
return -1;
|
||||
|
||||
if ( aMob.AccessLevel > bMob.AccessLevel )
|
||||
return -1;
|
||||
else if ( aMob.AccessLevel < bMob.AccessLevel )
|
||||
if ( aMob.AccessLevel < bMob.AccessLevel )
|
||||
return 1;
|
||||
else
|
||||
return Insensitive.Compare( aMob.Name, bMob.Name );
|
||||
return Insensitive.Compare( aMob.Name, bMob.Name );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3018,33 +2950,26 @@ namespace Server.Gumps
|
|||
{
|
||||
if ( x == null && y == null )
|
||||
return 0;
|
||||
else if ( x == null )
|
||||
if ( x == null )
|
||||
return -1;
|
||||
else if ( y == null )
|
||||
if ( y == null )
|
||||
return 1;
|
||||
|
||||
Account a = x as Account;
|
||||
Account b = y as Account;
|
||||
|
||||
if ( a == null || b == null )
|
||||
if ( !(x is Account a) || !(y is Account b) )
|
||||
throw new ArgumentException();
|
||||
|
||||
AccessLevel aLevel, bLevel;
|
||||
bool aOnline, bOnline;
|
||||
|
||||
GetAccountInfo( a, out aLevel, out aOnline );
|
||||
GetAccountInfo( b, out bLevel, out bOnline );
|
||||
GetAccountInfo( a, out var aLevel, out var aOnline );
|
||||
GetAccountInfo( b, out var bLevel, out var bOnline );
|
||||
|
||||
if ( aOnline && !bOnline )
|
||||
return -1;
|
||||
else if ( bOnline && !aOnline )
|
||||
if ( bOnline && !aOnline )
|
||||
return 1;
|
||||
else if ( aLevel > bLevel )
|
||||
if ( aLevel > bLevel )
|
||||
return -1;
|
||||
else if ( aLevel < bLevel )
|
||||
if ( aLevel < bLevel )
|
||||
return 1;
|
||||
else
|
||||
return Insensitive.Compare( a.Username, b.Username );
|
||||
return Insensitive.Compare( a.Username, b.Username );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -315,9 +315,8 @@ namespace Server.Gumps
|
|||
|
||||
AddButton( x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, i + 4, GumpButtonType.Reply, 0 );
|
||||
|
||||
if ( node is CAGObject )
|
||||
if ( node is CAGObject obj )
|
||||
{
|
||||
CAGObject obj = (CAGObject)node;
|
||||
int itemID = obj.ItemID;
|
||||
|
||||
Rectangle2D bounds = ItemBounds.Table[itemID];
|
||||
|
|
|
|||
|
|
@ -27,8 +27,7 @@ namespace Server.Gumps
|
|||
|
||||
private static void OnTarget( Mobile from, object target )
|
||||
{
|
||||
Mobile m = target as Mobile;
|
||||
if ( m == null || !m.Player )
|
||||
if ( !(target is Mobile m) || !m.Player )
|
||||
{
|
||||
from.SendMessage( "You must target a player." );
|
||||
return;
|
||||
|
|
@ -53,7 +52,7 @@ namespace Server.Gumps
|
|||
int x = 205 - ((title.Length / 2) * 7);
|
||||
if ( x < 120 )
|
||||
x = 120;
|
||||
AddLabel( x, 12, 2100, title );
|
||||
AddLabel( x, 12, 2100, title );
|
||||
|
||||
AddPage( 1 );
|
||||
AddButton( 12, 12, 0xFA8, 0xFAA, 0x7F, GumpButtonType.Reply, 0 );
|
||||
|
|
@ -97,7 +96,7 @@ namespace Server.Gumps
|
|||
public class CommentPrompt : Prompt
|
||||
{
|
||||
private Account m_Acct;
|
||||
public CommentPrompt( Account acct )
|
||||
public CommentPrompt( Account acct )
|
||||
{
|
||||
m_Acct = acct;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,8 +119,8 @@ namespace Server.Gumps
|
|||
|
||||
if ( box.TryDropItem( m_Mobile, toGive, false ) )
|
||||
{
|
||||
if ( toGive is BankCheck )
|
||||
m_Mobile.SendLocalizedMessage( 1060397, ( (BankCheck)toGive ).Worth.ToString() ); // ~1_AMOUNT~ gold has been deposited into your bank box.
|
||||
if ( toGive is BankCheck check )
|
||||
m_Mobile.SendLocalizedMessage( 1060397, check.Worth.ToString() ); // ~1_AMOUNT~ gold has been deposited into your bank box.
|
||||
|
||||
m_House.RemoveKeys( m_Mobile );
|
||||
new TempNoHousingRegion( m_House, m_Mobile );
|
||||
|
|
|
|||
|
|
@ -177,10 +177,10 @@ namespace Server.Gumps
|
|||
object child = node.Children[index];
|
||||
string name = "";
|
||||
|
||||
if ( child is ParentNode )
|
||||
name = ((ParentNode)child).Name;
|
||||
else if ( child is ChildNode )
|
||||
name = ((ChildNode)child).Name;
|
||||
if ( child is ParentNode parentNode )
|
||||
name = parentNode.Name;
|
||||
else if ( child is ChildNode childNode )
|
||||
name = childNode.Name;
|
||||
|
||||
AddImageTiled( x, y, EntryWidth, EntryHeight, EntryGumpID );
|
||||
AddLabelCropped( x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, name );
|
||||
|
|
@ -229,16 +229,10 @@ namespace Server.Gumps
|
|||
{
|
||||
object o = m_Node.Children[index];
|
||||
|
||||
if ( o is ParentNode )
|
||||
{
|
||||
from.SendGump( new GoGump( 0, from, m_Tree, (ParentNode)o ) );
|
||||
}
|
||||
if ( o is ParentNode node )
|
||||
from.SendGump( new GoGump( 0, from, m_Tree, node ) );
|
||||
else
|
||||
{
|
||||
ChildNode n = (ChildNode)o;
|
||||
|
||||
from.MoveToWorld( n.Location, m_Tree.Map );
|
||||
}
|
||||
from.MoveToWorld(((ChildNode)o).Location, m_Tree.Map );
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@ namespace Server.Gumps
|
|||
|
||||
if ( Guild.NewGuildSystem )
|
||||
{
|
||||
if ( m_Mobile is PlayerMobile )
|
||||
m_Mobile.SendGump( new GuildInfoGump( (PlayerMobile)m_Mobile, m_Guild ) );
|
||||
if ( m_Mobile is PlayerMobile mobile )
|
||||
mobile.SendGump( new GuildInfoGump( mobile, m_Guild ) );
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,9 +51,7 @@ namespace Server.Guilds
|
|||
{
|
||||
base.OnResponse( sender, info );
|
||||
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if ( pm == null || !IsMember( pm, guild ) )
|
||||
if ( !(sender.Mobile is PlayerMobile pm) || !IsMember( pm, guild ) )
|
||||
return;
|
||||
|
||||
GuildDisplayType display = m_Display;
|
||||
|
|
|
|||
|
|
@ -139,9 +139,7 @@ namespace Server.Guilds
|
|||
{
|
||||
base.OnResponse( sender, info );
|
||||
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if ( pm == null || !IsMember( pm, guild ) )
|
||||
if ( !(sender.Mobile is PlayerMobile pm) || !IsMember( pm, guild ) )
|
||||
return;
|
||||
|
||||
int id = info.ButtonID;
|
||||
|
|
|
|||
|
|
@ -43,9 +43,7 @@ namespace Server.Guilds
|
|||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if ( pm == null || pm.Guild != null )
|
||||
if ( !(sender.Mobile is PlayerMobile pm) || pm.Guild != null )
|
||||
return; //Sanity
|
||||
|
||||
switch( info.ButtonID )
|
||||
|
|
|
|||
|
|
@ -272,9 +272,7 @@ namespace Server.Guilds
|
|||
{
|
||||
base.OnResponse( sender, info );
|
||||
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if ( pm == null || !IsMember( pm, guild ) )
|
||||
if ( !(sender.Mobile is PlayerMobile pm) || !IsMember( pm, guild ) )
|
||||
return;
|
||||
|
||||
if ( AllowAdvancedSearch && info.ButtonID == 8 )
|
||||
|
|
|
|||
|
|
@ -62,9 +62,7 @@ namespace Server.Guilds
|
|||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if ( pm == null || !IsMember( pm, guild ) || !IsMember( m_Member, guild ) )
|
||||
if ( !(sender.Mobile is PlayerMobile pm) || !IsMember( pm, guild ) || !IsMember( m_Member, guild ) )
|
||||
return;
|
||||
|
||||
RankDefinition playerRank = pm.GuildRank;
|
||||
|
|
@ -192,15 +190,10 @@ namespace Server.Guilds
|
|||
|
||||
public void SetTitle_Callback( Mobile from, string text )
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
PlayerMobile targ = m_Member;
|
||||
|
||||
if ( pm == null || targ == null )
|
||||
if (!(from is PlayerMobile pm) || m_Member == null )
|
||||
return;
|
||||
|
||||
Guild g = targ.Guild as Guild;
|
||||
|
||||
if ( g == null || !IsMember( pm, g ) || !(pm.GuildRank.GetFlag( RankFlags.CanSetGuildTitle ) && (pm.GuildRank.Rank > targ.GuildRank.Rank || pm == targ)) )
|
||||
if ( !(m_Member.Guild is Guild g) || !IsMember( pm, g ) || !(pm.GuildRank.GetFlag( RankFlags.CanSetGuildTitle ) && (pm.GuildRank.Rank > m_Member.GuildRank.Rank || pm == m_Member)) )
|
||||
{
|
||||
if ( m_Member.GuildTitle == null || m_Member.GuildTitle.Length <= 0 )
|
||||
pm.SendLocalizedMessage( 1070746 ); // You don't have the permission to set that member's guild title.
|
||||
|
|
@ -220,11 +213,11 @@ namespace Server.Guilds
|
|||
else
|
||||
{
|
||||
if ( Insensitive.Equals( title, "none" ) )
|
||||
targ.GuildTitle = null;
|
||||
m_Member.GuildTitle = null;
|
||||
else
|
||||
targ.GuildTitle = title;
|
||||
m_Member.GuildTitle = title;
|
||||
|
||||
pm.SendLocalizedMessage( 1063156, targ.Name ); // The guild information for ~1_val~ has been updated.
|
||||
pm.SendLocalizedMessage( 1063156, m_Member.Name ); // The guild information for ~1_val~ has been updated.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,9 +182,7 @@ namespace Server.Guilds
|
|||
{
|
||||
base.OnResponse( sender, info );
|
||||
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if ( pm == null || !IsMember( pm, guild ) )
|
||||
if ( !(sender.Mobile is PlayerMobile pm) || !IsMember( pm, guild ) )
|
||||
return;
|
||||
|
||||
if ( info.ButtonID == 8 )
|
||||
|
|
|
|||
|
|
@ -22,15 +22,13 @@ namespace Server.Gumps
|
|||
if ( GuildGump.BadMember( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
|
||||
if ( targeted is Mobile )
|
||||
if ( targeted is Mobile m )
|
||||
{
|
||||
Mobile m = (Mobile)targeted;
|
||||
|
||||
PlayerState guildState = PlayerState.Find( m_Guild.Leader );
|
||||
PlayerState targetState = PlayerState.Find( m );
|
||||
|
||||
Faction guildFaction = ( guildState == null ? null : guildState.Faction );
|
||||
Faction targetFaction = ( targetState == null ? null : targetState.Faction );
|
||||
Faction guildFaction = guildState?.Faction;
|
||||
Faction targetFaction = targetState?.Faction;
|
||||
|
||||
if ( !m.Player )
|
||||
{
|
||||
|
|
@ -92,4 +90,4 @@ namespace Server.Gumps
|
|||
m_Mobile.SendGump( new GuildGump( m_Mobile, m_Guild ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,13 +115,15 @@ namespace Server.Gumps
|
|||
toGive = new BankCheck( m_House.Price );
|
||||
}
|
||||
|
||||
if (AccountGold.Enabled && toGive is BankCheck)
|
||||
BankCheck check = toGive as BankCheck;
|
||||
|
||||
if (AccountGold.Enabled && check != null)
|
||||
{
|
||||
var worth = ((BankCheck)toGive).Worth;
|
||||
var worth = check.Worth;
|
||||
|
||||
if (m_Mobile.Account != null && m_Mobile.Account.DepositGold(worth))
|
||||
{
|
||||
toGive.Delete();
|
||||
check.Delete();
|
||||
|
||||
m_Mobile.SendLocalizedMessage(1060397, worth.ToString("#,0"));
|
||||
// ~1_AMOUNT~ gold has been deposited into your bank box.
|
||||
|
|
@ -138,8 +140,8 @@ namespace Server.Gumps
|
|||
|
||||
if ( box.TryDropItem( m_Mobile, toGive, false ) )
|
||||
{
|
||||
if ( toGive is BankCheck )
|
||||
m_Mobile.SendLocalizedMessage( 1060397, ( (BankCheck)toGive ).Worth.ToString() ); // ~1_AMOUNT~ gold has been deposited into your bank box.
|
||||
if ( check != null )
|
||||
m_Mobile.SendLocalizedMessage( 1060397, check.Worth.ToString() ); // ~1_AMOUNT~ gold has been deposited into your bank box.
|
||||
|
||||
m_House.RemoveKeys( m_Mobile );
|
||||
m_House.Delete();
|
||||
|
|
|
|||
|
|
@ -127,10 +127,8 @@ namespace Server.Gumps
|
|||
string name;
|
||||
int labelHue = LabelHue;
|
||||
|
||||
if ( m is PlayerVendor )
|
||||
if ( m is PlayerVendor vendor )
|
||||
{
|
||||
PlayerVendor vendor = (PlayerVendor) m;
|
||||
|
||||
name = vendor.ShopName;
|
||||
|
||||
if ( vendor.IsOwner( from ) )
|
||||
|
|
@ -763,10 +761,10 @@ namespace Server.Gumps
|
|||
|
||||
foreach ( Mobile mobile in newHouse.InternalizedVendors )
|
||||
{
|
||||
if ( mobile is PlayerVendor )
|
||||
((PlayerVendor)mobile).House = newHouse;
|
||||
else if ( mobile is PlayerBarkeeper )
|
||||
((PlayerBarkeeper)mobile).House = newHouse;
|
||||
if ( mobile is PlayerVendor vendor )
|
||||
vendor.House = newHouse;
|
||||
else if ( mobile is PlayerBarkeeper barkeeper )
|
||||
barkeeper.House = newHouse;
|
||||
}
|
||||
|
||||
if ( house.MovingCrate != null )
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ namespace Server.Gumps
|
|||
AddImageTiled( 10, 40, width - 20, height - 80, 2624 );
|
||||
AddAlphaRegion( 10, 40, width - 20, height - 80 );
|
||||
|
||||
if ( content is int )
|
||||
AddHtmlLocalized( 10, 40, width - 20, height - 80, (int)content, contentColor, false, true );
|
||||
if ( content is int i )
|
||||
AddHtmlLocalized( 10, 40, width - 20, height - 80, i, contentColor, false, true );
|
||||
else if ( content is string )
|
||||
AddHtml( 10, 40, width - 20, height - 80, String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", contentColor, content ), false, true );
|
||||
|
||||
|
|
@ -41,8 +41,8 @@ namespace Server.Gumps
|
|||
|
||||
public override void OnResponse( Server.Network.NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( info.ButtonID == 1 && m_Callback != null )
|
||||
m_Callback( sender.Mobile, m_State );
|
||||
if ( info.ButtonID == 1 )
|
||||
m_Callback?.Invoke( sender.Mobile, m_State );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ namespace Server.Gumps
|
|||
|
||||
if ( from.Backpack != null )
|
||||
totalGold += from.Backpack.GetAmount( typeof( Gold ) );
|
||||
|
||||
|
||||
totalGold += Banker.GetBalance( from );
|
||||
|
||||
if ( totalGold < m_VI.Price )
|
||||
|
|
@ -132,9 +132,9 @@ namespace Server.Gumps
|
|||
|
||||
double days = (m_Vendor.HoldGold + m_Vendor.BankAccount) / ((double)perDay);
|
||||
|
||||
AddHtmlLocalized( 40, 25, 260, 20, 1038318, false, false ); // Amount of days I can work:
|
||||
AddHtmlLocalized( 40, 25, 260, 20, 1038318, false, false ); // Amount of days I can work:
|
||||
AddLabel( 300, 25, 0, ((int)days).ToString() );
|
||||
AddHtmlLocalized( 40, 48, 260, 20, 1038319, false, false ); // Earth days:
|
||||
AddHtmlLocalized( 40, 48, 260, 20, 1038319, false, false ); // Earth days:
|
||||
AddLabel( 300, 48, 0, ((int)(days / 12.0)).ToString() );
|
||||
}
|
||||
|
||||
|
|
@ -188,30 +188,29 @@ namespace Server.Gumps
|
|||
{
|
||||
int goldNeeded = perRealWorldDay - goldHeld;
|
||||
|
||||
AddHtmlLocalized( 40, 35, 260, 20, 1038320, 0x7FFF, false, false ); // Gold needed for 1 day of vendor salary:
|
||||
AddHtmlLocalized( 40, 35, 260, 20, 1038320, 0x7FFF, false, false ); // Gold needed for 1 day of vendor salary:
|
||||
AddLabel( 300, 35, 0x1F, goldNeeded.ToString() );
|
||||
}
|
||||
else
|
||||
{
|
||||
int days = goldHeld / perRealWorldDay;
|
||||
|
||||
AddHtmlLocalized( 40, 35, 260, 20, 1038318, 0x7FFF, false, false ); // # of days Vendor salary is paid for:
|
||||
AddHtmlLocalized( 40, 35, 260, 20, 1038318, 0x7FFF, false, false ); // # of days Vendor salary is paid for:
|
||||
AddLabel( 300, 35, 0x480, days.ToString() );
|
||||
}
|
||||
|
||||
AddHtmlLocalized( 40, 58, 260, 20, 1038324, 0x7FFF, false, false ); // My charge per real world day is:
|
||||
AddHtmlLocalized( 40, 58, 260, 20, 1038324, 0x7FFF, false, false ); // My charge per real world day is:
|
||||
AddLabel( 300, 58, 0x480, perRealWorldDay.ToString() );
|
||||
|
||||
AddHtmlLocalized( 40, 82, 260, 20, 1038322, 0x7FFF, false, false ); // Gold held in my account:
|
||||
AddHtmlLocalized( 40, 82, 260, 20, 1038322, 0x7FFF, false, false ); // Gold held in my account:
|
||||
AddLabel( 300, 82, 0x480, goldHeld.ToString() );
|
||||
|
||||
AddHtmlLocalized( 40, 108, 260, 20, 1062509, 0x7FFF, false, false ); // Shop Name:
|
||||
AddLabel( 140, 106, 0x66D, vendor.ShopName );
|
||||
|
||||
if ( vendor is RentedVendor )
|
||||
if ( vendor is RentedVendor rentedVendor )
|
||||
{
|
||||
int days, hours;
|
||||
((RentedVendor)vendor).ComputeRentalExpireDelay( out days, out hours );
|
||||
rentedVendor.ComputeRentalExpireDelay( out var days, out var hours );
|
||||
|
||||
AddLabel( 38, 132, 0x480, String.Format( "Location rental will expire in {0} day{1} and {2} hour{3}.", days, days != 1 ? "s" : "", hours, hours != 1 ? "s" : "" ) );
|
||||
}
|
||||
|
|
@ -342,7 +341,7 @@ namespace Server.Gumps
|
|||
return null;
|
||||
|
||||
Item i = null;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
ConstructorInfo ctor = m_Type.GetConstructor( new Type[0] );
|
||||
|
|
@ -352,7 +351,7 @@ namespace Server.Gumps
|
|||
catch
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
|
|
@ -544,10 +543,10 @@ namespace Server.Gumps
|
|||
|
||||
Mobile from = state.Mobile;
|
||||
|
||||
if ( m_Vendor is PlayerVendor && !((PlayerVendor)m_Vendor).CanInteractWith( from, true ) )
|
||||
if ( m_Vendor is PlayerVendor vendor && !vendor.CanInteractWith( from, true ) )
|
||||
return;
|
||||
|
||||
if ( m_Vendor is PlayerBarkeeper && !((PlayerBarkeeper)m_Vendor).IsOwner( from ) )
|
||||
if ( m_Vendor is PlayerBarkeeper barkeeper && !barkeeper.IsOwner( from ) )
|
||||
return;
|
||||
|
||||
if ( info.ButtonID == 0 )
|
||||
|
|
@ -738,10 +737,10 @@ namespace Server.Gumps
|
|||
if ( m_Item.Deleted )
|
||||
return;
|
||||
|
||||
if ( m_Vendor is PlayerVendor && !((PlayerVendor)m_Vendor).CanInteractWith( m_Mob, true ) )
|
||||
if ( m_Vendor is PlayerVendor vendor && !vendor.CanInteractWith( m_Mob, true ) )
|
||||
return;
|
||||
|
||||
if ( m_Vendor is PlayerBarkeeper && !((PlayerBarkeeper)m_Vendor).IsOwner( m_Mob ) )
|
||||
if ( m_Vendor is PlayerBarkeeper barkeeper && !barkeeper.IsOwner( m_Mob ) )
|
||||
return;
|
||||
|
||||
m_Item.Hue = hue;
|
||||
|
|
@ -767,10 +766,10 @@ namespace Server.Gumps
|
|||
if ( m_Vendor.Deleted )
|
||||
return;
|
||||
|
||||
if ( m_Vendor is PlayerVendor && !((PlayerVendor)m_Vendor).CanInteractWith( m_Mob, true ) )
|
||||
if ( m_Vendor is PlayerVendor vendor && !vendor.CanInteractWith( m_Mob, true ) )
|
||||
return;
|
||||
|
||||
if ( m_Vendor is PlayerBarkeeper && !((PlayerBarkeeper)m_Vendor).IsOwner( m_Mob ) )
|
||||
if ( m_Vendor is PlayerBarkeeper barkeeper && !barkeeper.IsOwner( m_Mob ) )
|
||||
return;
|
||||
|
||||
if ( m_FacialHair )
|
||||
|
|
|
|||
|
|
@ -205,10 +205,8 @@ namespace Server.Gumps
|
|||
{
|
||||
AddImageTiled( x - OffsetSize, y, TotalWidth, EntryHeight, BackGumpID + 4 );
|
||||
}
|
||||
else if ( o is Type )
|
||||
else if ( o is Type type )
|
||||
{
|
||||
Type type = (Type)o;
|
||||
|
||||
AddImageTiled( x, y, TypeWidth, EntryHeight, EntryGumpID );
|
||||
AddLabelCropped( x + TextOffsetX, y, TypeWidth - TextOffsetX, EntryHeight, TextHue, type.Name );
|
||||
x += TypeWidth + OffsetSize;
|
||||
|
|
@ -216,10 +214,8 @@ namespace Server.Gumps
|
|||
if ( SetGumpID != 0 )
|
||||
AddImageTiled( x, y, SetWidth, EntryHeight, SetGumpID );
|
||||
}
|
||||
else if ( o is PropertyInfo )
|
||||
else if ( o is PropertyInfo prop )
|
||||
{
|
||||
PropertyInfo prop = (PropertyInfo)o;
|
||||
|
||||
AddImageTiled( x, y, NameWidth, EntryHeight, EntryGumpID );
|
||||
AddLabelCropped( x + TextOffsetX, y, NameWidth - TextOffsetX, EntryHeight, TextHue, prop.Name );
|
||||
x += NameWidth + OffsetSize;
|
||||
|
|
@ -321,10 +317,10 @@ namespace Server.Gumps
|
|||
from.SendGump( new SetListOptionGump( prop, from, m_Object, m_Stack, m_Page, m_List, m_PoisonNames, m_PoisonValues ) );
|
||||
else if ( IsType( type, typeofMap ) )
|
||||
from.SendGump( new SetListOptionGump( prop, from, m_Object, m_Stack, m_Page, m_List, Map.GetMapNames(), Map.GetMapValues() ) );
|
||||
else if ( IsType( type, typeofSkills ) && m_Object is Mobile )
|
||||
else if ( IsType( type, typeofSkills ) && m_Object is Mobile mobile )
|
||||
{
|
||||
from.SendGump( new PropertiesGump( from, m_Object, m_Stack, m_List, m_Page ) );
|
||||
from.SendGump( new SkillsGump( from, (Mobile)m_Object ) );
|
||||
from.SendGump( new PropertiesGump( from, mobile, m_Stack, m_List, m_Page ) );
|
||||
from.SendGump( new SkillsGump( from, mobile ) );
|
||||
}
|
||||
else if ( HasAttribute( type, typeofPropertyObject, true ) )
|
||||
{
|
||||
|
|
@ -378,9 +374,7 @@ namespace Server.Gumps
|
|||
if ( attrs.Length == 0 )
|
||||
return new string[0];
|
||||
|
||||
CustomEnumAttribute ce = attrs[0] as CustomEnumAttribute;
|
||||
|
||||
if ( ce == null )
|
||||
if ( !(attrs[0] is CustomEnumAttribute ce) )
|
||||
return new string[0];
|
||||
|
||||
return ce.Names;
|
||||
|
|
@ -465,60 +459,56 @@ namespace Server.Gumps
|
|||
{
|
||||
return "-null-";
|
||||
}
|
||||
else if ( o is string )
|
||||
if ( o is string s )
|
||||
{
|
||||
return String.Format( "\"{0}\"", (string)o );
|
||||
return String.Format( "\"{0}\"", s );
|
||||
}
|
||||
else if ( o is bool )
|
||||
if ( o is bool )
|
||||
{
|
||||
return o.ToString();
|
||||
}
|
||||
else if ( o is char )
|
||||
if ( o is char c )
|
||||
{
|
||||
return String.Format( "0x{0:X} '{1}'", (int)(char)o, (char)o );
|
||||
return String.Format( "0x{0:X} '{1}'", (int)c, c );
|
||||
}
|
||||
else if ( o is Serial )
|
||||
if ( o is Serial serial )
|
||||
{
|
||||
Serial s = (Serial)o;
|
||||
|
||||
if ( s.IsValid )
|
||||
if ( serial.IsValid )
|
||||
{
|
||||
if ( s.IsItem )
|
||||
if ( serial.IsItem )
|
||||
{
|
||||
return String.Format( "(I) 0x{0:X}", s.Value );
|
||||
return String.Format( "(I) 0x{0:X}", serial.Value );
|
||||
}
|
||||
else if ( s.IsMobile )
|
||||
if ( serial.IsMobile )
|
||||
{
|
||||
return String.Format( "(M) 0x{0:X}", s.Value );
|
||||
return String.Format( "(M) 0x{0:X}", serial.Value );
|
||||
}
|
||||
}
|
||||
|
||||
return String.Format( "(?) 0x{0:X}", s.Value );
|
||||
return String.Format( "(?) 0x{0:X}", serial.Value );
|
||||
}
|
||||
else if ( o is byte || o is sbyte || o is short || o is ushort || o is int || o is uint || o is long || o is ulong )
|
||||
if ( o is byte || o is sbyte || o is short || o is ushort || o is int || o is uint || o is long || o is ulong )
|
||||
{
|
||||
return String.Format( "{0} (0x{0:X})", o );
|
||||
}
|
||||
else if ( o is Mobile )
|
||||
if ( o is Mobile mobile )
|
||||
{
|
||||
return String.Format( "(M) 0x{0:X} \"{1}\"", ((Mobile)o).Serial.Value, ((Mobile)o).Name );
|
||||
return String.Format( "(M) 0x{0:X} \"{1}\"", mobile.Serial.Value, mobile.Name );
|
||||
}
|
||||
else if ( o is Item )
|
||||
if ( o is Item item )
|
||||
{
|
||||
return String.Format( "(I) 0x{0:X}", ((Item)o).Serial.Value );
|
||||
return String.Format( "(I) 0x{0:X}", item.Serial.Value );
|
||||
}
|
||||
else if ( o is Type )
|
||||
if ( o is Type type )
|
||||
{
|
||||
return ((Type)o).Name;
|
||||
return type.Name;
|
||||
}
|
||||
else if ( o is TextDefinition )
|
||||
if ( o is TextDefinition definition )
|
||||
{
|
||||
return ((TextDefinition)o).Format( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
return o.ToString();
|
||||
return definition.Format( true );
|
||||
}
|
||||
|
||||
return o.ToString();
|
||||
}
|
||||
|
||||
private ArrayList BuildList()
|
||||
|
|
@ -653,56 +643,52 @@ namespace Server.Gumps
|
|||
{
|
||||
return "-null-";
|
||||
}
|
||||
else if ( o is string )
|
||||
if ( o is string s )
|
||||
{
|
||||
return String.Format( "\"{0}\"", (string)o );
|
||||
return String.Format( "\"{0}\"", s );
|
||||
}
|
||||
else if ( o is bool )
|
||||
if ( o is bool )
|
||||
{
|
||||
return o.ToString();
|
||||
}
|
||||
else if ( o is char )
|
||||
if ( o is char c )
|
||||
{
|
||||
return String.Format( "0x{0:X} '{1}'", (int)(char)o, (char)o );
|
||||
return String.Format( "0x{0:X} '{1}'", (int)c, c );
|
||||
}
|
||||
else if ( o is Serial )
|
||||
if ( o is Serial serial )
|
||||
{
|
||||
Serial s = (Serial)o;
|
||||
|
||||
if ( s.IsValid )
|
||||
if ( serial.IsValid )
|
||||
{
|
||||
if ( s.IsItem )
|
||||
if ( serial.IsItem )
|
||||
{
|
||||
return String.Format( "(I) 0x{0:X}", s.Value );
|
||||
return String.Format( "(I) 0x{0:X}", serial.Value );
|
||||
}
|
||||
else if ( s.IsMobile )
|
||||
if ( serial.IsMobile )
|
||||
{
|
||||
return String.Format( "(M) 0x{0:X}", s.Value );
|
||||
return String.Format( "(M) 0x{0:X}", serial.Value );
|
||||
}
|
||||
}
|
||||
|
||||
return String.Format( "(?) 0x{0:X}", s.Value );
|
||||
return String.Format( "(?) 0x{0:X}", serial.Value );
|
||||
}
|
||||
else if ( o is byte || o is sbyte || o is short || o is ushort || o is int || o is uint || o is long || o is ulong )
|
||||
if ( o is byte || o is sbyte || o is short || o is ushort || o is int || o is uint || o is long || o is ulong )
|
||||
{
|
||||
return String.Format( "{0} (0x{0:X})", o );
|
||||
}
|
||||
else if ( o is Mobile )
|
||||
if ( o is Mobile mobile )
|
||||
{
|
||||
return String.Format( "(M) 0x{0:X} \"{1}\"", ((Mobile)o).Serial.Value, ((Mobile)o).Name );
|
||||
return String.Format( "(M) 0x{0:X} \"{1}\"", mobile.Serial.Value, mobile.Name );
|
||||
}
|
||||
else if ( o is Item )
|
||||
if ( o is Item item )
|
||||
{
|
||||
return String.Format( "(I) 0x{0:X}", ((Item)o).Serial.Value );
|
||||
return String.Format( "(I) 0x{0:X}", item.Serial.Value );
|
||||
}
|
||||
else if ( o is Type )
|
||||
if ( o is Type type )
|
||||
{
|
||||
return ((Type)o).Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return o.ToString();
|
||||
return type.Name;
|
||||
}
|
||||
|
||||
return o.ToString();
|
||||
}
|
||||
|
||||
private class PropertySorter : IComparer
|
||||
|
|
@ -717,9 +703,9 @@ namespace Server.Gumps
|
|||
{
|
||||
if ( x == null && y == null )
|
||||
return 0;
|
||||
else if ( x == null )
|
||||
if ( x == null )
|
||||
return -1;
|
||||
else if ( y == null )
|
||||
if ( y == null )
|
||||
return 1;
|
||||
|
||||
PropertyInfo a = x as PropertyInfo;
|
||||
|
|
@ -759,9 +745,9 @@ namespace Server.Gumps
|
|||
{
|
||||
if ( x == null && y == null )
|
||||
return 0;
|
||||
else if ( x == null )
|
||||
if ( x == null )
|
||||
return -1;
|
||||
else if ( y == null )
|
||||
if ( y == null )
|
||||
return 1;
|
||||
|
||||
if ( !(x is DictionaryEntry) || !(y is DictionaryEntry) )
|
||||
|
|
@ -770,10 +756,7 @@ namespace Server.Gumps
|
|||
DictionaryEntry de1 = (DictionaryEntry)x;
|
||||
DictionaryEntry de2 = (DictionaryEntry)y;
|
||||
|
||||
Type a = (Type)de1.Key;
|
||||
Type b = (Type)de2.Key;
|
||||
|
||||
return GetDistance( a ).CompareTo( GetDistance( b ) );
|
||||
return GetDistance( (Type)de1.Key ).CompareTo( GetDistance( (Type)de2.Key ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,8 +78,8 @@ namespace Server.Gumps
|
|||
|
||||
if ( val == null )
|
||||
initialText = "";
|
||||
else if ( val is TextDefinition )
|
||||
initialText = ((TextDefinition)val).GetValue();
|
||||
else if ( val is TextDefinition definition )
|
||||
initialText = definition.GetValue();
|
||||
else
|
||||
initialText = val.ToString();
|
||||
|
||||
|
|
@ -279,4 +279,4 @@ namespace Server.Gumps
|
|||
m_Mobile.SendGump( new PropertiesGump( m_Mobile, m_Object, m_Stack, m_List, m_Page ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,9 +148,7 @@ namespace Server.Gumps
|
|||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
IPoint3D p = targeted as IPoint3D;
|
||||
|
||||
if ( p != null )
|
||||
if ( targeted is IPoint3D p )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -235,4 +233,4 @@ namespace Server.Gumps
|
|||
m_Mobile.SendGump( new PropertiesGump( m_Mobile, m_Object, m_Stack, m_List, m_Page ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,9 +153,7 @@ namespace Server.Gumps
|
|||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
IPoint3D p = targeted as IPoint3D;
|
||||
|
||||
if ( p != null )
|
||||
if ( targeted is IPoint3D p )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -241,4 +239,4 @@ namespace Server.Gumps
|
|||
m_Mobile.SendGump( new PropertiesGump( m_Mobile, m_Object, m_Stack, m_List, m_Page ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ namespace Server.Gumps
|
|||
Titles.AwardKarma( g, karmaAward, true );
|
||||
}
|
||||
|
||||
if ( m is PlayerMobile && ((PlayerMobile)m).NpcGuild == NpcGuild.ThievesGuild )
|
||||
if ( m is PlayerMobile mobile && mobile.NpcGuild == NpcGuild.ThievesGuild )
|
||||
return;
|
||||
|
||||
if ( killers.Count > 0 )
|
||||
|
|
@ -164,9 +164,8 @@ namespace Server.Gumps
|
|||
Timer.DelayCall(TimeSpan.FromMinutes(10), new TimerStateCallback(ReportedListExpiry_Callback), new object[] { from, killer });
|
||||
}
|
||||
|
||||
if (killer is PlayerMobile)
|
||||
if (killer is PlayerMobile pk)
|
||||
{
|
||||
PlayerMobile pk = (PlayerMobile)killer;
|
||||
pk.ResetKillTime();
|
||||
pk.SendLocalizedMessage(1049067);//You have been reported for murder!
|
||||
|
||||
|
|
@ -193,4 +192,4 @@ namespace Server.Gumps
|
|||
from.SendGump( new ReportMurdererGump( from, m_Killers, m_Idx ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,12 +192,12 @@ namespace Server.Gumps
|
|||
}
|
||||
}
|
||||
|
||||
if ( m_FromSacrifice && from is PlayerMobile )
|
||||
if ( m_FromSacrifice && from is PlayerMobile mobile )
|
||||
{
|
||||
((PlayerMobile)from).AvailableResurrects -= 1;
|
||||
mobile.AvailableResurrects -= 1;
|
||||
|
||||
Container pack = from.Backpack;
|
||||
Container corpse = from.Corpse;
|
||||
Container pack = mobile.Backpack;
|
||||
Container corpse = mobile.Corpse;
|
||||
|
||||
if ( pack != null && corpse != null )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -325,9 +325,7 @@ namespace Server.Gumps
|
|||
if ( !m_Contract.IsUsableBy( from, true, false, true, true ) )
|
||||
return;
|
||||
|
||||
Mobile mob = targeted as Mobile;
|
||||
|
||||
if ( mob == null || !mob.Player || !mob.Alive || mob == from )
|
||||
if ( !(targeted is Mobile mob) || !mob.Player || !mob.Alive || mob == from )
|
||||
{
|
||||
from.SendLocalizedMessage(1071984); //That is not a valid target for a rental contract!
|
||||
}
|
||||
|
|
@ -555,7 +553,7 @@ namespace Server.Gumps
|
|||
|
||||
/* The landlord for this vendor is offering you a partial refund of your rental fee
|
||||
* in exchange for immediate termination of your rental contract.<BR><BR>
|
||||
*
|
||||
*
|
||||
* If you accept this offer, the vendor will be immediately dismissed. You will then
|
||||
* be able to claim the inventory and any funds the vendor may be holding for you via
|
||||
* a context menu on the house sign for this house.
|
||||
|
|
@ -613,4 +611,4 @@ namespace Server.Gumps
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ namespace Server.Gumps
|
|||
|
||||
public static void ViewHouses_OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( targeted is Mobile )
|
||||
from.SendGump( new ViewHousesGump( from, GetHouses( (Mobile)targeted ), null ) );
|
||||
if ( targeted is Mobile mobile )
|
||||
from.SendGump( new ViewHousesGump( from, GetHouses( mobile ), null ) );
|
||||
}
|
||||
|
||||
private class HouseComparer : IComparer<BaseHouse>
|
||||
|
|
@ -44,9 +44,7 @@ namespace Server.Gumps
|
|||
{
|
||||
List<BaseHouse> list = new List<BaseHouse>();
|
||||
|
||||
Account acct = owner.Account as Account;
|
||||
|
||||
if ( acct == null )
|
||||
if ( !(owner.Account is Account acct) )
|
||||
{
|
||||
list.AddRange( BaseHouse.GetHouses( owner ) );
|
||||
}
|
||||
|
|
@ -114,21 +112,21 @@ namespace Server.Gumps
|
|||
|
||||
AddHtml( 15, 40 + ((i % 15) * 20), 20, 20, Color( String.Format( "{0}.", i+1 ), White ), false, false );
|
||||
|
||||
if ( name is int )
|
||||
AddHtmlLocalized( 35, 40 + ((i % 15) * 20), 160, 20, (int)name, White16, false, false );
|
||||
else if ( name is string )
|
||||
AddHtml( 35, 40 + ((i % 15) * 20), 160, 20, Color( (string)name, White ), false, false );
|
||||
if ( name is int nameInt )
|
||||
AddHtmlLocalized( 35, 40 + ((i % 15) * 20), 160, 20, nameInt, White16, false, false );
|
||||
else
|
||||
AddHtml( 35, 40 + ((i % 15) * 20), 160, 20, Color( name.ToString(), White ), false, false );
|
||||
|
||||
AddButton( 198, 39 + ((i % 15) * 20), 4005, 4007, i+1, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string houseName, owner, location;
|
||||
string location;
|
||||
Map map = sel.Map;
|
||||
|
||||
houseName = (sel.Sign == null) ? "An Unnamed House" : sel.Sign.GetName();
|
||||
owner = (sel.Owner == null) ? "nobody" : sel.Owner.Name;
|
||||
var houseName = (sel.Sign == null) ? "An Unnamed House" : sel.Sign.GetName();
|
||||
var owner = (sel.Owner == null) ? "nobody" : sel.Owner.Name;
|
||||
|
||||
int xLong = 0, yLat = 0, xMins = 0, yMins = 0;
|
||||
bool xEast = false, ySouth = false;
|
||||
|
|
@ -136,7 +134,7 @@ namespace Server.Gumps
|
|||
bool valid = Sextant.Format( sel.Location, map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth );
|
||||
|
||||
if ( valid )
|
||||
location = String.Format( "{0}° {1}'{2}, {3}° {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W" );
|
||||
location = String.Format( "{0}° {1}'{2}, {3}° {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W" );
|
||||
else
|
||||
location = "unknown";
|
||||
|
||||
|
|
@ -300,4 +298,4 @@ namespace Server.Gumps
|
|||
AddAlphaRegion( x, y, width, height );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ namespace Server.Gumps
|
|||
AddImageTiled( 10, 40, width - 20, height - 80, 2624 );
|
||||
AddAlphaRegion( 10, 40, width - 20, height - 80 );
|
||||
|
||||
if ( content is int )
|
||||
AddHtmlLocalized( 10, 40, width - 20, height - 80, (int)content, contentColor, false, true );
|
||||
if ( content is int i )
|
||||
AddHtmlLocalized( 10, 40, width - 20, height - 80, i, contentColor, false, true );
|
||||
else if ( content is string )
|
||||
AddHtml( 10, 40, width - 20, height - 80, String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", contentColor, content ), false, true );
|
||||
|
||||
|
|
@ -55,10 +55,13 @@ namespace Server.Gumps
|
|||
|
||||
public override void OnResponse( Server.Network.NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( info.ButtonID == 1 && m_Callback != null )
|
||||
if (m_Callback == null)
|
||||
return;
|
||||
|
||||
if ( info.ButtonID == 1)
|
||||
m_Callback( sender.Mobile, true, m_State );
|
||||
else if ( m_Callback != null )
|
||||
m_Callback( sender.Mobile, false, m_State );
|
||||
else
|
||||
m_Callback.Invoke( sender.Mobile, false, m_State );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ namespace Server.Gumps
|
|||
{
|
||||
Mobile m = states[i].Mobile;
|
||||
|
||||
if ( m != null && (m == owner || !m.Hidden || owner.AccessLevel >= m.AccessLevel || (m is PlayerMobile && ((PlayerMobile)m).VisibilityList.Contains( owner ) ) ) )
|
||||
if ( m != null && (m == owner || !m.Hidden || owner.AccessLevel >= m.AccessLevel || (m is PlayerMobile mobile && mobile.VisibilityList.Contains( owner ) ) ) )
|
||||
{
|
||||
if ( filter != null && ( m.Name == null || m.Name.ToLower().IndexOf( filter ) < 0 ) )
|
||||
continue;
|
||||
|
|
@ -281,7 +281,7 @@ namespace Server.Gumps
|
|||
from.SendMessage( "That player is no longer online." );
|
||||
from.SendGump( new WhoGump( from, m_Mobiles, m_Page ) );
|
||||
}
|
||||
else if ( m == from || !m.Hidden || from.AccessLevel >= m.AccessLevel || (m is PlayerMobile && ((PlayerMobile)m).VisibilityList.Contains( from )))
|
||||
else if ( m == from || !m.Hidden || from.AccessLevel >= m.AccessLevel || (m is PlayerMobile mobile && mobile.VisibilityList.Contains( from )))
|
||||
{
|
||||
from.SendGump( new ClientGump( from, m.NetState ) );
|
||||
}
|
||||
|
|
@ -297,4 +297,4 @@ namespace Server.Gumps
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,11 +59,11 @@ namespace Server.Gumps
|
|||
|
||||
/* As a 'Young' player, you are currently under a system of protection that prevents
|
||||
* you from being attacked by other players and certain monsters.<br><br>
|
||||
*
|
||||
*
|
||||
* If you choose to renounce your status as a 'Young' player, you will lose this protection.
|
||||
* You will become vulnerable to other players, and many monsters that had only glared
|
||||
* at you menacingly before will now attack you on sight!<br><br>
|
||||
*
|
||||
*
|
||||
* Select OKAY now if you wish to renounce your status as a 'Young' player, otherwise
|
||||
* press CANCEL.
|
||||
*/
|
||||
|
|
@ -82,9 +82,7 @@ namespace Server.Gumps
|
|||
|
||||
if ( info.ButtonID == 1 )
|
||||
{
|
||||
Account acc = from.Account as Account;
|
||||
|
||||
if ( acc != null )
|
||||
if ( from.Account is Account acc )
|
||||
{
|
||||
acc.RemoveYoungStatus( 502085 ); // You have chosen to renounce your `Young' player status.
|
||||
}
|
||||
|
|
@ -95,4 +93,4 @@ namespace Server.Gumps
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue