Add readme, dockerfile

This commit is contained in:
dave 2017-10-26 19:47:32 -07:00
parent 01605fa461
commit bc582502a3
7 changed files with 193 additions and 67 deletions

BIN
.DS_Store vendored

Binary file not shown.

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
sqldata

19
README.md Normal file
View File

@ -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/)

View File

@ -4,12 +4,97 @@
/*echo "<h1>Down for maintenance!</h1>";
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']!="") {

13
docker-compose.yml Normal file
View File

@ -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
View File

@ -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;

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB