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.
This commit is contained in:
Kamron Batman 2023-04-28 20:51:39 -07:00 committed by GitHub
parent 4242c446c8
commit 372820bb49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,7 +30,8 @@ namespace Server.Mobiles
private readonly List<IBuyItemInfo> _buyInfo = new();
private readonly List<IShopSellInfo> _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<BuyItemState>(buyInfo.Length);
var cont = BuyPack;
using var opls = PooledRefQueue<ObjectPropertyList>.Create(EnableVendorBuyOPL ? buyInfo.Length : 0);
using var opls = PooledRefQueue<ObjectPropertyList>.Create(_enableVendorBuyOPL ? buyInfo.Length : 0);
for (var idx = 0; idx < buyInfo.Length; idx++)
{