More cast conversion fixes
This commit is contained in:
parent
3f45bd57b9
commit
aba9452161
46 changed files with 359 additions and 506 deletions
|
|
@ -123,9 +123,9 @@ namespace Server.Items
|
|||
{
|
||||
m.SendLocalizedMessage( 1061632 ); // You can't do that while carrying the sigil.
|
||||
}
|
||||
else if ( m_TargetMap == Map.Felucca && m is PlayerMobile && ((PlayerMobile)m).Young )
|
||||
else if ( m_TargetMap == Map.Felucca && m is PlayerMobile mobile && mobile.Young )
|
||||
{
|
||||
m.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 ( (m.Kills >= 5 && m_TargetMap != Map.Felucca) || ( m_TargetMap == Map.Tokuno && (flags & ClientFlags.Tokuno) == 0 ) || ( m_TargetMap == Map.Malas && (flags & ClientFlags.Malas) == 0 ) || ( m_TargetMap == Map.Ilshenar && (flags & ClientFlags.Ilshenar) == 0 ) )
|
||||
{
|
||||
|
|
@ -160,7 +160,7 @@ namespace Server.Items
|
|||
|
||||
writer.Write( m_Target );
|
||||
writer.Write( m_TargetMap );
|
||||
|
||||
|
||||
// Version 1
|
||||
writer.Write( m_bDispellable );
|
||||
}
|
||||
|
|
@ -461,4 +461,4 @@ namespace Server.Items
|
|||
m_Gate.EndConfirmation( m_From );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -217,82 +217,75 @@ namespace Server.Items
|
|||
|
||||
public override bool OnDragDrop( Mobile from, Item item )
|
||||
{
|
||||
if ( item is BasePotion )
|
||||
{
|
||||
BasePotion pot = (BasePotion)item;
|
||||
int toHold = Math.Min( 100 - m_Held, pot.Amount );
|
||||
|
||||
if ( toHold <= 0 )
|
||||
{
|
||||
from.SendLocalizedMessage( 502233 ); // The keg will not hold any more!
|
||||
return false;
|
||||
}
|
||||
else if ( m_Held == 0 )
|
||||
{
|
||||
#region Mondain's Legacy
|
||||
if ( (int) pot.PotionEffect >= (int) PotionEffect.Invisibility )
|
||||
{
|
||||
from.SendLocalizedMessage( 502232 ); // The keg is not designed to hold that type of object.
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
if ( GiveBottle( from, toHold ) )
|
||||
{
|
||||
m_Type = pot.PotionEffect;
|
||||
Held = toHold;
|
||||
|
||||
from.PlaySound( 0x240 );
|
||||
|
||||
from.SendLocalizedMessage( 502237 ); // You place the empty bottle in your backpack.
|
||||
|
||||
item.Consume( toHold );
|
||||
|
||||
if ( !item.Deleted )
|
||||
item.Bounce( from );
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 502238 ); // You don't have room for the empty bottle in your backpack.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if ( pot.PotionEffect != m_Type )
|
||||
{
|
||||
from.SendLocalizedMessage( 502236 ); // You decide that it would be a bad idea to mix different types of potions.
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( GiveBottle( from, toHold ) )
|
||||
{
|
||||
Held += toHold;
|
||||
|
||||
from.PlaySound( 0x240 );
|
||||
|
||||
from.SendLocalizedMessage( 502237 ); // You place the empty bottle in your backpack.
|
||||
|
||||
item.Consume( toHold );
|
||||
|
||||
if ( !item.Deleted )
|
||||
item.Bounce( from );
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 502238 ); // You don't have room for the empty bottle in your backpack.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!(item is BasePotion pot))
|
||||
{
|
||||
from.SendLocalizedMessage( 502232 ); // The keg is not designed to hold that type of object.
|
||||
return false;
|
||||
}
|
||||
|
||||
int toHold = Math.Min( 100 - m_Held, pot.Amount );
|
||||
|
||||
if ( toHold <= 0 )
|
||||
{
|
||||
from.SendLocalizedMessage( 502233 ); // The keg will not hold any more!
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( m_Held == 0 )
|
||||
{
|
||||
#region Mondain's Legacy
|
||||
if ( (int) pot.PotionEffect >= (int) PotionEffect.Invisibility )
|
||||
{
|
||||
from.SendLocalizedMessage( 502232 ); // The keg is not designed to hold that type of object.
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
if ( GiveBottle( from, toHold ) )
|
||||
{
|
||||
m_Type = pot.PotionEffect;
|
||||
Held = toHold;
|
||||
|
||||
from.PlaySound( 0x240 );
|
||||
|
||||
from.SendLocalizedMessage( 502237 ); // You place the empty bottle in your backpack.
|
||||
|
||||
pot.Consume( toHold );
|
||||
|
||||
if ( !pot.Deleted )
|
||||
pot.Bounce( from );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 502238 ); // You don't have room for the empty bottle in your backpack.
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( pot.PotionEffect != m_Type )
|
||||
{
|
||||
from.SendLocalizedMessage( 502236 ); // You decide that it would be a bad idea to mix different types of potions.
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( GiveBottle( from, toHold ) )
|
||||
{
|
||||
Held += toHold;
|
||||
|
||||
from.PlaySound( 0x240 );
|
||||
|
||||
from.SendLocalizedMessage( 502237 ); // You place the empty bottle in your backpack.
|
||||
|
||||
pot.Consume( toHold );
|
||||
|
||||
if ( !pot.Deleted )
|
||||
pot.Bounce( from );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 502238 ); // You don't have room for the empty bottle in your backpack.
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool GiveBottle( Mobile m, int amount )
|
||||
|
|
|
|||
|
|
@ -81,13 +81,9 @@ namespace Server.Items
|
|||
|
||||
if ( handTwo is BaseWeapon )
|
||||
handOne = handTwo;
|
||||
if ( handTwo is BaseRanged )
|
||||
{
|
||||
BaseRanged ranged = (BaseRanged) handTwo;
|
||||
|
||||
if ( ranged.Balanced )
|
||||
return true;
|
||||
}
|
||||
if ( handTwo is BaseRanged ranged && ranged.Balanced )
|
||||
return true;
|
||||
|
||||
return ( handOne == null || handTwo == null );
|
||||
}
|
||||
|
|
@ -223,10 +219,8 @@ namespace Server.Items
|
|||
|
||||
public override bool StackWith( Mobile from, Item dropped, bool playSound )
|
||||
{
|
||||
if ( dropped is BasePotion && ((BasePotion)dropped).m_PotionEffect == m_PotionEffect )
|
||||
return base.StackWith( from, dropped, playSound );
|
||||
|
||||
return false;
|
||||
return dropped is BasePotion potion && potion.m_PotionEffect == m_PotionEffect &&
|
||||
base.StackWith(from, potion, playSound);
|
||||
}
|
||||
|
||||
#region ICraftable Members
|
||||
|
|
|
|||
|
|
@ -40,9 +40,7 @@ namespace Server.Items
|
|||
return;
|
||||
}
|
||||
|
||||
ThrowTarget targ = from.Target as ThrowTarget;
|
||||
|
||||
if ( targ != null && targ.Potion == this )
|
||||
if ( from.Target is ThrowTarget targ && targ.Potion == this )
|
||||
return;
|
||||
|
||||
from.RevealingAction();
|
||||
|
|
@ -86,9 +84,7 @@ namespace Server.Items
|
|||
// Check if any other players are using this potion
|
||||
for ( int i = 0; i < m_Users.Count; i ++ )
|
||||
{
|
||||
ThrowTarget targ = m_Users[ i ].Target as ThrowTarget;
|
||||
|
||||
if ( targ != null && targ.Potion == this )
|
||||
if ( m_Users[ i ].Target is ThrowTarget targ && targ.Potion == this )
|
||||
Target.Cancel( from );
|
||||
}
|
||||
|
||||
|
|
@ -112,9 +108,7 @@ namespace Server.Items
|
|||
|
||||
public static void AddDelay( Mobile m )
|
||||
{
|
||||
Timer timer = m_Delay[ m ] as Timer;
|
||||
|
||||
if ( timer != null )
|
||||
if ( m_Delay[ m ] is Timer timer )
|
||||
timer.Stop();
|
||||
|
||||
m_Delay[ m ] = Timer.DelayCall( TimeSpan.FromSeconds( 30 ), new TimerStateCallback( EndDelay_Callback ), m );
|
||||
|
|
@ -122,9 +116,7 @@ namespace Server.Items
|
|||
|
||||
public static int GetDelay( Mobile m )
|
||||
{
|
||||
Timer timer = m_Delay[ m ] as Timer;
|
||||
|
||||
if ( timer != null && timer.Next > DateTime.UtcNow )
|
||||
if ( m_Delay[ m ] is Timer timer && timer.Next > DateTime.UtcNow )
|
||||
return (int) (timer.Next - DateTime.UtcNow).TotalSeconds;
|
||||
|
||||
return 0;
|
||||
|
|
@ -132,15 +124,13 @@ namespace Server.Items
|
|||
|
||||
private static void EndDelay_Callback( object obj )
|
||||
{
|
||||
if ( obj is Mobile )
|
||||
EndDelay( (Mobile) obj );
|
||||
if ( obj is Mobile mobile )
|
||||
EndDelay( mobile );
|
||||
}
|
||||
|
||||
public static void EndDelay( Mobile m )
|
||||
{
|
||||
Timer timer = m_Delay[ m ] as Timer;
|
||||
|
||||
if ( timer != null )
|
||||
if ( m_Delay[ m ] is Timer timer )
|
||||
{
|
||||
timer.Stop();
|
||||
m_Delay.Remove( m );
|
||||
|
|
@ -167,13 +157,11 @@ namespace Server.Items
|
|||
if ( m_Potion.Deleted || m_Potion.Map == Map.Internal )
|
||||
return;
|
||||
|
||||
IPoint3D p = targeted as IPoint3D;
|
||||
|
||||
if ( p == null || from.Map == null )
|
||||
if ( !(targeted is IPoint3D p) || from.Map == null )
|
||||
return;
|
||||
|
||||
// Add delay
|
||||
BaseConflagrationPotion.AddDelay( from );
|
||||
AddDelay( from );
|
||||
|
||||
SpellHelper.GetSurfaceTop( ref p );
|
||||
|
||||
|
|
@ -181,8 +169,8 @@ namespace Server.Items
|
|||
|
||||
IEntity to;
|
||||
|
||||
if ( p is Mobile )
|
||||
to = (Mobile)p;
|
||||
if ( p is Mobile mobile )
|
||||
to = mobile;
|
||||
else
|
||||
to = new Entity( Serial.Zero, new Point3D( p ), from.Map );
|
||||
|
||||
|
|
|
|||
|
|
@ -41,9 +41,7 @@ namespace Server.Items
|
|||
return;
|
||||
}
|
||||
|
||||
ThrowTarget targ = from.Target as ThrowTarget;
|
||||
|
||||
if ( targ != null && targ.Potion == this )
|
||||
if ( from.Target is ThrowTarget targ && targ.Potion == this )
|
||||
return;
|
||||
|
||||
from.RevealingAction();
|
||||
|
|
@ -87,9 +85,7 @@ namespace Server.Items
|
|||
// Check if any other players are using this potion
|
||||
for ( int i = 0; i < m_Users.Count; i ++ )
|
||||
{
|
||||
ThrowTarget targ = m_Users[ i ].Target as ThrowTarget;
|
||||
|
||||
if ( targ != null && targ.Potion == this )
|
||||
if ( m_Users[ i ].Target is ThrowTarget targ && targ.Potion == this )
|
||||
Target.Cancel( from );
|
||||
}
|
||||
|
||||
|
|
@ -102,10 +98,8 @@ namespace Server.Items
|
|||
|
||||
foreach ( Mobile mobile in map.GetMobilesInRange( loc, Radius ) )
|
||||
{
|
||||
if ( mobile is BaseCreature )
|
||||
if ( mobile is BaseCreature mon )
|
||||
{
|
||||
BaseCreature mon = (BaseCreature) mobile;
|
||||
|
||||
if ( mon.Controlled || mon.Summoned )
|
||||
continue;
|
||||
|
||||
|
|
@ -134,9 +128,7 @@ namespace Server.Items
|
|||
|
||||
public static void AddDelay( Mobile m )
|
||||
{
|
||||
Timer timer = m_Delay[ m ] as Timer;
|
||||
|
||||
if ( timer != null )
|
||||
if ( m_Delay[ m ] is Timer timer )
|
||||
timer.Stop();
|
||||
|
||||
m_Delay[ m ] = Timer.DelayCall( TimeSpan.FromSeconds( 60 ), new TimerStateCallback( EndDelay_Callback ), m );
|
||||
|
|
@ -144,9 +136,7 @@ namespace Server.Items
|
|||
|
||||
public static int GetDelay( Mobile m )
|
||||
{
|
||||
Timer timer = m_Delay[ m ] as Timer;
|
||||
|
||||
if ( timer != null && timer.Next > DateTime.UtcNow )
|
||||
if ( m_Delay[ m ] is Timer timer && timer.Next > DateTime.UtcNow )
|
||||
return (int) (timer.Next - DateTime.UtcNow).TotalSeconds;
|
||||
|
||||
return 0;
|
||||
|
|
@ -154,15 +144,13 @@ namespace Server.Items
|
|||
|
||||
private static void EndDelay_Callback( object obj )
|
||||
{
|
||||
if ( obj is Mobile )
|
||||
EndDelay( (Mobile) obj );
|
||||
if ( obj is Mobile mobile )
|
||||
EndDelay( mobile );
|
||||
}
|
||||
|
||||
public static void EndDelay( Mobile m )
|
||||
{
|
||||
Timer timer = m_Delay[ m ] as Timer;
|
||||
|
||||
if ( timer != null )
|
||||
if ( m_Delay[ m ] is Timer timer )
|
||||
{
|
||||
timer.Stop();
|
||||
m_Delay.Remove( m );
|
||||
|
|
@ -189,13 +177,11 @@ namespace Server.Items
|
|||
if ( m_Potion.Deleted || m_Potion.Map == Map.Internal )
|
||||
return;
|
||||
|
||||
IPoint3D p = targeted as IPoint3D;
|
||||
|
||||
if ( p == null || from.Map == null )
|
||||
if ( !(targeted is IPoint3D p) || from.Map == null )
|
||||
return;
|
||||
|
||||
// Add delay
|
||||
BaseConfusionBlastPotion.AddDelay( from );
|
||||
AddDelay( from );
|
||||
|
||||
SpellHelper.GetSurfaceTop( ref p );
|
||||
|
||||
|
|
@ -203,8 +189,8 @@ namespace Server.Items
|
|||
|
||||
IEntity to;
|
||||
|
||||
if ( p is Mobile )
|
||||
to = (Mobile)p;
|
||||
if ( p is Mobile mobile )
|
||||
to = mobile;
|
||||
else
|
||||
to = new Entity( Serial.Zero, new Point3D( p ), from.Map );
|
||||
|
||||
|
|
|
|||
|
|
@ -117,17 +117,13 @@ namespace Server.Items
|
|||
Point3D loc;
|
||||
Map map;
|
||||
|
||||
if ( parent is Item )
|
||||
if ( parent is Item item )
|
||||
{
|
||||
Item item = (Item)parent;
|
||||
|
||||
loc = item.GetWorldLocation();
|
||||
map = item.Map;
|
||||
}
|
||||
else if ( parent is Mobile )
|
||||
else if ( parent is Mobile m )
|
||||
{
|
||||
Mobile m = (Mobile)parent;
|
||||
|
||||
loc = m.Location;
|
||||
map = m.Map;
|
||||
}
|
||||
|
|
@ -141,10 +137,10 @@ namespace Server.Items
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( parent is Item )
|
||||
((Item)parent).PublicOverheadMessage( MessageType.Regular, 0x22, false, timer.ToString() );
|
||||
else if ( parent is Mobile )
|
||||
((Mobile)parent).PublicOverheadMessage( MessageType.Regular, 0x22, false, timer.ToString() );
|
||||
if ( parent is Item item )
|
||||
item.PublicOverheadMessage( MessageType.Regular, 0x22, false, timer.ToString() );
|
||||
else if ( parent is Mobile mobile )
|
||||
mobile.PublicOverheadMessage( MessageType.Regular, 0x22, false, timer.ToString() );
|
||||
|
||||
states[1] = timer - 1;
|
||||
}
|
||||
|
|
@ -187,9 +183,7 @@ namespace Server.Items
|
|||
if ( m_Potion.Deleted || m_Potion.Map == Map.Internal )
|
||||
return;
|
||||
|
||||
IPoint3D p = targeted as IPoint3D;
|
||||
|
||||
if ( p == null )
|
||||
if ( !(targeted is IPoint3D p) )
|
||||
return;
|
||||
|
||||
Map map = from.Map;
|
||||
|
|
@ -201,16 +195,14 @@ namespace Server.Items
|
|||
|
||||
from.RevealingAction();
|
||||
|
||||
IEntity to;
|
||||
IEntity to = new Entity( Serial.Zero, new Point3D( p ), map );
|
||||
|
||||
to = new Entity( Serial.Zero, new Point3D( p ), map );
|
||||
|
||||
if ( p is Mobile )
|
||||
if ( p is Mobile m )
|
||||
{
|
||||
if ( !RelativeLocation ) // explosion location = current mob location.
|
||||
p = ((Mobile)p).Location;
|
||||
p = m.Location;
|
||||
else
|
||||
to = (Mobile)p;
|
||||
to = m;
|
||||
}
|
||||
|
||||
Effects.SendMovingEffect( from, to, m_Potion.ItemID, 7, 0, false, false, m_Potion.Hue, 0 );
|
||||
|
|
@ -235,9 +227,8 @@ namespace Server.Items
|
|||
for ( int i = 0; m_Users != null && i < m_Users.Count; ++i )
|
||||
{
|
||||
Mobile m = m_Users[i];
|
||||
ThrowTarget targ = m.Target as ThrowTarget;
|
||||
|
||||
if ( targ != null && targ.Potion == this )
|
||||
if ( m.Target is ThrowTarget targ && targ.Potion == this )
|
||||
Target.Cancel( m );
|
||||
}
|
||||
|
||||
|
|
@ -259,9 +250,9 @@ namespace Server.Items
|
|||
|
||||
foreach ( IEntity o in eable )
|
||||
{
|
||||
if ( o is Mobile && (from == null || (SpellHelper.ValidIndirectTarget( from, (Mobile)o ) && from.CanBeHarmful( (Mobile)o, false ))))
|
||||
if ( o is Mobile mobile && (from == null || (SpellHelper.ValidIndirectTarget( from, mobile ) && from.CanBeHarmful( mobile, false ))))
|
||||
{
|
||||
toExplode.Add( o );
|
||||
toExplode.Add( mobile );
|
||||
++toDamage;
|
||||
}
|
||||
else if ( o is BaseExplosionPotion && o != this )
|
||||
|
|
@ -279,12 +270,9 @@ namespace Server.Items
|
|||
{
|
||||
object o = toExplode[i];
|
||||
|
||||
if ( o is Mobile )
|
||||
if ( o is Mobile m )
|
||||
{
|
||||
Mobile m = (Mobile)o;
|
||||
|
||||
if ( from != null )
|
||||
from.DoHarmful( m );
|
||||
from?.DoHarmful( m );
|
||||
|
||||
int damage = Utility.RandomMinMax( min, max );
|
||||
|
||||
|
|
@ -297,10 +285,8 @@ namespace Server.Items
|
|||
|
||||
AOS.Damage( m, from, damage, 0, 100, 0, 0, 0 );
|
||||
}
|
||||
else if ( o is BaseExplosionPotion )
|
||||
else if ( o is BaseExplosionPotion pot )
|
||||
{
|
||||
BaseExplosionPotion pot = (BaseExplosionPotion)o;
|
||||
|
||||
pot.Explode( from, false, pot.GetWorldLocation(), pot.Map );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ namespace Server.Items
|
|||
|
||||
private static void Hide_Callback( object obj )
|
||||
{
|
||||
if ( obj is Mobile )
|
||||
Hide( (Mobile) obj );
|
||||
if ( obj is Mobile mobile )
|
||||
Hide( mobile );
|
||||
}
|
||||
|
||||
public static void Hide( Mobile m )
|
||||
|
|
@ -60,8 +60,8 @@ namespace Server.Items
|
|||
|
||||
private static void EndHide_Callback( object obj )
|
||||
{
|
||||
if ( obj is Mobile )
|
||||
EndHide( (Mobile) obj );
|
||||
if ( obj is Mobile mobile )
|
||||
EndHide( mobile );
|
||||
}
|
||||
|
||||
public static void EndHide( Mobile m )
|
||||
|
|
|
|||
|
|
@ -270,13 +270,14 @@ namespace Server.Items
|
|||
{
|
||||
NetState ns = toCheck.NetState;
|
||||
|
||||
if ( ns != null ) {
|
||||
foreach ( Gump gump in ns.Gumps ) {
|
||||
RunebookGump bookGump = gump as RunebookGump;
|
||||
if (ns == null)
|
||||
return false;
|
||||
|
||||
if ( bookGump != null && bookGump.Book == this ) {
|
||||
return true;
|
||||
}
|
||||
foreach ( Gump gump in ns.Gumps )
|
||||
{
|
||||
if ( gump is RunebookGump bookGump && bookGump.Book == this )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -295,7 +296,7 @@ namespace Server.Items
|
|||
if ( m_Crafter != null )
|
||||
list.Add( 1050043, m_Crafter.Name ); // crafted by ~1_NAME~
|
||||
|
||||
if ( m_Description != null && m_Description.Length > 0 )
|
||||
if ( !string.IsNullOrEmpty(m_Description) )
|
||||
list.Add( m_Description );
|
||||
}
|
||||
|
||||
|
|
@ -358,9 +359,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnAfterDuped( Item newItem )
|
||||
{
|
||||
Runebook book = newItem as Runebook;
|
||||
|
||||
if ( book == null )
|
||||
if ( !(newItem is Runebook book) )
|
||||
return;
|
||||
|
||||
book.m_Entries = new List<RunebookEntry>();
|
||||
|
|
@ -388,7 +387,7 @@ namespace Server.Items
|
|||
|
||||
public override bool OnDragDrop( Mobile from, Item dropped )
|
||||
{
|
||||
if ( dropped is RecallRune )
|
||||
if ( dropped is RecallRune rune )
|
||||
{
|
||||
if ( IsLockedDown && from.AccessLevel < AccessLevel.GameMaster )
|
||||
{
|
||||
|
|
@ -400,13 +399,11 @@ namespace Server.Items
|
|||
}
|
||||
else if ( m_Entries.Count < 16 )
|
||||
{
|
||||
RecallRune rune = (RecallRune)dropped;
|
||||
|
||||
if ( rune.Marked && rune.TargetMap != null )
|
||||
{
|
||||
m_Entries.Add( new RunebookEntry( rune.Target, rune.TargetMap, rune.Description, rune.House ) );
|
||||
|
||||
dropped.Delete();
|
||||
rune.Delete();
|
||||
|
||||
from.Send( new PlaySound( 0x42, GetWorldLocation() ) );
|
||||
|
||||
|
|
@ -419,10 +416,8 @@ namespace Server.Items
|
|||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 502409 ); // This rune does not have a marked location.
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 502409 ); // This rune does not have a marked location.
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -64,10 +64,8 @@ namespace Server.Items
|
|||
|
||||
private static void AllSpells_OnTarget( Mobile from, object obj )
|
||||
{
|
||||
if ( obj is Spellbook )
|
||||
if ( obj is Spellbook book )
|
||||
{
|
||||
Spellbook book = (Spellbook)obj;
|
||||
|
||||
if ( book.BookCount == 64 )
|
||||
book.Content = ulong.MaxValue;
|
||||
else
|
||||
|
|
@ -268,8 +266,8 @@ namespace Server.Items
|
|||
|
||||
Item item = from.FindItemOnLayer( Layer.OneHanded );
|
||||
|
||||
if ( item is Spellbook )
|
||||
list.Add( (Spellbook)item );
|
||||
if ( item is Spellbook spellbook )
|
||||
list.Add( spellbook );
|
||||
|
||||
Container pack = from.Backpack;
|
||||
|
||||
|
|
@ -280,8 +278,8 @@ namespace Server.Items
|
|||
{
|
||||
item = pack.Items[i];
|
||||
|
||||
if ( item is Spellbook )
|
||||
list.Add( (Spellbook)item );
|
||||
if ( item is Spellbook spellbook1 )
|
||||
list.Add( spellbook1 );
|
||||
}
|
||||
|
||||
return list;
|
||||
|
|
@ -352,45 +350,38 @@ namespace Server.Items
|
|||
|
||||
public override bool OnDragDrop( Mobile from, Item dropped )
|
||||
{
|
||||
if ( dropped is SpellScroll && dropped.Amount == 1 )
|
||||
if ( dropped is SpellScroll scroll && scroll.Amount == 1 )
|
||||
{
|
||||
SpellScroll scroll = (SpellScroll)dropped;
|
||||
|
||||
SpellbookType type = GetTypeForSpell( scroll.SpellID );
|
||||
|
||||
if ( type != this.SpellbookType )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ( HasSpell( scroll.SpellID ) )
|
||||
|
||||
if ( HasSpell( scroll.SpellID ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 500179 ); // That spell is already present in that spellbook.
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
int val = scroll.SpellID - BookOffset;
|
||||
|
||||
if ( val >= 0 && val < BookCount )
|
||||
{
|
||||
int val = scroll.SpellID - BookOffset;
|
||||
m_Content |= (ulong)1 << val;
|
||||
++m_Count;
|
||||
|
||||
if ( val >= 0 && val < BookCount )
|
||||
{
|
||||
m_Content |= (ulong)1 << val;
|
||||
++m_Count;
|
||||
InvalidateProperties();
|
||||
|
||||
InvalidateProperties();
|
||||
scroll.Delete();
|
||||
|
||||
scroll.Delete();
|
||||
|
||||
from.Send( new PlaySound( 0x249, GetWorldLocation() ) );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
from.Send( new PlaySound( 0x249, GetWorldLocation() ) );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
|
|
@ -452,9 +443,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnAfterDuped( Item newItem )
|
||||
{
|
||||
Spellbook book = newItem as Spellbook;
|
||||
|
||||
if ( book == null )
|
||||
if ( !(newItem is Spellbook book) )
|
||||
return;
|
||||
|
||||
book.m_AosAttributes = new AosAttributes( newItem, m_AosAttributes );
|
||||
|
|
@ -463,10 +452,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;
|
||||
|
|
@ -493,10 +480,8 @@ 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();
|
||||
|
|
@ -802,31 +787,31 @@ namespace Server.Items
|
|||
if ( m_AosSkillBonuses == null )
|
||||
m_AosSkillBonuses = new AosSkillBonuses( this );
|
||||
|
||||
if ( Core.AOS && Parent is Mobile )
|
||||
m_AosSkillBonuses.AddTo( (Mobile) Parent );
|
||||
if ( Core.AOS && Parent is Mobile mobile )
|
||||
m_AosSkillBonuses.AddTo( mobile );
|
||||
|
||||
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 ( Parent is Mobile m )
|
||||
{
|
||||
Mobile m = (Mobile)Parent;
|
||||
if (strBonus != 0 || dexBonus != 0 || intBonus != 0)
|
||||
{
|
||||
string modName = Serial.ToString();
|
||||
|
||||
string modName = Serial.ToString();
|
||||
if ( strBonus != 0 )
|
||||
m.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) );
|
||||
|
||||
if ( strBonus != 0 )
|
||||
m.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) );
|
||||
if ( dexBonus != 0 )
|
||||
m.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) );
|
||||
|
||||
if ( dexBonus != 0 )
|
||||
m.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) );
|
||||
if ( intBonus != 0 )
|
||||
m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) );
|
||||
}
|
||||
|
||||
if ( intBonus != 0 )
|
||||
m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) );
|
||||
m.CheckStatTimers();
|
||||
}
|
||||
|
||||
if ( Parent is Mobile )
|
||||
((Mobile)Parent).CheckStatTimers();
|
||||
}
|
||||
|
||||
private static int[] m_LegendPropertyCounts = new int[]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue