From e5e0c1c5c9fb6afd68ebe9dc075af23f46f11e25 Mon Sep 17 00:00:00 2001 From: TrueDoctor Date: Wed, 11 Apr 2018 14:41:01 +0200 Subject: General Cleanup and retructuring --- DiscoBot/Auxiliary/Misc.cs | 51 ----------------------------- DiscoBot/Auxiliary/RandomMisc.cs | 51 +++++++++++++++++++++++++++++ DiscoBot/Auxiliary/Soundeffects.cs | 66 -------------------------------------- DiscoBot/Auxiliary/Talent.cs | 2 +- 4 files changed, 52 insertions(+), 118 deletions(-) delete mode 100644 DiscoBot/Auxiliary/Misc.cs create mode 100644 DiscoBot/Auxiliary/RandomMisc.cs delete mode 100644 DiscoBot/Auxiliary/Soundeffects.cs (limited to 'DiscoBot/Auxiliary') diff --git a/DiscoBot/Auxiliary/Misc.cs b/DiscoBot/Auxiliary/Misc.cs deleted file mode 100644 index 2531f12..0000000 --- a/DiscoBot/Auxiliary/Misc.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace DiscoBot.Auxiliary -{ - using System; - using System.Linq; - using System.Text; - - public static class Misc - { - private static readonly Random Rand = new Random(); - - // use: 4w6 +4 - public static string Roll(string input) - { - var output = new StringBuilder(); - var strings = input.Split('w', 'd').ToList(); - int count = Convert.ToInt32(strings[0]); - strings = strings[1].Split(' ').ToList(); - int d = Convert.ToInt32(strings[0]); - - if (strings.Count > 0) - { - } - - int sum = 0; - for (int i = 0; i < count; i++) - { - var roll = Dice.Roll(d); - sum += roll; - output.Append("[" + roll + "] "); - } - - if (count > 1) - { - output.Append("sum: " + sum); - } - - return output.ToString(); - } - - public static double Random(double stdDev = 1, double mean = 0) - { - double u1 = Rand.NextDouble(); // uniform(0,1) random doubles - double u2 = Rand.NextDouble(); - double randStdNormal = Math.Sqrt(-2.0 * Math.Log(u1)) * - Math.Sin(2.0 * Math.PI * u2); // random normal(0,1) - double randNormal = - mean + stdDev * randStdNormal; // random normal(mean,stdDev^2) - return randNormal; - } - } -} diff --git a/DiscoBot/Auxiliary/RandomMisc.cs b/DiscoBot/Auxiliary/RandomMisc.cs new file mode 100644 index 0000000..b0df456 --- /dev/null +++ b/DiscoBot/Auxiliary/RandomMisc.cs @@ -0,0 +1,51 @@ +namespace DiscoBot.Auxiliary +{ + using System; + using System.Linq; + using System.Text; + + public static class RandomMisc + { + private static readonly Random Rand = new Random(); + + // use: 4w6 +4 + public static string Roll(string input) + { + var output = new StringBuilder(); + var strings = input.Split('w', 'd').ToList(); + int count = Convert.ToInt32(strings[0]); + strings = strings[1].Split(' ').ToList(); + int d = Convert.ToInt32(strings[0]); + + if (strings.Count > 0) + { + } + + int sum = 0; + for (int i = 0; i < count; i++) + { + var roll = Dice.Roll(d); + sum += roll; + output.Append("[" + roll + "] "); + } + + if (count > 1) + { + output.Append("sum: " + sum); + } + + return output.ToString(); + } + + public static double Random(double stdDev = 1, double mean = 0) + { + double u1 = Rand.NextDouble(); // uniform(0,1) random doubles + double u2 = Rand.NextDouble(); + double randStdNormal = Math.Sqrt(-2.0 * Math.Log(u1)) * + Math.Sin(2.0 * Math.PI * u2); // random normal(0,1) + double randNormal = + mean + stdDev * randStdNormal; // random normal(mean,stdDev^2) + return randNormal; + } + } +} diff --git a/DiscoBot/Auxiliary/Soundeffects.cs b/DiscoBot/Auxiliary/Soundeffects.cs deleted file mode 100644 index c959156..0000000 --- a/DiscoBot/Auxiliary/Soundeffects.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace DiscoBot.Auxiliary -{ - using System.Runtime.CompilerServices; - using System.Threading; - - using DiscoBot.Commands; - - public enum Sound - { - Bell, - Ding, - Nooo, - Monterkill, - Finish, - Wrong, - Magic - } - - public static class SoundEffects - { - public static async Task Play(Sound s) - { - string url = string.Empty; - int vol = 256; - switch (s) - { - case Sound.Bell: - case Sound.Ding: - url = "https://www.myinstants.com/media/sounds/boxing-bell.mp3"; - break; - case Sound.Finish: - url = "https://www.myinstants.com/media/sounds/finishhim.swf.mp3"; - break; - case Sound.Magic: - url = "https://www.myinstants.com/media/sounds/dream-harp-sound-effect.mp3"; - break; - case Sound.Monterkill: - url = "https://www.myinstants.com/media/sounds/announcer_kill_monster_01.mp3"; - break; - case Sound.Nooo: - url = "https://www.myinstants.com/media/sounds/nooo.swf.mp3"; - break; - case Sound.Wrong: - // url = "https://www.myinstants.com/media/sounds/stupid_dum_03.mp3"; - // vol = 10; - url = "https://www.myinstants.com/media/sounds/wrong-answer-sound-effect.mp3"; - vol = 50; - break; - } - - if (url != string.Empty) - { - // await Dsa.Service.SendAudioAsync(url, vol); - await Voice.SendAsync(url, vol); - } - - throw new Exception("Ton Existiert nicht"); - } - } -} diff --git a/DiscoBot/Auxiliary/Talent.cs b/DiscoBot/Auxiliary/Talent.cs index 969304c..e93aa18 100644 --- a/DiscoBot/Auxiliary/Talent.cs +++ b/DiscoBot/Auxiliary/Talent.cs @@ -17,7 +17,7 @@ public int Value { get; set; } - public string[] Test() // turn XX/XX/XX into string[]{XX,XX,XX} + public string[] GetEigenschaften() // turn XX/XX/XX into string[]{XX,XX,XX} { var temp = this.Probe.Split('/'); for (var index = 0; index < temp.Length; index++) -- cgit v1.3.1