fix: Prevent setting properties of higher privileged mobiles (#1420)
--------- Co-authored-by: Kamron Batman <3953314+kamronbatman@users.noreply.github.com>
This commit is contained in:
parent
8ff105ac46
commit
e9fa2bf9fa
3 changed files with 26 additions and 0 deletions
|
|
@ -363,6 +363,14 @@ namespace Server.Commands
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// Don't allow staff to be modified if they are under StaffAccess command
|
||||||
|
if (obj is Mobile mob &&
|
||||||
|
(mob.AccessLevel > from.AccessLevel ||
|
||||||
|
mob.Account?.AccessLevel > from.AccessLevel))
|
||||||
|
{
|
||||||
|
return "You cannot modify a higher privileged mobile.";
|
||||||
|
}
|
||||||
|
|
||||||
if (toSet is AccessLevel newLevel)
|
if (toSet is AccessLevel newLevel)
|
||||||
{
|
{
|
||||||
var reqLevel = newLevel switch
|
var reqLevel = newLevel switch
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Server.Commands;
|
using Server.Commands;
|
||||||
|
using Server.Commands.Generic;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
|
|
@ -16,6 +17,14 @@ namespace Server.Gumps
|
||||||
|
|
||||||
public override void OnResponse(NetState sender, RelayInfo relayInfo)
|
public override void OnResponse(NetState sender, RelayInfo relayInfo)
|
||||||
{
|
{
|
||||||
|
var from = sender.Mobile;
|
||||||
|
|
||||||
|
if (!BaseCommand.IsAccessible(from, m_Object))
|
||||||
|
{
|
||||||
|
from.SendMessage("You may no longer access their properties.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var index = relayInfo.ButtonID - 1;
|
var index = relayInfo.ButtonID - 1;
|
||||||
|
|
||||||
if (index >= 0 && index < m_Names.Length)
|
if (index >= 0 && index < m_Names.Length)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Server.Commands;
|
using Server.Commands;
|
||||||
|
using Server.Commands.Generic;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
using static Server.Gumps.PropsConfig;
|
using static Server.Gumps.PropsConfig;
|
||||||
|
|
@ -164,6 +165,14 @@ namespace Server.Gumps
|
||||||
|
|
||||||
public override void OnResponse(NetState sender, RelayInfo info)
|
public override void OnResponse(NetState sender, RelayInfo info)
|
||||||
{
|
{
|
||||||
|
var from = sender.Mobile;
|
||||||
|
|
||||||
|
if (!BaseCommand.IsAccessible(from, m_Object))
|
||||||
|
{
|
||||||
|
from.SendMessage("You may no longer access their properties.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var index = info.ButtonID - 1;
|
var index = info.ButtonID - 1;
|
||||||
|
|
||||||
if (index >= 0 && index < m_Values.Length)
|
if (index >= 0 && index < m_Values.Length)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue