#W# Tradesman: There 'Work' item has been moved into the 'Tradesman' file.

This commit is contained in:
WarrentyExpired 2026-11-04 15:29:51 -05:00
parent 08548d7234
commit 0d1620e0a0
9 changed files with 261 additions and 252 deletions

View file

@ -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));
}
}

View file

@ -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));
}
}

View file

@ -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)
{
}
}
}

View file

@ -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)
{
}
}
}

View file

@ -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)
{
}
}
}

View file

@ -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)
{
}
}
}

View file

@ -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)
{
}
}
}

View file

@ -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)
{
}
}
}

View file

@ -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);
}
}
}