Fixes casting checks

This commit is contained in:
Kamron Batman 2018-08-19 01:38:55 +08:00
parent 7ea00fbf4f
commit 03dd5f1926
431 changed files with 5616 additions and 6250 deletions

View file

@ -94,7 +94,7 @@ namespace Server.Items
if ( version < 2 )
m_Level = GetRandomLevel();
if( version < 3 && m_TargetMap == Map.Tokuno )
if ( version < 3 && m_TargetMap == Map.Tokuno )
m_TargetMap = Map.Trammel;
}

View file

@ -153,10 +153,10 @@ namespace Server.Items
if ( version < 3 )
UpdateHue();
if( version < 4 && m_TargetMap == Map.Tokuno )
if ( version < 4 && m_TargetMap == Map.Tokuno )
m_TargetMap = Map.Trammel;
}
public override void OnDoubleClick( Mobile from )
{
if ( IsChildOf( from.Backpack ) )
@ -338,4 +338,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -38,7 +38,7 @@ namespace Server.Items
int version = reader.ReadInt();
if( version == 0 && Core.ML )
if ( version == 0 && Core.ML )
Layer = Layer.OneHanded;
}
}

View file

@ -38,7 +38,7 @@ namespace Server.Items
int version = reader.ReadInt();
if( version == 0 && Core.ML )
if ( version == 0 && Core.ML )
Layer = Layer.OneHanded;
}
}

View file

@ -39,7 +39,7 @@ namespace Server.Items
int version = reader.ReadInt();
if( version == 0 && Core.ML )
if ( version == 0 && Core.ML )
Layer = Layer.OneHanded;
}
}

View file

@ -91,16 +91,16 @@ namespace Server.Items
}
public override int LabelNumber
{
{
get
{
if( m_Held > 0 && ( int )m_Type >= ( int )PotionEffect.Conflagration )
if ( m_Held > 0 && ( int )m_Type >= ( int )PotionEffect.Conflagration )
{
return 1072658 + ( int )m_Type - ( int )PotionEffect.Conflagration;
}
return (m_Held > 0 ? 1041620 + (int)m_Type : 1041641);
}
return (m_Held > 0 ? 1041620 + (int)m_Type : 1041641);
}
}
public override void GetProperties( ObjectPropertyList list )
@ -248,7 +248,7 @@ namespace Server.Items
item.Consume( toHold );
if( !item.Deleted )
if ( !item.Deleted )
item.Bounce( from );
return true;
@ -276,7 +276,7 @@ namespace Server.Items
item.Consume( toHold );
if( !item.Deleted )
if ( !item.Deleted )
item.Bounce( from );
return true;
@ -342,7 +342,7 @@ namespace Server.Items
case PotionEffect.ExplosionLesser: return new LesserExplosionPotion();
case PotionEffect.Explosion: return new ExplosionPotion();
case PotionEffect.ExplosionGreater: return new GreaterExplosionPotion();
case PotionEffect.Conflagration: return new ConflagrationPotion();
case PotionEffect.ConflagrationGreater: return new GreaterConflagrationPotion();
@ -356,4 +356,4 @@ namespace Server.Items
TileData.ItemTable[0x1940].Height = 4;
}
}
}
}

View file

@ -203,7 +203,7 @@ namespace Server.Items
m_TargetMap = m.Map;
}
if( !setDesc )
if ( !setDesc )
m_Description = BaseRegion.GetRuneNameFor( Region.Find( m_Target, m_TargetMap ) );
CalculateHue();
@ -318,4 +318,4 @@ namespace Server.Items
{
}
}
}
}

View file

@ -38,7 +38,7 @@ namespace Server.Items
int version = reader.ReadInt();
if( version == 0 && Core.ML )
if ( version == 0 && Core.ML )
Layer = Layer.OneHanded;
}
}

View file

@ -161,7 +161,7 @@ namespace Server.Items
}
}
if( version == 0 )
if ( version == 0 )
Stackable = Core.ML;
}
@ -223,7 +223,7 @@ namespace Server.Items
public override bool StackWith( Mobile from, Item dropped, bool playSound )
{
if( dropped is BasePotion && ((BasePotion)dropped).m_PotionEffect == m_PotionEffect )
if ( dropped is BasePotion && ((BasePotion)dropped).m_PotionEffect == m_PotionEffect )
return base.StackWith( from, dropped, playSound );
return false;

View file

@ -242,7 +242,7 @@ namespace Server.Items
m_MinDamage = min;
m_MaxDamage = max;
if( m_From == null )
if ( m_From == null )
return;
int alchemySkill = m_From.Skills.Alchemy.Fixed;

View file

@ -94,7 +94,7 @@ namespace Server.Items
{
from.SendLocalizedMessage( 500236 ); // You should throw it now!
if( Core.ML )
if ( Core.ML )
m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.25 ), 5, new TimerStateCallback( Detonate_OnTick ), new object[]{ from, 3 } ); // 3.6 seconds explosion delay
else
m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 0.75 ), TimeSpan.FromSeconds( 1.0 ), 4, new TimerStateCallback( Detonate_OnTick ), new object[]{ from, 3 } ); // 2.6 seconds explosion delay
@ -205,9 +205,9 @@ namespace Server.Items
to = new Entity( Serial.Zero, new Point3D( p ), map );
if( p is Mobile )
if ( p is Mobile )
{
if( !RelativeLocation ) // explosion location = current mob location.
if ( !RelativeLocation ) // explosion location = current mob location.
p = ((Mobile)p).Location;
else
to = (Mobile)p;
@ -215,7 +215,7 @@ namespace Server.Items
Effects.SendMovingEffect( from, to, m_Potion.ItemID, 7, 0, false, false, m_Potion.Hue, 0 );
if( m_Potion.Amount > 1 )
if ( m_Potion.Amount > 1 )
{
Mobile.LiftItemDupe( m_Potion, 1 );
}

View file

@ -203,7 +203,7 @@ namespace Server.Items
LootType = LootType.Blessed;
if( Core.SE && Weight == 3.0 )
if ( Core.SE && Weight == 3.0 )
Weight = 1.0;
int version = reader.ReadInt();

View file

@ -158,9 +158,9 @@ namespace Server.Items
return SpellbookType.Necromancer;
else if ( spellID >= 200 && spellID < 210 )
return SpellbookType.Paladin;
else if( spellID >= 400 && spellID < 406 )
else if ( spellID >= 400 && spellID < 406 )
return SpellbookType.Samurai;
else if( spellID >= 500 && spellID < 508 )
else if ( spellID >= 500 && spellID < 508 )
return SpellbookType.Ninja;
else if ( spellID >= 600 && spellID < 617 )
return SpellbookType.Arcanist;
@ -597,17 +597,17 @@ namespace Server.Items
m_AosSkillBonuses.GetProperties( list );
if( m_Slayer != SlayerName.None )
if ( m_Slayer != SlayerName.None )
{
SlayerEntry entry = SlayerGroup.GetEntryByName( m_Slayer );
if( entry != null )
if ( entry != null )
list.Add( entry.Title );
}
if( m_Slayer2 != SlayerName.None )
if ( m_Slayer2 != SlayerName.None )
{
SlayerEntry entry = SlayerGroup.GetEntryByName( m_Slayer2 );
if( entry != null )
if ( entry != null )
list.Add( entry.Title );
}
@ -879,9 +879,9 @@ namespace Server.Items
if ( magery >= 1000 )
{
if( magery >= 1200 )
if ( magery >= 1200 )
propertyCounts = m_LegendPropertyCounts;
else if( magery >= 1100 )
else if ( magery >= 1100 )
propertyCounts = m_ElderPropertyCounts;
else
propertyCounts = m_GrandPropertyCounts;

View file

@ -280,7 +280,7 @@ namespace Server.Items
{
Mobile master = petPatient.ControlMaster;
if( master != null && m_Healer == master )
if ( master != null && m_Healer == master )
{
petPatient.ResurrectPet();

View file

@ -36,7 +36,7 @@ namespace Server.Items
Recipe r = this.Recipe;
if( r != null )
if ( r != null )
list.Add( 1049644, r.TextDefinition.ToString() ); // [~1_stuff~]
}
@ -59,7 +59,7 @@ namespace Server.Items
public override void OnDoubleClick( Mobile from )
{
if( !from.InRange( this.GetWorldLocation(), 2 ) )
if ( !from.InRange( this.GetWorldLocation(), 2 ) )
{
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
return;
@ -67,11 +67,11 @@ namespace Server.Items
Recipe r = this.Recipe;
if( r != null && from is PlayerMobile )
if ( r != null && from is PlayerMobile )
{
PlayerMobile pm = from as PlayerMobile;
if( !pm.HasRecipe( r ) )
if ( !pm.HasRecipe( r ) )
{
bool allRequiredSkills = true;
double chance = r.CraftItem.GetSuccessChance( from, null, r.CraftSystem, false, ref allRequiredSkills );

View file

@ -49,7 +49,7 @@ namespace Server.Items
{
int v = (int)type;
if( v < 0 || v >= m_Table.Length )
if ( v < 0 || v >= m_Table.Length )
v = 0;
return m_Table[v];
@ -101,7 +101,7 @@ namespace Server.Items
{
base.GetProperties( list );
if( m_Crafter != null )
if ( m_Crafter != null )
list.Add( 1050043, m_Crafter.Name ); // crafted by ~1_NAME~
//On OSI it says it's exceptional. Intentional difference.
@ -114,7 +114,7 @@ namespace Server.Items
this.LabelTo( from, 1061133, String.Format( "{0}\t{1}", GetSkillTitle( m_SkillLevel ).ToString(), RepairSkillInfo.GetInfo( m_Skill ).Name ) ); // A repair service contract from ~1_SKILL_TITLE~ ~2_SKILL_NAME~.
if( m_Crafter != null )
if ( m_Crafter != null )
this.LabelTo( from, 1050043, m_Crafter.Name ); // crafted by ~1_NAME~
}
@ -139,7 +139,7 @@ namespace Server.Items
public RepairDeed( RepairSkillType skill, double level, Mobile crafter, bool normalizeLevel ) : base( 0x14F0 )
{
if( normalizeLevel )
if ( normalizeLevel )
SkillLevel = (int)(level/10)*10;
else
SkillLevel = level;
@ -158,9 +158,9 @@ namespace Server.Items
{
int skill = (int)(skillLevel/10);
if( skill >= 11 )
if ( skill >= 11 )
return (1062008 + skill-11);
else if( skill >=5 )
else if ( skill >=5 )
return (1061123 + skill-5);
switch( skill )
@ -178,7 +178,7 @@ namespace Server.Items
{
for( int i = 0; i < RepairSkillInfo.Table.Length; i++ )
{
if( RepairSkillInfo.Table[i].System == s )
if ( RepairSkillInfo.Table[i].System == s )
return (RepairSkillType)i;
}
@ -187,15 +187,15 @@ namespace Server.Items
public override void OnDoubleClick( Mobile from )
{
if( Check( from ) )
if ( Check( from ) )
Repair.Do( from, RepairSkillInfo.GetInfo( m_Skill ).System, this );
}
public bool Check( Mobile from )
{
if( !IsChildOf( from.Backpack ) )
if ( !IsChildOf( from.Backpack ) )
from.SendLocalizedMessage( 1047012 ); // The contract must be in your backpack to use it.
else if( !VerifyRegion( from ) )
else if ( !VerifyRegion( from ) )
TextDefinition.SendMessageTo( from, RepairSkillInfo.GetInfo( m_Skill ).NotNearbyMessage );
else
return true;
@ -207,7 +207,7 @@ namespace Server.Items
{
//TODO: When the entire region system data is in, convert to that instead of a proximity thing.
if( !m.Region.IsPartOf( typeof( TownRegion ) ) )
if ( !m.Region.IsPartOf( typeof( TownRegion ) ) )
return false;
return Server.Factions.Faction.IsNearType( m, RepairSkillInfo.GetInfo( m_Skill ).NearbyTypes, 6 );

View file

@ -93,12 +93,12 @@ namespace Server.Items
public bool ReplenishesCharges
{
get { return m_ReplenishesCharges; }
set
set
{
if( value != m_ReplenishesCharges && value )
if ( value != m_ReplenishesCharges && value )
m_LastReplenished = DateTime.UtcNow;
m_ReplenishesCharges = value;
m_ReplenishesCharges = value;
}
}
@ -109,17 +109,17 @@ namespace Server.Items
public void CheckReplenishUses( bool invalidate )
{
if( !m_ReplenishesCharges || m_UsesRemaining >= InitMaxUses )
if ( !m_ReplenishesCharges || m_UsesRemaining >= InitMaxUses )
return;
if( m_LastReplenished + ChargeReplenishRate < DateTime.UtcNow )
if ( m_LastReplenished + ChargeReplenishRate < DateTime.UtcNow )
{
TimeSpan timeDifference = DateTime.UtcNow - m_LastReplenished;
m_UsesRemaining = Math.Min( m_UsesRemaining + (int)( timeDifference.Ticks / ChargeReplenishRate.Ticks), InitMaxUses ); //How rude of TimeSpan to not allow timespan division.
m_LastReplenished = DateTime.UtcNow;
if( invalidate )
if ( invalidate )
InvalidateProperties();
}
@ -354,24 +354,24 @@ namespace Server.Items
list.Add( 1060584, m_UsesRemaining.ToString() ); // uses remaining: ~1_val~
if( m_ReplenishesCharges )
if ( m_ReplenishesCharges )
list.Add( 1070928 ); // Replenish Charges
if( m_Slayer != SlayerName.None )
if ( m_Slayer != SlayerName.None )
{
SlayerEntry entry = SlayerGroup.GetEntryByName( m_Slayer );
if( entry != null )
if ( entry != null )
list.Add( entry.Title );
}
if( m_Slayer2 != SlayerName.None )
if ( m_Slayer2 != SlayerName.None )
{
SlayerEntry entry = SlayerGroup.GetEntryByName( m_Slayer2 );
if( entry != null )
if ( entry != null )
list.Add( entry.Title );
}
if( m_UsesRemaining != oldUses )
if ( m_UsesRemaining != oldUses )
Timer.DelayCall( TimeSpan.Zero, new TimerCallback( InvalidateProperties ) );
}
@ -390,21 +390,21 @@ namespace Server.Items
if ( m_Quality == InstrumentQuality.Exceptional )
attrs.Add( new EquipInfoAttribute( 1018305 - (int)m_Quality ) );
if( m_ReplenishesCharges )
if ( m_ReplenishesCharges )
attrs.Add( new EquipInfoAttribute( 1070928 ) ); // Replenish Charges
// TODO: Must this support item identification?
if( m_Slayer != SlayerName.None )
if ( m_Slayer != SlayerName.None )
{
SlayerEntry entry = SlayerGroup.GetEntryByName( m_Slayer );
if( entry != null )
if ( entry != null )
attrs.Add( new EquipInfoAttribute( entry.Title ) );
}
if( m_Slayer2 != SlayerName.None )
if ( m_Slayer2 != SlayerName.None )
{
SlayerEntry entry = SlayerGroup.GetEntryByName( m_Slayer2 );
if( entry != null )
if ( entry != null )
attrs.Add( new EquipInfoAttribute( entry.Title ) );
}
@ -439,7 +439,7 @@ namespace Server.Items
writer.Write( (int) 3 ); // version
writer.Write( m_ReplenishesCharges );
if( m_ReplenishesCharges )
if ( m_ReplenishesCharges )
writer.Write( m_LastReplenished );
@ -467,7 +467,7 @@ namespace Server.Items
{
m_ReplenishesCharges = reader.ReadBool();
if( m_ReplenishesCharges )
if ( m_ReplenishesCharges )
m_LastReplenished = reader.ReadDateTime();
goto case 2;
@ -484,7 +484,7 @@ namespace Server.Items
m_WellSound = reader.ReadEncodedInt();
m_BadlySound = reader.ReadEncodedInt();
break;
}
case 1:
@ -584,4 +584,4 @@ namespace Server.Items
#endregion
}
}
}

View file

@ -64,7 +64,7 @@ namespace Server.Items
{
case 1: // Okay
{
if( info.Switches.Length > 0 )
if ( info.Switches.Length > 0 )
{
m_Callback( m_From, m_State, info.Switches[ 0 ] );
}
@ -79,4 +79,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -77,7 +77,7 @@ namespace Server.Items
public virtual void SetTubHue( Mobile from, object state, int hue )
{
if( state is DyeTub )
if ( state is DyeTub )
{
DyeTub tub = state as DyeTub;
@ -95,11 +95,11 @@ namespace Server.Items
if ( tub.Redyable )
{
if( tub.MetallicHues ) /* OSI has three metallic tubs now */
if ( tub.MetallicHues ) /* OSI has three metallic tubs now */
{
from.SendGump( new MetallicHuePicker( from, new MetallicHuePicker.MetallicHuePickerCallback( SetTubHue ), tub ) );
}
else if( tub.CustomHuePicker != null )
else if ( tub.CustomHuePicker != null )
{
from.SendGump( new CustomHuePickerGump( from, tub.CustomHuePicker, new CustomHuePickerCallback( SetTubHue ), tub ) );
}
@ -124,4 +124,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -63,7 +63,7 @@ namespace Server.Items
from.SendLocalizedMessage( 502440 ); // Scissors can not be used on that to produce anything.
}
else */
if( Core.AOS && targeted == from )
if ( Core.AOS && targeted == from )
{
from.SendLocalizedMessage( 1062845 + Utility.Random( 3 ) ); //"That doesn't seem like the smartest thing to do." / "That was an encounter you don't wish to repeat." / "Ha! You missed!"
}
@ -71,9 +71,9 @@ namespace Server.Items
{
from.SendLocalizedMessage( 1063305 ); // Didn't your parents ever tell you not to run with scissors in your hand?!
}
else if( targeted is Item && !((Item)targeted).Movable )
else if ( targeted is Item && !((Item)targeted).Movable )
{
if( targeted is IScissorable && ( targeted is PlagueBeastInnard || targeted is PlagueBeastMutationCore ) )
if ( targeted is IScissorable && ( targeted is PlagueBeastInnard || targeted is PlagueBeastMutationCore ) )
{
IScissorable obj = (IScissorable) targeted;

View file

@ -365,7 +365,7 @@ namespace Server.Items
AosElementAttribute.Poison
};
if( randomizeOrder )
if ( randomizeOrder )
{
for( int i = 0; i < attrs.Length; i++ )
{
@ -399,7 +399,7 @@ namespace Server.Items
private static int AssignElementalDamage( BaseWeapon weapon, AosElementAttribute attr, int totalDamage )
{
if( totalDamage <= 0 )
if ( totalDamage <= 0 )
return 0;
int random = Utility.Random( (int)(totalDamage/10) + 1 ) * 10;