diff --git a/MatheApp.sql b/MatheApp.sql new file mode 100644 index 0000000..ad33548 --- /dev/null +++ b/MatheApp.sql @@ -0,0 +1,60 @@ +-- MariaDB dump 10.19 Distrib 10.6.11-MariaDB, for debian-linux-gnu (x86_64) +-- +-- Host: localhost Database: MatheApp +-- ------------------------------------------------------ +-- Server version 10.6.11-MariaDB-0ubuntu0.22.04.1 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `user` +-- + +DROP TABLE IF EXISTS `user`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `user` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `username` varchar(255) NOT NULL, + `vorname` varchar(255) NOT NULL, + `nachname` varchar(255) NOT NULL, + `email` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + `lesson_count` int(11) NOT NULL, + `level` int(11) NOT NULL, + `xp` int(11) NOT NULL, + `coins` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `reference_unique` (`username`,`email`) +) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `user` +-- + +LOCK TABLES `user` WRITE; +/*!40000 ALTER TABLE `user` DISABLE KEYS */; +INSERT INTO `user` VALUES (3,'patryk','patryk','hegenberg','testMail@test.de','$2y$10$G8s3UA8zMjHnKAQ01B4.R.NX7gLZi28BuQiOVyBbnbYbNCZusx13W',1,1,17,43); +/*!40000 ALTER TABLE `user` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2023-01-11 13:29:50 diff --git a/scripts/game.js b/scripts/game.js index 725eb4f..283463f 100644 --- a/scripts/game.js +++ b/scripts/game.js @@ -1,11 +1,22 @@ (function (w) { var playerStats = document.getElementById("playerStats").innerHTML; - playerStats = playerStats.replace("'","").replace("{","").replace("}", "").split(","); - statsOfPlayer = {}; - for (var i = 0; i < playerStats.length; i++) { - var parts = playerStats[i].split(":") - statsOfPlayer[parts[0].trim().replace("'","").replace('"','').replace('"','')] = parts[1].trim().replace("'",""); + + function convertData(stats) { + var player = {}; + stats = stats.replace("'", "").replace("{","").replace("}",""); + stats = stats.split(","); + for (let i = 0; i < stats.length; i++) { + var parts = stats[i].split(":"); + if (isNaN(Number(parts[1].replace("'","").replace('"','').replace('"','')))) { + player[parts[0].replace("'","").replace('"','').replace('"','')] = parts[1].replace("'","").replace('"','').replace('"',''); + } else { + player[parts[0].replace("'","").replace('"','').replace('"','')] = Number(parts[1].replace("'","").replace('"','').replace('"','')); + } + } + return player; } + + var statsOfPlayer = convertData(playerStats); let count = 1; // game title const gametitle = "The Math Wizard"; diff --git a/views/index.view.php b/views/index.view.php index c200d43..439c241 100644 --- a/views/index.view.php +++ b/views/index.view.php @@ -2,7 +2,7 @@
-
+
-
+
-
+

Features

diff --git a/views/partials/nav.php b/views/partials/nav.php index 5504f9e..000158d 100644 --- a/views/partials/nav.php +++ b/views/partials/nav.php @@ -19,7 +19,7 @@ nes-btn text-sm">Abmelden Anmelden - Registrieren +