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

@ -1,11 +1,10 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Server.Commands.Generic;
using Server.Engines.Help;
using Server.Gumps;
using Server.Items;
using Server.Menus;
using Server.Menus.ItemLists;
using Server.Menus.Questions;
using Server.Misc;
using Server.Mobiles;
@ -17,7 +16,7 @@ using Server.Targets;
namespace Server.Commands
{
public static class CommandHandlers
public class CommandHandlers
{
public static void Initialize()
{
@ -89,17 +88,19 @@ namespace Server.Commands
{
if (e.Length == 1 && !e.GetBoolean(0))
{
Packets.SendSpeedControlDisabled(from.NetState);
from.Send(SpeedControl.Disable);
from.SendMessage("Speed boost has been disabled.");
}
else
{
Packets.SendSpeedControlMount(from.NetState);
from.Send(SpeedControl.MountSpeed);
from.SendMessage("Speed boost has been enabled.");
}
}
else
{
from.SendMessage("Format: SpeedBoost [true|false]");
}
}
[Usage("Where")]
@ -158,16 +159,18 @@ namespace Server.Commands
{
PageEntry pe = PageQueue.GetEntry(targ);
from.SendMessage(pe?.Handler == from
? "You may only use this command if you are handling their help page."
: "You may only use this command on someone who has paged you.");
if (pe?.Handler == from)
from.SendMessage("You may only use this command if you are handling their help page.");
else
from.SendMessage("You may only use this command on someone who has paged you.");
return;
}
from.SendMessage(targ.AddToBackpack(held)
? "The item they were holding has been placed into their backpack."
: "The item they were holding has been placed at their feet.");
if (targ.AddToBackpack(held))
from.SendMessage("The item they were holding has been placed into their backpack.");
else
from.SendMessage("The item they were holding has been placed at their feet.");
held.ClearBounce();
@ -217,8 +220,14 @@ namespace Server.Commands
}
List<IEntity> list = new List<IEntity>();
list.AddRange(World.Items.Values.Where(item => item.Map == map && item.Parent == null));
list.AddRange(World.Mobiles.Values.Where(m => m.Map == map && !m.Player));
foreach (Item item in World.Items.Values)
if (item.Map == map && item.Parent == null)
list.Add(item);
foreach (Mobile m in World.Mobiles.Values)
if (m.Map == map && !m.Player)
list.Add(m);
if (list.Count > 0)
{
@ -268,7 +277,9 @@ namespace Server.Commands
}
}
else
{
from.SendMessage("There were no pets found for that player.");
}
}
else if (obj is Mobile master && master.Player)
{
@ -297,7 +308,9 @@ namespace Server.Commands
}
}
else
{
from.SendMessage("There were no pets found for that player.");
}
}
else
{
@ -336,9 +349,15 @@ namespace Server.Commands
CommandLogging.WriteLine(m, "{0} {1} playing sound {2} (toAll={3})", m.AccessLevel, CommandLogging.Format(m),
index, toAll);
Packet p = new PlaySound(index, m.Location);
p.Acquire();
foreach (NetState state in m.GetClientsInRange(12))
if (toAll || state.Mobile.CanSee(m))
Packets.SendPlaySound(state, index, m.Location);
state.Send(p);
p.Release();
}
[Usage("Echo <text>")]
@ -347,7 +366,10 @@ namespace Server.Commands
{
string toEcho = e.ArgString.Trim();
e.Mobile.SendMessage(toEcho.Length > 0 ? toEcho : "Format: Echo \"<text>\"");
if (toEcho.Length > 0)
e.Mobile.SendMessage(toEcho);
else
e.Mobile.SendMessage("Format: Echo \"<text>\"");
}
[Usage("Bank")]
@ -506,12 +528,16 @@ namespace Server.Commands
Dictionary<string, Region> list = from.Map.Regions;
foreach (var (_, r) in list)
foreach (KeyValuePair<string, Region> kvp in list)
{
Region r = kvp.Value;
if (Insensitive.Equals(r.Name, name))
{
from.Location = new Point3D(r.GoLocation);
return;
}
}
for (int i = 0; i < Map.AllMaps.Count; ++i)
{
@ -592,7 +618,11 @@ namespace Server.Commands
{
Mobile m = e.Mobile;
List<CommandEntry> list = CommandSystem.Entries.Values.Where(entry => m.AccessLevel >= entry.AccessLevel).ToList();
List<CommandEntry> list = new List<CommandEntry>();
foreach (CommandEntry entry in CommandSystem.Entries.Values)
if (m.AccessLevel >= entry.AccessLevel)
list.Add(entry);
list.Sort();
@ -641,8 +671,13 @@ namespace Server.Commands
public static void BroadcastMessage(AccessLevel ac, int hue, string message)
{
foreach (Mobile m in NetState.Instances.Select(state => state.Mobile).Where(m => m?.AccessLevel >= ac))
m.SendMessage(hue, message);
foreach (NetState state in NetState.Instances)
{
Mobile m = state.Mobile;
if (m?.AccessLevel >= ac)
m.SendMessage(hue, message);
}
}
[Usage("AutoPageNotify")]