Fixes implicit ternary expressions

This commit is contained in:
Kamron Batman 2018-09-14 14:56:48 -07:00
parent c85b0a740c
commit ff26dfa375
345 changed files with 1905 additions and 2336 deletions

View file

@ -78,9 +78,9 @@ namespace Server.SkillHandlers
}
else
{
(targeted as Item)?.SendLocalizedMessageTo( @from, 500323, "" ); // Only living things have anatomies!
(targeted as Item)?.SendLocalizedMessageTo( from, 500323, "" ); // Only living things have anatomies!
}
}
}
}
}
}

View file

@ -72,17 +72,17 @@ namespace Server.SkillHandlers
if ( from.Skills[SkillName.EvalInt].Base >= 76.0 )
targ.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 1038202 + mnMod, from.NetState ); // That being is at [10,20,...] percent mental strength.
}
else
}
else
{
targ.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 1038166 + (body / 11), from.NetState ); // You cannot judge his/her/its mental abilities.
}
}
else
{
(targeted as Item)?.SendLocalizedMessageTo( @from, 500908, "" ); // It looks smarter than a rock, but dumber than a piece of wood.
(targeted as Item)?.SendLocalizedMessageTo( from, 500908, "" ); // It looks smarter than a rock, but dumber than a piece of wood.
}
}
}
}
}
}

View file

@ -90,23 +90,21 @@ namespace Server.SkillHandlers
return TimeSpan.FromSeconds( 1.0 );
}
else
if ( ok )
{
if ( ok )
{
m.Hidden = true;
m.Warmode = false;
m.LocalOverheadMessage( MessageType.Regular, 0x1F4, 501240 ); // You have hidden yourself well.
}
else
{
m.RevealingAction();
m.LocalOverheadMessage( MessageType.Regular, 0x22, 501241 ); // You can't seem to hide here.
}
return TimeSpan.FromSeconds( 10.0 );
m.Hidden = true;
m.Warmode = false;
m.LocalOverheadMessage( MessageType.Regular, 0x1F4, 501240 ); // You have hidden yourself well.
}
else
{
m.RevealingAction();
m.LocalOverheadMessage( MessageType.Regular, 0x22, 501241 ); // You can't seem to hide here.
}
return TimeSpan.FromSeconds( 10.0 );
}
}
}

View file

@ -36,66 +36,64 @@ namespace Server.SkillHandlers
m.SendLocalizedMessage( 501845 ); // You are busy doing something else and cannot focus.
return TimeSpan.FromSeconds( 5.0 );
}
else if ( !Core.AOS && m.Hits < (m.HitsMax / 10) ) // Less than 10% health
}
if ( !Core.AOS && m.Hits < (m.HitsMax / 10) ) // Less than 10% health
{
m.SendLocalizedMessage( 501849 ); // The mind is strong but the body is weak.
return TimeSpan.FromSeconds( 5.0 );
}
else if ( m.Mana >= m.ManaMax )
if ( m.Mana >= m.ManaMax )
{
m.SendLocalizedMessage( 501846 ); // You are at peace.
return TimeSpan.FromSeconds( Core.AOS ? 10.0 : 5.0 );
}
else if ( Core.AOS && Misc.RegenRates.GetArmorOffset( m ) > 0 )
if ( Core.AOS && Misc.RegenRates.GetArmorOffset( m ) > 0 )
{
m.SendLocalizedMessage( 500135 ); // Regenerative forces cannot penetrate your armor!
return TimeSpan.FromSeconds( 10.0 );
}
Item oneHanded = m.FindItemOnLayer( Layer.OneHanded );
Item twoHanded = m.FindItemOnLayer( Layer.TwoHanded );
if ( Core.AOS && m.Player )
{
if ( !CheckOkayHolding( oneHanded ) )
m.AddToBackpack( oneHanded );
if ( !CheckOkayHolding( twoHanded ) )
m.AddToBackpack( twoHanded );
}
else if ( !CheckOkayHolding( oneHanded ) || !CheckOkayHolding( twoHanded ) )
{
m.SendLocalizedMessage( 502626 ); // Your hands must be free to cast spells or meditate.
return TimeSpan.FromSeconds( 2.5 );
}
double skillVal = m.Skills[SkillName.Meditation].Value;
double chance = (50.0 + (( skillVal - ( m.ManaMax - m.Mana ) ) * 2)) / 100;
if ( chance > Utility.RandomDouble() )
{
m.CheckSkill( SkillName.Meditation, 0.0, 100.0 );
m.SendLocalizedMessage( 501851 ); // You enter a meditative trance.
m.Meditating = true;
BuffInfo.AddBuff( m, new BuffInfo( BuffIcon.ActiveMeditation, 1075657 ) );
if ( m.Player || m.Body.IsHuman )
m.PlaySound( 0xF9 );
}
else
{
Item oneHanded = m.FindItemOnLayer( Layer.OneHanded );
Item twoHanded = m.FindItemOnLayer( Layer.TwoHanded );
if ( Core.AOS && m.Player )
{
if ( !CheckOkayHolding( oneHanded ) )
m.AddToBackpack( oneHanded );
if ( !CheckOkayHolding( twoHanded ) )
m.AddToBackpack( twoHanded );
}
else if ( !CheckOkayHolding( oneHanded ) || !CheckOkayHolding( twoHanded ) )
{
m.SendLocalizedMessage( 502626 ); // Your hands must be free to cast spells or meditate.
return TimeSpan.FromSeconds( 2.5 );
}
double skillVal = m.Skills[SkillName.Meditation].Value;
double chance = (50.0 + (( skillVal - ( m.ManaMax - m.Mana ) ) * 2)) / 100;
if ( chance > Utility.RandomDouble() )
{
m.CheckSkill( SkillName.Meditation, 0.0, 100.0 );
m.SendLocalizedMessage( 501851 ); // You enter a meditative trance.
m.Meditating = true;
BuffInfo.AddBuff( m, new BuffInfo( BuffIcon.ActiveMeditation, 1075657 ) );
if ( m.Player || m.Body.IsHuman )
m.PlaySound( 0xF9 );
}
else
{
m.SendLocalizedMessage( 501850 ); // You cannot focus your concentration.
}
return TimeSpan.FromSeconds( 10.0 );
m.SendLocalizedMessage( 501850 ); // You cannot focus your concentration.
}
return TimeSpan.FromSeconds( 10.0 );
}
}
}

View file

@ -58,7 +58,7 @@ namespace Server.SkillHandlers
}
from.PlaySound( 0x241 );
if ( from.CheckTargetSkill( SkillName.RemoveTrap, targ, targ.TrapPower, targ.TrapPower + 30 ) )
{
targ.TrapPower = 0;
@ -76,7 +76,7 @@ namespace Server.SkillHandlers
BaseFactionTrap trap = (BaseFactionTrap) targeted;
Faction faction = Faction.Find( from );
FactionTrapRemovalKit kit = ( from.Backpack == null ? null : from.Backpack.FindItemByType( typeof( FactionTrapRemovalKit ) ) as FactionTrapRemovalKit );
FactionTrapRemovalKit kit = @from.Backpack?.FindItemByType( typeof( FactionTrapRemovalKit ) ) as FactionTrapRemovalKit;
bool isOwner = ( trap.Placer == from || ( trap.Faction != null && trap.Faction.IsCommander( from ) ) );
@ -114,7 +114,7 @@ namespace Server.SkillHandlers
}
if ( !isOwner )
kit?.ConsumeCharge( @from );
kit?.ConsumeCharge( from );
}
}
else
@ -124,4 +124,4 @@ namespace Server.SkillHandlers
}
}
}
}
}

View file

@ -64,7 +64,7 @@ namespace Server.SkillHandlers
if ( map != null )
{
string message = $"You notice {@from.Name} attempting to peek into {root.Name}'s belongings.";
string message = $"You notice {from.Name} attempting to peek into {root.Name}'s belongings.";
IPooledEnumerable<NetState> eable = map.GetClientsInRange( from.Location, 8 );
@ -91,7 +91,7 @@ namespace Server.SkillHandlers
else
{
from.SendLocalizedMessage( 500210 ); // You failed to peek into the container.
if ( from.Skills[SkillName.Hiding].Value / 2 < Utility.Random( 100 ) )
from.RevealingAction();
}

View file

@ -89,7 +89,7 @@ namespace Server.SkillHandlers
else if ( toSteal is Sigil )
{
PlayerState pl = PlayerState.Find( m_Thief );
Faction faction = ( pl == null ? null : pl.Faction );
Faction faction = pl?.Faction;
Sigil sig = (Sigil) toSteal;

View file

@ -144,9 +144,9 @@ namespace Server.SkillHandlers
{
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;
return m_From.GetDistanceToSqrt( x ).CompareTo( m_From.GetDistanceToSqrt( y ) );
@ -378,7 +378,8 @@ namespace Server.SkillHandlers
Stop();
return;
}
else if ( m_From.NetState == null || m_From.Deleted || m_Target.Deleted || m_From.Map != m_Target.Map || !m_From.InRange( m_Target, m_Range ) || ( m_Target.Hidden && m_Target.AccessLevel > m_From.AccessLevel ) )
if ( m_From.NetState == null || m_From.Deleted || m_Target.Deleted || m_From.Map != m_Target.Map || !m_From.InRange( m_Target, m_Range ) || ( m_Target.Hidden && m_Target.AccessLevel > m_From.AccessLevel ) )
{
m_Arrow.Stop();
Stop();