From 314a2384d2103bb743ee853e8785384533cec195 Mon Sep 17 00:00:00 2001 From: WarrentyExpired Date: Fri, 2 Oct 2026 13:59:36 -0400 Subject: [PATCH] #W# Added: Settings.cs has some custimizable settings exposed for easy tweaking. --- .../UOContent/Items/Misc/Corpses/Corpse.cs | 2 +- Projects/UOContent/Misc/Broadcasts.cs | 9 ++++ Projects/UOContent/Misc/ValidSettings.cs | 50 +++++++++++++++++++ Projects/UOContent/Mobiles/BaseCreature.cs | 12 +++-- .../Mobiles/Vendors/NPC/AnimalTrainer.cs | 1 + Projects/UOContent/Settings.cs | 11 ++++ 6 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 Projects/UOContent/Misc/ValidSettings.cs create mode 100644 Projects/UOContent/Settings.cs diff --git a/Projects/UOContent/Items/Misc/Corpses/Corpse.cs b/Projects/UOContent/Items/Misc/Corpses/Corpse.cs index 04e9806c9..6133dd443 100644 --- a/Projects/UOContent/Items/Misc/Corpses/Corpse.cs +++ b/Projects/UOContent/Items/Misc/Corpses/Corpse.cs @@ -94,7 +94,7 @@ public partial class Corpse : Container, ICarvable private static TimeSpan InstancedCorpseTime = TimeSpan.FromMinutes(3.0); private static TimeSpan _defaultDecayTime = TimeSpan.FromMinutes(7.0); - private static TimeSpan _boneDecayTime = TimeSpan.FromMinutes(7.0); + private static TimeSpan _boneDecayTime = TimeSpan.FromMinutes(ValidSettings.BoneDecay()); private IDevourer _devourer; // The creature that devoured this corpse diff --git a/Projects/UOContent/Misc/Broadcasts.cs b/Projects/UOContent/Misc/Broadcasts.cs index 74eb2ad4f..17f02ad24 100644 --- a/Projects/UOContent/Misc/Broadcasts.cs +++ b/Projects/UOContent/Misc/Broadcasts.cs @@ -6,6 +6,7 @@ namespace Server.Misc { EventSink.ServerCrashed += EventSink_Crashed; EventSink.Shutdown += EventSink_Shutdown; + EventSink.Disconnected += EventSink_Disconnected; } public static void EventSink_Crashed(ServerCrashedEventArgs e) @@ -31,5 +32,13 @@ namespace Server.Misc // ignored } } + + public static void EventSink_Disconnected(Mobile m) + { + if ( Settings.S_SaveOnCharacterLogout ) + { + World.Save(); + } + } } } diff --git a/Projects/UOContent/Misc/ValidSettings.cs b/Projects/UOContent/Misc/ValidSettings.cs new file mode 100644 index 000000000..a533c351b --- /dev/null +++ b/Projects/UOContent/Misc/ValidSettings.cs @@ -0,0 +1,50 @@ +using System; +using Server.Misc; +using Server.Mobiles; + +namespace Server +{ + class ValidSettings + { + public static double BoneDecay() + { + if ( Settings.S_BoneDecay < 1 ) + { + Settings.S_BoneDecay = 0; + } + else if (Settings.S_BoneDecay < 10 ) + { + Settings.S_BoneDecay = 10; + } + else if (Settings.S_BoneDecay > 1440 ) + { + Settings.S_BoneDecay = 1440; + } + return (double)Settings.S_BoneDecay; + } + + public static double BondDays() + { + int days = Settings.S_BondDays; + + if ( days > 30 ) + days = 30; + + if ( days < 0 ) + days = 0; + return (double)days; + } + public static int ExtraStableSlots() + { + int stable = Settings.S_Stables; + + if ( stable < 0 ) + stable = 0; + + if ( stable > 20 ) + stable = 20; + + return stable; + } + } +} diff --git a/Projects/UOContent/Mobiles/BaseCreature.cs b/Projects/UOContent/Mobiles/BaseCreature.cs index 0c9e703f0..ebcdc43b5 100644 --- a/Projects/UOContent/Mobiles/BaseCreature.cs +++ b/Projects/UOContent/Mobiles/BaseCreature.cs @@ -1397,7 +1397,7 @@ namespace Server.Mobiles public virtual bool StandsDownOnCommand => PetsStandDownOnCommand; public virtual bool IsBondable => BondingEnabled && !Summoned; - public virtual TimeSpan BondingDelay => TimeSpan.FromDays(7.0); + public virtual TimeSpan BondingDelay => TimeSpan.FromDays(ValidSettings.BondDays()); public virtual TimeSpan BondingAbandonDelay => TimeSpan.FromDays(1.0); public override bool CanRegenHits => !IsDeadPet && !Summoned && base.CanRegenHits; @@ -3819,7 +3819,7 @@ namespace Server.Mobiles { var tc = Core.TickCount; - if (!Controlled && !Summoned && Region is Server.Regions.GreetingDungeonRegion) + if (Settings.S_LineOfSight && !Controlled && !Summoned && Region is Server.Regions.GreetingDungeonRegion) { if (Combatant == null) { @@ -3856,6 +3856,12 @@ namespace Server.Mobiles Hidden = false; CantWalk = false; } + else if (Hidden && _isLosHidden) + { + _isLosHidden = false; + Hidden = false; + CantWalk = false; + } } if (EnableRummaging && CanRummageCorpses && !Summoned && !Controlled && tc - m_NextRummageTime >= 0) @@ -4581,7 +4587,7 @@ namespace Server.Mobiles { BondingBegin = Core.Now; } - else if (BondingBegin + BondingDelay <= Core.Now) + else if ( ( ValidSettings.BondDays() < 1 ) || BondingBegin + BondingDelay <= Core.Now) { IsBonded = true; BondingBegin = DateTime.MinValue; diff --git a/Projects/UOContent/Mobiles/Vendors/NPC/AnimalTrainer.cs b/Projects/UOContent/Mobiles/Vendors/NPC/AnimalTrainer.cs index b3fb4d721..6da1acb0a 100644 --- a/Projects/UOContent/Mobiles/Vendors/NPC/AnimalTrainer.cs +++ b/Projects/UOContent/Mobiles/Vendors/NPC/AnimalTrainer.cs @@ -95,6 +95,7 @@ namespace Server.Mobiles { max += (int)((vetern - 90.0) / 10); } + max = max + ValidSettings.ExtraStableSlots(); return max; } diff --git a/Projects/UOContent/Settings.cs b/Projects/UOContent/Settings.cs new file mode 100644 index 000000000..6efa1aa18 --- /dev/null +++ b/Projects/UOContent/Settings.cs @@ -0,0 +1,11 @@ +namespace Server +{ + public static class Settings + { + public static bool S_SaveOnCharacterLogout = true; // Saves on Logout + public static int S_BoneDecay = 1440; // 10-1440 minutes till bones decay + public static bool S_LineOfSight = true; // Mobs are hidden in Dungeons + public static int S_BondDays = 1; // 1-30 Days to bond with pet + public static int S_Stables = 3; // 0-20 Extra stable slots + } +}