fix: Fixes region priority and resolution. (#1254)
- [X] Fixes world location JSON deserializer. - [X] Fixes region resolver and priorities. - [X] Removes DynamicJson from regions. - [X] Adds missing region music.
This commit is contained in:
parent
139be1bc23
commit
18c4459e6b
31 changed files with 3809 additions and 3677 deletions
|
|
@ -1,77 +1,80 @@
|
|||
using System.Text.Json;
|
||||
using Server.Json;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Regions
|
||||
namespace Server.Regions;
|
||||
|
||||
public class JailRegion : BaseRegion
|
||||
{
|
||||
public class JailRegion : BaseRegion
|
||||
public JailRegion(string name, Map map, Region parent, params Rectangle3D[] area)
|
||||
: base(name, map, parent, area)
|
||||
{
|
||||
public JailRegion(DynamicJson json, JsonSerializerOptions options) : base(json, options)
|
||||
{
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public override bool CheckTravel(Mobile m, Point3D newLocation, TravelCheckType travelType)
|
||||
{
|
||||
if (m?.AccessLevel == AccessLevel.Player)
|
||||
{
|
||||
m.SendLocalizedMessage(1114345); // You'll need a better jailbreak plan than that!
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckTravel(m, newLocation, travelType);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public JailRegion(string name, Map map, Region parent, int priority, params Rectangle3D[] area)
|
||||
: base(name, map, parent, priority, area)
|
||||
{
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public override bool CheckTravel(Mobile m, Point3D newLocation, TravelCheckType travelType)
|
||||
{
|
||||
if (m?.AccessLevel == AccessLevel.Player)
|
||||
{
|
||||
m.SendLocalizedMessage(1114345); // You'll need a better jailbreak plan than that!
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckTravel(m, newLocation, travelType);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue