fix(cleanup): Consolidate the duplicate code in Properties, PropsGump, and PropsConfig (#540)
This commit is contained in:
parent
98ce65083a
commit
dd2933a9ef
21 changed files with 335 additions and 761 deletions
|
|
@ -10,6 +10,8 @@ using Server.Mobiles;
|
|||
using Server.Utilities;
|
||||
using CPA = Server.CommandPropertyAttribute;
|
||||
|
||||
using static Server.Attributes;
|
||||
|
||||
namespace Server.Engines.Spawners
|
||||
{
|
||||
public abstract class BaseSpawner : Item, ISpawner
|
||||
|
|
@ -529,7 +531,7 @@ namespace Server.Engines.Spawners
|
|||
return null;
|
||||
}
|
||||
|
||||
var attr = Properties.GetCPA(thisProp);
|
||||
var attr = GetCPA(thisProp);
|
||||
|
||||
if (attr == null || attr.WriteLevel > AccessLevel.Developer || !thisProp.CanWrite || attr.ReadOnly)
|
||||
{
|
||||
|
|
@ -600,7 +602,7 @@ namespace Server.Engines.Spawners
|
|||
if (paramargs.Length == 0)
|
||||
{
|
||||
entity = type.CreateInstance<IEntity>(
|
||||
ci => Add.IsConstructible(ci, AccessLevel.Developer)
|
||||
ci => IsConstructible(ci, AccessLevel.Developer)
|
||||
);
|
||||
}
|
||||
else
|
||||
|
|
@ -611,7 +613,7 @@ namespace Server.Engines.Spawners
|
|||
{
|
||||
var ctor = ctors[i];
|
||||
|
||||
if (Add.IsConstructible(ctor, AccessLevel.Developer))
|
||||
if (IsConstructible(ctor, AccessLevel.Developer))
|
||||
{
|
||||
var paramList = ctor.GetParameters();
|
||||
|
||||
|
|
|
|||
|
|
@ -15,10 +15,11 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Commands;
|
||||
using Server.Commands.Generic;
|
||||
using Server.Network;
|
||||
|
||||
using static Server.Types;
|
||||
|
||||
namespace Server.Engines.Spawners
|
||||
{
|
||||
public class EditSpawnCommand : BaseCommand
|
||||
|
|
@ -59,7 +60,7 @@ namespace Server.Engines.Spawners
|
|||
|
||||
var type = AssemblyHandler.FindTypeByName(name);
|
||||
|
||||
if (!Add.IsEntity(type))
|
||||
if (!IsEntity(type))
|
||||
{
|
||||
LogFailure("No type with that name was found.");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -14,11 +14,12 @@
|
|||
*************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Server.Commands;
|
||||
using Server.Commands.Generic;
|
||||
using Server.Gumps;
|
||||
using Server.Targeting;
|
||||
|
||||
using static Server.Types;
|
||||
|
||||
namespace Server.Engines.Spawners
|
||||
{
|
||||
public class SpawnPropsCommand : BaseCommand
|
||||
|
|
@ -53,15 +54,14 @@ namespace Server.Engines.Spawners
|
|||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private List<object> _list;
|
||||
private readonly List<object> _list;
|
||||
|
||||
public InternalTarget(List<object> list) : base(-1, false, TargetFlags.None) =>
|
||||
_list = list;
|
||||
public InternalTarget(List<object> list) : base(-1, false, TargetFlags.None) => _list = list;
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
var type = targeted.GetType();
|
||||
if (!Add.IsEntity(type))
|
||||
if (!IsEntity(type))
|
||||
{
|
||||
from.SendMessage("No type with that name was found.");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue