More cast conversion fixes
This commit is contained in:
parent
3f45bd57b9
commit
aba9452161
46 changed files with 359 additions and 506 deletions
|
|
@ -173,21 +173,19 @@ namespace Server.Items
|
|||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( targeted is Item )
|
||||
if ( targeted is Item item )
|
||||
{
|
||||
Item item = (Item)targeted;
|
||||
|
||||
if ( item.QuestItem )
|
||||
{
|
||||
from.SendLocalizedMessage( 1151836 ); // You may not dye toggled quest items.
|
||||
}
|
||||
else if ( item is IDyable && m_Tub.AllowDyables )
|
||||
else if ( item is IDyable dyable && m_Tub.AllowDyables )
|
||||
{
|
||||
if ( !from.InRange( m_Tub.GetWorldLocation(), 1 ) || !from.InRange( item.GetWorldLocation(), 1 ) )
|
||||
from.SendLocalizedMessage( 500446 ); // That is too far away.
|
||||
else if ( item.Parent is Mobile )
|
||||
from.SendLocalizedMessage( 500861 ); // Can't Dye clothing that is being worn.
|
||||
else if ( ((IDyable)item).Dye( from, m_Tub ) )
|
||||
else if ( dyable.Dye( from, m_Tub ) )
|
||||
from.PlaySound( 0x23E );
|
||||
}
|
||||
else if ( (FurnitureAttribute.Check( item ) || (item is PotionKeg)) && m_Tub.AllowFurniture )
|
||||
|
|
@ -258,7 +256,7 @@ namespace Server.Items
|
|||
from.PlaySound( 0x23E );
|
||||
}
|
||||
}
|
||||
else if ( (item is BaseArmor && (((BaseArmor)item).MaterialType == ArmorMaterialType.Leather || ((BaseArmor)item).MaterialType == ArmorMaterialType.Studded) || item is ElvenBoots || item is WoodlandBelt) && m_Tub.AllowLeather )
|
||||
else if ( (item is BaseArmor armor && (armor.MaterialType == ArmorMaterialType.Leather || armor.MaterialType == ArmorMaterialType.Studded) || item is ElvenBoots || item is WoodlandBelt) && m_Tub.AllowLeather )
|
||||
{
|
||||
if ( !from.InRange( m_Tub.GetWorldLocation(), 1 ) || !from.InRange( item.GetWorldLocation(), 1 ) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -77,10 +77,8 @@ namespace Server.Items
|
|||
|
||||
public virtual void SetTubHue( Mobile from, object state, int hue )
|
||||
{
|
||||
if ( state is DyeTub )
|
||||
if ( state is DyeTub tub )
|
||||
{
|
||||
DyeTub tub = state as DyeTub;
|
||||
|
||||
tub.DyedHue = hue;
|
||||
|
||||
/* dyes.m_UsesRemaining--; let this change ride till the overhaul */
|
||||
|
|
@ -89,10 +87,8 @@ namespace Server.Items
|
|||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( targeted is DyeTub )
|
||||
if ( targeted is DyeTub tub )
|
||||
{
|
||||
DyeTub tub = (DyeTub) targeted;
|
||||
|
||||
if ( tub.Redyable )
|
||||
{
|
||||
if ( tub.MetallicHues ) /* OSI has three metallic tubs now */
|
||||
|
|
|
|||
|
|
@ -71,20 +71,16 @@ namespace Server.Items
|
|||
{
|
||||
from.SendLocalizedMessage( 1063305 ); // Didn't your parents ever tell you not to run with scissors in your hand?!
|
||||
}
|
||||
else if ( targeted is Item && !((Item)targeted).Movable )
|
||||
else if ( targeted is Item item && !item.Movable )
|
||||
{
|
||||
if ( targeted is IScissorable && ( targeted is PlagueBeastInnard || targeted is PlagueBeastMutationCore ) )
|
||||
if ( item is IScissorable obj && ( obj is PlagueBeastInnard || obj is PlagueBeastMutationCore ) )
|
||||
{
|
||||
IScissorable obj = (IScissorable) targeted;
|
||||
|
||||
if ( CanScissor( from, obj ) && obj.Scissor( from, m_Item ) )
|
||||
from.PlaySound( 0x248 );
|
||||
}
|
||||
}
|
||||
else if ( targeted is IScissorable )
|
||||
else if ( targeted is IScissorable obj )
|
||||
{
|
||||
IScissorable obj = (IScissorable)targeted;
|
||||
|
||||
if ( CanScissor( from, obj ) && obj.Scissor( from, m_Item ) )
|
||||
from.PlaySound( 0x248 );
|
||||
}
|
||||
|
|
@ -96,10 +92,8 @@ namespace Server.Items
|
|||
|
||||
protected override void OnNonlocalTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( targeted is IScissorable && ( targeted is PlagueBeastInnard || targeted is PlagueBeastMutationCore ) )
|
||||
if ( targeted is IScissorable obj && ( obj is PlagueBeastInnard || obj is PlagueBeastMutationCore ) )
|
||||
{
|
||||
IScissorable obj = (IScissorable) targeted;
|
||||
|
||||
if ( CanScissor( from, obj ) && obj.Scissor( from, m_Item ) )
|
||||
from.PlaySound( 0x248 );
|
||||
}
|
||||
|
|
@ -110,7 +104,7 @@ namespace Server.Items
|
|||
|
||||
public static bool CanScissor( Mobile from, IScissorable obj )
|
||||
{
|
||||
if ( obj is Item && ( (Item)obj ).Nontransferable )
|
||||
if ( obj is Item item && item.Nontransferable )
|
||||
{
|
||||
from.SendLocalizedMessage( 502440 ); // Scissors can not be used on that to produce anything.
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue