Add readme, dockerfile
This commit is contained in:
parent
01605fa461
commit
bc582502a3
|
@ -0,0 +1 @@
|
||||||
|
sqldata
|
|
@ -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/)
|
91
config.php
91
config.php
|
@ -4,12 +4,97 @@
|
||||||
/*echo "<h1>Down for maintenance!</h1>";
|
/*echo "<h1>Down for maintenance!</h1>";
|
||||||
exit;*/
|
exit;*/
|
||||||
|
|
||||||
|
$con = mysql_connect("mysql","rpg","wiggleyourdickbutt");
|
||||||
$con = mysql_connect("mysql","mop_admin","droids");
|
|
||||||
if (!$con) {
|
if (!$con) {
|
||||||
die('Could not connect: ' . mysql_error());
|
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
|
//Get user IP
|
||||||
if($_SERVER['HTTP_X_FORWARDED_FOR']!="") {
|
if($_SERVER['HTTP_X_FORWARDED_FOR']!="") {
|
||||||
|
|
|
@ -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/"
|
136
init.sql
136
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;
|
CREATE DATABASE mop_rpg;
|
||||||
|
|
||||||
USE mop_rpg;
|
-- USE mop_rpg;
|
||||||
|
|
||||||
CREATE TABLE `mrpg_battles` (
|
-- CREATE TABLE `mrpg_battles` (
|
||||||
`id` text,
|
-- `id` text,
|
||||||
`use` text,
|
-- `use` text,
|
||||||
`enemy` text,
|
-- `enemy` text,
|
||||||
`enemyhp` text,
|
-- `enemyhp` text,
|
||||||
`other` text
|
-- `other` text
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
-- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
CREATE TABLE `mrpg_confirm` (
|
-- CREATE TABLE `mrpg_confirm` (
|
||||||
`id` int(11) DEFAULT NULL,
|
-- `id` int(11) DEFAULT NULL,
|
||||||
`q` text,
|
-- `q` text,
|
||||||
`yesx` int(11) DEFAULT NULL,
|
-- `yesx` int(11) DEFAULT NULL,
|
||||||
`yesy` int(11) DEFAULT NULL,
|
-- `yesy` int(11) DEFAULT NULL,
|
||||||
`nox` int(11) DEFAULT NULL,
|
-- `nox` int(11) DEFAULT NULL,
|
||||||
`noy` int(11) DEFAULT NULL
|
-- `noy` int(11) DEFAULT NULL
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
-- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
CREATE TABLE `mrpg_message` (
|
-- CREATE TABLE `mrpg_message` (
|
||||||
`id` int(11) DEFAULT NULL,
|
-- `id` int(11) DEFAULT NULL,
|
||||||
`q` text,
|
-- `q` text,
|
||||||
`x` int(11) DEFAULT NULL,
|
-- `x` int(11) DEFAULT NULL,
|
||||||
`y` int(11) DEFAULT NULL
|
-- `y` int(11) DEFAULT NULL
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
-- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
CREATE TABLE `mrpg_monsters` (
|
-- CREATE TABLE `mrpg_monsters` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
-- `id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`image` text,
|
-- `image` text,
|
||||||
`hp` int(11) DEFAULT NULL,
|
-- `hp` int(11) DEFAULT NULL,
|
||||||
`name` text,
|
-- `name` text,
|
||||||
`diemsg` text,
|
-- `diemsg` text,
|
||||||
`expgive` int(11) DEFAULT NULL,
|
-- `expgive` int(11) DEFAULT NULL,
|
||||||
`power` int(11) DEFAULT NULL,
|
-- `power` int(11) DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`)
|
-- PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
|
-- ) 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 (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 (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 (3,'monster.png',30,'Monster','monster died',30,5);
|
||||||
|
|
||||||
CREATE TABLE `mrpg_stat` (
|
-- CREATE TABLE `mrpg_stat` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
-- `id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`hp` int(11) DEFAULT NULL,
|
-- `hp` int(11) DEFAULT NULL,
|
||||||
`maxhp` int(11) DEFAULT NULL,
|
-- `maxhp` int(11) DEFAULT NULL,
|
||||||
`pp` int(11) DEFAULT NULL,
|
-- `pp` int(11) DEFAULT NULL,
|
||||||
`offense` int(11) DEFAULT NULL,
|
-- `offense` int(11) DEFAULT NULL,
|
||||||
`defense` int(11) DEFAULT NULL,
|
-- `defense` int(11) DEFAULT NULL,
|
||||||
`fight` int(11) DEFAULT NULL,
|
-- `fight` int(11) DEFAULT NULL,
|
||||||
`speed` int(11) DEFAULT NULL,
|
-- `speed` int(11) DEFAULT NULL,
|
||||||
`wisdom` int(11) DEFAULT NULL,
|
-- `wisdom` int(11) DEFAULT NULL,
|
||||||
`strength` int(11) DEFAULT NULL,
|
-- `strength` int(11) DEFAULT NULL,
|
||||||
`force` int(11) DEFAULT NULL,
|
-- `force` int(11) DEFAULT NULL,
|
||||||
`poison` int(11) DEFAULT NULL,
|
-- `poison` int(11) DEFAULT NULL,
|
||||||
`other` int(11) DEFAULT NULL,
|
-- `other` int(11) DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`)
|
-- PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
|
-- ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
CREATE TABLE `mrpg_users` (
|
-- CREATE TABLE `mrpg_users` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
-- `id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`name` text,
|
-- `name` text,
|
||||||
`password` text,
|
-- `password` text,
|
||||||
`x` int(11) DEFAULT NULL,
|
-- `x` int(11) DEFAULT NULL,
|
||||||
`y` int(11) DEFAULT NULL,
|
-- `y` int(11) DEFAULT NULL,
|
||||||
`dir` text,
|
-- `dir` text,
|
||||||
`inventory` text,
|
-- `inventory` text,
|
||||||
`level` int(11) DEFAULT NULL,
|
-- `level` int(11) DEFAULT NULL,
|
||||||
`lastact` text,
|
-- `lastact` text,
|
||||||
`mode` text,
|
-- `mode` text,
|
||||||
PRIMARY KEY (`id`)
|
-- PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
|
-- ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 90 KiB |
Loading…
Reference in New Issue