Fixes casting checks

This commit is contained in:
Kamron Batman 2018-08-19 01:38:55 +08:00
parent 7ea00fbf4f
commit 03dd5f1926
431 changed files with 5616 additions and 6250 deletions

View file

@ -104,8 +104,8 @@ namespace Server.Engines.Craft
}
// ****************************************
if ( notice is int && (int)notice > 0 )
AddHtmlLocalized( 170, 295, 350, 40, (int)notice, LabelColor, false, false );
if ( notice is int noticeInt && noticeInt > 0 )
AddHtmlLocalized( 170, 295, 350, 40, noticeInt, LabelColor, false, false );
else if ( notice is string )
AddHtml( 170, 295, 350, 40, String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", FontColor, notice ), false, false );
@ -115,7 +115,7 @@ namespace Server.Engines.Craft
string nameString = craftSystem.CraftSubRes.NameString;
int nameNumber = craftSystem.CraftSubRes.NameNumber;
int resIndex = ( context == null ? -1 : context.LastResourceIndex );
int resIndex = context?.LastResourceIndex ?? -1;
Type resourceType = craftSystem.CraftSubRes.ResType;
@ -616,4 +616,4 @@ namespace Server.Engines.Craft
}
}
}
}
}

View file

@ -62,9 +62,9 @@ namespace Server.Engines.Craft
AddButton( 15, 387, 4014, 4016, 0, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 50, 390, 150, 18, 1044150, LabelColor, false, false ); // BACK
bool needsRecipe = ( craftItem.Recipe != null && from is PlayerMobile && !((PlayerMobile)from).HasRecipe( craftItem.Recipe ) );
bool needsRecipe = ( craftItem.Recipe != null && from is PlayerMobile mobile && !mobile.HasRecipe( craftItem.Recipe ) );
if( needsRecipe )
if ( needsRecipe )
{
AddButton( 270, 387, 4005, 4007, 0, GumpButtonType.Page, 0 );
AddHtmlLocalized( 305, 390, 150, 18, 1044151, GreyLabelColor, false, false ); // MAKE NOW
@ -88,17 +88,17 @@ namespace Server.Engines.Craft
DrawResource();
/*
if( craftItem.RequiresSE )
if ( craftItem.RequiresSE )
AddHtmlLocalized( 170, 302 + (m_OtherCount++ * 20), 310, 18, 1063363, LabelColor, false, false ); //* Requires the "Samurai Empire" expansion
* */
if( craftItem.RequiredExpansion != Expansion.None )
if ( craftItem.RequiredExpansion != Expansion.None )
{
bool supportsEx = (from.NetState != null && from.NetState.SupportsExpansion( craftItem.RequiredExpansion ));
TextDefinition.AddHtmlText( this, 170, 302 + (m_OtherCount++ * 20), 310, 18, RequiredExpansionMessage( craftItem.RequiredExpansion ), false, false, supportsEx ? LabelColor : RedLabelColor, supportsEx ? LabelHue : RedLabelHue );
}
if( needsRecipe )
if ( needsRecipe )
AddHtmlLocalized( 170, 302 + (m_OtherCount++ * 20), 310, 18, 1073620, RedLabelColor, false, false ); // You have not learned this recipe.
}
@ -167,9 +167,9 @@ namespace Server.Engines.Craft
if ( m_ShowExceptionalChance )
{
if( excepChance < 0.0 )
if ( excepChance < 0.0 )
excepChance = 0.0;
else if( excepChance > 1.0 )
else if ( excepChance > 1.0 )
excepChance = 1.0;
AddHtmlLocalized( 170, 100, 250, 18, 1044058, 32767, false, false ); // Exceptional Chance:
@ -207,7 +207,7 @@ namespace Server.Engines.Craft
type = craftResource.ItemType;
nameString = craftResource.NameString;
nameNumber = craftResource.NameNumber;
// Resource Mutation
if ( type == res.ResType && resIndex > -1 )
{
@ -284,4 +284,4 @@ namespace Server.Engines.Craft
}
}
}
}
}

View file

