Companion to #2712, which covers HireRanger's refused `EquipItem`. A sweep that built every constructible Mobile 2,000 times under each expansion found these other outfits that put two items on one layer. They don't leak, because `AddItem` skips `CheckEquip`, but the NPC wears both items and the client draws only one. | NPC | Conflict | |---|---| | Miner, Ranger, Thief | Own shirt/pants/ThighBoots added on top of the random `BaseVendor.InitOutfit` (shoes doubled on every spawn) | | MasterTheophilus | Shoes + Robe added over `EvilMageLord`'s Sandals + Robe | | Merchant | Shirt + FancyShirt, or PlainDress + FancyDress | | IronWorker | Bandana/JesterHat + Bascinet | | MeerCaptain | One-handed sword + Crossbow | | BakeKitsune | `BodyMod` isn't saved, so after a restart `RemoveDisguise` bailed and the next `Disguise()` stacked a second robe and pair of shoes | ## Changes - `BaseCreature.ReplaceEquipment(item)` equips an item in place of whatever an inherited outfit put on its layer, and deletes the item if it still can't be equipped. - Miner, Ranger, Thief, MasterTheophilus: their own pieces replace the inherited ones. - Merchant and IronWorker: dropped the duplicate roll. Each kept the item the client was already drawing, which is the last one sent: the fancy set and the Bascinet. - MeerCaptain: the sword goes into its pack as loot. **Behavior change:** `Mobile.Weapon` checks the one-handed layer first, so it was fighting with the sword despite its archer AI, its Archery skill and the bolts in its pack. It now uses the crossbow. - BakeKitsune: `RemoveDisguise` strips the disguise without checking `IsBodyMod`. ## Testing - I re-ran the sweep (local diagnostic, not committed; needs client tiledata) at 500 rolls × 12 expansions. Only HireRanger (#2712) and LordOaks (separate fix coming) remain. - UOContent.Tests: 1218 passed, 2 skipped.
63 lines
1.4 KiB
C#
63 lines
1.4 KiB
C#
using ModernUO.Serialization;
|
|
using Server.Items;
|
|
|
|
namespace Server.Mobiles;
|
|
|
|
[SerializationGenerator(0, false)]
|
|
public partial class Merchant : BaseEscortable
|
|
{
|
|
[Constructible]
|
|
public Merchant()
|
|
{
|
|
Title = "the merchant";
|
|
SetSkill(SkillName.ItemID, 55.0, 78.0);
|
|
SetSkill(SkillName.ArmsLore, 55, 78);
|
|
}
|
|
|
|
public override bool CanTeach => true;
|
|
public override bool ClickTitle => false; // Do not display 'the merchant' when single-clicking
|
|
|
|
private static int GetRandomHue()
|
|
{
|
|
return Utility.Random(6) switch
|
|
{
|
|
0 => 0,
|
|
1 => Utility.RandomBlueHue(),
|
|
2 => Utility.RandomGreenHue(),
|
|
3 => Utility.RandomRedHue(),
|
|
4 => Utility.RandomYellowHue(),
|
|
5 => Utility.RandomNeutralHue(),
|
|
_ => 0
|
|
};
|
|
}
|
|
|
|
public override void InitOutfit()
|
|
{
|
|
var lowHue = GetRandomHue();
|
|
|
|
AddItem(new ThighBoots());
|
|
|
|
if (Female)
|
|
{
|
|
AddItem(new FancyDress(lowHue));
|
|
}
|
|
else
|
|
{
|
|
AddItem(new FancyShirt(lowHue));
|
|
}
|
|
|
|
AddItem(new LongPants(lowHue));
|
|
|
|
if (!Female)
|
|
{
|
|
AddItem(new BodySash(lowHue));
|
|
}
|
|
|
|
// if (!Female)
|
|
// AddItem( new Longsword() );
|
|
|
|
Utility.AssignRandomHair(this);
|
|
|
|
PackGold(200, 250);
|
|
}
|
|
}
|