fix: Codegens tools and magical skill items (#1299)
This commit is contained in:
parent
f314c63175
commit
899c2e868d
24 changed files with 1529 additions and 1732 deletions
|
|
@ -1,273 +1,229 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ModernUO.Serialization;
|
||||
using Server.ContextMenus;
|
||||
using Server.Engines.Craft;
|
||||
using Server.Engines.Harvest;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
namespace Server.Items;
|
||||
|
||||
public interface IUsesRemaining
|
||||
{
|
||||
public interface IUsesRemaining
|
||||
int UsesRemaining { get; set; }
|
||||
bool ShowUsesRemaining { get; set; }
|
||||
}
|
||||
|
||||
[SerializationGenerator(2, false)]
|
||||
public abstract partial class BaseHarvestTool : Item, IUsesRemaining, ICraftable
|
||||
{
|
||||
[InvalidateProperties]
|
||||
[SerializableField(0)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private string _crafter;
|
||||
|
||||
[InvalidateProperties]
|
||||
[SerializableField(2)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private int _usesRemaining;
|
||||
|
||||
public BaseHarvestTool(int itemID, int usesRemaining = 50) : base(itemID)
|
||||
{
|
||||
int UsesRemaining { get; set; }
|
||||
bool ShowUsesRemaining { get; set; }
|
||||
_usesRemaining = usesRemaining;
|
||||
_quality = ToolQuality.Regular;
|
||||
}
|
||||
|
||||
public abstract class BaseHarvestTool : Item, IUsesRemaining, ICraftable
|
||||
[SerializableProperty(1)]
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public ToolQuality Quality
|
||||
{
|
||||
private Mobile m_Crafter;
|
||||
private ToolQuality m_Quality;
|
||||
private int m_UsesRemaining;
|
||||
|
||||
public BaseHarvestTool(int itemID, int usesRemaining = 50) : base(itemID)
|
||||
get => _quality;
|
||||
set
|
||||
{
|
||||
m_UsesRemaining = usesRemaining;
|
||||
m_Quality = ToolQuality.Regular;
|
||||
}
|
||||
|
||||
public BaseHarvestTool(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile Crafter
|
||||
{
|
||||
get => m_Crafter;
|
||||
set
|
||||
{
|
||||
m_Crafter = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public ToolQuality Quality
|
||||
{
|
||||
get => m_Quality;
|
||||
set
|
||||
{
|
||||
UnscaleUses();
|
||||
m_Quality = value;
|
||||
InvalidateProperties();
|
||||
ScaleUses();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract HarvestSystem HarvestSystem { get; }
|
||||
|
||||
public int OnCraft(
|
||||
int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
|
||||
CraftItem craftItem, int resHue
|
||||
)
|
||||
{
|
||||
Quality = (ToolQuality)quality;
|
||||
|
||||
if (makersMark)
|
||||
{
|
||||
Crafter = from;
|
||||
}
|
||||
|
||||
return quality;
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int UsesRemaining
|
||||
{
|
||||
get => m_UsesRemaining;
|
||||
set
|
||||
{
|
||||
m_UsesRemaining = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
bool IUsesRemaining.ShowUsesRemaining
|
||||
{
|
||||
get => true;
|
||||
set { }
|
||||
}
|
||||
|
||||
public void ScaleUses()
|
||||
{
|
||||
m_UsesRemaining = m_UsesRemaining * GetUsesScalar() / 100;
|
||||
UnscaleUses();
|
||||
_quality = value;
|
||||
InvalidateProperties();
|
||||
ScaleUses();
|
||||
this.MarkDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract HarvestSystem HarvestSystem { get; }
|
||||
|
||||
public int OnCraft(
|
||||
int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
|
||||
CraftItem craftItem, int resHue
|
||||
)
|
||||
{
|
||||
Quality = (ToolQuality)quality;
|
||||
|
||||
if (makersMark)
|
||||
{
|
||||
Crafter = from?.RawName;
|
||||
}
|
||||
|
||||
public void UnscaleUses()
|
||||
return quality;
|
||||
}
|
||||
|
||||
bool IUsesRemaining.ShowUsesRemaining
|
||||
{
|
||||
get => true;
|
||||
set { }
|
||||
}
|
||||
|
||||
public void ScaleUses()
|
||||
{
|
||||
_usesRemaining = _usesRemaining * GetUsesScalar() / 100;
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public void UnscaleUses()
|
||||
{
|
||||
_usesRemaining = _usesRemaining * 100 / GetUsesScalar();
|
||||
}
|
||||
|
||||
public int GetUsesScalar() => _quality == ToolQuality.Exceptional ? 200 : 100;
|
||||
|
||||
public override void GetProperties(IPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
// Makers mark not displayed on OSI
|
||||
// if (m_Crafter != null)
|
||||
// list.Add( 1050043, m_Crafter.Name ); // crafted by ~1_NAME~
|
||||
|
||||
if (_quality == ToolQuality.Exceptional)
|
||||
{
|
||||
m_UsesRemaining = m_UsesRemaining * 100 / GetUsesScalar();
|
||||
list.Add(1060636); // exceptional
|
||||
}
|
||||
|
||||
public int GetUsesScalar()
|
||||
{
|
||||
if (m_Quality == ToolQuality.Exceptional)
|
||||
{
|
||||
return 200;
|
||||
}
|
||||
list.Add(1060584, _usesRemaining); // uses remaining: ~1_val~
|
||||
}
|
||||
|
||||
return 100;
|
||||
public virtual void DisplayDurabilityTo(Mobile m)
|
||||
{
|
||||
LabelToAffix(m, 1017323, AffixType.Append, $": {_usesRemaining}"); // Durability
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
DisplayDurabilityTo(from);
|
||||
|
||||
base.OnSingleClick(from);
|
||||
}
|
||||
|
||||
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.
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||
{
|
||||
base.GetContextMenuEntries(from, list);
|
||||
|
||||
AddContextMenuEntries(from, this, list, HarvestSystem);
|
||||
}
|
||||
|
||||
public static void AddContextMenuEntries(Mobile from, Item item, List<ContextMenuEntry> list, HarvestSystem system)
|
||||
{
|
||||
if (system != Mining.System)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public override void GetProperties(IPropertyList list)
|
||||
if (!item.IsChildOf(from.Backpack) && item.Parent != from)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
// Makers mark not displayed on OSI
|
||||
// if (m_Crafter != null)
|
||||
// list.Add( 1050043, m_Crafter.Name ); // crafted by ~1_NAME~
|
||||
|
||||
if (m_Quality == ToolQuality.Exceptional)
|
||||
{
|
||||
list.Add(1060636); // exceptional
|
||||
}
|
||||
|
||||
list.Add(1060584, m_UsesRemaining); // uses remaining: ~1_val~
|
||||
return;
|
||||
}
|
||||
|
||||
public virtual void DisplayDurabilityTo(Mobile m)
|
||||
if (from is not PlayerMobile pm)
|
||||
{
|
||||
LabelToAffix(m, 1017323, AffixType.Append, $": {m_UsesRemaining}"); // Durability
|
||||
return;
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
var miningEntry = new ContextMenuEntry(pm.ToggleMiningStone ? 6179 : 6178);
|
||||
miningEntry.Color = 0x421F;
|
||||
list.Add(miningEntry);
|
||||
|
||||
list.Add(new ToggleMiningStoneEntry(pm, false, 6176));
|
||||
list.Add(new ToggleMiningStoneEntry(pm, true, 6177));
|
||||
}
|
||||
|
||||
private void Deserialize(IGenericReader reader, int version)
|
||||
{
|
||||
var crafter = reader.ReadEntity<Mobile>();
|
||||
_quality = (ToolQuality)reader.ReadInt();
|
||||
_usesRemaining = reader.ReadInt();
|
||||
|
||||
if (crafter != null)
|
||||
{
|
||||
DisplayDurabilityTo(from);
|
||||
|
||||
base.OnSingleClick(from);
|
||||
}
|
||||
|
||||
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.
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||
{
|
||||
base.GetContextMenuEntries(from, list);
|
||||
|
||||
AddContextMenuEntries(from, this, list, HarvestSystem);
|
||||
}
|
||||
|
||||
public static void AddContextMenuEntries(Mobile from, Item item, List<ContextMenuEntry> list, HarvestSystem system)
|
||||
{
|
||||
if (system != Mining.System)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!item.IsChildOf(from.Backpack) && item.Parent != from)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (from is not PlayerMobile pm)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var miningEntry = new ContextMenuEntry(pm.ToggleMiningStone ? 6179 : 6178);
|
||||
miningEntry.Color = 0x421F;
|
||||
list.Add(miningEntry);
|
||||
|
||||
list.Add(new ToggleMiningStoneEntry(pm, false, 6176));
|
||||
list.Add(new ToggleMiningStoneEntry(pm, true, 6177));
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(1); // version
|
||||
|
||||
writer.Write(m_Crafter);
|
||||
writer.Write((int)m_Quality);
|
||||
|
||||
writer.Write(m_UsesRemaining);
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_Crafter = reader.ReadEntity<Mobile>();
|
||||
m_Quality = (ToolQuality)reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_UsesRemaining = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class ToggleMiningStoneEntry : ContextMenuEntry
|
||||
{
|
||||
private readonly PlayerMobile m_Mobile;
|
||||
private readonly bool m_Value;
|
||||
|
||||
public ToggleMiningStoneEntry(PlayerMobile mobile, bool value, int number) : base(number)
|
||||
{
|
||||
m_Mobile = mobile;
|
||||
m_Value = value;
|
||||
|
||||
var stoneMining = mobile.StoneMining && mobile.Skills.Mining.Base >= 100.0;
|
||||
|
||||
if (mobile.ToggleMiningStone == value || value && !stoneMining)
|
||||
Timer.DelayCall(
|
||||
(tool, m) =>
|
||||
{
|
||||
Flags |= CMEFlags.Disabled;
|
||||
tool._crafter = m.RawName;
|
||||
},
|
||||
this,
|
||||
crafter
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private class ToggleMiningStoneEntry : ContextMenuEntry
|
||||
{
|
||||
private PlayerMobile _mobile;
|
||||
private bool _value;
|
||||
|
||||
public ToggleMiningStoneEntry(PlayerMobile mobile, bool value, int number) : base(number)
|
||||
{
|
||||
_mobile = mobile;
|
||||
_value = value;
|
||||
|
||||
var stoneMining = mobile.StoneMining && mobile.Skills.Mining.Base >= 100.0;
|
||||
|
||||
if (mobile.ToggleMiningStone == value || value && !stoneMining)
|
||||
{
|
||||
Flags |= CMEFlags.Disabled;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
var oldValue = _mobile.ToggleMiningStone;
|
||||
|
||||
if (_value)
|
||||
{
|
||||
if (oldValue)
|
||||
{
|
||||
_mobile.SendLocalizedMessage(1054023); // You are already set to mine both ore and stone!
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
var oldValue = m_Mobile.ToggleMiningStone;
|
||||
|
||||
if (m_Value)
|
||||
else if (!_mobile.StoneMining || _mobile.Skills.Mining.Base < 100.0)
|
||||
{
|
||||
if (oldValue)
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(1054023); // You are already set to mine both ore and stone!
|
||||
}
|
||||
else if (!m_Mobile.StoneMining || m_Mobile.Skills.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.
|
||||
}
|
||||
// You have not learned how to mine stone or you do not have enough skill!
|
||||
_mobile.SendLocalizedMessage(1054024);
|
||||
}
|
||||
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!
|
||||
}
|
||||
_mobile.ToggleMiningStone = true;
|
||||
_mobile.SendLocalizedMessage(1054022); // You are now set to mine both ore and stone.
|
||||
}
|
||||
}
|
||||
else if (oldValue)
|
||||
{
|
||||
_mobile.ToggleMiningStone = false;
|
||||
_mobile.SendLocalizedMessage(1054020); // You are now set to mine only ore.
|
||||
}
|
||||
else
|
||||
{
|
||||
_mobile.SendLocalizedMessage(1054021); // You are already set to mine only ore!
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,65 +1,43 @@
|
|||
using ModernUO.Serialization;
|
||||
using Server.Engines.Harvest;
|
||||
|
||||
namespace Server.Items
|
||||
namespace Server.Items;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class GargoylesPickaxe : BaseAxe, IUsesRemaining
|
||||
{
|
||||
public class GargoylesPickaxe : BaseAxe, IUsesRemaining
|
||||
[Constructible]
|
||||
public GargoylesPickaxe() : this(Utility.RandomMinMax(101, 125))
|
||||
{
|
||||
[Constructible]
|
||||
public GargoylesPickaxe() : this(Utility.RandomMinMax(101, 125))
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public GargoylesPickaxe(int uses) : base(0xE85 + Utility.Random(2))
|
||||
{
|
||||
Weight = 11.0;
|
||||
UsesRemaining = uses;
|
||||
ShowUsesRemaining = true;
|
||||
}
|
||||
|
||||
public GargoylesPickaxe(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1041281; // a gargoyle's pickaxe
|
||||
public override HarvestSystem HarvestSystem => Mining.System;
|
||||
|
||||
public override WeaponAbility PrimaryAbility => WeaponAbility.DoubleStrike;
|
||||
public override WeaponAbility SecondaryAbility => WeaponAbility.Disarm;
|
||||
|
||||
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 override int OldStrengthReq => 25;
|
||||
public override int OldMinDamage => 1;
|
||||
public override int OldMaxDamage => 15;
|
||||
public override int OldSpeed => 35;
|
||||
|
||||
public override int InitMinHits => 31;
|
||||
public override int InitMaxHits => 60;
|
||||
|
||||
public override WeaponAnimation DefAnimation => WeaponAnimation.Slash1H;
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
|
||||
if (Hue == 0x973)
|
||||
{
|
||||
Hue = 0x0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public GargoylesPickaxe(int uses) : base(0xE85 + Utility.Random(2))
|
||||
{
|
||||
Weight = 11.0;
|
||||
UsesRemaining = uses;
|
||||
ShowUsesRemaining = true;
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1041281; // a gargoyle's pickaxe
|
||||
public override HarvestSystem HarvestSystem => Mining.System;
|
||||
|
||||
public override WeaponAbility PrimaryAbility => WeaponAbility.DoubleStrike;
|
||||
public override WeaponAbility SecondaryAbility => WeaponAbility.Disarm;
|
||||
|
||||
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 override int OldStrengthReq => 25;
|
||||
public override int OldMinDamage => 1;
|
||||
public override int OldMaxDamage => 15;
|
||||
public override int OldSpeed => 35;
|
||||
|
||||
public override int InitMinHits => 31;
|
||||
public override int InitMaxHits => 60;
|
||||
|
||||
public override WeaponAnimation DefAnimation => WeaponAnimation.Slash1H;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,178 +1,138 @@
|
|||
using System;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Engines.Harvest;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
namespace Server.Items;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class ProspectorsTool : BaseBashing, IUsesRemaining
|
||||
{
|
||||
public class ProspectorsTool : BaseBashing, IUsesRemaining
|
||||
[InvalidateProperties]
|
||||
[SerializableField(0)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private int _usesRemaining;
|
||||
|
||||
[Constructible]
|
||||
public ProspectorsTool() : base(0xFB4)
|
||||
{
|
||||
private int m_UsesRemaining;
|
||||
Weight = 9.0;
|
||||
UsesRemaining = 50;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public ProspectorsTool() : base(0xFB4)
|
||||
public override int LabelNumber => 1049065; // prospector's tool
|
||||
|
||||
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 OldStrengthReq => 10;
|
||||
public override int OldMinDamage => 6;
|
||||
public override int OldMaxDamage => 8;
|
||||
public override int OldSpeed => 33;
|
||||
|
||||
bool IUsesRemaining.ShowUsesRemaining
|
||||
{
|
||||
get => true;
|
||||
set { }
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (IsChildOf(from.Backpack) || Parent == from)
|
||||
{
|
||||
Weight = 9.0;
|
||||
UsesRemaining = 50;
|
||||
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 ProspectorsTool(Serial serial) : base(serial)
|
||||
HarvestSystem system = Mining.System;
|
||||
|
||||
if (!system.GetHarvestDetails(from, this, toProspect, out var tileID, out var map, out var loc))
|
||||
{
|
||||
from.SendLocalizedMessage(1049048); // You cannot use your prospector tool on that.
|
||||
return;
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1049065; // prospector's tool
|
||||
var def = system.GetDefinition(tileID);
|
||||
|
||||
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 OldStrengthReq => 10;
|
||||
public override int OldMinDamage => 6;
|
||||
public override int OldMaxDamage => 8;
|
||||
public override int OldSpeed => 33;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int UsesRemaining
|
||||
if (def == null || def.Veins.Length <= 1)
|
||||
{
|
||||
get => m_UsesRemaining;
|
||||
set
|
||||
{
|
||||
m_UsesRemaining = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
from.SendLocalizedMessage(1049048); // You cannot use your prospector tool on that.
|
||||
return;
|
||||
}
|
||||
|
||||
bool IUsesRemaining.ShowUsesRemaining
|
||||
var bank = def.GetBank(map, loc.X, loc.Y);
|
||||
|
||||
if (bank == null)
|
||||
{
|
||||
get => true;
|
||||
set { }
|
||||
from.SendLocalizedMessage(1049048); // You cannot use your prospector tool on that.
|
||||
return;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
HarvestVein vein = bank.Vein, defaultVein = bank.DefaultVein;
|
||||
|
||||
if (vein == null || defaultVein == null)
|
||||
{
|
||||
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.
|
||||
}
|
||||
from.SendLocalizedMessage(1049048); // You cannot use your prospector tool on that.
|
||||
return;
|
||||
}
|
||||
|
||||
public void Prospect(Mobile from, object toProspect)
|
||||
if (vein != defaultVein)
|
||||
{
|
||||
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;
|
||||
|
||||
if (!system.GetHarvestDetails(from, this, toProspect, out var tileID, out var map, out var loc))
|
||||
{
|
||||
from.SendLocalizedMessage(1049048); // You cannot use your prospector tool on that.
|
||||
return;
|
||||
}
|
||||
|
||||
var def = system.GetDefinition(tileID);
|
||||
|
||||
if (def == null || def.Veins.Length <= 1)
|
||||
{
|
||||
from.SendLocalizedMessage(1049048); // You cannot use your prospector tool on that.
|
||||
return;
|
||||
}
|
||||
|
||||
var bank = def.GetBank(map, loc.X, loc.Y);
|
||||
|
||||
if (bank == null)
|
||||
{
|
||||
from.SendLocalizedMessage(1049048); // You cannot use your prospector tool on that.
|
||||
return;
|
||||
}
|
||||
|
||||
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 != defaultVein)
|
||||
{
|
||||
from.SendLocalizedMessage(1049049); // That ore looks to be prospected already.
|
||||
return;
|
||||
}
|
||||
|
||||
var 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);
|
||||
|
||||
--UsesRemaining;
|
||||
|
||||
if (UsesRemaining <= 0)
|
||||
{
|
||||
from.SendLocalizedMessage(1049062); // You have used up your prospector's tool.
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
from.SendLocalizedMessage(1049049); // That ore looks to be prospected already.
|
||||
return;
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
var veinIndex = Array.IndexOf(def.Veins, vein);
|
||||
|
||||
writer.Write(1); // version
|
||||
writer.Write(m_UsesRemaining);
|
||||
if (veinIndex < 0)
|
||||
{
|
||||
from.SendLocalizedMessage(1049048); // You cannot use your prospector tool on that.
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
else if (veinIndex >= def.Veins.Length - 1)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_UsesRemaining = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_UsesRemaining = 50;
|
||||
break;
|
||||
}
|
||||
}
|
||||
from.SendLocalizedMessage(1049061); // You cannot improve valorite ore through prospecting.
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
else
|
||||
{
|
||||
private readonly ProspectorsTool m_Tool;
|
||||
bank.Vein = def.Veins[veinIndex + 1];
|
||||
from.SendLocalizedMessage(1049050 + veinIndex);
|
||||
|
||||
public InternalTarget(ProspectorsTool tool) : base(2, true, TargetFlags.None) => m_Tool = tool;
|
||||
--UsesRemaining;
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
if (UsesRemaining <= 0)
|
||||
{
|
||||
m_Tool.Prospect(from, targeted);
|
||||
from.SendLocalizedMessage(1049062); // You have used up your prospector's tool.
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private ProspectorsTool _tool;
|
||||
|
||||
public InternalTarget(ProspectorsTool tool) : base(2, true, TargetFlags.None) => _tool = tool;
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
_tool.Prospect(from, targeted);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,30 +1,13 @@
|
|||
using ModernUO.Serialization;
|
||||
using Server.Engines.Harvest;
|
||||
|
||||
namespace Server.Items
|
||||
namespace Server.Items;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class Shovel : BaseHarvestTool
|
||||
{
|
||||
public class Shovel : BaseHarvestTool
|
||||
{
|
||||
[Constructible]
|
||||
public Shovel(int uses = 50) : base(0xF39, uses) => Weight = 5.0;
|
||||
[Constructible]
|
||||
public Shovel(int uses = 50) : base(0xF39, uses) => Weight = 5.0;
|
||||
|
||||
public Shovel(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override HarvestSystem HarvestSystem => Mining.System;
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
public override HarvestSystem HarvestSystem => Mining.System;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,53 +1,36 @@
|
|||
using ModernUO.Serialization;
|
||||
using Server.Engines.Harvest;
|
||||
|
||||
namespace Server.Items
|
||||
namespace Server.Items;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class SturdyPickaxe : BaseAxe, IUsesRemaining
|
||||
{
|
||||
public class SturdyPickaxe : BaseAxe, IUsesRemaining
|
||||
[Constructible]
|
||||
public SturdyPickaxe(int uses = 180) : base(0xE86)
|
||||
{
|
||||
[Constructible]
|
||||
public SturdyPickaxe(int uses = 180) : base(0xE86)
|
||||
{
|
||||
Weight = 11.0;
|
||||
Hue = 0x973;
|
||||
UsesRemaining = uses;
|
||||
ShowUsesRemaining = true;
|
||||
}
|
||||
|
||||
public SturdyPickaxe(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1045126; // sturdy pickaxe
|
||||
public override HarvestSystem HarvestSystem => Mining.System;
|
||||
|
||||
public override WeaponAbility PrimaryAbility => WeaponAbility.DoubleStrike;
|
||||
public override WeaponAbility SecondaryAbility => WeaponAbility.Disarm;
|
||||
|
||||
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 override int OldStrengthReq => 25;
|
||||
public override int OldMinDamage => 1;
|
||||
public override int OldMaxDamage => 15;
|
||||
public override int OldSpeed => 35;
|
||||
|
||||
public override WeaponAnimation DefAnimation => WeaponAnimation.Slash1H;
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
Weight = 11.0;
|
||||
Hue = 0x973;
|
||||
UsesRemaining = uses;
|
||||
ShowUsesRemaining = true;
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1045126; // sturdy pickaxe
|
||||
public override HarvestSystem HarvestSystem => Mining.System;
|
||||
|
||||
public override WeaponAbility PrimaryAbility => WeaponAbility.DoubleStrike;
|
||||
public override WeaponAbility SecondaryAbility => WeaponAbility.Disarm;
|
||||
|
||||
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 override int OldStrengthReq => 25;
|
||||
public override int OldMinDamage => 1;
|
||||
public override int OldMaxDamage => 15;
|
||||
public override int OldSpeed => 35;
|
||||
|
||||
public override WeaponAnimation DefAnimation => WeaponAnimation.Slash1H;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,35 +1,18 @@
|
|||
using ModernUO.Serialization;
|
||||
using Server.Engines.Harvest;
|
||||
|
||||
namespace Server.Items
|
||||
namespace Server.Items;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class SturdyShovel : BaseHarvestTool
|
||||
{
|
||||
public class SturdyShovel : BaseHarvestTool
|
||||
[Constructible]
|
||||
public SturdyShovel(int uses = 180) : base(0xF39, uses)
|
||||
{
|
||||
[Constructible]
|
||||
public SturdyShovel(int uses = 180) : base(0xF39, uses)
|
||||
{
|
||||
Weight = 5.0;
|
||||
Hue = 0x973;
|
||||
}
|
||||
|
||||
public SturdyShovel(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1045125; // sturdy shovel
|
||||
public override HarvestSystem HarvestSystem => Mining.System;
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
Weight = 5.0;
|
||||
Hue = 0x973;
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1045125; // sturdy shovel
|
||||
public override HarvestSystem HarvestSystem => Mining.System;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue