diff options
Diffstat (limited to 'DiscoBot')
27 files changed, 1413 insertions, 265 deletions
diff --git a/DiscoBot/App.config b/DiscoBot/App.config index f107529..d08a333 100644 --- a/DiscoBot/App.config +++ b/DiscoBot/App.config @@ -1,5 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> <configuration> + <configSections> + <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > + <section name="DiscoBot.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> + </sectionGroup> + </configSections> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> </startup> @@ -10,13 +15,20 @@ <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" /> </dependentAssembly> <dependentAssembly> - <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /> - </dependentAssembly> - <dependentAssembly> <assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.2.2.0" newVersion="1.2.2.0" /> + </dependentAssembly> </assemblyBinding> </runtime> + <userSettings> + <DiscoBot.Properties.Settings> + <setting name="Token" serializeAs="String"> + <value>Mjk0NTU0MDU4Nzg4NzAwMTYx.DOzDcQ.J-nCikbZdZtdrug0E8TwwV_2ITw</value> + </setting> + </DiscoBot.Properties.Settings> + </userSettings> </configuration> diff --git a/DiscoBot/Auxiliary/CommandExtension.cs b/DiscoBot/Auxiliary/CommandExtension.cs new file mode 100644 index 0000000..6690d03 --- /dev/null +++ b/DiscoBot/Auxiliary/CommandExtension.cs @@ -0,0 +1,46 @@ +namespace DiscoBot.Auxiliary +{ + using System; + using System.Collections.Generic; + using System.ComponentModel; + using System.Linq; + using System.Threading; + using System.Threading.Tasks; + + using Discord; + using Discord.Commands; + + public static class CommandExtension + { + public static async Task ReplyTimedAsync(this ModuleBase m, string message, TimeSpan time) + { + var token = message.GetHashCode(); + var send = m.Context.Channel.SendMessageAsync($"#{token}\n```xl\n{message}```", true); + + var barInvoker = new BackgroundWorker(); + barInvoker.DoWork += delegate + { + Thread.Sleep(time); + Delete(token, m); + }; + + await send; + barInvoker.RunWorkerAsync(); + } + + private static void Delete(int token, ModuleBase m) + { + var messagesAsync = m.Context.Channel.GetMessagesAsync(); + Task.WaitAll(messagesAsync.ToArray()); + var list = messagesAsync.ToEnumerable().ToList(); + var messages = new List<IMessage>(); + foreach (var task in list) + { + messages.AddRange(task.ToList()); + } + + m.Context.Channel.DeleteMessagesAsync( + messages.Where(x => x.Content.StartsWith($"#{token}\n") && x.Author.IsBot)); + } + } +} diff --git a/DiscoBot/Auxiliary/Dice.cs b/DiscoBot/Auxiliary/Dice.cs new file mode 100644 index 0000000..16a8a77 --- /dev/null +++ b/DiscoBot/Auxiliary/Dice.cs @@ -0,0 +1,12 @@ +namespace DiscoBot.Auxiliary +{ + public static class Dice // roll it! + { + private static readonly System.Random Rnd = new System.Random(); + + public static int Roll(int d = 20) + { + return Rnd.Next(d) + 1; + } + } +} diff --git a/DiscoBot/Auxiliary/KampfTalent.cs b/DiscoBot/Auxiliary/KampfTalent.cs new file mode 100644 index 0000000..05b7c9e --- /dev/null +++ b/DiscoBot/Auxiliary/KampfTalent.cs @@ -0,0 +1,18 @@ +namespace DiscoBot.Auxiliary +{ + public class KampfTalent + { + public KampfTalent(string name, int at, int pa) + { + this.Name = name; + this.At = at; + this.Pa = pa; + } + + public string Name { get; set; } + + public int At { get; set; } + + public int Pa { get; set; } + } +} diff --git a/DiscoBot/Auxiliary/Misc.cs b/DiscoBot/Auxiliary/Misc.cs new file mode 100644 index 0000000..2531f12 --- /dev/null +++ b/DiscoBot/Auxiliary/Misc.cs @@ -0,0 +1,51 @@ +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/SpellCorrect.cs b/DiscoBot/Auxiliary/SpellCorrect.cs new file mode 100644 index 0000000..8c5741b --- /dev/null +++ b/DiscoBot/Auxiliary/SpellCorrect.cs @@ -0,0 +1,134 @@ +namespace DiscoBot.Auxiliary +{ + using System; + using System.Diagnostics; + using System.Linq; + + public class SpellCorrect : StringComparer + { + public override int Compare(string x, string y) + { + if (string.IsNullOrEmpty(x)) + { + throw new ArgumentException("message", nameof(x)); + } + + if (string.IsNullOrEmpty(y)) + { + throw new ArgumentException("message", nameof(y)); + } + + if (x.Equals(y)) + { + return 0; + } + + x = x.ToLower(); + y = y.ToLower(); + if (x.Equals(y)) + { + return 1; + } + + var subs = y.Split(' ', '/'); + int score = subs.Count(); + foreach (string s in subs) + { + if (s.Equals(x)) + { + score--; + } + } + + if (score < subs.Count()) + { + return score + 1; + } + + return 100000 - (int)(this.CompareExact(x, y) * 1000.0); + /*if (y.Contains(x)) + return 6;*/ + } + + public override bool Equals(string x, string y) + { + Debug.Assert(x != null, nameof(x) + " != null"); + return x.Equals(y); + } + + public override int GetHashCode(string obj) + { + throw new NotImplementedException(); + } + + public double CompareExact(string s, string q) + { + int i, j; + const double Match = 3.0; + const double Gap = -2.0; + const double Mismatch = -2.0; + + double decay; + + double[,] matrix = new double[s.Length + 1, q.Length + 1]; + double max = 0.0; + matrix[0, 0] = 0.0; + + for (i = 1; i < s.Length; i++) + { + matrix[i, 0] = 0.0; + } + + for (i = 1; i < q.Length; i++) + { + matrix[0, i] = 0.0; + } + + for (i = 1; i <= s.Length; i++) + { + for (j = 1; j <= q.Length; j++) + { + decay = j / (double)(s.Length * 1000); + double add = s[i - 1] == q[j - 1] ? (Match - decay) : Mismatch; + double score = matrix[i - 1, j - 1] + add; + + if (score < (matrix[i - 1, j] + Gap)) + { + score = matrix[i - 1, j] + Gap; + } + + if (score < (matrix[i, j - 1] + Gap)) + { + score = matrix[i, j - 1] + Gap; + } + + if (i > 1 && j > 1) + { + if (s[i - 1] == q[j - 2] && s[i - 2] == q[j - 1]) + { + add = (3 / 2.0) * Match - decay; + if (score < matrix[i - 2, j - 2] + add) + { + score = matrix[i - 2, j - 2] + add; + } + } + } + + if (score < 0) + { + score = 0; + } + + if (max < score) + { + max = score; + } + + matrix[i, j] = score; + } + } + + return max; + } + } +} diff --git a/DiscoBot/Auxiliary/Talent.cs b/DiscoBot/Auxiliary/Talent.cs new file mode 100644 index 0000000..969304c --- /dev/null +++ b/DiscoBot/Auxiliary/Talent.cs @@ -0,0 +1,37 @@ +namespace DiscoBot.Auxiliary +{ + using System; + + public class Talent // talent objekt + { + public Talent(string name, string probe, int value) + { + this.Name = name; + this.Probe = probe; + this.Value = value; + } + + public string Name { get; set; } + + public string Probe { get; set; } + + public int Value { get; set; } + + public string[] Test() // turn XX/XX/XX into string[]{XX,XX,XX} + { + var temp = this.Probe.Split('/'); + for (var index = 0; index < temp.Length; index++) + { + temp[index] = temp[index].Replace("/", string.Empty); + } + + return temp; + } + + public int CheckName(string quarry) + { + var sc = (StringComparer)new SpellCorrect(); + return sc.Compare(quarry, this.Name); + } + } +} diff --git a/DiscoBot/Auxiliary/Vorteil.cs b/DiscoBot/Auxiliary/Vorteil.cs new file mode 100644 index 0000000..823305c --- /dev/null +++ b/DiscoBot/Auxiliary/Vorteil.cs @@ -0,0 +1,15 @@ +namespace DiscoBot.Auxiliary +{ + public class Vorteil // talent objekt + { + public Vorteil(string name, int value = 0) + { + this.Name = name; + this.Value = value; + } + + public string Name { get; set; } + + public int Value { get; set; } + } +} diff --git a/DiscoBot/Char.cs b/DiscoBot/Char.cs deleted file mode 100644 index 28ed7b9..0000000 --- a/DiscoBot/Char.cs +++ /dev/null @@ -1,120 +0,0 @@ -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<string, int> eigenschaften = new Dictionary<string, int>(); - public List<Talent> talente = new List<Talent>(); - public List<Kampf> kampftalente = new List<Kampf>(); - - public Dictionary<string, string> Proptable = new Dictionary<string, string>(); - - - 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", "Gewandtheit"); - Proptable.Add("KO", "Konstitution"); - Proptable.Add("KK", "Körperkraft"); - - } - public string TestTalent(string talent) - { - 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; - public 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 - { - static System.Random rnd = new System.Random(); - public static int Rolld20() - { - return rnd.Next(1,21) ; - } - } -} diff --git a/DiscoBot/Characters/Character.cs b/DiscoBot/Characters/Character.cs new file mode 100644 index 0000000..a78e613 --- /dev/null +++ b/DiscoBot/Characters/Character.cs @@ -0,0 +1,312 @@ +namespace DiscoBot.Characters +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Text; + using System.Xml; + + using DiscoBot.Auxiliary; + + public class Character : ICharacter + { + public Character() + { + this.PropTable.Add("MU", "Mut"); // routing + this.PropTable.Add("KL", "Klugheit"); + this.PropTable.Add("IN", "Intuition"); + this.PropTable.Add("CH", "Charisma"); + this.PropTable.Add("FF", "Fingerfertigkeit"); + this.PropTable.Add("GE", "Gewandtheit"); + this.PropTable.Add("KO", "Konstitution"); + this.PropTable.Add("KK", "Körperkraft"); + } + + public Character(string path) : this() + { + this.Load(path); // load + } + + public Character(Character c, string name, int stDv = 2) : this() + { + this.Name = name; + foreach (var i in c.Eigenschaften) + { + this.Eigenschaften.Add(i.Key, i.Value + (int)Math.Round(Misc.Random(stDv))); + } + + foreach (var i in c.Vorteile) + { + this.Vorteile.Add(new Vorteil(i.Name, i.Value + (int)Math.Round(Misc.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)))); + } + + 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)))); + } + } + + public string Name { get; set; } // char name + + public Dictionary<string, int> Eigenschaften { get; set; } = new Dictionary<string, int>(); // char properties + + public List<Talent> Talente { get; set; } = new List<Talent>(); // list of talent objects (talents and spells) + + public List<KampfTalent> Kampftalente { get; set; } = new List<KampfTalent>(); // list of combat objects + + public List<Vorteil> Vorteile { get; set; } = new List<Vorteil>(); + + public Dictionary<string, string> PropTable { get; set; } = new Dictionary<string, string>(); // -> Körperkraft + + public string TestTalent(string talent, int erschwernis = 0) // Talentprobe + { + try + { + var output = new StringBuilder(); + var sc = new SpellCorrect(); + var tTalent = this.Talente.OrderBy(x => sc.Compare(talent, x.Name)).First(); + + if (sc.Compare(talent, tTalent.Name) > 94100) + { + return $"{this.Name} kann nicht {talent}..."; + } + + var props = tTalent.Test(); // get the required properties + int tap = tTalent.Value; // get tap + var werte = props.Select(p => this.Eigenschaften[this.PropTable[p]]).ToList(); + + output.AppendFormat( + "{0} würfelt: {1} \n{2} - {3} taw:{4} {5} \n", + this.Name, + tTalent.Name, + tTalent.Probe, + string.Join("/", werte), + tTalent.Value, + erschwernis.Equals(0) ? string.Empty : "Erschwernis: " + erschwernis); + + output.Append(" "); + tap -= erschwernis; + int gesamtErschwernis = tap; + if (gesamtErschwernis < 0) + { + tap = 0; + for (int i = 0; i <= 2; i++) + { + // foreach property, dice and tap + int temp = Dice.Roll(); + int eigenschaft = this.Eigenschaften[this.PropTable[props[i]]]; + + if (eigenschaft - gesamtErschwernis < temp) + { + tap -= temp - eigenschaft + gesamtErschwernis; + } + + output.Append($"[{temp}]"); // add to string + } + + if (tap >= 0) + { + tap = 1; + } + } + else + { + for (int i = 0; i <= 2; i++) + { + // foreach property, dice and tap + int temp = Dice.Roll(); + int eigenschaft = this.Eigenschaften[this.PropTable[props[i]]]; + + if (eigenschaft < temp) + { + tap -= temp - eigenschaft; + } + + output.Append($"[{temp}]"); // add to string + } + } + + tap = tap == 0 ? 1 : tap; + + output.AppendFormat(" tap: {0,2}", tap); + + return output.ToString(); // return output + } + catch (Exception) + { + throw new Exception( + $"{talent} nicht vorhanden! Besitzt {this.Name} {talent} nicht? \n Oder ist {talent} falsch geschrieben?"); + } + } + + public string TestEigenschaft(string eigenschaft, int erschwernis = 0) + { + var output = new StringBuilder(); + var prop = this.PropTable[eigenschaft.ToUpper()]; + int tap = this.Eigenschaften[prop]; + output.AppendFormat( + "{0}-Eigenschaftsprobe ew:{1} {2} \n", + prop, + tap, + erschwernis.Equals(0) ? string.Empty : "Erschwernis: " + erschwernis); + int roll = Dice.Roll(); + output.Append($"Gewürfelt: {roll} übrig: {tap - roll - erschwernis}"); + return output.ToString(); + } + + public string Angriff(string talent, int erschwernis = 0) // pretty self explanatory + { + var output = new StringBuilder(); + var sc = new SpellCorrect(); + var attack = this.Kampftalente.OrderBy(x => sc.Compare(talent, x.Name)).First(); + if (sc.Compare(talent, attack.Name) > 94) + { + return $"{this.Name} kann nicht mit der Waffenart {talent} umgehen..."; + } + + int tap = attack.At; + output.AppendFormat( + "{0}-Angriff taw:{1} {2} \n", + attack.Name, + tap, + erschwernis.Equals(0) ? string.Empty : "Erschwernis: " + erschwernis); + + int temp = Dice.Roll(); + output.Append(temp - erschwernis); + return output.ToString(); + } + + public string Parade(string talent, int erschwernis = 0) + { + var output = new StringBuilder(); + var sc = new SpellCorrect(); + var attack = this.Kampftalente.OrderBy(x => sc.Compare(talent, x.Name)).First(); + + if (sc.Compare(talent, attack.Name) > 94) + { + return $"{this.Name} kann nicht mit der Waffenart {talent} umgehen..."; + } + + int tap = attack.Pa; + output.AppendFormat( + "{0}-Parade taw:{1} {2}\n", + attack.Name, + tap, + erschwernis.Equals(0) ? string.Empty : "Erschwernis: " + erschwernis); + + int temp = Dice.Roll(); + output.Append(temp - erschwernis); + return output.ToString(); + } + + public string Fernkampf(string talent, int erschwernis = 0) + { + var output = new StringBuilder(); + var sc = new SpellCorrect(); + int fk = this.Eigenschaften["fk"]; + var attack = this.Talente.OrderBy(x => sc.Compare(talent, x.Name)).First(); + if (sc.Compare(talent, attack.Name) > 94) + { + return $"{this.Name} kann nicht mit der Waffenart {talent} umgehen..."; + } + + int tap = attack.Value; + output.AppendFormat( + "{0} taw:{1} {2} \n", + attack.Name, + tap, + erschwernis.Equals(0) ? string.Empty : "Erschwernis: " + erschwernis); + tap -= erschwernis; + int temp = Dice.Roll(); + tap -= temp > fk ? temp - fk : 0; + output.Append($"W20: {temp} tap: {tap}"); + return output.ToString(); + } + + private void Load(string path) + { + var reader = new XmlTextReader(path); + while (reader.Read()) + { + // read until he hits keywords + if (reader.NodeType != XmlNodeType.Element) + { + continue; + } + + switch (reader.Name) + { + case "Wesen": + reader.Skip(); + break; + case "held": + this.Name = reader.GetAttribute("name"); // name + break; + case "eigenschaft": + this.Eigenschaften.Add( + reader.GetAttribute("name") ?? throw new InvalidOperationException(), + Convert.ToInt32(reader.GetAttribute("value")) + Convert.ToInt32(reader.GetAttribute("mod"))); + break; + case "vt": + reader.Read(); + while (reader.Name.Equals("vorteil")) + { + try + { + this.Vorteile.Add(new Vorteil( + reader.GetAttribute("name"), + Convert.ToInt32(reader.GetAttribute("value")))); + } + catch + { + this.Vorteile.Add(new Vorteil(reader.GetAttribute("name"))); + } + + reader.Read(); + } + + break; + case "talentliste": + reader.Read(); + while (reader.Name.Equals("talent")) + { + this.Talente.Add( + new Talent( + reader.GetAttribute("name"), + reader.GetAttribute("probe")?.Remove(0, 2).Trim(')'), + Convert.ToInt32(reader.GetAttribute("value")))); + reader.Read(); + } + + break; + case "zauberliste": + reader.Read(); + while (reader.Name.Equals("zauber")) + { + this.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")); + this.Kampftalente.Add(new KampfTalent(atName, at, pa)); + break; + } + } + } + } +} diff --git a/DiscoBot/Characters/ICharacter.cs b/DiscoBot/Characters/ICharacter.cs new file mode 100644 index 0000000..135243a --- /dev/null +++ b/DiscoBot/Characters/ICharacter.cs @@ -0,0 +1,17 @@ +namespace DiscoBot.Characters +{ + public interface ICharacter + { + string Name { get; set; } + + string TestTalent(string talent, int erschwernis = 0); + + string TestEigenschaft(string eigenschaft, int erschwernis = 0); + + string Angriff(string talent, int erschwernis = 0); + + string Parade(string talent, int erschwernis = 0); + + string Fernkampf(string talent, int erschwernis = 0); + } +} diff --git a/DiscoBot/Characters/NPC.cs b/DiscoBot/Characters/NPC.cs new file mode 100644 index 0000000..470d5ff --- /dev/null +++ b/DiscoBot/Characters/NPC.cs @@ -0,0 +1,106 @@ +namespace DiscoBot.Characters +{ + using System; + + using DiscoBot.Auxiliary; + + public class Npc : ICharacter + { + private readonly int mean, stDv; + + public Npc(string name, int mean, int stDv) + { + this.mean = mean; + this.stDv = stDv; + this.Name = name; + } + + public string Name { get; set; } + + public string TestTalent(string talent, int tap = 3) + { + for (int i = 0; i <= 2; i++) + { + // foreach property, dice and tap + int temp = Dice.Roll(); + int eigenschaft = (int)Math.Round(Misc.Random(this.stDv, this.mean)); + + if (eigenschaft < temp) + { + tap -= temp - eigenschaft; + } + } + + if (tap >= 0) + { + return $"{this.Name} vollführt {talent} erfolgreich"; + } + + return $"{this.Name} scheitert an {talent}"; + } + + public string TestEigenschaft(string eigenschaft, int erschwernis = 0) + { + int temp = Dice.Roll(); + int prop = (int)Math.Round(Misc.Random(this.stDv, this.stDv)); + + if (temp + erschwernis < prop) + { + return $"{this.Name} vollführt {eigenschaft} erfolgreich"; + } + + return $"{this.Name} scheitert an {eigenschaft}"; + } + + public string Angriff(string waffe, int erschwernis = 0) + { + int temp = Dice.Roll(); + + if (temp == 1) + { + return $"{this.Name} greift kritisch mit {waffe} an"; + } + + if (temp < erschwernis) + { + return $"{this.Name} greift mit {waffe} an"; + } + + return $"{this.Name} haut mit {waffe} daneben"; + } + + public string Parade(string waffe, int erschwernis = 0) + { + int temp = Dice.Roll(); + + if (temp == 1) + { + return $"{this.Name} pariert mit {waffe} meisterlich"; + } + + if (temp < erschwernis) + { + return $"{this.Name} pariert mit {waffe} an"; + } + + return $"{this.Name} schafft es nicht mit {waffe} zu parieren"; + } + + public string Fernkampf(string waffe, int erschwernis = 0) + { + int temp = Dice.Roll(); + + if (temp == 1) + { + return $"{this.Name} trifft kritisch mit {waffe}"; + } + + if (temp < erschwernis) + { + return $"{this.Name} greift mit {waffe} an"; + } + + return $"{this.Name} schießt mit {waffe} daneben"; + } + } +} diff --git a/DiscoBot/Commands.cs b/DiscoBot/Commands.cs deleted file mode 100644 index 6984761..0000000 --- a/DiscoBot/Commands.cs +++ /dev/null @@ -1,64 +0,0 @@ -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 - { - 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) - { - // ReplyAsync is a method on ModuleBase - - await ReplyAsync("```xl\n" + test.TestTalent(talent) + "\n```"); - - } - } - - [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/Commands/CommandTypes.cs b/DiscoBot/Commands/CommandTypes.cs new file mode 100644 index 0000000..4ff0814 --- /dev/null +++ b/DiscoBot/Commands/CommandTypes.cs @@ -0,0 +1,12 @@ +namespace DiscoBot.Commands +{ + public enum CommandTypes + { + Talent, + Eigenschaft, + Angriff, + Parade, + Fernkampf, + KeinChar + } +} diff --git a/DiscoBot/Commands/FileHandler.cs b/DiscoBot/Commands/FileHandler.cs new file mode 100644 index 0000000..efebe3f --- /dev/null +++ b/DiscoBot/Commands/FileHandler.cs @@ -0,0 +1,43 @@ +namespace DiscoBot.Commands +{ + using System; + using System.Linq; + using System.Net; + + using DiscoBot.Auxiliary; + using DiscoBot.Characters; + + using Discord.Commands; + + public class FileHandler : ModuleBase + { + [Command("add"), Summary("fügt Helden hinzu")] + public void AddChar() + { + var msg = this.Context.Message; + if (msg.Attachments == null) + { + throw new ArgumentException("Es wurde keine Datei angehängt"); + } + + var attachments = msg.Attachments.ToList(); + + if (!attachments.Any(x => x.Filename.EndsWith(".xml"))) + { + throw new ArgumentException("Es wurde kein xml Held mitgeschickt"); + } + + foreach (var attachment in attachments.Where(x => x.Filename.EndsWith(".xml"))) + { + using (var client = new WebClient()) + { + client.DownloadFile(attachment.Url, "helden\\" + attachment.Filename); + } + + Dsa.Chars.Add(new Character("helden\\" + attachment.Filename)); + (Dsa.Chars.Last() as Character)?.Talente.Select(x => new Talent(x.Name, x.Probe, 0)) + .Where(c => !Dsa.Talente.Exists(v => v.Name.Equals(c.Name))).ToList().ForEach(v => Dsa.Talente.Add(v)); + } + } + } +} diff --git a/DiscoBot/Commands/Gm.cs b/DiscoBot/Commands/Gm.cs new file mode 100644 index 0000000..60b82fb --- /dev/null +++ b/DiscoBot/Commands/Gm.cs @@ -0,0 +1,103 @@ +namespace DiscoBot.Commands +{ + using System.Linq; + using System.Threading.Tasks; + + using DiscoBot.Auxiliary; + + using Discord.Commands; + using Discord.WebSocket; + + public class Gm : ModuleBase + { + public static string CheckCommand(string name, CommandTypes command, string waffe, int erschwernis = 0) + { + var comp = new SpellCorrect(); + var chr = Dsa.Chars.OrderBy(x => comp.Compare(x.Name, name)).First(); + 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); + } + + return $"{name} verwendet {waffe}"; + } + + [Command("gm"), Summary("Führt eine probe aus")] + [Alias("GM", "as", "As", "als")] + public async Task ProbeAsync([Summary("Fernkampfwaffe")] string name, string command, string waffe, int erschwernis = 0) + { + if (!((SocketGuildUser)this.Context.User).Roles.ToList().Exists(v => v.Name.Equals("Meister"))) + { + await this.ReplyAsync("```xl\n Keine ausreichenden Berechtigunen\n```"); + return; + } + + command = command.ToLower(); + string res = this.Test(name, command, waffe, erschwernis); + + if (Dsa.GeneralContext != null && Dsa.GeneralContext.Channel.Id != this.Context.Channel.Id) + { + await Dsa.GeneralContext.Channel.SendMessageAsync("```xl\n" + res + "\n```"); + } + + await this.ReplyAsync("```xl\n" + res + "\n```"); + } + + private string Test(string name, string command, string waffe, int erschwernis = 0) + { + string res; + switch (command) + { + 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; + default: + res = $"Kommando {command} nicht gefunden"; + break; + } + + return res; + } + } +} diff --git a/DiscoBot/Commands/List.cs b/DiscoBot/Commands/List.cs new file mode 100644 index 0000000..9eac3a1 --- /dev/null +++ b/DiscoBot/Commands/List.cs @@ -0,0 +1,76 @@ +namespace DiscoBot.Commands +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Text; + using System.Threading.Tasks; + + using DiscoBot.Auxiliary; + using DiscoBot.Characters; + + using Discord.Commands; + + public class List : ModuleBase + { + [Command("list"), Summary("gibt eine Auflistung aus")] + public async Task ListAsync([Summary("Aktion")] string prop) + { + var res = new List<string>(); + switch (prop.ToLower()) + { + case "chars": + case "Chars": + res.AddRange(Dsa.Chars.Select(x => x.Name)); + break; + case "t": + case "ta": + case "talent": + case "zauber": + res.AddRange( + ((Character)Dsa.Chars.Find(x => x.Name.Equals(Dsa.Relation[this.Context.User.Username]))) + .Talente.Select(s => s.Name + "\t " + s.Value + "\t " + s.Probe)); + break; + case "w": + case "waffe": + case "waffen": + res.AddRange( + ((Character)Dsa.Chars.Find(x => x.Name.Equals(Dsa.Relation[this.Context.User.Username]))) + .Kampftalente.Select(s => s.Name)); + break; + case "fern": + res.AddRange( + ((Character)Dsa.Chars.Find(x => x.Name.Equals(Dsa.Relation[this.Context.User.Username]))) + .Talente.Select(s => s.Name)); + break; + case "v": + case "vt": + case "vor": + case "vorteil": + res.AddRange( + ((Character)Dsa.Chars.Find(x => x.Name.Equals(Dsa.Relation[this.Context.User.Username]))) + .Vorteile + .Select(s => s.Name + "\t " + (s.Value == 0 ? string.Empty : s.Value.ToString()))); + break; + + default: + res.Add($"Kommando {prop} nicht gefunden"); + break; + } + + var sb = new StringBuilder(); + foreach (string re in res) + { + if (sb.Length + re.Length > 1798) + { + await this.ReplyTimedAsync(sb.ToString(), TimeSpan.FromSeconds(90)); + sb.Clear(); + } + + sb.AppendLine(re); + } + + await this.ReplyTimedAsync(sb.ToString(), TimeSpan.FromSeconds(90)); + } + } +} diff --git a/DiscoBot/Commands/NpcCommands.cs b/DiscoBot/Commands/NpcCommands.cs new file mode 100644 index 0000000..f2b17b6 --- /dev/null +++ b/DiscoBot/Commands/NpcCommands.cs @@ -0,0 +1,37 @@ +namespace DiscoBot.Commands +{ + using System; + using System.Linq; + using System.Threading.Tasks; + + using DiscoBot.Auxiliary; + using DiscoBot.Characters; + + using Discord.Commands; + + public class NpcCommands : ModuleBase + { + [Command("npc"), Summary("Erstellt ein NPC")] + [Alias("Npc", "NPc", "NPC", "nPC")] + public Task RandomAsync([Summary("Create Random")] string npcName, int mean = 9, int stDv = 1) + { + Dsa.Chars.Add(new Npc(npcName, mean, stDv)); + return this.ReplyAsync($"{npcName} wurde zufällig generiert"); + } + + [Command("npc"), Summary("Erstellt ein NPC")] + [Alias("Npc", "NPc", "NPC", "nPC")] + public Task CopyAsync([Summary("Create Copy")] string npcName, string source, int stDv = 1) + { + if (Dsa.Chars.Exists(x => x.Name.Equals(npcName))) + { + throw new Exception("Char gibt es schon"); + } + + var comp = new SpellCorrect(); + var chr = Dsa.Chars.OrderBy(x => comp.Compare(x.Name, source)).First(); + Dsa.Chars.Add(new Character(chr as Character, npcName, stDv)); + return this.ReplyAsync($"{npcName} wurde als variierte Kopie von {source} erstellt"); + } + } +} diff --git a/DiscoBot/Commands/Test.cs b/DiscoBot/Commands/Test.cs new file mode 100644 index 0000000..d56a43c --- /dev/null +++ b/DiscoBot/Commands/Test.cs @@ -0,0 +1,47 @@ +namespace DiscoBot.Commands +{ + using System.Threading.Tasks; + + using Discord.Commands; + + public class Test : ModuleBase + { + [Command("t"), Summary("Würfelt ein Talent-/Zauberprobe")] + [Alias("T", "Talent", "talent", "zauber", "z", "versuche")] + public Task TalentAsync([Summary("Talent oder Zaubername")] string talent, int erschwernis = 0) + { + string res = Gm.CheckCommand(Dsa.Relation[this.Context.User.Username], CommandTypes.Talent, talent, erschwernis); + return this.ReplyAsync("```xl\n" + res + "\n```"); + } + + [Command("e"), Summary("Würfelt eine Eigenschaftsprobe")] + [Alias("E", "Eigenschaft", "eigenschaft", "eigen")] + public Task EigenschaftAsync([Summary("Eigenschaftskürzel und Erschwernis")] string talent, int erschwernis = 0) + { + var chr = Dsa.Chars.Find(x => x.Name.Equals(Dsa.Relation[this.Context.User.Username])); + string res = chr.TestEigenschaft(talent, erschwernis); + return this.ReplyAsync("```xl\n" + res + "\n```"); + } + + [Command("a"), Summary("Würfelt ein Angriff")] + [Alias("At", "at", "Angriff", "angriff", "attackiere_mit", "attacke", "Attacke")] + public Task AngriffAsync([Summary("Weapon")] string weapon, int erschwernis = 0) + { + return this.ReplyAsync("```xl\n" + Dsa.Chars.Find(x => x.Name.Equals(Dsa.Relation[this.Context.User.Username])).Angriff(weapon, erschwernis) + "\n```"); + } + + [Command("p"), Summary("Würfelt eine Parade Probe")] + [Alias("P", "Parade", "parade", "pariere_mit")] + public Task ParadeAsync([Summary("Parade Weapon")] string talent, int erschwernis = 0) + { + return this.ReplyAsync("```xl\n" + Dsa.Chars.Find(x => x.Name.Equals(Dsa.Relation[this.Context.User.Username])).Parade(talent, erschwernis) + "\n```"); + } + + [Command("f"), Summary("Führt eine Fernkampfprobe aus")] + [Alias("F", "fernkampf", "Fernkampf", "schieße", "schieße_mit")] + public Task FernkampfAsync([Summary("Fernkampfwaffe")] string waffe, int erschwernis = 0) + { + return this.ReplyAsync("```xl\n" + Dsa.Chars.Find(x => x.Name.Equals(Dsa.Relation[this.Context.User.Username])).Fernkampf(waffe, erschwernis) + "\n```"); + } + } +} diff --git a/DiscoBot/Commands/Utility.cs b/DiscoBot/Commands/Utility.cs new file mode 100644 index 0000000..bbba1a1 --- /dev/null +++ b/DiscoBot/Commands/Utility.cs @@ -0,0 +1,32 @@ +namespace DiscoBot.Commands +{ + using System.Threading.Tasks; + + using DiscoBot.Auxiliary; + + using Discord.Commands; + + public class Utility : 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```"); + } + + [Command("general"), Summary("Set General ")] + public Task SetGeneralAsync([Remainder, Summary("Set General")] int i = 0) + { + Dsa.GeneralContext = this.Context; + return this.Context.Channel.SendMessageAsync($"```xl\n Der Dachs hat in '{this.Context.Channel.Name}' ein Zuhause gefunden. Gm Nachrichten werden nun auch in diesem Channel gepostet. \n```"); + } + + [Command("say"), Summary("Echos a message.")] + [Alias("s")] + public Task SayAsync([Remainder, Summary("The text to echo")] string echo) + { + return this.ReplyAsync(echo); + } + } +} diff --git a/DiscoBot/Commands/Voice.cs b/DiscoBot/Commands/Voice.cs new file mode 100644 index 0000000..02210e8 --- /dev/null +++ b/DiscoBot/Commands/Voice.cs @@ -0,0 +1,67 @@ +namespace DiscoBot.Commands +{ + using System.Diagnostics; + using System.Threading.Tasks; + + using Discord; + using Discord.Audio; + using Discord.Commands; + + public class Voice : ModuleBase + { + public static IAudioClient Client { get; set; } + [Command("join", RunMode = RunMode.Async)] + public async Task JoinChannelAsync(IVoiceChannel channel = null) + { + var msg = this.Context.Message; + + // Get the audio channel + channel = channel ?? (msg.Author as IGuildUser)?.VoiceChannel; + if (channel == null) + { + await msg.Channel.SendMessageAsync( + "User must be in a voice channel, or a voice channel must be passed as an argument."); + return; + } + + // For the next step with transmitting audio, you would want to pass this Audio Client in to a service. + var audioClient = await channel.ConnectAsync(); + Client = audioClient; + } + + [Command("leave", RunMode = RunMode.Async)] + public Task LeaveChannelAsync(IVoiceChannel channel = null) + { + // For the next step with transmitting audio, you would want to pass this Audio Client in to a service. + return Client.StopAsync(); + } + + [Command("play")] + public Task PlayAudioAsync(string path) + { + return SendAsync(path); + } + + private static Process CreateStream(string path) + { + var ffmpeg = new ProcessStartInfo + { + FileName = "ffmpeg", + Arguments = $"-i {path} -ac 2 -f s16le -ar 48000 -ab 620000 pipe:1", + UseShellExecute = false, + RedirectStandardOutput = true, + }; + return Process.Start(ffmpeg); + } + + private static async Task SendAsync(string path) + { + // Create FFmpeg using the previous example + var ffmpeg = CreateStream(path); + var output = ffmpeg.StandardOutput.BaseStream; + var discord = Client.CreatePCMStream(AudioApplication.Music); + await output.CopyToAsync(discord); + await discord.FlushAsync(); + } + } +} diff --git a/DiscoBot/DSA.cs b/DiscoBot/DSA.cs new file mode 100644 index 0000000..d9cefb2 --- /dev/null +++ b/DiscoBot/DSA.cs @@ -0,0 +1,45 @@ +namespace DiscoBot +{ + using System.Collections.Generic; + using System.IO; + using System.Linq; + + using DiscoBot.Auxiliary; + using DiscoBot.Characters; + + using Discord.Commands; + + public static class Dsa + { + public static ICommandContext GeneralContext { get; set; } + + public static Dictionary<string, string> Relation { get; set; } = new Dictionary<string, string>(); // dictionary to match the char + + public static List<ICharacter> Chars { get; set; } = new List<ICharacter>(); // list of all characters + + public static List<Talent> Talente { get; set; } = new List<Talent>(); + + public static void Startup() + { + Relation.Add("The Doctor", "Numeri Illuminus"); // Relation + Relation.Add("Tardis", "Morla"); // "Numeri Illuminus"); + Relation.Add("DSA Bot", "Morla"); // "Felis Exodus Schattenwald"); + Relation.Add("Morla", "Morla"); + Relation.Add("Rhoktar", "Rhoktar4"); + + // relation.Add("Papo","Gwendelson"); + Relation.Add("Papo", "Pump aus der Gosse"); + Relation.Add("Potus", "Potus"); + + // relation.Add("Papo", "Pump aus der Gosse"); + foreach (var filename in Directory.GetFiles("helden", "*.xml")) + { + Chars.Add(new Character(filename)); + (Chars.Last() as Character)?.Talente.Select(x => new Talent(x.Name, x.Probe, 0)) + .Where(c => !Talente.Exists(v => v.Name.Equals(c.Name))).ToList().ForEach(v => Talente.Add(v)); + } + + Talente = Talente.OrderBy(x => x.Name).ToList(); + } + } +}
\ No newline at end of file diff --git a/DiscoBot/DiscoBot.csproj b/DiscoBot/DiscoBot.csproj index 9920f40..3955ef6 100644 --- a/DiscoBot/DiscoBot.csproj +++ b/DiscoBot/DiscoBot.csproj @@ -12,6 +12,8 @@ <FileAlignment>512</FileAlignment> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <TargetFrameworkProfile /> + <NuGetPackageImportStamp> + </NuGetPackageImportStamp> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PlatformTarget>AnyCPU</PlatformTarget> @@ -33,51 +35,53 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> - <Reference Include="Discord.Net.Commands, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL"> - <HintPath>..\packages\Discord.Net.Commands.1.0.1\lib\netstandard1.1\Discord.Net.Commands.dll</HintPath> + <Reference Include="Discord.Net.Commands, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Discord.Net.Commands.1.0.2\lib\netstandard1.1\Discord.Net.Commands.dll</HintPath> </Reference> - <Reference Include="Discord.Net.Core, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL"> - <HintPath>..\packages\Discord.Net.Core.1.0.1\lib\net45\Discord.Net.Core.dll</HintPath> + <Reference Include="Discord.Net.Core, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Discord.Net.Core.1.0.2\lib\net45\Discord.Net.Core.dll</HintPath> </Reference> - <Reference Include="Discord.Net.Rest, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL"> - <HintPath>..\packages\Discord.Net.Rest.1.0.1\lib\net45\Discord.Net.Rest.dll</HintPath> + <Reference Include="Discord.Net.Rest, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Discord.Net.Rest.1.0.2\lib\net45\Discord.Net.Rest.dll</HintPath> </Reference> - <Reference Include="Discord.Net.Rpc, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL"> - <HintPath>..\packages\Discord.Net.Rpc.1.0.1\lib\net45\Discord.Net.Rpc.dll</HintPath> + <Reference Include="Discord.Net.Rpc, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Discord.Net.Rpc.1.0.2\lib\net45\Discord.Net.Rpc.dll</HintPath> </Reference> - <Reference Include="Discord.Net.Webhook, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL"> - <HintPath>..\packages\Discord.Net.Webhook.1.0.1\lib\netstandard1.1\Discord.Net.Webhook.dll</HintPath> + <Reference Include="Discord.Net.Webhook, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Discord.Net.Webhook.1.0.2\lib\netstandard1.1\Discord.Net.Webhook.dll</HintPath> </Reference> - <Reference Include="Discord.Net.WebSocket, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL"> - <HintPath>..\packages\Discord.Net.WebSocket.1.0.1\lib\net45\Discord.Net.WebSocket.dll</HintPath> + <Reference Include="Discord.Net.WebSocket, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Discord.Net.WebSocket.1.0.2\lib\net45\Discord.Net.WebSocket.dll</HintPath> </Reference> - <Reference Include="Microsoft.Extensions.DependencyInjection, Version=1.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> - <HintPath>..\packages\Microsoft.Extensions.DependencyInjection.1.1.1\lib\netstandard1.1\Microsoft.Extensions.DependencyInjection.dll</HintPath> + <Reference Include="Microsoft.Extensions.DependencyInjection, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.Extensions.DependencyInjection.2.0.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.dll</HintPath> </Reference> - <Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> - <HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.1.1.1\lib\netstandard1.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath> + <Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.2.0.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath> </Reference> <Reference Include="Microsoft.Win32.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll</HintPath> </Reference> <Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> - <HintPath>..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> + <HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> + </Reference> + <Reference Include="Sodium, Version=0.10.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\libsodium-net.0.10.0\lib\Net40\Sodium.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.AppContext, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll</HintPath> </Reference> - <Reference Include="System.Collections.Immutable, Version=1.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> - <HintPath>..\packages\System.Collections.Immutable.1.3.1\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath> - <Private>True</Private> + <Reference Include="System.Collections.Immutable, Version=1.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Collections.Immutable.1.4.0\lib\netstandard2.0\System.Collections.Immutable.dll</HintPath> </Reference> <Reference Include="System.ComponentModel.Composition" /> <Reference Include="System.Console, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>..\packages\System.Console.4.3.0\lib\net46\System.Console.dll</HintPath> </Reference> <Reference Include="System.Core" /> - <Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> - <HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.3.0\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath> + <Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.2.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.4.1\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath> </Reference> <Reference Include="System.Globalization.Calendars, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>..\packages\System.Globalization.Calendars.4.3.0\lib\net46\System.Globalization.Calendars.dll</HintPath> @@ -98,8 +102,9 @@ <Reference Include="System.IO.FileSystem.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath> </Reference> - <Reference Include="System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> - <HintPath>..\packages\System.Net.Http.4.3.0\lib\net46\System.Net.Http.dll</HintPath> + <Reference Include="System.Net.Http, Version=4.1.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Net.Http.4.3.3\lib\net46\System.Net.Http.dll</HintPath> + <Private>True</Private> </Reference> <Reference Include="System.Net.Sockets, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>..\packages\System.Net.Sockets.4.3.0\lib\net46\System.Net.Sockets.dll</HintPath> @@ -109,7 +114,9 @@ <HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath> </Reference> <Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> - <HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath> + <Private>True</Private> </Reference> <Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath> @@ -117,8 +124,9 @@ <Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath> </Reference> - <Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> - <HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath> + <Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.2\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath> + <Private>True</Private> </Reference> <Reference Include="System.Xml.Linq" /> <Reference Include="System.Data.DataSetExtensions" /> @@ -126,18 +134,55 @@ <Reference Include="System.Data" /> <Reference Include="System.Xml" /> <Reference Include="System.Xml.ReaderWriter, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> - <HintPath>..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll</HintPath> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\packages\System.Xml.ReaderWriter.4.3.1\lib\net46\System.Xml.ReaderWriter.dll</HintPath> + <Private>True</Private> </Reference> </ItemGroup> <ItemGroup> - <Compile Include="Char.cs" /> - <Compile Include="Commands.cs" /> + <Compile Include="Auxiliary\Dice.cs" /> + <Compile Include="Auxiliary\KampfTalent.cs" /> + <Compile Include="Auxiliary\SpellCorrect.cs" /> + <Compile Include="Auxiliary\Talent.cs" /> + <Compile Include="Auxiliary\Vorteil.cs" /> + <Compile Include="Characters\Character.cs" /> + <Compile Include="Auxiliary\CommandExtension.cs" /> + <Compile Include="Commands\CommandTypes.cs" /> + <Compile Include="Commands\FileHandler.cs" /> + <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="Characters\ICharacter.cs" /> + <Compile Include="Auxiliary\Misc.cs" /> + <Compile Include="Characters\NPC.cs" /> + <Compile Include="Dsa.cs" /> <Compile Include="Program.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + <DependentUpon>Settings.settings</DependentUpon> + </Compile> </ItemGroup> <ItemGroup> <None Include="App.config" /> <None Include="packages.config" /> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <Import Project="..\packages\Baseclass.Contrib.Nuget.Output.2.4.1\build\net40\Baseclass.Contrib.Nuget.Output.targets" Condition="Exists('..\packages\Baseclass.Contrib.Nuget.Output.2.4.1\build\net40\Baseclass.Contrib.Nuget.Output.targets')" /> + <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> + <PropertyGroup> + <ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText> + </PropertyGroup> + <Error Condition="!Exists('..\packages\Baseclass.Contrib.Nuget.Output.2.4.1\build\net40\Baseclass.Contrib.Nuget.Output.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Baseclass.Contrib.Nuget.Output.2.4.1\build\net40\Baseclass.Contrib.Nuget.Output.targets'))" /> + <Error Condition="!Exists('..\packages\NETStandard.Library.2.0.1\build\netstandard2.0\NETStandard.Library.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NETStandard.Library.2.0.1\build\netstandard2.0\NETStandard.Library.targets'))" /> + </Target> + <Import Project="..\packages\NETStandard.Library.2.0.1\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('..\packages\NETStandard.Library.2.0.1\build\netstandard2.0\NETStandard.Library.targets')" /> </Project>
\ No newline at end of file diff --git a/DiscoBot/Program.cs b/DiscoBot/Program.cs index 962e416..6bf870e 100644 --- a/DiscoBot/Program.cs +++ b/DiscoBot/Program.cs @@ -1,71 +1,87 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Reflection; +using System.Threading.Tasks; + using Discord; -using Discord.WebSocket; using Discord.Commands; -using Microsoft.Extensions.DependencyInjection; +using Discord.WebSocket; +using Microsoft.Extensions.DependencyInjection; namespace DiscoBot { + using DiscoBot.Commands; + public class Program { 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 static void Main(string[] args) => new Program().StartAsync().GetAwaiter().GetResult(); - public async Task Start() + public async Task StartAsync() { - client = new DiscordSocketClient(); - commands = new CommandService(); + Dsa.Startup(); + this.client = new DiscordSocketClient(); + this.commands = new CommandService(); - string token = "Mjk0NTU0MDU4Nzg4NzAwMTYx.C7XGwQ.VwCAM10lDmwUe01NhBvDKNbd17I"; + string token = Properties.Settings.Default.Token; - services = new ServiceCollection() + this.services = new ServiceCollection() .BuildServiceProvider(); + AppDomain.CurrentDomain.ProcessExit += OnProcessExit; - await InstallCommands(); - - await client.LoginAsync(TokenType.Bot, token); - await client.StartAsync(); + await this.InstallCommandsAsync(); + await this.client.LoginAsync(TokenType.Bot, token); + await this.client.StartAsync(); + await Task.Delay(-1); } - public async Task InstallCommands() + public Task InstallCommandsAsync() { // Hook the MessageReceived Event into our Command Handler - client.MessageReceived += HandleCommand; + this.client.MessageReceived += this.HandleCommandAsync; + // Discover all of the commands in this assembly and load them. - await commands.AddModulesAsync(Assembly.GetEntryAssembly()); + return this.commands.AddModulesAsync(Assembly.GetEntryAssembly()); } - public async Task HandleCommand(SocketMessage messageParam) + public async Task HandleCommandAsync(SocketMessage messageParam) { // Don't process the command if it was a System Message - var message = messageParam as SocketUserMessage; - if (message == null) return; + if (!(messageParam is SocketUserMessage message)) + { + 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; + if (!(message.HasCharPrefix('!', ref argPos) || message.HasMentionPrefix(this.client.CurrentUser, ref argPos))) + { + return; + } + // Create a Command Context - var context = new CommandContext(client, message); + var context = new CommandContext(this.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); + var result = await this.commands.ExecuteAsync(context, argPos, this.services); if (!result.IsSuccess) + { await context.Channel.SendMessageAsync(result.ErrorReason); + } } - } + private static void OnProcessExit(object sender, EventArgs e) + { + Console.WriteLine("I'm out of here"); + Voice.Client.StopAsync(); + } + } } diff --git a/DiscoBot/Properties/Settings.Designer.cs b/DiscoBot/Properties/Settings.Designer.cs new file mode 100644 index 0000000..9813b8a --- /dev/null +++ b/DiscoBot/Properties/Settings.Designer.cs @@ -0,0 +1,38 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// 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. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace DiscoBot.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.6.0.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("Mjk0NTU0MDU4Nzg4NzAwMTYx.DOzDcQ.J-nCikbZdZtdrug0E8TwwV_2ITw")] + public string Token { + get { + return ((string)(this["Token"])); + } + set { + this["Token"] = value; + } + } + } +} diff --git a/DiscoBot/Properties/Settings.settings b/DiscoBot/Properties/Settings.settings new file mode 100644 index 0000000..f3be2b7 --- /dev/null +++ b/DiscoBot/Properties/Settings.settings @@ -0,0 +1,9 @@ +<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="DiscoBot.Properties" GeneratedClassName="Settings"> + <Profiles /> + <Settings> + <Setting Name="Token" Type="System.String" Scope="User"> + <Value Profile="(Default)">Mjk0NTU0MDU4Nzg4NzAwMTYx.DOzDcQ.J-nCikbZdZtdrug0E8TwwV_2ITw</Value> + </Setting> + </Settings> +</SettingsFile>
\ No newline at end of file diff --git a/DiscoBot/packages.config b/DiscoBot/packages.config index cf276c0..e3bca0f 100644 --- a/DiscoBot/packages.config +++ b/DiscoBot/packages.config @@ -1,26 +1,28 @@ <?xml version="1.0" encoding="utf-8"?> <packages> - <package id="Discord.Net" version="1.0.1" targetFramework="net461" /> - <package id="Discord.Net.Commands" version="1.0.1" targetFramework="net461" /> - <package id="Discord.Net.Core" version="1.0.1" targetFramework="net461" /> - <package id="Discord.Net.Rest" version="1.0.1" targetFramework="net461" /> - <package id="Discord.Net.Rpc" version="1.0.1" targetFramework="net461" /> - <package id="Discord.Net.Webhook" version="1.0.1" targetFramework="net461" /> - <package id="Discord.Net.WebSocket" version="1.0.1" targetFramework="net461" /> - <package id="Microsoft.Extensions.DependencyInjection" version="1.1.1" targetFramework="net461" /> - <package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="1.1.1" targetFramework="net461" /> - <package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net461" /> + <package id="Baseclass.Contrib.Nuget.Output" version="2.4.1" targetFramework="net461" /> + <package id="Discord.Net" version="1.0.2" targetFramework="net461" /> + <package id="Discord.Net.Commands" version="1.0.2" targetFramework="net461" /> + <package id="Discord.Net.Core" version="1.0.2" targetFramework="net461" /> + <package id="Discord.Net.Rest" version="1.0.2" targetFramework="net461" /> + <package id="Discord.Net.Rpc" version="1.0.2" targetFramework="net461" /> + <package id="Discord.Net.Webhook" version="1.0.2" targetFramework="net461" /> + <package id="Discord.Net.WebSocket" version="1.0.2" targetFramework="net461" /> + <package id="libsodium-net" version="0.10.0" targetFramework="net461" /> + <package id="Microsoft.Extensions.DependencyInjection" version="2.0.0" targetFramework="net461" /> + <package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="2.0.0" targetFramework="net461" /> + <package id="Microsoft.NETCore.Platforms" version="2.0.1" targetFramework="net461" /> <package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net461" /> - <package id="NETStandard.Library" version="1.6.1" targetFramework="net461" /> - <package id="Newtonsoft.Json" version="10.0.2" targetFramework="net461" /> + <package id="NETStandard.Library" version="2.0.1" targetFramework="net461" /> + <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net461" /> <package id="System.AppContext" version="4.3.0" targetFramework="net461" /> <package id="System.Collections" version="4.3.0" targetFramework="net461" /> <package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net461" /> - <package id="System.Collections.Immutable" version="1.3.1" targetFramework="net461" /> + <package id="System.Collections.Immutable" version="1.4.0" targetFramework="net461" /> <package id="System.ComponentModel" version="4.3.0" targetFramework="net461" /> <package id="System.Console" version="4.3.0" targetFramework="net461" /> <package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net461" /> - <package id="System.Diagnostics.DiagnosticSource" version="4.3.0" targetFramework="net461" /> + <package id="System.Diagnostics.DiagnosticSource" version="4.4.1" targetFramework="net461" /> <package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net461" /> <package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net461" /> <package id="System.Globalization" version="4.3.0" targetFramework="net461" /> @@ -33,7 +35,7 @@ <package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net461" /> <package id="System.Linq" version="4.3.0" targetFramework="net461" /> <package id="System.Linq.Expressions" version="4.3.0" targetFramework="net461" /> - <package id="System.Net.Http" version="4.3.0" targetFramework="net461" /> + <package id="System.Net.Http" version="4.3.3" targetFramework="net461" /> <package id="System.Net.Primitives" version="4.3.0" targetFramework="net461" /> <package id="System.Net.Sockets" version="4.3.0" targetFramework="net461" /> <package id="System.ObjectModel" version="4.3.0" targetFramework="net461" /> @@ -47,16 +49,16 @@ <package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net461" /> <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net461" /> <package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net461" /> - <package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net461" /> + <package id="System.Security.Cryptography.Algorithms" version="4.3.1" targetFramework="net461" /> <package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" /> <package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" /> - <package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net461" /> + <package id="System.Security.Cryptography.X509Certificates" version="4.3.2" targetFramework="net461" /> <package id="System.Text.Encoding" version="4.3.0" targetFramework="net461" /> <package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net461" /> <package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net461" /> <package id="System.Threading" version="4.3.0" targetFramework="net461" /> <package id="System.Threading.Tasks" version="4.3.0" targetFramework="net461" /> <package id="System.Threading.Timer" version="4.3.0" targetFramework="net461" /> - <package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net461" /> + <package id="System.Xml.ReaderWriter" version="4.3.1" targetFramework="net461" /> <package id="System.Xml.XDocument" version="4.3.0" targetFramework="net461" /> </packages>
\ No newline at end of file |