Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -2,124 +2,124 @@ using Server.Engines.Craft;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
[FlippableAttribute( 0x13E4, 0x13E3 )]
|
||||
public class AncientSmithyHammer : BaseTool
|
||||
{
|
||||
private int m_Bonus;
|
||||
private SkillMod m_SkillMod;
|
||||
[Flippable(0x13E4, 0x13E3)]
|
||||
public class AncientSmithyHammer : BaseTool
|
||||
{
|
||||
private int m_Bonus;
|
||||
private SkillMod m_SkillMod;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Bonus
|
||||
{
|
||||
get => m_Bonus;
|
||||
set
|
||||
{
|
||||
m_Bonus = value;
|
||||
InvalidateProperties();
|
||||
[Constructible]
|
||||
public AncientSmithyHammer(int bonus) : this(bonus, 600)
|
||||
{
|
||||
}
|
||||
|
||||
if ( m_Bonus == 0 )
|
||||
{
|
||||
m_SkillMod?.Remove();
|
||||
[Constructible]
|
||||
public AncientSmithyHammer(int bonus, int uses) : base(uses, 0x13E4)
|
||||
{
|
||||
m_Bonus = bonus;
|
||||
Weight = 8.0;
|
||||
Layer = Layer.OneHanded;
|
||||
Hue = 0x482;
|
||||
}
|
||||
|
||||
m_SkillMod = null;
|
||||
}
|
||||
else if ( m_SkillMod == null && Parent is Mobile mobile )
|
||||
{
|
||||
m_SkillMod = new DefaultSkillMod( SkillName.Blacksmith, true, m_Bonus );
|
||||
mobile.AddSkillMod( m_SkillMod );
|
||||
}
|
||||
else if ( m_SkillMod != null )
|
||||
{
|
||||
m_SkillMod.Value = m_Bonus;
|
||||
}
|
||||
}
|
||||
}
|
||||
public AncientSmithyHammer(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnAdded(IEntity parent)
|
||||
{
|
||||
base.OnAdded( parent );
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Bonus
|
||||
{
|
||||
get => m_Bonus;
|
||||
set
|
||||
{
|
||||
m_Bonus = value;
|
||||
InvalidateProperties();
|
||||
|
||||
if ( m_Bonus != 0 && parent is Mobile mobile )
|
||||
{
|
||||
m_SkillMod?.Remove();
|
||||
if (m_Bonus == 0)
|
||||
{
|
||||
m_SkillMod?.Remove();
|
||||
|
||||
m_SkillMod = new DefaultSkillMod( SkillName.Blacksmith, true, m_Bonus );
|
||||
mobile.AddSkillMod( m_SkillMod );
|
||||
}
|
||||
}
|
||||
m_SkillMod = null;
|
||||
}
|
||||
else if (m_SkillMod == null && Parent is Mobile mobile)
|
||||
{
|
||||
m_SkillMod = new DefaultSkillMod(SkillName.Blacksmith, true, m_Bonus);
|
||||
mobile.AddSkillMod(m_SkillMod);
|
||||
}
|
||||
else if (m_SkillMod != null)
|
||||
{
|
||||
m_SkillMod.Value = m_Bonus;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnRemoved(IEntity parent)
|
||||
{
|
||||
base.OnRemoved( parent );
|
||||
public override CraftSystem CraftSystem => DefBlacksmithy.CraftSystem;
|
||||
public override int LabelNumber => 1045127; // ancient smithy hammer
|
||||
|
||||
m_SkillMod?.Remove();
|
||||
public override void OnAdded(IEntity parent)
|
||||
{
|
||||
base.OnAdded(parent);
|
||||
|
||||
m_SkillMod = null;
|
||||
}
|
||||
if (m_Bonus != 0 && parent is Mobile mobile)
|
||||
{
|
||||
m_SkillMod?.Remove();
|
||||
|
||||
public override CraftSystem CraftSystem => DefBlacksmithy.CraftSystem;
|
||||
public override int LabelNumber => 1045127; // ancient smithy hammer
|
||||
m_SkillMod = new DefaultSkillMod(SkillName.Blacksmith, true, m_Bonus);
|
||||
mobile.AddSkillMod(m_SkillMod);
|
||||
}
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public AncientSmithyHammer( int bonus ) : this( bonus, 600 )
|
||||
{
|
||||
}
|
||||
public override void OnRemoved(IEntity parent)
|
||||
{
|
||||
base.OnRemoved(parent);
|
||||
|
||||
[Constructible]
|
||||
public AncientSmithyHammer( int bonus, int uses ) : base( uses, 0x13E4 )
|
||||
{
|
||||
m_Bonus = bonus;
|
||||
Weight = 8.0;
|
||||
Layer = Layer.OneHanded;
|
||||
Hue = 0x482;
|
||||
}
|
||||
m_SkillMod?.Remove();
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
m_SkillMod = null;
|
||||
}
|
||||
|
||||
if ( m_Bonus != 0 )
|
||||
list.Add( 1060451, "#1042354\t{0}", m_Bonus.ToString() ); // ~1_skillname~ +~2_val~
|
||||
}
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
public AncientSmithyHammer( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
if (m_Bonus != 0)
|
||||
list.Add(1060451, "#1042354\t{0}", m_Bonus.ToString()); // ~1_skillname~ +~2_val~
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
writer.Write(0); // version
|
||||
|
||||
writer.Write( (int) m_Bonus );
|
||||
}
|
||||
writer.Write(m_Bonus);
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Bonus = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Bonus = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_Bonus != 0 && Parent is Mobile mobile )
|
||||
{
|
||||
m_SkillMod?.Remove();
|
||||
if (m_Bonus != 0 && Parent is Mobile mobile)
|
||||
{
|
||||
m_SkillMod?.Remove();
|
||||
|
||||
m_SkillMod = new DefaultSkillMod( SkillName.Blacksmith, true, m_Bonus );
|
||||
mobile.AddSkillMod( m_SkillMod );
|
||||
}
|
||||
m_SkillMod = new DefaultSkillMod(SkillName.Blacksmith, true, m_Bonus);
|
||||
mobile.AddSkillMod(m_SkillMod);
|
||||
}
|
||||
|
||||
if ( Hue == 0 )
|
||||
Hue = 0x482;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Hue == 0)
|
||||
Hue = 0x482;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,35 +2,37 @@ using Server.Engines.Craft;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Anvil, Flippable( 0xFAF, 0xFB0 )]
|
||||
public class ColoredAnvil : Item
|
||||
{
|
||||
[Constructible]
|
||||
public ColoredAnvil() : this( CraftResources.GetHue( (CraftResource)Utility.RandomMinMax( (int)CraftResource.DullCopper, (int)CraftResource.Valorite ) ) )
|
||||
{
|
||||
}
|
||||
[Anvil]
|
||||
[Flippable(0xFAF, 0xFB0)]
|
||||
public class ColoredAnvil : Item
|
||||
{
|
||||
[Constructible]
|
||||
public ColoredAnvil() : this(CraftResources.GetHue(
|
||||
(CraftResource)Utility.RandomMinMax((int)CraftResource.DullCopper, (int)CraftResource.Valorite)))
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public ColoredAnvil( int hue ) : base( 0xFAF )
|
||||
{
|
||||
Hue = hue;
|
||||
Weight = 20;
|
||||
}
|
||||
[Constructible]
|
||||
public ColoredAnvil(int hue) : base(0xFAF)
|
||||
{
|
||||
Hue = hue;
|
||||
Weight = 20;
|
||||
}
|
||||
|
||||
public ColoredAnvil( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
public ColoredAnvil(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,247 +1,248 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
[FlippableAttribute( 0x13c6, 0x13ce )]
|
||||
public class LeatherGlovesOfMining : BaseGlovesOfMining
|
||||
{
|
||||
public override int BasePhysicalResistance => 2;
|
||||
public override int BaseFireResistance => 4;
|
||||
public override int BaseColdResistance => 3;
|
||||
public override int BasePoisonResistance => 3;
|
||||
public override int BaseEnergyResistance => 3;
|
||||
[Flippable(0x13c6, 0x13ce)]
|
||||
public class LeatherGlovesOfMining : BaseGlovesOfMining
|
||||
{
|
||||
[Constructible]
|
||||
public LeatherGlovesOfMining(int bonus) : base(bonus, 0x13C6)
|
||||
{
|
||||
Weight = 1;
|
||||
}
|
||||
|
||||
public override int InitMinHits => 30;
|
||||
public override int InitMaxHits => 40;
|
||||
public LeatherGlovesOfMining(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int AosStrReq => 20;
|
||||
public override int OldStrReq => 10;
|
||||
public override int BasePhysicalResistance => 2;
|
||||
public override int BaseFireResistance => 4;
|
||||
public override int BaseColdResistance => 3;
|
||||
public override int BasePoisonResistance => 3;
|
||||
public override int BaseEnergyResistance => 3;
|
||||
|
||||
public override int ArmorBase => 13;
|
||||
public override int InitMinHits => 30;
|
||||
public override int InitMaxHits => 40;
|
||||
|
||||
public override ArmorMaterialType MaterialType => ArmorMaterialType.Leather;
|
||||
public override CraftResource DefaultResource => CraftResource.RegularLeather;
|
||||
public override int AosStrReq => 20;
|
||||
public override int OldStrReq => 10;
|
||||
|
||||
public override ArmorMeditationAllowance DefMedAllowance => ArmorMeditationAllowance.All;
|
||||
public override int ArmorBase => 13;
|
||||
|
||||
public override int LabelNumber => 1045122; // leather blacksmith gloves of mining
|
||||
public override ArmorMaterialType MaterialType => ArmorMaterialType.Leather;
|
||||
public override CraftResource DefaultResource => CraftResource.RegularLeather;
|
||||
|
||||
[Constructible]
|
||||
public LeatherGlovesOfMining( int bonus ) : base( bonus, 0x13C6 )
|
||||
{
|
||||
Weight = 1;
|
||||
}
|
||||
public override ArmorMeditationAllowance DefMedAllowance => ArmorMeditationAllowance.All;
|
||||
|
||||
public LeatherGlovesOfMining( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int LabelNumber => 1045122; // leather blacksmith gloves of mining
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
[FlippableAttribute( 0x13d5, 0x13dd )]
|
||||
public class StuddedGlovesOfMining : BaseGlovesOfMining
|
||||
{
|
||||
public override int BasePhysicalResistance => 2;
|
||||
public override int BaseFireResistance => 4;
|
||||
public override int BaseColdResistance => 3;
|
||||
public override int BasePoisonResistance => 3;
|
||||
public override int BaseEnergyResistance => 4;
|
||||
[Flippable(0x13d5, 0x13dd)]
|
||||
public class StuddedGlovesOfMining : BaseGlovesOfMining
|
||||
{
|
||||
[Constructible]
|
||||
public StuddedGlovesOfMining(int bonus) : base(bonus, 0x13D5)
|
||||
{
|
||||
Weight = 2;
|
||||
}
|
||||
|
||||
public override int InitMinHits => 35;
|
||||
public override int InitMaxHits => 45;
|
||||
public StuddedGlovesOfMining(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int AosStrReq => 25;
|
||||
public override int OldStrReq => 25;
|
||||
public override int BasePhysicalResistance => 2;
|
||||
public override int BaseFireResistance => 4;
|
||||
public override int BaseColdResistance => 3;
|
||||
public override int BasePoisonResistance => 3;
|
||||
public override int BaseEnergyResistance => 4;
|
||||
|
||||
public override int ArmorBase => 16;
|
||||
public override int InitMinHits => 35;
|
||||
public override int InitMaxHits => 45;
|
||||
|
||||
public override ArmorMaterialType MaterialType => ArmorMaterialType.Studded;
|
||||
public override CraftResource DefaultResource => CraftResource.RegularLeather;
|
||||
public override int AosStrReq => 25;
|
||||
public override int OldStrReq => 25;
|
||||
|
||||
public override int LabelNumber => 1045123; // studded leather blacksmith gloves of mining
|
||||
public override int ArmorBase => 16;
|
||||
|
||||
[Constructible]
|
||||
public StuddedGlovesOfMining( int bonus ) : base( bonus, 0x13D5 )
|
||||
{
|
||||
Weight = 2;
|
||||
}
|
||||
public override ArmorMaterialType MaterialType => ArmorMaterialType.Studded;
|
||||
public override CraftResource DefaultResource => CraftResource.RegularLeather;
|
||||
|
||||
public StuddedGlovesOfMining( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int LabelNumber => 1045123; // studded leather blacksmith gloves of mining
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
[FlippableAttribute( 0x13eb, 0x13f2 )]
|
||||
public class RingmailGlovesOfMining : BaseGlovesOfMining
|
||||
{
|
||||
public override int BasePhysicalResistance => 3;
|
||||
public override int BaseFireResistance => 3;
|
||||
public override int BaseColdResistance => 1;
|
||||
public override int BasePoisonResistance => 5;
|
||||
public override int BaseEnergyResistance => 3;
|
||||
[Flippable(0x13eb, 0x13f2)]
|
||||
public class RingmailGlovesOfMining : BaseGlovesOfMining
|
||||
{
|
||||
[Constructible]
|
||||
public RingmailGlovesOfMining(int bonus) : base(bonus, 0x13EB)
|
||||
{
|
||||
Weight = 1;
|
||||
}
|
||||
|
||||
public override int InitMinHits => 40;
|
||||
public override int InitMaxHits => 50;
|
||||
public RingmailGlovesOfMining(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int AosStrReq => 40;
|
||||
public override int OldStrReq => 20;
|
||||
public override int BasePhysicalResistance => 3;
|
||||
public override int BaseFireResistance => 3;
|
||||
public override int BaseColdResistance => 1;
|
||||
public override int BasePoisonResistance => 5;
|
||||
public override int BaseEnergyResistance => 3;
|
||||
|
||||
public override int OldDexBonus => -1;
|
||||
public override int InitMinHits => 40;
|
||||
public override int InitMaxHits => 50;
|
||||
|
||||
public override int ArmorBase => 22;
|
||||
public override int AosStrReq => 40;
|
||||
public override int OldStrReq => 20;
|
||||
|
||||
public override ArmorMaterialType MaterialType => ArmorMaterialType.Ringmail;
|
||||
public override int OldDexBonus => -1;
|
||||
|
||||
public override int LabelNumber => 1045124; // ringmail blacksmith gloves of mining
|
||||
public override int ArmorBase => 22;
|
||||
|
||||
[Constructible]
|
||||
public RingmailGlovesOfMining( int bonus ) : base( bonus, 0x13EB )
|
||||
{
|
||||
Weight = 1;
|
||||
}
|
||||
public override ArmorMaterialType MaterialType => ArmorMaterialType.Ringmail;
|
||||
|
||||
public RingmailGlovesOfMining( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int LabelNumber => 1045124; // ringmail blacksmith gloves of mining
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class BaseGlovesOfMining : BaseArmor
|
||||
{
|
||||
private int m_Bonus;
|
||||
private SkillMod m_SkillMod;
|
||||
public abstract class BaseGlovesOfMining : BaseArmor
|
||||
{
|
||||
private int m_Bonus;
|
||||
private SkillMod m_SkillMod;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Bonus
|
||||
{
|
||||
get => m_Bonus;
|
||||
set
|
||||
{
|
||||
m_Bonus = value;
|
||||
InvalidateProperties();
|
||||
public BaseGlovesOfMining(int bonus, int itemID) : base(itemID)
|
||||
{
|
||||
m_Bonus = bonus;
|
||||
|
||||
if ( m_Bonus == 0 )
|
||||
{
|
||||
m_SkillMod?.Remove();
|
||||
Hue = CraftResources.GetHue(
|
||||
(CraftResource)Utility.RandomMinMax((int)CraftResource.DullCopper, (int)CraftResource.Valorite));
|
||||
}
|
||||
|
||||
m_SkillMod = null;
|
||||
}
|
||||
else if ( m_SkillMod == null && Parent is Mobile mobile )
|
||||
{
|
||||
m_SkillMod = new DefaultSkillMod( SkillName.Mining, true, m_Bonus );
|
||||
mobile.AddSkillMod( m_SkillMod );
|
||||
}
|
||||
else if ( m_SkillMod != null )
|
||||
{
|
||||
m_SkillMod.Value = m_Bonus;
|
||||
}
|
||||
}
|
||||
}
|
||||
public BaseGlovesOfMining(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnAdded(IEntity parent)
|
||||
{
|
||||
base.OnAdded( parent );
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Bonus
|
||||
{
|
||||
get => m_Bonus;
|
||||
set
|
||||
{
|
||||
m_Bonus = value;
|
||||
InvalidateProperties();
|
||||
|
||||
if ( m_Bonus != 0 && parent is Mobile mobile )
|
||||
{
|
||||
m_SkillMod?.Remove();
|
||||
if (m_Bonus == 0)
|
||||
{
|
||||
m_SkillMod?.Remove();
|
||||
|
||||
m_SkillMod = new DefaultSkillMod( SkillName.Mining, true, m_Bonus );
|
||||
mobile.AddSkillMod( m_SkillMod );
|
||||
}
|
||||
}
|
||||
m_SkillMod = null;
|
||||
}
|
||||
else if (m_SkillMod == null && Parent is Mobile mobile)
|
||||
{
|
||||
m_SkillMod = new DefaultSkillMod(SkillName.Mining, true, m_Bonus);
|
||||
mobile.AddSkillMod(m_SkillMod);
|
||||
}
|
||||
else if (m_SkillMod != null)
|
||||
{
|
||||
m_SkillMod.Value = m_Bonus;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnRemoved(IEntity parent)
|
||||
{
|
||||
base.OnRemoved( parent );
|
||||
public override void OnAdded(IEntity parent)
|
||||
{
|
||||
base.OnAdded(parent);
|
||||
|
||||
m_SkillMod?.Remove();
|
||||
if (m_Bonus != 0 && parent is Mobile mobile)
|
||||
{
|
||||
m_SkillMod?.Remove();
|
||||
|
||||
m_SkillMod = null;
|
||||
}
|
||||
m_SkillMod = new DefaultSkillMod(SkillName.Mining, true, m_Bonus);
|
||||
mobile.AddSkillMod(m_SkillMod);
|
||||
}
|
||||
}
|
||||
|
||||
public BaseGlovesOfMining( int bonus, int itemID ) : base( itemID )
|
||||
{
|
||||
m_Bonus = bonus;
|
||||
public override void OnRemoved(IEntity parent)
|
||||
{
|
||||
base.OnRemoved(parent);
|
||||
|
||||
Hue = CraftResources.GetHue( (CraftResource)Utility.RandomMinMax( (int)CraftResource.DullCopper, (int)CraftResource.Valorite ) );
|
||||
}
|
||||
m_SkillMod?.Remove();
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
m_SkillMod = null;
|
||||
}
|
||||
|
||||
if ( m_Bonus != 0 )
|
||||
list.Add( 1062005, m_Bonus.ToString() ); // mining bonus +~1_val~
|
||||
}
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
public BaseGlovesOfMining( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
if (m_Bonus != 0)
|
||||
list.Add(1062005, m_Bonus.ToString()); // mining bonus +~1_val~
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
writer.Write(0); // version
|
||||
|
||||
writer.Write( (int) m_Bonus );
|
||||
}
|
||||
writer.Write(m_Bonus);
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Bonus = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Bonus = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_Bonus != 0 && Parent is Mobile mobile )
|
||||
{
|
||||
m_SkillMod?.Remove();
|
||||
if (m_Bonus != 0 && Parent is Mobile mobile)
|
||||
{
|
||||
m_SkillMod?.Remove();
|
||||
|
||||
m_SkillMod = new DefaultSkillMod( SkillName.Mining, true, m_Bonus );
|
||||
mobile.AddSkillMod( m_SkillMod );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m_SkillMod = new DefaultSkillMod(SkillName.Mining, true, m_Bonus);
|
||||
mobile.AddSkillMod(m_SkillMod);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,184 +1,192 @@
|
|||
using Server.Targeting;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class PowderOfTemperament : Item, IUsesRemaining
|
||||
{
|
||||
private int m_UsesRemaining;
|
||||
public class PowderOfTemperament : Item, IUsesRemaining
|
||||
{
|
||||
private int m_UsesRemaining;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int UsesRemaining
|
||||
{
|
||||
get => m_UsesRemaining;
|
||||
set { m_UsesRemaining = value; InvalidateProperties(); }
|
||||
}
|
||||
[Constructible]
|
||||
public PowderOfTemperament() : this(10)
|
||||
{
|
||||
}
|
||||
|
||||
public bool ShowUsesRemaining{ get => true;
|
||||
set{} }
|
||||
[Constructible]
|
||||
public PowderOfTemperament(int charges) : base(4102)
|
||||
{
|
||||
Weight = 1.0;
|
||||
Hue = 2419;
|
||||
UsesRemaining = charges;
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1049082; // powder of fortifying
|
||||
public PowderOfTemperament(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public PowderOfTemperament() : this( 10 )
|
||||
{
|
||||
}
|
||||
public override int LabelNumber => 1049082; // powder of fortifying
|
||||
|
||||
[Constructible]
|
||||
public PowderOfTemperament( int charges ) : base( 4102 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
Hue = 2419;
|
||||
UsesRemaining = charges;
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int UsesRemaining
|
||||
{
|
||||
get => m_UsesRemaining;
|
||||
set
|
||||
{
|
||||
m_UsesRemaining = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public PowderOfTemperament( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public bool ShowUsesRemaining
|
||||
{
|
||||
get => true;
|
||||
set { }
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
writer.Write( (int) m_UsesRemaining );
|
||||
}
|
||||
writer.Write(0);
|
||||
writer.Write(m_UsesRemaining);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_UsesRemaining = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_UsesRemaining = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add( 1060584, m_UsesRemaining.ToString() ); // uses remaining: ~1_val~
|
||||
}
|
||||
list.Add(1060584, m_UsesRemaining.ToString()); // uses remaining: ~1_val~
|
||||
}
|
||||
|
||||
public virtual void DisplayDurabilityTo( Mobile m )
|
||||
{
|
||||
LabelToAffix( m, 1017323, AffixType.Append, ": " + m_UsesRemaining.ToString() ); // Durability
|
||||
}
|
||||
public virtual void DisplayDurabilityTo(Mobile m)
|
||||
{
|
||||
LabelToAffix(m, 1017323, AffixType.Append, ": " + m_UsesRemaining); // Durability
|
||||
}
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
DisplayDurabilityTo( from );
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
DisplayDurabilityTo(from);
|
||||
|
||||
base.OnSingleClick( from );
|
||||
}
|
||||
base.OnSingleClick(from);
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( IsChildOf( from.Backpack ) )
|
||||
from.Target = new InternalTarget( this );
|
||||
else
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (IsChildOf(from.Backpack))
|
||||
from.Target = new InternalTarget(this);
|
||||
else
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private PowderOfTemperament m_Powder;
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private PowderOfTemperament m_Powder;
|
||||
|
||||
public InternalTarget( PowderOfTemperament powder ) : base( 2, false, TargetFlags.None )
|
||||
{
|
||||
m_Powder = powder;
|
||||
}
|
||||
public InternalTarget(PowderOfTemperament powder) : base(2, false, TargetFlags.None)
|
||||
{
|
||||
m_Powder = powder;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( m_Powder.Deleted || m_Powder.UsesRemaining <= 0 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049086 ); // You have used up your powder of temperament.
|
||||
return;
|
||||
}
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (m_Powder.Deleted || m_Powder.UsesRemaining <= 0)
|
||||
{
|
||||
from.SendLocalizedMessage(1049086); // You have used up your powder of temperament.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( targeted is Item item && item is IDurability wearable )
|
||||
{
|
||||
if ( !wearable.CanFortify )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049083 ); // You cannot use the powder on that item.
|
||||
return;
|
||||
}
|
||||
if (targeted is Item item && item is IDurability wearable)
|
||||
{
|
||||
if (!wearable.CanFortify)
|
||||
{
|
||||
from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ( item.IsChildOf( from.Backpack ) || ( Core.ML && item.Parent == from ) ) && m_Powder.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
int origMaxHP = wearable.MaxHitPoints;
|
||||
int origCurHP = wearable.HitPoints;
|
||||
if ((item.IsChildOf(from.Backpack) || Core.ML && item.Parent == from) &&
|
||||
m_Powder.IsChildOf(from.Backpack))
|
||||
{
|
||||
int origMaxHP = wearable.MaxHitPoints;
|
||||
int origCurHP = wearable.HitPoints;
|
||||
|
||||
if ( origMaxHP > 0 )
|
||||
{
|
||||
int initMaxHP = Core.AOS ? 255 : wearable.InitMaxHits;
|
||||
if (origMaxHP > 0)
|
||||
{
|
||||
int initMaxHP = Core.AOS ? 255 : wearable.InitMaxHits;
|
||||
|
||||
wearable.UnscaleDurability();
|
||||
wearable.UnscaleDurability();
|
||||
|
||||
if ( wearable.MaxHitPoints < initMaxHP )
|
||||
{
|
||||
int bonus = initMaxHP - wearable.MaxHitPoints;
|
||||
if (wearable.MaxHitPoints < initMaxHP)
|
||||
{
|
||||
int bonus = initMaxHP - wearable.MaxHitPoints;
|
||||
|
||||
if ( bonus > 10 )
|
||||
bonus = 10;
|
||||
if (bonus > 10)
|
||||
bonus = 10;
|
||||
|
||||
wearable.MaxHitPoints += bonus;
|
||||
wearable.HitPoints += bonus;
|
||||
wearable.MaxHitPoints += bonus;
|
||||
wearable.HitPoints += bonus;
|
||||
|
||||
wearable.ScaleDurability();
|
||||
wearable.ScaleDurability();
|
||||
|
||||
if ( wearable.MaxHitPoints > 255 ) wearable.MaxHitPoints = 255;
|
||||
if ( wearable.HitPoints > 255 ) wearable.HitPoints = 255;
|
||||
if (wearable.MaxHitPoints > 255) wearable.MaxHitPoints = 255;
|
||||
if (wearable.HitPoints > 255) wearable.HitPoints = 255;
|
||||
|
||||
if ( wearable.MaxHitPoints > origMaxHP )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049084 ); // You successfully use the powder on the item.
|
||||
from.PlaySound( 0x247 );
|
||||
if (wearable.MaxHitPoints > origMaxHP)
|
||||
{
|
||||
from.SendLocalizedMessage(1049084); // You successfully use the powder on the item.
|
||||
from.PlaySound(0x247);
|
||||
|
||||
--m_Powder.UsesRemaining;
|
||||
--m_Powder.UsesRemaining;
|
||||
|
||||
if ( m_Powder.UsesRemaining <= 0 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049086 ); // You have used up your powder of fortifying.
|
||||
m_Powder.Delete();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wearable.MaxHitPoints = origMaxHP;
|
||||
wearable.HitPoints = origCurHP;
|
||||
from.SendLocalizedMessage( 1049085 ); // The item cannot be improved any further.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1049085 ); // The item cannot be improved any further.
|
||||
wearable.ScaleDurability();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1049083 ); // You cannot use the powder on that item.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1049083 ); // You cannot use the powder on that item.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_Powder.UsesRemaining <= 0)
|
||||
{
|
||||
from.SendLocalizedMessage(1049086); // You have used up your powder of fortifying.
|
||||
m_Powder.Delete();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wearable.MaxHitPoints = origMaxHP;
|
||||
wearable.HitPoints = origCurHP;
|
||||
from.SendLocalizedMessage(1049085); // The item cannot be improved any further.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1049085); // The item cannot be improved any further.
|
||||
wearable.ScaleDurability();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue