diff --git a/.DS_Store b/.DS_Store
deleted file mode 100644
index c9e0979..0000000
Binary files a/.DS_Store and /dev/null differ
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a0b502d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+sqldata
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..d5d0289
--- /dev/null
+++ b/README.md
@@ -0,0 +1,19 @@
+MopRpg
+======
+
+![](screenshot.png)
+
+**A game I wrote a long time ago.**
+
+Setup
+-----
+
+You need the docker images:
+- [dpedu/nginxfpm](http://gitlab.davepedu.com/dave/docker-nginxfpm)
+- [dpedu/mariadb](http://gitlab.davepedu.com/dave/docker-mariadb)
+
+Steps:
+
+- `docker-compose up`
+- `docker exec -i moprpg_mysql_1 mysql < init.sql`
+- browse to [http://127.0.0.1:8080/](http://127.0.0.1:8080/)
diff --git a/config.php b/config.php
index 2bf805b..6e76ca2 100644
--- a/config.php
+++ b/config.php
@@ -4,12 +4,97 @@
/*echo "
Down for maintenance!
";
exit;*/
-
-$con = mysql_connect("mysql","mop_admin","droids");
+$con = mysql_connect("mysql","rpg","wiggleyourdickbutt");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
-mysql_select_db("mop_rpg", $con);
+
+$r = mysql_select_db("mop_rpg", $con);
+
+
+
+$tables = array();
+$q = mysql_query("SHOW TABLES");
+while($row = mysql_fetch_array($q)) {
+ array_push($tables, $row[0]);
+}
+
+if(!$tables) {
+ $queries = array("CREATE TABLE `mrpg_battles` (
+ `id` text,
+ `use` text,
+ `enemy` text,
+ `enemyhp` text,
+ `other` text
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;",
+
+ "CREATE TABLE `mrpg_confirm` (
+ `id` int(11) DEFAULT NULL,
+ `q` text,
+ `yesx` int(11) DEFAULT NULL,
+ `yesy` int(11) DEFAULT NULL,
+ `nox` int(11) DEFAULT NULL,
+ `noy` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;",
+
+ "CREATE TABLE `mrpg_message` (
+ `id` int(11) DEFAULT NULL,
+ `q` text,
+ `x` int(11) DEFAULT NULL,
+ `y` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;",
+
+ "CREATE TABLE `mrpg_monsters` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `image` text,
+ `hp` int(11) DEFAULT NULL,
+ `name` text,
+ `diemsg` text,
+ `expgive` int(11) DEFAULT NULL,
+ `power` int(11) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;",
+
+ "INSERT INTO `mrpg_monsters` VALUES (1,'rat.png',30,'Rat','rat died',10,0);",
+ "INSERT INTO `mrpg_monsters` VALUES (2,'chef_1.png',30,'Chef','chef screamed \"profit has a tiny dick\" and died',20,2);",
+ "INSERT INTO `mrpg_monsters` VALUES (3,'monster.png',30,'Monster','monster died',30,5);",
+
+ "CREATE TABLE `mrpg_stat` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `hp` int(11) DEFAULT NULL,
+ `maxhp` int(11) DEFAULT NULL,
+ `pp` int(11) DEFAULT NULL,
+ `offense` int(11) DEFAULT NULL,
+ `defense` int(11) DEFAULT NULL,
+ `fight` int(11) DEFAULT NULL,
+ `speed` int(11) DEFAULT NULL,
+ `wisdom` int(11) DEFAULT NULL,
+ `strength` int(11) DEFAULT NULL,
+ `force` int(11) DEFAULT NULL,
+ `poison` int(11) DEFAULT NULL,
+ `other` int(11) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;",
+
+ "CREATE TABLE `mrpg_users` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` text,
+ `password` text,
+ `x` int(11) DEFAULT NULL,
+ `y` int(11) DEFAULT NULL,
+ `dir` text,
+ `inventory` text,
+ `level` int(11) DEFAULT NULL,
+ `lastact` text,
+ `mode` text,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;");
+
+ foreach($queries as $q) {
+ mysql_query($q);
+ print_r(mysql_error());
+ }
+}
//Get user IP
if($_SERVER['HTTP_X_FORWARDED_FOR']!="") {
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..1fa0e89
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,13 @@
+mysql:
+ image: dpedu/mariadb
+ volumes:
+ - "./init.sql:/tmp/init.sql"
+ - "./sqldata/:/var/lib/mysql/"
+web:
+ image: dpedu/nginxfpm
+ links:
+ - mysql
+ ports:
+ - "127.0.0.1:8080:80"
+ volumes:
+ - ".:/usr/share/nginx/html/"
diff --git a/init.sql b/init.sql
index ec23f9b..e870def 100644
--- a/init.sql
+++ b/init.sql
@@ -1,73 +1,81 @@
+
+-- run me like:
+-- sudo docker exec -i moprpg_mysql_1 mysql < init.sql
+
+CREATE USER 'rpg'@'%' IDENTIFIED BY 'wiggleyourdickbutt';
+GRANT ALL PRIVILEGES ON mop_rpg.* TO 'rpg'@'%';
+FLUSH PRIVILEGES;
+
CREATE DATABASE mop_rpg;
-USE mop_rpg;
+-- USE mop_rpg;
-CREATE TABLE `mrpg_battles` (
- `id` text,
- `use` text,
- `enemy` text,
- `enemyhp` text,
- `other` text
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+-- CREATE TABLE `mrpg_battles` (
+-- `id` text,
+-- `use` text,
+-- `enemy` text,
+-- `enemyhp` text,
+-- `other` text
+-- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-CREATE TABLE `mrpg_confirm` (
- `id` int(11) DEFAULT NULL,
- `q` text,
- `yesx` int(11) DEFAULT NULL,
- `yesy` int(11) DEFAULT NULL,
- `nox` int(11) DEFAULT NULL,
- `noy` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+-- CREATE TABLE `mrpg_confirm` (
+-- `id` int(11) DEFAULT NULL,
+-- `q` text,
+-- `yesx` int(11) DEFAULT NULL,
+-- `yesy` int(11) DEFAULT NULL,
+-- `nox` int(11) DEFAULT NULL,
+-- `noy` int(11) DEFAULT NULL
+-- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-CREATE TABLE `mrpg_message` (
- `id` int(11) DEFAULT NULL,
- `q` text,
- `x` int(11) DEFAULT NULL,
- `y` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+-- CREATE TABLE `mrpg_message` (
+-- `id` int(11) DEFAULT NULL,
+-- `q` text,
+-- `x` int(11) DEFAULT NULL,
+-- `y` int(11) DEFAULT NULL
+-- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-CREATE TABLE `mrpg_monsters` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `image` text,
- `hp` int(11) DEFAULT NULL,
- `name` text,
- `diemsg` text,
- `expgive` int(11) DEFAULT NULL,
- `power` int(11) DEFAULT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
+-- CREATE TABLE `mrpg_monsters` (
+-- `id` int(11) NOT NULL AUTO_INCREMENT,
+-- `image` text,
+-- `hp` int(11) DEFAULT NULL,
+-- `name` text,
+-- `diemsg` text,
+-- `expgive` int(11) DEFAULT NULL,
+-- `power` int(11) DEFAULT NULL,
+-- PRIMARY KEY (`id`)
+-- ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
-INSERT INTO `mrpg_monsters` VALUES (1,'rat.png',30,'Rat','rat died',10,0);
-INSERT INTO `mrpg_monsters` VALUES (2,'chef_1.png',30,'Chef','chef screamed "profit has a tiny dick" and died',20,2);
-INSERT INTO `mrpg_monsters` VALUES (3,'monster.png',30,'Monster','monster died',30,5);
+-- INSERT INTO `mrpg_monsters` VALUES (1,'rat.png',30,'Rat','rat died',10,0);
+-- INSERT INTO `mrpg_monsters` VALUES (2,'chef_1.png',30,'Chef','chef screamed "profit has a tiny dick" and died',20,2);
+-- INSERT INTO `mrpg_monsters` VALUES (3,'monster.png',30,'Monster','monster died',30,5);
-CREATE TABLE `mrpg_stat` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `hp` int(11) DEFAULT NULL,
- `maxhp` int(11) DEFAULT NULL,
- `pp` int(11) DEFAULT NULL,
- `offense` int(11) DEFAULT NULL,
- `defense` int(11) DEFAULT NULL,
- `fight` int(11) DEFAULT NULL,
- `speed` int(11) DEFAULT NULL,
- `wisdom` int(11) DEFAULT NULL,
- `strength` int(11) DEFAULT NULL,
- `force` int(11) DEFAULT NULL,
- `poison` int(11) DEFAULT NULL,
- `other` int(11) DEFAULT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
+-- CREATE TABLE `mrpg_stat` (
+-- `id` int(11) NOT NULL AUTO_INCREMENT,
+-- `hp` int(11) DEFAULT NULL,
+-- `maxhp` int(11) DEFAULT NULL,
+-- `pp` int(11) DEFAULT NULL,
+-- `offense` int(11) DEFAULT NULL,
+-- `defense` int(11) DEFAULT NULL,
+-- `fight` int(11) DEFAULT NULL,
+-- `speed` int(11) DEFAULT NULL,
+-- `wisdom` int(11) DEFAULT NULL,
+-- `strength` int(11) DEFAULT NULL,
+-- `force` int(11) DEFAULT NULL,
+-- `poison` int(11) DEFAULT NULL,
+-- `other` int(11) DEFAULT NULL,
+-- PRIMARY KEY (`id`)
+-- ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
-CREATE TABLE `mrpg_users` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `name` text,
- `password` text,
- `x` int(11) DEFAULT NULL,
- `y` int(11) DEFAULT NULL,
- `dir` text,
- `inventory` text,
- `level` int(11) DEFAULT NULL,
- `lastact` text,
- `mode` text,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
+-- CREATE TABLE `mrpg_users` (
+-- `id` int(11) NOT NULL AUTO_INCREMENT,
+-- `name` text,
+-- `password` text,
+-- `x` int(11) DEFAULT NULL,
+-- `y` int(11) DEFAULT NULL,
+-- `dir` text,
+-- `inventory` text,
+-- `level` int(11) DEFAULT NULL,
+-- `lastact` text,
+-- `mode` text,
+-- PRIMARY KEY (`id`)
+-- ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
diff --git a/screenshot.png b/screenshot.png
new file mode 100644
index 0000000..503f2eb
Binary files /dev/null and b/screenshot.png differ