summaryrefslogtreecommitdiff
path: root/DSACore
diff options
context:
space:
mode:
authorTrueDoctor <d-kobert@web.de>2018-09-27 23:46:43 +0200
committerTrueDoctor <d-kobert@web.de>2018-09-27 23:46:43 +0200
commitad0a46175e7efbbd5bdf952aacc69d8a7750b05a (patch)
tree4dc970234a3273940c59aecdb305bbca2b2e9ab3 /DSACore
parent39da0da55a09a56bae3c250e6108c8edf77bfbfd (diff)
implemented rudemetary groups
Diffstat (limited to 'DSACore')
-rw-r--r--DSACore/DSA_Game/Dsa.cs4
-rw-r--r--DSACore/DSA_Game/Save/Session.cs2
-rw-r--r--DSACore/Hubs/ChatHub.cs31
-rw-r--r--DSACore/Properties/launchSettings.json2
-rw-r--r--DSACore/PropertiesDSACore-Audio-Sound.json7
-rw-r--r--DSACore/PropertiesDSACore-Auxiliary-CommandInfo.json101
-rw-r--r--DSACore/PropertiesDSACore-DSA_Game-Characters-Character.json290
-rw-r--r--DSACore/PropertiesNewtonsoft-Json-Linq-JProperty.json30
-rw-r--r--DSACore/Startup.cs21
9 files changed, 480 insertions, 8 deletions
diff --git a/DSACore/DSA_Game/Dsa.cs b/DSACore/DSA_Game/Dsa.cs
index 7258e8c..94de194 100644
--- a/DSACore/DSA_Game/Dsa.cs
+++ b/DSACore/DSA_Game/Dsa.cs
@@ -13,7 +13,7 @@ namespace DSACore.DSA_Game
public static class Dsa
{
- public const string rootPath = "DiscoBot\\DSACore\\";
+ public const string rootPath = "";//"DiscoBot\\DSACore\\";
private static Session s_session;
@@ -46,7 +46,7 @@ namespace DSACore.DSA_Game
//new .Auxiliary.Calculator.StringSolver("1d100 - (1d200 + 1) * -50000").Solve();
/*Session = new Session();*/
// relation.Add("Papo", "Pump aus der Gosse");
- foreach (var filename in Directory.GetFiles("helden", "*.xml"))
+ foreach (var filename in Directory.GetFiles(rootPath + "helden", "*.xml"))
{
Chars.Add(new Character(filename));
(Chars.Last() as Character)?.Talente.Select(x => new Talent(x.Name, x.Probe, 0))
diff --git a/DSACore/DSA_Game/Save/Session.cs b/DSACore/DSA_Game/Save/Session.cs
index d343920..b402656 100644
--- a/DSACore/DSA_Game/Save/Session.cs
+++ b/DSACore/DSA_Game/Save/Session.cs
@@ -9,7 +9,7 @@ namespace DSACore.DSA_Game.Save
public class Session
{
- public static string DirectoryPath { get; set; } = @"sessions";
+ public static string DirectoryPath { get; set; } = Dsa.rootPath + @"sessions";
public Dictionary<string, string> Relation { get; set; } = new Dictionary<string, string>(); // dictionary to match the char
diff --git a/DSACore/Hubs/ChatHub.cs b/DSACore/Hubs/ChatHub.cs
index 6af8c38..9cd7aed 100644
--- a/DSACore/Hubs/ChatHub.cs
+++ b/DSACore/Hubs/ChatHub.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using DSACore.Models;
using Microsoft.AspNetCore.SignalR;
namespace DSACore.Hubs
@@ -10,7 +11,35 @@ namespace DSACore.Hubs
{
public async Task SendMessage(string user, string message)
{
- await Clients.All.SendAsync("ReciveMessage", user, message);
+ string group = "default";
+ var args = message.Split(' ', StringSplitOptions.RemoveEmptyEntries).ToList();
+ var ident = args.First().Replace("!", "");
+ if(args.Count>0){args.RemoveAt(0);}
+
+ await SendToGroup(group, user, Commands.CommandHandler.ExecuteCommand(new Command{CharId = 0,CmdIdentifier = ident, CmdTexts = args, Name = user}));
}
+
+ private Task SendToGroup(string group, string user, string message)
+ {
+ return Clients.Group(group).SendCoreAsync("ReceiveMessage", new object[] { user, message });
+ }
+
+ public async Task Login(string group, string password)
+ {
+ if (password == "valid")
+ {
+ await Groups.AddToGroupAsync(Context.ConnectionId, group);
+ }
+
+ await SendToGroup(group, "", "Ein neuer Nutzer hat die Gruppe betreten");
+ }
+
+ public async Task Disconnect(string group, string user)
+ {
+ await Groups.RemoveFromGroupAsync(Context.ConnectionId, group);
+
+ await SendToGroup(group, user, "Connection lost");
+ }
+
}
}
diff --git a/DSACore/Properties/launchSettings.json b/DSACore/Properties/launchSettings.json
index 2da5fec..50d10a9 100644
--- a/DSACore/Properties/launchSettings.json
+++ b/DSACore/Properties/launchSettings.json
@@ -21,7 +21,7 @@
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/commands",
- "applicationUrl": "https://0.0.0.0:5001;http://0.0.0.0:5000",
+ "applicationUrl": "https://192.168.2.58:5001;http://192.168.2.58:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
diff --git a/DSACore/PropertiesDSACore-Audio-Sound.json b/DSACore/PropertiesDSACore-Audio-Sound.json
new file mode 100644
index 0000000..87a0e6b
--- /dev/null
+++ b/DSACore/PropertiesDSACore-Audio-Sound.json
@@ -0,0 +1,7 @@
+[
+ {
+ "Name": "Test",
+ "Url": "http",
+ "Volume": 100
+ }
+] \ No newline at end of file
diff --git a/DSACore/PropertiesDSACore-Auxiliary-CommandInfo.json b/DSACore/PropertiesDSACore-Auxiliary-CommandInfo.json
new file mode 100644
index 0000000..b9941f2
--- /dev/null
+++ b/DSACore/PropertiesDSACore-Auxiliary-CommandInfo.json
@@ -0,0 +1,101 @@
+[
+ {
+ "Name": "ich bin",
+ "Scope": "All",
+ "Brief": "Setzt den gespielten Charakter fest",
+ "Description": [
+ "Mit \"!Ich bin\" kann der gespielte Charakter definiert, bzw. gewechselt werden.\n",
+ " Die Charaktere müssen als *.xml Dateien hinterlegt sein.\n\n",
+ " !ich Zeigt an welcher Charakter zur Zeit gespielt wird\n",
+ " !ich bin Zalibius Wechsel zum Helden Zalibius\n",
+ " !ich Rhoktar Orkische Variante von !ich bin.\n",
+ " Wechselt zu Rhoktar.\n\n",
+ " !list chars Zeigt die Liste verfügbarer Charaktere.\n",
+ " \n"
+ ]
+ },
+ {
+ "Name": "List",
+ "Scope": "All",
+ "Brief": "Anzeige vonSpielrelevanten Listen",
+ "Description": [
+ "Mit \"!list\" lassen sich spielrelevante Listen ausgeben. Die Angezeigte Liste wird nach einiger Zeit wieder gelöscht.\n",
+ "\n",
+ " !list chars Liste aller verfügbaren Helden (eingelesen per *.xml)\n",
+ " und NSCs.\n",
+ " (Mit \"!ich bin\" kann der Held ausgewählt werden.)\n",
+ " !list commands Liste aller verwendbaren Bot-Kommandos.\n",
+ " !list sounds Liste der Soundeffekte."
+ ]
+ },
+ {
+ "Name": "Held",
+ "Scope": "All",
+ "Brief": "Anzeige von Heldenwerten",
+ "Description": [
+ "Mit \"!Held\" lassen sich Heldenwerte ausgeben. Mehrere Werte können gleichzeitig angefordert werde. \"!Held LE Waffen\" liefert so z.B. Informationen zur Lebensenergie und den Kampfwerten.\n Bis auf wenige Ausnahmen wird die Angezeigte Liste nach einiger Zeit wieder gelöscht.\n",
+ "\n",
+ " !Held Zeigt den Heldenbrief an.\n",
+ " (Diese Liste wird nicht automatisch gelöscht)\n",
+ " !Held Eigenschaften Zeigt die Eigenschaften MU/KL/CH/IN/KK/GE/FF/KO.\n",
+ " !Held e Kurzform von \"!Held Eigenschaften\".\n",
+ " !Held LE Zeigt LE an.\n",
+ " !Held AE Zeigt AE an.\n",
+ " !Held stats Zeigt Eigenschaften und zusätzlich SO/LE/AE.\n",
+ " !Held Kampfwerte Zeigt AT/PA für aktivierte Waffentalente.\n",
+ " !Held Waffe/!list w Kurzformen von \"!Held Kampfwerte\".\n",
+ " !Held Vorteile Zeigt Vor- und Nachteile an.\n",
+ " !Held v Kurzform von \"!Held Vorteile\".\n",
+ " !Held Talente Zeigt die Liste aller aktivierten Talente, deren TaW,\n",
+ " sowie die Probe.\n",
+ " !Held t Kurzform von \"!Held Talente\".\n",
+ " !Held Zauber Zeigt die Liste aller aktivierten Zauber, deren ZaW,\n",
+ " sowie die Probe.\n",
+ " !Held z Kurzform von \"!Held Zauber\".\n"
+ ]
+ },
+ {
+ "Name": "LE",
+ "Scope": "All",
+ "Brief": "Ändert dein Leben - im wahrsten Sinne des Wortes",
+ "Description": [
+ "Mit !LE zeigt man die Lebensenergie an, ändert sie, oder setzt sie auf einen neuen Wert\n\n",
+ " !LE Zeigt Lebensenergie an\n",
+ " !LE 30 Setzt LE auf 30\n",
+ " !LE +5 Erhöht LE um 5 (bis zum Maximum)\n",
+ " !LE ++5 Erhöht LE um 5 (ignoriert Maximum)\n",
+ " !LE -5 Verringert LE um 5\n \n"
+ ]
+ },
+ {
+ "Name": "AE",
+ "Scope": "All",
+ "Brief": "Ändert Astralenergie",
+ "Description": [
+ "Mit !AE (oder !Asp) zeigt man die Astralenergie an, ändert sie, oder setzt sie auf einen neuen Wert\n\n",
+ " !AE Zeigt Astralenergie an\n",
+ " !AE 30 Setzt Asp auf 30\n",
+ " !AE +5 Erhöht Asp um 5 (bis zum Maximum)\n",
+ " !AE ++5 Erhöht Asp um 5 (ignoriert Maximum)\n",
+ " !AE -5 Verringert Asp um 5 (Minimum 0)\n"
+ ]
+ },
+ {
+ "Name": "Gm",
+ "Scope": "Meister",
+ "Brief": "Kontrolliere andere Charaktere",
+ "Description": [
+ "Mit !GM fürhrt man commands als eine andere Person aus.",
+ " !GM [charaktername] [command] [commandattribut] [mofifier]",
+ " Unterstützte [commands]'s:",
+ " !GM [name] LE",
+ " !GM [name] AE",
+ " !GM [name] Talent",
+ " !GM [name] Fernkampf",
+ " !GM [name] Eigenschaft",
+ " !GM [name] Zauber",
+ " !GM [name] Angriff",
+ " !GM [name] Parade"
+ ]
+ }
+] \ No newline at end of file
diff --git a/DSACore/PropertiesDSACore-DSA_Game-Characters-Character.json b/DSACore/PropertiesDSACore-DSA_Game-Characters-Character.json
new file mode 100644
index 0000000..fd387f5
--- /dev/null
+++ b/DSACore/PropertiesDSACore-DSA_Game-Characters-Character.json
@@ -0,0 +1,290 @@
+[
+ {
+ "Eigenschaften": {},
+ "Talente": [],
+ "Zauber": [],
+ "Kampftalente": [],
+ "Vorteile": [],
+ "PropTable": {
+ "MU": "Mut",
+ "KL": "Klugheit",
+ "IN": "Intuition",
+ "CH": "Charisma",
+ "FF": "Fingerfertigkeit",
+ "GE": "Gewandtheit",
+ "KO": "Konstitution",
+ "KK": "Körperkraft"
+ },
+ "Lebenspunkte_Basis": 30,
+ "Lebenspunkte_Aktuell": 30,
+ "Ausdauer_Basis": 0,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Basis": 20,
+ "Astralpunkte_Aktuell": 20,
+ "Name": "Felis Exodus Schattenwald"
+ },
+ {
+ "Eigenschaften": {},
+ "Talente": [],
+ "Zauber": [],
+ "Kampftalente": [],
+ "Vorteile": [],
+ "PropTable": {
+ "MU": "Mut",
+ "KL": "Klugheit",
+ "IN": "Intuition",
+ "CH": "Charisma",
+ "FF": "Fingerfertigkeit",
+ "GE": "Gewandtheit",
+ "KO": "Konstitution",
+ "KK": "Körperkraft"
+ },
+ "Lebenspunkte_Basis": 29,
+ "Lebenspunkte_Aktuell": 29,
+ "Ausdauer_Basis": 0,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Basis": 0,
+ "Astralpunkte_Aktuell": 0,
+ "Name": "Gardist"
+ },
+ {
+ "Eigenschaften": {},
+ "Talente": [],
+ "Zauber": [],
+ "Kampftalente": [],
+ "Vorteile": [],
+ "PropTable": {
+ "MU": "Mut",
+ "KL": "Klugheit",
+ "IN": "Intuition",
+ "CH": "Charisma",
+ "FF": "Fingerfertigkeit",
+ "GE": "Gewandtheit",
+ "KO": "Konstitution",
+ "KK": "Körperkraft"
+ },
+ "Lebenspunkte_Basis": 31,
+ "Lebenspunkte_Aktuell": 31,
+ "Ausdauer_Basis": 0,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Basis": 0,
+ "Astralpunkte_Aktuell": 0,
+ "Name": "Hartmut Reiher"
+ },
+ {
+ "Eigenschaften": {},
+ "Talente": [],
+ "Zauber": [],
+ "Kampftalente": [],
+ "Vorteile": [],
+ "PropTable": {
+ "MU": "Mut",
+ "KL": "Klugheit",
+ "IN": "Intuition",
+ "CH": "Charisma",
+ "FF": "Fingerfertigkeit",
+ "GE": "Gewandtheit",
+ "KO": "Konstitution",
+ "KK": "Körperkraft"
+ },
+ "Lebenspunkte_Basis": 21,
+ "Lebenspunkte_Aktuell": 21,
+ "Ausdauer_Basis": 0,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Basis": 35,
+ "Astralpunkte_Aktuell": 35,
+ "Name": "Helga vom Drachenei, Tausendsasserin"
+ },
+ {
+ "Eigenschaften": {},
+ "Talente": [],
+ "Zauber": [],
+ "Kampftalente": [],
+ "Vorteile": [],
+ "PropTable": {
+ "MU": "Mut",
+ "KL": "Klugheit",
+ "IN": "Intuition",
+ "CH": "Charisma",
+ "FF": "Fingerfertigkeit",
+ "GE": "Gewandtheit",
+ "KO": "Konstitution",
+ "KK": "Körperkraft"
+ },
+ "Lebenspunkte_Basis": 25,
+ "Lebenspunkte_Aktuell": 25,
+ "Ausdauer_Basis": 0,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Basis": 0,
+ "Astralpunkte_Aktuell": 0,
+ "Name": "Krenko"
+ },
+ {
+ "Eigenschaften": {},
+ "Talente": [],
+ "Zauber": [],
+ "Kampftalente": [],
+ "Vorteile": [],
+ "PropTable": {
+ "MU": "Mut",
+ "KL": "Klugheit",
+ "IN": "Intuition",
+ "CH": "Charisma",
+ "FF": "Fingerfertigkeit",
+ "GE": "Gewandtheit",
+ "KO": "Konstitution",
+ "KK": "Körperkraft"
+ },
+ "Lebenspunkte_Basis": 39,
+ "Lebenspunkte_Aktuell": 39,
+ "Ausdauer_Basis": 0,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Basis": 0,
+ "Astralpunkte_Aktuell": 0,
+ "Name": "Ledur Torfinson"
+ },
+ {
+ "Eigenschaften": {},
+ "Talente": [],
+ "Zauber": [],
+ "Kampftalente": [],
+ "Vorteile": [],
+ "PropTable": {
+ "MU": "Mut",
+ "KL": "Klugheit",
+ "IN": "Intuition",
+ "CH": "Charisma",
+ "FF": "Fingerfertigkeit",
+ "GE": "Gewandtheit",
+ "KO": "Konstitution",
+ "KK": "Körperkraft"
+ },
+ "Lebenspunkte_Basis": 26,
+ "Lebenspunkte_Aktuell": 26,
+ "Ausdauer_Basis": 0,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Basis": 13,
+ "Astralpunkte_Aktuell": 13,
+ "Name": "Morla"
+ },
+ {
+ "Eigenschaften": {},
+ "Talente": [],
+ "Zauber": [],
+ "Kampftalente": [],
+ "Vorteile": [],
+ "PropTable": {
+ "MU": "Mut",
+ "KL": "Klugheit",
+ "IN": "Intuition",
+ "CH": "Charisma",
+ "FF": "Fingerfertigkeit",
+ "GE": "Gewandtheit",
+ "KO": "Konstitution",
+ "KK": "Körperkraft"
+ },
+ "Lebenspunkte_Basis": 28,
+ "Lebenspunkte_Aktuell": 28,
+ "Ausdauer_Basis": 0,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Basis": 40,
+ "Astralpunkte_Aktuell": 40,
+ "Name": "Numeri Illuminus"
+ },
+ {
+ "Eigenschaften": {},
+ "Talente": [],
+ "Zauber": [],
+ "Kampftalente": [],
+ "Vorteile": [],
+ "PropTable": {
+ "MU": "Mut",
+ "KL": "Klugheit",
+ "IN": "Intuition",
+ "CH": "Charisma",
+ "FF": "Fingerfertigkeit",
+ "GE": "Gewandtheit",
+ "KO": "Konstitution",
+ "KK": "Körperkraft"
+ },
+ "Lebenspunkte_Basis": 39,
+ "Lebenspunkte_Aktuell": 39,
+ "Ausdauer_Basis": 0,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Basis": 16,
+ "Astralpunkte_Aktuell": 16,
+ "Name": "Potus"
+ },
+ {
+ "Eigenschaften": {},
+ "Talente": [],
+ "Zauber": [],
+ "Kampftalente": [],
+ "Vorteile": [],
+ "PropTable": {
+ "MU": "Mut",
+ "KL": "Klugheit",
+ "IN": "Intuition",
+ "CH": "Charisma",
+ "FF": "Fingerfertigkeit",
+ "GE": "Gewandtheit",
+ "KO": "Konstitution",
+ "KK": "Körperkraft"
+ },
+ "Lebenspunkte_Basis": 18,
+ "Lebenspunkte_Aktuell": 18,
+ "Ausdauer_Basis": 0,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Basis": 13,
+ "Astralpunkte_Aktuell": 13,
+ "Name": "Pump aus der Gosse"
+ },
+ {
+ "Eigenschaften": {},
+ "Talente": [],
+ "Zauber": [],
+ "Kampftalente": [],
+ "Vorteile": [],
+ "PropTable": {
+ "MU": "Mut",
+ "KL": "Klugheit",
+ "IN": "Intuition",
+ "CH": "Charisma",
+ "FF": "Fingerfertigkeit",
+ "GE": "Gewandtheit",
+ "KO": "Konstitution",
+ "KK": "Körperkraft"
+ },
+ "Lebenspunkte_Basis": 34,
+ "Lebenspunkte_Aktuell": 34,
+ "Ausdauer_Basis": 0,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Basis": 17,
+ "Astralpunkte_Aktuell": 17,
+ "Name": "Rhoktar4"
+ },
+ {
+ "Eigenschaften": {},
+ "Talente": [],
+ "Zauber": [],
+ "Kampftalente": [],
+ "Vorteile": [],
+ "PropTable": {
+ "MU": "Mut",
+ "KL": "Klugheit",
+ "IN": "Intuition",
+ "CH": "Charisma",
+ "FF": "Fingerfertigkeit",
+ "GE": "Gewandtheit",
+ "KO": "Konstitution",
+ "KK": "Körperkraft"
+ },
+ "Lebenspunkte_Basis": 28,
+ "Lebenspunkte_Aktuell": 28,
+ "Ausdauer_Basis": 0,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Basis": 43,
+ "Astralpunkte_Aktuell": 43,
+ "Name": "Volant"
+ }
+] \ No newline at end of file
diff --git a/DSACore/PropertiesNewtonsoft-Json-Linq-JProperty.json b/DSACore/PropertiesNewtonsoft-Json-Linq-JProperty.json
new file mode 100644
index 0000000..5b400e5
--- /dev/null
+++ b/DSACore/PropertiesNewtonsoft-Json-Linq-JProperty.json
@@ -0,0 +1,30 @@
+{
+ "$schema": "http://json.schemastore.org/launchsettings.json",
+ "iisSettings": {
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
+ "iisExpress": {
+ "applicationUrl": "http://localhost:2170",
+ "sslPort": 44365
+ }
+ },
+ "profiles": {
+ "IIS Express": {
+ "commandName": "IISExpress",
+ "launchBrowser": true,
+ "launchUrl": "api/commands",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "DSACore": {
+ "commandName": "Project",
+ "launchBrowser": true,
+ "launchUrl": "api/commands",
+ "applicationUrl": "https://192.168.2.58:5001;http://192.168.2.58:5000",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/DSACore/Startup.cs b/DSACore/Startup.cs
index 0628151..c189436 100644
--- a/DSACore/Startup.cs
+++ b/DSACore/Startup.cs
@@ -26,12 +26,23 @@ namespace DSACore
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
+ services.AddCors(options => options.AddPolicy("CorsPolicy",
+ builder =>
+ {
+ builder.WithOrigins("https://dsa.truekuehli.de")
+ .WithHeaders("Access-Control-Allow-Origin")
+ .AllowAnyHeader()
+ .AllowAnyMethod()
+ .AllowCredentials();
+ }));
+ /*
services.AddCors(options =>
{
options.AddPolicy("AllowSpecificOrigin",
- builder => builder.WithOrigins("https://console.firebase.google.com/project/heldenonline-4d828"));
+ builder => builder.AllowAnyMethod().AllowAnyHeader().AllowAnyOrigin().AllowCredentials()/*WithOrigins("https://dsa.truekuehli.de")#1#);
});
+*/
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
services.AddSignalR();
@@ -49,9 +60,13 @@ namespace DSACore
app.UseHsts();
}
+ app.UseCors("CorsPolicy");
+
app.UseSignalR(routes => { routes.MapHub<ChatHub>("/chatHub"); });
- app.UseCors("AllowSpecificOrigin");
- app.UseHttpsRedirection();
+
+
+ //app.UseCors("AllowSpecificOrigin");
+ //app.UseHttpsRedirection();
app.UseMvc();
}
}