Fixes implicit ternary expressions
This commit is contained in:
parent
c85b0a740c
commit
ff26dfa375
345 changed files with 1905 additions and 2336 deletions
|
|
@ -1014,7 +1014,7 @@ namespace Server.Factions
|
|||
|
||||
if ( pack != null )
|
||||
{
|
||||
Container killerPack = ( killer == null ? null : killer.Backpack );
|
||||
Container killerPack = killer?.Backpack;
|
||||
Item[] sigils = pack.FindItemsByType( typeof( Sigil ) );
|
||||
|
||||
for ( int i = 0; i < sigils.Length; ++i )
|
||||
|
|
|
|||
|
|
@ -59,7 +59,8 @@ namespace Server.Factions
|
|||
ps.IsActive = false;
|
||||
continue;
|
||||
}
|
||||
else if ( ps.KillPoints > 0 )
|
||||
|
||||
if ( ps.KillPoints > 0 )
|
||||
{
|
||||
int atrophy = ( ps.KillPoints + 9 ) / 10;
|
||||
ps.KillPoints -= atrophy;
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ namespace Server.Factions
|
|||
{
|
||||
Faction faction = Faction.Find( from );
|
||||
|
||||
faction?.BeginHonorLeadership( @from );
|
||||
faction?.BeginHonorLeadership( from );
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,11 +21,9 @@ namespace Server.Factions
|
|||
index = offset / ButtonTypes;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
type = index = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
type = index = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool Exists( Mobile mob )
|
||||
|
|
|
|||
|
|
@ -128,10 +128,10 @@ namespace Server.Factions
|
|||
AddHtml( 120, 100, 150, 20, from.Name, false, false );
|
||||
|
||||
AddHtmlLocalized( 20, 130, 100, 20, 1018064, false, false ); // score :
|
||||
AddHtml( 120, 130, 100, 20, (pl != null ? pl.KillPoints : 0).ToString(), false, false );
|
||||
AddHtml( 120, 130, 100, 20, (pl?.KillPoints ?? 0).ToString(), false, false );
|
||||
|
||||
AddHtmlLocalized( 20, 160, 100, 20, 1011446, false, false ); // Rank :
|
||||
AddHtml( 120, 160, 100, 20, (pl != null ? pl.Rank.Rank : 0).ToString(), false, false );
|
||||
AddHtml( 120, 160, 100, 20, (pl?.Rank.Rank ?? 0).ToString(), false, false );
|
||||
|
||||
AddHtmlLocalized( 55, 250, 100, 20, 1011447, false, false ); // BACK
|
||||
AddButton( 20, 250, 4005, 4007, 0, GumpButtonType.Page, 1 );
|
||||
|
|
|
|||
|
|
@ -118,7 +118,8 @@ namespace Server.Factions
|
|||
from.SendLocalizedMessage( 1010339 ); // You no longer control this city
|
||||
return;
|
||||
}
|
||||
else if ( m_Town.Sheriff != null )
|
||||
|
||||
if ( m_Town.Sheriff != null )
|
||||
{
|
||||
from.SendLocalizedMessage( 1010342 ); // You must fire your Sheriff before you can elect a new one
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ namespace Server.Factions
|
|||
set
|
||||
{
|
||||
m_Faction = value;
|
||||
Hue = ( m_Faction == null ? 0 : m_Faction.Definition.HuePrimary );
|
||||
Hue = m_Faction?.Definition.HuePrimary ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace Server.Factions
|
|||
{
|
||||
m_Faction = value;
|
||||
|
||||
AssignName( m_Faction == null ? null : m_Faction.Definition.FactionStoneName );
|
||||
AssignName( m_Faction?.Definition.FactionStoneName );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ namespace Server.Factions
|
|||
{
|
||||
m_Faction = value;
|
||||
|
||||
Hue = ( m_Faction == null ? 0 : m_Faction.Definition.HueJoin );
|
||||
AssignName( m_Faction == null ? null : m_Faction.Definition.SignupName );
|
||||
Hue = m_Faction?.Definition.HueJoin ?? 0;
|
||||
AssignName( m_Faction?.Definition.SignupName );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,11 +30,11 @@ namespace Server {
|
|||
from.AddStatMod( new StatMod( StatType.All, "blood-rose", amount, TimeSpan.FromMinutes( time ) ) );
|
||||
|
||||
return true;
|
||||
} else {
|
||||
from.SendLocalizedMessage( 1062927 ); // You have eaten one of these recently and eating another would provide no benefit.
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 1062927 ); // You have eaten one of these recently and eating another would provide no benefit.
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer ) {
|
||||
|
|
@ -49,4 +49,4 @@ namespace Server {
|
|||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,8 @@ namespace Server {
|
|||
|
||||
weight = Utility.Random( weight );
|
||||
|
||||
foreach ( WeightedItem item in _items ) {
|
||||
foreach ( WeightedItem item in _items )
|
||||
{
|
||||
if ( weight < item.Weight ) {
|
||||
Item obj = item.Construct();
|
||||
|
||||
|
|
@ -95,9 +96,9 @@ namespace Server {
|
|||
}
|
||||
|
||||
break;
|
||||
} else {
|
||||
weight -= item.Weight;
|
||||
}
|
||||
|
||||
weight -= item.Weight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ namespace Server.Factions
|
|||
|
||||
public void Update()
|
||||
{
|
||||
ItemID = ( m_Town == null ? 0x1869 : m_Town.Definition.SigilID );
|
||||
ItemID = m_Town?.Definition.SigilID ?? 0x1869;
|
||||
|
||||
if ( m_Town == null )
|
||||
AssignName( null );
|
||||
|
|
|
|||
|
|
@ -29,10 +29,9 @@ namespace Server.Factions
|
|||
{
|
||||
if ( Amount <= 1 )
|
||||
return 0x2E4;
|
||||
else if ( Amount <= 5 )
|
||||
if ( Amount <= 5 )
|
||||
return 0x2E5;
|
||||
else
|
||||
return 0x2E6;
|
||||
return 0x2E6;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace Server.Factions
|
|||
|
||||
public override void OnTownChanged()
|
||||
{
|
||||
AssignName( Town == null ? null : Town.Definition.StrongholdMonolithName );
|
||||
AssignName( Town?.Definition.StrongholdMonolithName );
|
||||
}
|
||||
|
||||
public StrongholdMonolith() : this( null, null )
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace Server.Factions
|
|||
|
||||
public override void OnTownChanged()
|
||||
{
|
||||
AssignName( Town == null ? null : Town.Definition.TownMonolithName );
|
||||
AssignName( Town?.Definition.TownMonolithName );
|
||||
}
|
||||
|
||||
public TownMonolith() : this( null )
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace Server.Factions
|
|||
{
|
||||
m_Town = value;
|
||||
|
||||
AssignName( m_Town == null ? null : m_Town.Definition.TownStoneName );
|
||||
AssignName( m_Town?.Definition.TownStoneName );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ namespace Server.Factions
|
|||
if ( from.Alive )
|
||||
m_Placer.SendMessage( "You have earned {0} silver pieces because {1} fell for your trap.", silverGiven, from.Name );
|
||||
else
|
||||
m_Placer.SendLocalizedMessage( 1042736, $"{silverGiven} silver\t{@from.Name}"); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_NAME~!
|
||||
m_Placer.SendLocalizedMessage( 1042736, $"{silverGiven} silver\t{from.Name}"); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_NAME~!
|
||||
}
|
||||
|
||||
victimState.OnGivenSilverTo( m_Placer );
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ namespace Server.Factions
|
|||
{
|
||||
m_Faction = value;
|
||||
|
||||
Body = ( m_Faction == null ? 0xE2 : m_Faction.Definition.WarHorseBody );
|
||||
ItemID = ( m_Faction == null ? 0x3EA0 : m_Faction.Definition.WarHorseItem );
|
||||
Body = m_Faction?.Definition.WarHorseBody ?? 0xE2;
|
||||
ItemID = m_Faction?.Definition.WarHorseItem ?? 0x3EA0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -310,45 +310,43 @@ namespace Server.Factions
|
|||
|
||||
return active;
|
||||
}
|
||||
else
|
||||
|
||||
Map map = m_Mobile.Map;
|
||||
|
||||
if ( map != null )
|
||||
{
|
||||
Map map = m_Mobile.Map;
|
||||
Mobile active = null, inactive = null;
|
||||
double actPrio = 0.0, inactPrio = 0.0;
|
||||
|
||||
if ( map != null )
|
||||
Mobile comb = m_Mobile.Combatant;
|
||||
|
||||
if ( comb != null && !comb.Deleted && comb.Alive && !comb.IsDeadBondedPet && CanDispel( comb ) )
|
||||
{
|
||||
Mobile active = null, inactive = null;
|
||||
double actPrio = 0.0, inactPrio = 0.0;
|
||||
active = inactive = comb;
|
||||
actPrio = inactPrio = m_Mobile.GetDistanceToSqrt( comb );
|
||||
}
|
||||
|
||||
Mobile comb = m_Mobile.Combatant;
|
||||
|
||||
if ( comb != null && !comb.Deleted && comb.Alive && !comb.IsDeadBondedPet && CanDispel( comb ) )
|
||||
foreach ( Mobile m in m_Mobile.GetMobilesInRange( 12 ) )
|
||||
{
|
||||
if ( m != m_Mobile && CanDispel( m ) )
|
||||
{
|
||||
active = inactive = comb;
|
||||
actPrio = inactPrio = m_Mobile.GetDistanceToSqrt( comb );
|
||||
}
|
||||
double prio = m_Mobile.GetDistanceToSqrt( m );
|
||||
|
||||
foreach ( Mobile m in m_Mobile.GetMobilesInRange( 12 ) )
|
||||
{
|
||||
if ( m != m_Mobile && CanDispel( m ) )
|
||||
if ( !activeOnly && (inactive == null || prio < inactPrio) )
|
||||
{
|
||||
double prio = m_Mobile.GetDistanceToSqrt( m );
|
||||
inactive = m;
|
||||
inactPrio = prio;
|
||||
}
|
||||
|
||||
if ( !activeOnly && (inactive == null || prio < inactPrio) )
|
||||
{
|
||||
inactive = m;
|
||||
inactPrio = prio;
|
||||
}
|
||||
|
||||
if ( (m_Mobile.Combatant == m || m.Combatant == m_Mobile) && (active == null || prio < actPrio) )
|
||||
{
|
||||
active = m;
|
||||
actPrio = prio;
|
||||
}
|
||||
if ( (m_Mobile.Combatant == m || m.Combatant == m_Mobile) && (active == null || prio < actPrio) )
|
||||
{
|
||||
active = m;
|
||||
actPrio = prio;
|
||||
}
|
||||
}
|
||||
|
||||
return active != null ? active : inactive;
|
||||
}
|
||||
|
||||
return active ?? inactive;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
@ -473,7 +471,7 @@ namespace Server.Factions
|
|||
{
|
||||
Target targ = m_Guard.Target;
|
||||
|
||||
Mobile toHarm = ( dispelTarget == null ? combatant : dispelTarget );
|
||||
Mobile toHarm = dispelTarget ?? combatant;
|
||||
|
||||
if ( (targ.Flags & TargetFlags.Harmful) != 0 && toHarm != null )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue