From 372820bb492a438cbf1e603494c356bd2e123053 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Fri, 28 Apr 2023 20:51:39 -0700 Subject: [PATCH] fix: Vendors are now invulnerable for LBR+ or by override (#1399) ### Summary Changes vendors so they are invulnerable with LBR+ era or with the `vendor.isInvulnerable` setting added. --- Projects/UOContent/Mobiles/Vendors/BaseVendor.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Projects/UOContent/Mobiles/Vendors/BaseVendor.cs b/Projects/UOContent/Mobiles/Vendors/BaseVendor.cs index ea80e0c9e..817c254ea 100644 --- a/Projects/UOContent/Mobiles/Vendors/BaseVendor.cs +++ b/Projects/UOContent/Mobiles/Vendors/BaseVendor.cs @@ -30,7 +30,8 @@ namespace Server.Mobiles private readonly List _buyInfo = new(); private readonly List _sellInfo = new(); - private static bool EnableVendorBuyOPL; + private static bool _enableVendorBuyOPL; + private static bool _vendorInvulnerable; public static void Configure() { @@ -38,7 +39,9 @@ namespace Server.Mobiles // CUO is not compatible with this turned off // Also items may require a string description for their name to show up properly. // See SBAnimalTrainer for an example - EnableVendorBuyOPL = ServerConfiguration.GetSetting("opl.enableForVendorBuy", true); + _enableVendorBuyOPL = ServerConfiguration.GetSetting("opl.enableForVendorBuy", true); + + _vendorInvulnerable = ServerConfiguration.GetSetting("vendor.isInvulnerable", false); } public static void Initialize() @@ -90,7 +93,7 @@ namespace Server.Mobiles public virtual NpcGuild NpcGuild => NpcGuild.None; - public override bool IsInvulnerable => true; + public override bool IsInvulnerable => Core.LBR || _vendorInvulnerable; public virtual DateTime NextTrickOrTreat { get; set; } @@ -875,7 +878,7 @@ namespace Server.Mobiles var list = new List(buyInfo.Length); var cont = BuyPack; - using var opls = PooledRefQueue.Create(EnableVendorBuyOPL ? buyInfo.Length : 0); + using var opls = PooledRefQueue.Create(_enableVendorBuyOPL ? buyInfo.Length : 0); for (var idx = 0; idx < buyInfo.Length; idx++) {