summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--DiscoBot/Audio/AudioModule.cs89
-rw-r--r--DiscoBot/Audio/Soundeffects.cs (renamed from DiscoBot/Auxiliary/Soundeffects.cs)12
-rw-r--r--DiscoBot/Audio/Voice.cs (renamed from DiscoBot/Commands/Voice.cs)5
-rw-r--r--DiscoBot/Auxiliary/RandomMisc.cs (renamed from DiscoBot/Auxiliary/Misc.cs)2
-rw-r--r--DiscoBot/Auxiliary/Talent.cs2
-rw-r--r--DiscoBot/Characters/Character.cs11
-rw-r--r--DiscoBot/Characters/NPC.cs4
-rw-r--r--DiscoBot/Commands/MiscCommands.cs (renamed from DiscoBot/Commands/Utility.cs)4
-rw-r--r--DiscoBot/Commands/ProbenTest.cs (renamed from DiscoBot/Commands/Test.cs)2
-rw-r--r--DiscoBot/DiscoBot.csproj10
10 files changed, 68 insertions, 73 deletions
diff --git a/DiscoBot/Audio/AudioModule.cs b/DiscoBot/Audio/AudioModule.cs
index 0c3814f..9eaf1f2 100644
--- a/DiscoBot/Audio/AudioModule.cs
+++ b/DiscoBot/Audio/AudioModule.cs
@@ -12,61 +12,64 @@ using DiscoBot.Commands;
using Discord;
using Discord.Commands;
-public class AudioModule : ModuleBase
+namespace DiscoBot.Audio
{
- // Scroll down further for the AudioService.
- // Like, way down
- private readonly AudioService _service;
-
- // Remember to add an instance of the AudioService
- // to your IServiceCollection when you initialize your bot
- public AudioModule(AudioService service)
- {
- _service = service;
- Dsa.Service = service;
- }
-
- // You *MUST* mark these commands with 'RunMode.Async'
- // otherwise the bot will not respond until the Task times out.
- [Command("_join", RunMode = RunMode.Async)]
- public async Task JoinCmd()
+ public class AudioModule : ModuleBase
{
- await _service.JoinAudio(Context.Guild, (Context.User as IVoiceState).VoiceChannel);
- }
+ // Scroll down further for the AudioService.
+ // Like, way down
+ private readonly AudioService _service;
- // Remember to add preconditions to your commands,
- // this is merely the minimal amount necessary.
- // Adding more commands of your own is also encouraged.
- [Command("_leave", RunMode = RunMode.Async)]
- public async Task LeaveCmd()
- {
- await _service.LeaveAudio(Context.Guild);
- }
+ // Remember to add an instance of the AudioService
+ // to your IServiceCollection when you initialize your bot
+ public AudioModule(AudioService service)
+ {
+ _service = service;
+ Dsa.Service = service;
+ }
- [Command("_play", RunMode = RunMode.Async)]
- public async Task PlayCmd([Remainder] string song)
- {
- if (Dsa.GeneralContext == null)
+ // You *MUST* mark these commands with 'RunMode.Async'
+ // otherwise the bot will not respond until the Task times out.
+ [Command("_join", RunMode = RunMode.Async)]
+ public async Task JoinCmd()
{
- Dsa.GeneralContext = this.Context;
+ await _service.JoinAudio(Context.Guild, (Context.User as IVoiceState).VoiceChannel);
}
- var sounds = Enum.GetValues(typeof(Sound));
- var soundList = new List<Sound>();
- foreach (var sound in sounds)
+ // Remember to add preconditions to your commands,
+ // this is merely the minimal amount necessary.
+ // Adding more commands of your own is also encouraged.
+ [Command("_leave", RunMode = RunMode.Async)]
+ public async Task LeaveCmd()
{
- soundList.Add((Sound)sound);
+ await _service.LeaveAudio(Context.Guild);
}
- var sc = new SpellCorrect();
+ [Command("_play", RunMode = RunMode.Async)]
+ public async Task PlayCmd([Remainder] string song)
+ {
+ if (Dsa.GeneralContext == null)
+ {
+ Dsa.GeneralContext = this.Context;
+ }
- var tSound = soundList.OrderBy(x => sc.Compare(song, x.ToString())).First();
+ var sounds = Enum.GetValues(typeof(Sound));
+ var soundList = new List<Sound>();
+ foreach (var sound in sounds)
+ {
+ soundList.Add((Sound)sound);
+ }
- if (sc.Compare(song, tSound.ToString()) > SpellCorrect.ErrorThreshold)
- {
- await _service.SendAudioAsync(Context.Guild, Context.Channel, song);
- }
+ var sc = new SpellCorrect();
+
+ var tSound = soundList.OrderBy(x => sc.Compare(song, x.ToString())).First();
- await SoundEffects.Play(tSound);
+ if (sc.Compare(song, tSound.ToString()) > SpellCorrect.ErrorThreshold)
+ {
+ await _service.SendAudioAsync(Context.Guild, Context.Channel, song);
+ }
+
+ await SoundEffects.Play(tSound);
+ }
}
} \ No newline at end of file
diff --git a/DiscoBot/Auxiliary/Soundeffects.cs b/DiscoBot/Audio/Soundeffects.cs
index c959156..555a79c 100644
--- a/DiscoBot/Auxiliary/Soundeffects.cs
+++ b/DiscoBot/Audio/Soundeffects.cs
@@ -1,13 +1,7 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace DiscoBot.Auxiliary
+namespace DiscoBot.Audio
{
- using System.Runtime.CompilerServices;
- using System.Threading;
+ using System;
+ using System.Threading.Tasks;
using DiscoBot.Commands;
diff --git a/DiscoBot/Commands/Voice.cs b/DiscoBot/Audio/Voice.cs
index 9e94a30..d1f7915 100644
--- a/DiscoBot/Commands/Voice.cs
+++ b/DiscoBot/Audio/Voice.cs
@@ -1,15 +1,12 @@
-namespace DiscoBot.Commands
+namespace DiscoBot.Audio
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
- using System.Media;
- using System.Threading;
using System.Threading.Tasks;
- using DiscoBot.Audio;
using DiscoBot.Auxiliary;
using Discord;
diff --git a/DiscoBot/Auxiliary/Misc.cs b/DiscoBot/Auxiliary/RandomMisc.cs
index 2531f12..b0df456 100644
--- a/DiscoBot/Auxiliary/Misc.cs
+++ b/DiscoBot/Auxiliary/RandomMisc.cs
@@ -4,7 +4,7 @@
using System.Linq;
using System.Text;
- public static class Misc
+ public static class RandomMisc
{
private static readonly Random Rand = new Random();
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++)
diff --git a/DiscoBot/Characters/Character.cs b/DiscoBot/Characters/Character.cs
index 6884eaf..9d84fa8 100644
--- a/DiscoBot/Characters/Character.cs
+++ b/DiscoBot/Characters/Character.cs
@@ -6,6 +6,7 @@
using System.Text;
using System.Xml;
+ using DiscoBot.Audio;
using DiscoBot.Auxiliary;
public class Character : ICharacter
@@ -33,22 +34,22 @@
this.Name = name;
foreach (var i in c.Eigenschaften)
{
- this.Eigenschaften.Add(i.Key, i.Value + (int)Math.Round(Misc.Random(stDv)));
+ this.Eigenschaften.Add(i.Key, i.Value + (int)Math.Round(RandomMisc.Random(stDv)));
}
foreach (var i in c.Vorteile)
{
- this.Vorteile.Add(new Vorteil(i.Name, i.Value + (int)Math.Round(Misc.Random(stDv))));
+ this.Vorteile.Add(new Vorteil(i.Name, i.Value + (int)Math.Round(RandomMisc.Random(stDv))));
}
foreach (var i in c.Talente)
{
- this.Talente.Add(new Talent(i.Name, i.Probe, i.Value + (int)Math.Round(Misc.Random(stDv))));
+ this.Talente.Add(new Talent(i.Name, i.Probe, i.Value + (int)Math.Round(RandomMisc.Random(stDv))));
}
foreach (var i in c.Kampftalente)
{
- this.Kampftalente.Add(new KampfTalent(i.Name, i.At + (int)Math.Round(Misc.Random(stDv)), i.Pa + (int)Math.Round(Misc.Random(stDv))));
+ this.Kampftalente.Add(new KampfTalent(i.Name, i.At + (int)Math.Round(RandomMisc.Random(stDv)), i.Pa + (int)Math.Round(RandomMisc.Random(stDv))));
}
}
@@ -80,7 +81,7 @@
return $"{this.Name} kann nicht {talent}...";
}
- var props = tTalent.Test(); // get the required properties
+ var props = tTalent.GetEigenschaften(); // get the required properties
int tap = tTalent.Value; // get taw
var werte = props.Select(p => this.Eigenschaften[this.PropTable[p]]).ToList();
diff --git a/DiscoBot/Characters/NPC.cs b/DiscoBot/Characters/NPC.cs
index f399a70..341f775 100644
--- a/DiscoBot/Characters/NPC.cs
+++ b/DiscoBot/Characters/NPC.cs
@@ -25,7 +25,7 @@
{
// foreach property, dice and tap
int temp = Dice.Roll();
- int eigenschaft = (int)Math.Round(Misc.Random(this.stDv, this.mean));
+ int eigenschaft = (int)Math.Round(RandomMisc.Random(this.stDv, this.mean));
if (eigenschaft < temp)
{
@@ -45,7 +45,7 @@
public string TestEigenschaft(string eigenschaft, int erschwernis = 0)
{
int temp = Dice.Roll();
- int prop = (int)Math.Round(Misc.Random(this.stDv, this.stDv));
+ int prop = (int)Math.Round(RandomMisc.Random(this.stDv, this.stDv));
if (temp + erschwernis < prop)
{
diff --git a/DiscoBot/Commands/Utility.cs b/DiscoBot/Commands/MiscCommands.cs
index bbba1a1..c067507 100644
--- a/DiscoBot/Commands/Utility.cs
+++ b/DiscoBot/Commands/MiscCommands.cs
@@ -6,13 +6,13 @@
using Discord.Commands;
- public class Utility : ModuleBase
+ public class MiscCommands : ModuleBase
{
[Command("r"), Summary("Würfelt ")]
[Alias("R", "Roll", "roll", "Würfle")]
public Task RollAsync([Remainder, Summary("Weapon")] string roll)
{
- return this.ReplyAsync("```xl\n" + Misc.Roll(roll) + "\n```");
+ return this.ReplyAsync("```xl\n" + RandomMisc.Roll(roll) + "\n```");
}
[Command("general"), Summary("Set General ")]
diff --git a/DiscoBot/Commands/Test.cs b/DiscoBot/Commands/ProbenTest.cs
index d56a43c..a73f4fd 100644
--- a/DiscoBot/Commands/Test.cs
+++ b/DiscoBot/Commands/ProbenTest.cs
@@ -4,7 +4,7 @@
using Discord.Commands;
- public class Test : ModuleBase
+ public class ProbenTest : ModuleBase
{
[Command("t"), Summary("Würfelt ein Talent-/Zauberprobe")]
[Alias("T", "Talent", "talent", "zauber", "z", "versuche")]
diff --git a/DiscoBot/DiscoBot.csproj b/DiscoBot/DiscoBot.csproj
index 899a485..b6635ea 100644
--- a/DiscoBot/DiscoBot.csproj
+++ b/DiscoBot/DiscoBot.csproj
@@ -144,7 +144,8 @@
<Compile Include="Audio\AudioService.cs" />
<Compile Include="Auxiliary\Dice.cs" />
<Compile Include="Auxiliary\KampfTalent.cs" />
- <Compile Include="Auxiliary\Soundeffects.cs" />
+ <Compile Include="Audio\Soundeffects.cs" />
+ <Compile Include="Commands\MiscCommands.cs" />
<Compile Include="Auxiliary\SpellCorrect.cs" />
<Compile Include="Auxiliary\Talent.cs" />
<Compile Include="Auxiliary\Vorteil.cs" />
@@ -155,11 +156,10 @@
<Compile Include="Commands\Gm.cs" />
<Compile Include="Commands\List.cs" />
<Compile Include="Commands\NpcCommands.cs" />
- <Compile Include="Commands\Test.cs" />
- <Compile Include="Commands\Utility.cs" />
- <Compile Include="Commands\Voice.cs" />
+ <Compile Include="Commands\ProbenTest.cs" />
+ <Compile Include="Audio\Voice.cs" />
<Compile Include="Characters\ICharacter.cs" />
- <Compile Include="Auxiliary\Misc.cs" />
+ <Compile Include="Auxiliary\RandomMisc.cs" />
<Compile Include="Characters\NPC.cs" />
<Compile Include="Dsa.cs" />
<Compile Include="Program.cs" />