@ -72,7 +72,7 @@ namespace Server.Engines.Craft
public void AddRecipe( int id, CraftSystem system )
{
if( m_Recipe != null )
if ( m_Recipe != null )
{
Console.WriteLine( "Warning: Attempted add of recipe #{0} to the crafting of {1} in CraftSystem {2}.", id, this.m_Type.Name, system );
return;
@ -395,7 +395,7 @@ namespace Server.Engines.Craft
public bool IsMarkable( Type type )
{
if( m_ForceNonExceptional ) //Don't even display the stuff for marking if it can't ever be exceptional.
if ( m_ForceNonExceptional ) //Don't even display the stuff for marking if it can't ever be exceptional.
return false;
for ( int i = 0; i < m_MarkableTable.Length; ++i )
@ -526,15 +526,13 @@ namespace Server.Engines.Craft
for ( int j = 0; j < items[i].Length; ++j )
{
IHasQuantity hq = items[i][j] as IHasQuantity;
if ( hq == null )
if ( !(items[i][j] is IHasQuantity hq) )
{
totals[i] += items[i][j].Amount;
}
else
{
if ( hq is BaseBeverage && ((BaseBeverage)hq).Content != m_RequiredBeverage )
if ( hq is BaseBeverage beverage && beverage.Content != m_RequiredBeverage )
continue;
totals[i] += hq.Quantity;
@ -552,9 +550,8 @@ namespace Server.Engines.Craft
for ( int j = 0; j < items[i].Length; ++j )
{
Item item = items[i][j];
IHasQuantity hq = item as IHasQuantity;
if ( hq == null )
if ( !(item is IHasQuantity hq) )
{
int theirAmount = item.Amount;
@ -571,7 +568,7 @@ namespace Server.Engines.Craft
}
else
{
if ( hq is BaseBeverage && ((BaseBeverage)hq).Content != m_RequiredBeverage )
if ( hq is BaseBeverage beverage && beverage.Content != m_RequiredBeverage )
continue;
int theirAmount = hq.Quantity;
@ -601,15 +598,13 @@ namespace Server.Engines.Craft
for ( int i = 0; i < items.Length; ++i )
{
IHasQuantity hq = items[i] as IHasQuantity;
if ( hq == null )
if ( !(items[i] is IHasQuantity hq) )
{
amount += items[i].Amount;
}
else
{
if ( hq is BaseBeverage && ((BaseBeverage)hq).Content != m_RequiredBeverage )
if ( hq is BaseBeverage beverage && beverage.Content != m_RequiredBeverage )
continue;
amount += hq.Quantity;
@ -862,26 +857,20 @@ namespace Server.Engines.Craft
public double GetExceptionalChance( CraftSystem system, double chance, Mobile from )
{
if( m_ForceNonExceptional )
if ( m_ForceNonExceptional )
return 0.0;
double bonus = 0.0;
if ( from.Talisman is BaseTalisman )
if ( from.Talisman is BaseTalisman talisman && talisman.Skill == system.MainSkill )
{
BaseTalisman talisman = (BaseTalisman) from.Talisman;
if ( talisman.Skill == system.MainSkill )
{
chance -= talisman.SuccessBonus / 100.0;
bonus = talisman.ExceptionalBonus / 100.0;
}
chance -= talisman.SuccessBonus / 100.0;
bonus = talisman.ExceptionalBonus / 100.0;
}
switch ( system.ECA )
{
default:
case CraftECA.ChanceMinusSixty: chance -= 0.6; break;
default: chance -= 0.6; break;
case CraftECA.FiftyPercentChanceMinusTenPercent: chance = chance * 0.5 - 0.1; break;
case CraftECA.ChanceMinusSixtyToFourtyFive:
{
@ -955,13 +944,8 @@ namespace Server.Engines.Craft
else
chance = 0.0;
if ( allRequiredSkills && from.Talisman is BaseTalisman )
{
BaseTalisman talisman = (BaseTalisman) from.Talisman;
if ( talisman.Skill == craftSystem.MainSkill )
chance += talisman.SuccessBonus / 100.0;
}
if ( allRequiredSkills && from.Talisman is BaseTalisman talisman && talisman.Skill == craftSystem.MainSkill )
chance += talisman.SuccessBonus / 100.0;
if ( allRequiredSkills && valMainSkill == maxMainSkill )
chance = 1.0;
@ -973,32 +957,32 @@ namespace Server.Engines.Craft
{
if ( from.BeginAction( typeof( CraftSystem ) ) )
{
if( RequiredExpansion == Expansion.None || ( from.NetState != null && from.NetState.SupportsExpansion( RequiredExpansion ) ) )
if ( RequiredExpansion == Expansion.None || ( from.NetState != null && from.NetState.SupportsExpansion( RequiredExpansion ) ) )
{
bool allRequiredSkills = true;
double chance = GetSuccessChance( from, typeRes, craftSystem, false, ref allRequiredSkills );
if ( allRequiredSkills && chance >= 0.0 )
{
if( this.Recipe == null || !(from is PlayerMobile) || ((PlayerMobile)from).HasRecipe( this.Recipe ) )
if ( this.Recipe == null || !(from is PlayerMobile) || ((PlayerMobile)from).HasRecipe( this.Recipe ) )
{
int badCraft = craftSystem.CanCraft( from, tool, m_Type );
if( badCraft <= 0 )
if ( badCraft <= 0 )
{
int resHue = 0;
int maxAmount = 0;
object message = null;
if( ConsumeRes( from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.None, ref message ) )
if ( ConsumeRes( from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.None, ref message ) )
{
message = null;
if( ConsumeAttributes( from, ref message, false ) )
if ( ConsumeAttributes( from, ref message, false ) )
{
CraftContext context = craftSystem.GetContext( from );
if( context != null )
if ( context != null )
context.OnMade( this );
int iMin = craftSystem.MinCraftEffect;
@ -1080,25 +1064,15 @@ namespace Server.Engines.Craft
object checkMessage = null;
// Not enough resource to craft it
if ( !ConsumeRes( from, typeRes, craftSystem, ref checkResHue, ref checkMaxAmount, ConsumeType.None, ref checkMessage ) )
if ( !(ConsumeRes( from, typeRes, craftSystem, ref checkResHue, ref checkMaxAmount, ConsumeType.None, ref checkMessage )
&& ConsumeAttributes( from, ref checkMessage, false )))
{
if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
from.SendGump( new CraftGump( from, craftSystem, tool, checkMessage ) );
else if ( checkMessage is int && (int)checkMessage > 0 )
from.SendLocalizedMessage( (int)checkMessage );
else if ( checkMessage is string )
from.SendMessage( (string)checkMessage );
return;
}
else if ( !ConsumeAttributes( from, ref checkMessage, false ) )
{
if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
from.SendGump( new CraftGump( from, craftSystem, tool, checkMessage ) );
else if ( checkMessage is int && (int)checkMessage > 0 )
from.SendLocalizedMessage( (int)checkMessage );
else if ( checkMessage is string )
from.SendMessage( (string)checkMessage );
else if ( checkMessage is int messageInt && messageInt > 0 )
from.SendLocalizedMessage( messageInt );
else
from.SendMessage( checkMessage.ToString() );
return;
}
@ -1119,25 +1093,15 @@ namespace Server.Engines.Craft
object message = null;
// Not enough resource to craft it
if ( !ConsumeRes( from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message ) )
if ( !(ConsumeRes( from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message )
&& ConsumeAttributes( from, ref message, true )))
{
if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
from.SendGump( new CraftGump( from, craftSystem, tool, message ) );
else if ( message is int && (int)message > 0 )
from.SendLocalizedMessage( (int)message );
else if ( message is string )
from.SendMessage( (string)message );
return;
}
else if ( !ConsumeAttributes( from, ref message, true ) )
{
if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
from.SendGump( new CraftGump( from, craftSystem, tool, message ) );
else if ( message is int && (int)message > 0 )
from.SendLocalizedMessage( (int)message );
else if ( message is string )
from.SendMessage( (string)message );
else if ( message is int messageIn && messageIn > 0 )
from.SendLocalizedMessage( messageIn );
else
from.SendMessage( message.ToString() );
return;
}
@ -1146,8 +1110,7 @@ namespace Server.Engines.Craft
if ( craftSystem is DefBlacksmithy )
{
AncientSmithyHammer hammer = from.FindItemOnLayer( Layer.OneHanded ) as AncientSmithyHammer;
if ( hammer != null && hammer != tool )
if ( from.FindItemOnLayer( Layer.OneHanded ) is AncientSmithyHammer hammer && hammer != tool )
{
hammer.UsesRemaining--;
if ( hammer.UsesRemaining < 1 )
@ -1180,22 +1143,22 @@ namespace Server.Engines.Craft
if ( item != null )
{
if( item is ICraftable )
endquality = ((ICraftable)item).OnCraft( quality, makersMark, from, craftSystem, typeRes, tool, this, resHue );
if ( item is ICraftable craftable )
endquality = craftable.OnCraft( quality, makersMark, from, craftSystem, typeRes, tool, this, resHue );
else if ( item.Hue == 0 )
item.Hue = resHue;
if ( maxAmount > 0 )
{
if ( !item.Stackable && item is IUsesRemaining )
((IUsesRemaining)item).UsesRemaining *= maxAmount;
if ( !item.Stackable && item is IUsesRemaining remaining )
remaining.UsesRemaining *= maxAmount;
else
item.Amount = maxAmount;
}
from.AddToBackpack( item );
if( from.AccessLevel > AccessLevel.Player )
if ( from.AccessLevel > AccessLevel.Player )
CommandLogging.WriteLine( from, "Crafting {0} with craft system {1}", CommandLogging.Format( item ), craftSystem.GetType().Name );
//from.PlaySound( 0x57 );
@ -1266,10 +1229,10 @@ namespace Server.Engines.Craft
{
if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
from.SendGump( new CraftGump( from, craftSystem, tool, message ) );
else if ( message is int && (int)message > 0 )
from.SendLocalizedMessage( (int)message );
else if ( message is string )
from.SendMessage( (string)message );
else if ( message is int messageInt && messageInt > 0 )
from.SendLocalizedMessage( messageInt );
else
from.SendMessage( message.ToString() );
return;
}

View file

@ -32,18 +32,14 @@ namespace Server.Engines.Craft
if ( !(item is BaseArmor) && !(item is BaseWeapon) )
return EnhanceResult.BadItem;
if ( item is IArcaneEquip )
{
IArcaneEquip eq = (IArcaneEquip)item;
if ( eq.IsArcane )
return EnhanceResult.BadItem;
}
if ( item is IArcaneEquip eq && eq.IsArcane )
return EnhanceResult.BadItem;
if ( CraftResources.IsStandard( resource ) )
return EnhanceResult.BadResource;
int num = craftSystem.CanCraft( from, tool, item.GetType() );
if ( num > 0 )
{
resMessage = num;
@ -56,7 +52,7 @@ namespace Server.Engines.Craft
return EnhanceResult.BadItem;
bool allRequiredSkills = false;
if( craftItem.GetSuccessChance( from, resType, craftSystem, false, ref allRequiredSkills ) <= 0.0 )
if ( craftItem.GetSuccessChance( from, resType, craftSystem, false, ref allRequiredSkills ) <= 0.0 )
return EnhanceResult.NoSkill;
CraftResourceInfo info = CraftResources.GetInfo( resource );
@ -76,8 +72,7 @@ namespace Server.Engines.Craft
if ( craftSystem is DefBlacksmithy )
{
AncientSmithyHammer hammer = from.FindItemOnLayer( Layer.OneHanded ) as AncientSmithyHammer;
if ( hammer != null )
if ( from.FindItemOnLayer( Layer.OneHanded ) is AncientSmithyHammer hammer )
{
hammer.UsesRemaining--;
if ( hammer.UsesRemaining < 1 )
@ -99,10 +94,8 @@ namespace Server.Engines.Craft
bool lreqBonus = false;
bool dincBonus = false;
if ( item is BaseWeapon )
if ( item is BaseWeapon weapon )
{
BaseWeapon weapon = (BaseWeapon)item;
if ( !CraftResources.IsStandard( weapon.Resource ) )
return EnhanceResult.AlreadyEnhanced;
@ -203,17 +196,15 @@ namespace Server.Engines.Craft
if ( !craftItem.ConsumeRes( from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref resMessage ) )
return EnhanceResult.NoResources;
if( item is BaseWeapon )
if ( item is BaseWeapon w )
{
BaseWeapon w = (BaseWeapon)item;
w.Resource = resource;
int hue = w.GetElementalDamageHue();
if( hue > 0 )
if ( hue > 0 )
w.Hue = hue;
}
else if( item is BaseArmor ) //Sanity
else
{
((BaseArmor)item).Resource = resource;
}
@ -302,10 +293,10 @@ namespace Server.Engines.Craft
protected override void OnTarget( Mobile from, object targeted )
{
if ( targeted is Item )
if ( targeted is Item item )
{
object message = null;
EnhanceResult res = Enhance.Invoke( from, m_CraftSystem, m_Tool, (Item)targeted, m_Resource, m_ResourceType, ref message );
EnhanceResult res = Enhance.Invoke( from, m_CraftSystem, m_Tool, item, m_Resource, m_ResourceType, ref message );
switch ( res )
{
@ -324,4 +315,4 @@ namespace Server.Engines.Craft
}
}
}
}
}

View file

@ -24,10 +24,10 @@ namespace Server.Engines.Craft
m.BeginTarget( -1, false, Server.Targeting.TargetFlags.None, new TargetCallback(
delegate( Mobile from, object targeted )
{
if( targeted is PlayerMobile )
if ( targeted is PlayerMobile mobile )
{
foreach( KeyValuePair<int, Recipe> kvp in m_Recipes )
((PlayerMobile)targeted).AcquireRecipe( kvp.Key );
mobile.AcquireRecipe( kvp.Key );
m.SendMessage( "You teach them all of the recipies." );
}
@ -49,9 +49,9 @@ namespace Server.Engines.Craft
m.BeginTarget( -1, false, Server.Targeting.TargetFlags.None, new TargetCallback(
delegate( Mobile from, object targeted )
{
if( targeted is PlayerMobile )
if ( targeted is PlayerMobile mobile )
{
((PlayerMobile)targeted).ResetRecipes();
mobile.ResetRecipes();
m.SendMessage( "They forget all their recipies." );
}
@ -99,7 +99,7 @@ namespace Server.Engines.Craft
{
get
{
if( m_TD == null )
if ( m_TD == null )
m_TD = new TextDefinition( m_CraftItem.NameNumber, m_CraftItem.NameString );
return m_TD;
@ -112,7 +112,7 @@ namespace Server.Engines.Craft
m_System = system;
m_CraftItem = item;
if( m_Recipes.ContainsKey( id ) )
if ( m_Recipes.ContainsKey( id ) )
throw new Exception( "Attempting to create recipe with preexisting ID." );
m_Recipes.Add( id, this );

View file

@ -68,15 +68,15 @@ namespace Server.Engines.Craft
double difficulty = GetRepairDifficulty( curHits, maxHits ) * 0.1;
if( m_Deed != null )
if ( m_Deed != null )
{
double value = m_Deed.SkillLevel;
double minSkill = difficulty - 25.0;
double maxSkill = difficulty + 25;
if( value < minSkill )
if ( value < minSkill )
return false; // Too difficult
else if( value >= maxSkill )
else if ( value >= maxSkill )
return true; // No challenge
double chance = (value - minSkill) / (maxSkill - minSkill);
@ -91,7 +91,7 @@ namespace Server.Engines.Craft
private bool CheckDeed( Mobile from )
{
if( m_Deed != null )
if ( m_Deed != null )
{
return m_Deed.Check( from );
}
@ -211,7 +211,7 @@ namespace Server.Engines.Craft
{
int number;
if( !CheckDeed( from ) )
if ( !CheckDeed( from ) )
return;
bool usingDeed = (m_Deed != null);
@ -223,9 +223,8 @@ namespace Server.Engines.Craft
{
number = 1044282; // You must be near a forge and and anvil to repair items. * Yes, there are two and's *
}
else if ( m_CraftSystem is DefTinkering && targeted is Golem )
else if ( m_CraftSystem is DefTinkering && targeted is Golem g )
{
Golem g = (Golem)targeted;
int damage = g.HitsMax - g.Hits;
if ( g.IsDeadBondedPet )
@ -286,9 +285,8 @@ namespace Server.Engines.Craft
}
}
}
else if ( targeted is BaseWeapon )
else if ( targeted is BaseWeapon weapon )
{
BaseWeapon weapon = (BaseWeapon)targeted;
SkillName skill = m_CraftSystem.MainSkill;
int toWeaken = 0;
@ -351,9 +349,8 @@ namespace Server.Engines.Craft
toDelete = true;
}
}
else if ( targeted is BaseArmor )
else if ( targeted is BaseArmor armor )
{
BaseArmor armor = (BaseArmor)targeted;
SkillName skill = m_CraftSystem.MainSkill;
int toWeaken = 0;
@ -412,9 +409,8 @@ namespace Server.Engines.Craft
toDelete = true;
}
}
else if ( targeted is BaseClothing )
else if ( targeted is BaseClothing clothing )
{
BaseClothing clothing = (BaseClothing)targeted;
SkillName skill = m_CraftSystem.MainSkill;
int toWeaken = 0;
@ -434,7 +430,7 @@ namespace Server.Engines.Craft
toWeaken = 3;
}
if (m_CraftSystem.CraftItems.SearchForSubclass(clothing.GetType()) == null && !IsSpecialClothing(clothing) && !((targeted is TribalMask) || (targeted is HornedTribalMask)) )
if (m_CraftSystem.CraftItems.SearchForSubclass(clothing.GetType()) == null && !IsSpecialClothing(clothing) && !((clothing is TribalMask) || (clothing is HornedTribalMask)) )
{
number = (usingDeed) ? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract.
}
@ -473,13 +469,13 @@ namespace Server.Engines.Craft
toDelete = true;
}
}
else if( !usingDeed && targeted is BlankScroll )
else if ( !usingDeed && targeted is BlankScroll scroll )
{
SkillName skill = m_CraftSystem.MainSkill;
if( from.Skills[skill].Value >= 50.0 )
if ( from.Skills[skill].Value >= 50.0 )
{
((BlankScroll)targeted).Consume( 1 );
scroll.Consume( 1 );
RepairDeed deed = new RepairDeed( RepairDeed.GetTypeFor( m_CraftSystem ), from.Skills[skill].Value, from );
from.AddToBackpack( deed );
@ -497,7 +493,7 @@ namespace Server.Engines.Craft
number = 500426; // You can't repair that.
}
if( !usingDeed )
if ( !usingDeed )
{
CraftContext context = m_CraftSystem.GetContext( from );
from.SendGump( new CraftGump( from, m_CraftSystem, m_Tool, number ) );
@ -506,10 +502,10 @@ namespace Server.Engines.Craft
{
from.SendLocalizedMessage( number );
if( toDelete )
if ( toDelete )
m_Deed.Delete();
}
}
}
}
}
}

View file

@ -90,7 +90,7 @@ namespace Server.Engines.Craft
Type resourceType = info.ResourceTypes[0];
Item ingot = (Item)Activator.CreateInstance( resourceType );
if ( item is DragonBardingDeed || (item is BaseArmor && ((BaseArmor)item).PlayerConstructed) || (item is BaseWeapon && ((BaseWeapon)item).PlayerConstructed) || (item is BaseClothing && ((BaseClothing)item).PlayerConstructed) )
if ( item is DragonBardingDeed || (item is BaseArmor armor && armor.PlayerConstructed) || (item is BaseWeapon weapon && weapon.PlayerConstructed) || (item is BaseClothing clothing && clothing.PlayerConstructed) )
ingot.Amount = craftResource.Amount / 2;
else
ingot.Amount = 1;
@ -118,7 +118,7 @@ namespace Server.Engines.Craft
if ( num == 1044267 )
{
bool anvil, forge;
DefBlacksmithy.CheckAnvilAndForge( from, 2, out anvil, out forge );
if ( !anvil )
@ -135,19 +135,19 @@ namespace Server.Engines.Craft
bool isStoreBought = false;
int message;
if ( targeted is BaseArmor )
if ( targeted is BaseArmor armor )
{
result = Resmelt( from, (BaseArmor)targeted, ((BaseArmor)targeted).Resource );
isStoreBought = !((BaseArmor)targeted).PlayerConstructed;
result = Resmelt( from, armor, armor.Resource );
isStoreBought = !armor.PlayerConstructed;
}
else if ( targeted is BaseWeapon )
else if ( targeted is BaseWeapon weapon )
{
result = Resmelt( from, (BaseWeapon)targeted, ((BaseWeapon)targeted).Resource );
isStoreBought = !((BaseWeapon)targeted).PlayerConstructed;
result = Resmelt( from, weapon, weapon.Resource );
isStoreBought = !weapon.PlayerConstructed;
}
else if ( targeted is DragonBardingDeed )
else if ( targeted is DragonBardingDeed deed )
{
result = Resmelt( from, (DragonBardingDeed)targeted, ((DragonBardingDeed)targeted).Resource );
result = Resmelt( from, deed, deed.Resource );
isStoreBought = false;
}
@ -164,4 +164,4 @@ namespace Server.Engines.Craft
}
}
}
}
}