Adds more formatting

This commit is contained in:
Kamron Batman 2018-08-19 21:28:24 +08:00
parent e77d695684
commit f674ec2be0
68 changed files with 530 additions and 876 deletions

View file

@ -20,18 +20,12 @@ namespace Server.Items
if ( m_Deed.Deleted || m_Deed.RootParent != from )
return;
if ( target is BaseClothing )
if ( target is BaseClothing item )
{
BaseClothing item = (BaseClothing)target;
if ( item is IArcaneEquip )
if ( (item as IArcaneEquip)?.IsArcane == true )
{
IArcaneEquip eq = (IArcaneEquip)item;
if ( eq.IsArcane )
{
from.SendLocalizedMessage( 1005019 ); // This bless deed is for Clothes only.
return;
}
from.SendLocalizedMessage( 1005019 ); // This bless deed is for Clothes only.
return;
}
if ( item.LootType == LootType.Blessed || item.BlessedFor == from || (Mobile.InsuranceEnabled && item.Insured) ) // Check if its already newbied (blessed)

View file

@ -27,7 +27,7 @@ namespace Server.Items
{
InvalidateProperties();
if ( m_Commodity == null && item is ICommodity && ((ICommodity)item).IsDeedable )
if ( m_Commodity == null && (item as ICommodity)?.IsDeedable == true )
{
m_Commodity = item;
m_Commodity.Internalize();
@ -35,10 +35,8 @@ namespace Server.Items
return true;
}
else
{
return false;
}
return false;
}
public override void Serialize( GenericWriter writer )
@ -109,7 +107,7 @@ namespace Server.Items
string args;
if ( m_Commodity.Name == null )
args = String.Format( "#{0}\t{1}", ( m_Commodity is ICommodity ) ? ((ICommodity)m_Commodity).DescriptionNumber : m_Commodity.LabelNumber, m_Commodity.Amount );
args = String.Format( "#{0}\t{1}", ( m_Commodity is ICommodity commodity ) ? commodity.DescriptionNumber : m_Commodity.LabelNumber, m_Commodity.Amount );
else
args = String.Format( "{0}\t{1}", m_Commodity.Name, m_Commodity.Amount );
@ -130,7 +128,7 @@ namespace Server.Items
string args;
if ( m_Commodity.Name == null )
args = String.Format( "#{0}\t{1}", ( m_Commodity is ICommodity ) ? ((ICommodity)m_Commodity).DescriptionNumber : m_Commodity.LabelNumber, m_Commodity.Amount );
args = String.Format( "#{0}\t{1}", ( m_Commodity is ICommodity commodity ) ? commodity.DescriptionNumber : m_Commodity.LabelNumber, m_Commodity.Amount );
else
args = String.Format( "{0}\t{1}", m_Commodity.Name, m_Commodity.Amount );
@ -228,16 +226,16 @@ namespace Server.Items
{
number = 1047028; // The commodity deed has already been filled.
}
else if ( targeted is Item )
else if ( targeted is Item item )
{
BankBox box = from.FindBankNoCreate();
CommodityDeedBox cox = CommodityDeedBox.Find( m_Deed );
// Veteran Rewards mods
if ( box != null && m_Deed.IsChildOf( box ) && ((Item)targeted).IsChildOf( box ) ||
cox != null && cox.IsSecure && ((Item)targeted).IsChildOf( cox ) )
if ( box != null && m_Deed.IsChildOf( box ) && item.IsChildOf( box ) ||
cox != null && cox.IsSecure && item.IsChildOf( cox ) )
{
if ( m_Deed.SetCommodity( (Item) targeted ) )
if ( m_Deed.SetCommodity( item ) )
{
m_Deed.Hue = 0x592;
number = 1047030; // The commodity deed has been filled.
@ -247,16 +245,13 @@ namespace Server.Items
number = 1047027; // That is not a commodity the bankers will fill a commodity deed with.
}
}
else if ( Core.ML )
{
number = 1080526; // That must be in your bank box or commodity deed box to use it.
}
else
{
if ( Core.ML )
{
number = 1080526; // That must be in your bank box or commodity deed box to use it.
}
else
{
number = 1047026; // That must be in your bank box to use it.
}
number = 1047026; // That must be in your bank box to use it.
}
}
else

View file

@ -54,9 +54,7 @@ namespace Server.Items
if ( Deleted )
return;
SwampDragon pet = obj as SwampDragon;
if ( pet == null || pet.HasBarding )
if ( !(obj is SwampDragon pet) || pet.HasBarding )
{
from.SendLocalizedMessage( 1053025 ); // That is not an unarmored swamp dragon.
}

View file

@ -94,12 +94,10 @@ namespace Server.Items
int[][] RacialData = (m_From.Race == Race.Human) ? HumanArray : ElvenArray;
if ( m_From is PlayerMobile )
if ( m_From is PlayerMobile pm )
{
PlayerMobile pm = (PlayerMobile)m_From;
pm.SetHairMods( -1, -1 ); // clear any hairmods (disguise kit, incognito)
m_From.HairItemID = (m_From.Female) ? RacialData[info.ButtonID][2] : RacialData[info.ButtonID][3];
pm.HairItemID = (pm.Female) ? RacialData[info.ButtonID][2] : RacialData[info.ButtonID][3];
m_Deed.Delete();
}
}

View file

@ -86,15 +86,13 @@ namespace Server.Items
public void Placement_OnTarget( Mobile from, object targeted, object state )
{
IPoint3D p = targeted as IPoint3D;
if ( p == null )
if ( !(targeted is IPoint3D p) )
return;
Point3D loc = new Point3D( p );
if ( p is StaticTarget )
loc.Z -= TileData.ItemTable[((StaticTarget)p).ItemID].CalcHeight; /* NOTE: OSI does not properly normalize Z positioning here.
if ( p is StaticTarget target )
loc.Z -= TileData.ItemTable[target.ItemID].CalcHeight; /* NOTE: OSI does not properly normalize Z positioning here.
* A side affect is that you can only place on floors (due to the CanFit call).
* That functionality may be desired. And so, it's included in this script.
*/
@ -107,9 +105,7 @@ namespace Server.Items
{
this.Delete();
HolidayTree tree = new HolidayTree( from, type, loc );
BaseHouse house = BaseHouse.FindHouseAt( tree );
if ( house != null )
house.Addons.Add( tree );
BaseHouse.FindHouseAt( tree )?.Addons.Add( tree );
}
public override void OnDoubleClick( Mobile from )

View file

@ -100,9 +100,8 @@ namespace Server.Items
{
from.SendLocalizedMessage( 501928 ); // You can't target the same ticket!
}
else if ( targeted is NewPlayerTicket )
else if ( targeted is NewPlayerTicket theirTicket )
{
NewPlayerTicket theirTicket = targeted as NewPlayerTicket;
Mobile them = theirTicket.m_Owner;
if ( them == null || them.Deleted )
@ -115,7 +114,7 @@ namespace Server.Items
them.SendGump( new InternalGump( them, theirTicket ) );
}
}
else if ( targeted is Item && ((Item)targeted).ItemID == 0x14F0 )
else if ((targeted as Item)?.ItemID == 0x14F0 )
{
from.SendLocalizedMessage( 501931 ); // You need to find another ticket marked NEW PLAYER.
}

View file

@ -245,8 +245,7 @@ namespace Server.Items
if ( !m_Contract.IsUsableBy( from, false, true, true, true ) )
return;
IPoint3D location = targeted as IPoint3D;
if ( location == null )
if ( !(targeted is IPoint3D location) )
return;
Point3D pLocation = new Point3D( location );
@ -284,8 +283,7 @@ namespace Server.Items
}
else
{
bool vendor, contract;
BaseHouse.IsThereVendor( pLocation, map, out vendor, out contract );
BaseHouse.IsThereVendor( pLocation, map, out var vendor, out var contract );
if ( vendor )
{