Fixes FindItemsByType and FindItemByType and new override of IsLockedDown and IsSecure by renaming their methods.
This commit is contained in:
parent
7321fa1b63
commit
a48ebb3a5f
50 changed files with 416 additions and 643 deletions
|
|
@ -1108,7 +1108,7 @@ namespace Server.Commands.Generic
|
|||
}
|
||||
|
||||
foreach (BaseHouse house in BaseHouse.AllHouses)
|
||||
if (house.IsSecure(item) || house.IsLockedDown(item))
|
||||
if (house.HasSecureItem(item) || house.HasLockedDownItem(item))
|
||||
{
|
||||
e.Mobile.SendGump(new PropertiesGump(e.Mobile, house));
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ namespace Server.Commands.Generic
|
|||
size = i;
|
||||
}
|
||||
|
||||
parsed.Sort(delegate(BaseExtension a, BaseExtension b) { return a.Order - b.Order; });
|
||||
parsed.Sort((a, b) => a.Order - b.Order);
|
||||
|
||||
AssemblyEmitter emitter = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
public sealed class LimitExtension : BaseExtension
|
||||
{
|
||||
public static ExtensionInfo ExtInfo = new ExtensionInfo(80, "Limit", 1, delegate { return new LimitExtension(); });
|
||||
public static ExtensionInfo ExtInfo = new ExtensionInfo(80, "Limit", 1, () => new LimitExtension());
|
||||
|
||||
public override ExtensionInfo Info => ExtInfo;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
public sealed class SortExtension : BaseExtension
|
||||
{
|
||||
public static ExtensionInfo ExtInfo = new ExtensionInfo(40, "Order", -1, delegate { return new SortExtension(); });
|
||||
public static ExtensionInfo ExtInfo = new ExtensionInfo(40, "Order", -1, () => new SortExtension());
|
||||
|
||||
private IComparer m_Comparer;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
public sealed class WhereExtension : BaseExtension
|
||||
{
|
||||
public static ExtensionInfo ExtInfo = new ExtensionInfo(20, "Where", -1, delegate { return new WhereExtension(); });
|
||||
public static ExtensionInfo ExtInfo = new ExtensionInfo(20, "Where", -1, () => new WhereExtension());
|
||||
|
||||
public override ExtensionInfo Info => ExtInfo;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Items;
|
||||
using Server.Targeting;
|
||||
|
||||
|
|
@ -39,42 +41,36 @@ namespace Server.Commands.Generic
|
|||
if (command.ObjectTypes == ObjectTypes.Mobiles)
|
||||
return; // sanity check
|
||||
|
||||
if (!(targeted is Container))
|
||||
if (!(targeted is Container cont))
|
||||
{
|
||||
from.SendMessage("That is not a container.");
|
||||
else
|
||||
try
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Extensions ext = Extensions.Parse(from, ref args);
|
||||
|
||||
if (!CheckObjectTypes(from, command, ext, out bool items, out bool _))
|
||||
return;
|
||||
|
||||
if (!items)
|
||||
{
|
||||
Extensions ext = Extensions.Parse(from, ref args);
|
||||
|
||||
bool items, mobiles;
|
||||
|
||||
if (!CheckObjectTypes(from, command, ext, out items, out mobiles))
|
||||
return;
|
||||
|
||||
if (!items)
|
||||
{
|
||||
from.SendMessage("This command only works on items.");
|
||||
return;
|
||||
}
|
||||
|
||||
Container cont = (Container)targeted;
|
||||
|
||||
Item[] found = cont.FindItemsByType(typeof(Item), true);
|
||||
|
||||
ArrayList list = new ArrayList();
|
||||
|
||||
for (int i = 0; i < found.Length; ++i)
|
||||
if (ext.IsValid(found[i]))
|
||||
list.Add(found[i]);
|
||||
|
||||
ext.Filter(list);
|
||||
|
||||
RunCommand(from, list, command, args);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
from.SendMessage(e.Message);
|
||||
from.SendMessage("This command only works on items.");
|
||||
return;
|
||||
}
|
||||
|
||||
List<Item> list = cont.FindItemsByType<Item>().Where(item => ext.IsValid(item)).ToList();
|
||||
|
||||
// TODO: Is there a way to avoid using ArrayList?
|
||||
ext.Filter(new ArrayList(list));
|
||||
|
||||
RunCommand(from, list, command, args);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
from.SendMessage(e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue