Adds more formatting
This commit is contained in:
parent
e77d695684
commit
f674ec2be0
68 changed files with 530 additions and 876 deletions
|
|
@ -54,9 +54,7 @@ namespace Server.Items
|
|||
|
||||
public void Throw( Mobile from )
|
||||
{
|
||||
BaseKnife knife = from.Weapon as BaseKnife;
|
||||
|
||||
if ( knife == null )
|
||||
if ( !(from.Weapon is BaseKnife knife) )
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500751 ); // Try holding a knife...
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -74,9 +74,7 @@ namespace Server.Items
|
|||
m_Timer = null;
|
||||
}
|
||||
|
||||
Mobile from = state as Mobile;
|
||||
|
||||
if ( from != null && !from.Deleted && !this.Deleted && IsFull )
|
||||
if ( state is Mobile from && !from.Deleted && !this.Deleted && IsFull )
|
||||
{
|
||||
SackFlour flour = new SackFlour();
|
||||
|
||||
|
|
@ -137,9 +135,7 @@ namespace Server.Items
|
|||
|
||||
for ( int i = 0; i < components.Count; ++i )
|
||||
{
|
||||
AddonComponent component = components[i] as AddonComponent;
|
||||
|
||||
if ( component == null )
|
||||
if ( !(components[i] is AddonComponent component) )
|
||||
continue;
|
||||
|
||||
int[] itemTable = FindItemTable( component.ItemID );
|
||||
|
|
|
|||
|
|
@ -60,9 +60,7 @@ namespace Server.Items
|
|||
m_Timer = null;
|
||||
}
|
||||
|
||||
Mobile from = state as Mobile;
|
||||
|
||||
if ( from != null && !from.Deleted && !this.Deleted && IsFull )
|
||||
if ( state is Mobile from && !from.Deleted && !this.Deleted && IsFull )
|
||||
{
|
||||
SackFlour flour = new SackFlour();
|
||||
|
||||
|
|
@ -123,9 +121,7 @@ namespace Server.Items
|
|||
|
||||
for ( int i = 0; i < components.Count; ++i )
|
||||
{
|
||||
AddonComponent component = components[i] as AddonComponent;
|
||||
|
||||
if ( component == null )
|
||||
if ( !(components[i] is AddonComponent component) )
|
||||
continue;
|
||||
|
||||
int[] itemTable = FindItemTable( component.ItemID );
|
||||
|
|
|
|||
|
|
@ -76,9 +76,7 @@ namespace Server.Items
|
|||
{
|
||||
for ( int i = 0; i < Components.Count; ++i )
|
||||
{
|
||||
AddonComponent ac = Components[i] as AddonComponent;
|
||||
|
||||
if ( ac != null && ac.Hue == 2118 )
|
||||
if ( Components[i] is AddonComponent ac && ac.Hue == 2118 )
|
||||
ac.Hue = 1161;
|
||||
}
|
||||
} );
|
||||
|
|
@ -90,9 +88,7 @@ namespace Server.Items
|
|||
{
|
||||
for ( int i = 0; i < Components.Count; ++i )
|
||||
{
|
||||
AddonComponent ac = Components[i] as AddonComponent;
|
||||
|
||||
if ( ac != null )
|
||||
if ( Components[i] is AddonComponent ac )
|
||||
ac.Name = "jack-o-lantern";
|
||||
}
|
||||
} );
|
||||
|
|
|
|||
|
|
@ -17,9 +17,7 @@ namespace Server.Items
|
|||
{
|
||||
m_Active = value;
|
||||
|
||||
SHTeleporter sourceAddon = Addon as SHTeleporter;
|
||||
|
||||
if ( sourceAddon != null )
|
||||
if ( Addon is SHTeleporter sourceAddon )
|
||||
sourceAddon.ChangeActive( value );
|
||||
}
|
||||
}
|
||||
|
|
@ -46,9 +44,7 @@ namespace Server.Items
|
|||
{
|
||||
m_TeleDest = value;
|
||||
|
||||
SHTeleporter sourceAddon = Addon as SHTeleporter;
|
||||
|
||||
if ( sourceAddon != null )
|
||||
if ( Addon is SHTeleporter sourceAddon )
|
||||
sourceAddon.ChangeDest( value );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -208,10 +208,8 @@ namespace Server.Items
|
|||
|
||||
bool takeItem = true;
|
||||
|
||||
if ( dropped is FishBowl )
|
||||
if ( dropped is FishBowl bowl )
|
||||
{
|
||||
FishBowl bowl = (FishBowl) dropped;
|
||||
|
||||
if ( bowl.Empty || !AddFish( from, bowl.Fish ) )
|
||||
return false;
|
||||
|
||||
|
|
@ -219,10 +217,8 @@ namespace Server.Items
|
|||
|
||||
takeItem = false;
|
||||
}
|
||||
else if ( dropped is BaseFish )
|
||||
else if ( dropped is BaseFish fish )
|
||||
{
|
||||
BaseFish fish = (BaseFish) dropped;
|
||||
|
||||
if ( !AddFish( from, fish ) )
|
||||
return false;
|
||||
}
|
||||
|
|
@ -240,10 +236,8 @@ namespace Server.Items
|
|||
|
||||
from.SendLocalizedMessage( 1074259, "1" ); // ~1_NUM~ unit(s) of food have been added to the aquarium.
|
||||
}
|
||||
else if ( dropped is BaseBeverage )
|
||||
else if ( dropped is BaseBeverage beverage )
|
||||
{
|
||||
BaseBeverage beverage = (BaseBeverage) dropped;
|
||||
|
||||
if ( beverage.IsEmpty || !beverage.Pourable || beverage.Content != BeverageType.Water )
|
||||
{
|
||||
from.SendLocalizedMessage( 500840 ); // Can't pour that in there.
|
||||
|
|
@ -283,13 +277,8 @@ namespace Server.Items
|
|||
|
||||
item.MoveToWorld( loc, Map );
|
||||
|
||||
if ( item is BaseFish )
|
||||
{
|
||||
BaseFish fish = (BaseFish) item;
|
||||
|
||||
if ( !fish.Dead )
|
||||
fish.StartTimer();
|
||||
}
|
||||
if ( item is BaseFish fish && !fish.Dead )
|
||||
fish.StartTimer();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -785,10 +774,8 @@ namespace Server.Items
|
|||
return false;
|
||||
}
|
||||
|
||||
if ( item is BaseFish )
|
||||
if ( item is BaseFish fish )
|
||||
{
|
||||
BaseFish fish = (BaseFish) item;
|
||||
|
||||
FishBowl bowl;
|
||||
|
||||
if ( (bowl = GetEmptyBowl( from )) != null )
|
||||
|
|
@ -820,10 +807,8 @@ namespace Server.Items
|
|||
from.SendLocalizedMessage( 1074514 ); // You have no place to put it.
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1074513 ); // You put the item into your pack.
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 1074513 ); // You put the item into your pack.
|
||||
}
|
||||
|
||||
InvalidateProperties();
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ namespace Server.Items
|
|||
AddHtmlLocalized( 20, 217, 250, 20, item.LabelNumber, 0xFFFFFF, false, false ); // Name
|
||||
|
||||
// item details
|
||||
if ( item is BaseFish )
|
||||
AddHtmlLocalized( 20, 239, 315, 20, ( (BaseFish) item ).GetDescription(), 0xFFFFFF, false, false );
|
||||
if ( item is BaseFish fish )
|
||||
AddHtmlLocalized( 20, 239, 315, 20, fish.GetDescription(), 0xFFFFFF, false, false );
|
||||
else
|
||||
AddHtmlLocalized( 20, 239, 315, 20, 1073634, 0xFFFFFF, false, false ); // An aquarium decoration
|
||||
|
||||
|
|
|
|||
|
|
@ -25,10 +25,7 @@ namespace Server.Items
|
|||
if ( Empty )
|
||||
return null;
|
||||
|
||||
if ( Items[ 0 ] is BaseFish )
|
||||
return (BaseFish) Items[ 0 ];
|
||||
|
||||
return null;
|
||||
return Items[0] as BaseFish;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,9 +101,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnAfterDuped( Item newItem )
|
||||
{
|
||||
BaseArmor armor = newItem as BaseArmor;
|
||||
|
||||
if ( armor == null )
|
||||
if ( !(newItem is BaseArmor armor) )
|
||||
return;
|
||||
|
||||
armor.m_AosAttributes = new AosAttributes( newItem, m_AosAttributes );
|
||||
|
|
@ -125,8 +123,7 @@ namespace Server.Items
|
|||
{
|
||||
if ( m_ArmorBase == -1 )
|
||||
return ArmorBase;
|
||||
else
|
||||
return m_ArmorBase;
|
||||
return m_ArmorBase;
|
||||
}
|
||||
set
|
||||
{
|
||||
|
|
@ -258,8 +255,7 @@ namespace Server.Items
|
|||
Invalidate();
|
||||
InvalidateProperties();
|
||||
|
||||
if ( Parent is Mobile )
|
||||
((Mobile)Parent).UpdateResistances();
|
||||
(Parent as Mobile)?.UpdateResistances();
|
||||
|
||||
ScaleDurability();
|
||||
}
|
||||
|
|
@ -353,8 +349,7 @@ namespace Server.Items
|
|||
Invalidate();
|
||||
InvalidateProperties();
|
||||
|
||||
if ( Parent is Mobile )
|
||||
((Mobile)Parent).UpdateResistances();
|
||||
(Parent as Mobile)?.UpdateResistances();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -609,10 +604,8 @@ namespace Server.Items
|
|||
|
||||
Item item = m.Items[i];
|
||||
|
||||
if ( item is BaseArmor )
|
||||
if ( item is BaseArmor armor )
|
||||
{
|
||||
BaseArmor armor = (BaseArmor)item;
|
||||
|
||||
if ( armor.RequiredRace != null && m.Race != armor.RequiredRace )
|
||||
{
|
||||
if ( armor.RequiredRace == Race.Elf )
|
||||
|
|
@ -669,10 +662,8 @@ namespace Server.Items
|
|||
|
||||
public override void OnAdded(IEntity parent)
|
||||
{
|
||||
if ( parent is Mobile )
|
||||
if ( parent is Mobile from )
|
||||
{
|
||||
Mobile from = (Mobile)parent;
|
||||
|
||||
if ( Core.AOS )
|
||||
m_AosSkillBonuses.AddTo( from );
|
||||
|
||||
|
|
@ -692,8 +683,7 @@ namespace Server.Items
|
|||
|
||||
protected void Invalidate()
|
||||
{
|
||||
if ( Parent is Mobile )
|
||||
((Mobile)Parent).Delta( MobileDelta.Armor ); // Tell them armor rating has changed
|
||||
(Parent as Mobile)?.Delta( MobileDelta.Armor ); // Tell them armor rating has changed
|
||||
}
|
||||
|
||||
public BaseArmor( Serial serial ) : base( serial )
|
||||
|
|
@ -1105,17 +1095,17 @@ namespace Server.Items
|
|||
if ( m_AosSkillBonuses == null )
|
||||
m_AosSkillBonuses = new AosSkillBonuses( this );
|
||||
|
||||
if ( Core.AOS && Parent is Mobile )
|
||||
m_AosSkillBonuses.AddTo( (Mobile)Parent );
|
||||
Mobile m = Parent as Mobile;
|
||||
|
||||
if ( Core.AOS && m != null )
|
||||
m_AosSkillBonuses.AddTo( m );
|
||||
|
||||
int strBonus = ComputeStatBonus( StatType.Str );
|
||||
int dexBonus = ComputeStatBonus( StatType.Dex );
|
||||
int intBonus = ComputeStatBonus( StatType.Int );
|
||||
|
||||
if ( Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
|
||||
if ( m != null && (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
|
||||
{
|
||||
Mobile m = (Mobile)Parent;
|
||||
|
||||
string modName = Serial.ToString();
|
||||
|
||||
if ( strBonus != 0 )
|
||||
|
|
@ -1128,8 +1118,7 @@ namespace Server.Items
|
|||
m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) );
|
||||
}
|
||||
|
||||
if ( Parent is Mobile )
|
||||
((Mobile)Parent).CheckStatTimers();
|
||||
m?.CheckStatTimers();
|
||||
|
||||
if ( version < 7 )
|
||||
m_PlayerConstructed = true; // we don't know, so, assume it's crafted
|
||||
|
|
@ -1267,9 +1256,8 @@ namespace Server.Items
|
|||
|
||||
public override void OnRemoved(IEntity parent)
|
||||
{
|
||||
if ( parent is Mobile )
|
||||
if ( parent is Mobile m )
|
||||
{
|
||||
Mobile m = (Mobile)parent;
|
||||
string modName = this.Serial.ToString();
|
||||
|
||||
m.RemoveStatMod( modName + "Str" );
|
||||
|
|
@ -1279,7 +1267,7 @@ namespace Server.Items
|
|||
if ( Core.AOS )
|
||||
m_AosSkillBonuses.Remove();
|
||||
|
||||
((Mobile)parent).Delta( MobileDelta.Armor ); // Tell them armor rating has changed
|
||||
m.Delta( MobileDelta.Armor ); // Tell them armor rating has changed
|
||||
m.CheckStatTimers();
|
||||
}
|
||||
|
||||
|
|
@ -1288,15 +1276,15 @@ namespace Server.Items
|
|||
|
||||
public virtual int OnHit( BaseWeapon weapon, int damageTaken )
|
||||
{
|
||||
double HalfAr = ArmorRating / 2.0;
|
||||
int Absorbed = (int)(HalfAr + HalfAr*Utility.RandomDouble());
|
||||
double halfar = ArmorRating / 2.0;
|
||||
int absorbed = (int)(halfar + halfar*Utility.RandomDouble());
|
||||
|
||||
damageTaken -= Absorbed;
|
||||
damageTaken -= absorbed;
|
||||
if ( damageTaken < 0 )
|
||||
damageTaken = 0;
|
||||
|
||||
if ( Absorbed < 2 )
|
||||
Absorbed = 2;
|
||||
if ( absorbed < 2 )
|
||||
absorbed = 2;
|
||||
|
||||
if ( 25 > Utility.Random( 100 ) ) // 25% chance to lower durability
|
||||
{
|
||||
|
|
@ -1309,7 +1297,7 @@ namespace Server.Items
|
|||
int wear;
|
||||
|
||||
if ( weapon.Type == WeaponType.Bashing )
|
||||
wear = Absorbed / 2;
|
||||
wear = absorbed / 2;
|
||||
else
|
||||
wear = Utility.Random( 2 );
|
||||
|
||||
|
|
@ -1332,8 +1320,8 @@ namespace Server.Items
|
|||
{
|
||||
MaxHitPoints -= wear;
|
||||
|
||||
if ( Parent is Mobile )
|
||||
((Mobile)Parent).LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061121 ); // Your equipment is severely damaged.
|
||||
if ( Parent is Mobile mobile )
|
||||
mobile.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061121 ); // Your equipment is severely damaged.
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1644,8 +1632,8 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
if ( Core.AOS && tool is BaseRunicTool )
|
||||
((BaseRunicTool)tool).ApplyAttributesTo( this );
|
||||
if ( Core.AOS )
|
||||
(tool as BaseRunicTool)?.ApplyAttributesTo( this );
|
||||
|
||||
return quality;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,21 +62,21 @@ namespace Server.Items
|
|||
private BookPageInfo[] m_Pages;
|
||||
private bool m_Writable;
|
||||
private SecureLevel m_SecureLevel;
|
||||
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string Title
|
||||
{
|
||||
get { return m_Title; }
|
||||
set { m_Title = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string Author
|
||||
{
|
||||
get { return m_Author; }
|
||||
set { m_Author = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Writable
|
||||
{
|
||||
|
|
@ -147,7 +147,7 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
public virtual BookContent DefaultContent{ get{ return null; } }
|
||||
|
||||
|
||||
public BaseBook( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
|
@ -313,13 +313,13 @@ namespace Server.Items
|
|||
if ( m_Pages != null && m_Pages.Length > 0 )
|
||||
list.Add( 1060660, "Pages\t{0}", m_Pages.Length ); // ~1_val~: ~2_val~
|
||||
}*/
|
||||
|
||||
|
||||
public override void OnSingleClick ( Mobile from )
|
||||
{
|
||||
LabelTo( from, "{0} by {1}", m_Title, m_Author );
|
||||
LabelTo( from, "[{0} pages]", m_Pages.Length );
|
||||
}
|
||||
|
||||
|
||||
public override void OnDoubleClick ( Mobile from )
|
||||
{
|
||||
if ( m_Title == null && m_Author == null && m_Writable == true )
|
||||
|
|
@ -375,9 +375,8 @@ namespace Server.Items
|
|||
public static void OldHeaderChange( NetState state, PacketReader pvSrc )
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
BaseBook book = World.FindItem( pvSrc.ReadInt32() ) as BaseBook;
|
||||
|
||||
if ( book == null || !book.Writable || !from.InRange( book.GetWorldLocation(), 1 ) || !book.IsAccessibleTo( from ) )
|
||||
if ( !(World.FindItem( pvSrc.ReadInt32() ) is BaseBook book) || !book.Writable || !from.InRange( book.GetWorldLocation(), 1 ) || !book.IsAccessibleTo( from ) )
|
||||
return;
|
||||
|
||||
pvSrc.Seek( 4, SeekOrigin.Current ); // Skip flags and page count
|
||||
|
|
@ -392,9 +391,8 @@ namespace Server.Items
|
|||
public static void HeaderChange( NetState state, PacketReader pvSrc )
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
BaseBook book = World.FindItem( pvSrc.ReadInt32() ) as BaseBook;
|
||||
|
||||
if ( book == null || !book.Writable || !from.InRange( book.GetWorldLocation(), 1 ) || !book.IsAccessibleTo( from ) )
|
||||
if ( !(World.FindItem( pvSrc.ReadInt32() ) is BaseBook book) || !book.Writable || !from.InRange( book.GetWorldLocation(), 1 ) || !book.IsAccessibleTo( from ) )
|
||||
return;
|
||||
|
||||
pvSrc.Seek( 4, SeekOrigin.Current ); // Skip flags and page count
|
||||
|
|
@ -420,9 +418,8 @@ namespace Server.Items
|
|||
public static void ContentChange( NetState state, PacketReader pvSrc )
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
BaseBook book = World.FindItem( pvSrc.ReadInt32() ) as BaseBook;
|
||||
|
||||
if ( book == null || !book.Writable || !from.InRange( book.GetWorldLocation(), 1 ) || !book.IsAccessibleTo( from ) )
|
||||
if ( !(World.FindItem( pvSrc.ReadInt32() ) is BaseBook book) || !book.Writable || !from.InRange( book.GetWorldLocation(), 1 ) || !book.IsAccessibleTo( from ) )
|
||||
return;
|
||||
|
||||
int pageCount = pvSrc.ReadUInt16();
|
||||
|
|
@ -533,4 +530,4 @@ namespace Server.Items
|
|||
m_Stream.Write( (byte) 0 ); // terminate
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -292,10 +292,8 @@ namespace Server.Items
|
|||
|
||||
Item item = m.Items[i];
|
||||
|
||||
if ( item is BaseClothing )
|
||||
if ( item is BaseClothing clothing )
|
||||
{
|
||||
BaseClothing clothing = (BaseClothing)item;
|
||||
|
||||
if ( clothing.RequiredRace != null && m.Race != clothing.RequiredRace )
|
||||
{
|
||||
if ( clothing.RequiredRace == Race.Elf )
|
||||
|
|
@ -337,9 +335,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnAdded(IEntity parent)
|
||||
{
|
||||
Mobile mob = parent as Mobile;
|
||||
|
||||
if ( mob != null )
|
||||
if ( parent is Mobile mob )
|
||||
{
|
||||
if ( Core.AOS )
|
||||
m_AosSkillBonuses.AddTo( mob );
|
||||
|
|
@ -353,9 +349,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnRemoved(IEntity parent)
|
||||
{
|
||||
Mobile mob = parent as Mobile;
|
||||
|
||||
if ( mob != null )
|
||||
if ( parent is Mobile mob )
|
||||
{
|
||||
if ( Core.AOS )
|
||||
m_AosSkillBonuses.Remove();
|
||||
|
|
@ -415,8 +409,7 @@ namespace Server.Items
|
|||
{
|
||||
MaxHitPoints -= wear;
|
||||
|
||||
if ( Parent is Mobile )
|
||||
((Mobile)Parent).LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061121 ); // Your equipment is severely damaged.
|
||||
(Parent as Mobile)?.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061121 ); // Your equipment is severely damaged.
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -452,9 +445,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnAfterDuped( Item newItem )
|
||||
{
|
||||
BaseClothing clothing = newItem as BaseClothing;
|
||||
|
||||
if ( clothing == null )
|
||||
if ( !(newItem is BaseClothing clothing) )
|
||||
return;
|
||||
|
||||
clothing.m_AosAttributes = new AosAttributes( newItem, m_AosAttributes );
|
||||
|
|
@ -911,9 +902,7 @@ namespace Server.Items
|
|||
if ( m_MaxHitPoints == 0 && m_HitPoints == 0 )
|
||||
m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax( InitMinHits, InitMaxHits );
|
||||
|
||||
Mobile parent = Parent as Mobile;
|
||||
|
||||
if ( parent != null )
|
||||
if ( Parent is Mobile parent )
|
||||
{
|
||||
if ( Core.AOS )
|
||||
m_AosSkillBonuses.AddTo( parent );
|
||||
|
|
|
|||
|
|
@ -192,16 +192,16 @@ namespace Server.Items
|
|||
{
|
||||
base.OnAdded( parent );
|
||||
|
||||
if ( parent is Mobile )
|
||||
((Mobile)parent).VirtualArmorMod += 2;
|
||||
if ( parent is Mobile mobile )
|
||||
mobile.VirtualArmorMod += 2;
|
||||
}
|
||||
|
||||
public override void OnRemoved(IEntity parent)
|
||||
{
|
||||
base.OnRemoved( parent );
|
||||
|
||||
if ( parent is Mobile )
|
||||
((Mobile)parent).VirtualArmorMod -= 2;
|
||||
if ( parent is Mobile mobile )
|
||||
mobile.VirtualArmorMod -= 2;
|
||||
}
|
||||
|
||||
public override bool Dye( Mobile from, DyeTub sender )
|
||||
|
|
@ -275,8 +275,8 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
if ( Parent is Mobile )
|
||||
((Mobile)Parent).VirtualArmorMod += 2;
|
||||
if ( Parent is Mobile mobile )
|
||||
mobile.VirtualArmorMod += 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -732,8 +732,8 @@ namespace Server.Items
|
|||
{
|
||||
base.OnAdded( parent );
|
||||
|
||||
if ( parent is Mobile )
|
||||
Misc.Titles.AwardKarma( (Mobile)parent, -20, true );
|
||||
if ( parent is Mobile mobile )
|
||||
Misc.Titles.AwardKarma( mobile, -20, true );
|
||||
}
|
||||
|
||||
public OrcishKinMask( Serial serial ) : base( serial )
|
||||
|
|
|
|||
|
|
@ -269,16 +269,16 @@ namespace Server.Items
|
|||
{
|
||||
base.OnAdded( parent );
|
||||
|
||||
if ( parent is Mobile )
|
||||
((Mobile)parent).VirtualArmorMod += 2;
|
||||
if ( parent is Mobile mobile )
|
||||
mobile.VirtualArmorMod += 2;
|
||||
}
|
||||
|
||||
public override void OnRemoved(IEntity parent)
|
||||
{
|
||||
base.OnRemoved( parent );
|
||||
|
||||
if ( parent is Mobile )
|
||||
((Mobile)parent).VirtualArmorMod -= 2;
|
||||
if ( parent is Mobile mobile )
|
||||
mobile.VirtualArmorMod -= 2;
|
||||
}
|
||||
|
||||
public override bool Dye( Mobile from, DyeTub sender )
|
||||
|
|
@ -352,8 +352,8 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
if ( Parent is Mobile )
|
||||
((Mobile)Parent).VirtualArmorMod += 2;
|
||||
if ( Parent is Mobile mobile )
|
||||
mobile.VirtualArmorMod += 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -394,16 +394,16 @@ namespace Server.Items
|
|||
{
|
||||
base.OnAdded( parent );
|
||||
|
||||
if ( parent is Mobile )
|
||||
((Mobile)parent).VirtualArmorMod += 2;
|
||||
if ( parent is Mobile mobile )
|
||||
mobile.VirtualArmorMod += 2;
|
||||
}
|
||||
|
||||
public override void OnRemoved(IEntity parent)
|
||||
{
|
||||
base.OnRemoved( parent );
|
||||
|
||||
if ( parent is Mobile )
|
||||
((Mobile)parent).VirtualArmorMod -= 2;
|
||||
if ( parent is Mobile mobile )
|
||||
mobile.VirtualArmorMod -= 2;
|
||||
}
|
||||
|
||||
public override bool Dye( Mobile from, DyeTub sender )
|
||||
|
|
@ -477,8 +477,8 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
if ( Parent is Mobile )
|
||||
((Mobile)Parent).VirtualArmorMod += 2;
|
||||
if ( Parent is Mobile mobile )
|
||||
mobile.VirtualArmorMod += 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ namespace Server.Items
|
|||
|
||||
public static void GetContextMenuEntries( Mobile from, Item item, List<ContextMenuEntry> list )
|
||||
{
|
||||
if ( from is PlayerMobile )
|
||||
list.Add( new LockKarmaEntry( (PlayerMobile)from ) );
|
||||
if ( from is PlayerMobile mobile )
|
||||
list.Add( new LockKarmaEntry( mobile ) );
|
||||
|
||||
list.Add( new ResurrectEntry( from, item ) );
|
||||
|
||||
|
|
|
|||
|
|
@ -53,9 +53,7 @@ namespace Server.Items
|
|||
|
||||
private static void Link_OnFirstTarget( Mobile from, object targeted )
|
||||
{
|
||||
BaseDoor door = targeted as BaseDoor;
|
||||
|
||||
if ( door == null )
|
||||
if ( !(targeted is BaseDoor door) )
|
||||
{
|
||||
from.BeginTarget( -1, false, TargetFlags.None, new TargetCallback( Link_OnFirstTarget ) );
|
||||
from.SendMessage( "That is not a door. Try again." );
|
||||
|
|
@ -70,9 +68,8 @@ namespace Server.Items
|
|||
private static void Link_OnSecondTarget( Mobile from, object targeted, object state )
|
||||
{
|
||||
BaseDoor first = (BaseDoor)state;
|
||||
BaseDoor second = targeted as BaseDoor;
|
||||
|
||||
if ( second == null )
|
||||
if ( !(targeted is BaseDoor second) )
|
||||
{
|
||||
from.BeginTarget( -1, false, TargetFlags.None, new TargetStateCallback( Link_OnSecondTarget ), first );
|
||||
from.SendMessage( "That is not a door. Try again." );
|
||||
|
|
@ -95,9 +92,7 @@ namespace Server.Items
|
|||
|
||||
private static void ChainLink_OnTarget( Mobile from, object targeted, object state )
|
||||
{
|
||||
BaseDoor door = targeted as BaseDoor;
|
||||
|
||||
if ( door == null )
|
||||
if ( !(targeted is BaseDoor door) )
|
||||
{
|
||||
from.BeginTarget( -1, false, TargetFlags.None, new TargetStateCallback( ChainLink_OnTarget ), state );
|
||||
from.SendMessage( "That is not a door. Try again." );
|
||||
|
|
@ -586,4 +581,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,9 +61,9 @@ namespace Server.Items
|
|||
|
||||
BaseHouse house = BaseHouse.FindHouseAt( this );
|
||||
|
||||
if ( house != null && house.IsLockedDown( this ) )
|
||||
if ( house?.IsLockedDown( this ) == true )
|
||||
{
|
||||
if ( dropped is VendorRentalContract || ( dropped is Container && ((Container)dropped).FindItemByType( typeof( VendorRentalContract ) ) != null ) )
|
||||
if ( dropped is VendorRentalContract || ( dropped is Container container && container.FindItemByType( typeof( VendorRentalContract ) ) != null ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062492 ); // You cannot place a rental contract in a locked down container.
|
||||
return false;
|
||||
|
|
@ -95,9 +95,9 @@ namespace Server.Items
|
|||
|
||||
BaseHouse house = BaseHouse.FindHouseAt( this );
|
||||
|
||||
if ( house != null && house.IsLockedDown( this ) )
|
||||
if ( house?.IsLockedDown( this ) == true )
|
||||
{
|
||||
if ( item is VendorRentalContract || ( item is Container && ((Container)item).FindItemByType( typeof( VendorRentalContract ) ) != null ) )
|
||||
if ( item is VendorRentalContract || ( item is Container container && container.FindItemByType( typeof( VendorRentalContract ) ) != null ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062492 ); // You cannot place a rental contract in a locked down container.
|
||||
return false;
|
||||
|
|
@ -119,8 +119,8 @@ namespace Server.Items
|
|||
{
|
||||
base.UpdateTotal( sender, type, delta );
|
||||
|
||||
if ( type == TotalType.Weight && RootParent is Mobile )
|
||||
((Mobile) RootParent).InvalidateProperties();
|
||||
if ( type == TotalType.Weight )
|
||||
(RootParent as Mobile)?.InvalidateProperties();
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
|
|
@ -238,12 +238,7 @@ namespace Server.Items
|
|||
|
||||
public override bool CheckContentDisplay( Mobile from )
|
||||
{
|
||||
object root = this.RootParent;
|
||||
|
||||
if ( root is BaseCreature && ((BaseCreature)root).Controlled && ((BaseCreature)root).ControlMaster == from )
|
||||
return true;
|
||||
|
||||
return base.CheckContentDisplay( from );
|
||||
return RootParent is BaseCreature creature && creature.Controlled && creature.ControlMaster == from || base.CheckContentDisplay( from );
|
||||
}
|
||||
|
||||
public StrongBackpack( Serial serial ) : base( serial )
|
||||
|
|
@ -279,16 +274,10 @@ namespace Server.Items
|
|||
|
||||
public override int DefaultMaxWeight {
|
||||
get {
|
||||
if ( Core.ML ) {
|
||||
Mobile m = Parent as Mobile;
|
||||
if ( m != null && m.Player && m.Backpack == this ) {
|
||||
return 550;
|
||||
} else {
|
||||
return base.DefaultMaxWeight;
|
||||
}
|
||||
} else {
|
||||
return base.DefaultMaxWeight;
|
||||
}
|
||||
if ( Core.ML && Parent is Mobile m && m.Player && m.Backpack == this )
|
||||
return 550;
|
||||
|
||||
return base.DefaultMaxWeight;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -616,8 +616,8 @@ namespace Server.Items
|
|||
{
|
||||
Item item = Loot.Construct( m_Types );
|
||||
|
||||
if ( item is Key )
|
||||
( (Key)item ).ItemID = Utility.RandomList( (int)KeyType.Copper, (int)KeyType.Gold, (int)KeyType.Iron, (int)KeyType.Rusty );
|
||||
if ( item is Key key )
|
||||
key.ItemID = Utility.RandomList( (int)KeyType.Copper, (int)KeyType.Gold, (int)KeyType.Iron, (int)KeyType.Rusty );
|
||||
else if ( item is Arrow || item is Bolt )
|
||||
item.Amount = Utility.RandomMinMax( 2, 6 );
|
||||
else if ( item is Bandage || item is Lockpick )
|
||||
|
|
@ -662,10 +662,8 @@ namespace Server.Items
|
|||
{
|
||||
item = base.Construct();
|
||||
|
||||
if ( item is BaseBeverage )
|
||||
if ( item is BaseBeverage bev )
|
||||
{
|
||||
BaseBeverage bev = (BaseBeverage)item;
|
||||
|
||||
bev.Content = m_Content;
|
||||
bev.Quantity = bev.MaxQuantity;
|
||||
}
|
||||
|
|
@ -1514,9 +1512,7 @@ namespace Server.Items
|
|||
if ( nearest != null && mob.GetDistanceToSqrt( loc ) > nearest.GetDistanceToSqrt( loc ) && !( nearest is Cobbler && mob is Provisioner ) )
|
||||
continue;
|
||||
|
||||
FillableContent check = m_AcquireTable[ mob.GetType() ] as FillableContent;
|
||||
|
||||
if ( check != null )
|
||||
if ( m_AcquireTable[ mob.GetType() ] is FillableContent check )
|
||||
{
|
||||
nearest = mob;
|
||||
content = check;
|
||||
|
|
|
|||
|
|
@ -202,34 +202,24 @@ namespace Server.Items
|
|||
|
||||
public override bool OnDragDrop( Mobile from, Item dropped )
|
||||
{
|
||||
RecallRune rune = dropped as RecallRune;
|
||||
|
||||
if ( rune != null && base.OnDragDrop( from, dropped ) )
|
||||
if ( dropped is RecallRune rune && base.OnDragDrop( from, dropped ) )
|
||||
{
|
||||
Mark( rune );
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool OnDragDropInto( Mobile from, Item dropped, Point3D p )
|
||||
{
|
||||
RecallRune rune = dropped as RecallRune;
|
||||
|
||||
if ( rune != null && base.OnDragDropInto( from, dropped, p ) )
|
||||
if ( dropped is RecallRune rune && base.OnDragDropInto( from, dropped, p ) )
|
||||
{
|
||||
Mark( rune );
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
|
|
|
|||
|
|
@ -122,17 +122,11 @@ namespace Server.Items
|
|||
else
|
||||
item = Loot.RandomArmorOrShieldOrWeapon();
|
||||
|
||||
if ( item is BaseWeapon )
|
||||
if ( item is BaseWeapon weapon )
|
||||
{
|
||||
BaseWeapon weapon = (BaseWeapon)item;
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
int attributeCount;
|
||||
int min, max;
|
||||
|
||||
GetRandomAOSStats( out attributeCount, out min, out max );
|
||||
|
||||
GetRandomAOSStats( out var attributeCount, out var min, out var max );
|
||||
BaseRunicTool.ApplyAttributesTo( weapon, attributeCount, min, max );
|
||||
}
|
||||
else
|
||||
|
|
@ -142,19 +136,13 @@ namespace Server.Items
|
|||
weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random( 6 );
|
||||
}
|
||||
|
||||
DropItem( item );
|
||||
DropItem( weapon );
|
||||
}
|
||||
else if ( item is BaseArmor )
|
||||
else if ( item is BaseArmor armor )
|
||||
{
|
||||
BaseArmor armor = (BaseArmor)item;
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
int attributeCount;
|
||||
int min, max;
|
||||
|
||||
GetRandomAOSStats( out attributeCount, out min, out max );
|
||||
|
||||
GetRandomAOSStats( out var attributeCount, out var min, out var max );
|
||||
BaseRunicTool.ApplyAttributesTo( armor, attributeCount, min, max );
|
||||
}
|
||||
else
|
||||
|
|
@ -163,34 +151,24 @@ namespace Server.Items
|
|||
armor.Durability = (ArmorDurabilityLevel)Utility.Random( 6 );
|
||||
}
|
||||
|
||||
DropItem( item );
|
||||
DropItem( armor );
|
||||
}
|
||||
else if ( item is BaseHat )
|
||||
else if ( item is BaseHat hat )
|
||||
{
|
||||
BaseHat hat = (BaseHat)item;
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
int attributeCount;
|
||||
int min, max;
|
||||
|
||||
GetRandomAOSStats( out attributeCount, out min, out max );
|
||||
|
||||
GetRandomAOSStats( out var attributeCount, out var min, out var max );
|
||||
BaseRunicTool.ApplyAttributesTo( hat, attributeCount, min, max );
|
||||
}
|
||||
|
||||
DropItem( item );
|
||||
DropItem( hat );
|
||||
}
|
||||
else if ( item is BaseJewel )
|
||||
else if ( item is BaseJewel jewel )
|
||||
{
|
||||
int attributeCount;
|
||||
int min, max;
|
||||
GetRandomAOSStats( out var attributeCount, out var min, out var max );
|
||||
BaseRunicTool.ApplyAttributesTo( jewel, attributeCount, min, max );
|
||||
|
||||
GetRandomAOSStats( out attributeCount, out min, out max );
|
||||
|
||||
BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, attributeCount, min, max );
|
||||
|
||||
DropItem( item );
|
||||
DropItem( jewel );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,19 +45,14 @@ namespace Server.Items
|
|||
{
|
||||
foreach( Item i in Items )
|
||||
{
|
||||
if ( i != null && !i.Deleted )
|
||||
if (i?.Deleted != false)
|
||||
continue;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
if ( i is BaseWeapon )
|
||||
{
|
||||
if ( CraftResources.GetType( ( (BaseWeapon)i ).Resource ) == CraftResourceType.Metal )
|
||||
return true;
|
||||
}
|
||||
if ( i is BaseArmor )
|
||||
{
|
||||
if ( CraftResources.GetType( ( (BaseArmor)i ).Resource ) == CraftResourceType.Metal )
|
||||
return true;
|
||||
}
|
||||
if ( i is DragonBardingDeed )
|
||||
case BaseWeapon weapon when CraftResources.GetType( weapon.Resource ) == CraftResourceType.Metal:
|
||||
case BaseArmor armor when CraftResources.GetType( armor.Resource ) == CraftResourceType.Metal:
|
||||
case DragonBardingDeed _:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -68,20 +63,18 @@ namespace Server.Items
|
|||
{
|
||||
foreach( Item i in Items )
|
||||
{
|
||||
if ( i != null && !i.Deleted )
|
||||
if (!(i is IScissorable && !i.Deleted))
|
||||
continue;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
if ( i is IScissorable )
|
||||
{
|
||||
if ( i is BaseClothing )
|
||||
return true;
|
||||
if ( i is BaseArmor )
|
||||
{
|
||||
if ( CraftResources.GetType( ( (BaseArmor)i ).Resource ) == CraftResourceType.Leather )
|
||||
return true;
|
||||
}
|
||||
if ( ( i is Cloth ) || ( i is BoltOfCloth ) || ( i is Hides ) || ( i is BonePile ) )
|
||||
return true;
|
||||
}
|
||||
case BaseClothing _:
|
||||
case BaseArmor armor when CraftResources.GetType( armor.Resource ) == CraftResourceType.Leather:
|
||||
case Cloth _:
|
||||
case BoltOfCloth _:
|
||||
case Hides _:
|
||||
case BonePile _:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
@ -128,7 +121,7 @@ namespace Server.Items
|
|||
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 ) )
|
||||
{
|
||||
double mining = from.Skills[ SkillName.Mining ].Value;
|
||||
if ( mining > 100.0 )
|
||||
|
|
@ -176,7 +169,7 @@ namespace Server.Items
|
|||
bool ToolFound = false;
|
||||
foreach( Item tool in tools )
|
||||
{
|
||||
if ( tool is BaseTool && ( (BaseTool)tool ).CraftSystem == DefBlacksmithy.CraftSystem )
|
||||
if ( tool is BaseTool baseTool && baseTool.CraftSystem == DefBlacksmithy.CraftSystem )
|
||||
ToolFound = true;
|
||||
}
|
||||
|
||||
|
|
@ -186,8 +179,7 @@ namespace Server.Items
|
|||
return;
|
||||
}
|
||||
|
||||
bool anvil, forge;
|
||||
DefBlacksmithy.CheckAnvilAndForge( from, 2, out anvil, out forge );
|
||||
DefBlacksmithy.CheckAnvilAndForge( from, 2, out _, out var forge );
|
||||
|
||||
if ( !forge )
|
||||
{
|
||||
|
|
@ -204,31 +196,28 @@ namespace Server.Items
|
|||
|
||||
for(int i = Smeltables.Count - 1; i >= 0; i--)
|
||||
{
|
||||
Item item = Smeltables[ i ];
|
||||
|
||||
if ( item is BaseArmor )
|
||||
{
|
||||
if ( Resmelt( from, item, ( (BaseArmor)item ).Resource ) )
|
||||
salvaged++;
|
||||
else
|
||||
notSalvaged++;
|
||||
}
|
||||
else if ( item is BaseWeapon )
|
||||
{
|
||||
if ( Resmelt( from, item, ( (BaseWeapon)item ).Resource ) )
|
||||
salvaged++;
|
||||
else
|
||||
notSalvaged++;
|
||||
}
|
||||
else if ( item is DragonBardingDeed )
|
||||
{
|
||||
if ( Resmelt( from, item, ( (DragonBardingDeed)item ).Resource ) )
|
||||
salvaged++;
|
||||
|
||||
else
|
||||
notSalvaged++;
|
||||
}
|
||||
}
|
||||
switch (Smeltables[i])
|
||||
{
|
||||
case BaseArmor armor when Resmelt( from, armor, armor.Resource ):
|
||||
salvaged++;
|
||||
break;
|
||||
case BaseArmor _:
|
||||
notSalvaged++;
|
||||
break;
|
||||
case BaseWeapon weapon when Resmelt( from, weapon, weapon.Resource ):
|
||||
salvaged++;
|
||||
break;
|
||||
case BaseWeapon _:
|
||||
notSalvaged++;
|
||||
break;
|
||||
case DragonBardingDeed deed when Resmelt( from, deed, deed.Resource ):
|
||||
salvaged++;
|
||||
break;
|
||||
case DragonBardingDeed _:
|
||||
notSalvaged++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( m_Failure )
|
||||
{
|
||||
from.SendLocalizedMessage( 1079975 ); // You failed to smelt some metal for lack of skill.
|
||||
|
|
@ -240,8 +229,7 @@ namespace Server.Items
|
|||
|
||||
private void SalvageCloth( Mobile from )
|
||||
{
|
||||
Scissors scissors = from.Backpack.FindItemByType( typeof( Scissors ) ) as Scissors;
|
||||
if ( scissors == null )
|
||||
if ( !(from.Backpack.FindItemByType( typeof( Scissors ) ) is Scissors scissors) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1079823 ); // You need scissors in order to salvage cloth.
|
||||
return;
|
||||
|
|
@ -258,22 +246,18 @@ namespace Server.Items
|
|||
{
|
||||
Item item = scissorables[i];
|
||||
|
||||
if ( item is IScissorable )
|
||||
{
|
||||
IScissorable scissorable = (IScissorable)item;
|
||||
if (!(item is IScissorable scissorable))
|
||||
continue;
|
||||
|
||||
if ( Scissors.CanScissor( from, scissorable ) && scissorable.Scissor( from, scissors ) )
|
||||
++salvaged;
|
||||
else
|
||||
++notSalvaged;
|
||||
}
|
||||
if ( Scissors.CanScissor( from, scissorable ) && scissorable.Scissor( from, scissors ) )
|
||||
++salvaged;
|
||||
else
|
||||
++notSalvaged;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 1079974, String.Format( "{0}\t{1}", salvaged, salvaged + notSalvaged ) ); // Salvaged: ~1_COUNT~/~2_NUM~ tailored items
|
||||
|
||||
Container pack = from.Backpack;
|
||||
|
||||
foreach (Item i in ((Container)this).FindItemsByType(typeof(Item), true))
|
||||
foreach (Item i in this.FindItemsByType(typeof(Item), true))
|
||||
{
|
||||
if ( ( i is Leather ) || ( i is Cloth ) || ( i is SpinedLeather ) || ( i is HornedLeather ) || ( i is BarbedLeather ) || ( i is Bandage ) || ( i is Bone ) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -198,17 +198,11 @@ namespace Server.Items
|
|||
else
|
||||
item = Loot.RandomArmorOrShieldOrWeapon();
|
||||
|
||||
if ( item is BaseWeapon )
|
||||
if ( item is BaseWeapon weapon )
|
||||
{
|
||||
BaseWeapon weapon = (BaseWeapon)item;
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
int attributeCount;
|
||||
int min, max;
|
||||
|
||||
GetRandomAOSStats( out attributeCount, out min, out max );
|
||||
|
||||
GetRandomAOSStats( out var attributeCount, out var min, out var max );
|
||||
BaseRunicTool.ApplyAttributesTo( weapon, attributeCount, min, max );
|
||||
}
|
||||
else
|
||||
|
|
@ -218,19 +212,13 @@ namespace Server.Items
|
|||
weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random( 6 );
|
||||
}
|
||||
|
||||
cont.DropItem( item );
|
||||
cont.DropItem( weapon );
|
||||
}
|
||||
else if ( item is BaseArmor )
|
||||
else if ( item is BaseArmor armor )
|
||||
{
|
||||
BaseArmor armor = (BaseArmor)item;
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
int attributeCount;
|
||||
int min, max;
|
||||
|
||||
GetRandomAOSStats( out attributeCount, out min, out max );
|
||||
|
||||
GetRandomAOSStats( out var attributeCount, out var min, out var max );
|
||||
BaseRunicTool.ApplyAttributesTo( armor, attributeCount, min, max );
|
||||
}
|
||||
else
|
||||
|
|
@ -239,34 +227,24 @@ namespace Server.Items
|
|||
armor.Durability = (ArmorDurabilityLevel)Utility.Random( 6 );
|
||||
}
|
||||
|
||||
cont.DropItem( item );
|
||||
cont.DropItem( armor );
|
||||
}
|
||||
else if ( item is BaseHat )
|
||||
else if ( item is BaseHat hat )
|
||||
{
|
||||
BaseHat hat = (BaseHat)item;
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
int attributeCount;
|
||||
int min, max;
|
||||
|
||||
GetRandomAOSStats( out attributeCount, out min, out max );
|
||||
|
||||
GetRandomAOSStats( out var attributeCount, out var min, out var max );
|
||||
BaseRunicTool.ApplyAttributesTo( hat, attributeCount, min, max );
|
||||
}
|
||||
|
||||
cont.DropItem( item );
|
||||
cont.DropItem( hat );
|
||||
}
|
||||
else if ( item is BaseJewel )
|
||||
else if ( item is BaseJewel jewel )
|
||||
{
|
||||
int attributeCount;
|
||||
int min, max;
|
||||
GetRandomAOSStats( out var attributeCount, out var min, out var max );
|
||||
BaseRunicTool.ApplyAttributesTo( jewel, attributeCount, min, max );
|
||||
|
||||
GetRandomAOSStats( out attributeCount, out min, out max );
|
||||
|
||||
BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, attributeCount, min, max );
|
||||
|
||||
cont.DropItem( item );
|
||||
cont.DropItem( jewel );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 )
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -715,10 +715,8 @@ namespace Server.Items
|
|||
if ( !IsEmpty || !Fillable || !ValidateUse( from, false ) )
|
||||
return;
|
||||
|
||||
if ( targ is BaseBeverage )
|
||||
if ( targ is BaseBeverage bev )
|
||||
{
|
||||
BaseBeverage bev = (BaseBeverage)targ;
|
||||
|
||||
if ( bev.IsEmpty || !bev.ValidateUse( from, true ) )
|
||||
return;
|
||||
|
||||
|
|
@ -737,10 +735,8 @@ namespace Server.Items
|
|||
bev.Quantity = 0;
|
||||
}
|
||||
}
|
||||
else if ( targ is BaseWaterContainer )
|
||||
else if ( targ is BaseWaterContainer bwc )
|
||||
{
|
||||
BaseWaterContainer bwc = targ as BaseWaterContainer;
|
||||
|
||||
if ( Quantity == 0 || ( Content == BeverageType.Water && !IsFull ) )
|
||||
{
|
||||
int iNeed = Math.Min( ( MaxQuantity - Quantity ), bwc.Quantity );
|
||||
|
|
@ -755,15 +751,12 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
else if ( targ is Item )
|
||||
else if ( targ is Item item )
|
||||
{
|
||||
Item item = (Item)targ;
|
||||
IWaterSource src;
|
||||
IWaterSource src = ( item as IWaterSource );
|
||||
|
||||
src = ( item as IWaterSource );
|
||||
|
||||
if ( src == null && item is AddonComponent )
|
||||
src = ( ( (AddonComponent)item ).Addon as IWaterSource );
|
||||
if ( src == null && item is AddonComponent component )
|
||||
src = ( component.Addon as IWaterSource );
|
||||
|
||||
if ( src == null || src.Quantity <= 0 )
|
||||
return;
|
||||
|
|
@ -791,10 +784,8 @@ namespace Server.Items
|
|||
|
||||
from.SendLocalizedMessage( 1010089 ); // You fill the container with water.
|
||||
}
|
||||
else if ( targ is Cow )
|
||||
else if ( targ is Cow cow )
|
||||
{
|
||||
Cow cow = (Cow)targ;
|
||||
|
||||
if ( cow.TryMilk( from ) )
|
||||
{
|
||||
Content = BeverageType.Milk;
|
||||
|
|
@ -802,21 +793,17 @@ namespace Server.Items
|
|||
from.SendLocalizedMessage( 1080197 ); // You fill the container with milk.
|
||||
}
|
||||
}
|
||||
else if ( targ is LandTarget )
|
||||
else if ( targ is LandTarget target )
|
||||
{
|
||||
int tileID = ( (LandTarget)targ ).TileID;
|
||||
int tileID = target.TileID;
|
||||
|
||||
PlayerMobile player = from as PlayerMobile;
|
||||
|
||||
if ( player != null )
|
||||
if ( from is PlayerMobile player )
|
||||
{
|
||||
QuestSystem qs = player.Quest;
|
||||
|
||||
if ( qs is WitchApprenticeQuest )
|
||||
{
|
||||
FindIngredientObjective obj = qs.FindObjective( typeof( FindIngredientObjective ) ) as FindIngredientObjective;
|
||||
|
||||
if ( obj != null && !obj.Completed && obj.Ingredient == Ingredient.SwampWater )
|
||||
if ( qs.FindObjective( typeof( FindIngredientObjective ) ) is FindIngredientObjective obj && !obj.Completed && obj.Ingredient == Ingredient.SwampWater )
|
||||
{
|
||||
bool contains = false;
|
||||
|
||||
|
|
@ -956,10 +943,8 @@ namespace Server.Items
|
|||
if ( IsEmpty || !Pourable || !ValidateUse( from, false ) )
|
||||
return;
|
||||
|
||||
if ( targ is BaseBeverage )
|
||||
if ( targ is BaseBeverage bev )
|
||||
{
|
||||
BaseBeverage bev = (BaseBeverage)targ;
|
||||
|
||||
if ( !bev.ValidateUse( from, true ) )
|
||||
return;
|
||||
|
||||
|
|
@ -1023,10 +1008,8 @@ namespace Server.Items
|
|||
|
||||
--Quantity;
|
||||
}
|
||||
else if ( targ is BaseWaterContainer )
|
||||
else if ( targ is BaseWaterContainer bwc )
|
||||
{
|
||||
BaseWaterContainer bwc = targ as BaseWaterContainer;
|
||||
|
||||
if ( Content != BeverageType.Water )
|
||||
{
|
||||
from.SendLocalizedMessage( 500842 ); // Can't pour that in there.
|
||||
|
|
@ -1048,27 +1031,23 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
else if ( targ is PlantItem )
|
||||
else if ( targ is PlantItem item )
|
||||
{
|
||||
( (PlantItem)targ ).Pour( from, this );
|
||||
item.Pour( from, this );
|
||||
}
|
||||
else if ( targ is AddonComponent &&
|
||||
( ( (AddonComponent)targ ).Addon is WaterVatEast || ( (AddonComponent)targ ).Addon is WaterVatSouth ) &&
|
||||
else if ( targ is AddonComponent component &&
|
||||
( component.Addon is WaterVatEast || component.Addon is WaterVatSouth ) &&
|
||||
this.Content == BeverageType.Water )
|
||||
{
|
||||
PlayerMobile player = from as PlayerMobile;
|
||||
|
||||
if ( player != null )
|
||||
if ( from is PlayerMobile player )
|
||||
{
|
||||
SolenMatriarchQuest qs = player.Quest as SolenMatriarchQuest;
|
||||
|
||||
if ( qs != null )
|
||||
if ( player.Quest is SolenMatriarchQuest qs )
|
||||
{
|
||||
QuestObjective obj = qs.FindObjective( typeof( GatherWaterObjective ) );
|
||||
|
||||
if ( obj != null && !obj.Completed )
|
||||
{
|
||||
BaseAddon vat = ( (AddonComponent)targ ).Addon;
|
||||
BaseAddon vat = component.Addon;
|
||||
|
||||
if ( vat.X > 5784 && vat.X < 5814 && vat.Y > 1903 && vat.Y < 1934 &&
|
||||
( ( qs.RedSolen && vat.Map == Map.Trammel ) || ( !qs.RedSolen && vat.Map == Map.Felucca ) ) )
|
||||
|
|
@ -1127,9 +1106,7 @@ namespace Server.Items
|
|||
|
||||
for( int i = 0; i < items.Length; ++i )
|
||||
{
|
||||
BaseBeverage bev = items[ i ] as BaseBeverage;
|
||||
|
||||
if ( bev != null && bev.Content == content && !bev.IsEmpty )
|
||||
if ( items[i] is BaseBeverage bev && bev.Content == content && !bev.IsEmpty )
|
||||
total += bev.Quantity;
|
||||
}
|
||||
|
||||
|
|
@ -1141,9 +1118,7 @@ namespace Server.Items
|
|||
|
||||
for( int i = 0; i < items.Length; ++i )
|
||||
{
|
||||
BaseBeverage bev = items[ i ] as BaseBeverage;
|
||||
|
||||
if ( bev == null || bev.Content != content || bev.IsEmpty )
|
||||
if ( !(items[i] is BaseBeverage bev) || bev.Content != content || bev.IsEmpty )
|
||||
continue;
|
||||
|
||||
int theirQuantity = bev.Quantity;
|
||||
|
|
|
|||
|
|
@ -74,26 +74,26 @@ namespace Server.Items
|
|||
{
|
||||
int itemID;
|
||||
|
||||
if ( targeted is Item )
|
||||
itemID = ((Item)targeted).ItemID;
|
||||
else if ( targeted is StaticTarget )
|
||||
itemID = ((StaticTarget)targeted).ItemID;
|
||||
if ( targeted is Item item )
|
||||
itemID = item.ItemID;
|
||||
else if ( targeted is StaticTarget target )
|
||||
itemID = target.ItemID;
|
||||
else
|
||||
return false;
|
||||
|
||||
if ( itemID >= 0xDE3 && itemID <= 0xDE9 )
|
||||
return true; // Campfire
|
||||
else if ( itemID >= 0x461 && itemID <= 0x48E )
|
||||
if ( itemID >= 0x461 && itemID <= 0x48E )
|
||||
return true; // Sandstone oven/fireplace
|
||||
else if ( itemID >= 0x92B && itemID <= 0x96C )
|
||||
if ( itemID >= 0x92B && itemID <= 0x96C )
|
||||
return true; // Stone oven/fireplace
|
||||
else if ( itemID == 0xFAC )
|
||||
if ( itemID == 0xFAC )
|
||||
return true; // Firepit
|
||||
else if ( itemID >= 0x184A && itemID <= 0x184C )
|
||||
if ( itemID >= 0x184A && itemID <= 0x184C )
|
||||
return true; // Heating stand (left)
|
||||
else if ( itemID >= 0x184E && itemID <= 0x1850 )
|
||||
if ( itemID >= 0x184E && itemID <= 0x1850 )
|
||||
return true; // Heating stand (right)
|
||||
else if ( itemID >= 0x398C && itemID <= 0x399F )
|
||||
if ( itemID >= 0x398C && itemID <= 0x399F )
|
||||
return true; // Fire field
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@ namespace Server.Items
|
|||
{
|
||||
if ( m_Item.Deleted ) return;
|
||||
|
||||
Item targetItem = targeted as Item;
|
||||
if ( targetItem == null || targetItem.Deleted ) return;
|
||||
if ( !(targeted is Item targetItem) || targetItem.Deleted )
|
||||
return;
|
||||
|
||||
m_Item.Consume();
|
||||
|
||||
|
|
@ -171,16 +171,16 @@ namespace Server.Items
|
|||
|
||||
m_Item.Consume();
|
||||
|
||||
if ( targeted is BowlFlour )
|
||||
if ( targeted is BowlFlour flour )
|
||||
{
|
||||
((BowlFlour)targeted).Delete();
|
||||
flour.Delete();
|
||||
|
||||
from.AddToBackpack( new CakeMix() );
|
||||
}
|
||||
else if ( targeted is Campfire )
|
||||
else if ( targeted is Campfire campfire )
|
||||
{
|
||||
from.PlaySound( 0x225 );
|
||||
InternalTimer t = new InternalTimer( from, (Campfire)targeted );
|
||||
InternalTimer t = new InternalTimer( from, campfire );
|
||||
t.Start();
|
||||
}
|
||||
}
|
||||
|
|
@ -270,16 +270,16 @@ namespace Server.Items
|
|||
|
||||
m_Item.Consume();
|
||||
|
||||
if ( targeted is Dough )
|
||||
if ( targeted is Dough dough )
|
||||
{
|
||||
((Dough)targeted).Consume();
|
||||
dough.Consume();
|
||||
|
||||
from.AddToBackpack( new SweetDough() );
|
||||
}
|
||||
|
||||
if (targeted is BowlFlour)
|
||||
if (targeted is BowlFlour flour)
|
||||
{
|
||||
((BowlFlour)targeted).Delete();
|
||||
flour.Delete();
|
||||
|
||||
from.AddToBackpack( new CookieMix() );
|
||||
}
|
||||
|
|
@ -618,12 +618,10 @@ namespace Server.Items
|
|||
|
||||
public virtual void OnTarget( Mobile from, object obj )
|
||||
{
|
||||
if ( obj is AddonComponent )
|
||||
obj = (obj as AddonComponent).Addon;
|
||||
if ( obj is AddonComponent addon )
|
||||
obj = addon.Addon;
|
||||
|
||||
IFlourMill mill = obj as IFlourMill;
|
||||
|
||||
if ( mill != null )
|
||||
if ( obj is IFlourMill mill )
|
||||
{
|
||||
int needs = mill.MaxFlour - mill.CurFlour;
|
||||
|
||||
|
|
|
|||
|
|
@ -79,16 +79,12 @@ namespace Server.Items
|
|||
|
||||
public override bool OnDragDrop( Mobile from, Item dropped )
|
||||
{
|
||||
BasePiece piece = dropped as BasePiece;
|
||||
|
||||
return ( piece != null && piece.Board == this && base.OnDragDrop( from, dropped ) );
|
||||
return ( dropped is BasePiece piece && piece.Board == this && base.OnDragDrop( from, dropped ) );
|
||||
}
|
||||
|
||||
public override bool OnDragDropInto( Mobile from, Item dropped, Point3D point )
|
||||
{
|
||||
BasePiece piece = dropped as BasePiece;
|
||||
|
||||
if ( piece != null && piece.Board == this && base.OnDragDropInto( from, dropped, point ) )
|
||||
if ( dropped is BasePiece piece && piece.Board == this && base.OnDragDropInto( from, dropped, point ) )
|
||||
{
|
||||
Packet p = new PlaySound( 0x127, GetWorldLocation() );
|
||||
|
||||
|
|
@ -108,10 +104,8 @@ namespace Server.Items
|
|||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
|
||||
|
|
|
|||
|
|
@ -413,9 +413,7 @@ namespace Server.Items
|
|||
|
||||
public void Placement_OnTarget( Mobile from, object targeted, object state )
|
||||
{
|
||||
IPoint3D p = targeted as IPoint3D;
|
||||
|
||||
if ( p == null || Deleted )
|
||||
if ( !(targeted is IPoint3D p) || Deleted )
|
||||
return;
|
||||
|
||||
Point3D loc = new Point3D( p );
|
||||
|
|
|
|||
|
|
@ -116,9 +116,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnAfterDuped( Item newItem )
|
||||
{
|
||||
BaseJewel jewel = newItem as BaseJewel;
|
||||
|
||||
if ( jewel == null )
|
||||
if ( !(newItem is BaseJewel jewel) )
|
||||
return;
|
||||
|
||||
jewel.m_AosAttributes = new AosAttributes( newItem, m_AosAttributes );
|
||||
|
|
@ -143,10 +141,8 @@ namespace Server.Items
|
|||
|
||||
public override void OnAdded(IEntity parent)
|
||||
{
|
||||
if ( Core.AOS && parent is Mobile )
|
||||
if ( Core.AOS && parent is Mobile from )
|
||||
{
|
||||
Mobile from = (Mobile)parent;
|
||||
|
||||
m_AosSkillBonuses.AddTo( from );
|
||||
|
||||
int strBonus = m_AosAttributes.BonusStr;
|
||||
|
|
@ -173,19 +169,17 @@ namespace Server.Items
|
|||
|
||||
public override void OnRemoved(IEntity parent)
|
||||
{
|
||||
if ( Core.AOS && parent is Mobile )
|
||||
if ( Core.AOS && parent is Mobile @from )
|
||||
{
|
||||
Mobile from = (Mobile)parent;
|
||||
|
||||
m_AosSkillBonuses.Remove();
|
||||
|
||||
string modName = this.Serial.ToString();
|
||||
|
||||
from.RemoveStatMod( modName + "Str" );
|
||||
from.RemoveStatMod( modName + "Dex" );
|
||||
from.RemoveStatMod( modName + "Int" );
|
||||
@from.RemoveStatMod( modName + "Str" );
|
||||
@from.RemoveStatMod( modName + "Dex" );
|
||||
@from.RemoveStatMod( modName + "Int" );
|
||||
|
||||
from.CheckStatTimers();
|
||||
@from.CheckStatTimers();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -327,17 +321,17 @@ namespace Server.Items
|
|||
m_AosResistances = new AosElementAttributes( this, reader );
|
||||
m_AosSkillBonuses = new AosSkillBonuses( this, reader );
|
||||
|
||||
if ( Core.AOS && Parent is Mobile )
|
||||
m_AosSkillBonuses.AddTo( (Mobile)Parent );
|
||||
Mobile m = Parent as Mobile;
|
||||
|
||||
if ( Core.AOS && m != null )
|
||||
m_AosSkillBonuses.AddTo( m );
|
||||
|
||||
int strBonus = m_AosAttributes.BonusStr;
|
||||
int dexBonus = m_AosAttributes.BonusDex;
|
||||
int intBonus = m_AosAttributes.BonusInt;
|
||||
|
||||
if ( Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
|
||||
if ( m != null && (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
|
||||
{
|
||||
Mobile m = (Mobile)Parent;
|
||||
|
||||
string modName = Serial.ToString();
|
||||
|
||||
if ( strBonus != 0 )
|
||||
|
|
@ -350,8 +344,7 @@ namespace Server.Items
|
|||
m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) );
|
||||
}
|
||||
|
||||
if ( Parent is Mobile )
|
||||
((Mobile)Parent).CheckStatTimers();
|
||||
m?.CheckStatTimers();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,10 +17,8 @@ namespace Server.Items
|
|||
|
||||
public override void Ignite()
|
||||
{
|
||||
if ( !(Parent is Mobile) && RootParent is Mobile )
|
||||
if ( !(Parent is Mobile) && RootParent is Mobile holder )
|
||||
{
|
||||
Mobile holder = (Mobile)RootParent;
|
||||
|
||||
if ( holder.EquipItem( this ) )
|
||||
{
|
||||
if ( this is Candle )
|
||||
|
|
@ -61,4 +59,4 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,16 +28,16 @@ namespace Server.Items
|
|||
{
|
||||
base.OnAdded( parent );
|
||||
|
||||
if ( parent is Mobile && Burning )
|
||||
Mobiles.MeerMage.StopEffect( (Mobile)parent, true );
|
||||
if ( parent is Mobile mobile && Burning )
|
||||
Mobiles.MeerMage.StopEffect( mobile, true );
|
||||
}
|
||||
|
||||
public override void Ignite()
|
||||
{
|
||||
base.Ignite();
|
||||
|
||||
if ( Parent is Mobile && Burning )
|
||||
Mobiles.MeerMage.StopEffect( (Mobile)Parent, true );
|
||||
if ( Parent is Mobile mobile && Burning )
|
||||
Mobiles.MeerMage.StopEffect( mobile, true );
|
||||
}
|
||||
|
||||
public Torch( Serial serial ) : base( serial )
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ namespace Server.Items
|
|||
writer.Write( m_Height );
|
||||
|
||||
writer.Write( m_Protected );
|
||||
|
||||
|
||||
writer.Write( m_Pins.Count );
|
||||
for ( int i = 0; i < m_Pins.Count; ++i )
|
||||
writer.Write( m_Pins[i] );
|
||||
|
|
@ -303,9 +303,8 @@ namespace Server.Items
|
|||
private static void OnMapCommand( NetState state, PacketReader pvSrc )
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
MapItem map = World.FindItem( pvSrc.ReadInt32() ) as MapItem;
|
||||
|
||||
if ( map == null )
|
||||
if ( !(World.FindItem( pvSrc.ReadInt32() ) is MapItem map) )
|
||||
return;
|
||||
|
||||
int command = pvSrc.ReadByte();
|
||||
|
|
@ -366,7 +365,7 @@ namespace Server.Items
|
|||
m_Stream.Write( (byte) command );
|
||||
m_Stream.Write( (byte) number );
|
||||
m_Stream.Write( (short) x );
|
||||
m_Stream.Write( (short) y );
|
||||
m_Stream.Write( (short) y );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -400,4 +399,4 @@ namespace Server.Items
|
|||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -342,11 +342,7 @@ namespace Server.Items
|
|||
{
|
||||
IPoint3D p = targeted as IPoint3D;
|
||||
|
||||
Point3D targ3D;
|
||||
if ( p is Item )
|
||||
targ3D = ((Item)p).GetWorldLocation();
|
||||
else
|
||||
targ3D = new Point3D( p );
|
||||
Point3D targ3D = (p as Item)?.GetWorldLocation() ?? new Point3D(p);
|
||||
|
||||
int maxRange;
|
||||
double skillValue = from.Skills[SkillName.Mining].Value;
|
||||
|
|
@ -621,7 +617,7 @@ namespace Server.Items
|
|||
if ( from.AccessLevel >= AccessLevel.GameMaster )
|
||||
return true;
|
||||
|
||||
if ( from is PlayerMobile && ((PlayerMobile)from).Young )
|
||||
if ( @from is PlayerMobile mobile && mobile.Young )
|
||||
return true;
|
||||
|
||||
if ( from == this.Decoder )
|
||||
|
|
@ -935,4 +931,4 @@ namespace Server.Items
|
|||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,8 +60,7 @@ namespace Server.Items
|
|||
|
||||
foreach( Mobile m in GetMobilesInRange( 0 ) )
|
||||
{
|
||||
BaseCreature bc = m as BaseCreature;
|
||||
if ( m.Alive && !m.IsDeadBondedPet && (bc == null || bc.Controlled || bc.Summoned) )
|
||||
if ( m.Alive && !m.IsDeadBondedPet && (!(m is BaseCreature bc) || bc.Controlled || bc.Summoned) )
|
||||
{
|
||||
toDamage.Add( m );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,31 +59,35 @@ namespace Server.Items
|
|||
return;
|
||||
}
|
||||
|
||||
if ( obj is IArcaneEquip && obj is Item )
|
||||
if ( obj is IArcaneEquip eq && eq is Item item )
|
||||
{
|
||||
Item item = (Item)obj;
|
||||
CraftResource resource = CraftResource.None;
|
||||
|
||||
if ( item is BaseClothing )
|
||||
resource = ((BaseClothing)item).Resource;
|
||||
else if ( item is BaseArmor )
|
||||
resource = ((BaseArmor)item).Resource;
|
||||
else if ( item is BaseWeapon ) // Sanity, weapons cannot receive gems...
|
||||
resource = ((BaseWeapon)item).Resource;
|
||||
|
||||
IArcaneEquip eq = (IArcaneEquip)obj;
|
||||
switch (item)
|
||||
{
|
||||
case BaseClothing clothing:
|
||||
resource = clothing.Resource;
|
||||
break;
|
||||
case BaseArmor armor:
|
||||
resource = armor.Resource;
|
||||
break;
|
||||
// Sanity, weapons cannot receive gems...
|
||||
case BaseWeapon weapon:
|
||||
resource = weapon.Resource;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !item.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
return;
|
||||
}
|
||||
else if ( item.LootType == LootType.Blessed )
|
||||
if ( item.LootType == LootType.Blessed )
|
||||
{
|
||||
from.SendMessage( "You can only use this on exceptionally crafted robes, thigh boots, cloaks, or leather gloves." );
|
||||
return;
|
||||
}
|
||||
else if ( resource != CraftResource.None && resource != CraftResource.RegularLeather )
|
||||
if ( resource != CraftResource.None && resource != CraftResource.RegularLeather )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049690 ); // Arcane gems can not be used on that type of leather.
|
||||
return;
|
||||
|
|
@ -117,30 +121,37 @@ namespace Server.Items
|
|||
{
|
||||
bool isExceptional = false;
|
||||
|
||||
if ( item is BaseClothing )
|
||||
isExceptional = ( ((BaseClothing)item).Quality == ClothingQuality.Exceptional );
|
||||
else if ( item is BaseArmor )
|
||||
isExceptional = ( ((BaseArmor)item).Quality == ArmorQuality.Exceptional );
|
||||
else if ( item is BaseWeapon )
|
||||
isExceptional = ( ((BaseWeapon)item).Quality == WeaponQuality.Exceptional );
|
||||
switch (item)
|
||||
{
|
||||
case BaseClothing clothing:
|
||||
isExceptional = clothing.Quality == ClothingQuality.Exceptional;
|
||||
break;
|
||||
case BaseArmor armor:
|
||||
isExceptional = armor.Quality == ArmorQuality.Exceptional;
|
||||
break;
|
||||
case BaseWeapon weapon:
|
||||
isExceptional = weapon.Quality == WeaponQuality.Exceptional;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( isExceptional )
|
||||
{
|
||||
if ( item is BaseClothing )
|
||||
switch (item)
|
||||
{
|
||||
((BaseClothing)item).Quality = ClothingQuality.Regular;
|
||||
((BaseClothing)item).Crafter = from;
|
||||
}
|
||||
else if ( item is BaseArmor )
|
||||
{
|
||||
((BaseArmor)item).Quality = ArmorQuality.Regular;
|
||||
((BaseArmor)item).Crafter = from;
|
||||
((BaseArmor)item).PhysicalBonus = ((BaseArmor)item).FireBonus = ((BaseArmor)item).ColdBonus = ((BaseArmor)item).PoisonBonus = ((BaseArmor)item).EnergyBonus = 0; // Is there a method to remove bonuses?
|
||||
}
|
||||
else if ( item is BaseWeapon ) // Sanity, weapons cannot receive gems...
|
||||
{
|
||||
((BaseWeapon)item).Quality = WeaponQuality.Regular;
|
||||
((BaseWeapon)item).Crafter = from;
|
||||
case BaseClothing clothing:
|
||||
clothing.Quality = ClothingQuality.Regular;
|
||||
clothing.Crafter = @from;
|
||||
break;
|
||||
case BaseArmor armor:
|
||||
armor.Quality = ArmorQuality.Regular;
|
||||
armor.Crafter = @from;
|
||||
armor.PhysicalBonus = armor.FireBonus = armor.ColdBonus = armor.PoisonBonus = armor.EnergyBonus = 0; // Is there a method to remove bonuses?
|
||||
break;
|
||||
// Sanity, weapons cannot receive gems...
|
||||
case BaseWeapon weapon:
|
||||
weapon.Quality = WeaponQuality.Regular;
|
||||
weapon.Crafter = @from;
|
||||
break;
|
||||
}
|
||||
|
||||
eq.CurArcaneCharges = eq.MaxArcaneCharges = charges;
|
||||
|
|
@ -177,13 +188,8 @@ namespace Server.Items
|
|||
{
|
||||
Item obj = items[i];
|
||||
|
||||
if ( obj is IArcaneEquip )
|
||||
{
|
||||
IArcaneEquip eq = (IArcaneEquip)obj;
|
||||
|
||||
if ( eq.IsArcane )
|
||||
avail += eq.CurArcaneCharges;
|
||||
}
|
||||
if ( obj is IArcaneEquip eq && eq.IsArcane )
|
||||
avail += eq.CurArcaneCharges;
|
||||
}
|
||||
|
||||
if ( avail < amount )
|
||||
|
|
@ -193,23 +199,16 @@ namespace Server.Items
|
|||
{
|
||||
Item obj = items[i];
|
||||
|
||||
if ( obj is IArcaneEquip )
|
||||
if ( obj is IArcaneEquip eq && eq.IsArcane )
|
||||
{
|
||||
IArcaneEquip eq = (IArcaneEquip)obj;
|
||||
|
||||
if ( eq.IsArcane )
|
||||
if ( eq.CurArcaneCharges > amount )
|
||||
{
|
||||
if ( eq.CurArcaneCharges > amount )
|
||||
{
|
||||
eq.CurArcaneCharges -= amount;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
amount -= eq.CurArcaneCharges;
|
||||
eq.CurArcaneCharges = 0;
|
||||
}
|
||||
eq.CurArcaneCharges -= amount;
|
||||
break;
|
||||
}
|
||||
|
||||
amount -= eq.CurArcaneCharges;
|
||||
eq.CurArcaneCharges = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,17 +98,15 @@ namespace Server.Items
|
|||
|
||||
Container root = parent as Container;
|
||||
|
||||
while (root != null && root.Parent is Container)
|
||||
while (root?.Parent is Container)
|
||||
{
|
||||
root = (Container)root.Parent;
|
||||
}
|
||||
|
||||
parent = root ?? parent;
|
||||
|
||||
if (parent is SecureTradeContainer && AccountGold.ConvertOnTrade)
|
||||
if (parent is SecureTradeContainer trade && AccountGold.ConvertOnTrade)
|
||||
{
|
||||
var trade = (SecureTradeContainer)parent;
|
||||
|
||||
if (trade.Trade.From.Container == trade)
|
||||
{
|
||||
tradeInfo = trade.Trade.From;
|
||||
|
|
@ -120,12 +118,12 @@ namespace Server.Items
|
|||
owner = tradeInfo.Mobile;
|
||||
}
|
||||
}
|
||||
else if (parent is BankBox && AccountGold.ConvertOnBank)
|
||||
else if (parent is BankBox box && AccountGold.ConvertOnBank)
|
||||
{
|
||||
owner = ((BankBox)parent).Owner;
|
||||
owner = box.Owner;
|
||||
}
|
||||
|
||||
if (owner == null || owner.Account == null || !owner.Account.DepositGold(Worth))
|
||||
if (owner?.Account == null || !owner.Account.DepositGold(Worth))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -134,17 +132,13 @@ namespace Server.Items
|
|||
{
|
||||
if (owner.NetState != null && !owner.NetState.NewSecureTrading)
|
||||
{
|
||||
int gold;
|
||||
int plat = Math.DivRem(Worth, AccountGold.CurrencyThreshold, out gold);
|
||||
int plat = Math.DivRem(Worth, AccountGold.CurrencyThreshold, out var gold);
|
||||
|
||||
tradeInfo.Plat += plat;
|
||||
tradeInfo.Gold += gold;
|
||||
}
|
||||
|
||||
if (tradeInfo.VirtualCheck != null)
|
||||
{
|
||||
tradeInfo.VirtualCheck.UpdateTrade(tradeInfo.Mobile);
|
||||
}
|
||||
tradeInfo.VirtualCheck?.UpdateTrade(tradeInfo.Mobile);
|
||||
}
|
||||
|
||||
owner.SendLocalizedMessage(1042763, Worth.ToString("#,0"));
|
||||
|
|
@ -239,9 +233,7 @@ namespace Server.Items
|
|||
// Gold was deposited in your account:
|
||||
from.SendLocalizedMessage(1042672, true, deposited.ToString("#,0"));
|
||||
|
||||
var pm = from as PlayerMobile;
|
||||
|
||||
if (pm != null)
|
||||
if (@from is PlayerMobile pm)
|
||||
{
|
||||
var qs = pm.Quest;
|
||||
|
||||
|
|
|
|||
|
|
@ -80,23 +80,23 @@ namespace Server.Items
|
|||
if ( mt != null && !( to is ChaosDragoon || to is ChaosDragoonElite ) )
|
||||
mt.Rider = null;
|
||||
|
||||
if (to is PlayerMobile)
|
||||
if (to is PlayerMobile mobile)
|
||||
{
|
||||
if (Server.Spells.Ninjitsu.AnimalForm.UnderTransformation(to))
|
||||
if (Server.Spells.Ninjitsu.AnimalForm.UnderTransformation(mobile))
|
||||
{
|
||||
to.SendLocalizedMessage(1114066, from.Name); // ~1_NAME~ knocked you out of animal form!
|
||||
mobile.SendLocalizedMessage(1114066, from.Name); // ~1_NAME~ knocked you out of animal form!
|
||||
}
|
||||
else if (to.Mounted)
|
||||
else if (mobile.Mounted)
|
||||
{
|
||||
to.SendLocalizedMessage(1040023); // You have been knocked off of your mount!
|
||||
mobile.SendLocalizedMessage(1040023); // You have been knocked off of your mount!
|
||||
}
|
||||
|
||||
(to as PlayerMobile).SetMountBlock(BlockMountType.Dazed, TimeSpan.FromSeconds( Core.ML ? 10 : 3 ), true);
|
||||
mobile.SetMountBlock(BlockMountType.Dazed, TimeSpan.FromSeconds( Core.ML ? 10 : 3 ), true);
|
||||
}
|
||||
|
||||
if (Core.AOS && from is PlayerMobile) /* only failsafe, attacker should already be dismounted */
|
||||
if (Core.AOS) /* only failsafe, attacker should already be dismounted */
|
||||
{
|
||||
(from as PlayerMobile).SetMountBlock( BlockMountType.BolaRecovery, TimeSpan.FromSeconds( Core.ML ? 10 : 3 ), true );
|
||||
(from as PlayerMobile)?.SetMountBlock( BlockMountType.BolaRecovery, TimeSpan.FromSeconds( Core.ML ? 10 : 3 ), true );
|
||||
}
|
||||
|
||||
to.Damage(1);
|
||||
|
|
@ -160,10 +160,8 @@ namespace Server.Items
|
|||
if ( m_Bola.Deleted )
|
||||
return;
|
||||
|
||||
if ( obj is Mobile )
|
||||
if ( obj is Mobile to )
|
||||
{
|
||||
Mobile to = (Mobile)obj;
|
||||
|
||||
if ( !m_Bola.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1040019 ); // The bola must be in your pack to use it.
|
||||
|
|
@ -231,4 +229,4 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,9 +88,7 @@ namespace Server.Items
|
|||
if ( i >= items.Count )
|
||||
continue;
|
||||
|
||||
BulletinMessage msg = items[i] as BulletinMessage;
|
||||
|
||||
if ( msg == null )
|
||||
if ( !(items[i] is BulletinMessage msg) )
|
||||
continue;
|
||||
|
||||
if ( msg.Thread == null && CheckTime( msg.LastPostTime, ThreadDeletionTime ) )
|
||||
|
|
@ -111,9 +109,7 @@ namespace Server.Items
|
|||
if ( i >= items.Count )
|
||||
continue;
|
||||
|
||||
BulletinMessage check = items[i] as BulletinMessage;
|
||||
|
||||
if ( check == null )
|
||||
if ( !(items[i] is BulletinMessage check) )
|
||||
continue;
|
||||
|
||||
if ( check.Thread == msg )
|
||||
|
|
@ -134,9 +130,7 @@ namespace Server.Items
|
|||
|
||||
for ( int i = 0; i < items.Count; ++i )
|
||||
{
|
||||
BulletinMessage msg = items[i] as BulletinMessage;
|
||||
|
||||
if ( msg == null || msg.Poster != poster )
|
||||
if ( !(items[i] is BulletinMessage msg) || msg.Poster != poster )
|
||||
continue;
|
||||
|
||||
if ( onlyCheckRoot && msg.Thread != null )
|
||||
|
|
@ -227,9 +221,8 @@ namespace Server.Items
|
|||
Mobile from = state.Mobile;
|
||||
|
||||
int packetID = pvSrc.ReadByte();
|
||||
BaseBulletinBoard board = World.FindItem( pvSrc.ReadInt32() ) as BaseBulletinBoard;
|
||||
|
||||
if ( board == null || !board.CheckRange( from ) )
|
||||
if ( !(World.FindItem( pvSrc.ReadInt32() ) is BaseBulletinBoard board) || !board.CheckRange( from ) )
|
||||
return;
|
||||
|
||||
switch ( packetID )
|
||||
|
|
@ -243,9 +236,7 @@ namespace Server.Items
|
|||
|
||||
public static void BBRequestContent( Mobile from, BaseBulletinBoard board, PacketReader pvSrc )
|
||||
{
|
||||
BulletinMessage msg = World.FindItem( pvSrc.ReadInt32() ) as BulletinMessage;
|
||||
|
||||
if ( msg == null || msg.Parent != board )
|
||||
if ( !(World.FindItem( pvSrc.ReadInt32() ) is BulletinMessage msg) || msg.Parent != board )
|
||||
return;
|
||||
|
||||
from.Send( new BBMessageContent( board, msg ) );
|
||||
|
|
@ -253,9 +244,7 @@ namespace Server.Items
|
|||
|
||||
public static void BBRequestHeader( Mobile from, BaseBulletinBoard board, PacketReader pvSrc )
|
||||
{
|
||||
BulletinMessage msg = World.FindItem( pvSrc.ReadInt32() ) as BulletinMessage;
|
||||
|
||||
if ( msg == null || msg.Parent != board )
|
||||
if ( !(World.FindItem( pvSrc.ReadInt32() ) is BulletinMessage msg) || msg.Parent != board )
|
||||
return;
|
||||
|
||||
from.Send( new BBMessageHeader( board, msg ) );
|
||||
|
|
@ -270,7 +259,7 @@ namespace Server.Items
|
|||
|
||||
int breakout = 0;
|
||||
|
||||
while ( thread != null && thread.Thread != null && breakout++ < 10 )
|
||||
while ( thread?.Thread != null && breakout++ < 10 )
|
||||
thread = thread.Thread;
|
||||
|
||||
DateTime lastPostTime = DateTime.MinValue;
|
||||
|
|
@ -306,9 +295,7 @@ namespace Server.Items
|
|||
|
||||
public static void BBRemoveMessage( Mobile from, BaseBulletinBoard board, PacketReader pvSrc )
|
||||
{
|
||||
BulletinMessage msg = World.FindItem( pvSrc.ReadInt32() ) as BulletinMessage;
|
||||
|
||||
if ( msg == null || msg.Parent != board )
|
||||
if ( !(World.FindItem( pvSrc.ReadInt32() ) is BulletinMessage msg) || msg.Parent != board )
|
||||
return;
|
||||
|
||||
if ( from.AccessLevel < AccessLevel.GameMaster && msg.Poster != from )
|
||||
|
|
@ -476,7 +463,7 @@ namespace Server.Items
|
|||
|
||||
public void Validate()
|
||||
{
|
||||
if ( !( Parent is BulletinBoard && ((BulletinBoard)Parent).Items.Contains( this ) ) )
|
||||
if ( (Parent as BulletinBoard)?.Items.Contains( this ) == false )
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
|
|
@ -637,4 +624,4 @@ namespace Server.Items
|
|||
return v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -210,10 +210,8 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
else if ( targeted is ReceiverCrystal )
|
||||
else if ( targeted is ReceiverCrystal receiver )
|
||||
{
|
||||
ReceiverCrystal receiver = (ReceiverCrystal) targeted;
|
||||
|
||||
if ( m_Crystal.Receivers.Count >= 10 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1010042 ); // This broadcast crystal is already linked to 10 receivers.
|
||||
|
|
@ -234,18 +232,16 @@ namespace Server.Items
|
|||
}
|
||||
else if ( targeted == from )
|
||||
{
|
||||
foreach( ReceiverCrystal receiver in new List<ReceiverCrystal>( m_Crystal.Receivers ) )
|
||||
foreach( ReceiverCrystal rc in new List<ReceiverCrystal>( m_Crystal.Receivers ) )
|
||||
{
|
||||
receiver.Sender = null;
|
||||
rc.Sender = null;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 1010046 ); // You unlink the broadcast crystal from all of its receivers.
|
||||
}
|
||||
else
|
||||
{
|
||||
Item targItem = targeted as Item;
|
||||
|
||||
if ( targItem != null && targItem.VerifyMove( from ) )
|
||||
if ( targeted is Item targItem && targItem.VerifyMove( from ) )
|
||||
{
|
||||
CrystalRechargeInfo info = CrystalRechargeInfo.Get( targItem.GetType() );
|
||||
|
||||
|
|
@ -373,13 +369,13 @@ namespace Server.Items
|
|||
|
||||
string text = String.Format( "{0} says {1}", from.Name, message );
|
||||
|
||||
if ( this.RootParent is Mobile )
|
||||
if ( this.RootParent is Mobile mobile )
|
||||
{
|
||||
((Mobile)this.RootParent).SendMessage( 0x2B2, "Crystal: " + text );
|
||||
mobile.SendMessage( 0x2B2, "Crystal: " + text );
|
||||
}
|
||||
else if ( this.RootParent is Item )
|
||||
else if ( this.RootParent is Item item )
|
||||
{
|
||||
((Item)this.RootParent).PublicOverheadMessage( MessageType.Regular, 0x2B2, false, "Crystal: " + text );
|
||||
item.PublicOverheadMessage( MessageType.Regular, 0x2B2, false, "Crystal: " + text );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -445,9 +441,7 @@ namespace Server.Items
|
|||
}
|
||||
else
|
||||
{
|
||||
Item targItem = targeted as Item;
|
||||
|
||||
if ( targItem != null && targItem.VerifyMove( from ) )
|
||||
if ( targeted is Item targItem && targItem.VerifyMove( from ) )
|
||||
{
|
||||
CrystalRechargeInfo info = CrystalRechargeInfo.Get( targItem.GetType() );
|
||||
|
||||
|
|
|
|||
|
|
@ -436,13 +436,7 @@ namespace Server.Items
|
|||
|
||||
public static string GetCorpseName( Mobile m )
|
||||
{
|
||||
if ( m is BaseCreature )
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)m;
|
||||
return bc.CorpseNameOverride ?? bc.CorpseName;
|
||||
}
|
||||
|
||||
return null;
|
||||
return m is BaseCreature bc ? bc.CorpseNameOverride ?? bc.CorpseName : null;
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
|
|
@ -484,13 +478,8 @@ namespace Server.Items
|
|||
{
|
||||
c.AssignInstancedLoot();
|
||||
}
|
||||
else if ( Core.AOS )
|
||||
{
|
||||
PlayerMobile pm = owner as PlayerMobile;
|
||||
|
||||
if ( pm != null )
|
||||
c.RestoreEquip = pm.EquipSnapshot;
|
||||
}
|
||||
else if ( Core.AOS && owner is PlayerMobile pm )
|
||||
c.RestoreEquip = pm.EquipSnapshot;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -945,9 +934,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnClick()
|
||||
{
|
||||
Corpse corpse = Owner.Target as Corpse;
|
||||
|
||||
if ( corpse != null && Owner.From.CheckAlive() )
|
||||
if ( Owner.Target is Corpse corpse && Owner.From.CheckAlive() )
|
||||
corpse.Open( Owner.From, false );
|
||||
}
|
||||
}
|
||||
|
|
@ -1034,9 +1021,7 @@ namespace Server.Items
|
|||
#region Self Looting
|
||||
if ( checkSelfLoot && from == m_Owner && !GetFlag( CorpseFlag.SelfLooted ) && this.Items.Count != 0 )
|
||||
{
|
||||
DeathRobe robe = from.FindItemOnLayer( Layer.OuterTorso ) as DeathRobe;
|
||||
|
||||
if ( robe != null )
|
||||
if ( @from.FindItemOnLayer( Layer.OuterTorso ) is DeathRobe robe )
|
||||
{
|
||||
Map map = from.Map;
|
||||
|
||||
|
|
@ -1118,17 +1103,14 @@ namespace Server.Items
|
|||
return;
|
||||
|
||||
#region Quests
|
||||
PlayerMobile player = from as PlayerMobile;
|
||||
|
||||
if ( player != null )
|
||||
if ( @from is PlayerMobile player )
|
||||
{
|
||||
QuestSystem qs = player.Quest;
|
||||
|
||||
if ( qs is UzeraanTurmoilQuest )
|
||||
{
|
||||
GetDaemonBoneObjective obj = qs.FindObjective( typeof( GetDaemonBoneObjective ) ) as GetDaemonBoneObjective;
|
||||
|
||||
if ( obj != null && obj.CorpseWithBone == this && ( !obj.Completed || UzeraanTurmoilQuest.HasLostDaemonBone( player ) ) )
|
||||
if ( qs.FindObjective( typeof( GetDaemonBoneObjective ) ) is GetDaemonBoneObjective obj && obj.CorpseWithBone == this && ( !obj.Completed || UzeraanTurmoilQuest.HasLostDaemonBone( player ) ) )
|
||||
{
|
||||
Item bone = new QuestDaemonBone();
|
||||
|
||||
|
|
@ -1151,9 +1133,7 @@ namespace Server.Items
|
|||
}
|
||||
else if ( qs is TheSummoningQuest )
|
||||
{
|
||||
VanquishDaemonObjective obj = qs.FindObjective( typeof( VanquishDaemonObjective ) ) as VanquishDaemonObjective;
|
||||
|
||||
if ( obj != null && obj.Completed && obj.CorpseWithSkull == this )
|
||||
if ( qs.FindObjective( typeof( VanquishDaemonObjective ) ) is VanquishDaemonObjective obj && obj.Completed && obj.CorpseWithSkull == this )
|
||||
{
|
||||
GoldenSkull sk = new GoldenSkull();
|
||||
|
||||
|
|
@ -1276,9 +1256,9 @@ namespace Server.Items
|
|||
if ( IsCriminalAction( from ) )
|
||||
from.CriminalAction( true );
|
||||
}
|
||||
else if ( dead is BaseCreature )
|
||||
else if ( dead is BaseCreature creature )
|
||||
{
|
||||
((BaseCreature)dead).OnCarve( from, this, item );
|
||||
creature.OnCarve( from, this, item );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -183,13 +183,13 @@ namespace Server.Items
|
|||
writer.Write( m_TriggerDelay );
|
||||
writer.Write( m_SoundDelay );
|
||||
|
||||
if ( m_Source is Item )
|
||||
writer.Write( m_Source as Item );
|
||||
if ( m_Source is Item srcItem )
|
||||
writer.Write( srcItem );
|
||||
else
|
||||
writer.Write( m_Source as Mobile );
|
||||
|
||||
if ( m_Target is Item )
|
||||
writer.Write( m_Target as Item );
|
||||
if ( m_Target is Item targItem )
|
||||
writer.Write( targItem );
|
||||
else
|
||||
writer.Write( m_Target as Mobile );
|
||||
|
||||
|
|
@ -269,12 +269,12 @@ namespace Server.Items
|
|||
IEntity ent = null;
|
||||
|
||||
if (m_PlaySoundAtTrigger)
|
||||
ent = trigger as IEntity;
|
||||
ent = trigger;
|
||||
|
||||
if (ent == null)
|
||||
ent = this;
|
||||
|
||||
Effects.PlaySound((ent is Item) ? ((Item)ent).GetWorldLocation() : ent.Location, ent.Map, m_SoundID);
|
||||
Effects.PlaySound((ent as Item)?.GetWorldLocation() ?? ent.Location, ent.Map, m_SoundID);
|
||||
}
|
||||
|
||||
public void DoEffect(IEntity trigger)
|
||||
|
|
@ -282,7 +282,7 @@ namespace Server.Items
|
|||
if (Deleted || m_TriggerType == EffectTriggerType.None)
|
||||
return;
|
||||
|
||||
if (trigger is Mobile && ((Mobile)trigger).Hidden && ((Mobile)trigger).AccessLevel > AccessLevel.Player)
|
||||
if (trigger is Mobile mobile && mobile.Hidden && mobile.AccessLevel > AccessLevel.Player)
|
||||
return;
|
||||
|
||||
if (m_SoundID > 0)
|
||||
|
|
|
|||
|
|
@ -100,23 +100,20 @@ namespace Server.Items
|
|||
HeldBy.PublicOverheadMessage( MessageType.Regular, 957, false, m_Ticks.ToString() );
|
||||
else if ( RootParent == null )
|
||||
PublicOverheadMessage( MessageType.Regular, 957, false, m_Ticks.ToString() );
|
||||
else if ( RootParent is Mobile )
|
||||
((Mobile)RootParent).PublicOverheadMessage( MessageType.Regular, 957, false, m_Ticks.ToString() );
|
||||
else if ( RootParent is Mobile mobile )
|
||||
mobile.PublicOverheadMessage( MessageType.Regular, 957, false, m_Ticks.ToString() );
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if ( HeldBy != null )
|
||||
HeldBy.DropHolding();
|
||||
HeldBy?.DropHolding();
|
||||
|
||||
if ( m_Users != null )
|
||||
{
|
||||
foreach ( Mobile m in m_Users )
|
||||
{
|
||||
ThrowTarget targ = m.Target as ThrowTarget;
|
||||
|
||||
if ( targ != null && targ.Bomb == this )
|
||||
if ( m.Target is ThrowTarget targ && targ.Bomb == this )
|
||||
Target.Cancel( m );
|
||||
}
|
||||
|
||||
|
|
@ -124,9 +121,8 @@ namespace Server.Items
|
|||
m_Users = null;
|
||||
}
|
||||
|
||||
if ( RootParent is Mobile )
|
||||
if ( RootParent is Mobile parent )
|
||||
{
|
||||
Mobile parent = (Mobile)RootParent;
|
||||
parent.SendLocalizedMessage( 1060583 ); // The firebomb explodes in your hand!
|
||||
AOS.Damage( parent, Utility.Random( 3 ) + 4, 0, 100, 0, 0, 0 );
|
||||
}
|
||||
|
|
@ -140,15 +136,13 @@ namespace Server.Items
|
|||
|
||||
eable.Free();
|
||||
|
||||
Mobile victim;
|
||||
for ( int i = 0; i < toDamage.Count; ++i )
|
||||
{
|
||||
victim = toDamage[i];
|
||||
Mobile victim = toDamage[i];
|
||||
|
||||
if ( m_LitBy == null || (SpellHelper.ValidIndirectTarget( m_LitBy, victim ) && m_LitBy.CanBeHarmful( victim, false )) )
|
||||
{
|
||||
if ( m_LitBy != null )
|
||||
m_LitBy.DoHarmful( victim );
|
||||
m_LitBy?.DoHarmful( victim );
|
||||
|
||||
AOS.Damage( victim, m_LitBy, Utility.Random( 3 ) + 4, 0, 100, 0, 0, 0 );
|
||||
}
|
||||
|
|
@ -168,21 +162,14 @@ namespace Server.Items
|
|||
if ( Deleted || Map == Map.Internal || !IsChildOf( from.Backpack ) )
|
||||
return;
|
||||
|
||||
IPoint3D p = obj as IPoint3D;
|
||||
|
||||
if ( p == null )
|
||||
if ( !(obj is IPoint3D p) )
|
||||
return;
|
||||
|
||||
SpellHelper.GetSurfaceTop( ref p );
|
||||
|
||||
from.RevealingAction();
|
||||
|
||||
IEntity to;
|
||||
|
||||
if ( p is Mobile )
|
||||
to = (Mobile)p;
|
||||
else
|
||||
to = new Entity( Serial.Zero, new Point3D( p ), Map );
|
||||
IEntity to = p as IEntity ?? new Entity( Serial.Zero, new Point3D( p ), Map );
|
||||
|
||||
Effects.SendMovingEffect( from, to, ItemID, 7, 0, false, false, Hue, 0 );
|
||||
|
||||
|
|
@ -257,8 +244,7 @@ namespace Server.Items
|
|||
{
|
||||
if ( ItemID == 0x398C && m_LitBy == null || (SpellHelper.ValidIndirectTarget( m_LitBy, m ) && m_LitBy.CanBeHarmful( m, false )) )
|
||||
{
|
||||
if ( m_LitBy != null )
|
||||
m_LitBy.DoHarmful( m );
|
||||
m_LitBy?.DoHarmful( m );
|
||||
|
||||
AOS.Damage( m, m_LitBy, 2, 0, 100, 0, 0, 0 );
|
||||
m.PlaySound( 0x208 );
|
||||
|
|
@ -284,15 +270,13 @@ namespace Server.Items
|
|||
return;
|
||||
}
|
||||
|
||||
Mobile victim;
|
||||
for ( int i = 0; i < m_Burning.Count; )
|
||||
{
|
||||
victim = m_Burning[i];
|
||||
Mobile victim = m_Burning[i];
|
||||
|
||||
if ( victim.Location == Location && victim.Map == Map && (m_LitBy == null || ( SpellHelper.ValidIndirectTarget( m_LitBy, victim ) && m_LitBy.CanBeHarmful( victim, false ) )) )
|
||||
{
|
||||
if ( m_LitBy != null )
|
||||
m_LitBy.DoHarmful( victim );
|
||||
m_LitBy?.DoHarmful( victim );
|
||||
|
||||
AOS.Damage( victim, m_LitBy, Utility.Random( 3 ) + 4, 0, 100, 0, 0, 0 );
|
||||
++i;
|
||||
|
|
|
|||
|
|
@ -60,10 +60,10 @@ namespace Server.Items
|
|||
|
||||
addon.Map = Map.Internal;
|
||||
|
||||
if ( addon is BaseAddon )
|
||||
result = ( (BaseAddon) addon ).CouldFit( addon.Location, from.Map, from, ref house );
|
||||
else if ( addon is BaseAddonContainer )
|
||||
result = ( (BaseAddonContainer) addon ).CouldFit( addon.Location, from.Map, from, ref house );
|
||||
if ( addon is BaseAddon baseAddon )
|
||||
result = baseAddon.CouldFit( baseAddon.Location, from.Map, from, ref house );
|
||||
else if ( addon is BaseAddonContainer container )
|
||||
result = container.CouldFit( container.Location, from.Map, from, ref house );
|
||||
|
||||
addon.Map = from.Map;
|
||||
|
||||
|
|
@ -101,10 +101,8 @@ namespace Server.Items
|
|||
|
||||
private void ClearComponents( Item item )
|
||||
{
|
||||
if ( item is BaseAddon )
|
||||
if ( item is BaseAddon addon )
|
||||
{
|
||||
BaseAddon addon = (BaseAddon) item;
|
||||
|
||||
foreach ( AddonComponent c in addon.Components )
|
||||
{
|
||||
c.Addon = null;
|
||||
|
|
@ -113,17 +111,15 @@ namespace Server.Items
|
|||
|
||||
addon.Components.Clear();
|
||||
}
|
||||
else if ( item is BaseAddonContainer )
|
||||
else if ( item is BaseAddonContainer addonContainer )
|
||||
{
|
||||
BaseAddonContainer addon = (BaseAddonContainer) item;
|
||||
|
||||
foreach ( AddonContainerComponent c in addon.Components )
|
||||
foreach ( AddonContainerComponent c in addonContainer.Components )
|
||||
{
|
||||
c.Addon = null;
|
||||
c.Delete();
|
||||
}
|
||||
|
||||
addon.Components.Clear();
|
||||
addonContainer.Components.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,14 +29,12 @@ 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.Movable == false && from.AccessLevel == AccessLevel.Player )
|
||||
return;
|
||||
|
||||
Type type = targeted.GetType();
|
||||
Type type = item.GetType();
|
||||
|
||||
FlippableAttribute[] AttributeArray = (FlippableAttribute[])type.GetCustomAttributes( typeof( FlippableAttribute ), false );
|
||||
|
||||
|
|
@ -47,7 +45,7 @@ namespace Server.Items
|
|||
|
||||
FlippableAttribute fa = AttributeArray[0];
|
||||
|
||||
fa.Flip( (Item)targeted );
|
||||
fa.Flip( item );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,10 +74,8 @@ namespace Server.Items
|
|||
|
||||
parent = root ?? parent;
|
||||
|
||||
if (parent is SecureTradeContainer && AccountGold.ConvertOnTrade)
|
||||
if (parent is SecureTradeContainer trade && AccountGold.ConvertOnTrade)
|
||||
{
|
||||
var trade = (SecureTradeContainer)parent;
|
||||
|
||||
if (trade.Trade.From.Container == trade)
|
||||
{
|
||||
tradeInfo = trade.Trade.From;
|
||||
|
|
@ -89,12 +87,12 @@ namespace Server.Items
|
|||
owner = tradeInfo.Mobile;
|
||||
}
|
||||
}
|
||||
else if (parent is BankBox && AccountGold.ConvertOnBank)
|
||||
else if (parent is BankBox box && AccountGold.ConvertOnBank)
|
||||
{
|
||||
owner = ((BankBox)parent).Owner;
|
||||
owner = box.Owner;
|
||||
}
|
||||
|
||||
if (owner == null || owner.Account == null || !owner.Account.DepositGold(Amount))
|
||||
if (owner?.Account == null || !owner.Account.DepositGold(Amount))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -103,17 +101,13 @@ namespace Server.Items
|
|||
{
|
||||
if (owner.NetState != null && !owner.NetState.NewSecureTrading)
|
||||
{
|
||||
int gold;
|
||||
int plat = Math.DivRem(Amount, AccountGold.CurrencyThreshold, out gold);
|
||||
int plat = Math.DivRem(Amount, AccountGold.CurrencyThreshold, out var gold);
|
||||
|
||||
tradeInfo.Plat += plat;
|
||||
tradeInfo.Gold += gold;
|
||||
}
|
||||
|
||||
if (tradeInfo.VirtualCheck != null)
|
||||
{
|
||||
tradeInfo.VirtualCheck.UpdateTrade(tradeInfo.Mobile);
|
||||
}
|
||||
tradeInfo.VirtualCheck?.UpdateTrade(tradeInfo.Mobile);
|
||||
}
|
||||
|
||||
owner.SendLocalizedMessage(1042763, Amount.ToString("#,0"));
|
||||
|
|
|
|||
|
|
@ -150,10 +150,9 @@ namespace Server.Items
|
|||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( targeted is Item && InteriorDecorator.CheckUse( m_Decorator, from ) )
|
||||
if ( targeted is Item item && InteriorDecorator.CheckUse( m_Decorator, from ) )
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt( from );
|
||||
Item item = (Item)targeted;
|
||||
|
||||
bool isDecorableComponent = false;
|
||||
|
||||
|
|
@ -162,23 +161,20 @@ namespace Server.Items
|
|||
object addon = null;
|
||||
int count = 0;
|
||||
|
||||
if ( item is AddonComponent )
|
||||
switch (item)
|
||||
{
|
||||
AddonComponent component = (AddonComponent) item;
|
||||
count = component.Addon.Components.Count;
|
||||
addon = component.Addon;
|
||||
}
|
||||
else if ( item is AddonContainerComponent )
|
||||
{
|
||||
AddonContainerComponent component = (AddonContainerComponent) item;
|
||||
count = component.Addon.Components.Count;
|
||||
addon = component.Addon;
|
||||
}
|
||||
else if ( item is BaseAddonContainer )
|
||||
{
|
||||
BaseAddonContainer container = (BaseAddonContainer) item;
|
||||
count = container.Components.Count;
|
||||
addon = container;
|
||||
case AddonComponent component:
|
||||
count = component.Addon.Components.Count;
|
||||
addon = component.Addon;
|
||||
break;
|
||||
case AddonContainerComponent containerComponent:
|
||||
count = containerComponent.Addon.Components.Count;
|
||||
addon = containerComponent.Addon;
|
||||
break;
|
||||
case BaseAddonContainer container:
|
||||
count = container.Components.Count;
|
||||
addon = container;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( count == 1 && Core.SE )
|
||||
|
|
@ -244,12 +240,18 @@ namespace Server.Items
|
|||
{
|
||||
object addon = null;
|
||||
|
||||
if ( item is AddonComponent )
|
||||
addon = ((AddonComponent) item).Addon;
|
||||
else if ( item is AddonContainerComponent )
|
||||
addon = ((AddonContainerComponent) item).Addon;
|
||||
else if ( item is BaseAddonContainer )
|
||||
addon = (BaseAddonContainer) item;
|
||||
switch (item)
|
||||
{
|
||||
case AddonComponent component:
|
||||
addon = component.Addon;
|
||||
break;
|
||||
case AddonContainerComponent containerComponent:
|
||||
addon = containerComponent.Addon;
|
||||
break;
|
||||
case BaseAddonContainer container:
|
||||
addon = container;
|
||||
break;
|
||||
}
|
||||
|
||||
FlippableAddonAttribute[] aAttributes = (FlippableAddonAttribute[]) addon.GetType().GetCustomAttributes( typeof( FlippableAddonAttribute ), false );
|
||||
|
||||
|
|
|
|||
|
|
@ -50,10 +50,8 @@ namespace Server.Items
|
|||
|
||||
foreach ( Item item in items )
|
||||
{
|
||||
if ( item is Key )
|
||||
if ( item is Key key )
|
||||
{
|
||||
Key key = (Key) item;
|
||||
|
||||
if ( key.KeyValue == keyValue )
|
||||
key.Delete();
|
||||
}
|
||||
|
|
@ -75,10 +73,8 @@ namespace Server.Items
|
|||
|
||||
foreach ( Item item in items )
|
||||
{
|
||||
if ( item is Key )
|
||||
if ( item is Key key )
|
||||
{
|
||||
Key key = (Key) item;
|
||||
|
||||
if ( key.KeyValue == keyValue )
|
||||
return true;
|
||||
}
|
||||
|
|
@ -293,52 +289,37 @@ namespace Server.Items
|
|||
{
|
||||
if ( o.KeyValue == this.KeyValue )
|
||||
{
|
||||
if ( o is BaseDoor && !((BaseDoor)o).UseLocks() )
|
||||
{
|
||||
if ( o is BaseDoor door && !door.UseLocks() )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
o.Locked = !o.Locked;
|
||||
|
||||
if ( o is LockableContainer cont1 )
|
||||
{
|
||||
o.Locked = !o.Locked;
|
||||
|
||||
if ( o is LockableContainer )
|
||||
{
|
||||
LockableContainer cont = (LockableContainer)o;
|
||||
|
||||
if ( cont.LockLevel == -255 )
|
||||
cont.LockLevel = cont.RequiredSkill - 10;
|
||||
}
|
||||
|
||||
if ( o is Item )
|
||||
{
|
||||
Item item = (Item) o;
|
||||
|
||||
if ( o.Locked )
|
||||
item.SendLocalizedMessageTo( from, 1048000 ); // You lock it.
|
||||
else
|
||||
item.SendLocalizedMessageTo( from, 1048001 ); // You unlock it.
|
||||
|
||||
if ( item is LockableContainer )
|
||||
{
|
||||
LockableContainer cont = (LockableContainer) item;
|
||||
|
||||
if ( cont.TrapType != TrapType.None && cont.TrapOnLockpick )
|
||||
{
|
||||
if ( o.Locked )
|
||||
item.SendLocalizedMessageTo( from, 501673 ); // You re-enable the trap.
|
||||
else
|
||||
item.SendLocalizedMessageTo( from, 501672 ); // You disable the trap temporarily. Lock it again to re-enable it.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
if ( cont1.LockLevel == -255 )
|
||||
cont1.LockLevel = cont1.RequiredSkill - 10;
|
||||
}
|
||||
|
||||
if ( o is Item item )
|
||||
{
|
||||
if ( o.Locked )
|
||||
item.SendLocalizedMessageTo( from, 1048000 ); // You lock it.
|
||||
else
|
||||
item.SendLocalizedMessageTo( from, 1048001 ); // You unlock it.
|
||||
|
||||
if ( item is LockableContainer cont && cont.TrapType != TrapType.None && cont.TrapOnLockpick )
|
||||
{
|
||||
if ( o.Locked )
|
||||
cont.SendLocalizedMessageTo( from, 501673 ); // You re-enable the trap.
|
||||
else
|
||||
cont.SendLocalizedMessageTo( from, 501672 ); // You disable the trap temporarily. Lock it again to re-enable it.
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private class RenamePrompt : Prompt
|
||||
|
|
@ -388,9 +369,9 @@ namespace Server.Items
|
|||
|
||||
from.Prompt = new RenamePrompt( m_Key );
|
||||
}
|
||||
else if ( targeted is ILockable )
|
||||
else if ( targeted is ILockable lockable )
|
||||
{
|
||||
if ( m_Key.UseOn( from, (ILockable) targeted ) )
|
||||
if ( m_Key.UseOn( from, lockable ) )
|
||||
number = -1;
|
||||
else
|
||||
number = 501668; // This key doesn't seem to unlock that.
|
||||
|
|
@ -426,10 +407,8 @@ namespace Server.Items
|
|||
|
||||
int number;
|
||||
|
||||
if ( targeted is Key )
|
||||
if ( targeted is Key k )
|
||||
{
|
||||
Key k = (Key)targeted;
|
||||
|
||||
if ( k.m_KeyVal == 0 )
|
||||
{
|
||||
number = 501675; // This key is also blank.
|
||||
|
|
@ -465,4 +444,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,24 +30,20 @@ namespace Server.Items
|
|||
return false;
|
||||
}
|
||||
|
||||
Key key = dropped as Key;
|
||||
|
||||
if ( key == null || key.KeyValue == 0 )
|
||||
if ( !(dropped is Key key) || key.KeyValue == 0 )
|
||||
{
|
||||
from.SendLocalizedMessage( 501689 ); // Only non-blank keys can be put on a keyring.
|
||||
return false;
|
||||
}
|
||||
else if ( this.Keys.Count >= MaxKeys )
|
||||
if ( this.Keys.Count >= MaxKeys )
|
||||
{
|
||||
from.SendLocalizedMessage( 1008138 ); // This keyring is full.
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Add( key );
|
||||
from.SendLocalizedMessage( 501691 ); // You put the key on the keyring.
|
||||
return true;
|
||||
}
|
||||
|
||||
Add( key );
|
||||
from.SendLocalizedMessage( 501691 ); // You put the key on the keyring.
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
|
|
@ -84,10 +80,8 @@ namespace Server.Items
|
|||
m_KeyRing.Open( from );
|
||||
from.SendLocalizedMessage( 501685 ); // You open the keyring.
|
||||
}
|
||||
else if ( targeted is ILockable )
|
||||
else if ( targeted is ILockable o )
|
||||
{
|
||||
ILockable o = (ILockable) targeted;
|
||||
|
||||
foreach ( Key key in m_KeyRing.Keys )
|
||||
{
|
||||
if ( key.UseOn( from, o ) )
|
||||
|
|
@ -125,9 +119,7 @@ namespace Server.Items
|
|||
|
||||
public void Open( Mobile from )
|
||||
{
|
||||
Container cont = this.Parent as Container;
|
||||
|
||||
if ( cont == null )
|
||||
if ( !(this.Parent is Container cont) )
|
||||
return;
|
||||
|
||||
for ( int i = m_Keys.Count - 1; i >= 0; i-- )
|
||||
|
|
|
|||
|
|
@ -75,9 +75,9 @@ namespace Server.Items
|
|||
{
|
||||
from.SendLocalizedMessage( 1005401 ); // You cannot bury the stone here.
|
||||
}
|
||||
else if ( from is PlayerMobile && ((PlayerMobile)from).Young )
|
||||
else if ( @from is PlayerMobile mobile && mobile.Young )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049543 ); // You decide against traveling to Felucca while you are still young.
|
||||
mobile.SendLocalizedMessage( 1049543 ); // You decide against traveling to Felucca while you are still young.
|
||||
}
|
||||
else if ( from.Kills >= 5 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -61,14 +61,12 @@ namespace Server.Items
|
|||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
else if ( obj is Item && ((Item)obj).RootParent != from )
|
||||
else if ( obj is Item item && item.RootParent != from )
|
||||
{
|
||||
from.SendLocalizedMessage( 1005425 ); // You may only wipe down items you are holding or carrying.
|
||||
}
|
||||
else if ( obj is BaseWeapon )
|
||||
else if ( obj is BaseWeapon weapon )
|
||||
{
|
||||
BaseWeapon weapon = (BaseWeapon)obj;
|
||||
|
||||
if ( weapon.Poison == null || weapon.PoisonCharges <= 0 )
|
||||
{
|
||||
from.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, 1005422 ); // Hmmmm... this does not need to be cleaned.
|
||||
|
|
@ -86,10 +84,8 @@ namespace Server.Items
|
|||
from.SendLocalizedMessage( 1010497 ); // You have cleaned the item.
|
||||
}
|
||||
}
|
||||
else if ( obj == from && obj is PlayerMobile )
|
||||
else if ( obj == from && obj is PlayerMobile pm )
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)obj;
|
||||
|
||||
if ( pm.BodyMod == 183 || pm.BodyMod == 184 )
|
||||
{
|
||||
pm.SavagePaintExpiration = TimeSpan.Zero;
|
||||
|
|
@ -107,10 +103,8 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
#region Firebomb
|
||||
else if ( obj is BaseBeverage )
|
||||
else if ( obj is BaseBeverage beverage )
|
||||
{
|
||||
BaseBeverage beverage = (BaseBeverage) obj;
|
||||
|
||||
if ( beverage.Content == BeverageType.Liquor )
|
||||
{
|
||||
Firebomb bomb = new Firebomb( beverage.ItemID );
|
||||
|
|
|
|||
|
|
@ -505,7 +505,7 @@ namespace Server.Items
|
|||
{
|
||||
from.SendLocalizedMessage( 501356 ); // This person is already banned!
|
||||
}
|
||||
else if ( poster is BaseCreature && ((BaseCreature)poster).NoHouseRestrictions )
|
||||
else if ( poster is BaseCreature creature && creature.NoHouseRestrictions )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062040 ); // You cannot ban that.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,9 +62,7 @@ namespace Server.Items
|
|||
|
||||
foreach( Mobile m in GetMobilesInRange( 0 ) )
|
||||
{
|
||||
BaseCreature bc = m as BaseCreature;
|
||||
|
||||
if ( m.Alive && !m.IsDeadBondedPet && (bc == null || bc.Controlled || bc.Summoned) )
|
||||
if ( m.Alive && !m.IsDeadBondedPet && (!(m is BaseCreature bc) || bc.Controlled || bc.Summoned) )
|
||||
{
|
||||
toDamage.Add( m );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,13 +48,12 @@ namespace Server.Items
|
|||
{
|
||||
Mobile m = null;
|
||||
|
||||
if ( parent is Item )
|
||||
m = ((Item)parent).RootParent as Mobile;
|
||||
else if ( parent is Mobile )
|
||||
m = (Mobile)parent;
|
||||
if ( parent is Item item )
|
||||
m = item.RootParent as Mobile;
|
||||
else if ( parent is Mobile mobile )
|
||||
m = mobile;
|
||||
|
||||
if ( m != null )
|
||||
m.CloseGump( typeof( PromotionalTokenGump ) );
|
||||
m?.CloseGump( typeof( PromotionalTokenGump ) );
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
|
|
@ -123,10 +122,10 @@ namespace Server.Items
|
|||
|
||||
public override Item CreateItemFor( Mobile from )
|
||||
{
|
||||
if ( from != null && from.Account != null )
|
||||
if ( @from?.Account != null )
|
||||
return new SoulstoneFragment( from.Account.ToString() );
|
||||
else
|
||||
return null;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override TextDefinition ItemGumpName => 1070999;// <center>Soulstone Fragment</center>
|
||||
|
|
|
|||
|
|
@ -323,8 +323,8 @@ namespace Server.Items
|
|||
}
|
||||
else
|
||||
{
|
||||
ClientFlags flags = mobile.NetState == null ? ClientFlags.None : mobile.NetState.Flags;
|
||||
bool young = mobile is PlayerMobile ? ((PlayerMobile)mobile).Young : false;
|
||||
ClientFlags flags = mobile.NetState?.Flags ?? ClientFlags.None;
|
||||
bool young = mobile is PlayerMobile playerMobile && playerMobile.Young;
|
||||
|
||||
if ( Core.SE && (flags & ClientFlags.Tokuno) != 0 )
|
||||
checkLists = young ? PMList.SEListsYoung : PMList.SELists;
|
||||
|
|
|
|||
|
|
@ -53,9 +53,8 @@ namespace Server.Items
|
|||
{
|
||||
message = "It cannot weight itself.";
|
||||
}
|
||||
else if ( targeted is Item )
|
||||
else if ( targeted is Item item )
|
||||
{
|
||||
Item item = (Item)targeted;
|
||||
object root = item.RootParent;
|
||||
|
||||
if ( (root != null && root != from) || item.Parent == from )
|
||||
|
|
@ -90,4 +89,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -994,7 +994,7 @@ namespace Server.Items
|
|||
return false;
|
||||
}
|
||||
|
||||
if (GetFlag(ConditionFlag.DenyFollowers) && (m.Followers != 0 || (m is PlayerMobile && ((PlayerMobile)m).AutoStabled.Count != 0)))
|
||||
if (GetFlag(ConditionFlag.DenyFollowers) && (m.Followers != 0 || (m is PlayerMobile mobile && mobile.AutoStabled.Count != 0)))
|
||||
{
|
||||
m.SendLocalizedMessage(1077250); // No pets permitted beyond this point.
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ namespace Server.Items
|
|||
from.BodyMod = ( from.Female ? 184 : 183 );
|
||||
from.HueMod = 0;
|
||||
|
||||
if ( from is PlayerMobile )
|
||||
((PlayerMobile)from).SavagePaintExpiration = TimeSpan.FromDays( 7.0 );
|
||||
if ( @from is PlayerMobile mobile )
|
||||
mobile.SavagePaintExpiration = TimeSpan.FromDays( 7.0 );
|
||||
|
||||
from.SendLocalizedMessage( 1042537 ); // You now bear the markings of the savage tribe. Your body paint will last about a week or you can remove it with an oil cloth.
|
||||
|
||||
|
|
|
|||
|
|
@ -111,8 +111,8 @@ namespace Server.Items
|
|||
|
||||
foreach ( Item item in GetItemsInRange( NeighborRange ) )
|
||||
{
|
||||
if ( item != this && item is WarningItem )
|
||||
list.Add( (WarningItem)item );
|
||||
if ( item != this && item is WarningItem warningItem )
|
||||
list.Add( warningItem );
|
||||
}
|
||||
|
||||
for ( int i = 0; i < list.Count; i++ )
|
||||
|
|
|
|||
|
|
@ -115,9 +115,9 @@ namespace Server.Items
|
|||
|
||||
protected override void OnTarget( Mobile from, object target )
|
||||
{
|
||||
if ( target is WayPoint && m_Point != null )
|
||||
if ( target is WayPoint point && m_Point != null )
|
||||
{
|
||||
m_Point.NextPoint = (WayPoint)target;
|
||||
m_Point.NextPoint = point;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -137,14 +137,14 @@ namespace Server.Items
|
|||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( targeted is WayPoint )
|
||||
if ( targeted is WayPoint wayPoint )
|
||||
{
|
||||
if ( m_Last != null )
|
||||
m_Last.NextPoint = (WayPoint)targeted;
|
||||
m_Last.NextPoint = wayPoint;
|
||||
}
|
||||
else if ( targeted is IPoint3D )
|
||||
else if ( targeted is IPoint3D d )
|
||||
{
|
||||
Point3D p = new Point3D( (IPoint3D)targeted );
|
||||
Point3D p = new Point3D( d );
|
||||
|
||||
WayPoint point = new WayPoint( m_Last );
|
||||
point.MoveToWorld( p, from.Map );
|
||||
|
|
|
|||
|
|
@ -95,9 +95,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnAfterDuped( Item newItem )
|
||||
{
|
||||
BaseQuiver quiver = newItem as BaseQuiver;
|
||||
|
||||
if ( quiver == null )
|
||||
if ( !(newItem is BaseQuiver quiver) )
|
||||
return;
|
||||
|
||||
quiver.m_Attributes = new AosAttributes( newItem, m_Attributes );
|
||||
|
|
@ -194,20 +192,16 @@ namespace Server.Items
|
|||
|
||||
public override void OnAdded(IEntity parent)
|
||||
{
|
||||
if ( parent is Mobile )
|
||||
if ( parent is Mobile mob )
|
||||
{
|
||||
Mobile mob = (Mobile) parent;
|
||||
|
||||
m_Attributes.AddStatBonuses( mob );
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnRemoved(IEntity parent)
|
||||
{
|
||||
if ( parent is Mobile )
|
||||
if ( parent is Mobile mob )
|
||||
{
|
||||
Mobile mob = (Mobile) parent;
|
||||
|
||||
m_Attributes.RemoveStatBonuses( mob );
|
||||
}
|
||||
}
|
||||
|
|
@ -447,10 +441,8 @@ namespace Server.Items
|
|||
|
||||
public void InvalidateWeight()
|
||||
{
|
||||
if ( RootParent is Mobile )
|
||||
if ( RootParent is Mobile m )
|
||||
{
|
||||
Mobile m = (Mobile) RootParent;
|
||||
|
||||
m.UpdateTotals();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,4 +140,4 @@ namespace Server.ContextMenus
|
|||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -916,6 +916,7 @@ namespace Server.Network
|
|||
}
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum CMEFlags
|
||||
{
|
||||
None = 0x00,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue