using System; using System.Collections.Generic; using Server.ContextMenus; using Server.Engines.Harvest; namespace Server.Items { public interface IAxe { bool Axe(Mobile from, BaseAxe axe); } public abstract class BaseAxe : BaseMeleeWeapon, IHarvestTool { public BaseAxe(int itemID) : base(itemID) { } public BaseAxe(Serial serial) : base(serial) { } public override int DefHitSound { get { return 0x232; } } public override int DefMissSound { get { return 0x23A; } } public override SkillName DefSkill { get { return SkillName.Swords; } } public override WeaponType DefType { get { return WeaponType.Axe; } } public override WeaponAnimation DefAnimation { get { return WeaponAnimation.Slash2H; } } public virtual HarvestSystem HarvestSystem { get { return Lumberjacking.System; } } public override void OnDoubleClick(Mobile from) { if (HarvestSystem == null || Deleted) return; Point3D loc = GetWorldLocation(); if (!from.InLOS(loc) || !from.InRange(loc, 2)) { from.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3E9, 1019045); // I can't reach that return; } else if (!IsAccessibleTo(from)) { PublicOverheadMessage(Server.Network.MessageType.Regular, 0x3E9, 1061637); // You are not allowed to access return; } if (!(HarvestSystem is Mining)) from.SendLocalizedMessage(1010018); // What do you want to use this item on? HarvestSystem.BeginHarvesting(from, this); } public override void GetContextMenuEntries(Mobile from, List list) { base.GetContextMenuEntries(from, list); if (HarvestSystem == null) return; BaseHarvestTool.AddContextMenuEntries(from, this, list, HarvestSystem); } public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write((int)3); // version } public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch ( version ) { case 3: break; case 2: { if(version == 2) ShowUsesRemaining = reader.ReadBool(); goto case 1; } case 1: { if(version == 2) UsesRemaining = reader.ReadInt(); goto case 0; } case 0: { break; } } } public override void OnHit(Mobile attacker, IDamageable defender, double damageBonus) { base.OnHit(attacker, defender, damageBonus); if (!Core.AOS && defender is Mobile && (attacker.Player || attacker.Body.IsHuman) && Layer == Layer.TwoHanded && (attacker.Skills[SkillName.Anatomy].Value / 400.0) >= Utility.RandomDouble()) { StatMod mod = ((Mobile)defender).GetStatMod("Concussion"); if (mod == null) { ((Mobile)defender).SendMessage("You receive a concussion blow!"); ((Mobile)defender).AddStatMod(new StatMod(StatType.Int, "Concussion", -(((Mobile)defender).RawInt / 2), TimeSpan.FromSeconds(30.0))); attacker.SendMessage("You deliver a concussion blow!"); attacker.PlaySound(0x308); } } } } }