#W# Added: Settings.cs has some custimizable settings exposed for easy tweaking.

This commit is contained in:
WarrentyExpired 2026-10-02 13:59:36 -04:00
parent c1c3c1b30d
commit 314a2384d2
6 changed files with 81 additions and 4 deletions

View file

@ -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

View file

@ -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();
}
}
}
}

View file

@ -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;
}
}
}

View file

@ -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;

View file

@ -95,6 +95,7 @@ namespace Server.Mobiles
{
max += (int)((vetern - 90.0) / 10);
}
max = max + ValidSettings.ExtraStableSlots();
return max;
}

View file

@ -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
}
}