Reorganizes Project (#41)
This commit is contained in:
parent
08bf44af9a
commit
3614a66aee
3499 changed files with 79 additions and 55 deletions
|
|
@ -0,0 +1,256 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.ContextMenus;
|
||||
using Server.Engines.Craft;
|
||||
using Server.Engines.Harvest;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
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 BaseHarvestTool(int itemID, int usesRemaining = 50) : base(itemID)
|
||||
{
|
||||
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; }
|
||||
|
||||
#region ICraftable Members
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
[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;
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public void UnscaleUses()
|
||||
{
|
||||
m_UsesRemaining = m_UsesRemaining * 100 / GetUsesScalar();
|
||||
}
|
||||
|
||||
public int GetUsesScalar()
|
||||
{
|
||||
if (m_Quality == ToolQuality.Exceptional)
|
||||
return 200;
|
||||
|
||||
return 100;
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList 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 (m_Quality == ToolQuality.Exceptional)
|
||||
list.Add(1060636); // exceptional
|
||||
|
||||
list.Add(1060584, m_UsesRemaining.ToString()); // uses remaining: ~1_val~
|
||||
}
|
||||
|
||||
public virtual void DisplayDurabilityTo(Mobile m)
|
||||
{
|
||||
LabelToAffix(m, 1017323, AffixType.Append, ": " + m_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;
|
||||
|
||||
if (!item.IsChildOf(from.Backpack) && item.Parent != from)
|
||||
return;
|
||||
|
||||
if (!(from is PlayerMobile pm))
|
||||
return;
|
||||
|
||||
ContextMenuEntry 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(GenericWriter 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(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class ToggleMiningStoneEntry : ContextMenuEntry
|
||||
{
|
||||
private PlayerMobile m_Mobile;
|
||||
private bool m_Value;
|
||||
|
||||
public ToggleMiningStoneEntry(PlayerMobile mobile, bool value, int number) : base(number)
|
||||
{
|
||||
m_Mobile = mobile;
|
||||
m_Value = value;
|
||||
|
||||
bool stoneMining = mobile.StoneMining && mobile.Skills.Mining.Base >= 100.0;
|
||||
|
||||
if (mobile.ToggleMiningStone == value || value && !stoneMining)
|
||||
Flags |= CMEFlags.Disabled;
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
bool oldValue = m_Mobile.ToggleMiningStone;
|
||||
|
||||
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.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!
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
using Server.Engines.Harvest;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class GargoylesPickaxe : BaseAxe, IUsesRemaining
|
||||
{
|
||||
[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(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if (Hue == 0x973)
|
||||
Hue = 0x0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,177 @@
|
|||
using System;
|
||||
using Server.Engines.Harvest;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ProspectorsTool : BaseBashing, IUsesRemaining
|
||||
{
|
||||
private int m_UsesRemaining;
|
||||
|
||||
[Constructible]
|
||||
public ProspectorsTool() : base(0xFB4)
|
||||
{
|
||||
Weight = 9.0;
|
||||
UsesRemaining = 50;
|
||||
}
|
||||
|
||||
public ProspectorsTool(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int UsesRemaining
|
||||
{
|
||||
get => m_UsesRemaining;
|
||||
set
|
||||
{
|
||||
m_UsesRemaining = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
bool IUsesRemaining.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 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;
|
||||
|
||||
if (!system.GetHarvestDetails(from, this, toProspect, out int tileID, out Map map, out Point3D loc))
|
||||
{
|
||||
from.SendLocalizedMessage(1049048); // You cannot use your prospector tool on that.
|
||||
return;
|
||||
}
|
||||
|
||||
HarvestDefinition def = system.GetDefinition(tileID);
|
||||
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
--UsesRemaining;
|
||||
|
||||
if (UsesRemaining <= 0)
|
||||
{
|
||||
from.SendLocalizedMessage(1049062); // You have used up your prospector's tool.
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(1); // version
|
||||
writer.Write(m_UsesRemaining);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_UsesRemaining = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_UsesRemaining = 50;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private ProspectorsTool m_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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
33
Projects/Scripts/Items/Skill Items/Harvest Tools/Shovel.cs
Normal file
33
Projects/Scripts/Items/Skill Items/Harvest Tools/Shovel.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
using Server.Engines.Harvest;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class Shovel : BaseHarvestTool
|
||||
{
|
||||
[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(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
using Server.Engines.Harvest;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class SturdyPickaxe : BaseAxe, IUsesRemaining
|
||||
{
|
||||
[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(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
using Server.Engines.Harvest;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class SturdyShovel : BaseHarvestTool
|
||||
{
|
||||
[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(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue