From 27c9c6266cf7e2e2d06b4cb7be3360c9259407a3 Mon Sep 17 00:00:00 2001 From: TrueDoctor Date: Tue, 22 Aug 2017 14:36:31 +0200 Subject: removed unnecesary projacts --- DiscoBot/DiscoBot.csproj | 21 --------------------- DiscoBot/packages.config | 1 - 2 files changed, 22 deletions(-) diff --git a/DiscoBot/DiscoBot.csproj b/DiscoBot/DiscoBot.csproj index 7029d1d..fcd58d4 100644 --- a/DiscoBot/DiscoBot.csproj +++ b/DiscoBot/DiscoBot.csproj @@ -35,24 +35,6 @@ ..\packages\Discord.Net.0.9.6\lib\net45\Discord.Net.dll - - ..\packages\Discord.Net.Commands.0.9.6\lib\net45\Discord.Net.Commands.dll - - - ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll - - - ..\packages\Nito.AsyncEx.3.0.1\lib\net45\Nito.AsyncEx.dll - - - ..\packages\Nito.AsyncEx.3.0.1\lib\net45\Nito.AsyncEx.Concurrent.dll - - - ..\packages\Nito.AsyncEx.3.0.1\lib\net45\Nito.AsyncEx.Enlightenment.dll - - - ..\packages\RestSharp.105.2.3\lib\net452\RestSharp.dll - @@ -63,9 +45,6 @@ - - ..\packages\WebSocket4Net.0.14.1\lib\net45\WebSocket4Net.dll - diff --git a/DiscoBot/packages.config b/DiscoBot/packages.config index b7e5584..02a056d 100644 --- a/DiscoBot/packages.config +++ b/DiscoBot/packages.config @@ -1,7 +1,6 @@  - -- cgit v1.2.3-70-g09d2 From eb7a842b8fe784891a8f865cf47cc20e4fcb22b0 Mon Sep 17 00:00:00 2001 From: TrueDoctor Date: Tue, 22 Aug 2017 19:44:55 +0200 Subject: implemented charackter class implemented xml readout --- DiscoBot.sln | 17 +- DiscoBot/App.config | 34 +-- DiscoBot/AppControll.cs | 197 ---------------- DiscoBot/Char.cs | 109 +++++++++ DiscoBot/Commands.cs | 67 ++++++ DiscoBot/DiscoBot.csproj | 111 +++++++-- DiscoBot/MyBot.cs | 113 --------- DiscoBot/Program.cs | 63 ++++- DiscoBot/Properties/AssemblyInfo.cs | 2 +- DiscoBot/Properties/Settings.Designer.cs | 38 ---- DiscoBot/Properties/Settings.settings | 9 - DiscoBot/ServerControl.cs | 59 ----- DiscoBot/packages.config | 64 +++++- Felis.xml | 380 +++++++++++++++++++++++++++++++ 14 files changed, 794 insertions(+), 469 deletions(-) delete mode 100644 DiscoBot/AppControll.cs create mode 100644 DiscoBot/Char.cs create mode 100644 DiscoBot/Commands.cs delete mode 100644 DiscoBot/MyBot.cs delete mode 100644 DiscoBot/Properties/Settings.Designer.cs delete mode 100644 DiscoBot/Properties/Settings.settings delete mode 100644 DiscoBot/ServerControl.cs create mode 100644 Felis.xml diff --git a/DiscoBot.sln b/DiscoBot.sln index af2bf82..7049ed0 100644 --- a/DiscoBot.sln +++ b/DiscoBot.sln @@ -1,9 +1,14 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26228.9 +VisualStudioVersion = 15.0.26430.16 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscoBot", "DiscoBot\DiscoBot.csproj", "{1273D5D1-9F46-492F-9DFE-0098CD00405C}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A6857735-6707-4A33-A7F8-3A06E354D7F3}" + ProjectSection(SolutionItems) = preProject + Felis.xml = Felis.xml + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscoBot", "DiscoBot\DiscoBot.csproj", "{1186AF1C-BC46-4B3D-BEE0-CE478B8AEAC7}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +16,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1273D5D1-9F46-492F-9DFE-0098CD00405C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1273D5D1-9F46-492F-9DFE-0098CD00405C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1273D5D1-9F46-492F-9DFE-0098CD00405C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1273D5D1-9F46-492F-9DFE-0098CD00405C}.Release|Any CPU.Build.0 = Release|Any CPU + {1186AF1C-BC46-4B3D-BEE0-CE478B8AEAC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1186AF1C-BC46-4B3D-BEE0-CE478B8AEAC7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1186AF1C-BC46-4B3D-BEE0-CE478B8AEAC7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1186AF1C-BC46-4B3D-BEE0-CE478B8AEAC7}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/DiscoBot/App.config b/DiscoBot/App.config index fb543e1..f107529 100644 --- a/DiscoBot/App.config +++ b/DiscoBot/App.config @@ -1,18 +1,22 @@ - + - - -
- - - + - - - - C:\Users\Dennis\Downloads\FTBBeyondServer - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + diff --git a/DiscoBot/AppControll.cs b/DiscoBot/AppControll.cs deleted file mode 100644 index c32f3a2..0000000 --- a/DiscoBot/AppControll.cs +++ /dev/null @@ -1,197 +0,0 @@ -using System; -using System.Diagnostics; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -namespace DiscoBot -{ - public class ConsoleAppManager - { - private readonly string appName; - private readonly Process process = new Process(); - private readonly object theLock = new object(); - private SynchronizationContext context; - private string pendingWriteData; - - public ConsoleAppManager(string appName) - { - this.appName = appName; - - this.process.StartInfo.FileName = this.appName; - this.process.StartInfo.RedirectStandardError = true; - this.process.StartInfo.StandardErrorEncoding = Encoding.UTF8; - - this.process.StartInfo.RedirectStandardInput = true; - this.process.StartInfo.RedirectStandardOutput = true; - this.process.EnableRaisingEvents = true; - this.process.StartInfo.CreateNoWindow = true; - - this.process.StartInfo.UseShellExecute = false; - - this.process.StartInfo.StandardOutputEncoding = Encoding.UTF8; - - this.process.Exited += this.ProcessOnExited; - } - - public event EventHandler ErrorTextReceived; - public event EventHandler ProcessExited; - public event EventHandler StandartTextReceived; - - public int ExitCode - { - get { return this.process.ExitCode; } - } - - public bool Running - { - get; private set; - } - - public void ExecuteAsync(params string[] args) - { - if (this.Running) - { - throw new InvalidOperationException( - "Process is still Running. Please wait for the process to complete."); - } - - string arguments = string.Join(" ", args); - - this.process.StartInfo.Arguments = arguments; - - this.context = SynchronizationContext.Current; - - this.process.Start(); - this.Running = true; - - new Task(this.ReadOutputAsync).Start(); - new Task(this.WriteInputTask).Start(); - new Task(this.ReadOutputErrorAsync).Start(); - } - - public void Write(string data) - { - if (data == null) - { - return; - } - - lock (this.theLock) - { - this.pendingWriteData = data; - } - } - - public void WriteLine(string data) - { - this.Write(data + Environment.NewLine); - } - - protected virtual void OnErrorTextReceived(string e) - { - EventHandler handler = this.ErrorTextReceived; - - if (handler != null) - { - if (this.context != null) - { - this.context.Post(delegate { handler(this, e); }, null); - } - else - { - handler(this, e); - } - } - } - - protected virtual void OnProcessExited() - { - EventHandler handler = this.ProcessExited; - if (handler != null) - { - handler(this, EventArgs.Empty); - } - } - - protected virtual void OnStandartTextReceived(string e) - { - EventHandler handler = this.StandartTextReceived; - - if (handler != null) - { - if (this.context != null) - { - this.context.Post(delegate { handler(this, e); }, null); - } - else - { - handler(this, e); - } - } - } - - private void ProcessOnExited(object sender, EventArgs eventArgs) - { - this.OnProcessExited(); - } - - private async void ReadOutputAsync() - { - var standart = new StringBuilder(); - char[] buff = new char[1024]; - int length; - - while (this.process.HasExited == false) - { - standart.Clear(); - - length = await this.process.StandardOutput.ReadAsync(buff, 0, buff.Length); - char[] temp = new char[1024]; - Array.Copy(buff, temp, length); - standart.Append(temp); - this.OnStandartTextReceived(standart.ToString()); - Thread.Sleep(1); - } - - this.Running = false; - } - - private async void ReadOutputErrorAsync() - { - var sb = new StringBuilder(); - - do - { - sb.Clear(); - var buff = new char[1024]; - int length = await this.process.StandardError.ReadAsync(buff, 0, buff.Length); - char[] temp = new char[1024]; - Array.Copy(buff, temp, length); - sb.Append(temp); - this.OnErrorTextReceived(sb.ToString()); - Thread.Sleep(1); - } - while (this.process.HasExited == false); - } - - private async void WriteInputTask() - { - while (this.process.HasExited == false) - { - Thread.Sleep(1); - - if (this.pendingWriteData != null) - { - await this.process.StandardInput.WriteLineAsync(this.pendingWriteData); - await this.process.StandardInput.FlushAsync(); - - lock (this.theLock) - { - this.pendingWriteData = null; - } - } - } - } - } -} \ No newline at end of file diff --git a/DiscoBot/Char.cs b/DiscoBot/Char.cs new file mode 100644 index 0000000..250810d --- /dev/null +++ b/DiscoBot/Char.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml; + +namespace DiscoBot +{ + public class Char + { + + string name; + public Dictionary eigenschaften = new Dictionary(); + public List talente = new List(); + public List kampftalente = new List(); + + public Dictionary Proptable = new Dictionary(); + + + public Char(String path = "Felis.xml") + { + + Load(path); + } + + private void Load(string path) + { + XmlTextReader reader = new XmlTextReader(path); + while (reader.Read()) + { + if (reader.NodeType == XmlNodeType.Element) + switch (reader.Name) + { + case "held": + name = reader.GetAttribute("name"); + break; + case "eigenschaft": + eigenschaften.Add(reader.GetAttribute("name"), Convert.ToInt32(reader.GetAttribute("value")) + Convert.ToInt32(reader.GetAttribute("mod"))); + break; + case "talentliste": + reader.Read(); + while (reader.Name.Equals("talent")) + { + talente.Add(new Talent(reader.GetAttribute("name"), reader.GetAttribute("probe").Remove(0, 2).Trim(')'), Convert.ToInt32(reader.GetAttribute("value")))); + reader.Read(); + } + break; + case "kampfwerte": + string atname = reader.GetAttribute("name"); + reader.Read(); + int at = Convert.ToInt32(reader.GetAttribute("value")); + reader.Read(); + int pa = Convert.ToInt32(reader.GetAttribute("value")); + kampftalente.Add(new Kampf(atname, at, pa)); + break; + } + + + + } + Proptable.Add("MU", "Mut"); + Proptable.Add("KL", "Klugheit"); + Proptable.Add("IN", "Intuition"); + Proptable.Add("CH", "Charisma"); + Proptable.Add("FF", "Fingerfertigkeit"); + Proptable.Add("GE", "Gewandheit"); + Proptable.Add("KO", "Konstitution"); + Proptable.Add("KK", "Körperkraft"); + + } + string TestTalent(string talent) + { + var props =talente.Find(v => v.name.Equals(talent)).Test(); + + return ""; + } + + } + public class Talent + { + public string name, probe; + private int value; + public Talent(string name, string probe, int value) { this.name = name; this.probe = probe; this.value = value; } + public string[] Test() + { + var temp = probe.Split('/'); + foreach (string s in temp) + s.Replace("/", ""); + return temp; + } + + } + public class Kampf + { + string name; + private int at, pa; + public Kampf(string name, int at, int pa) { this.name = name; this.at = at; this.pa = pa; } + void Test() { } + } + public static class dice + { + public static int Rolld20() + { + System.Random rnd = new System.Random(); + return rnd.Next(19) + 1; + } + } +} diff --git a/DiscoBot/Commands.cs b/DiscoBot/Commands.cs new file mode 100644 index 0000000..9fe9513 --- /dev/null +++ b/DiscoBot/Commands.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Discord; +using Discord.Commands; +using Discord.WebSocket; + + +namespace DiscoBot +{ + class Commands + { + } + public class Info : ModuleBase + { + // ~say hello -> hello + [Command("say"), Summary("Echos a message.")] + public async Task Say([Remainder, Summary("The text to echo")] string echo) + { + + + // ReplyAsync is a method on ModuleBase + await ReplyAsync(echo); + + } + } + + public class Abfrage : ModuleBase + { + // ~say hello -> hello + [Command("t"), Summary("tests a talent.")] + public async Task Say([Remainder, Summary("The text to echo")] string talent) + { + // + //a.talente.First(x=>) + + + // ReplyAsync is a method on ModuleBase + + await ReplyAsync(talent); + + } + } + + [Group("sample")] + public class Sample : ModuleBase + { + // ~sample square 20 -> 400 + [Command("square"), Summary("Squares a number.")] + public async Task Square([Summary("The number to square.")] int num) + { + // We can also access the channel from the Command Context. + await Context.Channel.SendMessageAsync($"{num}^2 = {Math.Pow(num, 2)}"); + } + + [Command("userinfo"), Summary("Returns info about the current user, or the user parameter, if one passed.")] + [Alias("user", "whois")] + public async Task UserInfo([Summary("The (optional) user to get info for")] IUser user = null) + { + var userInfo = user ?? Context.Client.CurrentUser; + await ReplyAsync($"{userInfo.Username}#{userInfo.Discriminator}"); + } + } + +} diff --git a/DiscoBot/DiscoBot.csproj b/DiscoBot/DiscoBot.csproj index fcd58d4..9920f40 100644 --- a/DiscoBot/DiscoBot.csproj +++ b/DiscoBot/DiscoBot.csproj @@ -4,13 +4,14 @@ Debug AnyCPU - {1273D5D1-9F46-492F-9DFE-0098CD00405C} + {1186AF1C-BC46-4B3D-BEE0-CE478B8AEAC7} Exe DiscoBot DiscoBot - v4.5.2 + v4.6.1 512 true + AnyCPU @@ -32,39 +33,111 @@ 4 - - ..\packages\Discord.Net.0.9.6\lib\net45\Discord.Net.dll + + ..\packages\Discord.Net.Commands.1.0.1\lib\netstandard1.1\Discord.Net.Commands.dll + + + ..\packages\Discord.Net.Core.1.0.1\lib\net45\Discord.Net.Core.dll + + + ..\packages\Discord.Net.Rest.1.0.1\lib\net45\Discord.Net.Rest.dll + + + ..\packages\Discord.Net.Rpc.1.0.1\lib\net45\Discord.Net.Rpc.dll + + + ..\packages\Discord.Net.Webhook.1.0.1\lib\netstandard1.1\Discord.Net.Webhook.dll + + + ..\packages\Discord.Net.WebSocket.1.0.1\lib\net45\Discord.Net.WebSocket.dll + + + ..\packages\Microsoft.Extensions.DependencyInjection.1.1.1\lib\netstandard1.1\Microsoft.Extensions.DependencyInjection.dll + + + ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.1.1.1\lib\netstandard1.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll + + + ..\packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll + + + ..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll + + ..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll + + + ..\packages\System.Collections.Immutable.1.3.1\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + True + + + + ..\packages\System.Console.4.3.0\lib\net46\System.Console.dll + - - + + ..\packages\System.Diagnostics.DiagnosticSource.4.3.0\lib\net46\System.Diagnostics.DiagnosticSource.dll + + + ..\packages\System.Globalization.Calendars.4.3.0\lib\net46\System.Globalization.Calendars.dll + + + ..\packages\System.Interactive.Async.3.1.1\lib\net46\System.Interactive.Async.dll + + + ..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll + + + + ..\packages\System.IO.Compression.ZipFile.4.3.0\lib\net46\System.IO.Compression.ZipFile.dll + + + ..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll + + + ..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll + + + ..\packages\System.Net.Http.4.3.0\lib\net46\System.Net.Http.dll + + + ..\packages\System.Net.Sockets.4.3.0\lib\net46\System.Net.Sockets.dll + + + + ..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll + + + ..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll + + + ..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll + + + ..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll + + + ..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll + - + + ..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll + - + + - - - True - True - Settings.settings - - - - SettingsSingleFileGenerator - Settings.Designer.cs - \ No newline at end of file diff --git a/DiscoBot/MyBot.cs b/DiscoBot/MyBot.cs deleted file mode 100644 index f9bd427..0000000 --- a/DiscoBot/MyBot.cs +++ /dev/null @@ -1,113 +0,0 @@ -using Discord; -using Discord.Commands; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Drawing; -using System.Windows; - -namespace DiscoBot -{ - class MyBot - { - DiscordClient discord; - CommandService commands; - private String token; - ServerControl FTB = new ServerControl(); - - public MyBot(string token = "Mjk0NTU0MDU4Nzg4NzAwMTYx.C7XGwQ.VwCAM10lDmwUe01NhBvDKNbd17I") - { - this.token = token; - - discord = new DiscordClient(x => - { - x.LogLevel = LogSeverity.Info; - x.LogHandler = Log; - }); - - discord.UsingCommands(x => - { - x.PrefixChar = '!'; - x.AllowMentionPrefix = true; - }); - - commands = discord.GetService(); - //Mandelbrot(); - //Server(); - DSA(); - - discord.ExecuteAndWait(async () => - { - await discord.Connect(token, TokenType.Bot); - }); - } - - private void Mandelbrot() - { - commands.CreateCommand("mandelbrot") - .Do(async (e) => - { - //await e.Channel.SendMessage("!hallo"); - - await e.Channel.SendFile(@"C:\temp\temp.png"); - - - }); - } - private void Server() - { - - commands.CreateCommand("start") - .Do(async (e) => - { - await e.Channel.SendMessage("Server wird gestartet"); - - FTB.Start(); - - }); - commands.CreateCommand("stop") - .Do(async (e) => - { - await e.Channel.SendMessage("Server wird gestoppt"); - - //FTB.Stop(); - }); - commands.CreateCommand("/") - .Parameter("command",ParameterType.Required) - .Parameter("value",ParameterType.Multiple) - .Do(async (e) => - { - await e.Channel.SendMessage("Command wird ausgeführt"); - - FTB.Command(e.GetArg("command")+" "+e.GetArg("value")); - }); - - commands.CreateCommand("restart") - .Do(async (e) => - { - await e.Channel.SendMessage("Server wird neu gestartet"); - - FTB.Stop(); - }); - - } - private void DSA() - { - commands.CreateCommand("wer ist Schuld?") - .Do(async (e) => - { - await e.Channel.SendMessage(e.Channel.Users.ToArray()[new Random().Next(0,4)].ToString()); - - FTB.Stop(); - }); - } - - private void Log(object sender, LogMessageEventArgs e) - { - Console.WriteLine(e.Message); - } - } -} diff --git a/DiscoBot/Program.cs b/DiscoBot/Program.cs index aa7b7ab..962e416 100644 --- a/DiscoBot/Program.cs +++ b/DiscoBot/Program.cs @@ -3,20 +3,69 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Reflection; +using Discord; +using Discord.WebSocket; +using Discord.Commands; +using Microsoft.Extensions.DependencyInjection; + namespace DiscoBot { - class Program + public class Program { - static void Main(string[] args) + private CommandService commands; + private DiscordSocketClient client; + private IServiceProvider services; + + public Char a = new Char(); + + + static void Main(string[] args) => new Program().Start().GetAwaiter().GetResult(); + + public async Task Start() { - //new Form1(); - new System.Threading.Thread(Launch).Start(); - //MyBot Bot2 = new MyBot("MjU1NDM1MDUyMTg2MzM3Mjkw.Cydmeg.AV2aEAwrM9UHqOUnmmUXaC5TBm4"); + client = new DiscordSocketClient(); + commands = new CommandService(); + + string token = "Mjk0NTU0MDU4Nzg4NzAwMTYx.C7XGwQ.VwCAM10lDmwUe01NhBvDKNbd17I"; + + services = new ServiceCollection() + .BuildServiceProvider(); + + await InstallCommands(); + + await client.LoginAsync(TokenType.Bot, token); + await client.StartAsync(); + + await Task.Delay(-1); } - public static void Launch() + + public async Task InstallCommands() { - new MyBot(); + // Hook the MessageReceived Event into our Command Handler + client.MessageReceived += HandleCommand; + // Discover all of the commands in this assembly and load them. + await commands.AddModulesAsync(Assembly.GetEntryAssembly()); + } + + public async Task HandleCommand(SocketMessage messageParam) + { + // Don't process the command if it was a System Message + var message = messageParam as SocketUserMessage; + if (message == null) return; + // Create a number to track where the prefix ends and the command begins + int argPos = 0; + // Determine if the message is a command, based on if it starts with '!' or a mention prefix + if (!(message.HasCharPrefix('!', ref argPos) || message.HasMentionPrefix(client.CurrentUser, ref argPos))) return; + // Create a Command Context + var context = new CommandContext(client, message); + // Execute the command. (result does not indicate a return value, + // rather an object stating if the command executed successfully) + var result = await commands.ExecuteAsync(context, argPos, services); + if (!result.IsSuccess) + await context.Channel.SendMessageAsync(result.ErrorReason); } } + } diff --git a/DiscoBot/Properties/AssemblyInfo.cs b/DiscoBot/Properties/AssemblyInfo.cs index 700b7d6..1ff6b8f 100644 --- a/DiscoBot/Properties/AssemblyInfo.cs +++ b/DiscoBot/Properties/AssemblyInfo.cs @@ -20,7 +20,7 @@ using System.Runtime.InteropServices; [assembly: ComVisible(false)] // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird -[assembly: Guid("1273d5d1-9f46-492f-9dfe-0098cd00405c")] +[assembly: Guid("1186af1c-bc46-4b3d-bee0-ce478b8aeac7")] // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: // diff --git a/DiscoBot/Properties/Settings.Designer.cs b/DiscoBot/Properties/Settings.Designer.cs deleted file mode 100644 index 3bfda66..0000000 --- a/DiscoBot/Properties/Settings.Designer.cs +++ /dev/null @@ -1,38 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Dieser Code wurde von einem Tool generiert. -// Laufzeitversion:4.0.30319.42000 -// -// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -// der Code erneut generiert wird. -// -//------------------------------------------------------------------------------ - -namespace DiscoBot.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.0.1.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("C:\\Users\\Dennis\\Downloads\\FTBBeyondServer")] - public string ServerPaht { - get { - return ((string)(this["ServerPaht"])); - } - set { - this["ServerPaht"] = value; - } - } - } -} diff --git a/DiscoBot/Properties/Settings.settings b/DiscoBot/Properties/Settings.settings deleted file mode 100644 index d7563a4..0000000 --- a/DiscoBot/Properties/Settings.settings +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - C:\Users\Dennis\Downloads\FTBBeyondServer - - - \ No newline at end of file diff --git a/DiscoBot/ServerControl.cs b/DiscoBot/ServerControl.cs deleted file mode 100644 index 58da9fb..0000000 --- a/DiscoBot/ServerControl.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Diagnostics; -using System.IO; - -namespace DiscoBot -{ - class ServerControl - { - Process FTBProcess = new Process(); - ConsoleAppManager manager; - - public ServerControl() - { - manager = new ConsoleAppManager(DiscoBot.Properties.Settings.Default.ServerPaht + @"\ServerStart.bat"); - - FTBProcess.StartInfo.FileName = /*@"C:\Program Files\Java\jdk1.8.0_101\jre\bin\java.exe";//*/DiscoBot.Properties.Settings.Default.ServerPaht + @"\ServerStart.bat"; - //FTBProcess.StartInfo.Arguments = @"-server -Xms512M -Xmx6G -XX:PermSize=256M -XX:+UseParNewGC -XX:+CMSIncrementalPacing -XX:+CMSClassUnloadingEnabled -XX:ParallelGCThreads=2 -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -jar C:\Users\Dennis\Downloads\FTBBeyondServer\minecraft_server.1.10.2.jar nogui"; - FTBProcess.StartInfo.WorkingDirectory = /*@"C:\Program Files\Java\jdk1.8.0_101\jre\bin";*/Properties.Settings.Default.ServerPaht; - - - - } - - - private void Refresh() - { - while(true) - Console.WriteLine(FTBProcess.StandardOutput.ReadToEnd()); - } - - public void Start() - { - FTBProcess.Start(); - new System.Threading.Thread(Refresh).Start(); - - } - - - public void Command(string c) - { - FTBProcess.StandardInput.WriteLine(c); - } - - public void Stop() - { - Process[] myProcesses; - myProcesses = Process.GetProcessesByName("java"); - foreach (Process p in myProcesses) - p.Kill(); - - - } - - } -} diff --git a/DiscoBot/packages.config b/DiscoBot/packages.config index 02a056d..cf276c0 100644 --- a/DiscoBot/packages.config +++ b/DiscoBot/packages.config @@ -1,8 +1,62 @@  - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Felis.xml b/Felis.xml new file mode 100644 index 0000000..62cf8f5 --- /dev/null +++ b/Felis.xml @@ -0,0 +1,380 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pA70izIxomtGcRb/16T9inwwXw8= + + + VJwVRJxgJH4HZS+IjrA6Xwv5BHNXoEDLNFGY0OJX0t1jR6laSNhNsw== + + + +

+ /KaCzo4Syrom78z3EQ5SbbB4sF7ey80etKII864WF64B81uRpH5t9jQTxeEu0ImbzRMqzVDZkVG9 + xD7nN1kuFw== +

+ li7dzDacuo67Jg7mtqEm2TRuOMU= + + Z4Rxsnqc9E7pGknFFH2xqaryRPBaQ01khpMdLRQnG541Awtx/XPaF5Bpsy4pNWMOHCBiNU0Nogps + QW5QvnlMpA== + + + uVrvWkzIbUdL7E80AiD0PJDX3Ck0beY5StXp1wDAA1/ePpemd6rTBNd8YoCzOovNrX016YMcTSiO + iExM4RWtJA== + +
+
+
+
+
\ No newline at end of file -- cgit v1.2.3-70-g09d2 From d59a67e552628b464f079bccae20349d649bdd61 Mon Sep 17 00:00:00 2001 From: TrueDoctor Date: Tue, 22 Aug 2017 20:58:49 +0200 Subject: added syntax highlighting --- DiscoBot/Char.cs | 27 +++++++++++++++++++-------- DiscoBot/Commands.cs | 7 ++----- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/DiscoBot/Char.cs b/DiscoBot/Char.cs index 250810d..28ed7b9 100644 --- a/DiscoBot/Char.cs +++ b/DiscoBot/Char.cs @@ -64,23 +64,34 @@ namespace DiscoBot Proptable.Add("IN", "Intuition"); Proptable.Add("CH", "Charisma"); Proptable.Add("FF", "Fingerfertigkeit"); - Proptable.Add("GE", "Gewandheit"); + Proptable.Add("GE", "Gewandtheit"); Proptable.Add("KO", "Konstitution"); Proptable.Add("KK", "Körperkraft"); } - string TestTalent(string talent) + public string TestTalent(string talent) { - var props =talente.Find(v => v.name.Equals(talent)).Test(); - - return ""; + var output = new StringBuilder(); + var ttalent = talente.Find(v => v.name.Equals(talent)); + var props =ttalent.Test(); + int tap = ttalent.value; + for (int i = 0; i <= 2; i++) + { + int temp = dice.Rolld20(); + int eigenschaft = eigenschaften[Proptable[props[i]]]; + if (eigenschaft < temp) + tap -= temp - eigenschaft ; + output.Append(temp+" "); + } + output.Append("tap: "+ tap); + return output.ToString(); } } public class Talent { public string name, probe; - private int value; + public int value; public Talent(string name, string probe, int value) { this.name = name; this.probe = probe; this.value = value; } public string[] Test() { @@ -100,10 +111,10 @@ namespace DiscoBot } public static class dice { + static System.Random rnd = new System.Random(); public static int Rolld20() { - System.Random rnd = new System.Random(); - return rnd.Next(19) + 1; + return rnd.Next(1,21) ; } } } diff --git a/DiscoBot/Commands.cs b/DiscoBot/Commands.cs index 9fe9513..6984761 100644 --- a/DiscoBot/Commands.cs +++ b/DiscoBot/Commands.cs @@ -29,17 +29,14 @@ namespace DiscoBot public class Abfrage : ModuleBase { + Char test = new Char(); // ~say hello -> hello [Command("t"), Summary("tests a talent.")] public async Task Say([Remainder, Summary("The text to echo")] string talent) { - // - //a.talente.First(x=>) - - // ReplyAsync is a method on ModuleBase - await ReplyAsync(talent); + await ReplyAsync("```xl\n" + test.TestTalent(talent) + "\n```"); } } -- cgit v1.2.3-70-g09d2