Fixes casting checks
This commit is contained in:
parent
7ea00fbf4f
commit
03dd5f1926
431 changed files with 5616 additions and 6250 deletions
|
|
@ -38,7 +38,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if( m_Timer != null )
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
}
|
||||
|
||||
|
|
@ -47,10 +47,10 @@ namespace Server.Items
|
|||
DateTime now = DateTime.UtcNow;
|
||||
TimeSpan age = now - m_Created;
|
||||
|
||||
if( age > m_Duration ) {
|
||||
if ( age > m_Duration ) {
|
||||
Delete();
|
||||
} else {
|
||||
if( !m_Drying && age > (m_Duration - age) )
|
||||
if ( !m_Drying && age > (m_Duration - age) )
|
||||
{
|
||||
m_Drying = true;
|
||||
ItemID = 0x122B;
|
||||
|
|
@ -61,7 +61,7 @@ namespace Server.Items
|
|||
foreach( Mobile m in GetMobilesInRange( 0 ) )
|
||||
{
|
||||
BaseCreature bc = m as BaseCreature;
|
||||
if( m.Alive && !m.IsDeadBondedPet && (bc == null || bc.Controlled || bc.Summoned) )
|
||||
if ( m.Alive && !m.IsDeadBondedPet && (bc == null || bc.Controlled || bc.Summoned) )
|
||||
{
|
||||
toDamage.Add( m );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,11 +64,11 @@ namespace Server.Items
|
|||
Item item = (Item)obj;
|
||||
CraftResource resource = CraftResource.None;
|
||||
|
||||
if( item is BaseClothing )
|
||||
if ( item is BaseClothing )
|
||||
resource = ((BaseClothing)item).Resource;
|
||||
else if( item is BaseArmor )
|
||||
else if ( item is BaseArmor )
|
||||
resource = ((BaseArmor)item).Resource;
|
||||
else if( item is BaseWeapon ) // Sanity, weapons cannot receive gems...
|
||||
else if ( item is BaseWeapon ) // Sanity, weapons cannot receive gems...
|
||||
resource = ((BaseWeapon)item).Resource;
|
||||
|
||||
IArcaneEquip eq = (IArcaneEquip)obj;
|
||||
|
|
|
|||
|
|
@ -458,7 +458,7 @@ namespace Server.Items
|
|||
// shouldFillCorpse = !((BaseCreature)owner).IsBonded;
|
||||
|
||||
Corpse c;
|
||||
if( owner is MilitiaFighter )
|
||||
if ( owner is MilitiaFighter )
|
||||
c = new MilitiaFighterCorpse( owner, hair, facialhair, shouldFillCorpse ? equipItems : new List<Item>() );
|
||||
else
|
||||
c = new Corpse( owner, hair, facialhair, shouldFillCorpse ? equipItems : new List<Item>() );
|
||||
|
|
@ -591,7 +591,7 @@ namespace Server.Items
|
|||
BaseCreature bc = (BaseCreature)owner;
|
||||
|
||||
Mobile master = bc.GetMaster();
|
||||
if( master != null )
|
||||
if ( master != null )
|
||||
m_Aggressors.Add( master );
|
||||
|
||||
List<DamageStore> rights = BaseCreature.GetLootingRights( bc.DamageEntries, bc.HitsMax );
|
||||
|
|
@ -716,13 +716,13 @@ namespace Server.Items
|
|||
{
|
||||
Item item = reader.ReadItem();
|
||||
|
||||
if( reader.ReadBool() )
|
||||
if ( reader.ReadBool() )
|
||||
SetRestoreInfo( item, reader.ReadPoint3D() );
|
||||
else if( item != null )
|
||||
else if ( item != null )
|
||||
SetRestoreInfo( item, item.Location );
|
||||
}
|
||||
|
||||
if( reader.ReadBool() )
|
||||
if ( reader.ReadBool() )
|
||||
BeginDecay( reader.ReadDeltaTime() - DateTime.UtcNow );
|
||||
|
||||
m_Looters = reader.ReadStrongMobileList();
|
||||
|
|
@ -840,7 +840,7 @@ namespace Server.Items
|
|||
|
||||
public bool DevourCorpse()
|
||||
{
|
||||
if( Devoured || Deleted || m_Killer == null || m_Killer.Deleted || !m_Killer.Alive || !(m_Killer is IDevourer) || m_Owner == null || m_Owner.Deleted )
|
||||
if ( Devoured || Deleted || m_Killer == null || m_Killer.Deleted || !m_Killer.Alive || !(m_Killer is IDevourer) || m_Owner == null || m_Owner.Deleted )
|
||||
return false;
|
||||
|
||||
m_Devourer = (IDevourer)m_Killer; // Set the devourer the killer
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ namespace Server.Network
|
|||
List<Item> list = beheld.EquipItems;
|
||||
|
||||
int count = list.Count;
|
||||
if( beheld.Hair != null && beheld.Hair.ItemID > 0 )
|
||||
if ( beheld.Hair != null && beheld.Hair.ItemID > 0 )
|
||||
count++;
|
||||
if( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 )
|
||||
if ( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 )
|
||||
count++;
|
||||
|
||||
EnsureCapacity( 8 + (count * 5) );
|
||||
|
|
@ -34,13 +34,13 @@ namespace Server.Network
|
|||
}
|
||||
}
|
||||
|
||||
if( beheld.Hair != null && beheld.Hair.ItemID > 0 )
|
||||
if ( beheld.Hair != null && beheld.Hair.ItemID > 0 )
|
||||
{
|
||||
m_Stream.Write( (byte)(Layer.Hair + 1) );
|
||||
m_Stream.Write( (int)HairInfo.FakeSerial( beheld.Owner ) - 2 );
|
||||
}
|
||||
|
||||
if( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 )
|
||||
if ( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 )
|
||||
{
|
||||
m_Stream.Write( (byte)(Layer.FacialHair + 1) );
|
||||
m_Stream.Write( (int)FacialHairInfo.FakeSerial( beheld.Owner ) - 2 );
|
||||
|
|
@ -58,9 +58,9 @@ namespace Server.Network
|
|||
List<Item> items = beheld.EquipItems;
|
||||
int count = items.Count;
|
||||
|
||||
if( beheld.Hair != null && beheld.Hair.ItemID > 0 )
|
||||
if ( beheld.Hair != null && beheld.Hair.ItemID > 0 )
|
||||
count++;
|
||||
if( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 )
|
||||
if ( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 )
|
||||
count++;
|
||||
|
||||
EnsureCapacity( 5 + (count * 19) );
|
||||
|
|
@ -75,7 +75,7 @@ namespace Server.Network
|
|||
{
|
||||
Item child = items[i];
|
||||
|
||||
if( !child.Deleted && child.Parent == beheld && beholder.CanSee( child ) )
|
||||
if ( !child.Deleted && child.Parent == beheld && beholder.CanSee( child ) )
|
||||
{
|
||||
m_Stream.Write( (int)child.Serial );
|
||||
m_Stream.Write( (ushort)child.ItemID );
|
||||
|
|
@ -90,7 +90,7 @@ namespace Server.Network
|
|||
}
|
||||
}
|
||||
|
||||
if( beheld.Hair != null && beheld.Hair.ItemID > 0 )
|
||||
if ( beheld.Hair != null && beheld.Hair.ItemID > 0 )
|
||||
{
|
||||
m_Stream.Write( (int)HairInfo.FakeSerial( beheld.Owner ) - 2 );
|
||||
m_Stream.Write( (ushort)beheld.Hair.ItemID );
|
||||
|
|
@ -104,7 +104,7 @@ namespace Server.Network
|
|||
++written;
|
||||
}
|
||||
|
||||
if( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 )
|
||||
if ( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 )
|
||||
{
|
||||
m_Stream.Write( (int)FacialHairInfo.FakeSerial( beheld.Owner ) - 2 );
|
||||
m_Stream.Write( (ushort)beheld.FacialHair.ItemID );
|
||||
|
|
@ -198,4 +198,4 @@ namespace Server.Network
|
|||
m_Stream.Write((ushort)written);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ namespace Server.Items
|
|||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if( version >= 0 )
|
||||
if ( version >= 0 )
|
||||
{
|
||||
m_SpawnRange = reader.ReadInt();
|
||||
m_NextSpawnDelay = reader.ReadTimeSpan();
|
||||
|
|
@ -134,11 +134,11 @@ namespace Server.Items
|
|||
|
||||
public override void OnMovement( Mobile m, Point3D oldLocation )
|
||||
{
|
||||
if( m_NextSpawn < DateTime.UtcNow ) // means we haven't spawned anything if the next spawn is below
|
||||
if ( m_NextSpawn < DateTime.UtcNow ) // means we haven't spawned anything if the next spawn is below
|
||||
{
|
||||
if( Utility.InRange( m.Location, Location, 1 ) && !Utility.InRange( oldLocation, Location, 1 ) && m.Player && !(m.AccessLevel > AccessLevel.Player || m.Hidden) )
|
||||
if ( Utility.InRange( m.Location, Location, 1 ) && !Utility.InRange( oldLocation, Location, 1 ) && m.Player && !(m.AccessLevel > AccessLevel.Player || m.Hidden) )
|
||||
{
|
||||
if( m_Timer == null || !m_Timer.Running )
|
||||
if ( m_Timer == null || !m_Timer.Running )
|
||||
m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 2 ), new TimerCallback( HeedWarning ) );
|
||||
}
|
||||
}
|
||||
|
|
@ -150,7 +150,7 @@ namespace Server.Items
|
|||
{
|
||||
Map map = Map;
|
||||
|
||||
if( map == null )
|
||||
if ( map == null )
|
||||
return Location;
|
||||
|
||||
// Try 10 times to find a Spawnable location.
|
||||
|
|
@ -160,9 +160,9 @@ namespace Server.Items
|
|||
int y = Location.Y + (Utility.Random( (m_SpawnRange * 2) + 1 ) - m_SpawnRange);
|
||||
int z = Map.GetAverageZ( x, y );
|
||||
|
||||
if( Map.CanSpawnMobile( new Point2D( x, y ), this.Z ) )
|
||||
if ( Map.CanSpawnMobile( new Point2D( x, y ), this.Z ) )
|
||||
return new Point3D( x, y, this.Z );
|
||||
else if( Map.CanSpawnMobile( new Point2D( x, y ), z ) )
|
||||
else if ( Map.CanSpawnMobile( new Point2D( x, y ), z ) )
|
||||
return new Point3D( x, y, z );
|
||||
}
|
||||
|
||||
|
|
@ -177,22 +177,22 @@ namespace Server.Items
|
|||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if( Utility.InRange( from.Location, Location, 2 ) )
|
||||
if ( Utility.InRange( from.Location, Location, 2 ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
if( m_NextSpawn < DateTime.UtcNow )
|
||||
if ( m_NextSpawn < DateTime.UtcNow )
|
||||
{
|
||||
Map map = this.Map;
|
||||
BaseCreature bc = (BaseCreature)Activator.CreateInstance( m_Creatures[Utility.Random( m_Creatures.Length )] );
|
||||
|
||||
if( bc != null )
|
||||
if ( bc != null )
|
||||
{
|
||||
Point3D spawnLoc = GetSpawnPosition();
|
||||
|
||||
DoEffect( spawnLoc, map );
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 1 ), delegate()
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 1 ), delegate
|
||||
{
|
||||
bc.Home = Location;
|
||||
bc.RangeHome = m_SpawnRange;
|
||||
|
|
|
|||
|
|
@ -29,18 +29,18 @@ namespace Server.Items
|
|||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if( targeted is Item )
|
||||
if ( targeted is Item )
|
||||
{
|
||||
Item item = (Item)targeted;
|
||||
|
||||
if( item.Movable == false && from.AccessLevel == AccessLevel.Player )
|
||||
if ( item.Movable == false && from.AccessLevel == AccessLevel.Player )
|
||||
return;
|
||||
|
||||
Type type = targeted.GetType();
|
||||
|
||||
FlippableAttribute[] AttributeArray = (FlippableAttribute[])type.GetCustomAttributes( typeof( FlippableAttribute ), false );
|
||||
|
||||
if( AttributeArray.Length == 0 )
|
||||
if ( AttributeArray.Length == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -83,12 +83,12 @@ namespace Server.Items
|
|||
|
||||
public virtual void Flip( Item item )
|
||||
{
|
||||
if( m_ItemIDs == null )
|
||||
if ( m_ItemIDs == null )
|
||||
{
|
||||
try
|
||||
{
|
||||
MethodInfo flipMethod = item.GetType().GetMethod( "Flip", Type.EmptyTypes );
|
||||
if( flipMethod != null )
|
||||
if ( flipMethod != null )
|
||||
flipMethod.Invoke( item, new object[0] );
|
||||
}
|
||||
catch
|
||||
|
|
@ -101,14 +101,14 @@ namespace Server.Items
|
|||
int index = 0;
|
||||
for( int i = 0; i < m_ItemIDs.Length; i++ )
|
||||
{
|
||||
if( item.ItemID == m_ItemIDs[i] )
|
||||
if ( item.ItemID == m_ItemIDs[i] )
|
||||
{
|
||||
index = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( index > m_ItemIDs.Length - 1 )
|
||||
if ( index > m_ItemIDs.Length - 1 )
|
||||
index = 0;
|
||||
|
||||
item.ItemID = m_ItemIDs[index];
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ namespace Server.Items
|
|||
|
||||
if ( info.ButtonID != 0 && switches.Length > 0 )
|
||||
{
|
||||
if( m.HairItemID == 0 && m.FacialHairItemID == 0 )
|
||||
if ( m.HairItemID == 0 && m.FacialHairItemID == 0 )
|
||||
{
|
||||
m.SendLocalizedMessage( 502623 ); // You have no hair to dye and cannot use this
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ namespace Server.Items
|
|||
case 5: i = new OrigamiFish(); break;
|
||||
}
|
||||
|
||||
if( i != null )
|
||||
if ( i != null )
|
||||
from.AddToBackpack( i );
|
||||
|
||||
from.SendLocalizedMessage( 1070822 ); // You fold the paper into an interesting shape.
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if( m_Timer != null )
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
}
|
||||
|
||||
|
|
@ -49,10 +49,10 @@ namespace Server.Items
|
|||
DateTime now = DateTime.UtcNow;
|
||||
TimeSpan age = now - m_Created;
|
||||
|
||||
if( age > m_Duration ) {
|
||||
if ( age > m_Duration ) {
|
||||
Delete();
|
||||
} else {
|
||||
if( !m_Drying && age > (m_Duration - age) )
|
||||
if ( !m_Drying && age > (m_Duration - age) )
|
||||
{
|
||||
m_Drying = true;
|
||||
ItemID = 0x122B;
|
||||
|
|
@ -64,7 +64,7 @@ namespace Server.Items
|
|||
{
|
||||
BaseCreature bc = m as BaseCreature;
|
||||
|
||||
if( m.Alive && !m.IsDeadBondedPet && (bc == null || bc.Controlled || bc.Summoned) )
|
||||
if ( m.Alive && !m.IsDeadBondedPet && (bc == null || bc.Controlled || bc.Summoned) )
|
||||
{
|
||||
toDamage.Add( m );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if( !IsChildOf( from.Backpack ) )
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062334 ); // This item must be in your backpack to be used.
|
||||
}
|
||||
|
|
@ -48,12 +48,12 @@ namespace Server.Items
|
|||
{
|
||||
Mobile m = null;
|
||||
|
||||
if( parent is Item )
|
||||
if ( parent is Item )
|
||||
m = ((Item)parent).RootParent as Mobile;
|
||||
else if( parent is Mobile )
|
||||
else if ( parent is Mobile )
|
||||
m = (Mobile)parent;
|
||||
|
||||
if( m != null )
|
||||
if ( m != null )
|
||||
m.CloseGump( typeof( PromotionalTokenGump ) );
|
||||
}
|
||||
|
||||
|
|
@ -94,12 +94,12 @@ namespace Server.Items
|
|||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if( info.ButtonID != 1 )
|
||||
if ( info.ButtonID != 1 )
|
||||
return;
|
||||
|
||||
Mobile from = sender.Mobile;
|
||||
|
||||
if( !m_Token.IsChildOf( from.Backpack ) )
|
||||
if ( !m_Token.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062334 ); // This item must be in your backpack to be used.
|
||||
}
|
||||
|
|
@ -107,7 +107,7 @@ namespace Server.Items
|
|||
{
|
||||
Item i = m_Token.CreateItemFor( from );
|
||||
|
||||
if( i != null )
|
||||
if ( i != null )
|
||||
{
|
||||
from.BankBox.AddItem( i );
|
||||
TextDefinition.SendMessageTo( from, m_Token.ItemReceiveMessage );
|
||||
|
|
@ -123,7 +123,7 @@ namespace Server.Items
|
|||
|
||||
public override Item CreateItemFor( Mobile from )
|
||||
{
|
||||
if( from != null && from.Account != null )
|
||||
if ( from != null && from.Account != null )
|
||||
return new SoulstoneFragment( from.Account.ToString() );
|
||||
else
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ namespace Server.Items
|
|||
|
||||
if ( info.ButtonID != 0 && switches.Length > 0 )
|
||||
{
|
||||
if( m.FacialHairItemID == 0 )
|
||||
if ( m.FacialHairItemID == 0 )
|
||||
{
|
||||
m.SendLocalizedMessage( 502623 ); // You have no hair to dye and cannot use this
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ namespace Server.Items
|
|||
else
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 906, 1019045 ); // I can't reach that.
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ namespace Server.Items
|
|||
Mobile m = from.Mobile;
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if ( !m_SpecialHairDye.IsChildOf( m.Backpack ) )
|
||||
if ( !m_SpecialHairDye.IsChildOf( m.Backpack ) )
|
||||
{
|
||||
m.SendLocalizedMessage( 1042010 ); //You must have the objectin your backpack to use it.
|
||||
return;
|
||||
|
|
@ -153,7 +153,7 @@ namespace Server.Items
|
|||
|
||||
if ( info.ButtonID != 0 && switches.Length > 0 )
|
||||
{
|
||||
if( m.HairItemID == 0 )
|
||||
if ( m.HairItemID == 0 )
|
||||
{
|
||||
m.SendLocalizedMessage( 502623 ); // You have no hair to dye and cannot use this
|
||||
}
|
||||
|
|
@ -175,7 +175,7 @@ namespace Server.Items
|
|||
int hue = e.HueStart + hueOffset;
|
||||
|
||||
m.HairHue = hue;
|
||||
|
||||
|
||||
m.SendLocalizedMessage( 501199 ); // You dye your hair
|
||||
m.PlaySound( 0x4E );
|
||||
}
|
||||
|
|
@ -188,4 +188,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ namespace Server.Items
|
|||
{
|
||||
from.SendLocalizedMessage( 501699 ); // You cannot disguise yourself while polymorphed.
|
||||
}
|
||||
else if( TransformationSpellHelper.UnderTransformation( from ) )
|
||||
else if ( TransformationSpellHelper.UnderTransformation( from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 501699 ); // You cannot disguise yourself while polymorphed.
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue