Fixes casting checks
This commit is contained in:
parent
7ea00fbf4f
commit
03dd5f1926
431 changed files with 5616 additions and 6250 deletions
|
|
@ -154,9 +154,9 @@ namespace Server.Factions
|
|||
{
|
||||
object obj = fields[j];
|
||||
|
||||
if ( obj is Mobile )
|
||||
if ( obj is Mobile mobile )
|
||||
{
|
||||
AddHtml( x + 2, 140 + (idx * 20), 150, 20, Color( ((Mobile)obj).Name, LabelColor ), false, false );
|
||||
AddHtml( x + 2, 140 + (idx * 20), 150, 20, Color( mobile.Name, LabelColor ), false, false );
|
||||
x += 150;
|
||||
}
|
||||
else if ( obj is System.Net.IPAddress )
|
||||
|
|
@ -164,14 +164,14 @@ namespace Server.Factions
|
|||
AddHtml( x, 140 + (idx * 20), 100, 20, Color( Center( obj.ToString() ), LabelColor ), false, false );
|
||||
x += 100;
|
||||
}
|
||||
else if ( obj is DateTime )
|
||||
else if ( obj is DateTime time )
|
||||
{
|
||||
AddHtml( x, 140 + (idx * 20), 80, 20, Color( Center( FormatTimeSpan( ((DateTime)obj) - election.LastStateTime ) ), LabelColor ), false, false );
|
||||
AddHtml( x, 140 + (idx * 20), 80, 20, Color( Center( FormatTimeSpan( time - election.LastStateTime ) ), LabelColor ), false, false );
|
||||
x += 80;
|
||||
}
|
||||
else if ( obj is int )
|
||||
else if ( obj is int i1 )
|
||||
{
|
||||
AddHtml( x, 140 + (idx * 20), 60, 20, Color( Center( (int)obj + "%" ), LabelColor ), false, false );
|
||||
AddHtml( x, 140 + (idx * 20), 60, 20, Color( Center( i1 + "%" ), LabelColor ), false, false );
|
||||
x += 60;
|
||||
}
|
||||
}
|
||||
|
|
@ -215,4 +215,4 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ namespace Server.Factions
|
|||
|
||||
private FactionItemDefinition m_Definition;
|
||||
|
||||
public FactionImbueGump( int quality, Item item, Mobile from, CraftSystem craftSystem, BaseTool tool, object notice, int availableSilver, Faction faction, FactionItemDefinition def ) : base( 100, 200 )
|
||||
{
|
||||
public FactionImbueGump( int quality, Item item, Mobile from, CraftSystem craftSystem, BaseTool tool, object notice, int availableSilver, Faction faction, FactionItemDefinition def ) : base( 100, 200 )
|
||||
{
|
||||
m_Item = item;
|
||||
m_Mobile = from;
|
||||
m_Faction = faction;
|
||||
|
|
@ -39,13 +39,13 @@ namespace Server.Factions
|
|||
AddHtmlLocalized( 20, 20, 210, 25, 1011569, false, false ); // Imbue with Faction properties?
|
||||
|
||||
|
||||
AddHtmlLocalized( 20, 60, 170, 25, 1018302, false, false ); // Item quality:
|
||||
AddHtmlLocalized( 20, 60, 170, 25, 1018302, false, false ); // Item quality:
|
||||
AddHtmlLocalized( 175, 60, 100, 25, 1018305 - m_Quality, false, false ); // Exceptional, Average, Low
|
||||
|
||||
AddHtmlLocalized( 20, 80, 170, 25, 1011572, false, false ); // Item Cost :
|
||||
AddHtmlLocalized( 20, 80, 170, 25, 1011572, false, false ); // Item Cost :
|
||||
AddLabel( 175, 80, 0x34, def.SilverCost.ToString( "N0" ) ); // NOTE: Added 'N0'
|
||||
|
||||
AddHtmlLocalized( 20, 100, 170, 25, 1011573, false, false ); // Your Silver :
|
||||
AddHtmlLocalized( 20, 100, 170, 25, 1011573, false, false ); // Your Silver :
|
||||
AddLabel( 175, 100, 0x34, availableSilver.ToString( "N0" ) ); // NOTE: Added 'N0'
|
||||
|
||||
|
||||
|
|
@ -95,10 +95,10 @@ namespace Server.Factions
|
|||
|
||||
if ( m_Tool != null && !m_Tool.Deleted && m_Tool.UsesRemaining > 0 )
|
||||
m_Mobile.SendGump( new CraftGump( m_Mobile, m_CraftSystem, m_Tool, m_Notice ) );
|
||||
else if ( m_Notice is string )
|
||||
m_Mobile.SendMessage( (string) m_Notice );
|
||||
else if ( m_Notice is int && ((int)m_Notice) > 0 )
|
||||
m_Mobile.SendLocalizedMessage( (int) m_Notice );
|
||||
else if ( m_Notice is string s )
|
||||
m_Mobile.SendMessage( s );
|
||||
else if ( m_Notice is int i && i > 0 )
|
||||
m_Mobile.SendLocalizedMessage( i );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace Server.Factions
|
|||
AddBackground( 0, 0, 270, 120, 5054 );
|
||||
AddBackground( 10, 10, 250, 100, 3000 );
|
||||
|
||||
if ( from.Guild is Guild && ((Guild)from.Guild).Leader == from )
|
||||
if ( from.Guild is Guild guild && guild.Leader == from )
|
||||
AddHtmlLocalized( 20, 15, 230, 60, 1018057, true, true ); // Are you sure you want your entire guild to leave this faction?
|
||||
else
|
||||
AddHtmlLocalized( 20, 15, 230, 60, 1018063, true, true ); // Are you sure you want to leave this faction?
|
||||
|
|
@ -38,9 +38,7 @@ namespace Server.Factions
|
|||
{
|
||||
case 1: // continue
|
||||
{
|
||||
Guild guild = m_From.Guild as Guild;
|
||||
|
||||
if ( guild == null )
|
||||
if ( !(m_From.Guild is Guild guild) )
|
||||
{
|
||||
PlayerState pl = PlayerState.Find( m_From );
|
||||
|
||||
|
|
@ -89,4 +87,4 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,9 +124,8 @@ namespace Server.Factions
|
|||
{
|
||||
from.SendLocalizedMessage( 1010342 ); // You must fire your Sheriff before you can elect a new one
|
||||
}
|
||||
else if ( obj is Mobile )
|
||||
else if ( obj is Mobile targ )
|
||||
{
|
||||
Mobile targ = (Mobile)obj;
|
||||
PlayerState pl = PlayerState.Find( targ );
|
||||
|
||||
if ( pl == null )
|
||||
|
|
@ -163,15 +162,13 @@ namespace Server.Factions
|
|||
if ( m_Town.Owner != m_Faction || !m_Faction.IsCommander( from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1010339 ); // You no longer control this city
|
||||
return;
|
||||
}
|
||||
else if ( m_Town.Finance != null )
|
||||
{
|
||||
from.SendLocalizedMessage( 1010342 ); // You must fire your Sheriff before you can elect a new one
|
||||
}
|
||||
else if ( obj is Mobile )
|
||||
else if ( obj is Mobile targ )
|
||||
{
|
||||
Mobile targ = (Mobile)obj;
|
||||
PlayerState pl = PlayerState.Find( targ );
|
||||
|
||||
if ( pl == null )
|
||||
|
|
@ -203,4 +200,4 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue