Revert "Updates Packets & Randomizer (#43)" (#61)

This reverts commit 179cb50557.
This commit is contained in:
Kamron Batman 2019-11-11 08:46:11 -08:00 committed by GitHub
parent 179cb50557
commit c2ecc76457
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
588 changed files with 16260 additions and 10926 deletions

View file

@ -111,15 +111,20 @@ namespace Server.Commands.Generic
case ObjectTypes.All:
case ObjectTypes.Both:
{
items |= condIsItem;
mobiles |= condIsMobile;
if (condIsItem)
items = true;
if (condIsMobile)
mobiles = true;
break;
}
case ObjectTypes.Items:
{
if (condIsItem)
{
items = true;
}
else if (condIsMobile)
{
from.SendMessage("You may not use a mobile type condition for this command.");
@ -131,7 +136,9 @@ namespace Server.Commands.Generic
case ObjectTypes.Mobiles:
{
if (condIsMobile)
{
mobiles = true;
}
else if (condIsItem)
{
from.SendMessage("You may not use an item type condition for this command.");

View file

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Items;
using Server.Targeting;
@ -41,7 +40,7 @@ namespace Server.Commands.Generic
from.SendMessage("That is not a container.");
return;
}
try
{
Extensions ext = Extensions.Parse(from, ref args);
@ -71,4 +70,4 @@ namespace Server.Commands.Generic
}
}
}
}
}

View file

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Server.Commands.Generic
{
@ -29,10 +28,14 @@ namespace Server.Commands.Generic
List<object> list = new List<object>();
if (items)
list.AddRange(World.Items.Values.Where(item => ext.IsValid(item)));
foreach (Item item in World.Items.Values)
if (ext.IsValid(item))
list.Add(item);
if (mobiles)
list.AddRange(World.Mobiles.Values.Where(mob => ext.IsValid(mob)));
foreach (Mobile mob in World.Mobiles.Values)
if (ext.IsValid(mob))
list.Add(mob);
ext.Filter(list);
@ -44,4 +47,4 @@ namespace Server.Commands.Generic
}
}
}
}
}

View file

@ -30,7 +30,8 @@ namespace Server.Commands.Generic
public void Compile(ref AssemblyEmitter emitter)
{
emitter ??= new AssemblyEmitter("__dynamic");
if (emitter == null)
emitter = new AssemblyEmitter("__dynamic");
m_Conditionals = new IConditional[m_Conditions.Length];

View file

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Server.Commands.Generic
{
@ -31,7 +30,16 @@ namespace Server.Commands.Generic
List<object> list = new List<object>();
if (mobiles)
list.AddRange(reg.GetMobiles().Where(mob => BaseCommand.IsAccessible(from, mob)).Where(mob => ext.IsValid(mob)));
{
foreach (Mobile mob in reg.GetMobiles())
{
if (!BaseCommand.IsAccessible(from, mob))
continue;
if (ext.IsValid(mob))
list.Add(mob);
}
}
else
{
command.LogFailure("This command does not support items.");
@ -48,4 +56,4 @@ namespace Server.Commands.Generic
}
}
}
}
}

View file

@ -17,7 +17,7 @@ namespace Server.Commands.Generic
{
Serial serial = e.GetUInt32(0);
IEntity obj = null;
object obj = null;
if (serial.IsItem)
obj = World.FindItem(serial);
@ -25,16 +25,22 @@ namespace Server.Commands.Generic
obj = World.FindMobile(serial);
if (obj == null)
{
e.Mobile.SendMessage("That is not a valid serial.");
}
else
{
Commands.TryGetValue(e.GetString(1), out BaseCommand command);
if (command == null)
{
e.Mobile.SendMessage(
"That is either an invalid command name or one that does not support this modifier.");
}
else if (e.Mobile.AccessLevel < command.AccessLevel)
{
e.Mobile.SendMessage("You do not have access to that command.");
}
else
{
switch (command.ObjectTypes)