Sets a default parameter for OnHit. More casting cleanup.
This commit is contained in:
parent
74f498c1c8
commit
d6c0bf2d4c
96 changed files with 350 additions and 579 deletions
|
|
@ -328,8 +328,7 @@ namespace Server.Engines.CannedEvil
|
|||
m_Active = true;
|
||||
m_HasBeenAdvanced = false;
|
||||
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
m_Timer = new SliceTimer( this );
|
||||
m_Timer.Start();
|
||||
|
|
@ -359,8 +358,7 @@ namespace Server.Engines.CannedEvil
|
|||
m_Active = false;
|
||||
m_HasBeenAdvanced = false;
|
||||
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
m_Timer = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -45,8 +45,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
base.OnAfterDelete();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,8 +191,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
base.OnAfterDelete ();
|
||||
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile m )
|
||||
|
|
|
|||
|
|
@ -122,8 +122,7 @@ namespace Server.Engines.Help
|
|||
|
||||
public void Stop()
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
m_Timer = null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,8 +167,7 @@ namespace Server.Menus.Questions
|
|||
|
||||
public void StopClose()
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
m_Mobile.Frozen = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,8 +73,7 @@ namespace Server.Engines.Quests
|
|||
|
||||
public virtual void StopTimer()
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
m_Timer = null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -663,8 +663,7 @@ namespace Server.Mobiles
|
|||
|
||||
m_End = DateTime.UtcNow + delay;
|
||||
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
m_Timer = new InternalTimer( this, delay );
|
||||
if ( !IsFull )
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ namespace Server.Items
|
|||
{
|
||||
m_Resource = value;
|
||||
Hue = CraftResources.GetHue( m_Resource );
|
||||
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
|
@ -143,7 +143,7 @@ namespace Server.Items
|
|||
|
||||
if ( !map.CanFit( p3D.X, p3D.Y, p3D.Z, c.ItemData.Height, false, true, ( c.Z == 0 ) ) )
|
||||
return AddonFitResult.Blocked;
|
||||
else if ( !CheckHouse( from, p3D, map, c.ItemData.Height, ref house ) )
|
||||
if ( !CheckHouse( from, p3D, map, c.ItemData.Height, ref house ) )
|
||||
return AddonFitResult.NotInHouse;
|
||||
|
||||
if ( c.NeedsWall )
|
||||
|
|
@ -168,7 +168,7 @@ namespace Server.Items
|
|||
{
|
||||
Point3D addonLoc = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z );
|
||||
int addonHeight = c.ItemData.CalcHeight;
|
||||
|
||||
|
||||
if ( Utility.InRange( doorLoc, addonLoc, 1 ) && (addonLoc.Z == doorLoc.Z || ((addonLoc.Z + addonHeight) > doorLoc.Z && (doorLoc.Z + doorHeight) > addonLoc.Z)) )
|
||||
return AddonFitResult.DoorTooClose;
|
||||
}
|
||||
|
|
@ -293,4 +293,4 @@ namespace Server.Items
|
|||
Weight = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ namespace Server.Items
|
|||
|
||||
from.Direction = dir;
|
||||
|
||||
bool canThrow = true;
|
||||
bool canThrow;
|
||||
|
||||
if ( !from.InRange( this, 4 ) || !from.InLOS( this ) )
|
||||
canThrow = false;
|
||||
|
|
|
|||
|
|
@ -63,8 +63,7 @@ namespace Server.Items
|
|||
|
||||
public void EndSpin( SpinCallback callback, Mobile from, int hue )
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
m_Timer = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -65,8 +65,7 @@ namespace Server.Items
|
|||
|
||||
public void EndSpin( SpinCallback callback, Mobile from, int hue )
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
m_Timer = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -46,8 +46,7 @@ namespace Server.Items
|
|||
|
||||
public void BeginSwing()
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
m_Timer = new InternalTimer( this );
|
||||
m_Timer.Start();
|
||||
|
|
@ -57,8 +56,7 @@ namespace Server.Items
|
|||
|
||||
public void EndSwing()
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
m_Timer = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -73,8 +73,7 @@ namespace Server.Items
|
|||
|
||||
public void EndSpin( SpinCallback callback, Mobile from, int hue )
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
m_Timer = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -65,8 +65,7 @@ namespace Server.Items
|
|||
|
||||
public void EndSpin( SpinCallback callback, Mobile from, int hue )
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
m_Timer = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -52,8 +52,7 @@ namespace Server.Items
|
|||
|
||||
public void BeginSwing()
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
m_Timer = new InternalTimer( this );
|
||||
m_Timer.Start();
|
||||
|
|
@ -61,8 +60,7 @@ namespace Server.Items
|
|||
|
||||
public void EndSwing()
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
m_Timer = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -791,10 +791,8 @@ namespace Server.Items
|
|||
from.SendLocalizedMessage( 1074514 ); // You have no place to put it.
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1074512 ); // You put the gasping creature into your pack.
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 1074512 ); // You put the gasping creature into your pack.
|
||||
}
|
||||
|
||||
if ( !fish.Dead )
|
||||
|
|
@ -871,24 +869,21 @@ namespace Server.Items
|
|||
|
||||
if ( IsFull )
|
||||
{
|
||||
if ( from != null )
|
||||
from.SendLocalizedMessage( 1073636 ); // The decoration will not fit in the aquarium.
|
||||
from?.SendLocalizedMessage( 1073636 ); // The decoration will not fit in the aquarium.
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !Accepts( item ) )
|
||||
{
|
||||
if ( from != null )
|
||||
from.SendLocalizedMessage( 1073822 ); // The aquarium can not hold that item.
|
||||
from?.SendLocalizedMessage( 1073822 ); // The aquarium can not hold that item.
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
AddItem( item );
|
||||
|
||||
if ( from != null )
|
||||
from.SendLocalizedMessage( 1073635, ( item.LabelNumber != 0 ) ? String.Format( "#{0}", item.LabelNumber ) : item.Name ); // You add the following decoration to your aquarium: ~1_NAME~
|
||||
from?.SendLocalizedMessage( 1073635, ( item.LabelNumber != 0 ) ? String.Format( "#{0}", item.LabelNumber ) : item.Name ); // You add the following decoration to your aquarium: ~1_NAME~
|
||||
|
||||
InvalidateProperties();
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ namespace Server.Items
|
|||
DisplayPage( i, edit );
|
||||
}
|
||||
|
||||
public virtual void DisplayPage( int page, bool edit )
|
||||
public void DisplayPage( int page, bool edit )
|
||||
{
|
||||
AddPage( page );
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@ namespace Server.Items
|
|||
|
||||
public virtual void StartTimer()
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
m_Timer = Timer.DelayCall( DeathDelay, new TimerCallback( Kill ) );
|
||||
|
||||
|
|
@ -38,8 +37,7 @@ namespace Server.Items
|
|||
|
||||
public virtual void StopTimer()
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
m_Timer = null;
|
||||
|
||||
|
|
@ -64,7 +62,7 @@ namespace Server.Items
|
|||
// TODO: This will never return "very unusual dead aquarium creature" due to the way it is killed
|
||||
if ( ItemID > 0x3B0F )
|
||||
return Dead ? 1074424 : 1074422; // A very unusual [dead/live] aquarium creature
|
||||
else if ( Hue != 0 )
|
||||
if ( Hue != 0 )
|
||||
return Dead ? 1074425 : 1074423; // A [dead/live] aquarium creature of unusual color
|
||||
|
||||
return Dead ? 1073623 : 1073622; // A [dead/live] aquarium creature
|
||||
|
|
|
|||
|
|
@ -444,8 +444,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
m_Timer = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -126,8 +126,7 @@ namespace Server.Items
|
|||
else if ( m_Duration != TimeSpan.Zero )
|
||||
m_Duration = m_End - DateTime.UtcNow;
|
||||
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
PlayUnlitSound();
|
||||
}
|
||||
|
|
@ -142,8 +141,7 @@ namespace Server.Items
|
|||
{
|
||||
m_Duration = delay;
|
||||
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
if ( delay == TimeSpan.Zero )
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -38,8 +38,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
}
|
||||
|
||||
private void OnTick()
|
||||
|
|
|
|||
|
|
@ -40,8 +40,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
}
|
||||
|
||||
private void OnTick()
|
||||
|
|
|
|||
|
|
@ -124,8 +124,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
m_Timer = null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,8 +159,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
ClearEntries();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,8 +192,7 @@ namespace Server.Items
|
|||
{
|
||||
m_Table.Remove( m_Healer );
|
||||
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
m_Timer = null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ namespace Server.Items
|
|||
|
||||
Recipe r = this.Recipe;
|
||||
|
||||
if ( r != null && @from is PlayerMobile pm )
|
||||
if ( r != null && from is PlayerMobile pm )
|
||||
{
|
||||
if ( !pm.HasRecipe( r ) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ namespace Server.Items
|
|||
|
||||
public static BaseInstrument GetInstrument( Mobile from )
|
||||
{
|
||||
if ( !(m_Instruments[@from] is BaseInstrument item) )
|
||||
if ( !(m_Instruments[from] is BaseInstrument item) )
|
||||
return null;
|
||||
|
||||
if ( !item.IsChildOf( from.Backpack ) )
|
||||
|
|
@ -210,7 +210,7 @@ namespace Server.Items
|
|||
|
||||
InstrumentPickedCallback callback = state as InstrumentPickedCallback;
|
||||
|
||||
callback?.Invoke( @from, instrument );
|
||||
callback?.Invoke( from, instrument );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace Server.Items
|
|||
from.Send( new MessageLocalizedAffix( from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 1008146 + (int)Clock.GetMoonPhase( Map.Trammel, from.X, from.Y ), "", AffixType.Prepend, "Trammel : ", "" ) );
|
||||
from.Send( new MessageLocalizedAffix( from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 1008146 + (int)Clock.GetMoonPhase( Map.Felucca, from.X, from.Y ), "", AffixType.Prepend, "Felucca : ", "" ) );
|
||||
|
||||
if ( @from is PlayerMobile player )
|
||||
if ( from is PlayerMobile player )
|
||||
{
|
||||
QuestSystem qs = player.Quest;
|
||||
|
||||
|
|
|
|||
|
|
@ -152,8 +152,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnDelete()
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
base.OnDelete();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,11 +106,8 @@ namespace Server.Items
|
|||
return;
|
||||
}
|
||||
|
||||
if ( targeted is IDurability && targeted is Item )
|
||||
if ( targeted is Item item && item is IDurability wearable )
|
||||
{
|
||||
IDurability wearable = (IDurability) targeted;
|
||||
Item item = (Item) targeted;
|
||||
|
||||
if ( !wearable.CanFortify )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049083 ); // You cannot use the powder on that item.
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ namespace Server.Items
|
|||
{
|
||||
bool allow = base.OnMoveOver( m );
|
||||
|
||||
if ( allow && Addon is BedOfNailsAddon )
|
||||
( (BedOfNailsAddon)Addon ).OnMoveOver( m );
|
||||
if ( allow && Addon is BedOfNailsAddon addon )
|
||||
addon.OnMoveOver( m );
|
||||
|
||||
return allow;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,8 +125,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
m_Timer = null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,8 +32,7 @@ namespace Server.Items
|
|||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
|
|
|
|||
|
|
@ -38,10 +38,8 @@ namespace Server.Items
|
|||
{
|
||||
foreach ( AddonComponent c in Addon.Components )
|
||||
{
|
||||
if ( c is CurtainsComponent )
|
||||
if ( c is CurtainsComponent curtain )
|
||||
{
|
||||
CurtainsComponent curtain = (CurtainsComponent) c;
|
||||
|
||||
int temp = curtain.ItemID;
|
||||
curtain.ItemID = curtain.ClosedID;
|
||||
curtain.ClosedID = temp;
|
||||
|
|
|
|||
|
|
@ -82,8 +82,8 @@ namespace Server.Items
|
|||
{
|
||||
object[] param = (object[]) obj;
|
||||
|
||||
if ( param[ 0 ] is AddonComponent && param[ 1 ] is Mobile )
|
||||
Activate( (AddonComponent) param[ 0 ], (Mobile) param[ 1 ] );
|
||||
if ( param[ 0 ] is AddonComponent component && param[ 1 ] is Mobile mobile )
|
||||
Activate( component, mobile );
|
||||
}
|
||||
|
||||
public virtual void Activate( AddonComponent c, Mobile from )
|
||||
|
|
@ -127,10 +127,8 @@ namespace Server.Items
|
|||
|
||||
private void Deactivate( object obj )
|
||||
{
|
||||
if ( obj is AddonComponent )
|
||||
if ( obj is AddonComponent c )
|
||||
{
|
||||
AddonComponent c = (AddonComponent) obj;
|
||||
|
||||
if ( c.ItemID == 0x1269 )
|
||||
c.ItemID = 0x1260;
|
||||
else if ( c.ItemID == 0x1260 )
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ namespace Server.Items
|
|||
{
|
||||
object[] param = (object[]) obj;
|
||||
|
||||
if ( param[ 0 ] is AddonComponent && param[ 1 ] is Mobile )
|
||||
Activate( (AddonComponent) param[ 0 ], (Mobile) param[ 1 ] );
|
||||
if ( param[ 0 ] is AddonComponent component && param[ 1 ] is Mobile mobile )
|
||||
Activate( component, mobile );
|
||||
}
|
||||
|
||||
public virtual void Activate( AddonComponent c, Mobile from )
|
||||
|
|
@ -99,8 +99,8 @@ namespace Server.Items
|
|||
|
||||
private void Deactivate( object obj )
|
||||
{
|
||||
if ( obj is AddonComponent )
|
||||
( (AddonComponent) obj ).ItemID = 0x1249;
|
||||
if ( obj is AddonComponent component )
|
||||
component.ItemID = 0x1249;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,9 +62,9 @@ namespace Server.Items
|
|||
{
|
||||
Item deed = this.Deed;
|
||||
|
||||
if ( this.Parent is Item )
|
||||
if ( this.Parent is Item item )
|
||||
{
|
||||
((Item)this.Parent).AddItem( deed );
|
||||
item.AddItem( deed );
|
||||
deed.Location = this.Location;
|
||||
}
|
||||
else
|
||||
|
|
@ -227,9 +227,7 @@ 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 );
|
||||
|
|
|
|||
|
|
@ -205,9 +205,7 @@ namespace Server.Gumps
|
|||
|
||||
if ( entry.From != null )
|
||||
{
|
||||
Account acc = entry.From.Account as Account;
|
||||
|
||||
if ( acc != null )
|
||||
if ( entry.From.Account is Account acc )
|
||||
name = String.Format( "{0} ({1})", entry.From.Name, acc );
|
||||
else
|
||||
name = entry.From.Name;
|
||||
|
|
|
|||
|
|
@ -322,9 +322,7 @@ namespace Server.Items
|
|||
|
||||
private bool HasEntered( Mobile from )
|
||||
{
|
||||
Account acc = from.Account as Account;
|
||||
|
||||
if ( acc == null )
|
||||
if ( !(from.Account is Account acc) )
|
||||
return false;
|
||||
|
||||
foreach ( RaffleEntry entry in m_Entries )
|
||||
|
|
@ -370,7 +368,7 @@ namespace Server.Items
|
|||
bool xEast = false, ySouth = false;
|
||||
|
||||
if ( Sextant.Format( loc, map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth ) )
|
||||
result.AppendFormat( "{0}°{1}'{2},{3}°{4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W" );
|
||||
result.AppendFormat( "{0}°{1}'{2},{3}°{4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W" );
|
||||
else
|
||||
result.AppendFormat( "{0},{1}", loc.X, loc.Y );
|
||||
|
||||
|
|
@ -492,9 +490,7 @@ namespace Server.Items
|
|||
if ( Deleted || m_State != HouseRaffleState.Active || !from.CheckAlive() || HasEntered( from ) || IsAtIPLimit( from ) )
|
||||
return;
|
||||
|
||||
Account acc = from.Account as Account;
|
||||
|
||||
if ( acc == null )
|
||||
if ( !(from.Account is Account) )
|
||||
return;
|
||||
|
||||
if ( okay )
|
||||
|
|
@ -619,7 +615,7 @@ namespace Server.Items
|
|||
}
|
||||
case 0:
|
||||
{
|
||||
bool oldActive = ( version < 3 ) ? reader.ReadBool() : false;
|
||||
bool oldActive = ( version < 3 ) && reader.ReadBool();
|
||||
|
||||
m_Bounds = reader.ReadRect2D();
|
||||
m_Facet = reader.ReadMap();
|
||||
|
|
|
|||
|
|
@ -130,9 +130,7 @@ namespace Server.Items
|
|||
|
||||
for ( int i = Items.Count - 1; i >= 0; i-- )
|
||||
{
|
||||
PlagueBeastComponent innard = Items[ i ] as PlagueBeastComponent;
|
||||
|
||||
if ( innard != null )
|
||||
if ( Items[ i ] is PlagueBeastComponent innard )
|
||||
{
|
||||
Rectangle2D r = ItemBounds.Table[ innard.ItemID ];
|
||||
|
||||
|
|
|
|||
|
|
@ -62,9 +62,7 @@ namespace Server.Items
|
|||
{
|
||||
for ( int i = 0; i < pack.Items.Count; i++ )
|
||||
{
|
||||
PlagueBeastMainOrgan main = pack.Items[ i ] as PlagueBeastMainOrgan;
|
||||
|
||||
if ( main != null && main.Complete )
|
||||
if ( pack.Items[ i ] is PlagueBeastMainOrgan main && main.Complete )
|
||||
main.FinishOpening( from );
|
||||
}
|
||||
}
|
||||
|
|
@ -104,7 +102,7 @@ namespace Server.Items
|
|||
|
||||
ItemID--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public PlagueBeastBlood( Serial serial ) : base( serial )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -136,8 +136,8 @@ namespace Server.Items
|
|||
{
|
||||
if ( m_Organ != null && m_Organ.OnDropped( from, dropped, this ) )
|
||||
{
|
||||
if ( dropped is PlagueBeastComponent )
|
||||
m_Organ.Components.Add( (PlagueBeastComponent) dropped );
|
||||
if ( dropped is PlagueBeastComponent component )
|
||||
m_Organ.Components.Add( component );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -55,9 +55,7 @@ namespace Server.Items
|
|||
|
||||
public void AddComponent( PlagueBeastComponent c, int x, int y )
|
||||
{
|
||||
Container pack = Parent as Container;
|
||||
|
||||
if ( pack != null )
|
||||
if ( Parent is Container pack )
|
||||
pack.DropItem( c );
|
||||
|
||||
c.Organ = this;
|
||||
|
|
|
|||
|
|
@ -56,9 +56,7 @@ namespace Server.Items
|
|||
if ( Owner != null )
|
||||
Owner.PlaySound( 0x199 );
|
||||
|
||||
PlagueBeastRubbleOrgan organ = Organ as PlagueBeastRubbleOrgan;
|
||||
|
||||
if ( organ != null )
|
||||
if ( Organ is PlagueBeastRubbleOrgan organ )
|
||||
organ.OnVeinCut( from, this );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -199,9 +199,8 @@ namespace Server.Items
|
|||
{
|
||||
MessageHelper.SendLocalizedMessageTo( m_Bag, from, 1042544, 0x59 ); // This item is out of charges.
|
||||
}
|
||||
else if ( targeted is Item )
|
||||
else if ( targeted is Item item )
|
||||
{
|
||||
Item item = (Item)targeted;
|
||||
int reqCharges = (int)Math.Max( 1, Math.Ceiling( item.TotalWeight / 10.0 ) );
|
||||
|
||||
if ( !item.IsChildOf( from.Backpack ) )
|
||||
|
|
|
|||
|
|
@ -199,10 +199,8 @@ namespace Server.Items
|
|||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
else if ( targeted is BaseCreature )
|
||||
else if ( targeted is BaseCreature creature )
|
||||
{
|
||||
BaseCreature creature = (BaseCreature)targeted;
|
||||
|
||||
if ( !creature.Controlled || creature.ControlMaster != from )
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo( m_Ball, from, 1054117, 0x59 ); // You may only link your own pets to a Crystal Ball of Pet Summoning.
|
||||
|
|
@ -240,7 +238,7 @@ namespace Server.Items
|
|||
{
|
||||
SendLocalizedMessageTo( from, 1054122 ); // The Crystal Ball darkens. It must be charged before it can be used again.
|
||||
}
|
||||
else if ( pet is BaseMount && ((BaseMount)pet).Rider == from )
|
||||
else if ( pet is BaseMount mount && mount.Rider == from )
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo( this, from, 1054124, 0x36 ); // The Crystal Ball fills with a yellow mist. Why would you summon your pet while riding it?
|
||||
}
|
||||
|
|
@ -260,9 +258,9 @@ namespace Server.Items
|
|||
{
|
||||
from.Send( new AsciiMessage( this.Serial, this.ItemID, MessageType.Regular, 0x22, 3, "", "You cannot summon your pet to this location." ) );
|
||||
}
|
||||
else if ( Core.ML && from is PlayerMobile && DateTime.UtcNow < ((PlayerMobile)from).LastPetBallTime.AddSeconds( 15.0 ) )
|
||||
else if ( Core.ML && from is PlayerMobile mobile && DateTime.UtcNow < mobile.LastPetBallTime.AddSeconds( 15.0 ) )
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo( this, from, 1080072, 0x22 ); // You must wait a few seconds before you can summon your pet.
|
||||
MessageHelper.SendLocalizedMessageTo( this, mobile, 1080072, 0x22 ); // You must wait a few seconds before you can summon your pet.
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -298,17 +296,17 @@ namespace Server.Items
|
|||
pet.StabledBy = null;
|
||||
from.Stabled.Remove( pet );
|
||||
|
||||
if ( from is PlayerMobile )
|
||||
((PlayerMobile)from).AutoStabled.Remove( pet );
|
||||
if ( from is PlayerMobile mobile )
|
||||
mobile.AutoStabled.Remove( pet );
|
||||
}
|
||||
|
||||
pet.MoveToWorld( from.Location, from.Map );
|
||||
|
||||
MessageHelper.SendLocalizedMessageTo( this, from, 1054128, 0x43 ); // The Crystal Ball fills with a green mist. Your pet has been summoned.
|
||||
|
||||
if ( from is PlayerMobile )
|
||||
if ( from is PlayerMobile playerMobile )
|
||||
{
|
||||
((PlayerMobile)from).LastPetBallTime = DateTime.UtcNow;
|
||||
playerMobile.LastPetBallTime = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -204,9 +204,7 @@ namespace Server.Items
|
|||
|
||||
if ( m_Bracelet.CheckUse( m_From, false ) )
|
||||
{
|
||||
Mobile boundRoot = m_Bracelet.Bound.RootParent as Mobile;
|
||||
|
||||
if ( boundRoot != null )
|
||||
if ( m_Bracelet.Bound.RootParent is Mobile boundRoot )
|
||||
{
|
||||
m_Bracelet.Charges--;
|
||||
|
||||
|
|
@ -279,9 +277,9 @@ namespace Server.Items
|
|||
{
|
||||
return false;
|
||||
}
|
||||
else if ( boundRoot.Map == Map.Felucca && from is PlayerMobile && ((PlayerMobile)from).Young )
|
||||
else if ( boundRoot.Map == Map.Felucca && 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.
|
||||
return false;
|
||||
}
|
||||
else if ( from.Kills >= 5 && boundRoot.Map != Map.Felucca )
|
||||
|
|
@ -357,10 +355,8 @@ namespace Server.Items
|
|||
{
|
||||
from.SendLocalizedMessage( 1042664 ); // You must have the object in your backpack to use it.
|
||||
}
|
||||
else if ( targeted is BraceletOfBinding )
|
||||
else if ( targeted is BraceletOfBinding bindBracelet )
|
||||
{
|
||||
BraceletOfBinding bindBracelet = (BraceletOfBinding)targeted;
|
||||
|
||||
if ( bindBracelet == m_Bracelet )
|
||||
{
|
||||
from.SendLocalizedMessage( 1054012 ); // You cannot bind a bracelet of binding to itself!
|
||||
|
|
@ -471,4 +467,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,10 +59,8 @@ namespace Server.Items
|
|||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
}
|
||||
else if ( targeted is TranslocationItem )
|
||||
else if ( targeted is TranslocationItem transItem )
|
||||
{
|
||||
TranslocationItem transItem = (TranslocationItem)targeted;
|
||||
|
||||
if ( transItem.Charges >= transItem.MaxCharges )
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo( m_Powder, from, 1054137, 0x59 ); // This item cannot absorb any more powder of translocation.
|
||||
|
|
@ -88,10 +86,10 @@ namespace Server.Items
|
|||
m_Powder.Delete();
|
||||
}
|
||||
|
||||
if ( transItem is Item )
|
||||
if ( transItem is Item item )
|
||||
{
|
||||
// The ~1_translocationItem~ glows with green energy and absorbs magical power from the powder.
|
||||
MessageHelper.SendLocalizedMessageTo( (Item)transItem, from, 1054139, transItem.TranslocationItemName, 0x43 );
|
||||
MessageHelper.SendLocalizedMessageTo( item, from, 1054139, transItem.TranslocationItemName, 0x43 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -120,4 +118,4 @@ namespace Server.Items
|
|||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -642,10 +642,8 @@ namespace Server.Items
|
|||
|
||||
Effects.SendTargetParticles( from, 0x375A, 35, 90, 0x00, 0x00, 9502, (EffectLayer)255, 0x100 );
|
||||
|
||||
if ( m_Stone is SoulstoneFragment )
|
||||
if ( m_Stone is SoulstoneFragment frag )
|
||||
{
|
||||
SoulstoneFragment frag = m_Stone as SoulstoneFragment;
|
||||
|
||||
if ( --frag.UsesRemaining <= 0 )
|
||||
from.SendLocalizedMessage( 1070974 ); // You have used up your soulstone fragment.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,9 +66,7 @@ namespace Server.Items
|
|||
if ( !base.CanUse( from ) )
|
||||
return false;
|
||||
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return false;
|
||||
|
||||
#region Mondain's Legacy
|
||||
|
|
@ -109,9 +107,7 @@ namespace Server.Items
|
|||
if ( !CanUse( from ) )
|
||||
return;
|
||||
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return;
|
||||
|
||||
double tskill = from.Skills[Skill].Base;
|
||||
|
|
@ -130,9 +126,6 @@ namespace Server.Items
|
|||
Effects.SendTargetParticles( from, 0x373A, 35, 45, 0x00, 0x00, 9502, (EffectLayer)255, 0x100 );
|
||||
|
||||
pm.AcceleratedStart = DateTime.UtcNow + TimeSpan.FromMinutes(15);
|
||||
|
||||
Timer t = (Timer)m_Table[from];
|
||||
|
||||
m_Table[from] = Timer.DelayCall( TimeSpan.FromMinutes( 15 ), new TimerStateCallback( Expire_Callback ), from );
|
||||
|
||||
pm.AcceleratedSkill = Skill;
|
||||
|
|
|
|||
|
|
@ -54,9 +54,7 @@ namespace Server.Items
|
|||
if ( !base.CanUse( from ) )
|
||||
return false;
|
||||
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return false;
|
||||
|
||||
#region Mondain's Legacy
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ namespace Server.Items
|
|||
|
||||
int newValue = (int)Value;
|
||||
|
||||
if ( from is PlayerMobile && ((PlayerMobile)from).HasStatReward )
|
||||
if ( from is PlayerMobile mobile && mobile.HasStatReward )
|
||||
newValue += 5;
|
||||
|
||||
if ( from.StatCap >= newValue )
|
||||
|
|
@ -95,8 +95,8 @@ namespace Server.Items
|
|||
|
||||
from.SendLocalizedMessage( 1049512 ); // You feel a surge of magic as the scroll enhances your powers!
|
||||
|
||||
if ( from is PlayerMobile && ((PlayerMobile)from).HasStatReward )
|
||||
from.StatCap = (int)Value + 5;
|
||||
if ( from is PlayerMobile mobile && mobile.HasStatReward )
|
||||
mobile.StatCap = (int)Value + 5;
|
||||
else
|
||||
from.StatCap = (int)Value;
|
||||
|
||||
|
|
|
|||
|
|
@ -73,10 +73,8 @@ namespace Server.Items
|
|||
{
|
||||
if (!Deleted)
|
||||
{
|
||||
if (targeted != null && targeted is Mobile)
|
||||
if (targeted != null && targeted is Mobile to)
|
||||
{
|
||||
Mobile to = targeted as Mobile;
|
||||
|
||||
if (to is PlayerMobile)
|
||||
{
|
||||
if (to != from)
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ namespace Server.Items
|
|||
{
|
||||
base.GetContextMenuEntries( from, list );
|
||||
|
||||
if ( from is PlayerMobile )
|
||||
list.Add( new LockKarmaEntry( (PlayerMobile)from, Addon as AnkhOfSacrificeAddon ) );
|
||||
if ( from is PlayerMobile mobile )
|
||||
list.Add( new LockKarmaEntry( mobile, Addon as AnkhOfSacrificeAddon ) );
|
||||
|
||||
list.Add( new ResurrectEntry( from, Addon as AnkhOfSacrificeAddon ) );
|
||||
}
|
||||
|
|
@ -140,9 +140,9 @@ namespace Server.Items
|
|||
return;
|
||||
}
|
||||
|
||||
if ( from is PlayerMobile )
|
||||
if ( from is PlayerMobile mobile )
|
||||
{
|
||||
((PlayerMobile) from).AnkhNextUse = DateTime.UtcNow + TimeSpan.FromHours( 1 );
|
||||
mobile.AnkhNextUse = DateTime.UtcNow + TimeSpan.FromHours( 1 );
|
||||
}
|
||||
|
||||
base.OnResponse( state, info );
|
||||
|
|
|
|||
|
|
@ -26,12 +26,12 @@ namespace Server.Items
|
|||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
if ( Addon is CannonAddon )
|
||||
if ( Addon is CannonAddon addon )
|
||||
{
|
||||
if ( ((CannonAddon) Addon).IsRewardItem )
|
||||
if ( addon.IsRewardItem )
|
||||
list.Add( 1076223 ); // 7th Year Veteran Reward
|
||||
|
||||
list.Add( 1076207, ((CannonAddon) Addon).Charges.ToString() ); // Remaining Charges: ~1_val~
|
||||
list.Add( 1076207, addon.Charges.ToString() ); // Remaining Charges: ~1_val~
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -260,9 +260,7 @@ namespace Server.Items
|
|||
if ( m_Cannon == null || m_Cannon.Deleted )
|
||||
return;
|
||||
|
||||
IPoint3D p = targeted as IPoint3D;
|
||||
|
||||
if ( p == null )
|
||||
if ( !(targeted is IPoint3D p) )
|
||||
return;
|
||||
|
||||
if ( from.InLOS( new Point3D( p ) ) )
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace Server.Items
|
|||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
if ( Addon is StoneAnkh && ((StoneAnkh) Addon).IsRewardItem )
|
||||
if ( Addon is StoneAnkh ankh && ankh.IsRewardItem )
|
||||
list.Add( 1076221 ); // 5th Year Veteran Reward
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -189,10 +189,8 @@ namespace Server.Items
|
|||
if ( m_Tool == null || m_Tool.Deleted )
|
||||
return;
|
||||
|
||||
if ( targeted is BaseWeapon )
|
||||
if ( targeted is BaseWeapon item )
|
||||
{
|
||||
BaseWeapon item = (BaseWeapon) targeted;
|
||||
|
||||
from.CloseGump( typeof( InternalGump ) );
|
||||
from.SendGump( new InternalGump( m_Tool, item ) );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ namespace Server.Items
|
|||
{
|
||||
object root = RootParent;
|
||||
|
||||
if ( root is Mobile && ((Mobile)root).AccessLevel < m_AccessLevel )
|
||||
if ( root is Mobile mobile && mobile.AccessLevel < m_AccessLevel )
|
||||
{
|
||||
Delete();
|
||||
return false;
|
||||
|
|
@ -88,4 +88,4 @@ namespace Server.Items
|
|||
return ( from.AccessLevel >= m_AccessLevel );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,9 +211,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnAfterDuped(Item newItem)
|
||||
{
|
||||
BaseTalisman talisman = newItem as BaseTalisman;
|
||||
|
||||
if (talisman == null)
|
||||
if (!(newItem is BaseTalisman talisman))
|
||||
return;
|
||||
|
||||
talisman.m_Summoner = new TalismanAttribute(m_Summoner);
|
||||
|
|
@ -236,10 +234,8 @@ namespace Server.Items
|
|||
|
||||
public override void OnAdded(IEntity parent)
|
||||
{
|
||||
if (parent is Mobile)
|
||||
if (parent is Mobile from)
|
||||
{
|
||||
Mobile from = (Mobile)parent;
|
||||
|
||||
m_AosSkillBonuses.AddTo(from);
|
||||
m_AosAttributes.AddStatBonuses(from);
|
||||
|
||||
|
|
@ -261,10 +257,8 @@ namespace Server.Items
|
|||
|
||||
public override void OnRemoved(IEntity parent)
|
||||
{
|
||||
if (parent is Mobile)
|
||||
if (parent is Mobile from)
|
||||
{
|
||||
Mobile from = (Mobile)parent;
|
||||
|
||||
m_AosSkillBonuses.Remove();
|
||||
m_AosAttributes.RemoveStatBonuses(from);
|
||||
|
||||
|
|
@ -304,9 +298,8 @@ namespace Server.Items
|
|||
try { obj = Activator.CreateInstance(type); }
|
||||
catch { obj = null; }
|
||||
|
||||
if (obj is Item)
|
||||
if (obj is Item item)
|
||||
{
|
||||
Item item = (Item)obj;
|
||||
int count = 1;
|
||||
|
||||
if (m_Summoner != null && m_Summoner.Amount > 1)
|
||||
|
|
@ -340,13 +333,11 @@ namespace Server.Items
|
|||
from.SendLocalizedMessage(1075001); // You have been given some ingots.
|
||||
else if (item is Bandage)
|
||||
from.SendLocalizedMessage(1075002); // You have been given some clean bandages.
|
||||
else if (m_Summoner != null && m_Summoner.Name != null)
|
||||
else if (m_Summoner?.Name != null)
|
||||
from.SendLocalizedMessage(1074853, m_Summoner.Name.ToString()); // You have been given ~1_name~
|
||||
}
|
||||
else if (obj is BaseCreature)
|
||||
else if (obj is BaseCreature mob)
|
||||
{
|
||||
BaseCreature mob = (BaseCreature)obj;
|
||||
|
||||
if ((m_Creature != null && !m_Creature.Deleted) || from.Followers + mob.ControlSlots > from.FollowersMax)
|
||||
{
|
||||
from.SendLocalizedMessage(1074270); // You have too many followers to summon another one.
|
||||
|
|
@ -682,10 +673,8 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
if (Parent is Mobile)
|
||||
if (Parent is Mobile m)
|
||||
{
|
||||
Mobile m = (Mobile)Parent;
|
||||
|
||||
m_AosAttributes.AddStatBonuses(m);
|
||||
m_AosSkillBonuses.AddTo(m);
|
||||
|
||||
|
|
|
|||
|
|
@ -57,10 +57,8 @@ namespace Server.Items
|
|||
if ( m_Item == null || m_Item.Deleted )
|
||||
return;
|
||||
|
||||
if ( o is BaseTalisman )
|
||||
if ( o is BaseTalisman talisman )
|
||||
{
|
||||
BaseTalisman talisman = (BaseTalisman) o;
|
||||
|
||||
if ( talisman.Charges == 0 )
|
||||
{
|
||||
talisman.Charges = talisman.MaxCharges;
|
||||
|
|
|
|||
|
|
@ -21,8 +21,7 @@ namespace Server.Items
|
|||
|
||||
public virtual void StopTimer()
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
m_Timer = null;
|
||||
}
|
||||
|
|
@ -178,4 +177,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,17 +117,15 @@ namespace Server.Items
|
|||
{
|
||||
Item item = Loot.RandomArmorOrShieldOrWeapon();
|
||||
|
||||
if ( item is BaseWeapon )
|
||||
if ( item is BaseWeapon weapon )
|
||||
{
|
||||
BaseWeapon weapon = ( BaseWeapon )item;
|
||||
weapon.DamageLevel = ( WeaponDamageLevel )Utility.Random( m_Level );
|
||||
weapon.AccuracyLevel = ( WeaponAccuracyLevel )Utility.Random( m_Level );
|
||||
weapon.DurabilityLevel = ( WeaponDurabilityLevel )Utility.Random( m_Level );
|
||||
weapon.Quality = WeaponQuality.Regular;
|
||||
}
|
||||
else if ( item is BaseArmor )
|
||||
else if ( item is BaseArmor armor )
|
||||
{
|
||||
BaseArmor armor = ( BaseArmor )item;
|
||||
armor.ProtectionLevel = ( ArmorProtectionLevel )Utility.Random( m_Level );
|
||||
armor.Durability = ( ArmorDurabilityLevel )Utility.Random( m_Level );
|
||||
armor.Quality = ArmorQuality.Regular;
|
||||
|
|
|
|||
|
|
@ -124,17 +124,15 @@ namespace Server.Items
|
|||
{
|
||||
Item item = Loot.RandomArmorOrShieldOrWeapon();
|
||||
|
||||
if ( item is BaseWeapon )
|
||||
if ( item is BaseWeapon weapon )
|
||||
{
|
||||
BaseWeapon weapon = ( BaseWeapon )item;
|
||||
weapon.DamageLevel = ( WeaponDamageLevel )Utility.Random( m_Level );
|
||||
weapon.AccuracyLevel = ( WeaponAccuracyLevel )Utility.Random( m_Level );
|
||||
weapon.DurabilityLevel = ( WeaponDurabilityLevel )Utility.Random( m_Level );
|
||||
weapon.Quality = WeaponQuality.Regular;
|
||||
}
|
||||
else if ( item is BaseArmor )
|
||||
else if ( item is BaseArmor armor )
|
||||
{
|
||||
BaseArmor armor = ( BaseArmor )item;
|
||||
armor.ProtectionLevel = ( ArmorProtectionLevel )Utility.Random( m_Level );
|
||||
armor.Durability = ( ArmorDurabilityLevel )Utility.Random( m_Level );
|
||||
armor.Quality = ArmorQuality.Regular;
|
||||
|
|
|
|||
|
|
@ -33,15 +33,20 @@ namespace Server.Items
|
|||
|
||||
public override bool OnWandTarget( Mobile from, object o )
|
||||
{
|
||||
if ( o is BaseWeapon )
|
||||
((BaseWeapon)o).Identified = true;
|
||||
else if ( o is BaseArmor )
|
||||
((BaseArmor)o).Identified = true;
|
||||
if (o is Item item)
|
||||
{
|
||||
if ( item is BaseWeapon weapon )
|
||||
weapon.Identified = true;
|
||||
else if ( item is BaseArmor armor )
|
||||
armor.Identified = true;
|
||||
|
||||
if ( !Core.AOS && o is Item )
|
||||
((Item)o).OnSingleClick( from );
|
||||
if (!Core.AOS)
|
||||
item.OnSingleClick( from );
|
||||
|
||||
return ( o is Item );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ namespace Server.Items
|
|||
TransformContext context = TransformationSpellHelper.GetContext( defender );
|
||||
|
||||
if ( (context != null && ( context.Type == typeof( LichFormSpell ) || context.Type == typeof( WraithFormSpell ))) ||
|
||||
(defender is BaseCreature && ((BaseCreature)defender).BleedImmune) )
|
||||
(defender is BaseCreature creature && creature.BleedImmune) )
|
||||
{
|
||||
attacker.SendLocalizedMessage( 1062052 ); // Your target is not affected by the bleed attack!
|
||||
return;
|
||||
|
|
@ -63,8 +63,7 @@ namespace Server.Items
|
|||
{
|
||||
Timer t = (Timer)m_Table[m];
|
||||
|
||||
if ( t != null )
|
||||
t.Stop();
|
||||
t?.Stop();
|
||||
|
||||
t = new InternalTimer( from, m );
|
||||
m_Table[m] = t;
|
||||
|
|
|
|||
|
|
@ -60,9 +60,7 @@ namespace Server.Items
|
|||
|
||||
public static bool GetBonus( Mobile targ, ref int bonus )
|
||||
{
|
||||
BlockInfo info = m_Table[targ] as BlockInfo;
|
||||
|
||||
if ( info == null )
|
||||
if ( !(m_Table[targ] is BlockInfo info) )
|
||||
return false;
|
||||
|
||||
bonus = info.m_Bonus;
|
||||
|
|
@ -81,12 +79,9 @@ namespace Server.Items
|
|||
|
||||
public static void EndBlock( Mobile m )
|
||||
{
|
||||
BlockInfo info = m_Table[m] as BlockInfo;
|
||||
|
||||
if ( info != null )
|
||||
if ( m_Table[m] is BlockInfo info )
|
||||
{
|
||||
if ( info.m_Timer != null )
|
||||
info.m_Timer.Stop();
|
||||
info.m_Timer?.Stop();
|
||||
|
||||
m_Table.Remove( m );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,9 +39,7 @@ namespace Server.Items
|
|||
|
||||
int modifier = (int)(30.0 * ((Math.Max( attacker.Skills[SkillName.Bushido].Value, attacker.Skills[SkillName.Ninjitsu].Value ) - 50.0) / 70.0));
|
||||
|
||||
DefenseMasteryInfo info = m_Table[attacker] as DefenseMasteryInfo;
|
||||
|
||||
if ( info != null )
|
||||
if ( m_Table[attacker] is DefenseMasteryInfo info )
|
||||
EndDefense( (object)info );
|
||||
|
||||
ResistanceMod mod = new ResistanceMod( ResistanceType.Physical, 50 + modifier );
|
||||
|
|
@ -74,9 +72,7 @@ namespace Server.Items
|
|||
|
||||
public static bool GetMalus( Mobile targ, ref int damageMalus )
|
||||
{
|
||||
DefenseMasteryInfo info = m_Table[targ] as DefenseMasteryInfo;
|
||||
|
||||
if ( info == null )
|
||||
if ( !(m_Table[targ] is DefenseMasteryInfo info) )
|
||||
return false;
|
||||
|
||||
damageMalus = info.m_DamageMalus;
|
||||
|
|
@ -90,8 +86,7 @@ namespace Server.Items
|
|||
if ( info.m_Mod != null )
|
||||
info.m_From.RemoveResistanceMod( info.m_Mod );
|
||||
|
||||
if ( info.m_Timer != null )
|
||||
info.m_Timer.Stop();
|
||||
info.m_Timer?.Stop();
|
||||
|
||||
// No message is sent to the player.
|
||||
|
||||
|
|
|
|||
|
|
@ -35,9 +35,7 @@ namespace Server.Items
|
|||
|
||||
public override bool RequiresTactics( Mobile from )
|
||||
{
|
||||
BaseWeapon weapon = from.Weapon as BaseWeapon;
|
||||
|
||||
if ( weapon == null )
|
||||
if ( !(from.Weapon is BaseWeapon weapon) )
|
||||
return false;
|
||||
|
||||
return weapon.Skill != SkillName.Wrestling;
|
||||
|
|
|
|||
|
|
@ -72,36 +72,32 @@ namespace Server.Items
|
|||
defender.PlaySound( 0x140 );
|
||||
defender.FixedParticles( 0x3728, 10, 15, 9955, EffectLayer.Waist );
|
||||
|
||||
if (defender is PlayerMobile)
|
||||
if (defender is PlayerMobile mobile)
|
||||
{
|
||||
if (Server.Spells.Ninjitsu.AnimalForm.UnderTransformation(defender))
|
||||
if (Server.Spells.Ninjitsu.AnimalForm.UnderTransformation(mobile))
|
||||
{
|
||||
defender.SendLocalizedMessage(1114066, attacker.Name); // ~1_NAME~ knocked you out of animal form!
|
||||
mobile.SendLocalizedMessage(1114066, attacker.Name); // ~1_NAME~ knocked you out of animal form!
|
||||
}
|
||||
else if (defender.Mounted)
|
||||
else if (mobile.Mounted)
|
||||
{
|
||||
defender.SendLocalizedMessage(1040023); // You have been knocked off of your mount!
|
||||
mobile.SendLocalizedMessage(1040023); // You have been knocked off of your mount!
|
||||
}
|
||||
|
||||
(defender as PlayerMobile).SetMountBlock(BlockMountType.Dazed, TimeSpan.FromSeconds(10), true);
|
||||
mobile.SetMountBlock(BlockMountType.Dazed, TimeSpan.FromSeconds(10), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
defender.Mount.Rider = null;
|
||||
}
|
||||
|
||||
if ( attacker is PlayerMobile )
|
||||
if ( attacker is PlayerMobile playerMobile )
|
||||
{
|
||||
(attacker as PlayerMobile).SetMountBlock(BlockMountType.DismountRecovery, RemountDelay, true );
|
||||
playerMobile.SetMountBlock(BlockMountType.DismountRecovery, RemountDelay, true );
|
||||
}
|
||||
else if ( Core.ML && attacker is BaseCreature )
|
||||
else if ( Core.ML && attacker is BaseCreature bc )
|
||||
{
|
||||
BaseCreature bc = attacker as BaseCreature;
|
||||
|
||||
if ( bc.ControlMaster is PlayerMobile )
|
||||
if ( bc.ControlMaster is PlayerMobile pm )
|
||||
{
|
||||
PlayerMobile pm = bc.ControlMaster as PlayerMobile;
|
||||
|
||||
pm.SetMountBlock(BlockMountType.DismountRecovery, RemountDelay, false );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,9 +43,7 @@ namespace Server.Items
|
|||
if ( map == null )
|
||||
return;
|
||||
|
||||
BaseWeapon weapon = attacker.Weapon as BaseWeapon;
|
||||
|
||||
if ( weapon == null )
|
||||
if ( !(attacker.Weapon is BaseWeapon weapon) )
|
||||
return;
|
||||
|
||||
ArrayList list = new ArrayList();
|
||||
|
|
@ -88,9 +86,7 @@ namespace Server.Items
|
|||
Mobile m = (Mobile)targets[i];
|
||||
attacker.DoHarmful( m, true );
|
||||
|
||||
Timer t = Registry[m] as Timer;
|
||||
|
||||
if ( t != null )
|
||||
if ( Registry[m] is Timer t )
|
||||
{
|
||||
t.Stop();
|
||||
Registry.Remove( m );
|
||||
|
|
|
|||
|
|
@ -32,9 +32,7 @@ namespace Server.Items
|
|||
|
||||
ClearCurrentAbility( attacker );
|
||||
|
||||
BaseWeapon weapon = attacker.Weapon as BaseWeapon;
|
||||
|
||||
if ( weapon == null )
|
||||
if ( !(attacker.Weapon is BaseWeapon weapon) )
|
||||
return;
|
||||
|
||||
Poison p = weapon.Poison;
|
||||
|
|
|
|||
|
|
@ -40,9 +40,7 @@ namespace Server.Items
|
|||
|
||||
public override bool RequiresTactics( Mobile from )
|
||||
{
|
||||
BaseWeapon weapon = from.Weapon as BaseWeapon;
|
||||
|
||||
if ( weapon == null )
|
||||
if ( !(from.Weapon is BaseWeapon weapon) )
|
||||
return true;
|
||||
|
||||
return weapon.Skill != SkillName.Wrestling;
|
||||
|
|
|
|||
|
|
@ -85,9 +85,7 @@ namespace Server.Items
|
|||
|
||||
public virtual bool CheckWeaponSkill( Mobile from )
|
||||
{
|
||||
BaseWeapon weapon = from.Weapon as BaseWeapon;
|
||||
|
||||
if ( weapon == null )
|
||||
if ( !(from.Weapon is BaseWeapon weapon) )
|
||||
return false;
|
||||
|
||||
Skill skill = from.Skills[weapon.Skill];
|
||||
|
|
@ -141,7 +139,7 @@ namespace Server.Items
|
|||
|
||||
if ( from.Mana < mana )
|
||||
{
|
||||
if ( ( from is BaseCreature ) && ( from as BaseCreature ).HasManaOveride )
|
||||
if ( from is BaseCreature creature && creature.HasManaOveride )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -336,9 +334,7 @@ namespace Server.Items
|
|||
if ( !m.Player )
|
||||
return true;
|
||||
|
||||
BaseWeapon weapon = m.Weapon as BaseWeapon;
|
||||
|
||||
return ( weapon != null && (weapon.PrimaryAbility == a || weapon.SecondaryAbility == a) );
|
||||
return ( m.Weapon is BaseWeapon weapon && (weapon.PrimaryAbility == a || weapon.SecondaryAbility == a) );
|
||||
}
|
||||
|
||||
public virtual bool ValidatesDuringHit => true;
|
||||
|
|
|
|||
|
|
@ -28,9 +28,7 @@ namespace Server.Items
|
|||
if ( map == null )
|
||||
return;
|
||||
|
||||
BaseWeapon weapon = attacker.Weapon as BaseWeapon;
|
||||
|
||||
if ( weapon == null )
|
||||
if ( !(attacker.Weapon is BaseWeapon weapon) )
|
||||
return;
|
||||
|
||||
if ( !CheckMana( attacker, true ) )
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
public override void OnHit( Mobile attacker, Mobile defender, double damageBonus )
|
||||
public override void OnHit( Mobile attacker, Mobile defender, double damageBonus = 1 )
|
||||
{
|
||||
base.OnHit( attacker, defender, damageBonus );
|
||||
|
||||
|
|
|
|||
|
|
@ -413,15 +413,14 @@ namespace Server.Items
|
|||
{
|
||||
if ( m_AccuracyLevel == WeaponAccuracyLevel.Regular )
|
||||
{
|
||||
if ( m_SkillMod != null )
|
||||
m_SkillMod.Remove();
|
||||
m_SkillMod?.Remove();
|
||||
|
||||
m_SkillMod = null;
|
||||
}
|
||||
else if ( m_SkillMod == null && Parent is Mobile )
|
||||
else if ( m_SkillMod == null && Parent is Mobile mobile )
|
||||
{
|
||||
m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5 );
|
||||
((Mobile)Parent).AddSkillMod( m_SkillMod );
|
||||
mobile.AddSkillMod( m_SkillMod );
|
||||
}
|
||||
else if ( m_SkillMod != null )
|
||||
{
|
||||
|
|
@ -438,9 +437,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnAfterDuped( Item newItem )
|
||||
{
|
||||
BaseWeapon weap = newItem as BaseWeapon;
|
||||
|
||||
if ( weap == null )
|
||||
if ( !(newItem is BaseWeapon weap) )
|
||||
return;
|
||||
|
||||
weap.m_AosAttributes = new AosAttributes( newItem, m_AosAttributes );
|
||||
|
|
@ -507,15 +504,10 @@ namespace Server.Items
|
|||
|
||||
int v = m_AosWeaponAttributes.LowerStatReq;
|
||||
|
||||
CraftResourceInfo info = CraftResources.GetInfo( m_Resource );
|
||||
CraftAttributeInfo attrInfo = CraftResources.GetInfo( m_Resource )?.AttributeInfo;
|
||||
|
||||
if ( info != null )
|
||||
{
|
||||
CraftAttributeInfo attrInfo = info.AttributeInfo;
|
||||
|
||||
if ( attrInfo != null )
|
||||
v += attrInfo.WeaponLowerRequirements;
|
||||
}
|
||||
if ( attrInfo != null )
|
||||
v += attrInfo.WeaponLowerRequirements;
|
||||
|
||||
if ( v > 100 )
|
||||
v = 100;
|
||||
|
|
@ -587,29 +579,27 @@ namespace Server.Items
|
|||
|
||||
return false;
|
||||
}
|
||||
else if ( from.Dex < DexRequirement )
|
||||
if ( from.Dex < DexRequirement )
|
||||
{
|
||||
from.SendMessage( "You are not nimble enough to equip that." );
|
||||
return false;
|
||||
}
|
||||
else if ( from.Str < AOS.Scale( StrRequirement, 100 - GetLowerStatReq() ) )
|
||||
if ( from.Str < AOS.Scale( StrRequirement, 100 - GetLowerStatReq() ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 500213 ); // You are not strong enough to equip that.
|
||||
return false;
|
||||
}
|
||||
else if ( from.Int < IntRequirement )
|
||||
if ( from.Int < IntRequirement )
|
||||
{
|
||||
from.SendMessage( "You are not smart enough to equip that." );
|
||||
return false;
|
||||
}
|
||||
else if ( !from.CanBeginAction( typeof( BaseWeapon ) ) )
|
||||
if ( !from.CanBeginAction( typeof( BaseWeapon ) ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return base.CanEquip( from );
|
||||
}
|
||||
|
||||
return base.CanEquip( from );
|
||||
}
|
||||
|
||||
public virtual bool UseSkillMod{ get{ return !Core.AOS; } }
|
||||
|
|
@ -640,8 +630,7 @@ namespace Server.Items
|
|||
|
||||
if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular )
|
||||
{
|
||||
if ( m_SkillMod != null )
|
||||
m_SkillMod.Remove();
|
||||
m_SkillMod?.Remove();
|
||||
|
||||
m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5 );
|
||||
from.AddSkillMod( m_SkillMod );
|
||||
|
|
@ -649,8 +638,7 @@ namespace Server.Items
|
|||
|
||||
if ( Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 )
|
||||
{
|
||||
if ( m_MageMod != null )
|
||||
m_MageMod.Remove();
|
||||
m_MageMod?.Remove();
|
||||
|
||||
m_MageMod = new DefaultSkillMod( SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon );
|
||||
from.AddSkillMod( m_MageMod );
|
||||
|
|
@ -663,10 +651,8 @@ namespace Server.Items
|
|||
{
|
||||
base.OnAdded( parent );
|
||||
|
||||
if ( parent is Mobile )
|
||||
if ( parent is Mobile from )
|
||||
{
|
||||
Mobile from = (Mobile)parent;
|
||||
|
||||
if ( Core.AOS )
|
||||
m_AosSkillBonuses.AddTo( from );
|
||||
|
||||
|
|
@ -677,9 +663,8 @@ namespace Server.Items
|
|||
|
||||
public override void OnRemoved(IEntity parent)
|
||||
{
|
||||
if ( parent is Mobile )
|
||||
if ( parent is Mobile m )
|
||||
{
|
||||
Mobile m = (Mobile)parent;
|
||||
BaseWeapon weapon = m.Weapon as BaseWeapon;
|
||||
|
||||
string modName = this.Serial.ToString();
|
||||
|
|
@ -729,7 +714,7 @@ namespace Server.Items
|
|||
val = swrd;
|
||||
|
||||
if ( fenc > val ){ sk = SkillName.Fencing; val = fenc; }
|
||||
if ( mcng > val ){ sk = SkillName.Macing; val = mcng; }
|
||||
if ( mcng > val ){ sk = SkillName.Macing; }
|
||||
}
|
||||
else if ( m_AosWeaponAttributes.MageWeapon != 0 )
|
||||
{
|
||||
|
|
@ -770,7 +755,7 @@ namespace Server.Items
|
|||
BaseWeapon defWeapon = defender.Weapon as BaseWeapon;
|
||||
|
||||
Skill atkSkill = attacker.Skills[atkWeapon.Skill];
|
||||
Skill defSkill = defender.Skills[defWeapon.Skill];
|
||||
// Skill defSkill = defender.Skills[defWeapon.Skill];
|
||||
|
||||
double atkValue = atkWeapon.GetAttackSkillValue( attacker, defender );
|
||||
double defValue = defWeapon.GetDefendSkillValue( attacker, defender );
|
||||
|
|
@ -901,8 +886,8 @@ namespace Server.Items
|
|||
|
||||
TransformContext context = TransformationSpellHelper.GetContext( m );
|
||||
|
||||
if ( context != null && context.Spell is ReaperFormSpell )
|
||||
bonus += ((ReaperFormSpell)context.Spell).SwingSpeedBonus;
|
||||
if ( context?.Spell is ReaperFormSpell spell )
|
||||
bonus += spell.SwingSpeedBonus;
|
||||
|
||||
int discordanceEffect = 0;
|
||||
|
||||
|
|
@ -1009,24 +994,18 @@ namespace Server.Items
|
|||
|
||||
if ( canSwing )
|
||||
{
|
||||
Spell sp = attacker.Spell as Spell;
|
||||
|
||||
canSwing = ( sp == null || !sp.IsCasting || !sp.BlocksMovement );
|
||||
canSwing = ( !(attacker.Spell is Spell sp) || !sp.IsCasting || !sp.BlocksMovement );
|
||||
}
|
||||
|
||||
if ( canSwing )
|
||||
{
|
||||
PlayerMobile p = attacker as PlayerMobile;
|
||||
|
||||
canSwing = ( p == null || p.PeacedUntil <= DateTime.UtcNow );
|
||||
canSwing = ( !(attacker is PlayerMobile p) || p.PeacedUntil <= DateTime.UtcNow );
|
||||
}
|
||||
}
|
||||
|
||||
#region Dueling
|
||||
if ( attacker is PlayerMobile )
|
||||
if ( attacker is PlayerMobile pm )
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)attacker;
|
||||
|
||||
if ( pm.DuelContext != null && !pm.DuelContext.CheckItemEquip( attacker, this ) )
|
||||
canSwing = false;
|
||||
}
|
||||
|
|
@ -1039,9 +1018,8 @@ namespace Server.Items
|
|||
if ( attacker.NetState != null )
|
||||
attacker.Send( new Swing( 0, attacker, defender ) );
|
||||
|
||||
if ( attacker is BaseCreature )
|
||||
if ( attacker is BaseCreature bc )
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)attacker;
|
||||
WeaponAbility ab = bc.GetWeaponAbility();
|
||||
|
||||
if ( ab != null )
|
||||
|
|
@ -1080,10 +1058,7 @@ namespace Server.Items
|
|||
|
||||
public virtual int GetMissAttackSound( Mobile attacker, Mobile defender )
|
||||
{
|
||||
if ( attacker.GetAttackSound() == -1 )
|
||||
return MissSound;
|
||||
else
|
||||
return -1;
|
||||
return attacker.GetAttackSound() == -1 ? MissSound : -1;
|
||||
}
|
||||
|
||||
public virtual int GetMissDefendSound( Mobile attacker, Mobile defender )
|
||||
|
|
@ -1124,7 +1099,7 @@ namespace Server.Items
|
|||
|
||||
return defender.CheckSkill( SkillName.Parry, chance );
|
||||
}
|
||||
else if ( !(defender.Weapon is Fists) && !(defender.Weapon is BaseRanged) )
|
||||
if ( !(defender.Weapon is Fists) && !(defender.Weapon is BaseRanged) )
|
||||
{
|
||||
BaseWeapon weapon = defender.Weapon as BaseWeapon;
|
||||
|
||||
|
|
@ -1155,8 +1130,8 @@ namespace Server.Items
|
|||
|
||||
if ( chance > aosChance )
|
||||
return defender.CheckSkill( SkillName.Parry, chance );
|
||||
else
|
||||
return (aosChance > Utility.RandomDouble()); // Only skillcheck if wielding a shield & there's no effect from Bushido
|
||||
|
||||
return (aosChance > Utility.RandomDouble()); // Only skillcheck if wielding a shield & there's no effect from Bushido
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -1180,9 +1155,7 @@ namespace Server.Items
|
|||
|
||||
if ( CounterAttack.IsCountering( defender ) )
|
||||
{
|
||||
BaseWeapon weapon = defender.Weapon as BaseWeapon;
|
||||
|
||||
if ( weapon != null )
|
||||
if ( defender.Weapon is BaseWeapon weapon )
|
||||
{
|
||||
defender.FixedParticles(0x3779, 1, 15, 0x158B, 0x0, 0x3, EffectLayer.Waist);
|
||||
weapon.OnSwing( defender, attacker );
|
||||
|
|
@ -1203,10 +1176,7 @@ namespace Server.Items
|
|||
|
||||
BaseShield shield = defender.FindItemOnLayer( Layer.TwoHanded ) as BaseShield;
|
||||
|
||||
if ( shield != null )
|
||||
{
|
||||
shield.OnHit( this, damage );
|
||||
}
|
||||
shield?.OnHit( this, damage );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1229,9 +1199,7 @@ namespace Server.Items
|
|||
else
|
||||
armorItem = defender.ChestArmor;
|
||||
|
||||
IWearableDurability armor = armorItem as IWearableDurability;
|
||||
|
||||
if ( armor != null )
|
||||
if ( armorItem is IWearableDurability armor )
|
||||
armor.OnHit( this, damage ); // call OnHit to lose durability
|
||||
}
|
||||
|
||||
|
|
@ -1243,8 +1211,7 @@ namespace Server.Items
|
|||
if ( Core.AOS )
|
||||
return AbsorbDamageAOS( attacker, defender, damage );
|
||||
|
||||
BaseShield shield = defender.FindItemOnLayer( Layer.TwoHanded ) as BaseShield;
|
||||
if ( shield != null )
|
||||
if ( defender.FindItemOnLayer( Layer.TwoHanded ) is BaseShield shield )
|
||||
damage = shield.OnHit( this, damage );
|
||||
|
||||
double chance = Utility.RandomDouble();
|
||||
|
|
@ -1264,9 +1231,7 @@ namespace Server.Items
|
|||
else
|
||||
armorItem = defender.ChestArmor;
|
||||
|
||||
IWearableDurability armor = armorItem as IWearableDurability;
|
||||
|
||||
if ( armor != null )
|
||||
if ( armorItem is IWearableDurability armor )
|
||||
damage = armor.OnHit( this, damage );
|
||||
|
||||
int virtualArmor = defender.VirtualArmor + defender.VirtualArmorMod;
|
||||
|
|
@ -1300,9 +1265,7 @@ namespace Server.Items
|
|||
if ( attacker.Player || defender.Player )
|
||||
return 0;
|
||||
|
||||
BaseCreature bc = attacker as BaseCreature;
|
||||
|
||||
if ( bc == null || bc.PackInstinct == PackInstinct.None || (!bc.Controlled && !bc.Summoned) )
|
||||
if ( !(attacker is BaseCreature bc) || bc.PackInstinct == PackInstinct.None || (!bc.Controlled && !bc.Summoned) )
|
||||
return 0;
|
||||
|
||||
Mobile master = bc.ControlMaster;
|
||||
|
|
@ -1336,11 +1299,11 @@ namespace Server.Items
|
|||
|
||||
if ( inPack >= 5 )
|
||||
return 100;
|
||||
else if ( inPack >= 4 )
|
||||
if ( inPack >= 4 )
|
||||
return 75;
|
||||
else if ( inPack >= 3 )
|
||||
if ( inPack >= 3 )
|
||||
return 50;
|
||||
else if ( inPack >= 2 )
|
||||
if ( inPack >= 2 )
|
||||
return 25;
|
||||
|
||||
return 0;
|
||||
|
|
@ -1354,12 +1317,7 @@ namespace Server.Items
|
|||
set{ m_InDoubleStrike = value; }
|
||||
}
|
||||
|
||||
public void OnHit( Mobile attacker, Mobile defender )
|
||||
{
|
||||
OnHit( attacker, defender, 1.0 );
|
||||
}
|
||||
|
||||
public virtual void OnHit( Mobile attacker, Mobile defender, double damageBonus )
|
||||
public virtual void OnHit( Mobile attacker, Mobile defender, double damageBonus = 1.0)
|
||||
{
|
||||
if ( MirrorImage.HasClone( defender ) && (defender.Skills.Ninjitsu.Value / 150.0) > Utility.RandomDouble() )
|
||||
{
|
||||
|
|
@ -1436,10 +1394,8 @@ namespace Server.Items
|
|||
}
|
||||
else if ( !defender.Player )
|
||||
{
|
||||
if ( attacker is PlayerMobile )
|
||||
if ( attacker is PlayerMobile pm )
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)attacker;
|
||||
|
||||
if ( pm.WaitingForEnemy )
|
||||
{
|
||||
pm.EnemyOfOneType = defender.GetType();
|
||||
|
|
@ -1469,16 +1425,14 @@ namespace Server.Items
|
|||
|
||||
TransformContext context = TransformationSpellHelper.GetContext( defender );
|
||||
|
||||
if ( (m_Slayer == SlayerName.Silver || m_Slayer2 == SlayerName.Silver) && context != null && context.Spell is NecromancerSpell && context.Type != typeof( HorrificBeastSpell ) )
|
||||
if ( (m_Slayer == SlayerName.Silver || m_Slayer2 == SlayerName.Silver) && context?.Spell is NecromancerSpell && context.Type != typeof( HorrificBeastSpell ) )
|
||||
{
|
||||
// Every necromancer transformation other than horrific beast takes an additional 25% damage
|
||||
percentageBonus += 25;
|
||||
}
|
||||
|
||||
if ( attacker is PlayerMobile && !(Core.ML && defender is PlayerMobile ))
|
||||
if ( attacker is PlayerMobile pmAttacker && !(Core.ML && defender is PlayerMobile ))
|
||||
{
|
||||
PlayerMobile pmAttacker = (PlayerMobile) attacker;
|
||||
|
||||
if ( pmAttacker.HonorActive && pmAttacker.InRange( defender, 1 ) )
|
||||
{
|
||||
percentageBonus += 25;
|
||||
|
|
@ -1490,9 +1444,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
BaseTalisman talisman = attacker.Talisman as BaseTalisman;
|
||||
|
||||
if ( talisman != null && talisman.Killer != null )
|
||||
if ( attacker.Talisman is BaseTalisman talisman && talisman.Killer != null )
|
||||
percentageBonus += talisman.Killer.DamageBonus( defender );
|
||||
|
||||
percentageBonus = Math.Min( percentageBonus, 300 );
|
||||
|
|
@ -1647,8 +1599,8 @@ namespace Server.Items
|
|||
{
|
||||
--MaxHitPoints;
|
||||
|
||||
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
|
||||
{
|
||||
|
|
@ -1763,8 +1715,8 @@ namespace Server.Items
|
|||
|
||||
TransformContext context = TransformationSpellHelper.GetContext( attacker );
|
||||
|
||||
if ( context != null && context.Spell is ReaperFormSpell )
|
||||
damageBonus += ((ReaperFormSpell)context.Spell).SpellDamageBonus;
|
||||
if ( context?.Spell is ReaperFormSpell spell )
|
||||
damageBonus += spell.SpellDamageBonus;
|
||||
}
|
||||
|
||||
damage = AOS.Scale( damage, 100 + damageBonus );
|
||||
|
|
@ -1841,8 +1793,8 @@ namespace Server.Items
|
|||
{
|
||||
bool dispellable = false;
|
||||
|
||||
if ( defender is BaseCreature )
|
||||
dispellable = ((BaseCreature)defender).Summoned && !((BaseCreature)defender).IsAnimatedDead;
|
||||
if ( defender is BaseCreature creature )
|
||||
dispellable = creature.Summoned && !creature.IsAnimatedDead;
|
||||
|
||||
if ( !dispellable )
|
||||
return;
|
||||
|
|
@ -1944,9 +1896,7 @@ namespace Server.Items
|
|||
if ( atkSlayer != null && atkSlayer.Slays( defender ) || atkSlayer2 != null && atkSlayer2.Slays( defender ) )
|
||||
return CheckSlayerResult.Slayer;
|
||||
|
||||
BaseTalisman talisman = attacker.Talisman as BaseTalisman;
|
||||
|
||||
if ( talisman != null && TalismanSlayer.Slays( talisman.Slayer, defender ) )
|
||||
if ( attacker.Talisman is BaseTalisman talisman && TalismanSlayer.Slays( talisman.Slayer, defender ) )
|
||||
return CheckSlayerResult.Slayer;
|
||||
|
||||
if ( !Core.SE )
|
||||
|
|
@ -1989,10 +1939,8 @@ namespace Server.Items
|
|||
|
||||
public virtual void GetDamageTypes( Mobile wielder, out int phys, out int fire, out int cold, out int pois, out int nrgy, out int chaos, out int direct )
|
||||
{
|
||||
if ( wielder is BaseCreature )
|
||||
if ( wielder is BaseCreature bc )
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)wielder;
|
||||
|
||||
phys = bc.PhysicalDamage;
|
||||
fire = bc.FireDamage;
|
||||
cold = bc.ColdDamage;
|
||||
|
|
@ -2012,25 +1960,20 @@ namespace Server.Items
|
|||
|
||||
phys = 100 - fire - cold - pois - nrgy - chaos - direct;
|
||||
|
||||
CraftResourceInfo resInfo = CraftResources.GetInfo( m_Resource );
|
||||
CraftAttributeInfo attrInfo = CraftResources.GetInfo( m_Resource )?.AttributeInfo;
|
||||
|
||||
if ( resInfo != null )
|
||||
if ( attrInfo != null )
|
||||
{
|
||||
CraftAttributeInfo attrInfo = resInfo.AttributeInfo;
|
||||
int left = phys;
|
||||
|
||||
if ( attrInfo != null )
|
||||
{
|
||||
int left = phys;
|
||||
left = ApplyCraftAttributeElementDamage( attrInfo.WeaponColdDamage, ref cold, left );
|
||||
left = ApplyCraftAttributeElementDamage( attrInfo.WeaponEnergyDamage, ref nrgy, left );
|
||||
left = ApplyCraftAttributeElementDamage( attrInfo.WeaponFireDamage, ref fire, left );
|
||||
left = ApplyCraftAttributeElementDamage( attrInfo.WeaponPoisonDamage, ref pois, left );
|
||||
left = ApplyCraftAttributeElementDamage( attrInfo.WeaponChaosDamage, ref chaos, left );
|
||||
left = ApplyCraftAttributeElementDamage( attrInfo.WeaponDirectDamage, ref direct, left );
|
||||
|
||||
left = ApplyCraftAttributeElementDamage( attrInfo.WeaponColdDamage, ref cold, left );
|
||||
left = ApplyCraftAttributeElementDamage( attrInfo.WeaponEnergyDamage, ref nrgy, left );
|
||||
left = ApplyCraftAttributeElementDamage( attrInfo.WeaponFireDamage, ref fire, left );
|
||||
left = ApplyCraftAttributeElementDamage( attrInfo.WeaponPoisonDamage, ref pois, left );
|
||||
left = ApplyCraftAttributeElementDamage( attrInfo.WeaponChaosDamage, ref chaos, left );
|
||||
left = ApplyCraftAttributeElementDamage( attrInfo.WeaponDirectDamage, ref direct, left );
|
||||
|
||||
phys = left;
|
||||
}
|
||||
phys = left;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2064,24 +2007,22 @@ namespace Server.Items
|
|||
|
||||
WeaponAbility ability = WeaponAbility.GetCurrentAbility( attacker );
|
||||
|
||||
if ( ability != null )
|
||||
ability.OnMiss( attacker, defender );
|
||||
ability?.OnMiss( attacker, defender );
|
||||
|
||||
SpecialMove move = SpecialMove.GetCurrentMove( attacker );
|
||||
|
||||
if ( move != null )
|
||||
move.OnMiss( attacker, defender );
|
||||
move?.OnMiss( attacker, defender );
|
||||
|
||||
if ( defender is IHonorTarget && ((IHonorTarget)defender).ReceivedHonorContext != null )
|
||||
((IHonorTarget)defender).ReceivedHonorContext.OnTargetMissed( attacker );
|
||||
if ( defender is IHonorTarget target )
|
||||
{
|
||||
target.ReceivedHonorContext?.OnTargetMissed( attacker );
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void GetBaseDamageRange( Mobile attacker, out int min, out int max )
|
||||
{
|
||||
if ( attacker is BaseCreature )
|
||||
if ( attacker is BaseCreature c )
|
||||
{
|
||||
BaseCreature c = (BaseCreature)attacker;
|
||||
|
||||
if ( c.DamageMin >= 0 )
|
||||
{
|
||||
min = c.DamageMin;
|
||||
|
|
@ -2089,10 +2030,10 @@ namespace Server.Items
|
|||
return;
|
||||
}
|
||||
|
||||
if ( this is Fists && !attacker.Body.IsHuman )
|
||||
if ( this is Fists && !c.Body.IsHuman )
|
||||
{
|
||||
min = attacker.Str / 28;
|
||||
max = attacker.Str / 28;
|
||||
min = c.Str / 28;
|
||||
max = c.Str / 28;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -2103,9 +2044,7 @@ namespace Server.Items
|
|||
|
||||
public virtual double GetBaseDamage( Mobile attacker )
|
||||
{
|
||||
int min, max;
|
||||
|
||||
GetBaseDamageRange( attacker, out min, out max );
|
||||
GetBaseDamageRange( attacker, out int min, out int max );
|
||||
|
||||
int damage = Utility.RandomMinMax( min, max );
|
||||
|
||||
|
|
@ -2178,9 +2117,7 @@ namespace Server.Items
|
|||
|
||||
public virtual void GetStatusDamage( Mobile from, out int min, out int max )
|
||||
{
|
||||
int baseMin, baseMax;
|
||||
|
||||
GetBaseDamageRange( from, out baseMin, out baseMax );
|
||||
GetBaseDamageRange( from, out int baseMin, out int baseMax );
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
|
|
@ -2474,7 +2411,7 @@ namespace Server.Items
|
|||
SetSaveFlag( ref flags, SaveFlag.Poison, m_Poison != null );
|
||||
SetSaveFlag( ref flags, SaveFlag.PoisonCharges, m_PoisonCharges != 0 );
|
||||
SetSaveFlag( ref flags, SaveFlag.Crafter, m_Crafter != null );
|
||||
SetSaveFlag( ref flags, SaveFlag.Identified, m_Identified != false );
|
||||
SetSaveFlag( ref flags, SaveFlag.Identified, m_Identified );
|
||||
SetSaveFlag( ref flags, SaveFlag.StrReq, m_StrReq != -1 );
|
||||
SetSaveFlag( ref flags, SaveFlag.DexReq, m_DexReq != -1 );
|
||||
SetSaveFlag( ref flags, SaveFlag.IntReq, m_IntReq != -1 );
|
||||
|
|
@ -2629,6 +2566,8 @@ namespace Server.Items
|
|||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Mobile parentMobile = Parent as Mobile;
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 9:
|
||||
|
|
@ -2769,19 +2708,19 @@ namespace Server.Items
|
|||
else
|
||||
m_AosWeaponAttributes = new AosWeaponAttributes( this );
|
||||
|
||||
if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
|
||||
if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && parentMobile != null )
|
||||
{
|
||||
m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5 );
|
||||
((Mobile)Parent).AddSkillMod( m_SkillMod );
|
||||
parentMobile.AddSkillMod( m_SkillMod );
|
||||
}
|
||||
|
||||
if ( version < 7 && m_AosWeaponAttributes.MageWeapon != 0 )
|
||||
m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon;
|
||||
|
||||
if ( Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 && Parent is Mobile )
|
||||
if ( Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 && parentMobile != null )
|
||||
{
|
||||
m_MageMod = new DefaultSkillMod( SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon );
|
||||
((Mobile)Parent).AddSkillMod( m_MageMod );
|
||||
parentMobile.AddSkillMod( m_MageMod );
|
||||
}
|
||||
|
||||
if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) )
|
||||
|
|
@ -2902,41 +2841,38 @@ namespace Server.Items
|
|||
if ( m_Animation == OldAnimation )
|
||||
m_Animation = (WeaponAnimation)(-1);
|
||||
|
||||
if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
|
||||
if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && parentMobile != null )
|
||||
{
|
||||
m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5);
|
||||
((Mobile)Parent).AddSkillMod( m_SkillMod );
|
||||
parentMobile.AddSkillMod( m_SkillMod );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( Core.AOS && Parent is Mobile )
|
||||
m_AosSkillBonuses.AddTo( (Mobile)Parent );
|
||||
if ( Core.AOS && parentMobile != null )
|
||||
m_AosSkillBonuses.AddTo( parentMobile );
|
||||
|
||||
int strBonus = m_AosAttributes.BonusStr;
|
||||
int dexBonus = m_AosAttributes.BonusDex;
|
||||
int intBonus = m_AosAttributes.BonusInt;
|
||||
|
||||
if ( this.Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
|
||||
if ( parentMobile != null && (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
|
||||
{
|
||||
Mobile m = (Mobile)this.Parent;
|
||||
|
||||
string modName = this.Serial.ToString();
|
||||
|
||||
if ( strBonus != 0 )
|
||||
m.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) );
|
||||
parentMobile.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) );
|
||||
|
||||
if ( dexBonus != 0 )
|
||||
m.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) );
|
||||
parentMobile.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) );
|
||||
|
||||
if ( intBonus != 0 )
|
||||
m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) );
|
||||
parentMobile.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) );
|
||||
}
|
||||
|
||||
if ( Parent is Mobile )
|
||||
((Mobile)Parent).CheckStatTimers();
|
||||
parentMobile?.CheckStatTimers();
|
||||
|
||||
if ( m_Hits <= 0 && m_MaxHits <= 0 )
|
||||
{
|
||||
|
|
@ -2999,8 +2935,7 @@ namespace Server.Items
|
|||
|
||||
public int GetElementalDamageHue()
|
||||
{
|
||||
int phys, fire, cold, pois, nrgy, chaos, direct;
|
||||
GetDamageTypes( null, out phys, out fire, out cold, out pois, out nrgy, out chaos, out direct );
|
||||
GetDamageTypes( null, out int phys, out int fire, out int cold, out int pois, out int nrgy, out int chaos, out int direct );
|
||||
//Order is Cold, Energy, Fire, Poison, Physical left
|
||||
|
||||
int currentMax = 50;
|
||||
|
|
@ -3027,7 +2962,6 @@ namespace Server.Items
|
|||
if ( cold >= currentMax )
|
||||
{
|
||||
hue = 1261 + (cold - 50) / 10;
|
||||
currentMax = cold;
|
||||
}
|
||||
|
||||
return hue;
|
||||
|
|
@ -3102,10 +3036,7 @@ namespace Server.Items
|
|||
{
|
||||
CraftResourceInfo resInfo = CraftResources.GetInfo( m_Resource );
|
||||
|
||||
if ( resInfo == null )
|
||||
return 0;
|
||||
|
||||
CraftAttributeInfo attrInfo = resInfo.AttributeInfo;
|
||||
CraftAttributeInfo attrInfo = resInfo?.AttributeInfo;
|
||||
|
||||
if ( attrInfo == null )
|
||||
return 0;
|
||||
|
|
@ -3125,8 +3056,7 @@ namespace Server.Items
|
|||
list.Add( 1041350 ); // faction item
|
||||
#endregion
|
||||
|
||||
if ( m_AosSkillBonuses != null )
|
||||
m_AosSkillBonuses.GetProperties( list );
|
||||
m_AosSkillBonuses?.GetProperties( list );
|
||||
|
||||
if ( m_Quality == WeaponQuality.Exceptional )
|
||||
list.Add( 1060636 ); // exceptional
|
||||
|
|
@ -3137,8 +3067,8 @@ namespace Server.Items
|
|||
if ( ArtifactRarity > 0 )
|
||||
list.Add( 1061078, ArtifactRarity.ToString() ); // artifact rarity ~1_val~
|
||||
|
||||
if ( this is IUsesRemaining && ((IUsesRemaining)this).ShowUsesRemaining )
|
||||
list.Add( 1060584, ((IUsesRemaining)this).UsesRemaining.ToString() ); // uses remaining: ~1_val~
|
||||
if ( this is IUsesRemaining usesRemaining && usesRemaining.ShowUsesRemaining )
|
||||
list.Add( 1060584, usesRemaining.UsesRemaining.ToString() ); // uses remaining: ~1_val~
|
||||
|
||||
if ( m_Poison != null && m_PoisonCharges > 0 )
|
||||
list.Add( 1062412 + m_Poison.Level, m_PoisonCharges.ToString() );
|
||||
|
|
@ -3162,7 +3092,9 @@ namespace Server.Items
|
|||
|
||||
int prop;
|
||||
|
||||
if ( Core.ML && this is BaseRanged && ( (BaseRanged) this ).Balanced )
|
||||
BaseRanged ranged = this as BaseRanged;
|
||||
|
||||
if ( Core.ML && ranged?.Balanced == true )
|
||||
list.Add( 1072792 ); // Balanced
|
||||
|
||||
if ( (prop = m_AosWeaponAttributes.UseBestSkill) != 0 )
|
||||
|
|
@ -3234,7 +3166,7 @@ namespace Server.Items
|
|||
if ( ImmolatingWeaponSpell.IsImmolating( this ) )
|
||||
list.Add( 1111917 ); // Immolated
|
||||
|
||||
if ( Core.ML && this is BaseRanged && ( prop = ( (BaseRanged) this ).Velocity ) != 0 )
|
||||
if ( Core.ML && (ranged?.Velocity ?? 0) != 0 )
|
||||
list.Add( 1072793, prop.ToString() ); // Velocity ~1_val~%
|
||||
|
||||
if ( (prop = m_AosAttributes.BonusDex) != 0 )
|
||||
|
|
@ -3300,9 +3232,7 @@ namespace Server.Items
|
|||
if ( Core.ML && (prop = m_AosAttributes.IncreasedKarmaLoss) != 0 )
|
||||
list.Add( 1075210, prop.ToString() ); // Increased Karma Loss ~1val~%
|
||||
|
||||
int phys, fire, cold, pois, nrgy, chaos, direct;
|
||||
|
||||
GetDamageTypes( null, out phys, out fire, out cold, out pois, out nrgy, out chaos, out direct );
|
||||
GetDamageTypes( null, out int phys, out int fire, out int cold, out int pois, out int nrgy, out int chaos, out int direct );
|
||||
|
||||
if ( phys != 0 )
|
||||
list.Add( 1060403, phys.ToString() ); // physical damage ~1_val~%
|
||||
|
|
@ -3464,8 +3394,8 @@ namespace Server.Items
|
|||
if ( context != null && context.DoNotColor )
|
||||
Hue = 0;
|
||||
|
||||
if ( tool is BaseRunicTool )
|
||||
((BaseRunicTool)tool).ApplyAttributesTo( this );
|
||||
if ( tool is BaseRunicTool runicTool )
|
||||
runicTool.ApplyAttributesTo( this );
|
||||
|
||||
if ( Quality == WeaponQuality.Exceptional )
|
||||
{
|
||||
|
|
@ -3485,11 +3415,11 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
else if ( tool is BaseRunicTool )
|
||||
else if ( tool is BaseRunicTool runicTool )
|
||||
{
|
||||
CraftResource thisResource = CraftResources.GetFromType( resourceType );
|
||||
|
||||
if ( thisResource == ((BaseRunicTool)tool).Resource )
|
||||
if ( thisResource == runicTool.Resource )
|
||||
{
|
||||
Resource = thisResource;
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ namespace Server.Items
|
|||
from.Target = new BladedItemTarget( this );
|
||||
}
|
||||
|
||||
public override void OnHit( Mobile attacker, Mobile defender, double damageBonus )
|
||||
public override void OnHit( Mobile attacker, Mobile defender, double damageBonus = 1 )
|
||||
{
|
||||
base.OnHit( attacker, defender, damageBonus );
|
||||
|
||||
|
|
|
|||
|
|
@ -65,14 +65,13 @@ namespace Server.Items
|
|||
{
|
||||
return;
|
||||
}
|
||||
else if ( !from.Items.Contains( m_Dagger ) )
|
||||
|
||||
if ( !from.Items.Contains( m_Dagger ) )
|
||||
{
|
||||
from.SendMessage( "You must be holding that weapon to use it." );
|
||||
}
|
||||
else if ( targeted is Mobile )
|
||||
else if ( targeted is Mobile m )
|
||||
{
|
||||
Mobile m = (Mobile)targeted;
|
||||
|
||||
if ( m != from && from.HarmfulCheck( m ) )
|
||||
{
|
||||
Direction to = from.GetDirectionTo( m );
|
||||
|
|
@ -122,4 +121,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void OnHit( Mobile attacker, Mobile defender, double damageBonus )
|
||||
public override void OnHit( Mobile attacker, Mobile defender, double damageBonus = 1 )
|
||||
{
|
||||
base.OnHit( attacker, defender, damageBonus );
|
||||
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
public override void OnHit( Mobile attacker, Mobile defender, double damageBonus )
|
||||
public override void OnHit( Mobile attacker, Mobile defender, double damageBonus = 1 )
|
||||
{
|
||||
base.OnHit( attacker, defender, damageBonus );
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ namespace Server.Items
|
|||
|
||||
public override TimeSpan OnSwing( Mobile attacker, Mobile defender )
|
||||
{
|
||||
WeaponAbility a = WeaponAbility.GetCurrentAbility( attacker );
|
||||
// WeaponAbility a = WeaponAbility.GetCurrentAbility( attacker );
|
||||
|
||||
// Make sure we've been standing still for .25/.5/1 second depending on Era
|
||||
if (Core.TickCount - attacker.LastMoveTime >= (Core.SE ? 250 : Core.AOS ? 500 : 1000) || (Core.AOS && WeaponAbility.GetCurrentAbility(attacker) is MovingShot))
|
||||
|
|
@ -62,17 +62,13 @@ namespace Server.Items
|
|||
|
||||
if ( canSwing )
|
||||
{
|
||||
Spell sp = attacker.Spell as Spell;
|
||||
|
||||
canSwing = ( sp == null || !sp.IsCasting || !sp.BlocksMovement );
|
||||
canSwing = ( !(attacker.Spell is Spell sp) || !sp.IsCasting || !sp.BlocksMovement );
|
||||
}
|
||||
}
|
||||
|
||||
#region Dueling
|
||||
if ( attacker is PlayerMobile )
|
||||
if ( attacker is PlayerMobile pm )
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)attacker;
|
||||
|
||||
if ( pm.DuelContext != null && !pm.DuelContext.CheckItemEquip( attacker, this ) )
|
||||
canSwing = false;
|
||||
}
|
||||
|
|
@ -104,7 +100,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
public override void OnHit( Mobile attacker, Mobile defender, double damageBonus )
|
||||
public override void OnHit( Mobile attacker, Mobile defender, double damageBonus = 1)
|
||||
{
|
||||
if ( attacker.Player && !defender.Player && (defender.Body.IsAnimal || defender.Body.IsMonster) && 0.4 >= Utility.RandomDouble() )
|
||||
defender.AddToBackpack( Ammo );
|
||||
|
|
@ -134,21 +130,19 @@ namespace Server.Items
|
|||
{
|
||||
if ( Core.SE )
|
||||
{
|
||||
PlayerMobile p = attacker as PlayerMobile;
|
||||
|
||||
if ( p != null )
|
||||
if ( attacker is PlayerMobile pm )
|
||||
{
|
||||
Type ammo = AmmoType;
|
||||
|
||||
if ( p.RecoverableAmmo.ContainsKey( ammo ) )
|
||||
p.RecoverableAmmo[ ammo ]++;
|
||||
if ( pm.RecoverableAmmo.ContainsKey( ammo ) )
|
||||
pm.RecoverableAmmo[ ammo ]++;
|
||||
else
|
||||
p.RecoverableAmmo.Add( ammo, 1 );
|
||||
pm.RecoverableAmmo.Add( ammo, 1 );
|
||||
|
||||
if ( !p.Warmode )
|
||||
if ( !pm.Warmode )
|
||||
{
|
||||
if ( m_RecoveryTimer == null )
|
||||
m_RecoveryTimer = Timer.DelayCall( TimeSpan.FromSeconds( 10 ), new TimerCallback( p.RecoverAmmo ) );
|
||||
m_RecoveryTimer = Timer.DelayCall( TimeSpan.FromSeconds( 10 ), new TimerCallback( pm.RecoverAmmo ) );
|
||||
|
||||
if ( !m_RecoveryTimer.Running )
|
||||
m_RecoveryTimer.Start();
|
||||
|
|
|
|||
|
|
@ -47,9 +47,7 @@ namespace Server.Items
|
|||
|
||||
public void OnTargetGears( Mobile from, object targ )
|
||||
{
|
||||
Gears g = targ as Gears;
|
||||
|
||||
if ( g == null || !g.IsChildOf( from.Backpack ) )
|
||||
if ( !(targ is Gears g) || !g.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendMessage( "Those are not gears." ); // Apparently gears that aren't in your backpack aren't really gears at all. :-(
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void OnHit( Mobile attacker, Mobile defender, double damageBonus )
|
||||
public override void OnHit( Mobile attacker, Mobile defender, double damageBonus = 1 )
|
||||
{
|
||||
base.OnHit( attacker, defender, damageBonus );
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void OnHit( Mobile attacker, Mobile defender, double damageBonus )
|
||||
public override void OnHit( Mobile attacker, Mobile defender, double damageBonus = 1 )
|
||||
{
|
||||
base.OnHit( attacker, defender, damageBonus );
|
||||
|
||||
|
|
|
|||
|
|
@ -68,10 +68,8 @@ namespace Server.Items
|
|||
|
||||
protected override void OnTarget( Mobile from, object targ )
|
||||
{
|
||||
if ( targ is BaseCreature )
|
||||
if ( targ is BaseCreature bc )
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)targ;
|
||||
|
||||
if ( IsHerdable( bc ) )
|
||||
{
|
||||
if ( bc.Controlled )
|
||||
|
|
@ -114,9 +112,7 @@ namespace Server.Items
|
|||
|
||||
Map map = bc.Map;
|
||||
|
||||
ChampionSpawnRegion region = Region.Find( bc.Home, map ) as ChampionSpawnRegion;
|
||||
|
||||
if ( region != null )
|
||||
if ( Region.Find( bc.Home, map ) is ChampionSpawnRegion region )
|
||||
{
|
||||
ChampionSpawn spawn = region.ChampionSpawn;
|
||||
|
||||
|
|
@ -144,7 +140,7 @@ namespace Server.Items
|
|||
|
||||
protected override void OnTarget( Mobile from, object targ )
|
||||
{
|
||||
if ( targ is IPoint2D )
|
||||
if ( targ is IPoint2D p )
|
||||
{
|
||||
double min = m_Creature.MinTameSkill - 30;
|
||||
double max = m_Creature.MinTameSkill + 30 + Utility.Random( 10 );
|
||||
|
|
@ -154,9 +150,7 @@ namespace Server.Items
|
|||
|
||||
if ( from.CheckTargetSkill( SkillName.Herding, m_Creature, min, max ) )
|
||||
{
|
||||
IPoint2D p = (IPoint2D) targ;
|
||||
|
||||
if ( targ != from )
|
||||
if ( p != from )
|
||||
p = new Point2D( p.X, p.Y );
|
||||
|
||||
m_Creature.TargetLocation = p;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace Server.Items
|
|||
from.Target = new BladedItemTarget( this );
|
||||
}
|
||||
|
||||
public override void OnHit( Mobile attacker, Mobile defender, double damageBonus )
|
||||
public override void OnHit( Mobile attacker, Mobile defender, double damageBonus = 1 )
|
||||
{
|
||||
base.OnHit( attacker, defender, damageBonus );
|
||||
|
||||
|
|
|
|||
|
|
@ -108,8 +108,7 @@ namespace Server.Mobiles
|
|||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
m_Timer = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -151,8 +151,7 @@ namespace Server.Mobiles
|
|||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
m_Timer = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -86,8 +86,7 @@ namespace Server.Multis
|
|||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
m_Timer = null;
|
||||
|
||||
|
|
@ -142,4 +141,4 @@ namespace Server.Multis
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,8 +56,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnDelete()
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
m_Timer?.Stop();
|
||||
|
||||
base.OnDelete();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue