Fixes implicit ternary expressions
This commit is contained in:
parent
c85b0a740c
commit
ff26dfa375
345 changed files with 1905 additions and 2336 deletions
|
|
@ -152,7 +152,7 @@ namespace Server.Engines.Craft
|
|||
string nameString = craftSystem.CraftSubRes2.NameString;
|
||||
int nameNumber = craftSystem.CraftSubRes2.NameNumber;
|
||||
|
||||
int resIndex = ( context == null ? -1 : context.LastResourceIndex2 );
|
||||
int resIndex = context?.LastResourceIndex2 ?? -1;
|
||||
|
||||
Type resourceType = craftSystem.CraftSubRes2.ResType;
|
||||
|
||||
|
|
@ -481,7 +481,7 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
if ( m_Page == CraftPage.PickResource && index >= 0 && index < system.CraftSubRes.Count )
|
||||
{
|
||||
int groupIndex = ( context == null ? -1 : context.LastGroupIndex );
|
||||
int groupIndex = context?.LastGroupIndex ?? -1;
|
||||
|
||||
CraftSubRes res = system.CraftSubRes.GetAt( index );
|
||||
|
||||
|
|
@ -499,7 +499,7 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
else if ( m_Page == CraftPage.PickResource2 && index >= 0 && index < system.CraftSubRes2.Count )
|
||||
{
|
||||
int groupIndex = ( context == null ? -1 : context.LastGroupIndex );
|
||||
int groupIndex = context?.LastGroupIndex ?? -1;
|
||||
|
||||
CraftSubRes res = system.CraftSubRes2.GetAt( index );
|
||||
|
||||
|
|
|
|||
|
|
@ -246,30 +246,24 @@ namespace Server.Engines.Craft
|
|||
message = "You lack the required hit points to make that.";
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
consumHits = consume;
|
||||
}
|
||||
|
||||
consumHits = consume;
|
||||
|
||||
if ( Mana > 0 && from.Mana < Mana )
|
||||
{
|
||||
message = "You lack the required mana to make that.";
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
consumMana = consume;
|
||||
}
|
||||
|
||||
consumMana = consume;
|
||||
|
||||
if ( Stam > 0 && from.Stam < Stam )
|
||||
{
|
||||
message = "You lack the required stamina to make that.";
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
consumStam = consume;
|
||||
}
|
||||
|
||||
consumStam = consume;
|
||||
|
||||
if ( consumMana )
|
||||
from.Mana -= Mana;
|
||||
|
|
@ -786,7 +780,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
{
|
||||
CraftRes res = m_arCraftRes.GetAt( index );
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ namespace Server.Engines.Craft
|
|||
private int GetWeakenChance( Mobile mob, SkillName skill, int curHits, int maxHits )
|
||||
{
|
||||
// 40% - (1% per hp lost) - (1% per 10 craft skill)
|
||||
return (40 + (maxHits - curHits)) - (int)(((m_Deed != null)? m_Deed.SkillLevel : mob.Skills[skill].Value) / 10);
|
||||
return (40 + (maxHits - curHits)) - (int)((m_Deed?.SkillLevel ?? mob.Skills[skill].Value) / 10);
|
||||
}
|
||||
|
||||
private bool CheckWeaken( Mobile mob, SkillName skill, int curHits, int maxHits )
|
||||
|
|
@ -75,17 +75,15 @@ namespace Server.Engines.Craft
|
|||
|
||||
if ( value < minSkill )
|
||||
return false; // Too difficult
|
||||
else if ( value >= maxSkill )
|
||||
if ( value >= maxSkill )
|
||||
return true; // No challenge
|
||||
|
||||
double chance = (value - minSkill) / (maxSkill - minSkill);
|
||||
|
||||
return (chance >= Utility.RandomDouble());
|
||||
}
|
||||
else
|
||||
{
|
||||
return mob.CheckSkill( skill, difficulty - 25.0, difficulty + 25.0 );
|
||||
}
|
||||
|
||||
return mob.CheckSkill( skill, difficulty - 25.0, difficulty + 25.0 );
|
||||
}
|
||||
|
||||
private bool CheckDeed( Mobile from )
|
||||
|
|
@ -126,39 +124,41 @@ namespace Server.Engines.Craft
|
|||
|| ( weapon is ButcherKnife )
|
||||
|| ( weapon is SkinningKnife );
|
||||
}
|
||||
else if ( m_CraftSystem is DefCarpentry )
|
||||
|
||||
if ( m_CraftSystem is DefCarpentry )
|
||||
{
|
||||
return ( weapon is Club )
|
||||
|| ( weapon is BlackStaff )
|
||||
|| ( weapon is MagicWand )
|
||||
#region Temporary
|
||||
// TODO: Make these items craftable
|
||||
|| ( weapon is WildStaff );
|
||||
|| ( weapon is BlackStaff )
|
||||
|| ( weapon is MagicWand )
|
||||
#region Temporary
|
||||
// TODO: Make these items craftable
|
||||
|| ( weapon is WildStaff );
|
||||
#endregion
|
||||
}
|
||||
else if ( m_CraftSystem is DefBlacksmithy )
|
||||
if ( m_CraftSystem is DefBlacksmithy )
|
||||
{
|
||||
return ( weapon is Pitchfork )
|
||||
#region Temporary
|
||||
// TODO: Make these items craftable
|
||||
|| ( weapon is RadiantScimitar )
|
||||
|| ( weapon is WarCleaver )
|
||||
|| ( weapon is ElvenSpellblade )
|
||||
|| ( weapon is AssassinSpike )
|
||||
|| ( weapon is Leafblade )
|
||||
|| ( weapon is RuneBlade )
|
||||
|| ( weapon is ElvenMachete )
|
||||
|| ( weapon is OrnateAxe )
|
||||
|| ( weapon is DiamondMace );
|
||||
#region Temporary
|
||||
// TODO: Make these items craftable
|
||||
|| ( weapon is RadiantScimitar )
|
||||
|| ( weapon is WarCleaver )
|
||||
|| ( weapon is ElvenSpellblade )
|
||||
|| ( weapon is AssassinSpike )
|
||||
|| ( weapon is Leafblade )
|
||||
|| ( weapon is RuneBlade )
|
||||
|| ( weapon is ElvenMachete )
|
||||
|| ( weapon is OrnateAxe )
|
||||
|| ( weapon is DiamondMace );
|
||||
#endregion
|
||||
}
|
||||
#region Temporary
|
||||
// TODO: Make these items craftable
|
||||
else if ( m_CraftSystem is DefBowFletching )
|
||||
if ( m_CraftSystem is DefBowFletching )
|
||||
{
|
||||
return ( weapon is ElvenCompositeLongbow )
|
||||
|| ( weapon is MagicalShortbow );
|
||||
|| ( weapon is MagicalShortbow );
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
return false;
|
||||
|
|
@ -184,23 +184,25 @@ namespace Server.Engines.Craft
|
|||
|| ( armor is HidePants )
|
||||
|| ( armor is HidePauldrons );
|
||||
}
|
||||
else if ( m_CraftSystem is DefCarpentry )
|
||||
|
||||
if ( m_CraftSystem is DefCarpentry )
|
||||
{
|
||||
return ( armor is WingedHelm )
|
||||
|| ( armor is RavenHelm )
|
||||
|| ( armor is VultureHelm )
|
||||
|| ( armor is WoodlandArms )
|
||||
|| ( armor is WoodlandChest )
|
||||
|| ( armor is WoodlandGloves )
|
||||
|| ( armor is WoodlandGorget )
|
||||
|| ( armor is WoodlandLegs );
|
||||
|| ( armor is RavenHelm )
|
||||
|| ( armor is VultureHelm )
|
||||
|| ( armor is WoodlandArms )
|
||||
|| ( armor is WoodlandChest )
|
||||
|| ( armor is WoodlandGloves )
|
||||
|| ( armor is WoodlandGorget )
|
||||
|| ( armor is WoodlandLegs );
|
||||
}
|
||||
else if ( m_CraftSystem is DefBlacksmithy )
|
||||
if ( m_CraftSystem is DefBlacksmithy )
|
||||
{
|
||||
return ( armor is Circlet )
|
||||
|| ( armor is RoyalCirclet )
|
||||
|| ( armor is GemmedCirclet );
|
||||
|| ( armor is RoyalCirclet )
|
||||
|| ( armor is GemmedCirclet );
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue