diff --git a/Projects/Server/FeatureFlags.cs b/Projects/Server/FeatureFlags.cs index 99d6f9226..a70b4e452 100644 --- a/Projects/Server/FeatureFlags.cs +++ b/Projects/Server/FeatureFlags.cs @@ -10,4 +10,5 @@ public static class ServerFeatureFlags public static bool PvPCombat { get; set; } = true; public static bool BankAccess { get; set; } = true; public static bool SpeedhackDetection { get; set; } + public static bool InsuranceEnabled { get; set; } } diff --git a/Projects/Server/Items/Item.cs b/Projects/Server/Items/Item.cs index 907b71dd4..4d5ee13b3 100644 --- a/Projects/Server/Items/Item.cs +++ b/Projects/Server/Items/Item.cs @@ -1884,7 +1884,7 @@ public partial class Item : IHued, IComparable, ISpawnable, IObjectPropert { list.Add(1049643); // cursed } - else if (Insured) + else if (ServerFeatureFlags.InsuranceEnabled && Insured) { list.Add(1061682); // insured } @@ -4215,11 +4215,13 @@ public partial class Item : IHued, IComparable, ISpawnable, IObjectPropert Delete(); } - public virtual bool CheckBlessed(Mobile m) => m_LootType == LootType.Blessed || Insured || m != null && m == BlessedFor; + public virtual bool CheckBlessed(Mobile m) => + m_LootType == LootType.Blessed || ServerFeatureFlags.InsuranceEnabled && Insured || m != null && m == BlessedFor; public virtual bool CheckNewbied() => m_LootType == LootType.Newbied; - public virtual bool IsStandardLoot() => !Insured && BlessedFor == null && m_LootType == LootType.Regular; + public virtual bool IsStandardLoot() => + (!ServerFeatureFlags.InsuranceEnabled || !Insured) && BlessedFor == null && m_LootType == LootType.Regular; public override string ToString() => $"{Serial} \"{GetType().Name}\""; diff --git a/Projects/UOContent/Engines/FeatureFlags/FeatureFlagManager.cs b/Projects/UOContent/Engines/FeatureFlags/FeatureFlagManager.cs index 0402ad9a1..e599aeeb6 100644 --- a/Projects/UOContent/Engines/FeatureFlags/FeatureFlagManager.cs +++ b/Projects/UOContent/Engines/FeatureFlags/FeatureFlagManager.cs @@ -962,20 +962,21 @@ public static class FeatureFlagManager _ = key.ToLowerInvariant() switch { // Server project flags - "player_trading" => ServerFeatureFlags.PlayerTrading = enabled, - "pvp_combat" => ServerFeatureFlags.PvPCombat = enabled, - "bank_access" => ServerFeatureFlags.BankAccess = enabled, - "speedhack_detection" => ServerFeatureFlags.SpeedhackDetection = enabled, + "player_trading" => ServerFeatureFlags.PlayerTrading = enabled, + "pvp_combat" => ServerFeatureFlags.PvPCombat = enabled, + "bank_access" => ServerFeatureFlags.BankAccess = enabled, + "speedhack_detection" => ServerFeatureFlags.SpeedhackDetection = enabled, + "insurance" => ServerFeatureFlags.InsuranceEnabled = enabled, // UOContent flags - "vendor_purchase" => ContentFeatureFlags.VendorPurchase = enabled, - "vendor_sell" => ContentFeatureFlags.VendorSell = enabled, - "player_vendors" => ContentFeatureFlags.PlayerVendors = enabled, - "house_placement" => ContentFeatureFlags.HousePlacement = enabled, - "boat_placement" => ContentFeatureFlags.BoatPlacement = enabled, - "bulk_orders" => ContentFeatureFlags.BulkOrders = enabled, - "passive_detect_hidden" => ContentFeatureFlags.PassiveDetectHidden = enabled, - "young_player_system" => ContentFeatureFlags.YoungPlayerSystem = enabled, + "vendor_purchase" => ContentFeatureFlags.VendorPurchase = enabled, + "vendor_sell" => ContentFeatureFlags.VendorSell = enabled, + "player_vendors" => ContentFeatureFlags.PlayerVendors = enabled, + "house_placement" => ContentFeatureFlags.HousePlacement = enabled, + "boat_placement" => ContentFeatureFlags.BoatPlacement = enabled, + "bulk_orders" => ContentFeatureFlags.BulkOrders = enabled, + "passive_detect_hidden" => ContentFeatureFlags.PassiveDetectHidden = enabled, + "young_player_system" => ContentFeatureFlags.YoungPlayerSystem = enabled, "bitmap_pathfinding_cache" => ContentFeatureFlags.BitmapPathfindingCache = enabled, }; } diff --git a/Projects/UOContent/Engines/Insurance/Insurance.cs b/Projects/UOContent/Engines/Insurance/Insurance.cs index aa27f0028..da29b5592 100644 --- a/Projects/UOContent/Engines/Insurance/Insurance.cs +++ b/Projects/UOContent/Engines/Insurance/Insurance.cs @@ -10,12 +10,12 @@ namespace Server.Engines.Insurance; public static class Insurance { - public static bool Enabled { get; private set; } + public static bool Enabled => ServerFeatureFlags.InsuranceEnabled; private static Dictionary _insuranceContexts; public static void Configure() { - Enabled = ServerConfiguration.GetSetting("insurance.enable", Core.AOS); + ServerFeatureFlags.InsuranceEnabled = ServerConfiguration.GetSetting("insurance.enable", Core.AOS); if (Enabled) { @@ -72,7 +72,7 @@ public static class Insurance public static bool CheckItemInsuranceOnDeath(PlayerMobile from, Item item) { - if (!item.Insured) + if (!Enabled || !item.Insured) { return false; } diff --git a/Projects/UOContent/Items/Deeds/ClothingBlessDeed.cs b/Projects/UOContent/Items/Deeds/ClothingBlessDeed.cs index 7139ab552..25860f542 100644 --- a/Projects/UOContent/Items/Deeds/ClothingBlessDeed.cs +++ b/Projects/UOContent/Items/Deeds/ClothingBlessDeed.cs @@ -26,7 +26,7 @@ public class ClothingBlessTarget : Target // Create our targeting class (which w } // Check if its already newbied (blessed) - if (item.LootType == LootType.Blessed || item.BlessedFor == from || item.Insured) + if (item.LootType == LootType.Blessed || item.BlessedFor == from || Insurance.Enabled && item.Insured) { from.SendLocalizedMessage(1045113); // That item is already blessed } diff --git a/Projects/UOContent/Mobiles/Abilities/DestroyEquipment.cs b/Projects/UOContent/Mobiles/Abilities/DestroyEquipment.cs index 91f9bca57..ff7937ded 100644 --- a/Projects/UOContent/Mobiles/Abilities/DestroyEquipment.cs +++ b/Projects/UOContent/Mobiles/Abilities/DestroyEquipment.cs @@ -1,4 +1,5 @@ using Server.Collections; +using Server.Engines.Insurance; using Server.Items; namespace Server.Mobiles; @@ -23,7 +24,7 @@ public class DestroyEquipment : MonsterAbilitySingleTarget continue; } - if (item.Insured) + if (Insurance.Enabled && item.Insured) { continue; } diff --git a/Projects/UOContent/Mobiles/PlayerMobile.cs b/Projects/UOContent/Mobiles/PlayerMobile.cs index 6f1fb4d04..83c0e4cca 100644 --- a/Projects/UOContent/Mobiles/PlayerMobile.cs +++ b/Projects/UOContent/Mobiles/PlayerMobile.cs @@ -2397,7 +2397,8 @@ namespace Server.Mobiles [MethodImpl(MethodImplOptions.AggressiveInlining)] private bool FindItems_Callback(Item item) => - !item.Deleted && (item.LootType == LootType.Blessed || item.Insured) && Backpack != item.Parent; + !item.Deleted && Backpack != item.Parent && + (item.LootType == LootType.Blessed || ServerFeatureFlags.InsuranceEnabled && item.Insured); public override bool OnBeforeDeath() {