Fixes more casting and other formatting issues.
This commit is contained in:
parent
03dd5f1926
commit
61937d9c97
67 changed files with 325 additions and 570 deletions
|
|
@ -228,7 +228,7 @@ namespace Server.Engines.Harvest
|
|||
if ( type == typeof( TreasureMap ) )
|
||||
{
|
||||
int level;
|
||||
if ( @from is PlayerMobile mobile && mobile.Young && mobile.Map == Map.Trammel && TreasureMap.IsInHavenIsland( from ) )
|
||||
if ( from is PlayerMobile mobile && mobile.Young && mobile.Map == Map.Trammel && TreasureMap.IsInHavenIsland( from ) )
|
||||
level = 0;
|
||||
else
|
||||
level = 1;
|
||||
|
|
|
|||
|
|
@ -162,10 +162,10 @@ namespace Server.Engines.Harvest
|
|||
|
||||
public override void OnBadHarvestTarget( Mobile from, Item tool, object toHarvest )
|
||||
{
|
||||
if ( toHarvest is Mobile )
|
||||
( (Mobile)toHarvest ).PrivateOverheadMessage( MessageType.Regular, 0x3B2, 500450, from.NetState ); // You can only skin dead creatures.
|
||||
else if ( toHarvest is Item )
|
||||
( (Item)toHarvest ).LabelTo( from, 500464 ); // Use this on corpses to carve away meat and hide
|
||||
if ( toHarvest is Mobile mobile )
|
||||
mobile.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 500450, from.NetState ); // You can only skin dead creatures.
|
||||
else if ( toHarvest is Item item )
|
||||
item.LabelTo( from, 500464 ); // Use this on corpses to carve away meat and hide
|
||||
else if ( toHarvest is Targeting.StaticTarget || toHarvest is Targeting.LandTarget )
|
||||
from.SendLocalizedMessage( 500489 ); // You can't use an axe on that.
|
||||
else
|
||||
|
|
|
|||
|
|
@ -194,8 +194,7 @@ namespace Server.Engines.Harvest
|
|||
{
|
||||
if ( def == m_OreAndStone )
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
if ( pm != null && pm.StoneMining && pm.ToggleMiningStone && from.Skills[SkillName.Mining].Base >= 100.0 && 0.1 > Utility.RandomDouble() )
|
||||
if ( from is PlayerMobile pm && pm.StoneMining && pm.ToggleMiningStone && from.Skills[SkillName.Mining].Base >= 100.0 && 0.1 > Utility.RandomDouble() )
|
||||
return resource.Types[1];
|
||||
|
||||
return resource.Types[0];
|
||||
|
|
@ -236,17 +235,17 @@ namespace Server.Engines.Harvest
|
|||
if ( !base.CheckHarvest( from, tool, def, toHarvest ) )
|
||||
return false;
|
||||
|
||||
if ( def == m_Sand && !(from is PlayerMobile && from.Skills[SkillName.Mining].Base >= 100.0 && ((PlayerMobile)from).SandMining) )
|
||||
if ( def == m_Sand && !(from is PlayerMobile mobile && mobile.Skills[SkillName.Mining].Base >= 100.0 && mobile.SandMining) )
|
||||
{
|
||||
OnBadHarvestTarget( from, tool, toHarvest );
|
||||
return false;
|
||||
}
|
||||
else if ( from.Mounted )
|
||||
if ( from.Mounted )
|
||||
{
|
||||
from.SendLocalizedMessage( 501864 ); // You can't mine while riding.
|
||||
return false;
|
||||
}
|
||||
else if ( from.IsBodyMod && !from.Body.IsHuman )
|
||||
if ( from.IsBodyMod && !from.Body.IsHuman )
|
||||
{
|
||||
from.SendLocalizedMessage( 501865 ); // You can't mine while polymorphed.
|
||||
return false;
|
||||
|
|
@ -295,9 +294,7 @@ namespace Server.Engines.Harvest
|
|||
if ( map == null )
|
||||
return;
|
||||
|
||||
BaseCreature spawned = Activator.CreateInstance( res.Types[2], new object[]{ 25 } ) as BaseCreature;
|
||||
|
||||
if ( spawned != null )
|
||||
if ( Activator.CreateInstance( res.Types[2], new object[]{ 25 } ) is BaseCreature spawned )
|
||||
{
|
||||
int offset = Utility.Random( 8 ) * 2;
|
||||
|
||||
|
|
@ -313,17 +310,15 @@ namespace Server.Engines.Harvest
|
|||
spawned.Combatant = from;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
int z = map.GetAverageZ( x, y );
|
||||
|
||||
if ( Math.Abs( z - from.Z ) < 10 && map.CanSpawnMobile( x, y, z ) )
|
||||
{
|
||||
spawned.OnBeforeSpawn( new Point3D( x, y, z ), map );
|
||||
spawned.MoveToWorld( new Point3D( x, y, z ), map );
|
||||
spawned.Combatant = from;
|
||||
return;
|
||||
}
|
||||
int z = map.GetAverageZ( x, y );
|
||||
|
||||
if ( Math.Abs( z - from.Z ) < 10 && map.CanSpawnMobile( x, y, z ) )
|
||||
{
|
||||
spawned.OnBeforeSpawn( new Point3D( x, y, z ), map );
|
||||
spawned.MoveToWorld( new Point3D( x, y, z ), map );
|
||||
spawned.Combatant = from;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -430,4 +425,4 @@ namespace Server.Engines.Harvest
|
|||
};
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue