From b5d51784117f5fdecb14bc1cef6a6d2477a7c810 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 27 Jan 2017 14:18:46 -0500 Subject: Modularize the Lua engine C# code can be exposed to Lua from anywhere in the entire source code. --- ShiftOS_TheReturn/Commands.cs | 59 ------------------------------------------- 1 file changed, 59 deletions(-) (limited to 'ShiftOS_TheReturn/Commands.cs') diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index ed4d0e4..64cb72a 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -44,69 +44,10 @@ using ShiftOS.Objects.ShiftFS; namespace ShiftOS.Engine { - [Namespace("virus")] - public class VirusTestCommands - { - [Command("infect")] - public static void InfectFileWithMUDVirus(Dictionary args) - { - string signature = ""; - - if (args.ContainsKey("signature")) - signature = args["signature"] as string; - else - throw new Exception("Virus signature not provided."); - - string script = ""; - - Action scriptFound = new Action((s) => - { - script = s; - Virus v = new LuaVirus(s, 1); - VirusEngine.Add(v); - VirusEngine.Infect($"lua.{v.Signature}.1"); - }); - - ServerManager.MessageReceived += (srv) => - { - if (srv.Name == "mud_virus") - { - scriptFound?.Invoke(srv.Contents); - scriptFound = null; - } - }; - - ServerManager.SendMessage("getvirus", signature); - } - } - - [RequiresUpgrade("mud_fundamentals")] [Namespace("mud")] public static class MUDCommands { - [Command("addvirus")] - public static void Virus_AddToDatabase(Dictionary args) - { - string file = ""; - int threatLevel = 0; - - - if (args.ContainsKey("file")) - file = args["file"] as string; - else - throw new Exception("No 'file' argument provided."); - - if (args.ContainsKey("threatlevel")) - threatLevel = Convert.ToInt32(args["threatlevel"].ToString()); - - Virus lua = new LuaVirus(Utils.ReadAllText(file), threatLevel); - - Console.WriteLine("Virus uploaded to current multi-user domain successfully."); - - } - - [Command("status")] public static bool Status() { -- cgit v1.2.3