From 0d1620e0a05d3944d59a75a095713d33bf151912 Mon Sep 17 00:00:00 2001 From: WarrentyExpired Date: Wed, 4 Nov 2026 15:29:51 -0500 Subject: [PATCH] #W# Tradesman: There 'Work' item has been moved into the 'Tradesman' file. --- .../Citizens/Citizens/HumanCitizen.cs | 4 +- .../Citizens/Citizens/MonsterCitizen.cs | 4 +- .../Citizens/Tradesmen/ButcherMeat.cs | 69 --------------- .../Citizens/Tradesmen/SmelterForge.cs | 85 ------------------ .../Townfolk/Citizens/Tradesmen/SmithAnvil.cs | 86 ------------------- .../Citizens/Tradesmen/TradesmanButcher.cs | 66 ++++++++++++++ .../Citizens/Tradesmen/TradesmanSmelter.cs | 82 ++++++++++++++++++ .../Citizens/Tradesmen/TradesmanSmith.cs | 83 ++++++++++++++++++ .../Citizens/Tradesmen/TradesmenCitizen.cs | 34 ++++++-- 9 files changed, 261 insertions(+), 252 deletions(-) delete mode 100644 Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/ButcherMeat.cs delete mode 100644 Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/SmelterForge.cs delete mode 100644 Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/SmithAnvil.cs diff --git a/Projects/UOContent/Mobiles/Townfolk/Citizens/Citizens/HumanCitizen.cs b/Projects/UOContent/Mobiles/Townfolk/Citizens/Citizens/HumanCitizen.cs index f2f9943d4..be8dd159c 100644 --- a/Projects/UOContent/Mobiles/Townfolk/Citizens/Citizens/HumanCitizen.cs +++ b/Projects/UOContent/Mobiles/Townfolk/Citizens/Citizens/HumanCitizen.cs @@ -141,7 +141,7 @@ namespace Server.Mobiles Utility.AssignRandomFacialHair(this); } - _NextChatter = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(0, 10)); + _NextChatter = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(10, 20)); } public override void OnThink() @@ -192,7 +192,7 @@ namespace Server.Mobiles Say(line); } - _NextChatter = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(10, 15)); + _NextChatter = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(10, 20)); } } diff --git a/Projects/UOContent/Mobiles/Townfolk/Citizens/Citizens/MonsterCitizen.cs b/Projects/UOContent/Mobiles/Townfolk/Citizens/Citizens/MonsterCitizen.cs index acd93e90d..8e055ad02 100644 --- a/Projects/UOContent/Mobiles/Townfolk/Citizens/Citizens/MonsterCitizen.cs +++ b/Projects/UOContent/Mobiles/Townfolk/Citizens/Citizens/MonsterCitizen.cs @@ -32,7 +32,7 @@ namespace Server.Mobiles BaseSoundID = profile.SoundID; Karma = 1000; Fame = 1000; - _NextChatter = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(5, 15)); + _NextChatter = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(10, 20)); } public override void OnThink() @@ -58,7 +58,7 @@ namespace Server.Mobiles Say(lines[Utility.Random(lines.Length)]); } - _NextChatter = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(10, 15)); + _NextChatter = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(10, 20)); } } diff --git a/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/ButcherMeat.cs b/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/ButcherMeat.cs deleted file mode 100644 index 4dda3242f..000000000 --- a/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/ButcherMeat.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using Server; -using ModernUO.Serialization; - -namespace Server.Items -{ - [SerializationGenerator(0, false)] - public partial class ButcherHit : Item - { - private static readonly int[] _MeatGraphics = new int[] - { - 0x1871, // Meat faces south - 0x1872, // Meat faces east - 0x1873, // Meat faces south - 0x1874 // Meat faces east - }; - - [Constructible] - public ButcherHit() : base(0x1874) - { - ItemID = _MeatGraphics[Utility.Random(_MeatGraphics.Length)]; - Name = "meat"; - Movable = false; - } - - [Constructible] - public ButcherHit(int itemID) : base(itemID) - { - Name = "meat"; - Movable = false; - } - - public (Point3D loc, Direction dir) GetWorkerPlacement(Point3D baseLoc) - { - switch (ItemID) - { - case 0x1871: - return (new Point3D(baseLoc.X, baseLoc.Y + 1, baseLoc.Z), Direction.North); - case 0x1872: - return (new Point3D(baseLoc.X + 1, baseLoc.Y, baseLoc.Z), Direction.East); - case 0x1873: - return (new Point3D(baseLoc.X, baseLoc.Y + 1, baseLoc.Z), Direction.North); - case 0x1874: - return (new Point3D(baseLoc.X + 1, baseLoc.Y, baseLoc.Z), Direction.East); - - - default: - if (Utility.RandomBool()) - { - return (new Point3D(baseLoc.X - 1, baseLoc.Y, baseLoc.Z), Direction.East); - } - return (new Point3D(baseLoc.X, baseLoc.Y - 1, baseLoc.Z), Direction.South); - } - } - - public void Strike(Mobile from) - { - if (from == null || from.Deleted) return; - - from.Direction = from.GetDirectionTo(Location); - from.Animate(11, 5, 1, true, false, 0); - from.PlaySound(0x13F); - } - - public ButcherHit(Serial serial) : base(serial) - { - } - } -} diff --git a/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/SmelterForge.cs b/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/SmelterForge.cs deleted file mode 100644 index 299e57bb5..000000000 --- a/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/SmelterForge.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; -using Server; -using ModernUO.Serialization; - -namespace Server.Items -{ - [SerializationGenerator(0, false)] - public partial class ForgeHit : Item - { - [SerializableField(0)] - private Item _smeltedItem; - - [Constructible] - public ForgeHit() : base(0xFB1) - { - Name = "forge"; - Movable = false; - } - - public void Smelt(Mobile from) - { - if (from == null || from.Deleted) return; - - from.Direction = from.GetDirectionTo(Location); - - from.Animate(11, 5, 1, true, false, 0); - - if (_smeltedItem == null || _smeltedItem.Deleted) - { - _smeltedItem = new Item(0x19B8); - _smeltedItem.Movable = false; - _smeltedItem.Name = "smelting ore"; - - _smeltedItem.MoveToWorld(new Point3D(X, Y, Z + 5), Map); - from.PlaySound(0x2B); // Metal clink - } - else - { - if (_smeltedItem.ItemID == 0x19B8) - { - _smeltedItem.ItemID = 0x1BF3; - _smeltedItem.Name = "fresh ingots"; - from.PlaySound(0x208); // Fire sizzle/quench sound - } - else - { - _smeltedItem.ItemID = 0x19B8; - _smeltedItem.Name = "smelting ore"; - from.PlaySound(0x2B); // Metal clink - } - } - } - - public override void OnDelete() - { - if (_smeltedItem != null && !_smeltedItem.Deleted) - { - _smeltedItem.Delete(); - } - base.OnDelete(); - } - - public override void OnLocationChange(Point3D oldLocation) - { - base.OnLocationChange(oldLocation); - if (_smeltedItem != null && !_smeltedItem.Deleted) - { - _smeltedItem.Location = new Point3D(X, Y, Z + 5); - } - } - - public override void OnMapChange() - { - base.OnMapChange(); - if (_smeltedItem != null && !_smeltedItem.Deleted) - { - _smeltedItem.Map = Map; - } - } - - public ForgeHit(Serial serial) : base(serial) - { - } - } -} diff --git a/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/SmithAnvil.cs b/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/SmithAnvil.cs deleted file mode 100644 index 5805408ca..000000000 --- a/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/SmithAnvil.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System; -using Server; -using ModernUO.Serialization; - -namespace Server.Items -{ - [SerializationGenerator(0, false)] - public partial class AnvilHit : Item - { - [SerializableField(0)] - private Item _ForgedItem; - - private static readonly int[] _ForgedGraphics = - { - 0x1BEF, // Iron Ingot - 0x1B73, // Buckler - 0x1BEF, // Iron Ingot - 0x13B9, // Viking Sword - 0x1BEF, - 0x1401, // Kryss - 0x1BEF, - 0x1B76 // Heater Shield - }; - - [Constructible] - public AnvilHit() : base(0xFAF) - { - Name = "anvil"; - Movable = false; - } - - public void Strike(Mobile from) - { - if (from == null || from.Deleted) return; - - from.Direction = from.GetDirectionTo(Location); - - from.Animate(11, 5, 1, true, false, 0); - from.PlaySound(0x2A); - - if (_ForgedItem == null || _ForgedItem.Deleted) - { - _ForgedItem = new Item(_ForgedGraphics[Utility.Random(_ForgedGraphics.Length)]); - _ForgedItem.Movable = false; - _ForgedItem.Name = "a forged item"; - - _ForgedItem.MoveToWorld(new Point3D(X, Y, Z + 5), Map); - } - else - { - _ForgedItem.ItemID = _ForgedGraphics[Utility.Random(_ForgedGraphics.Length)]; - } - } - - public override void OnDelete() - { - if (_ForgedItem != null && !_ForgedItem.Deleted) - { - _ForgedItem.Delete(); - } - base.OnDelete(); - } - - public override void OnLocationChange(Point3D oldLocation) - { - base.OnLocationChange(oldLocation); - if (_ForgedItem != null && !_ForgedItem.Deleted) - { - _ForgedItem.Location = new Point3D(X, Y, Z + 5); - } - } - - public override void OnMapChange() - { - base.OnMapChange(); - if (_ForgedItem != null && !_ForgedItem.Deleted) - { - _ForgedItem.Map = Map; - } - } - - public AnvilHit(Serial serial) : base(serial) - { - } - } -} diff --git a/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/TradesmanButcher.cs b/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/TradesmanButcher.cs index 03596dcf3..0fa8436e2 100644 --- a/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/TradesmanButcher.cs +++ b/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/TradesmanButcher.cs @@ -75,3 +75,69 @@ namespace Server.Mobiles } } } + +namespace Server.Items +{ + [SerializationGenerator(0, false)] + public partial class ButcherHit : Item + { + private static readonly int[] _MeatGraphics = new int[] + { + 0x1871, // Meat faces south + 0x1872, // Meat faces east + 0x1873, // Meat faces south + 0x1874 // Meat faces east + }; + + [Constructible] + public ButcherHit() : base(0x1874) + { + ItemID = _MeatGraphics[Utility.Random(_MeatGraphics.Length)]; + Name = "meat"; + Movable = false; + } + + [Constructible] + public ButcherHit(int itemID) : base(itemID) + { + Name = "meat"; + Movable = false; + } + + public (Point3D loc, Direction dir) GetWorkerPlacement(Point3D baseLoc) + { + switch (ItemID) + { + case 0x1871: + return (new Point3D(baseLoc.X, baseLoc.Y + 1, baseLoc.Z), Direction.North); + case 0x1872: + return (new Point3D(baseLoc.X + 1, baseLoc.Y, baseLoc.Z), Direction.East); + case 0x1873: + return (new Point3D(baseLoc.X, baseLoc.Y + 1, baseLoc.Z), Direction.North); + case 0x1874: + return (new Point3D(baseLoc.X + 1, baseLoc.Y, baseLoc.Z), Direction.East); + + + default: + if (Utility.RandomBool()) + { + return (new Point3D(baseLoc.X - 1, baseLoc.Y, baseLoc.Z), Direction.East); + } + return (new Point3D(baseLoc.X, baseLoc.Y - 1, baseLoc.Z), Direction.South); + } + } + + public void Strike(Mobile from) + { + if (from == null || from.Deleted) return; + + from.Direction = from.GetDirectionTo(Location); + from.Animate(11, 5, 1, true, false, 0); + from.PlaySound(0x13F); + } + + public ButcherHit(Serial serial) : base(serial) + { + } + } +} diff --git a/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/TradesmanSmelter.cs b/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/TradesmanSmelter.cs index e3892da87..b7bb9b1e4 100644 --- a/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/TradesmanSmelter.cs +++ b/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/TradesmanSmelter.cs @@ -75,3 +75,85 @@ namespace Server.Mobiles } } } + +namespace Server.Items +{ + [SerializationGenerator(0, false)] + public partial class ForgeHit : Item + { + [SerializableField(0)] + private Item _smeltedItem; + + [Constructible] + public ForgeHit() : base(0xFB1) + { + Name = "forge"; + Movable = false; + } + + public void Smelt(Mobile from) + { + if (from == null || from.Deleted) return; + + from.Direction = from.GetDirectionTo(Location); + + from.Animate(11, 5, 1, true, false, 0); + + if (_smeltedItem == null || _smeltedItem.Deleted) + { + _smeltedItem = new Item(0x19B8); + _smeltedItem.Movable = false; + _smeltedItem.Name = "smelting ore"; + + _smeltedItem.MoveToWorld(new Point3D(X, Y, Z + 5), Map); + from.PlaySound(0x2B); // Metal clink + } + else + { + if (_smeltedItem.ItemID == 0x19B8) + { + _smeltedItem.ItemID = 0x1BF3; + _smeltedItem.Name = "fresh ingots"; + from.PlaySound(0x208); // Fire sizzle/quench sound + } + else + { + _smeltedItem.ItemID = 0x19B8; + _smeltedItem.Name = "smelting ore"; + from.PlaySound(0x2B); // Metal clink + } + } + } + + public override void OnDelete() + { + if (_smeltedItem != null && !_smeltedItem.Deleted) + { + _smeltedItem.Delete(); + } + base.OnDelete(); + } + + public override void OnLocationChange(Point3D oldLocation) + { + base.OnLocationChange(oldLocation); + if (_smeltedItem != null && !_smeltedItem.Deleted) + { + _smeltedItem.Location = new Point3D(X, Y, Z + 5); + } + } + + public override void OnMapChange() + { + base.OnMapChange(); + if (_smeltedItem != null && !_smeltedItem.Deleted) + { + _smeltedItem.Map = Map; + } + } + + public ForgeHit(Serial serial) : base(serial) + { + } + } +} diff --git a/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/TradesmanSmith.cs b/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/TradesmanSmith.cs index c186483e7..5af20914b 100644 --- a/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/TradesmanSmith.cs +++ b/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/TradesmanSmith.cs @@ -75,3 +75,86 @@ namespace Server.Mobiles } } } + +namespace Server.Items +{ + [SerializationGenerator(0, false)] + public partial class AnvilHit : Item + { + [SerializableField(0)] + private Item _ForgedItem; + + private static readonly int[] _ForgedGraphics = + { + 0x1BEF, // Iron Ingot + 0x1B73, // Buckler + 0x1BEF, // Iron Ingot + 0x13B9, // Viking Sword + 0x1BEF, + 0x1401, // Kryss + 0x1BEF, + 0x1B76 // Heater Shield + }; + + [Constructible] + public AnvilHit() : base(0xFAF) + { + Name = "anvil"; + Movable = false; + } + + public void Strike(Mobile from) + { + if (from == null || from.Deleted) return; + + from.Direction = from.GetDirectionTo(Location); + + from.Animate(11, 5, 1, true, false, 0); + from.PlaySound(0x2A); + + if (_ForgedItem == null || _ForgedItem.Deleted) + { + _ForgedItem = new Item(_ForgedGraphics[Utility.Random(_ForgedGraphics.Length)]); + _ForgedItem.Movable = false; + _ForgedItem.Name = "a forged item"; + + _ForgedItem.MoveToWorld(new Point3D(X, Y, Z + 5), Map); + } + else + { + _ForgedItem.ItemID = _ForgedGraphics[Utility.Random(_ForgedGraphics.Length)]; + } + } + + public override void OnDelete() + { + if (_ForgedItem != null && !_ForgedItem.Deleted) + { + _ForgedItem.Delete(); + } + base.OnDelete(); + } + + public override void OnLocationChange(Point3D oldLocation) + { + base.OnLocationChange(oldLocation); + if (_ForgedItem != null && !_ForgedItem.Deleted) + { + _ForgedItem.Location = new Point3D(X, Y, Z + 5); + } + } + + public override void OnMapChange() + { + base.OnMapChange(); + if (_ForgedItem != null && !_ForgedItem.Deleted) + { + _ForgedItem.Map = Map; + } + } + + public AnvilHit(Serial serial) : base(serial) + { + } + } +} diff --git a/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/TradesmenCitizen.cs b/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/TradesmenCitizen.cs index 9595b0697..c64d9583d 100644 --- a/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/TradesmenCitizen.cs +++ b/Projects/UOContent/Mobiles/Townfolk/Citizens/Tradesmen/TradesmenCitizen.cs @@ -43,8 +43,8 @@ namespace Server.Mobiles DressTradesman(); - CantWalk = false; - _NextChatter = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(10, 25)); + CantWalk = true; + _NextChatter = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(5, 10)); } public virtual void DressTradesman() @@ -54,18 +54,36 @@ namespace Server.Mobiles AddItem(new Boots(Utility.RandomNeutralHue())); } - public override void OnMovement(Mobile m, Point3D oldLocation) + public override void OnThink() { - base.OnMovement(m, oldLocation); + base.OnThink(); - if (m.Player && m.Alive && !m.Hidden && DateTime.UtcNow >= _NextChatter && InRange(m, 8)) + if (Deleted) return; + + // Check timer independently of player movement steps + if (DateTime.UtcNow >= _NextChatter) { - if (Utility.RandomBool()) + bool playerNearby = false; + foreach (Mobile m in GetMobilesInRange(8)) { - SayRandomChatter(); + if (m != null && m.Player && m.Alive && !m.Hidden) + { + playerNearby = true; + break; + } } - _NextChatter = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(30, 60)); + if (playerNearby) + { + SayRandomChatter(); + // Set normal interval between chatter lines + _NextChatter = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(15, 30)); + } + else + { + // Re-check every 5 seconds until a player enters range + _NextChatter = DateTime.UtcNow + TimeSpan.FromSeconds(5); + } } }