Fixes more casting
This commit is contained in:
parent
61937d9c97
commit
e77d695684
91 changed files with 512 additions and 908 deletions
|
|
@ -124,9 +124,7 @@ namespace Server.Items
|
|||
if ( pigment.Deleted || pigment.UsesRemaining <= 0 || !from.InRange( pigment.GetWorldLocation(), 3 ) || !pigment.IsAccessibleTo( from ))
|
||||
return;
|
||||
|
||||
Item i = targeted as Item;
|
||||
|
||||
if ( i == null )
|
||||
if ( !(targeted is Item i) )
|
||||
from.SendLocalizedMessage( 1070931 ); // You can only dye artifacts and enhanced magic items with this tub.
|
||||
else if ( !from.InRange( i.GetWorldLocation(), 3 ) || !IsAccessibleTo( from ) )
|
||||
from.SendLocalizedMessage( 502436 ); // That is not accessible.
|
||||
|
|
@ -165,12 +163,12 @@ namespace Server.Items
|
|||
|
||||
CraftResource resource = CraftResource.None;
|
||||
|
||||
if ( i is BaseWeapon )
|
||||
resource = ((BaseWeapon)i).Resource;
|
||||
else if ( i is BaseArmor )
|
||||
resource = ((BaseArmor)i).Resource;
|
||||
else if (i is BaseClothing)
|
||||
resource = ((BaseClothing)i).Resource;
|
||||
if ( i is BaseWeapon weapon )
|
||||
resource = weapon.Resource;
|
||||
else if ( i is BaseArmor armor )
|
||||
resource = armor.Resource;
|
||||
else if (i is BaseClothing clothing)
|
||||
resource = clothing.Resource;
|
||||
|
||||
if ( !CraftResources.IsStandard( resource ) )
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -815,10 +815,8 @@ namespace Server.Items
|
|||
int min = 20;
|
||||
int max = 80;
|
||||
|
||||
if ( item is BaseWeapon )
|
||||
if ( item is BaseWeapon weapon )
|
||||
{
|
||||
BaseWeapon weapon = (BaseWeapon)item;
|
||||
|
||||
if ( Core.AOS )
|
||||
BaseRunicTool.ApplyAttributesTo( weapon, attributeCount, min, max );
|
||||
else
|
||||
|
|
@ -828,10 +826,8 @@ namespace Server.Items
|
|||
weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random( 6 );
|
||||
}
|
||||
}
|
||||
else if ( item is BaseArmor )
|
||||
else if ( item is BaseArmor armor )
|
||||
{
|
||||
BaseArmor armor = (BaseArmor)item;
|
||||
|
||||
if ( Core.AOS )
|
||||
BaseRunicTool.ApplyAttributesTo( armor, attributeCount, min, max );
|
||||
else
|
||||
|
|
@ -840,10 +836,13 @@ namespace Server.Items
|
|||
armor.Durability = (ArmorDurabilityLevel)Utility.Random( 6 );
|
||||
}
|
||||
}
|
||||
else if ( item is BaseHat && Core.AOS )
|
||||
BaseRunicTool.ApplyAttributesTo( (BaseHat)item, attributeCount, min, max );
|
||||
else if ( item is BaseJewel && Core.AOS )
|
||||
BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, attributeCount, min, max );
|
||||
else if (Core.AOS)
|
||||
{
|
||||
if ( item is BaseHat hat )
|
||||
BaseRunicTool.ApplyAttributesTo( hat, attributeCount, min, max );
|
||||
else if ( item is BaseJewel jewel )
|
||||
BaseRunicTool.ApplyAttributesTo( jewel, attributeCount, min, max );
|
||||
}
|
||||
|
||||
DropItem( item );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,10 +124,7 @@ namespace Server.Misc
|
|||
|
||||
public static void HandleKill( Mobile victim, Mobile killer )
|
||||
{
|
||||
PlayerMobile pm = killer as PlayerMobile;
|
||||
BaseCreature bc = victim as BaseCreature;
|
||||
|
||||
if ( DropEra == TreasuresOfTokunoEra.None || pm == null || bc == null || !CheckLocation( bc ) || !CheckLocation( pm )|| !killer.InRange( victim, 18 ))
|
||||
if ( DropEra == TreasuresOfTokunoEra.None || !(killer is PlayerMobile pm) || !(victim is BaseCreature bc) || !CheckLocation( bc ) || !CheckLocation( pm )|| !killer.InRange( victim, 18 ))
|
||||
return;
|
||||
|
||||
if ( bc.Controlled || bc.Owners.Count > 0 || bc.Fame <= 0 )
|
||||
|
|
@ -246,13 +243,11 @@ namespace Server.Mobiles
|
|||
|
||||
public override void OnMovement( Mobile m, Point3D oldLocation )
|
||||
{
|
||||
if ( m.Alive && m is PlayerMobile )
|
||||
if ( m.Alive && m is PlayerMobile pm )
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)m;
|
||||
|
||||
int range = 3;
|
||||
|
||||
if ( m.Alive && Math.Abs( Z - m.Z ) < 16 && InRange( m, range ) && !InRange( oldLocation, range ) )
|
||||
if ( pm.Alive && Math.Abs( Z - pm.Z ) < 16 && InRange( m, range ) && !InRange( oldLocation, range ) )
|
||||
{
|
||||
if ( pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward )
|
||||
{
|
||||
|
|
@ -323,13 +318,13 @@ namespace Server.Gumps
|
|||
for( int i = 0; i < items.Count; i++ )
|
||||
{
|
||||
Item item = (Item)items[i];
|
||||
if ( item is ChestOfHeirlooms && !((ChestOfHeirlooms)item).Locked )
|
||||
if ( item is ChestOfHeirlooms heirlooms && !heirlooms.Locked )
|
||||
continue;
|
||||
|
||||
if ( item is ChestOfHeirlooms && ((ChestOfHeirlooms)item).TrapLevel != 10 )
|
||||
if ( item is ChestOfHeirlooms ofHeirlooms && ofHeirlooms.TrapLevel != 10 )
|
||||
continue;
|
||||
|
||||
if ( item is PigmentsOfTokuno && ((PigmentsOfTokuno)item).Type != PigmentType.None )
|
||||
if ( item is PigmentsOfTokuno tokuno && tokuno.Type != PigmentType.None )
|
||||
continue;
|
||||
|
||||
buttons.Add( new ItemTileButtonInfo( item ) );
|
||||
|
|
@ -385,9 +380,7 @@ namespace Server.Gumps
|
|||
|
||||
public override void HandleCancel( NetState sender )
|
||||
{
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if ( pm == null || !pm.InRange( m_Collector.Location, 7 ) )
|
||||
if ( !(sender.Mobile is PlayerMobile pm) || !pm.InRange( m_Collector.Location, 7 ) )
|
||||
return;
|
||||
|
||||
if ( pm.ToTItemsTurnedIn == 0 )
|
||||
|
|
@ -555,9 +548,7 @@ namespace Server.Gumps
|
|||
|
||||
public override void HandleButtonResponse( NetState sender, int adjustedButton, ImageTileButtonInfo buttonInfo )
|
||||
{
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if ( pm == null || !pm.InRange( m_Collector.Location, 7 ) || !(pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward) )
|
||||
if ( !(sender.Mobile is PlayerMobile pm) || !pm.InRange( m_Collector.Location, 7 ) || !(pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward) )
|
||||
return;
|
||||
|
||||
bool pigments = (buttonInfo is PigmentsTileButtonInfo);
|
||||
|
|
@ -566,7 +557,7 @@ namespace Server.Gumps
|
|||
|
||||
if ( pigments )
|
||||
{
|
||||
PigmentsTileButtonInfo p = buttonInfo as PigmentsTileButtonInfo;
|
||||
PigmentsTileButtonInfo p = (PigmentsTileButtonInfo) buttonInfo;
|
||||
|
||||
item = new PigmentsOfTokuno( p.Pigment );
|
||||
}
|
||||
|
|
@ -610,9 +601,7 @@ namespace Server.Gumps
|
|||
|
||||
public override void HandleCancel( NetState sender )
|
||||
{
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if ( pm == null || !pm.InRange( m_Collector.Location, 7 ) )
|
||||
if ( !(sender.Mobile is PlayerMobile pm) || !pm.InRange( m_Collector.Location, 7 ) )
|
||||
return;
|
||||
|
||||
if ( pm.ToTItemsTurnedIn == 0 )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue