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
|
|
@ -1,241 +1,260 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.ContextMenus;
|
||||
using Server.Engines.Craft;
|
||||
using Server.Engines.Harvest;
|
||||
using Server.ContextMenus;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public interface IUsesRemaining
|
||||
{
|
||||
int UsesRemaining{ get; set; }
|
||||
bool ShowUsesRemaining{ get; set; }
|
||||
}
|
||||
public interface IUsesRemaining
|
||||
{
|
||||
int UsesRemaining{ get; set; }
|
||||
bool ShowUsesRemaining{ get; set; }
|
||||
}
|
||||
|
||||
public abstract class BaseHarvestTool : Item, IUsesRemaining, ICraftable
|
||||
{
|
||||
private Mobile m_Crafter;
|
||||
private ToolQuality m_Quality;
|
||||
private int m_UsesRemaining;
|
||||
public abstract class BaseHarvestTool : Item, IUsesRemaining, ICraftable
|
||||
{
|
||||
private Mobile m_Crafter;
|
||||
private ToolQuality m_Quality;
|
||||
private int m_UsesRemaining;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile Crafter
|
||||
{
|
||||
get => m_Crafter;
|
||||
set{ m_Crafter = value; InvalidateProperties(); }
|
||||
}
|
||||
public BaseHarvestTool(int itemID) : this(50, itemID)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public ToolQuality Quality
|
||||
{
|
||||
get => m_Quality;
|
||||
set{ UnscaleUses(); m_Quality = value; InvalidateProperties(); ScaleUses(); }
|
||||
}
|
||||
public BaseHarvestTool(int usesRemaining, int itemID) : base(itemID)
|
||||
{
|
||||
m_UsesRemaining = usesRemaining;
|
||||
m_Quality = ToolQuality.Regular;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int UsesRemaining
|
||||
{
|
||||
get => m_UsesRemaining;
|
||||
set { m_UsesRemaining = value; InvalidateProperties(); }
|
||||
}
|
||||
public BaseHarvestTool(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public void ScaleUses()
|
||||
{
|
||||
m_UsesRemaining = (m_UsesRemaining * GetUsesScalar()) / 100;
|
||||
InvalidateProperties();
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile Crafter
|
||||
{
|
||||
get => m_Crafter;
|
||||
set
|
||||
{
|
||||
m_Crafter = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public void UnscaleUses()
|
||||
{
|
||||
m_UsesRemaining = (m_UsesRemaining * 100) / GetUsesScalar();
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public ToolQuality Quality
|
||||
{
|
||||
get => m_Quality;
|
||||
set
|
||||
{
|
||||
UnscaleUses();
|
||||
m_Quality = value;
|
||||
InvalidateProperties();
|
||||
ScaleUses();
|
||||
}
|
||||
}
|
||||
|
||||
public int GetUsesScalar()
|
||||
{
|
||||
if ( m_Quality == ToolQuality.Exceptional )
|
||||
return 200;
|
||||
public abstract HarvestSystem HarvestSystem{ get; }
|
||||
|
||||
return 100;
|
||||
}
|
||||
#region ICraftable Members
|
||||
|
||||
public bool ShowUsesRemaining{ get => true;
|
||||
set{} }
|
||||
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
|
||||
CraftItem craftItem, int resHue)
|
||||
{
|
||||
Quality = (ToolQuality)quality;
|
||||
|
||||
public abstract HarvestSystem HarvestSystem{ get; }
|
||||
if (makersMark)
|
||||
Crafter = from;
|
||||
|
||||
public BaseHarvestTool( int itemID ) : this( 50, itemID )
|
||||
{
|
||||
}
|
||||
return quality;
|
||||
}
|
||||
|
||||
public BaseHarvestTool( int usesRemaining, int itemID ) : base( itemID )
|
||||
{
|
||||
m_UsesRemaining = usesRemaining;
|
||||
m_Quality = ToolQuality.Regular;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int UsesRemaining
|
||||
{
|
||||
get => m_UsesRemaining;
|
||||
set
|
||||
{
|
||||
m_UsesRemaining = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
// Makers mark not displayed on OSI
|
||||
//if ( m_Crafter != null )
|
||||
// list.Add( 1050043, m_Crafter.Name ); // crafted by ~1_NAME~
|
||||
public bool ShowUsesRemaining
|
||||
{
|
||||
get => true;
|
||||
set { }
|
||||
}
|
||||
|
||||
if ( m_Quality == ToolQuality.Exceptional )
|
||||
list.Add( 1060636 ); // exceptional
|
||||
public void ScaleUses()
|
||||
{
|
||||
m_UsesRemaining = m_UsesRemaining * GetUsesScalar() / 100;
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
list.Add( 1060584, m_UsesRemaining.ToString() ); // uses remaining: ~1_val~
|
||||
}
|
||||
public void UnscaleUses()
|
||||
{
|
||||
m_UsesRemaining = m_UsesRemaining * 100 / GetUsesScalar();
|
||||
}
|
||||
|
||||
public virtual void DisplayDurabilityTo( Mobile m )
|
||||
{
|
||||
LabelToAffix( m, 1017323, AffixType.Append, ": " + m_UsesRemaining.ToString() ); // Durability
|
||||
}
|
||||
public int GetUsesScalar()
|
||||
{
|
||||
if (m_Quality == ToolQuality.Exceptional)
|
||||
return 200;
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
DisplayDurabilityTo( from );
|
||||
return 100;
|
||||
}
|
||||
|
||||
base.OnSingleClick( from );
|
||||
}
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( IsChildOf( from.Backpack ) || Parent == from )
|
||||
HarvestSystem.BeginHarvesting( from, this );
|
||||
else
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
// Makers mark not displayed on OSI
|
||||
//if ( m_Crafter != null )
|
||||
// list.Add( 1050043, m_Crafter.Name ); // crafted by ~1_NAME~
|
||||
|
||||
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
|
||||
{
|
||||
base.GetContextMenuEntries( from, list );
|
||||
if (m_Quality == ToolQuality.Exceptional)
|
||||
list.Add(1060636); // exceptional
|
||||
|
||||
AddContextMenuEntries( from, this, list, HarvestSystem );
|
||||
}
|
||||
list.Add(1060584, m_UsesRemaining.ToString()); // uses remaining: ~1_val~
|
||||
}
|
||||
|
||||
public static void AddContextMenuEntries( Mobile from, Item item, List<ContextMenuEntry> list, HarvestSystem system )
|
||||
{
|
||||
if ( system != Mining.System )
|
||||
return;
|
||||
public virtual void DisplayDurabilityTo(Mobile m)
|
||||
{
|
||||
LabelToAffix(m, 1017323, AffixType.Append, ": " + m_UsesRemaining); // Durability
|
||||
}
|
||||
|
||||
if ( !item.IsChildOf( from.Backpack ) && item.Parent != from )
|
||||
return;
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
DisplayDurabilityTo(from);
|
||||
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return;
|
||||
base.OnSingleClick(from);
|
||||
}
|
||||
|
||||
ContextMenuEntry miningEntry = new ContextMenuEntry( pm.ToggleMiningStone ? 6179 : 6178 );
|
||||
miningEntry.Color = 0x421F;
|
||||
list.Add( miningEntry );
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (IsChildOf(from.Backpack) || Parent == from)
|
||||
HarvestSystem.BeginHarvesting(from, this);
|
||||
else
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
|
||||
list.Add( new ToggleMiningStoneEntry( pm, false, 6176 ) );
|
||||
list.Add( new ToggleMiningStoneEntry( pm, true, 6177 ) );
|
||||
}
|
||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||
{
|
||||
base.GetContextMenuEntries(from, list);
|
||||
|
||||
private class ToggleMiningStoneEntry : ContextMenuEntry
|
||||
{
|
||||
private PlayerMobile m_Mobile;
|
||||
private bool m_Value;
|
||||
AddContextMenuEntries(from, this, list, HarvestSystem);
|
||||
}
|
||||
|
||||
public ToggleMiningStoneEntry( PlayerMobile mobile, bool value, int number ) : base( number )
|
||||
{
|
||||
m_Mobile = mobile;
|
||||
m_Value = value;
|
||||
public static void AddContextMenuEntries(Mobile from, Item item, List<ContextMenuEntry> list, HarvestSystem system)
|
||||
{
|
||||
if (system != Mining.System)
|
||||
return;
|
||||
|
||||
bool stoneMining = ( mobile.StoneMining && mobile.Skills[SkillName.Mining].Base >= 100.0 );
|
||||
if (!item.IsChildOf(from.Backpack) && item.Parent != from)
|
||||
return;
|
||||
|
||||
if ( mobile.ToggleMiningStone == value || ( value && !stoneMining ) )
|
||||
Flags |= CMEFlags.Disabled;
|
||||
}
|
||||
if (!(from is PlayerMobile pm))
|
||||
return;
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
bool oldValue = m_Mobile.ToggleMiningStone;
|
||||
ContextMenuEntry miningEntry = new ContextMenuEntry(pm.ToggleMiningStone ? 6179 : 6178);
|
||||
miningEntry.Color = 0x421F;
|
||||
list.Add(miningEntry);
|
||||
|
||||
if ( m_Value )
|
||||
{
|
||||
if ( oldValue )
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage( 1054023 ); // You are already set to mine both ore and stone!
|
||||
}
|
||||
else if ( !m_Mobile.StoneMining || m_Mobile.Skills[SkillName.Mining].Base < 100.0 )
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage( 1054024 ); // You have not learned how to mine stone or you do not have enough skill!
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.ToggleMiningStone = true;
|
||||
m_Mobile.SendLocalizedMessage( 1054022 ); // You are now set to mine both ore and stone.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( oldValue )
|
||||
{
|
||||
m_Mobile.ToggleMiningStone = false;
|
||||
m_Mobile.SendLocalizedMessage( 1054020 ); // You are now set to mine only ore.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage( 1054021 ); // You are already set to mine only ore!
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
list.Add(new ToggleMiningStoneEntry(pm, false, 6176));
|
||||
list.Add(new ToggleMiningStoneEntry(pm, true, 6177));
|
||||
}
|
||||
|
||||
public BaseHarvestTool( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write(1); // version
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
writer.Write(m_Crafter);
|
||||
writer.Write((int)m_Quality);
|
||||
|
||||
writer.Write( (Mobile) m_Crafter );
|
||||
writer.Write( (int) m_Quality );
|
||||
writer.Write(m_UsesRemaining);
|
||||
}
|
||||
|
||||
writer.Write( (int) 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 1:
|
||||
{
|
||||
m_Crafter = reader.ReadMobile();
|
||||
m_Quality = (ToolQuality)reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_UsesRemaining = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_Crafter = reader.ReadMobile();
|
||||
m_Quality = (ToolQuality) reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_UsesRemaining = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
private class ToggleMiningStoneEntry : ContextMenuEntry
|
||||
{
|
||||
private PlayerMobile m_Mobile;
|
||||
private bool m_Value;
|
||||
|
||||
#region ICraftable Members
|
||||
public ToggleMiningStoneEntry(PlayerMobile mobile, bool value, int number) : base(number)
|
||||
{
|
||||
m_Mobile = mobile;
|
||||
m_Value = value;
|
||||
|
||||
public int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue )
|
||||
{
|
||||
Quality = (ToolQuality)quality;
|
||||
bool stoneMining = mobile.StoneMining && mobile.Skills[SkillName.Mining].Base >= 100.0;
|
||||
|
||||
if ( makersMark )
|
||||
Crafter = from;
|
||||
if (mobile.ToggleMiningStone == value || value && !stoneMining)
|
||||
Flags |= CMEFlags.Disabled;
|
||||
}
|
||||
|
||||
return quality;
|
||||
}
|
||||
public override void OnClick()
|
||||
{
|
||||
bool oldValue = m_Mobile.ToggleMiningStone;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
if (m_Value)
|
||||
{
|
||||
if (oldValue)
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(1054023); // You are already set to mine both ore and stone!
|
||||
}
|
||||
else if (!m_Mobile.StoneMining || m_Mobile.Skills[SkillName.Mining].Base < 100.0)
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(
|
||||
1054024); // You have not learned how to mine stone or you do not have enough skill!
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.ToggleMiningStone = true;
|
||||
m_Mobile.SendLocalizedMessage(1054022); // You are now set to mine both ore and stone.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (oldValue)
|
||||
{
|
||||
m_Mobile.ToggleMiningStone = false;
|
||||
m_Mobile.SendLocalizedMessage(1054020); // You are now set to mine only ore.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(1054021); // You are already set to mine only ore!
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,62 +2,62 @@ using Server.Engines.Harvest;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class GargoylesPickaxe : BaseAxe, IUsesRemaining
|
||||
{
|
||||
public override int LabelNumber => 1041281; // a gargoyle's pickaxe
|
||||
public override HarvestSystem HarvestSystem => Mining.System;
|
||||
public class GargoylesPickaxe : BaseAxe, IUsesRemaining
|
||||
{
|
||||
[Constructible]
|
||||
public GargoylesPickaxe() : this(Utility.RandomMinMax(101, 125))
|
||||
{
|
||||
}
|
||||
|
||||
public override WeaponAbility PrimaryAbility => WeaponAbility.DoubleStrike;
|
||||
public override WeaponAbility SecondaryAbility => WeaponAbility.Disarm;
|
||||
[Constructible]
|
||||
public GargoylesPickaxe(int uses) : base(0xE85 + Utility.Random(2))
|
||||
{
|
||||
Weight = 11.0;
|
||||
UsesRemaining = uses;
|
||||
ShowUsesRemaining = true;
|
||||
}
|
||||
|
||||
public override int AosStrengthReq => 50;
|
||||
public override int AosMinDamage => 13;
|
||||
public override int AosMaxDamage => 15;
|
||||
public override int AosSpeed => 35;
|
||||
public override float MlSpeed => 3.00f;
|
||||
public GargoylesPickaxe(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int OldStrengthReq => 25;
|
||||
public override int OldMinDamage => 1;
|
||||
public override int OldMaxDamage => 15;
|
||||
public override int OldSpeed => 35;
|
||||
public override int LabelNumber => 1041281; // a gargoyle's pickaxe
|
||||
public override HarvestSystem HarvestSystem => Mining.System;
|
||||
|
||||
public override int InitMinHits => 31;
|
||||
public override int InitMaxHits => 60;
|
||||
public override WeaponAbility PrimaryAbility => WeaponAbility.DoubleStrike;
|
||||
public override WeaponAbility SecondaryAbility => WeaponAbility.Disarm;
|
||||
|
||||
public override WeaponAnimation DefAnimation => WeaponAnimation.Slash1H;
|
||||
public override int AosStrengthReq => 50;
|
||||
public override int AosMinDamage => 13;
|
||||
public override int AosMaxDamage => 15;
|
||||
public override int AosSpeed => 35;
|
||||
public override float MlSpeed => 3.00f;
|
||||
|
||||
[Constructible]
|
||||
public GargoylesPickaxe() : this( Utility.RandomMinMax( 101, 125 ))
|
||||
{
|
||||
}
|
||||
public override int OldStrengthReq => 25;
|
||||
public override int OldMinDamage => 1;
|
||||
public override int OldMaxDamage => 15;
|
||||
public override int OldSpeed => 35;
|
||||
|
||||
[Constructible]
|
||||
public GargoylesPickaxe( int uses ) : base( 0xE85 + Utility.Random( 2 ))
|
||||
{
|
||||
Weight = 11.0;
|
||||
UsesRemaining = uses;
|
||||
ShowUsesRemaining = true;
|
||||
}
|
||||
public override int InitMinHits => 31;
|
||||
public override int InitMaxHits => 60;
|
||||
|
||||
public GargoylesPickaxe( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override WeaponAnimation DefAnimation => WeaponAnimation.Slash1H;
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
if ( Hue == 0x973 )
|
||||
Hue = 0x0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Hue == 0x973)
|
||||
Hue = 0x0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,174 +1,181 @@
|
|||
using System;
|
||||
using Server.Targeting;
|
||||
using Server.Engines.Harvest;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ProspectorsTool : BaseBashing, IUsesRemaining
|
||||
{
|
||||
private int m_UsesRemaining;
|
||||
public class ProspectorsTool : BaseBashing, IUsesRemaining
|
||||
{
|
||||
private int m_UsesRemaining;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int UsesRemaining
|
||||
{
|
||||
get => m_UsesRemaining;
|
||||
set { m_UsesRemaining = value; InvalidateProperties(); }
|
||||
}
|
||||
[Constructible]
|
||||
public ProspectorsTool() : base(0xFB4)
|
||||
{
|
||||
Weight = 9.0;
|
||||
UsesRemaining = 50;
|
||||
}
|
||||
|
||||
public bool ShowUsesRemaining{ get => true;
|
||||
set{} }
|
||||
public ProspectorsTool(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1049065; // prospector's tool
|
||||
public override int LabelNumber => 1049065; // prospector's tool
|
||||
|
||||
public override WeaponAbility PrimaryAbility => WeaponAbility.CrushingBlow;
|
||||
public override WeaponAbility SecondaryAbility => WeaponAbility.ShadowStrike;
|
||||
public override WeaponAbility PrimaryAbility => WeaponAbility.CrushingBlow;
|
||||
public override WeaponAbility SecondaryAbility => WeaponAbility.ShadowStrike;
|
||||
|
||||
public override int AosStrengthReq => 40;
|
||||
public override int AosMinDamage => 13;
|
||||
public override int AosMaxDamage => 15;
|
||||
public override int AosSpeed => 33;
|
||||
public override int AosStrengthReq => 40;
|
||||
public override int AosMinDamage => 13;
|
||||
public override int AosMaxDamage => 15;
|
||||
public override int AosSpeed => 33;
|
||||
|
||||
public override int OldStrengthReq => 10;
|
||||
public override int OldMinDamage => 6;
|
||||
public override int OldMaxDamage => 8;
|
||||
public override int OldSpeed => 33;
|
||||
public override int OldStrengthReq => 10;
|
||||
public override int OldMinDamage => 6;
|
||||
public override int OldMaxDamage => 8;
|
||||
public override int OldSpeed => 33;
|
||||
|
||||
[Constructible]
|
||||
public ProspectorsTool() : base( 0xFB4 )
|
||||
{
|
||||
Weight = 9.0;
|
||||
UsesRemaining = 50;
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int UsesRemaining
|
||||
{
|
||||
get => m_UsesRemaining;
|
||||
set
|
||||
{
|
||||
m_UsesRemaining = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public ProspectorsTool( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public bool ShowUsesRemaining
|
||||
{
|
||||
get => true;
|
||||
set { }
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( IsChildOf( from.Backpack ) || Parent == from )
|
||||
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) || Parent == from)
|
||||
from.Target = new InternalTarget(this);
|
||||
else
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
|
||||
public void Prospect( Mobile from, object toProspect )
|
||||
{
|
||||
if ( !IsChildOf( from.Backpack ) && Parent != from )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
return;
|
||||
}
|
||||
public void Prospect(Mobile from, object toProspect)
|
||||
{
|
||||
if (!IsChildOf(from.Backpack) && Parent != from)
|
||||
{
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
HarvestSystem system = Mining.System;
|
||||
HarvestSystem system = Mining.System;
|
||||
|
||||
int tileID;
|
||||
Map map;
|
||||
Point3D loc;
|
||||
int tileID;
|
||||
Map map;
|
||||
Point3D loc;
|
||||
|
||||
if ( !system.GetHarvestDetails( from, this, toProspect, out tileID, out map, out loc ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049048 ); // You cannot use your prospector tool on that.
|
||||
return;
|
||||
}
|
||||
if (!system.GetHarvestDetails(from, this, toProspect, out tileID, out map, out loc))
|
||||
{
|
||||
from.SendLocalizedMessage(1049048); // You cannot use your prospector tool on that.
|
||||
return;
|
||||
}
|
||||
|
||||
HarvestDefinition def = system.GetDefinition( tileID );
|
||||
HarvestDefinition def = system.GetDefinition(tileID);
|
||||
|
||||
if ( def == null || def.Veins.Length <= 1 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049048 ); // You cannot use your prospector tool on that.
|
||||
return;
|
||||
}
|
||||
if (def == null || def.Veins.Length <= 1)
|
||||
{
|
||||
from.SendLocalizedMessage(1049048); // You cannot use your prospector tool on that.
|
||||
return;
|
||||
}
|
||||
|
||||
HarvestBank bank = def.GetBank( map, loc.X, loc.Y );
|
||||
HarvestBank bank = def.GetBank(map, loc.X, loc.Y);
|
||||
|
||||
if ( bank == null )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049048 ); // You cannot use your prospector tool on that.
|
||||
return;
|
||||
}
|
||||
if (bank == null)
|
||||
{
|
||||
from.SendLocalizedMessage(1049048); // You cannot use your prospector tool on that.
|
||||
return;
|
||||
}
|
||||
|
||||
HarvestVein vein = bank.Vein, defaultVein = bank.DefaultVein;
|
||||
HarvestVein vein = bank.Vein, defaultVein = bank.DefaultVein;
|
||||
|
||||
if ( vein == null || defaultVein == null )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049048 ); // You cannot use your prospector tool on that.
|
||||
return;
|
||||
}
|
||||
if (vein == null || defaultVein == null)
|
||||
{
|
||||
from.SendLocalizedMessage(1049048); // You cannot use your prospector tool on that.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( vein != defaultVein )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049049 ); // That ore looks to be prospected already.
|
||||
return;
|
||||
}
|
||||
if (vein != defaultVein)
|
||||
{
|
||||
from.SendLocalizedMessage(1049049); // That ore looks to be prospected already.
|
||||
return;
|
||||
}
|
||||
|
||||
int veinIndex = Array.IndexOf( def.Veins, vein );
|
||||
int veinIndex = Array.IndexOf(def.Veins, vein);
|
||||
|
||||
if ( veinIndex < 0 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049048 ); // You cannot use your prospector tool on that.
|
||||
}
|
||||
else if ( veinIndex >= (def.Veins.Length - 1) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049061 ); // You cannot improve valorite ore through prospecting.
|
||||
}
|
||||
else
|
||||
{
|
||||
bank.Vein = def.Veins[veinIndex + 1];
|
||||
from.SendLocalizedMessage( 1049050 + veinIndex );
|
||||
if (veinIndex < 0)
|
||||
{
|
||||
from.SendLocalizedMessage(1049048); // You cannot use your prospector tool on that.
|
||||
}
|
||||
else if (veinIndex >= def.Veins.Length - 1)
|
||||
{
|
||||
from.SendLocalizedMessage(1049061); // You cannot improve valorite ore through prospecting.
|
||||
}
|
||||
else
|
||||
{
|
||||
bank.Vein = def.Veins[veinIndex + 1];
|
||||
from.SendLocalizedMessage(1049050 + veinIndex);
|
||||
|
||||
--UsesRemaining;
|
||||
--UsesRemaining;
|
||||
|
||||
if ( UsesRemaining <= 0 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049062 ); // You have used up your prospector's tool.
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (UsesRemaining <= 0)
|
||||
{
|
||||
from.SendLocalizedMessage(1049062); // You have used up your prospector's tool.
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
writer.Write( (int) m_UsesRemaining );
|
||||
}
|
||||
writer.Write(1); // version
|
||||
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 1:
|
||||
{
|
||||
m_UsesRemaining = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_UsesRemaining = 50;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_UsesRemaining = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_UsesRemaining = 50;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private ProspectorsTool m_Tool;
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private ProspectorsTool m_Tool;
|
||||
|
||||
public InternalTarget( ProspectorsTool tool ) : base( 2, true, TargetFlags.None )
|
||||
{
|
||||
m_Tool = tool;
|
||||
}
|
||||
public InternalTarget(ProspectorsTool tool) : base(2, true, TargetFlags.None)
|
||||
{
|
||||
m_Tool = tool;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
m_Tool.Prospect( from, targeted );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
m_Tool.Prospect(from, targeted);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,37 +2,37 @@ using Server.Engines.Harvest;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class Shovel : BaseHarvestTool
|
||||
{
|
||||
public override HarvestSystem HarvestSystem => Mining.System;
|
||||
public class Shovel : BaseHarvestTool
|
||||
{
|
||||
[Constructible]
|
||||
public Shovel() : this(50)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Shovel() : this( 50 )
|
||||
{
|
||||
}
|
||||
[Constructible]
|
||||
public Shovel(int uses) : base(uses, 0xF39)
|
||||
{
|
||||
Weight = 5.0;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Shovel( int uses ) : base( uses, 0xF39 )
|
||||
{
|
||||
Weight = 5.0;
|
||||
}
|
||||
public Shovel(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public Shovel( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override HarvestSystem HarvestSystem => Mining.System;
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,57 +2,57 @@ using Server.Engines.Harvest;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class SturdyPickaxe : BaseAxe, IUsesRemaining
|
||||
{
|
||||
public override int LabelNumber => 1045126; // sturdy pickaxe
|
||||
public override HarvestSystem HarvestSystem => Mining.System;
|
||||
public class SturdyPickaxe : BaseAxe, IUsesRemaining
|
||||
{
|
||||
[Constructible]
|
||||
public SturdyPickaxe() : this(180)
|
||||
{
|
||||
}
|
||||
|
||||
public override WeaponAbility PrimaryAbility => WeaponAbility.DoubleStrike;
|
||||
public override WeaponAbility SecondaryAbility => WeaponAbility.Disarm;
|
||||
[Constructible]
|
||||
public SturdyPickaxe(int uses) : base(0xE86)
|
||||
{
|
||||
Weight = 11.0;
|
||||
Hue = 0x973;
|
||||
UsesRemaining = uses;
|
||||
ShowUsesRemaining = true;
|
||||
}
|
||||
|
||||
public override int AosStrengthReq => 50;
|
||||
public override int AosMinDamage => 13;
|
||||
public override int AosMaxDamage => 15;
|
||||
public override int AosSpeed => 35;
|
||||
public override float MlSpeed => 3.00f;
|
||||
public SturdyPickaxe(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int OldStrengthReq => 25;
|
||||
public override int OldMinDamage => 1;
|
||||
public override int OldMaxDamage => 15;
|
||||
public override int OldSpeed => 35;
|
||||
public override int LabelNumber => 1045126; // sturdy pickaxe
|
||||
public override HarvestSystem HarvestSystem => Mining.System;
|
||||
|
||||
public override WeaponAnimation DefAnimation => WeaponAnimation.Slash1H;
|
||||
public override WeaponAbility PrimaryAbility => WeaponAbility.DoubleStrike;
|
||||
public override WeaponAbility SecondaryAbility => WeaponAbility.Disarm;
|
||||
|
||||
[Constructible]
|
||||
public SturdyPickaxe() : this( 180 )
|
||||
{
|
||||
}
|
||||
public override int AosStrengthReq => 50;
|
||||
public override int AosMinDamage => 13;
|
||||
public override int AosMaxDamage => 15;
|
||||
public override int AosSpeed => 35;
|
||||
public override float MlSpeed => 3.00f;
|
||||
|
||||
[Constructible]
|
||||
public SturdyPickaxe( int uses ) : base( 0xE86 )
|
||||
{
|
||||
Weight = 11.0;
|
||||
Hue = 0x973;
|
||||
UsesRemaining = uses;
|
||||
ShowUsesRemaining = true;
|
||||
}
|
||||
public override int OldStrengthReq => 25;
|
||||
public override int OldMinDamage => 1;
|
||||
public override int OldMaxDamage => 15;
|
||||
public override int OldSpeed => 35;
|
||||
|
||||
public SturdyPickaxe( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override WeaponAnimation DefAnimation => WeaponAnimation.Slash1H;
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,39 +2,39 @@ using Server.Engines.Harvest;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class SturdyShovel : BaseHarvestTool
|
||||
{
|
||||
public override int LabelNumber => 1045125; // sturdy shovel
|
||||
public override HarvestSystem HarvestSystem => Mining.System;
|
||||
public class SturdyShovel : BaseHarvestTool
|
||||
{
|
||||
[Constructible]
|
||||
public SturdyShovel() : this(180)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public SturdyShovel() : this( 180 )
|
||||
{
|
||||
}
|
||||
[Constructible]
|
||||
public SturdyShovel(int uses) : base(uses, 0xF39)
|
||||
{
|
||||
Weight = 5.0;
|
||||
Hue = 0x973;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public SturdyShovel( int uses ) : base( uses, 0xF39 )
|
||||
{
|
||||
Weight = 5.0;
|
||||
Hue = 0x973;
|
||||
}
|
||||
public SturdyShovel(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public SturdyShovel( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int LabelNumber => 1045125; // sturdy shovel
|
||||
public override HarvestSystem HarvestSystem => Mining.System;
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue