ModernUO/Projects/UOContent/Systems/JailSystem/JailRegion.cs
Bohica 5f0561b7fc
feat: New Jail System (#2215)
New Jail System for MUO
----------------------------

Commands:
[jail [player] [reason] - Jail with time escalation per offense (5 to 120 minutes, GM only)
[unjail [player] - Manual release from jail regardless of time (GM only)
[jailinfo [player] - Check jail status and history (GM only)
[jailrecord - Checks their own jail record stats (player access)

Jail/Unjail can be found in the client view of a player in Admin Gump
![Screenshot 2025-06-12 030226](https://github.com/user-attachments/assets/a9f1a736-0316-464c-8958-c589ea0a1dcb)

Jail record gump, invoked with [jailrecord (30 second cooldown)
![Screenshot 2025-06-12 030320](https://github.com/user-attachments/assets/c19b3e76-3042-48ae-a00d-c70ef564bc84)
2025-07-16 20:41:21 -07:00

90 lines
2.5 KiB
C#

using System.Text.Json.Serialization;
using Server.Spells;
namespace Server.Regions;
public class JailRegion : BaseRegion
{
[JsonConstructor] // Don't include parent, since it is special
public JailRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
{
}
public JailRegion(string name, Map map, Region parent, params Rectangle3D[] area)
: base(name, map, parent, area)
{
}
public JailRegion(string name, Map map, Region parent, int priority, params Rectangle3D[] area)
: base(name, map, parent, priority, area)
{
}
public override bool AllowGain(Mobile m, Skill skill, object obj) => m.AccessLevel > AccessLevel.Player;
public override bool AllowBeneficial(Mobile from, Mobile target)
{
if (from.AccessLevel == AccessLevel.Player)
{
from.SendMessage("You may not do that in jail.");
return false;
}
return true;
}
public override bool AllowHarmful(Mobile from, Mobile target)
{
if (from.AccessLevel == AccessLevel.Player)
{
from.SendMessage("You may not do that in jail.");
return false;
}
return true;
}
public override bool AllowHousing(Mobile from, Point3D p) => false;
public override void AlterLightLevel(Mobile m, ref int global, ref int personal)
{
global = LightCycle.JailLevel;
}
private static TextDefinition _jailBreakPlan = 1114345; // You'll need a better jailbreak plan than that!
public override bool CheckTravel(Mobile m, Point3D newLocation, TravelCheckType travelType, out TextDefinition message)
{
if (m?.AccessLevel == AccessLevel.Player)
{
message = _jailBreakPlan;
return false;
}
return base.CheckTravel(m, newLocation, travelType, out message);
}
public override bool OnBeginSpellCast(Mobile from, ISpell s)
{
if (from.AccessLevel == AccessLevel.Player)
{
from.SendLocalizedMessage(502629); // You cannot cast spells here.
return false;
}
return true;
}
public override bool OnSkillUse(Mobile from, int Skill)
{
if (from.AccessLevel == AccessLevel.Player)
{
from.SendMessage("You may not use skills in jail.");
return false;
}
return true;
}
public override bool OnCombatantChange(Mobile from, Mobile Old, Mobile New) => from.AccessLevel > AccessLevel.Player;
}