From 2ab4051c6fe720dc47e99b0c305a0d779ee02d51 Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Sun, 19 May 2019 17:58:42 +0200 Subject: Moved Gamelogic to DSALib --- DSACore/Commands/CommandHandler.cs | 134 ------------------------------------- 1 file changed, 134 deletions(-) delete mode 100644 DSACore/Commands/CommandHandler.cs (limited to 'DSACore/Commands/CommandHandler.cs') diff --git a/DSACore/Commands/CommandHandler.cs b/DSACore/Commands/CommandHandler.cs deleted file mode 100644 index f74f87f..0000000 --- a/DSACore/Commands/CommandHandler.cs +++ /dev/null @@ -1,134 +0,0 @@ -using System; -using DSACore.Auxiliary; -using DSACore.Auxiliary.Calculator; -using DSACore.DSA_Game; -using DSACore.Models.Network; - -namespace DSACore.Commands -{ - public class CommandHandler - { - public static CommandResponse ExecuteCommand(Command cmd) - { - var res = string.Empty; - var type = ResponseType.Broadcast; - switch (cmd.CmdIdentifier.ToLower()) - { - case "addChar": - res = FileHandler.AddChar(cmd.CharId, cmd.CmdText); - break; - case "held": - case "wert": - case "werte": - case "char": - res = HeldList.ListAsync(cmd.CharId, cmd.CmdText); - break; - case "help": - case "man": - case "hilfe": - case "h": - res = Help.ShowHelp(cmd.CmdTexts.ToArray()); - type = ResponseType.Caller; - break; - case "le": - case "leben": - case "lp": - res = LE.LEAsync(cmd.CharId, cmd.CmdText); - break; - case "ae": - case "astral": - case "asp": - res = AE.AEAsync(cmd.CharId, cmd.CmdText); - break; - case "list": - res = List.ListAsync(cmd.CmdText); - type = ResponseType.Caller; - break; - case "r": - case "roll": - res = RandomMisc.Roll(cmd.CmdText + " " + cmd.Cmdmodifier); - break; - case "solve": - res = new StringSolver(cmd.CmdText + cmd.Cmdmodifier).Solve().ToString(); - break; - case "npc": - res = NpcCommands.CreateNpc(cmd.CharId, cmd.CmdTexts, cmd.Cmdmodifier); - break; - } - - if (res == string.Empty) res = Proben(cmd.Name, cmd.CmdIdentifier, cmd.CmdText, cmd.Cmdmodifier); - if (res != string.Empty) return new CommandResponse(res, type); - return new CommandResponse($"Kommando {cmd.CmdIdentifier} nicht gefunden", ResponseType.Error); - } - - private static string Proben(string name, string command, string waffe, int erschwernis = 0) - { - var res = string.Empty; - switch (command.ToLower()) - { - case "f": - case "fern": - case "fernkampf": - res = CheckCommand(name, CommandTypes.Fernkampf, waffe, erschwernis); - break; - case "t": - case "ta": - case "talent": - case "talente": - res = CheckCommand(name, CommandTypes.Talent, waffe, erschwernis); - break; - case "e": - case "ei": - case "eigenschaft": - res = CheckCommand(name, CommandTypes.Eigenschaft, waffe, erschwernis); - break; - case "z": - case "za": - case "zauber": - case "magie": - case "m": - res = CheckCommand(name, CommandTypes.Talent, waffe, erschwernis); - break; - case "a": - case "at": - case "an": - case "angrif": - case "angriff": - res = CheckCommand(name, CommandTypes.Angriff, waffe, erschwernis); - break; - case "p": - case "pa": - case "parade": - res = CheckCommand(name, CommandTypes.Parade, waffe, erschwernis); - break; - } - - return res; - } - - private static string CheckCommand(string name, CommandTypes command, string waffe, int erschwernis = 0) - { - var chr = Dsa.GetCharacter(0); - - switch (command) - { - case CommandTypes.Talent: - return chr.TestTalent(waffe, erschwernis); - case CommandTypes.Eigenschaft: - return chr.TestEigenschaft(waffe, erschwernis); - case CommandTypes.Angriff: - return chr.Angriff(waffe, erschwernis); - case CommandTypes.Parade: - return chr.Parade(waffe, erschwernis); - case CommandTypes.Fernkampf: - return chr.Fernkampf(waffe, erschwernis); - case CommandTypes.Zauber: - return chr.TestZauber(waffe, erschwernis); - } - - return $"{name} verwendet {waffe}"; - - throw new NotImplementedException("access char by id ore name and group id"); - } - } -} \ No newline at end of file -- cgit v1.2.3-54-g00ecf