Compare commits
6 Commits
0511da22fb
...
7e9ce285e0
Author | SHA1 | Date | |
---|---|---|---|
7e9ce285e0 | |||
b4d188de16 | |||
2b6ec4d4ab | |||
9df90861e2 | |||
b2ef29ca9c | |||
ea7e6e8646 |
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
.installed
|
.installed
|
||||||
database.db
|
database.db
|
||||||
|
database.db-*
|
||||||
|
|
787
public/admin.php
787
public/admin.php
File diff suppressed because it is too large
Load Diff
157
public/forum.php
157
public/forum.php
|
@ -1,102 +1,111 @@
|
||||||
<?php // forum.php :: Internal forums script for the game.
|
<?php
|
||||||
|
|
||||||
include('lib.php');
|
// forum.php :: Internal forums script for the game.
|
||||||
include('cookies.php');
|
|
||||||
$link = opendb();
|
if (!file_exists('../.installed')) redirect('install.php');
|
||||||
$userrow = checkcookies();
|
|
||||||
if ($userrow == false) { display("The forum is for registered players only.", "Forum"); die(); }
|
require_once '../src/lib.php';
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
$controlrow = get_control_row();
|
||||||
|
|
||||||
|
// Login (or verify) if not logged in.
|
||||||
|
if (($userrow = checkcookies()) === false) {
|
||||||
|
if (isset($_GET['do']) && $_GET['do'] === 'verify') {
|
||||||
|
header("Location: users.php?do=verify");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
header("Location: login.php?do=login");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Close game.
|
// Close game.
|
||||||
if ($controlrow["gameopen"] == 0) { display("The game is currently closed for maintanence. Please check back later.","Game Closed"); die(); }
|
if ((bool) $controlrow["gameopen"] === false) {
|
||||||
|
display("The game is currently closed for maintanence. Please check back later.", "Game Closed");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Force verify if the user isn't verified yet.
|
// Force verify if the user isn't verified yet.
|
||||||
if ($controlrow["verifyemail"] == 1 && $userrow["verify"] != 1) { header("Location: users.php?do=verify"); die(); }
|
if ((bool) $controlrow["verifyemail"] && (bool) $userrow["verify"] === false) {
|
||||||
|
header("Location: users.php?do=verify");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Block user if he/she has been banned.
|
// Block user if he/she has been banned.
|
||||||
if ($userrow["authlevel"] == 2) { die("Your account has been blocked. Please try back later."); }
|
if ($userrow["authlevel"] === 2) {
|
||||||
|
exit("Your account has been blocked.");
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($_GET["do"])) {
|
$do = explode(':', $_GET['do'] ?? '');
|
||||||
$do = explode(":",$_GET["do"]);
|
match ($do[0]) {
|
||||||
|
'thread' => showthread($do[1], $do[2]),
|
||||||
if ($do[0] == "thread") { showthread($do[1], $do[2]); }
|
'new' => newthread(),
|
||||||
elseif ($do[0] == "new") { newthread(); }
|
'reply' => reply(),
|
||||||
elseif ($do[0] == "reply") { reply(); }
|
'list' => donothing($do[1]),
|
||||||
elseif ($do[0] == "list") { donothing($do[1]); }
|
default => donothing()
|
||||||
|
};
|
||||||
} else { donothing(0); }
|
|
||||||
|
|
||||||
function donothing($start=0) {
|
function donothing($start = 0)
|
||||||
|
{
|
||||||
$query = doquery("SELECT * FROM {{table}} WHERE parent='0' ORDER BY newpostdate DESC LIMIT 20", "forum");
|
$query = db()->query('SELECT * FROM forum WHERE parent=0 ORDER BY newpostdate DESC LIMIT 20 OFFSET ?;', [20 * $start]);
|
||||||
$page = "<table width=\"100%\"><tr><td style=\"padding:1px; background-color:black;\"><table width=\"100%\" style=\"margins:0px;\" cellspacing=\"1\" cellpadding=\"3\"><tr><th colspan=\"3\" style=\"background-color:#dddddd;\"><center><a href=\"forum.php?do=new\">New Thread</a></center></th></tr><tr><th width=\"50%\" style=\"background-color:#dddddd;\">Thread</th><th width=\"10%\" style=\"background-color:#dddddd;\">Replies</th><th style=\"background-color:#dddddd;\">Last Post</th></tr>\n";
|
$page = "<table width=\"100%\"><tr><td style=\"padding:1px; background-color:black;\"><table width=\"100%\" style=\"margins:0px;\" cellspacing=\"1\" cellpadding=\"3\"><tr><th colspan=\"3\" style=\"background-color:#dddddd;\"><center><a href=\"forum.php?do=new\">New Thread</a></center></th></tr><tr><th width=\"50%\" style=\"background-color:#dddddd;\">Thread</th><th width=\"10%\" style=\"background-color:#dddddd;\">Replies</th><th style=\"background-color:#dddddd;\">Last Post</th></tr>\n";
|
||||||
$count = 1;
|
|
||||||
if (mysql_num_rows($query) == 0) {
|
$hasRows = false;
|
||||||
|
|
||||||
|
while ($row = $query->fetchArray(SQLITE3_ASSOC)) {
|
||||||
|
$hasRows = true;
|
||||||
|
$page .= "<tr><td style=\"background-color:#ffffff;\"><a href=\"forum.php?do=thread:".$row["id"].":0\">".$row["title"]."</a></td><td style=\"background-color:#ffffff;\">".$row["replies"]."</td><td style=\"background-color:#ffffff;\">".$row["newpostdate"]."</td></tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$hasRows) {
|
||||||
$page .= "<tr><td style=\"background-color:#ffffff;\" colspan=\"3\"><b>No threads in forum.</b></td></tr>\n";
|
$page .= "<tr><td style=\"background-color:#ffffff;\" colspan=\"3\"><b>No threads in forum.</b></td></tr>\n";
|
||||||
} else {
|
|
||||||
while ($row = mysql_fetch_array($query)) {
|
|
||||||
if ($count == 1) {
|
|
||||||
$page .= "<tr><td style=\"background-color:#ffffff;\"><a href=\"forum.php?do=thread:".$row["id"].":0\">".$row["title"]."</a></td><td style=\"background-color:#ffffff;\">".$row["replies"]."</td><td style=\"background-color:#ffffff;\">".$row["newpostdate"]."</td></tr>\n";
|
|
||||||
$count = 2;
|
|
||||||
} else {
|
|
||||||
$page .= "<tr><td style=\"background-color:#eeeeee;\"><a href=\"forum.php?do=thread:".$row["id"].":0\">".$row["title"]."</a></td><td style=\"background-color:#eeeeee;\">".$row["replies"]."</td><td style=\"background-color:#eeeeee;\">".$row["newpostdate"]."</td></tr>\n";
|
|
||||||
$count = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$page .= "</table></td></tr></table>";
|
$page .= "</table></td></tr></table>";
|
||||||
|
|
||||||
display($page, "Forum");
|
display($page, "Forum");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showthread($id, $start) {
|
function showthread($id, $start)
|
||||||
|
{
|
||||||
|
$posts = db()->query('SELECT * FROM forum WHERE id=? OR parent=? ORDER BY id LIMIT 15 OFFSET ?;', [$id, $id, $start * 15]);
|
||||||
|
$title = db()->query('SELECT title FROM forum WHERE id=? LIMIT 1;', [$id])->fetchArray(SQLITE3_ASSOC);
|
||||||
|
|
||||||
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' OR parent='$id' ORDER BY id LIMIT $start,15", "forum");
|
$page = "<table width=\"100%\"><tr><td style=\"padding:1px; background-color:black;\"><table width=\"100%\" style=\"margins:0px;\" cellspacing=\"1\" cellpadding=\"3\"><tr><td colspan=\"2\" style=\"background-color:#dddddd;\"><b><a href=\"forum.php\">Forum</a> :: ".$title['title']."</b></td></tr>\n";
|
||||||
$query2 = doquery("SELECT title FROM {{table}} WHERE id='$id' LIMIT 1", "forum");
|
while ($row = $posts->fetchArray(SQLITE3_ASSOC)) {
|
||||||
$row2 = mysql_fetch_array($query2);
|
$page .= "<tr><td width=\"25%\" style=\"background-color:#ffffff; vertical-align:top;\"><span class=\"small\"><b>".$row["author"]."</b><br><br>".prettyforumdate($row["postdate"])."</td><td style=\"background-color:#ffffff; vertical-align:top;\">".nl2br($row["content"])."</td></tr>\n";
|
||||||
$page = "<table width=\"100%\"><tr><td style=\"padding:1px; background-color:black;\"><table width=\"100%\" style=\"margins:0px;\" cellspacing=\"1\" cellpadding=\"3\"><tr><td colspan=\"2\" style=\"background-color:#dddddd;\"><b><a href=\"forum.php\">Forum</a> :: ".$row2["title"]."</b></td></tr>\n";
|
|
||||||
$count = 1;
|
|
||||||
while ($row = mysql_fetch_array($query)) {
|
|
||||||
if ($count == 1) {
|
|
||||||
$page .= "<tr><td width=\"25%\" style=\"background-color:#ffffff; vertical-align:top;\"><span class=\"small\"><b>".$row["author"]."</b><br /><br />".prettyforumdate($row["postdate"])."</td><td style=\"background-color:#ffffff; vertical-align:top;\">".nl2br($row["content"])."</td></tr>\n";
|
|
||||||
$count = 2;
|
|
||||||
} else {
|
|
||||||
$page .= "<tr><td width=\"25%\" style=\"background-color:#eeeeee; vertical-align:top;\"><span class=\"small\"><b>".$row["author"]."</b><br /><br />".prettyforumdate($row["postdate"])."</td><td style=\"background-color:#eeeeee; vertical-align:top;\">".nl2br($row["content"])."</td></tr>\n";
|
|
||||||
$count = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$page .= "</table></td></tr></table><br />";
|
$page .= "</table></td></tr></table><br>";
|
||||||
$page .= "<table width=\"100%\"><tr><td><b>Reply To This Thread:</b><br /><form action=\"forum.php?do=reply\" method=\"post\"><input type=\"hidden\" name=\"parent\" value=\"$id\" /><input type=\"hidden\" name=\"title\" value=\"Re: ".$row2["title"]."\" /><textarea name=\"content\" rows=\"7\" cols=\"40\"></textarea><br /><input type=\"submit\" name=\"submit\" value=\"Submit\" /> <input type=\"reset\" name=\"reset\" value=\"Reset\" /></form></td></tr></table>";
|
$page .= "<table width=\"100%\"><tr><td><b>Reply To This Thread:</b><br><form action=\"forum.php?do=reply\" method=\"post\"><input type=\"hidden\" name=\"parent\" value=\"$id\" /><input type=\"hidden\" name=\"title\" value=\"Re: ".$title["title"]."\" /><textarea name=\"content\" rows=\"7\" cols=\"40\"></textarea><br><input type=\"submit\" name=\"submit\" value=\"Submit\" /> <input type=\"reset\" name=\"reset\" value=\"Reset\" /></form></td></tr></table>";
|
||||||
|
|
||||||
display($page, "Forum");
|
display($page, "Forum");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function reply() {
|
function reply()
|
||||||
|
{
|
||||||
global $userrow;
|
global $userrow;
|
||||||
extract($_POST);
|
|
||||||
$query = doquery("INSERT INTO {{table}} SET id='',postdate=NOW(),newpostdate=NOW(),author='".$userrow["charname"]."',parent='$parent',replies='0',title='$title',content='$content'", "forum");
|
$p = $_POST['parent'] ?? 0;
|
||||||
$query2 = doquery("UPDATE {{table}} SET newpostdate=NOW(),replies=replies+1 WHERE id='$parent' LIMIT 1", "forum");
|
$t = trim($_POST['title'] ?? '');
|
||||||
header("Location: forum.php?do=thread:$parent:0");
|
$c = trim($_POST['content'] ?? '');
|
||||||
die();
|
|
||||||
|
db()->query('INSERT INTO forum (author, title, content, parent) VALUES (?, ?, ?, ?);', [$userrow['username'], $t, $c, $p]);
|
||||||
|
db()->query('UPDATE forum SET newpostdate=CURRENT_TIMESTAMP, replies=replies + 1 WHERE id=?;', [$p]);
|
||||||
|
redirect("forum.php?do=thread:$p:0");
|
||||||
}
|
}
|
||||||
|
|
||||||
function newthread() {
|
function newthread()
|
||||||
|
{
|
||||||
global $userrow;
|
global $userrow;
|
||||||
|
|
||||||
if (isset($_POST["submit"])) {
|
if (isset($_POST["submit"])) {
|
||||||
extract($_POST);
|
extract($_POST);
|
||||||
$query = doquery("INSERT INTO {{table}} SET id='',postdate=NOW(),newpostdate=NOW(),author='".$userrow["charname"]."',parent='0',replies='0',title='$title',content='$content'", "forum");
|
$t = trim($_POST['title'] ?? '');
|
||||||
header("Location: forum.php");
|
$c = trim($_POST['content'] ?? '');
|
||||||
die();
|
db()->query('INSERT INTO forum (author, title, content) VALUES (?, ?, ?);', [$userrow['username'], $t, $c]);
|
||||||
|
redirect('forum.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
$page = "<table width=\"100%\"><tr><td><b>Make A New Post:</b><br /><br/ ><form action=\"forum.php?do=new\" method=\"post\">Title:<br /><input type=\"text\" name=\"title\" size=\"50\" maxlength=\"50\" /><br /><br />Message:<br /><textarea name=\"content\" rows=\"7\" cols=\"40\"></textarea><br /><br /><input type=\"submit\" name=\"submit\" value=\"Submit\" /> <input type=\"reset\" name=\"reset\" value=\"Reset\" /></form></td></tr></table>";
|
$page = "<table width=\"100%\"><tr><td><b>Make A New Post:</b><br><br/ ><form action=\"forum.php?do=new\" method=\"post\">Title:<br><input type=\"text\" name=\"title\" size=\"50\" maxlength=\"50\" /><br><br>Message:<br><textarea name=\"content\" rows=\"7\" cols=\"40\"></textarea><br><br><input type=\"submit\" name=\"submit\" value=\"Submit\" /> <input type=\"reset\" name=\"reset\" value=\"Reset\" /></form></td></tr></table>";
|
||||||
display($page, "Forum");
|
display($page, "Forum");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
826
public/help.php
826
public/help.php
|
@ -1,323 +1,567 @@
|
||||||
<?php
|
<?php
|
||||||
include('lib.php');
|
if (!file_exists('../.installed')) redirect('install.php');
|
||||||
$link = opendb();
|
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
require_once '../src/lib.php';
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
|
||||||
ob_start("ob_gzhandler");
|
$controlrow = get_control_row();
|
||||||
|
|
||||||
|
$page = $_GET['page'] ?? '';
|
||||||
|
if (!in_array($page, ['main', 'items', 'levels', 'monsters', 'spells'])) $page = 'main';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title><? echo $controlrow["gamename"]; ?> Help</title>
|
<title><?= $controlrow["gamename"] ?> Help</title>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
body {
|
body {
|
||||||
background-image: url(images/background.jpg);
|
background-image: url('images/background.jpg');
|
||||||
color: black;
|
color: black;
|
||||||
font: 11px verdana;
|
font: 11px verdana;
|
||||||
}
|
}
|
||||||
table {
|
table {
|
||||||
border-style: none;
|
border-style: none;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
font: 11px verdana;
|
font: 11px verdana;
|
||||||
}
|
}
|
||||||
td {
|
tr:nth-child(even) {
|
||||||
border-style: none;
|
background-color: white;
|
||||||
padding: 3px;
|
}
|
||||||
vertical-align: top;
|
td {
|
||||||
}
|
border-style: none;
|
||||||
td.top {
|
padding: 3px;
|
||||||
border-bottom: solid 2px black;
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
td.left {
|
td.top {
|
||||||
width: 150px;
|
border-bottom: solid 2px black;
|
||||||
border-right: solid 2px black;
|
}
|
||||||
}
|
td.left {
|
||||||
td.right {
|
width: 150px;
|
||||||
width: 150px;
|
border-right: solid 2px black;
|
||||||
border-left: solid 2px black;
|
}
|
||||||
}
|
td.right {
|
||||||
a {
|
width: 150px;
|
||||||
color: #663300;
|
border-left: solid 2px black;
|
||||||
text-decoration: none;
|
}
|
||||||
font-weight: bold;
|
a {
|
||||||
}
|
color: #663300;
|
||||||
a:hover {
|
text-decoration: none;
|
||||||
color: #330000;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
.small {
|
a:hover {
|
||||||
font: 10px verdana;
|
color: #330000;
|
||||||
}
|
}
|
||||||
.highlight {
|
.small {
|
||||||
color: red;
|
font: 10px verdana;
|
||||||
}
|
}
|
||||||
.light {
|
.highlight {
|
||||||
color: #999999;
|
color: red;
|
||||||
}
|
}
|
||||||
.title {
|
.light {
|
||||||
border: solid 1px black;
|
color: #999999;
|
||||||
background-color: #eeeeee;
|
}
|
||||||
font-weight: bold;
|
.title {
|
||||||
padding: 5px;
|
border: solid 1px black;
|
||||||
margin: 3px;
|
background-color: #eeeeee;
|
||||||
}
|
font-weight: bold;
|
||||||
.copyright {
|
padding: 5px;
|
||||||
border: solid 1px black;
|
margin: 3px;
|
||||||
background-color: #eeeeee;
|
}
|
||||||
font: 10px verdana;
|
.copyright {
|
||||||
}
|
border: solid 1px black;
|
||||||
</style>
|
background-color: #eeeeee;
|
||||||
|
font: 10px verdana;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<a name="top"></a>
|
<a name="top"></a>
|
||||||
<h1><? echo $controlrow["gamename"]; ?> Help</h1>
|
<h1><?= $controlrow["gamename"] ?> Help</h1>
|
||||||
[ <a href="index.php">Return to the game</a> ]
|
[ <a href="/index.php">Return to the game</a> ]
|
||||||
|
|
||||||
<br /><br /><hr />
|
<br><br><hr>
|
||||||
|
|
||||||
<h3>Table of Contents</h3>
|
<?php
|
||||||
<ul>
|
// @MAIN
|
||||||
<li /><a href="#intro">Introduction</a>
|
if ($page === 'main'):
|
||||||
<li /><a href="#classes">Character Classes</a>
|
?>
|
||||||
<li /><a href="#difficulties">Difficulty Levels</a>
|
<h3>Table of Contents</h3>
|
||||||
<li /><a href="#intown">Playing The Game: In Town</a>
|
<ul>
|
||||||
<li /><a href="#exploring">Playing The Game: Exploring & Fighting</a>
|
<li /><a href="#intro">Introduction</a>
|
||||||
<li /><a href="#status">Playing The Game: Status Panels</a>
|
<li /><a href="#classes">Character Classes</a>
|
||||||
<li /><a href="#items">Spoilers: Items & Drops</a>
|
<li /><a href="#intown">Playing The Game: In Town</a>
|
||||||
<li /><a href="#monsters">Spoilers: Monsters</a>
|
<li /><a href="#exploring">Playing The Game: Exploring & Fighting</a>
|
||||||
<li /><a href="#spells">Spoilers: Spells</a>
|
<li /><a href="#status">Playing The Game: Status Panels</a>
|
||||||
<li /><a href="#levels">Spoilers: Levels</a>
|
<li /><a href="#items">Spoilers: Items & Drops</a>
|
||||||
<li /><a href="#credits">Credits</a>
|
<li /><a href="#monsters">Spoilers: Monsters</a>
|
||||||
</ul>
|
<li /><a href="#spells">Spoilers: Spells</a>
|
||||||
|
<li /><a href="#levels">Spoilers: Levels</a>
|
||||||
|
<li /><a href="#credits">Credits</a>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<hr />
|
<hr>
|
||||||
|
|
||||||
<h3><a name="intro"></a>Introduction</h3>
|
<h3><a name="intro"></a>Introduction</h3>
|
||||||
Firstly, I'd like to say thank you for playing my game. The <i>Dragon Knight</i> game engine is the result of several months of
|
Firstly, I'd like to say thank you for playing my game. The <i>Dragon Knight</i> game engine is the result of several months of
|
||||||
planning, coding and testing. The original idea was to create a web-based tribute to the NES game, <i>Dragon
|
planning, coding and testing. The original idea was to create a web-based tribute to the NES game, <i>Dragon
|
||||||
Warrior</i>. In its current iteration, only the underlying fighting system really resembles that game, as almost
|
Warrior</i>. In its current iteration, only the underlying fighting system really resembles that game, as almost
|
||||||
everything else in DK has been made bigger and better. But you should still recognize bits and pieces as stemming
|
everything else in DK has been made bigger and better. But you should still recognize bits and pieces as stemming
|
||||||
from <i>Dragon Warrior</i> and other RPGs of old.<br /><br />
|
from <i>Dragon Warrior</i> and other RPGs of old.<br><br>
|
||||||
This is the first game I've ever written, and it has definitely been a positive experience. It got difficult at
|
This is the first game I've ever written, and it has definitely been a positive experience. It got difficult at
|
||||||
times, admittedly, but it was still a lot of fun to write, and even more fun to play. And I hope to use this
|
times, admittedly, but it was still a lot of fun to write, and even more fun to play. And I hope to use this
|
||||||
experience so that if I ever want to create another game it will be even better than this one.<br /><br />
|
experience so that if I ever want to create another game it will be even better than this one.<br><br>
|
||||||
If you are a site administrator, and would like to install a copy of DK on your own server, you may visit the
|
If you are a site administrator, and would like to install a copy of DK on your own server, you may visit the
|
||||||
<a href="http://dragon.se7enet.com/dev.php" target="_new">development site</a> for <i>Dragon Knight</i>. This page
|
<a href="http://dragon.se7enet.com/dev.php" target="_new">development site</a> for <i>Dragon Knight</i>. This page
|
||||||
includes the downloadable game souce code, as well as some other resources that developers and administrators may
|
includes the downloadable game souce code, as well as some other resources that developers and administrators may
|
||||||
find valuable.<br /><br />
|
find valuable.<br><br>
|
||||||
Once again, thanks for playing!<br /><br />
|
Once again, thanks for playing!<br><br>
|
||||||
<i>Jamin Seven</i><br />
|
<i>Jamin Seven</i><br>
|
||||||
<i>Dragon Knight creator</i><br />
|
<i>Dragon Knight creator</i><br>
|
||||||
<a href="http://www.se7enet.com" target="_new">My Homepage</a><br />
|
<a href="http://www.se7enet.com" target="_new">My Homepage</a><br>
|
||||||
<a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight Homepage</a><br ><br />
|
<a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight Homepage</a><br ><br>
|
||||||
[ <a href="#top">Top</a> ]
|
[ <a href="#top">Top</a> ]
|
||||||
|
|
||||||
<br /><br /><hr />
|
<br><br><hr>
|
||||||
|
|
||||||
<h3><a name="classes"></a>Character Classes</h3>
|
<h3><a name="classes"></a>Character Classes</h3>
|
||||||
There are three character classes in the game. The main differences between the classes are what spells you get
|
There are three character classes in the game. The main differences between the classes are what spells you get
|
||||||
access to, the speed with which you level up, and the amount of HP/MP/strength/dexterity you gain per level. Below
|
access to, the speed with which you level up, and the amount of HP/MP/strength/dexterity you gain per level. Below
|
||||||
is a basic outline of each of the character classes. For more detailed information about the characters, please
|
is a basic outline of each of the character classes. For more detailed information about the characters, please
|
||||||
view the Levels table at the bottom of this page. Also, note that the outline below refers to the stock class setup
|
view the Levels table at the bottom of this page. Also, note that the outline below refers to the stock class setup
|
||||||
for the game. If your administrator has used his/her own class setup, this information may not be accurate.<br /><br />
|
for the game. If your administrator has used his/her own class setup, this information may not be accurate.<br><br>
|
||||||
<b><? echo $controlrow["class1name"]; ?></b>
|
<b><?= $controlrow["class1name"] ?></b>
|
||||||
<ul>
|
<ul>
|
||||||
<li />Fast level-ups
|
<li>Fast level-ups</li>
|
||||||
<li />High hit points
|
<li>High hit points</li>
|
||||||
<li />High magic points
|
<li>High magic points</li>
|
||||||
<li />Low strength
|
<li>Low strength</li>
|
||||||
<li />Low dexterity
|
<li>Low dexterity</li>
|
||||||
<li />5 heal spells
|
<li>5 heal spells</li>
|
||||||
<li />5 hurt spells
|
<li>5 hurt spells</li>
|
||||||
<li />3 sleep spells
|
<li>3 sleep spells</li>
|
||||||
<li />3 +defense spells
|
<li>3 +defense spells</li>
|
||||||
<li />0 +attack spells
|
<li>0 +attack spells</li>
|
||||||
</ul>
|
</ul>
|
||||||
<b><? echo $controlrow["class2name"]; ?></b>
|
<b><?= $controlrow["class2name"] ?></b>
|
||||||
<ul>
|
<ul>
|
||||||
<li />Medium level-ups
|
<li>Medium level-ups</li>
|
||||||
<li />Medium hit points
|
<li>Medium hit points</li>
|
||||||
<li />Low magic points
|
<li>Low magic points</li>
|
||||||
<li />High strength
|
<li>High strength</li>
|
||||||
<li />Low dexterity
|
<li>Low dexterity</li>
|
||||||
<li />3 heal spells
|
<li>3 heal spells</li>
|
||||||
<li />3 hurt spells
|
<li>3 hurt spells</li>
|
||||||
<li />2 sleep spells
|
<li>2 sleep spells</li>
|
||||||
<li />3 +defense spells
|
<li>3 +defense spells</li>
|
||||||
<li />3 +attack spells
|
<li>3 +attack spells</li>
|
||||||
</ul>
|
</ul>
|
||||||
<b><? echo $controlrow["class3name"]; ?></b>
|
<b><?= $controlrow["class3name"] ?></b>
|
||||||
<ul>
|
<ul>
|
||||||
<li />Slow level-ups
|
<li>Slow level-ups</li>
|
||||||
<li />Medium hit points
|
<li>Medium hit points</li>
|
||||||
<li />Medium magic points
|
<li>Medium magic points</li>
|
||||||
<li />Low strength
|
<li>Low strength</li>
|
||||||
<li />High dexterity
|
<li>High dexterity</li>
|
||||||
<li />4 heal spells
|
<li>4 heal spells</li>
|
||||||
<li />4 hurt spells
|
<li>4 hurt spells</li>
|
||||||
<li />3 sleep spells
|
<li>3 sleep spells</li>
|
||||||
<li />2 +defense spells
|
<li>2 +defense spells</li>
|
||||||
<li />2 +attack spells
|
<li>2 +attack spells</li>
|
||||||
</ul>
|
</ul>
|
||||||
[ <a href="#top">Top</a> ]
|
[ <a href="#top">Top</a> ]
|
||||||
|
|
||||||
<br /><br /><hr />
|
<br><br><hr>
|
||||||
|
|
||||||
<h3><a name="difficulties"></a>Difficulty Levels</h3>
|
<h3><a name="intown"></a>Playing The Game: In Town</h3>
|
||||||
<i><? echo $controlrow["gamename"]; ?></i> includes the ability to play using one of three difficulty levels.
|
When you begin a new game, the first thing you see is the Town screen. Towns serve four primary functions: healing, buying items,
|
||||||
All monster statistics in the game are set at a base number. However, using a difficulty multiplier, certain statistics
|
buying maps, and displaying game information.<br><br>
|
||||||
are increased. The amount of hit points a monster has goes up, which means it will take longer to kill. But the amount
|
To heal yourself, click the "Rest at the Inn" link at the top of the town screen. Each town's Inn has a different price - some towns
|
||||||
of experience and gold you gain from killing it also goes up. So the game is a little bit harder, but it is also more
|
are cheap, others are expensive. No matter what town you're in, the Inns always serve the same function: they restore your current
|
||||||
rewarding. The following are the three difficulty levels and their statistic multiplier, which applies to the monster's
|
hit points, magic points, and travel points to their maximum amounts. Out in the field, you are free to use healing spells to restore
|
||||||
HP, experience drop, and gold drop.
|
your hit points, but when you run low on magic points, the only way to restore them is at an Inn.<br><br>
|
||||||
<ul>
|
Buying weapons and armor is accomplished through the appropriately-named "Buy Weapons/Armor" link. Not every item is available in
|
||||||
<li /><? echo $controlrow["diff1name"] . ": <b>" . $controlrow["diff1mod"] . "</b>"; ?>
|
every town, so in order to get the most powerful items, you'll need to explore some of the outer towns. Once you've clicked the link,
|
||||||
<li /><? echo $controlrow["diff2name"] . ": <b>" . $controlrow["diff2mod"] . "</b>"; ?>
|
you are presented with a list of items available in this town's store. To the left of each item is an icon that represents its type:
|
||||||
<li /><? echo $controlrow["diff3name"] . ": <b>" . $controlrow["diff3mod"] . "</b>"; ?>
|
weapon, armor or shield. The amount of attack/defense power, as well as the item's price, are displayed to the right of the item name.
|
||||||
</ul>
|
You'll notice that some items have a red asterisk (<span class="highlight">*</span>) next to their names. These are items that come
|
||||||
[ <a href="#top">Top</a> ]
|
with special attributes that modify other parts of your character profile. See the Items & Drops table at the bottom of this page for
|
||||||
|
more information about special items.<br><br>
|
||||||
|
Maps are the third function in towns. Buying a map to a town places the town in your Travel To box in the left status panel. Once
|
||||||
|
you've purchased a town's map, you can click its name from your Travel To box and you will jump to that town. Travelling this way
|
||||||
|
costs travel points, though, and you'll only be able to visit towns if you have enough travel points.<br><br>
|
||||||
|
The final function in towns is displaying game information and statistics. This includes the latest news post made by the game
|
||||||
|
administrator, a list of players who have been online recently, and the Babble Box.<br><br>
|
||||||
|
[ <a href="#top">Top</a> ]
|
||||||
|
|
||||||
<br /><br /><hr />
|
<br><br><hr>
|
||||||
|
|
||||||
<h3><a name="intown"></a>Playing The Game: In Town</h3>
|
<h3><a name="exploring"></a>Playing The Game: Exploring & Fighting</h3>
|
||||||
When you begin a new game, the first thing you see is the Town screen. Towns serve four primary functions: healing, buying items,
|
Once you're done in town, you are free to start exploring the world. Use the compass buttons on the left status panel to move around.
|
||||||
buying maps, and displaying game information.<br /><br />
|
The game world is basically a big square, divided into four quadrants. Each quadrant is <?= $controlrow["gamesize"] ?> spaces
|
||||||
To heal yourself, click the "Rest at the Inn" link at the top of the town screen. Each town's Inn has a different price - some towns
|
square. The first town is usually located at (0N,0E). Click the North button from the first town, and now you'll be at (1N,0E).
|
||||||
are cheap, others are expensive. No matter what town you're in, the Inns always serve the same function: they restore your current
|
Likewise, if you now click the West button, you'll be at (1N,1W). Monster levels increase with every 5 spaces you move outward
|
||||||
hit points, magic points, and travel points to their maximum amounts. Out in the field, you are free to use healing spells to restore
|
from (0N,0E).<br><br>
|
||||||
your hit points, but when you run low on magic points, the only way to restore them is at an Inn.<br /><br />
|
While you're exploring, you will occasionally run into monsters. As in pretty much any other RPG game, you and the monster take turns
|
||||||
Buying weapons and armor is accomplished through the appropriately-named "Buy Weapons/Armor" link. Not every item is available in
|
hitting each other in an attempt to reduce each other's hit points to zero. Once you run into a monster, the Exploring screen changes
|
||||||
every town, so in order to get the most powerful items, you'll need to explore some of the outer towns. Once you've clicked the link,
|
to the Fighting screen.<br><br>
|
||||||
you are presented with a list of items available in this town's store. To the left of each item is an icon that represents its type:
|
When a fight begins, you'll see the monster's name and hit points, and the game will ask you for your first command. You then get to
|
||||||
weapon, armor or shield. The amount of attack/defense power, as well as the item's price, are displayed to the right of the item name.
|
pick whether you want to fight, use a spell, or run away. Note, though, that sometimes the monster has the chance to hit you
|
||||||
You'll notice that some items have a red asterisk (<span class="highlight">*</span>) next to their names. These are items that come
|
first.<br><br>
|
||||||
with special attributes that modify other parts of your character profile. See the Items & Drops table at the bottom of this page for
|
The Fight button is pretty straightforward: you attack the monster, and the amount of damage dealt is based on your attack power and
|
||||||
more information about special items.<br /><br />
|
the monster's armor. On top of that, there are two other things that can happen: an Excellent Hit, which doubles your total attack
|
||||||
Maps are the third function in towns. Buying a map to a town places the town in your Travel To box in the left status panel. Once
|
damage; and a monster dodge, which results in you doing no damage to the monster.<br><br>
|
||||||
you've purchased a town's map, you can click its name from your Travel To box and you will jump to that town. Travelling this way
|
The Spell button allows you to pick an available spell and cast it. See the Spells list at the bottom of this page for more information
|
||||||
costs travel points, though, and you'll only be able to visit towns if you have enough travel points.<br /><br />
|
about spells.<br><br>
|
||||||
The final function in towns is displaying game information and statistics. This includes the latest news post made by the game
|
Finally, there is the Run button, which lets you run away from a fight if the monster is too powerful. Be warned, though: it is
|
||||||
administrator, a list of players who have been online recently, and the Babble Box.<br /><br />
|
possible for the monster to block you from running and attack you. So if your hit points are low, you may fare better by staying
|
||||||
[ <a href="#top">Top</a> ]
|
around monsters that you know can't do much damage to you.<br><br>
|
||||||
|
Once you've had your turn, the monster also gets his turn. It is also possible for you to dodge the monster's attack and take no
|
||||||
|
damage.<br><br>
|
||||||
|
The end result of a fight is either you or the monster being knocked down to zero hit points. If you win, the monster dies and will
|
||||||
|
give you a certain amount of experience and gold. There is also a chance that the monster will drop an item, which you can put into
|
||||||
|
one of the three inventory slots to give you extra points in your character profile. If you lose and die, half of your gold is taken
|
||||||
|
away - however, you are given back a few hit points to help you make it back to town (for example, if you don't have enough gold to
|
||||||
|
pay for an Inn, and need to kill a couple low-level monsters to get the money).<br><br>
|
||||||
|
When the fight is over, you can continue exploring until you find another monster to beat into submission.<br><br>
|
||||||
|
[ <a href="#top">Top</a> ]
|
||||||
|
|
||||||
<br /><br /><hr />
|
<br><br><hr>
|
||||||
|
|
||||||
<h3><a name="exploring"></a>Playing The Game: Exploring & Fighting</h3>
|
<h3><a name="status"></a>Playing The Game: Status Panels</h3>
|
||||||
Once you're done in town, you are free to start exploring the world. Use the compass buttons on the left status panel to move around.
|
There are two status panels on the game screen: left and right.<br><br>
|
||||||
The game world is basically a big square, divided into four quadrants. Each quadrant is <? echo $controlrow["gamesize"]; ?> spaces
|
The left panel inclues your current location and play status (In Town, Exploring, Fighting), compass buttons for movement, and the
|
||||||
square. The first town is usually located at (0N,0E). Click the North button from the first town, and now you'll be at (1N,0E).
|
Travel To list for jumping between towns. At the bottom of the left panel is also a list of game functions.<br><br>
|
||||||
Likewise, if you now click the West button, you'll be at (1N,1W). Monster levels increase with every 5 spaces you move outward
|
The right panel displays some character statistics, your inventory, and quick spells.<br><br>
|
||||||
from (0N,0E).<br /><br />
|
The Character section shows the most important character statistics. It also displays the status bars for your current hit points,
|
||||||
While you're exploring, you will occasionally run into monsters. As in pretty much any other RPG game, you and the monster take turns
|
magic points and travel points. These status bars are colored either green, yellow or red depending on your current amount of each
|
||||||
hitting each other in an attempt to reduce each other's hit points to zero. Once you run into a monster, the Exploring screen changes
|
stat. There is also a link to pop up your list of extended statistics, which shows more detailed character information.<br><br>
|
||||||
to the Fighting screen.<br /><br />
|
The Fast Spells section lists any Heal spells you've learned. You may use these links any time you are in town or exploring to cast
|
||||||
When a fight begins, you'll see the monster's name and hit points, and the game will ask you for your first command. You then get to
|
the heal spell. These may not be used during fights, however - you have to use the Spells box on the fight screen for that.
|
||||||
pick whether you want to fight, use a spell, or run away. Note, though, that sometimes the monster has the chance to hit you
|
[ <a href="#top">Top</a> ]
|
||||||
first.<br /><br />
|
|
||||||
The Fight button is pretty straightforward: you attack the monster, and the amount of damage dealt is based on your attack power and
|
|
||||||
the monster's armor. On top of that, there are two other things that can happen: an Excellent Hit, which doubles your total attack
|
|
||||||
damage; and a monster dodge, which results in you doing no damage to the monster.<br /><br />
|
|
||||||
The Spell button allows you to pick an available spell and cast it. See the Spells list at the bottom of this page for more information
|
|
||||||
about spells.<br /><br />
|
|
||||||
Finally, there is the Run button, which lets you run away from a fight if the monster is too powerful. Be warned, though: it is
|
|
||||||
possible for the monster to block you from running and attack you. So if your hit points are low, you may fare better by staying
|
|
||||||
around monsters that you know can't do much damage to you.<br /><br />
|
|
||||||
Once you've had your turn, the monster also gets his turn. It is also possible for you to dodge the monster's attack and take no
|
|
||||||
damage.<br /><br />
|
|
||||||
The end result of a fight is either you or the monster being knocked down to zero hit points. If you win, the monster dies and will
|
|
||||||
give you a certain amount of experience and gold. There is also a chance that the monster will drop an item, which you can put into
|
|
||||||
one of the three inventory slots to give you extra points in your character profile. If you lose and die, half of your gold is taken
|
|
||||||
away - however, you are given back a few hit points to help you make it back to town (for example, if you don't have enough gold to
|
|
||||||
pay for an Inn, and need to kill a couple low-level monsters to get the money).<br /><br />
|
|
||||||
When the fight is over, you can continue exploring until you find another monster to beat into submission.<br /><br />
|
|
||||||
[ <a href="#top">Top</a> ]
|
|
||||||
|
|
||||||
<br /><br /><hr />
|
<br><br><hr>
|
||||||
|
|
||||||
<h3><a name="status"></a>Playing The Game: Status Panels</h3>
|
<h3><a name="items"></a>Spoilers: Items & Drops</h3>
|
||||||
There are two status panels on the game screen: left and right.<br /><br />
|
<a href="help.php?page=items">Click here</a> for the Items & Drops spoiler page.<br><br>
|
||||||
The left panel inclues your current location and play status (In Town, Exploring, Fighting), compass buttons for movement, and the
|
[ <a href="#top">Top</a> ]
|
||||||
Travel To list for jumping between towns. At the bottom of the left panel is also a list of game functions.<br /><br />
|
|
||||||
The right panel displays some character statistics, your inventory, and quick spells.<br /><br />
|
|
||||||
The Character section shows the most important character statistics. It also displays the status bars for your current hit points,
|
|
||||||
magic points and travel points. These status bars are colored either green, yellow or red depending on your current amount of each
|
|
||||||
stat. There is also a link to pop up your list of extended statistics, which shows more detailed character information.<br /><br />
|
|
||||||
The Fast Spells section lists any Heal spells you've learned. You may use these links any time you are in town or exploring to cast
|
|
||||||
the heal spell. These may not be used during fights, however - you have to use the Spells box on the fight screen for that.
|
|
||||||
[ <a href="#top">Top</a> ]
|
|
||||||
|
|
||||||
<br /><br /><hr />
|
<br><br><hr>
|
||||||
|
|
||||||
<h3><a name="items"></a>Spoilers: Items & Drops</h3>
|
<h3><a name="monsters"></a>Spoilers: Monsters</h3>
|
||||||
<a href="help_items.php">Click here</a> for the Items & Drops spoiler page.<br /><br />
|
<a href="help.php?page=monsters">Click here</a> for the Monsters spoiler page.<br><br>
|
||||||
[ <a href="#top">Top</a> ]
|
[ <a href="#top">Top</a> ]
|
||||||
|
|
||||||
<br /><br /><hr />
|
<br><br><hr>
|
||||||
|
|
||||||
<h3><a name="monsters"></a>Spoilers: Monsters</h3>
|
<h3><a name="spells"></a>Spoilers: Spells</h3>
|
||||||
<a href="help_monsters.php">Click here</a> for the Monsters spoiler page.<br /><br />
|
<a href="help.php?page=spells">Click here</a> for the Spells spoiler page.<br><br>
|
||||||
[ <a href="#top">Top</a> ]
|
[ <a href="#top">Top</a> ]
|
||||||
|
|
||||||
<br /><br /><hr />
|
<br><br><hr>
|
||||||
|
|
||||||
<h3><a name="spells"></a>Spoilers: Spells</h3>
|
<h3><a name="levels"></a>Spoilers: Levels</h3>
|
||||||
<a href="help_spells.php">Click here</a> for the Spells spoiler page.<br /><br />
|
<a href="help.php?page=levels">Click here</a> for the Levels spoiler page.<br><br>
|
||||||
[ <a href="#top">Top</a> ]
|
[ <a href="#top">Top</a> ]
|
||||||
|
|
||||||
<br /><br /><hr />
|
<br><br><hr>
|
||||||
|
|
||||||
<h3><a name="levels"></a>Spoilers: Levels</h3>
|
<h3><a name="credits"></a>Credits</h3>
|
||||||
<a href="help_levels.php">Click here</a> for the Levels spoiler page.<br /><br />
|
<ul>
|
||||||
[ <a href="#top">Top</a> ]
|
<li><b>All program code and stock graphics for the game were created by Jamin Seven</b>.<br><br></li>
|
||||||
|
<li>Major props go to a few people on the PHP manual site, for help with various chunks of code. The specific people are listed in the source code.<br><br></li>
|
||||||
|
<li>Super monkey love goes to Enix and the developers of <i>Dragon Warrior</i>. If it weren't for you guys, my game never would have been made.<br><br></li>
|
||||||
|
<li>Mega props go to Dalez from GameFAQs for his DW3 experience chart, which was where I got my experience levels from.<br><br></li>
|
||||||
|
<li>
|
||||||
|
Mad crazy ninja love goes to the following people for help and support throughout the development process:<br><br>
|
||||||
|
<b>Ideas:</b> (whether they got used or not)
|
||||||
|
<ul>
|
||||||
|
<li>kushet</li>
|
||||||
|
<li>lghtning</li>
|
||||||
|
<li>Ebolamonkey3000</li>
|
||||||
|
<li>Crimson Scythe</li>
|
||||||
|
<li>SilDeath</li>
|
||||||
|
</ul>
|
||||||
|
<b>Beta Testing:</b> (forums name if applicable, character name otherwise)
|
||||||
|
<ul>
|
||||||
|
<li>Ebolamonkey3000</li>
|
||||||
|
<li>lisi</li>
|
||||||
|
<li>Junglist</li>
|
||||||
|
<li>Crimson Scythe</li>
|
||||||
|
<li>Sk8erpunk69</li>
|
||||||
|
<li>lghtning</li>
|
||||||
|
<li>kushet</li>
|
||||||
|
<li>SilDeath</li>
|
||||||
|
<li>lowrider4life</li>
|
||||||
|
<li>dubiin</li>
|
||||||
|
<li>Sam Wise The Great</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
Apologies and lots of happy naked love to anyone I forgot. <br><br>
|
||||||
|
And of course, thanks to <b>you</b> for playing my game! <br><br>
|
||||||
|
<a href="/index.php?do=ninja">NINJA!</a> <br><br>
|
||||||
|
[ <a href="#top">Top</a> ]
|
||||||
|
|
||||||
<br /><br /><hr />
|
<br><br><hr><br>
|
||||||
|
|
||||||
<h3><a name="credits"></a>Credits</h3>
|
Please visit the following sites for more information:<br>
|
||||||
<ul>
|
<a href="http://www.se7enet.com" target="_new">Se7enet</a> (Jamin's homepage)<br>
|
||||||
<li /><b>All program code and stock graphics for the game were created by Jamin Seven</b>.<br /><br />
|
<a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight</a> (official DK homepage)<br>
|
||||||
<li />Major props go to a few people on the PHP manual site, for help with various chunks of code. The specific people are listed in the source code.<br /><br />
|
<a href="http://se7enet.com/forums" target="_new">Forums</a> (official DK forums)<br><br>
|
||||||
<li />Super monkey love goes to Enix and the developers of <i>Dragon Warrior</i>. If it weren't for you guys, my game never would have been made.<br /><br />
|
All original coding and graphics for the <i>Dragon Knight</i> game engine are © 2003-2005 by Jamin Seven.<br><br>
|
||||||
<li />Mega props go to Dalez from GameFAQs for his DW3 experience chart, which was where I got my experience levels from.<br /><br />
|
[ <a href="#top">Top</a> ]
|
||||||
<li />Mad crazy ninja love goes to the following people for help and support throughout the development process:<br /><br />
|
|
||||||
<b>Ideas:</b> (whether they got used or not)
|
|
||||||
<ul>
|
|
||||||
<li />kushet
|
|
||||||
<li />lghtning
|
|
||||||
<li />Ebolamonkey3000
|
|
||||||
<li />Crimson Scythe
|
|
||||||
<li />SilDeath
|
|
||||||
</ul><br />
|
|
||||||
<b>Beta Testing:</b> (forums name if applicable, character name otherwise)
|
|
||||||
<ul>
|
|
||||||
<li />Ebolamonkey3000
|
|
||||||
<li />lisi
|
|
||||||
<li />Junglist
|
|
||||||
<li />Crimson Scythe
|
|
||||||
<li />Sk8erpunk69
|
|
||||||
<li />lghtning
|
|
||||||
<li />kushet
|
|
||||||
<li />SilDeath
|
|
||||||
<li />lowrider4life
|
|
||||||
<li />dubiin
|
|
||||||
<li />Sam Wise The Great
|
|
||||||
</ul><br />
|
|
||||||
<li />Apologies and lots of happy naked love to anyone I forgot.<br /><br />
|
|
||||||
<li />And of course, thanks to <b>you</b> for playing my game!<br /><br />
|
|
||||||
<li /><a href="../index.php?do=ninja">NINJA!</a>
|
|
||||||
</ul>
|
|
||||||
[ <a href="#top">Top</a> ]
|
|
||||||
|
|
||||||
<br /><br /><hr /><br />
|
<?php
|
||||||
|
endif;
|
||||||
|
// @MAIN END
|
||||||
|
?>
|
||||||
|
|
||||||
Please visit the following sites for more information:<br />
|
<?php
|
||||||
<a href="http://www.se7enet.com" target="_new">Se7enet</a> (Jamin's homepage)<br />
|
// @ITEMS
|
||||||
<a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight</a> (official DK homepage)<br />
|
if ($page === 'items'):
|
||||||
<a href="http://se7enet.com/forums" target="_new">Forums</a> (official DK forums)<br /><br />
|
?>
|
||||||
All original coding and graphics for the <i>Dragon Knight</i> game engine are © 2003-2005 by Jamin Seven.<br /><br />
|
|
||||||
[ <a href="#top">Top</a> ]
|
<table width="60%" style="border: solid 1px black" cellspacing="0" cellpadding="0">
|
||||||
<br /><br />
|
<tr><td colspan="5" bgcolor="#ffffff"><center><b>Items</b></center></td></tr>
|
||||||
<table class="copyright" width="100%"><tr>
|
<tr><td><b>Type</b></td><td><b>Name</b></td><td><b>Cost</b></td><td><b>Attribute</b></td><td><b>Special</b></td></tr>
|
||||||
<td width="50%" align="center">Powered by <a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight</a></td><td width="50%" align="center">© 2003-2006 by renderse7en</td>
|
<?php
|
||||||
</tr></table>
|
$items = db()->query('SELECT * FROM items ORDER BY id;');
|
||||||
|
$item_types = [1 => ['weapon', 'Attack'], 2 => ['armor', 'Defense'], 3 => ['shield', 'Defense']];
|
||||||
|
|
||||||
|
while ($item = $items->fetchArray(SQLITE3_ASSOC)) {
|
||||||
|
$image = $item_types[$item['type']][0];
|
||||||
|
$power = $item_types[$item['type']][1];
|
||||||
|
|
||||||
|
if ($item['special'] !== 'X') {
|
||||||
|
$special = explode(',', $item['special']);
|
||||||
|
$attr = special_to_string($special[0]);
|
||||||
|
$stat = (($special[1] > 0) ? '+' : '') . $special[1];
|
||||||
|
$bigspecial = "$attr $stat";
|
||||||
|
} else {
|
||||||
|
$bigspecial = '<span class="light">None</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<tr><td width=\"5%\"><img src=\"images/icon_$image.gif\" alt=\"$image\"></td><td width=\"30%\">".$item["name"]."</td><td width=\"20%\">".$item["buycost"]." Gold</td><td width=\"20%\">".$item["attribute"]." $power Power</td><td width=\"25%\">$bigspecial</td></tr>\n";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<table width="60%" style="border: solid 1px black" cellspacing="0" cellpadding="0">
|
||||||
|
<tr><td colspan="4" bgcolor="#ffffff"><center><b>Drops</b></center></td></tr>
|
||||||
|
<tr><td><b>Name</b></td><td><b>Monster Level</b></td><td><b>Attribute 1</b></td><td><b>Attribute 2</b></td></tr>
|
||||||
|
<?php
|
||||||
|
$drops = db()->query('SELECT * FROM drops ORDER BY id;');
|
||||||
|
|
||||||
|
while ($drop = $drops->fetchArray(SQLITE3_ASSOC)) {
|
||||||
|
if ($drop["attribute1"] !== "X") {
|
||||||
|
$special = explode(',', $drop['attribute1']);
|
||||||
|
$attr = special_to_string($special[0]);
|
||||||
|
$stat = (($special[1] > 0) ? '+' : '') . $special[1];
|
||||||
|
$bigspecial1 = "$attr $stat";
|
||||||
|
} else {
|
||||||
|
$bigspecial1 = '<span class="light">None</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($drop["attribute2"] !== "X") {
|
||||||
|
$special = explode(',', $drop['attribute2']);
|
||||||
|
$attr = special_to_string($special[0]);
|
||||||
|
$stat = (($special[1] > 0) ? '+' : '') . $special[1];
|
||||||
|
$bigspecial2 = "$attr $stat";
|
||||||
|
} else {
|
||||||
|
$bigspecial2 = '<span class="light">None</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<tr><td width=\"25%\">".$drop["name"]."</td><td width=\"15%\">".$drop["mlevel"]."</td><td width=\"30%\">$bigspecial1</td><td width=\"30%\">$bigspecial2</td></tr>\n";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
endif;
|
||||||
|
// @ITEMS END
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// @SPELLS
|
||||||
|
if ($page === 'spells'):
|
||||||
|
?>
|
||||||
|
|
||||||
|
<table width="50%" style="border: solid 1px black" cellspacing="0" cellpadding="0">
|
||||||
|
<tr><td colspan="8" bgcolor="#ffffff"><center><b>Spells</b></center></td></tr>
|
||||||
|
<tr><td><b>Name</b></td><td><b>Cost</b></td><td><b>Type</b></td><td><b>Attribute</b></td></tr>
|
||||||
|
<?php
|
||||||
|
$spells = db()->query('SELECT * FROM spells ORDER BY id;');
|
||||||
|
$spell_types = ['None', 'Heal', 'Hurt', 'Sleep', '+Damage (%)', '+Defense (%)'];
|
||||||
|
while ($spell = $spells->fetchArray(SQLITE3_ASSOC)) {
|
||||||
|
echo <<<HTML
|
||||||
|
<tr><td width="25%">{$spell["name"]}</td>
|
||||||
|
<td width="25%">{$spell["mp"]}</td>
|
||||||
|
<td width="25%">{$spell_types[$spell['type']]}</td>
|
||||||
|
<td width="25%">{$spell["attribute"]}</td></tr>
|
||||||
|
HTML;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
<ul>
|
||||||
|
<li><b>Heal</b> spells always give you the maximum amount possible, until your current HP is full.</li>
|
||||||
|
<li><b>Hurt</b> spells deal X damage (not always the maximum) to the monster, regardless of the monster's armor.</li>
|
||||||
|
<li><b>Sleep</b> spells put the monster to sleep. The monster has an X in 15 chance of remaining asleep each turn.</li>
|
||||||
|
<li><b>+Damage</b> spells increase your total attack damage by X percent until the end of the fight.</li>
|
||||||
|
<li><b>+Defense</b> spells reduce the total damage you take from the monster by X percent until the end of each fight.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
endif;
|
||||||
|
// @SPELLS END
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// @MONSTERS
|
||||||
|
if ($page === 'monsters'):
|
||||||
|
?>
|
||||||
|
|
||||||
|
<table width="75%" style="border: solid 1px black" cellspacing="0" cellpadding="0">
|
||||||
|
<tr><td colspan="8" bgcolor="#ffffff"><center><b>Monsters</b></center></td></tr>
|
||||||
|
<tr><td><b>Name</b></td><td><b>Max HP</b></td><td><b>Max Damage</b></td><td><b>Armor</b></td><td><b>Level</b></td><td><b>Max Exp.</b></td><td><b>Max Gold</b></td><td><b>Immunity</b></td></tr>
|
||||||
|
<?php
|
||||||
|
$monsters = db()->query('SELECT * FROM monsters ORDER BY id;');
|
||||||
|
$immunities = ['<span class="light">None</span>', 'Hurt', 'Hurt & Sleep'];
|
||||||
|
|
||||||
|
while ($m = $monsters->fetchArray(SQLITE3_ASSOC)) {
|
||||||
|
$immune = $immunities[$m['immune']] ?? 'Unknown';
|
||||||
|
echo "<tr><td width=\"30%\">".$m["name"]."</td><td width=\"10%\">".$m["maxhp"]."</td><td width=\"10%\">".$m["maxdam"]."</td><td width=\"10%\">".$m["armor"]."</td><td width=\"10%\">".$m["level"]."</td><td width=\"10%\">".$m["maxexp"]."</td><td width=\"10%\">".$m["maxgold"]."</td><td width=\"20%\">$immune</td></tr>\n";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
endif;
|
||||||
|
// @MONSTERS END
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// @LEVELS
|
||||||
|
if ($page === 'levels'):
|
||||||
|
|
||||||
|
$rows = [];
|
||||||
|
|
||||||
|
$levels = db()->query('SELECT * FROM levels ORDER BY id;');
|
||||||
|
while ($level = $levels->fetchArray(SQLITE3_ASSOC)) {
|
||||||
|
$class_data = [1 => [], 2 => [], 3 => []];
|
||||||
|
|
||||||
|
foreach ($level as $column => $value) {
|
||||||
|
if ($column === 'id') continue;
|
||||||
|
|
||||||
|
$parts = explode('_', $column);
|
||||||
|
$class_number = (int) $parts[0];
|
||||||
|
$attribute = $parts[1];
|
||||||
|
|
||||||
|
if (in_array($class_number, [1, 2, 3])) {
|
||||||
|
$class_data[$class_number][$level['id']][$attribute] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$rows[$level['id']] = $class_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
$spells = [];
|
||||||
|
$spells_query = db()->query('SELECT * FROM spells ORDER BY id;');
|
||||||
|
while ($spell = $spells_query->fetchArray(SQLITE3_ASSOC)) {
|
||||||
|
$spells[$spell['id']] = $spell;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<table width="50%" style="border: solid 1px black" cellspacing="0" cellpadding="0">
|
||||||
|
<tr><td colspan="8" bgcolor="#ffffff"><center><b><? echo $controlrow["class1name"]; ?> Levels</b></center></td></tr>
|
||||||
|
<tr><td><b>Level</b><td><b>Exp.</b></td><td><b>HP</b></td><td><b>MP</b></td><td><b>TP</b></td><td><b>Strength</b></td><td><b>Dexterity</b></td><td><b>Spell</b></td></tr>
|
||||||
|
<?php
|
||||||
|
foreach ($rows as $level => $class_data) {
|
||||||
|
$level_data = $class_data[1][$level];
|
||||||
|
|
||||||
|
$spell_name = '';
|
||||||
|
if (!empty($level_data['spells'])) $spell_name = $spells[$level_data['spells']]['name'];
|
||||||
|
|
||||||
|
echo '<tr>';
|
||||||
|
echo '<td>' . $level . '</td>';
|
||||||
|
echo '<td>' . ($level_data['exp'] ?? '') . '</td>';
|
||||||
|
echo '<td>' . ($level_data['hp'] ?? '') . '</td>';
|
||||||
|
echo '<td>' . ($level_data['mp'] ?? '') . '</td>';
|
||||||
|
echo '<td>' . ($level_data['tp'] ?? '') . '</td>';
|
||||||
|
echo '<td>' . ($level_data['strength'] ?? '') . '</td>';
|
||||||
|
echo '<td>' . ($level_data['dexterity'] ?? '') . '</td>';
|
||||||
|
echo '<td>' . (!empty($spell_name) ? $spell_name : '<span class="light">None</span>') . '</td>';
|
||||||
|
echo '</tr>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<table width="50%" style="border: solid 1px black" cellspacing="0" cellpadding="0">
|
||||||
|
<tr><td colspan="8" bgcolor="#ffffff"><center><b><? echo $controlrow["class2name"]; ?> Levels</b></center></td></tr>
|
||||||
|
<tr><td><b>Level</b><td><b>Exp.</b></td><td><b>HP</b></td><td><b>MP</b></td><td><b>TP</b></td><td><b>Strength</b></td><td><b>Dexterity</b></td><td><b>Spell</b></td></tr>
|
||||||
|
<?php
|
||||||
|
foreach ($rows as $level => $class_data) {
|
||||||
|
$level_data = $class_data[2][$level];
|
||||||
|
|
||||||
|
$spell_name = '';
|
||||||
|
if (!empty($level_data['spells'])) $spell_name = $spells[$level_data['spells']]['name'];
|
||||||
|
|
||||||
|
echo '<tr>';
|
||||||
|
echo '<td>' . $level . '</td>';
|
||||||
|
echo '<td>' . ($level_data['exp'] ?? '') . '</td>';
|
||||||
|
echo '<td>' . ($level_data['hp'] ?? '') . '</td>';
|
||||||
|
echo '<td>' . ($level_data['mp'] ?? '') . '</td>';
|
||||||
|
echo '<td>' . ($level_data['tp'] ?? '') . '</td>';
|
||||||
|
echo '<td>' . ($level_data['strength'] ?? '') . '</td>';
|
||||||
|
echo '<td>' . ($level_data['dexterity'] ?? '') . '</td>';
|
||||||
|
echo '<td>' . (!empty($spell_name) ? $spell_name : '<span class="light">None</span>') . '</td>';
|
||||||
|
echo '</tr>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<table width="50%" style="border: solid 1px black" cellspacing="0" cellpadding="0">
|
||||||
|
<tr><td colspan="8" bgcolor="#ffffff"><center><b><? echo $controlrow["class3name"]; ?> Levels</b></center></td></tr>
|
||||||
|
<tr><td><b>Level</b><td><b>Exp.</b></td><td><b>HP</b></td><td><b>MP</b></td><td><b>TP</b></td><td><b>Strength</b></td><td><b>Dexterity</b></td><td><b>Spell</b></td></tr>
|
||||||
|
<?php
|
||||||
|
foreach ($rows as $level => $class_data) {
|
||||||
|
$level_data = $class_data[3][$level];
|
||||||
|
|
||||||
|
$spell_name = '';
|
||||||
|
if (!empty($level_data['spells'])) $spell_name = $spells[$level_data['spells']]['name'];
|
||||||
|
|
||||||
|
echo '<tr>';
|
||||||
|
echo '<td>' . $level . '</td>';
|
||||||
|
echo '<td>' . ($level_data['exp'] ?? '') . '</td>';
|
||||||
|
echo '<td>' . ($level_data['hp'] ?? '') . '</td>';
|
||||||
|
echo '<td>' . ($level_data['mp'] ?? '') . '</td>';
|
||||||
|
echo '<td>' . ($level_data['tp'] ?? '') . '</td>';
|
||||||
|
echo '<td>' . ($level_data['strength'] ?? '') . '</td>';
|
||||||
|
echo '<td>' . ($level_data['dexterity'] ?? '') . '</td>';
|
||||||
|
echo '<td>' . (!empty($spell_name) ? $spell_name : '<span class="light">None</span>') . '</td>';
|
||||||
|
echo '</tr>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
Experience points listed are total values up until that point. All other values are just the new amount that you gain for each level.
|
||||||
|
|
||||||
|
<?php
|
||||||
|
endif;
|
||||||
|
// @LEVELS END
|
||||||
|
?>
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<table class="copyright" width="100%"><tr>
|
||||||
|
<td width="50%" align="center">Powered by <a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight</a></td><td width="50%" align="center">© 2003-2006 by renderse7en</td>
|
||||||
|
</tr></table>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,155 +0,0 @@
|
||||||
<?php
|
|
||||||
include('lib.php');
|
|
||||||
$link = opendb();
|
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
|
||||||
ob_start("ob_gzhandler");
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
||||||
<head>
|
|
||||||
<title><? echo $controlrow["gamename"]; ?> Help</title>
|
|
||||||
<style type="text/css">
|
|
||||||
body {
|
|
||||||
background-image: url(images/background.jpg);
|
|
||||||
color: black;
|
|
||||||
font: 11px verdana;
|
|
||||||
}
|
|
||||||
table {
|
|
||||||
border-style: none;
|
|
||||||
padding: 0px;
|
|
||||||
font: 11px verdana;
|
|
||||||
}
|
|
||||||
td {
|
|
||||||
border-style: none;
|
|
||||||
padding: 3px;
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
td.top {
|
|
||||||
border-bottom: solid 2px black;
|
|
||||||
}
|
|
||||||
td.left {
|
|
||||||
width: 150px;
|
|
||||||
border-right: solid 2px black;
|
|
||||||
}
|
|
||||||
td.right {
|
|
||||||
width: 150px;
|
|
||||||
border-left: solid 2px black;
|
|
||||||
}
|
|
||||||
a {
|
|
||||||
color: #663300;
|
|
||||||
text-decoration: none;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
a:hover {
|
|
||||||
color: #330000;
|
|
||||||
}
|
|
||||||
.small {
|
|
||||||
font: 10px verdana;
|
|
||||||
}
|
|
||||||
.highlight {
|
|
||||||
color: red;
|
|
||||||
}
|
|
||||||
.light {
|
|
||||||
color: #999999;
|
|
||||||
}
|
|
||||||
.title {
|
|
||||||
border: solid 1px black;
|
|
||||||
background-color: #eeeeee;
|
|
||||||
font-weight: bold;
|
|
||||||
padding: 5px;
|
|
||||||
margin: 3px;
|
|
||||||
}
|
|
||||||
.copyright {
|
|
||||||
border: solid 1px black;
|
|
||||||
background-color: #eeeeee;
|
|
||||||
font: 10px verdana;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<a name="top"></a>
|
|
||||||
<h1><? echo $controlrow["gamename"]; ?> Help: Items & Drops</h1>
|
|
||||||
[ <a href="help.php">Return to Help</a> | <a href="index.php">Return to the game</a> ]
|
|
||||||
|
|
||||||
<br /><br /><hr />
|
|
||||||
|
|
||||||
<table width="60%" style="border: solid 1px black" cellspacing="0" cellpadding="0">
|
|
||||||
<tr><td colspan="5" bgcolor="#ffffff"><center><b>Items</b></center></td></tr>
|
|
||||||
<tr><td><b>Type</b></td><td><b>Name</b></td><td><b>Cost</b></td><td><b>Attribute</b></td><td><b>Special</b></td></tr>
|
|
||||||
<?
|
|
||||||
$count = 1;
|
|
||||||
$itemsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "items");
|
|
||||||
while ($itemsrow = mysql_fetch_array($itemsquery)) {
|
|
||||||
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
|
|
||||||
if ($itemsrow["type"] == 1) { $image = "weapon"; $power = "Attack"; } elseif ($itemsrow["type"] == 2) { $image = "armor"; $power = "Defense"; } else { $image = "shield"; $power = "Defense"; }
|
|
||||||
if ($itemsrow["special"] != "X") {
|
|
||||||
$special = explode(",",$itemsrow["special"]);
|
|
||||||
if ($special[0] == "maxhp") { $attr = "Max HP"; }
|
|
||||||
elseif ($special[0] == "maxmp") { $attr = "Max MP"; }
|
|
||||||
elseif ($special[0] == "maxtp") { $attr = "Max TP"; }
|
|
||||||
elseif ($special[0] == "goldbonus") { $attr = "Gold Bonus (%)"; }
|
|
||||||
elseif ($special[0] == "expbonus") { $attr = "Experience Bonus (%)"; }
|
|
||||||
elseif ($special[0] == "strength") { $attr = "Strength"; }
|
|
||||||
elseif ($special[0] == "dexterity") { $attr = "Dexterity"; }
|
|
||||||
elseif ($special[0] == "attackpower") { $attr = "Attack Power"; }
|
|
||||||
elseif ($special[0] == "defensepower") { $attr = "Defense Power"; }
|
|
||||||
else { $attr = $special[0]; }
|
|
||||||
if ($special[1] > 0) { $stat = "+" . $special[1]; } else { $stat = $special[1]; }
|
|
||||||
$bigspecial = "$attr $stat";
|
|
||||||
} else { $bigspecial = "<span class=\"light\">None</span>"; }
|
|
||||||
echo "<tr><td $color width=\"5%\"><img src=\"images/icon_$image.gif\" alt=\"$image\"></td><td $color width=\"30%\">".$itemsrow["name"]."</td><td $color width=\"20%\">".$itemsrow["buycost"]." Gold</td><td $color width=\"20%\">".$itemsrow["attribute"]." $power Power</td><td $color width=\"25%\">$bigspecial</td></tr>\n";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</table>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<table width="60%" style="border: solid 1px black" cellspacing="0" cellpadding="0">
|
|
||||||
<tr><td colspan="4" bgcolor="#ffffff"><center><b>Drops</b></center></td></tr>
|
|
||||||
<tr><td><b>Name</b></td><td><b>Monster Level</b></td><td><b>Attribute 1</b></td><td><b>Attribute 2</b></td></tr>
|
|
||||||
<?
|
|
||||||
$count = 1;
|
|
||||||
$itemsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "drops");
|
|
||||||
while ($itemsrow = mysql_fetch_array($itemsquery)) {
|
|
||||||
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
|
|
||||||
if ($itemsrow["attribute1"] != "X") {
|
|
||||||
$special1 = explode(",",$itemsrow["attribute1"]);
|
|
||||||
if ($special1[0] == "maxhp") { $attr1 = "Max HP"; }
|
|
||||||
elseif ($special1[0] == "maxmp") { $attr1 = "Max MP"; }
|
|
||||||
elseif ($special1[0] == "maxtp") { $attr1 = "Max TP"; }
|
|
||||||
elseif ($special1[0] == "goldbonus") { $attr1 = "Gold Bonus (%)"; }
|
|
||||||
elseif ($special1[0] == "expbonus") { $attr1 = "Experience Bonus (%)"; }
|
|
||||||
elseif ($special1[0] == "strength") { $attr1 = "Strength"; }
|
|
||||||
elseif ($special1[0] == "dexterity") { $attr1 = "Dexterity"; }
|
|
||||||
elseif ($special1[0] == "attackpower") { $attr1 = "Attack Power"; }
|
|
||||||
elseif ($special1[0] == "defensepower") { $attr1 = "Defense Power"; }
|
|
||||||
else { $attr1 = $special1[0]; }
|
|
||||||
if ($special1[1] > 0) { $stat1 = "+" . $special1[1]; } else { $stat1 = $special1[1]; }
|
|
||||||
$bigspecial1 = "$attr1 $stat1";
|
|
||||||
} else { $bigspecial1 = "<span class=\"light\">None</span>"; }
|
|
||||||
if ($itemsrow["attribute2"] != "X") {
|
|
||||||
$special2 = explode(",",$itemsrow["attribute2"]);
|
|
||||||
if ($special2[0] == "maxhp") { $attr2 = "Max HP"; }
|
|
||||||
elseif ($special2[0] == "maxmp") { $attr2 = "Max MP"; }
|
|
||||||
elseif ($special2[0] == "maxtp") { $attr2 = "Max TP"; }
|
|
||||||
elseif ($special2[0] == "goldbonus") { $attr2 = "Gold Bonus (%)"; }
|
|
||||||
elseif ($special2[0] == "expbonus") { $attr2 = "Experience Bonus (%)"; }
|
|
||||||
elseif ($special2[0] == "strength") { $attr2 = "Strength"; }
|
|
||||||
elseif ($special2[0] == "dexterity") { $attr2 = "Dexterity"; }
|
|
||||||
elseif ($special2[0] == "attackpower") { $attr2 = "Attack Power"; }
|
|
||||||
elseif ($special2[0] == "defensepower") { $attr2 = "Defense Power"; }
|
|
||||||
else { $attr2 = $special2[0]; }
|
|
||||||
if ($special2[1] > 0) { $stat2 = "+" . $special2[1]; } else { $stat2 = $special2[1]; }
|
|
||||||
$bigspecial2 = "$attr2 $stat2";
|
|
||||||
} else { $bigspecial2 = "<span class=\"light\">None</span>"; }
|
|
||||||
echo "<tr><td $color width=\"25%\">".$itemsrow["name"]."</td><td $color width=\"15%\">".$itemsrow["mlevel"]."</td><td $color width=\"30%\">$bigspecial1</td><td $color width=\"30%\">$bigspecial2</td></tr>\n";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</table>
|
|
||||||
<br />
|
|
||||||
<table class="copyright" width="100%"><tr>
|
|
||||||
<td width="50%" align="center">Powered by <a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight</a></td><td width="50%" align="center">© 2003-2006 by renderse7en</td>
|
|
||||||
</tr></table>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,141 +0,0 @@
|
||||||
<?php
|
|
||||||
include('lib.php');
|
|
||||||
$link = opendb();
|
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
|
||||||
ob_start("ob_gzhandler");
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
||||||
<head>
|
|
||||||
<title><? echo $controlrow["gamename"]; ?> Help</title>
|
|
||||||
<style type="text/css">
|
|
||||||
body {
|
|
||||||
background-image: url(images/background.jpg);
|
|
||||||
color: black;
|
|
||||||
font: 11px verdana;
|
|
||||||
}
|
|
||||||
table {
|
|
||||||
border-style: none;
|
|
||||||
padding: 0px;
|
|
||||||
font: 11px verdana;
|
|
||||||
}
|
|
||||||
td {
|
|
||||||
border-style: none;
|
|
||||||
padding: 3px;
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
td.top {
|
|
||||||
border-bottom: solid 2px black;
|
|
||||||
}
|
|
||||||
td.left {
|
|
||||||
width: 150px;
|
|
||||||
border-right: solid 2px black;
|
|
||||||
}
|
|
||||||
td.right {
|
|
||||||
width: 150px;
|
|
||||||
border-left: solid 2px black;
|
|
||||||
}
|
|
||||||
a {
|
|
||||||
color: #663300;
|
|
||||||
text-decoration: none;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
a:hover {
|
|
||||||
color: #330000;
|
|
||||||
}
|
|
||||||
.small {
|
|
||||||
font: 10px verdana;
|
|
||||||
}
|
|
||||||
.highlight {
|
|
||||||
color: red;
|
|
||||||
}
|
|
||||||
.light {
|
|
||||||
color: #999999;
|
|
||||||
}
|
|
||||||
.title {
|
|
||||||
border: solid 1px black;
|
|
||||||
background-color: #eeeeee;
|
|
||||||
font-weight: bold;
|
|
||||||
padding: 5px;
|
|
||||||
margin: 3px;
|
|
||||||
}
|
|
||||||
.copyright {
|
|
||||||
border: solid 1px black;
|
|
||||||
background-color: #eeeeee;
|
|
||||||
font: 10px verdana;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<a name="top"></a>
|
|
||||||
<h1><? echo $controlrow["gamename"]; ?> Help: Levels</h1>
|
|
||||||
[ <a href="help.php">Return to Help</a> | <a href="index.php">Return to the game</a> ]
|
|
||||||
|
|
||||||
<br /><br /><hr />
|
|
||||||
|
|
||||||
<table width="50%" style="border: solid 1px black" cellspacing="0" cellpadding="0">
|
|
||||||
<tr><td colspan="8" bgcolor="#ffffff"><center><b><? echo $controlrow["class1name"]; ?> Levels</b></center></td></tr>
|
|
||||||
<tr><td><b>Level</b><td><b>Exp.</b></td><td><b>HP</b></td><td><b>MP</b></td><td><b>TP</b></td><td><b>Strength</b></td><td><b>Dexterity</b></td><td><b>Spell</b></td></tr>
|
|
||||||
<?
|
|
||||||
$count = 1;
|
|
||||||
$itemsquery = doquery("SELECT id,1_exp,1_hp,1_mp,1_tp,1_strength,1_dexterity,1_spells FROM {{table}} ORDER BY id", "levels");
|
|
||||||
$spellsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "spells");
|
|
||||||
$spells = array();
|
|
||||||
while ($spellsrow = mysql_fetch_array($spellsquery)) {
|
|
||||||
$spells[$spellsrow["id"]] = $spellsrow;
|
|
||||||
}
|
|
||||||
while ($itemsrow = mysql_fetch_array($itemsquery)) {
|
|
||||||
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
|
|
||||||
if ($itemsrow["1_spells"] != 0) { $spell = $spells[$itemsrow["1_spells"]]["name"]; } else { $spell = "<span class=\"light\">None</span>"; }
|
|
||||||
if ($itemsrow["id"] != 100) { echo "<tr><td $color width=\"12%\">".$itemsrow["id"]."</td><td $color width=\"12%\">".number_format($itemsrow["1_exp"])."</td><td $color width=\"12%\">".$itemsrow["1_hp"]."</td><td $color width=\"12%\">".$itemsrow["1_mp"]."</td><td $color width=\"12%\">".$itemsrow["1_tp"]."</td><td $color width=\"12%\">".$itemsrow["1_strength"]."</td><td $color width=\"12%\">".$itemsrow["1_dexterity"]."</td><td $color width=\"12%\">$spell</td></tr>\n"; }
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</table>
|
|
||||||
<br /><br />
|
|
||||||
<table width="50%" style="border: solid 1px black" cellspacing="0" cellpadding="0">
|
|
||||||
<tr><td colspan="8" bgcolor="#ffffff"><center><b><? echo $controlrow["class2name"]; ?> Levels</b></center></td></tr>
|
|
||||||
<tr><td><b>Level</b><td><b>Exp.</b></td><td><b>HP</b></td><td><b>MP</b></td><td><b>TP</b></td><td><b>Strength</b></td><td><b>Dexterity</b></td><td><b>Spell</b></td></tr>
|
|
||||||
<?
|
|
||||||
$count = 1;
|
|
||||||
$itemsquery = doquery("SELECT id,2_exp,2_hp,2_mp,2_tp,2_strength,2_dexterity,2_spells FROM {{table}} ORDER BY id", "levels");
|
|
||||||
$spellsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "spells");
|
|
||||||
$spells = array();
|
|
||||||
while ($spellsrow = mysql_fetch_array($spellsquery)) {
|
|
||||||
$spells[$spellsrow["id"]] = $spellsrow;
|
|
||||||
}
|
|
||||||
while ($itemsrow = mysql_fetch_array($itemsquery)) {
|
|
||||||
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
|
|
||||||
if ($itemsrow["2_spells"] != 0) { $spell = $spells[$itemsrow["2_spells"]]["name"]; } else { $spell = "<span class=\"light\">None</span>"; }
|
|
||||||
if ($itemsrow["id"] != 100) { echo "<tr><td $color width=\"12%\">".$itemsrow["id"]."</td><td $color width=\"12%\">".number_format($itemsrow["2_exp"])."</td><td $color width=\"12%\">".$itemsrow["2_hp"]."</td><td $color width=\"12%\">".$itemsrow["2_mp"]."</td><td $color width=\"12%\">".$itemsrow["2_tp"]."</td><td $color width=\"12%\">".$itemsrow["2_strength"]."</td><td $color width=\"12%\">".$itemsrow["2_dexterity"]."</td><td $color width=\"12%\">$spell</td></tr>\n"; }
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</table>
|
|
||||||
<br /><br />
|
|
||||||
<table width="50%" style="border: solid 1px black" cellspacing="0" cellpadding="0">
|
|
||||||
<tr><td colspan="8" bgcolor="#ffffff"><center><b><? echo $controlrow["class3name"]; ?> Levels</b></center></td></tr>
|
|
||||||
<tr><td><b>Level</b><td><b>Exp.</b></td><td><b>HP</b></td><td><b>MP</b></td><td><b>TP</b></td><td><b>Strength</b></td><td><b>Dexterity</b></td><td><b>Spell</b></td></tr>
|
|
||||||
<?
|
|
||||||
$count = 1;
|
|
||||||
$itemsquery = doquery("SELECT id,3_exp,3_hp,3_mp,3_tp,3_strength,3_dexterity,3_spells FROM {{table}} ORDER BY id", "levels");
|
|
||||||
$spellsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "spells");
|
|
||||||
$spells = array();
|
|
||||||
while ($spellsrow = mysql_fetch_array($spellsquery)) {
|
|
||||||
$spells[$spellsrow["id"]] = $spellsrow;
|
|
||||||
}
|
|
||||||
while ($itemsrow = mysql_fetch_array($itemsquery)) {
|
|
||||||
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
|
|
||||||
if ($itemsrow["3_spells"] != 0) { $spell = $spells[$itemsrow["3_spells"]]["name"]; } else { $spell = "<span class=\"light\">None</span>"; }
|
|
||||||
if ($itemsrow["id"] != 100) { echo "<tr><td $color width=\"12%\">".$itemsrow["id"]."</td><td $color width=\"12%\">".number_format($itemsrow["3_exp"])."</td><td $color width=\"12%\">".$itemsrow["3_hp"]."</td><td $color width=\"12%\">".$itemsrow["3_mp"]."</td><td $color width=\"12%\">".$itemsrow["3_tp"]."</td><td $color width=\"12%\">".$itemsrow["3_strength"]."</td><td $color width=\"12%\">".$itemsrow["3_dexterity"]."</td><td $color width=\"12%\">$spell</td></tr>\n"; }
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</table>
|
|
||||||
<br />
|
|
||||||
Experience points listed are total values up until that point. All other values are just the new amount that you gain for each level.
|
|
||||||
<br /><br />
|
|
||||||
<table class="copyright" width="100%"><tr>
|
|
||||||
<td width="50%" align="center">Powered by <a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight</a></td><td width="50%" align="center">© 2003-2006 by renderse7en</td>
|
|
||||||
</tr></table>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,96 +0,0 @@
|
||||||
<?php
|
|
||||||
include('lib.php');
|
|
||||||
$link = opendb();
|
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
|
||||||
ob_start("ob_gzhandler");
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
||||||
<head>
|
|
||||||
<title><? echo $controlrow["gamename"]; ?> Help</title>
|
|
||||||
<style type="text/css">
|
|
||||||
body {
|
|
||||||
background-image: url(images/background.jpg);
|
|
||||||
color: black;
|
|
||||||
font: 11px verdana;
|
|
||||||
}
|
|
||||||
table {
|
|
||||||
border-style: none;
|
|
||||||
padding: 0px;
|
|
||||||
font: 11px verdana;
|
|
||||||
}
|
|
||||||
td {
|
|
||||||
border-style: none;
|
|
||||||
padding: 3px;
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
td.top {
|
|
||||||
border-bottom: solid 2px black;
|
|
||||||
}
|
|
||||||
td.left {
|
|
||||||
width: 150px;
|
|
||||||
border-right: solid 2px black;
|
|
||||||
}
|
|
||||||
td.right {
|
|
||||||
width: 150px;
|
|
||||||
border-left: solid 2px black;
|
|
||||||
}
|
|
||||||
a {
|
|
||||||
color: #663300;
|
|
||||||
text-decoration: none;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
a:hover {
|
|
||||||
color: #330000;
|
|
||||||
}
|
|
||||||
.small {
|
|
||||||
font: 10px verdana;
|
|
||||||
}
|
|
||||||
.highlight {
|
|
||||||
color: red;
|
|
||||||
}
|
|
||||||
.light {
|
|
||||||
color: #999999;
|
|
||||||
}
|
|
||||||
.title {
|
|
||||||
border: solid 1px black;
|
|
||||||
background-color: #eeeeee;
|
|
||||||
font-weight: bold;
|
|
||||||
padding: 5px;
|
|
||||||
margin: 3px;
|
|
||||||
}
|
|
||||||
.copyright {
|
|
||||||
border: solid 1px black;
|
|
||||||
background-color: #eeeeee;
|
|
||||||
font: 10px verdana;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<a name="top"></a>
|
|
||||||
<h1><? echo $controlrow["gamename"]; ?> Help: Monsters</h1>
|
|
||||||
[ <a href="help.php">Return to Help</a> | <a href="index.php">Return to the game</a> ]
|
|
||||||
|
|
||||||
<br /><br /><hr />
|
|
||||||
|
|
||||||
<table width="75%" style="border: solid 1px black" cellspacing="0" cellpadding="0">
|
|
||||||
<tr><td colspan="8" bgcolor="#ffffff"><center><b>Monsters</b></center></td></tr>
|
|
||||||
<tr><td><b>Name</b></td><td><b>Max HP</b></td><td><b>Max Damage</b></td><td><b>Armor</b></td><td><b>Level</b></td><td><b>Max Exp.</b></td><td><b>Max Gold</b></td><td><b>Immunity</b></td></tr>
|
|
||||||
<?
|
|
||||||
$count = 1;
|
|
||||||
$itemsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "monsters");
|
|
||||||
while ($itemsrow = mysql_fetch_array($itemsquery)) {
|
|
||||||
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
|
|
||||||
if ($itemsrow["immune"] == 0) { $immune = "<span class=\"light\">None</span>"; } elseif ($itemsrow["immune"] == 1) { $immune = "Hurt"; } else { $immune = "Hurt & Sleep"; }
|
|
||||||
echo "<tr><td $color width=\"30%\">".$itemsrow["name"]."</td><td $color width=\"10%\">".$itemsrow["maxhp"]."</td><td $color width=\"10%\">".$itemsrow["maxdam"]."</td><td $color width=\"10%\">".$itemsrow["armor"]."</td><td $color width=\"10%\">".$itemsrow["level"]."</td><td $color width=\"10%\">".$itemsrow["maxexp"]."</td><td $color width=\"10%\">".$itemsrow["maxgold"]."</td><td $color width=\"20%\">$immune</td></tr>\n";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</table>
|
|
||||||
<br />
|
|
||||||
<table class="copyright" width="100%"><tr>
|
|
||||||
<td width="50%" align="center">Powered by <a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight</a></td><td width="50%" align="center">© 2003-2006 by renderse7en</td>
|
|
||||||
</tr></table>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,106 +0,0 @@
|
||||||
<?php
|
|
||||||
include('lib.php');
|
|
||||||
$link = opendb();
|
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
|
||||||
ob_start("ob_gzhandler");
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
||||||
<head>
|
|
||||||
<title><? echo $controlrow["gamename"]; ?> Help</title>
|
|
||||||
<style type="text/css">
|
|
||||||
body {
|
|
||||||
background-image: url(images/background.jpg);
|
|
||||||
color: black;
|
|
||||||
font: 11px verdana;
|
|
||||||
}
|
|
||||||
table {
|
|
||||||
border-style: none;
|
|
||||||
padding: 0px;
|
|
||||||
font: 11px verdana;
|
|
||||||
}
|
|
||||||
td {
|
|
||||||
border-style: none;
|
|
||||||
padding: 3px;
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
td.top {
|
|
||||||
border-bottom: solid 2px black;
|
|
||||||
}
|
|
||||||
td.left {
|
|
||||||
width: 150px;
|
|
||||||
border-right: solid 2px black;
|
|
||||||
}
|
|
||||||
td.right {
|
|
||||||
width: 150px;
|
|
||||||
border-left: solid 2px black;
|
|
||||||
}
|
|
||||||
a {
|
|
||||||
color: #663300;
|
|
||||||
text-decoration: none;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
a:hover {
|
|
||||||
color: #330000;
|
|
||||||
}
|
|
||||||
.small {
|
|
||||||
font: 10px verdana;
|
|
||||||
}
|
|
||||||
.highlight {
|
|
||||||
color: red;
|
|
||||||
}
|
|
||||||
.light {
|
|
||||||
color: #999999;
|
|
||||||
}
|
|
||||||
.title {
|
|
||||||
border: solid 1px black;
|
|
||||||
background-color: #eeeeee;
|
|
||||||
font-weight: bold;
|
|
||||||
padding: 5px;
|
|
||||||
margin: 3px;
|
|
||||||
}
|
|
||||||
.copyright {
|
|
||||||
border: solid 1px black;
|
|
||||||
background-color: #eeeeee;
|
|
||||||
font: 10px verdana;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<a name="top"></a>
|
|
||||||
<h1><? echo $controlrow["gamename"]; ?> Help: Spells</h1>
|
|
||||||
[ <a href="help.php">Return to Help</a> | <a href="index.php">Return to the game</a> ]
|
|
||||||
|
|
||||||
<br /><br /><hr />
|
|
||||||
|
|
||||||
<table width="50%" style="border: solid 1px black" cellspacing="0" cellpadding="0">
|
|
||||||
<tr><td colspan="8" bgcolor="#ffffff"><center><b>Spells</b></center></td></tr>
|
|
||||||
<tr><td><b>Name</b></td><td><b>Cost</b></td><td><b>Type</b></td><td><b>Attribute</b></td></tr>
|
|
||||||
<?
|
|
||||||
$count = 1;
|
|
||||||
$itemsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "spells");
|
|
||||||
while ($itemsrow = mysql_fetch_array($itemsquery)) {
|
|
||||||
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
|
|
||||||
if ($itemsrow["type"] == 1) { $type = "Heal"; }
|
|
||||||
elseif ($itemsrow["type"] == 2) { $type = "Hurt"; }
|
|
||||||
elseif ($itemsrow["type"] == 3) { $type = "Sleep"; }
|
|
||||||
elseif ($itemsrow["type"] == 4) { $type = "+Damage (%)"; }
|
|
||||||
elseif ($itemsrow["type"] == 5) { $type = "+Defense (%)"; }
|
|
||||||
echo "<tr><td $color width=\"25%\">".$itemsrow["name"]."</td><td $color width=\"25%\">".$itemsrow["mp"]."</td><td $color width=\"25%\">$type</td><td $color width=\"25%\">".$itemsrow["attribute"]."</td></tr>\n";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</table>
|
|
||||||
<ul>
|
|
||||||
<li /><b>Heal</b> spells always give you the maximum amount possible, until your current HP is full.
|
|
||||||
<li /><b>Hurt</b> spells deal X damage (not always the maximum) to the monster, regardless of the monster's armor.
|
|
||||||
<li /><b>Sleep</b> spells put the monster to sleep. The monster has an X in 15 chance of remaining asleep each turn.
|
|
||||||
<li /><b>+Damage</b> spells increase your total attack damage by X percent until the end of the fight.
|
|
||||||
<li /><b>+Defense</b> spells reduce the total damage you take from the monster by X percent until the end of each fight.
|
|
||||||
</ul>
|
|
||||||
<table class="copyright" width="100%"><tr>
|
|
||||||
<td width="50%" align="center">Powered by <a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight</a></td><td width="50%" align="center">© 2003-2006 by renderse7en</td>
|
|
||||||
</tr></table>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
226
public/index.php
226
public/index.php
|
@ -2,10 +2,7 @@
|
||||||
|
|
||||||
// index.php :: Primary program script, evil alien overlord, you decide.
|
// index.php :: Primary program script, evil alien overlord, you decide.
|
||||||
|
|
||||||
if (!file_exists('../.installed')) {
|
if (!file_exists('../.installed')) redirect('install.php');
|
||||||
header('Location: install.php');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once '../src/lib.php';
|
require_once '../src/lib.php';
|
||||||
|
|
||||||
|
@ -81,8 +78,7 @@ function donothing()
|
||||||
$page = doexplore();
|
$page = doexplore();
|
||||||
$title = "Exploring";
|
$title = "Exploring";
|
||||||
} elseif ($userrow["currentaction"] == "Fighting") {
|
} elseif ($userrow["currentaction"] == "Fighting") {
|
||||||
$page = dofight();
|
redirect('index.php?do=fight');
|
||||||
$title = "Fighting";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
display($page, $title);
|
display($page, $title);
|
||||||
|
@ -95,53 +91,53 @@ function dotown()
|
||||||
{
|
{
|
||||||
global $userrow, $controlrow;
|
global $userrow, $controlrow;
|
||||||
|
|
||||||
$townquery = db()->query('SELECT * FROM towns WHERE latitude = ? AND longitude = ? LIMIT 1;', [$userrow["latitude"], $userrow["longitude"]]);
|
$townrow = get_town_by_xy($userrow['longitude'], $userrow['latitude']);
|
||||||
if ($townquery === false) display("There is an error with your user account, or with the town data. Please try again.", "Error");
|
|
||||||
$townrow = $townquery->fetchArray(SQLITE3_ASSOC);
|
|
||||||
if ($townrow === false) display("There is an error with your user account, or with the town data. Please try again.","Error");
|
if ($townrow === false) display("There is an error with your user account, or with the town data. Please try again.","Error");
|
||||||
|
|
||||||
|
$townrow["news"] = "";
|
||||||
|
$townrow["whosonline"] = "";
|
||||||
|
$townrow["babblebox"] = "";
|
||||||
|
|
||||||
// News box. Grab latest news entry and display it. Something a little more graceful coming soon maybe.
|
// News box. Grab latest news entry and display it. Something a little more graceful coming soon maybe.
|
||||||
if ($controlrow["shownews"] == 1) {
|
if ($controlrow["shownews"] == 1) {
|
||||||
$newsrow = db()->query('SELECT * FROM news ORDER BY id DESC LIMIT 1;')->fetchArray(SQLITE3_ASSOC);
|
$newsrow = db()->query('SELECT * FROM news ORDER BY id DESC LIMIT 1;')->fetchArray(SQLITE3_ASSOC);
|
||||||
$townrow["news"] = "<table width=\"95%\"><tr><td class=\"title\">Latest News</td></tr><tr><td>\n";
|
$townrow["news"] = "<table width=\"95%\"><tr><td class=\"title\">Latest News</td></tr><tr><td>\n";
|
||||||
$townrow["news"] .= "<span class=\"light\">[".prettydate($newsrow["postdate"])."]</span><br />".nl2br($newsrow["content"]);
|
$townrow["news"] .= "<span class=\"light\">[".prettydate($newsrow["postdate"])."]</span><br>".nl2br($newsrow["content"]);
|
||||||
$townrow["news"] .= "</td></tr></table>\n";
|
$townrow["news"] .= "</td></tr></table>\n";
|
||||||
} else {
|
}
|
||||||
$townrow["news"] = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Who's Online. Currently just members. Guests maybe later.
|
// Who's Online. Currently just members. Guests maybe later.
|
||||||
if ($controlrow["showonline"] == 1) {
|
if ($controlrow["showonline"] == 1) {
|
||||||
$onlinequery = db()->query("SELECT * FROM news WHERE strftime('%s', onlinetime) >= strftime('%s', 'now') - 600 ORDER BY charname");
|
$onlinequery = db()->query("SELECT id, username FROM users WHERE strftime('%s', onlinetime) >= strftime('%s', 'now') - 600 ORDER BY username");
|
||||||
|
|
||||||
$online_count = 0;
|
$online_count = 0;
|
||||||
$online_rows = [];
|
$online_rows = [];
|
||||||
|
|
||||||
foreach ($onlinequery->fetchArray(SQLITE3_ASSOC) as $onlinerow) {
|
while ($onlinerow = $onlinequery->fetchArray(SQLITE3_ASSOC)) {
|
||||||
$online_count++;
|
$online_count++;
|
||||||
$online_rows[] = "<a href=\"index.php?do=onlinechar:".$onlinerow["id"]."\">".$onlinerow["charname"]."</a>" . ", ";
|
$online_rows[] = "<a href=\"index.php?do=onlinechar:".$onlinerow["id"]."\">".$onlinerow["username"]."</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$townrow["whosonline"] = "<table width=\"95%\"><tr><td class=\"title\">Who's Online</td></tr><tr><td>\n";
|
$townrow["whosonline"] = "<table width=\"95%\"><tr><td class=\"title\">Who's Online</td></tr><tr><td>\n";
|
||||||
$townrow["whosonline"] .= "There are <b>$online_count</b> user(s) online within the last 10 minutes: ";
|
$townrow["whosonline"] .= "There are <b>$online_count</b> user(s) online within the last 10 minutes: ";
|
||||||
$townrow["whosonline"] .= rtrim(implode(', ', $online_rows), ', ');
|
$townrow["whosonline"] .= rtrim(implode(', ', $online_rows), ', ');
|
||||||
$townrow["whosonline"] .= "</td></tr></table>\n";
|
$townrow["whosonline"] .= "</td></tr></table>\n";
|
||||||
} else {
|
}
|
||||||
$townrow["whosonline"] = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($controlrow["showbabble"] == 1) {
|
if ($controlrow["showbabble"] == 1) {
|
||||||
$townrow["babblebox"] = "<table width=\"95%\"><tr><td class=\"title\">Babble Box</td></tr><tr><td>\n";
|
$townrow["babblebox"] = <<<HTML
|
||||||
$townrow["babblebox"] .= "<iframe src=\"index.php?do=babblebox\" name=\"sbox\" width=\"100%\" height=\"250\" frameborder=\"0\" id=\"bbox\">Your browser does not support inline frames! The Babble Box will not be available until you upgrade to a newer <a href=\"http://www.mozilla.org\" target=\"_new\">browser</a>.</iframe>";
|
<table width="95%">
|
||||||
$townrow["babblebox"] .= "</td></tr></table>\n";
|
<tr><td class="title">Babble Box</td></tr>
|
||||||
} else {
|
<tr><td>
|
||||||
$townrow["babblebox"] = "";
|
<iframe src="index.php?do=babblebox" name="sbox" width="100%" height="250" frameborder="0" id="bbox">
|
||||||
}
|
Your browser does not support inline frames! The Babble Box will not be available until you upgrade to a newer <a href="http://www.mozilla.org" target="_new">browser</a>.
|
||||||
|
</iframe>
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
HTML;
|
||||||
|
}
|
||||||
|
|
||||||
$page = gettemplate("towns");
|
return parsetemplate(gettemplate("towns"), $townrow);
|
||||||
$page = parsetemplate($page, $townrow);
|
|
||||||
|
|
||||||
return $page;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -160,154 +156,104 @@ function doexplore()
|
||||||
HTML;
|
HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Redirect to fighting.
|
|
||||||
*/
|
|
||||||
function dofight()
|
|
||||||
{
|
|
||||||
header("Location: index.php?do=fight");
|
|
||||||
}
|
|
||||||
|
|
||||||
function showchar()
|
function showchar()
|
||||||
{
|
{
|
||||||
global $userrow, $controlrow;
|
global $userrow, $controlrow;
|
||||||
|
|
||||||
// Format various userrow stuffs.
|
$userrow["experience"] = number_format($userrow["experience"]);
|
||||||
$userrow["experience"] = number_format($userrow["experience"]);
|
$userrow["gold"] = number_format($userrow["gold"]);
|
||||||
$userrow["gold"] = number_format($userrow["gold"]);
|
|
||||||
if ($userrow["expbonus"] > 0) {
|
|
||||||
$userrow["plusexp"] = "<span class=\"light\">(+".$userrow["expbonus"]."%)</span>";
|
|
||||||
} elseif ($userrow["expbonus"] < 0) {
|
|
||||||
$userrow["plusexp"] = "<span class=\"light\">(".$userrow["expbonus"]."%)</span>";
|
|
||||||
} else { $userrow["plusexp"] = ""; }
|
|
||||||
if ($userrow["goldbonus"] > 0) {
|
|
||||||
$userrow["plusgold"] = "<span class=\"light\">(+".$userrow["goldbonus"]."%)</span>";
|
|
||||||
} elseif ($userrow["goldbonus"] < 0) {
|
|
||||||
$userrow["plusgold"] = "<span class=\"light\">(".$userrow["goldbonus"]."%)</span>";
|
|
||||||
} else { $userrow["plusgold"] = ""; }
|
|
||||||
|
|
||||||
$levelquery = doquery("SELECT ". $userrow["charclass"]."_exp FROM {{table}} WHERE id='".($userrow["level"]+1)."' LIMIT 1", "levels");
|
$userrow["plusexp"] = $userrow["expbonus"] != 0
|
||||||
$levelrow = mysql_fetch_array($levelquery);
|
? "<span class=\"light\">(" . ($userrow["expbonus"] > 0 ? "+" : "") . $userrow["expbonus"] . "%)</span>"
|
||||||
if ($userrow["level"] < 99) { $userrow["nextlevel"] = number_format($levelrow[$userrow["charclass"]."_exp"]); } else { $userrow["nextlevel"] = "<span class=\"light\">None</span>"; }
|
: "";
|
||||||
|
|
||||||
if ($userrow["charclass"] == 1) { $userrow["charclass"] = $controlrow["class1name"]; }
|
$userrow["plusgold"] = $userrow["goldbonus"] != 0
|
||||||
elseif ($userrow["charclass"] == 2) { $userrow["charclass"] = $controlrow["class2name"]; }
|
? "<span class=\"light\">(" . ($userrow["goldbonus"] > 0 ? "+" : "") . $userrow["goldbonus"] . "%)</span>"
|
||||||
elseif ($userrow["charclass"] == 3) { $userrow["charclass"] = $controlrow["class3name"]; }
|
: "";
|
||||||
|
|
||||||
if ($userrow["difficulty"] == 1) { $userrow["difficulty"] = $controlrow["diff1name"]; }
|
$levelrow = db()->query("SELECT `{$userrow["charclass"]}_exp` FROM levels WHERE id=? LIMIT 1;", [$userrow['level'] + 1])->fetchArray(SQLITE3_ASSOC);
|
||||||
elseif ($userrow["difficulty"] == 2) { $userrow["difficulty"] = $controlrow["diff2name"]; }
|
$userrow["nextlevel"] = $userrow['level'] < 99 ? number_format($levelrow[$userrow["charclass"]."_exp"]) : '<span class="light">None</span>';
|
||||||
elseif ($userrow["difficulty"] == 3) { $userrow["difficulty"] = $controlrow["diff3name"]; }
|
|
||||||
|
|
||||||
$spellquery = doquery("SELECT id,name FROM {{table}}","spells");
|
$userrow['charclass'] = match ((int) $userrow['charclass']) {
|
||||||
$userspells = explode(",",$userrow["spells"]);
|
1 => $controlrow["class1name"],
|
||||||
$userrow["magiclist"] = "";
|
2 => $controlrow["class2name"],
|
||||||
while ($spellrow = mysql_fetch_array($spellquery)) {
|
3 => $controlrow["class3name"]
|
||||||
|
};
|
||||||
|
|
||||||
|
$spells = db()->query('SELECT id, name FROM spells;');
|
||||||
|
$userspells = explode(',', $userrow['spells']);
|
||||||
|
$userrow["magiclist"] = '';
|
||||||
|
while ($spellrow = $spells->fetchArray(SQLITE3_ASSOC)) {
|
||||||
$spell = false;
|
$spell = false;
|
||||||
foreach($userspells as $a => $b) {
|
foreach($userspells as $b) if ($b == $spellrow["id"]) $spell = true;
|
||||||
if ($b == $spellrow["id"]) { $spell = true; }
|
if ($spell == true) $userrow["magiclist"] .= $spellrow["name"]."<br>";
|
||||||
}
|
|
||||||
if ($spell == true) {
|
|
||||||
$userrow["magiclist"] .= $spellrow["name"]."<br />";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ($userrow["magiclist"] == "") { $userrow["magiclist"] = "None"; }
|
if ($userrow["magiclist"] == "") $userrow["magiclist"] = "None";
|
||||||
|
|
||||||
// Make page tags for XHTML validation.
|
$array = ["content" => parsetemplate(gettemplate("showchar"), $userrow), "title" => "Character Information"];
|
||||||
$xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
|
echo parsetemplate("<html>\n" . gettemplate("minimal"), $array);
|
||||||
. "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">\n"
|
|
||||||
. "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n";
|
|
||||||
|
|
||||||
$charsheet = gettemplate("showchar");
|
|
||||||
$page = $xml . gettemplate("minimal");
|
|
||||||
$array = array("content"=>parsetemplate($charsheet, $userrow), "title"=>"Character Information");
|
|
||||||
echo parsetemplate($page, $array);
|
|
||||||
die();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onlinechar($id) {
|
function onlinechar($id)
|
||||||
|
{
|
||||||
global $controlrow;
|
global $controlrow;
|
||||||
$userquery = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "users");
|
|
||||||
if (mysql_num_rows($userquery) == 1) { $userrow = mysql_fetch_array($userquery); } else { display("No such user.", "Error"); }
|
|
||||||
|
|
||||||
// Format various userrow stuffs.
|
$query = db()->query('SELECT * FROM users WHERE id=? LIMIT 1;', [$id]);
|
||||||
|
if ($query !== false) { $userrow = $query->fetchArray(SQLITE3_ASSOC); } else { display("No such user.", "Error"); }
|
||||||
|
unset($userrow['password']);
|
||||||
|
|
||||||
$userrow["experience"] = number_format($userrow["experience"]);
|
$userrow["experience"] = number_format($userrow["experience"]);
|
||||||
$userrow["gold"] = number_format($userrow["gold"]);
|
$userrow["gold"] = number_format($userrow["gold"]);
|
||||||
if ($userrow["expbonus"] > 0) {
|
|
||||||
$userrow["plusexp"] = "<span class=\"light\">(+".$userrow["expbonus"]."%)</span>";
|
|
||||||
} elseif ($userrow["expbonus"] < 0) {
|
|
||||||
$userrow["plusexp"] = "<span class=\"light\">(".$userrow["expbonus"]."%)</span>";
|
|
||||||
} else { $userrow["plusexp"] = ""; }
|
|
||||||
if ($userrow["goldbonus"] > 0) {
|
|
||||||
$userrow["plusgold"] = "<span class=\"light\">(+".$userrow["goldbonus"]."%)</span>";
|
|
||||||
} elseif ($userrow["goldbonus"] < 0) {
|
|
||||||
$userrow["plusgold"] = "<span class=\"light\">(".$userrow["goldbonus"]."%)</span>";
|
|
||||||
} else { $userrow["plusgold"] = ""; }
|
|
||||||
|
|
||||||
$levelquery = doquery("SELECT ". $userrow["charclass"]."_exp FROM {{table}} WHERE id='".($userrow["level"]+1)."' LIMIT 1", "levels");
|
$userrow["plusexp"] = $userrow["expbonus"] != 0
|
||||||
$levelrow = mysql_fetch_array($levelquery);
|
? "<span class=\"light\">(" . ($userrow["expbonus"] > 0 ? "+" : "") . $userrow["expbonus"] . "%)</span>"
|
||||||
$userrow["nextlevel"] = number_format($levelrow[$userrow["charclass"]."_exp"]);
|
: "";
|
||||||
|
|
||||||
if ($userrow["charclass"] == 1) { $userrow["charclass"] = $controlrow["class1name"]; }
|
$userrow["plusgold"] = $userrow["goldbonus"] != 0
|
||||||
elseif ($userrow["charclass"] == 2) { $userrow["charclass"] = $controlrow["class2name"]; }
|
? "<span class=\"light\">(" . ($userrow["goldbonus"] > 0 ? "+" : "") . $userrow["goldbonus"] . "%)</span>"
|
||||||
elseif ($userrow["charclass"] == 3) { $userrow["charclass"] = $controlrow["class3name"]; }
|
: "";
|
||||||
|
|
||||||
if ($userrow["difficulty"] == 1) { $userrow["difficulty"] = $controlrow["diff1name"]; }
|
$levelrow = db()->query("SELECT `{$userrow["charclass"]}_exp` FROM levels WHERE id=? LIMIT 1;", [$userrow['level'] + 1])->fetchArray(SQLITE3_ASSOC);
|
||||||
elseif ($userrow["difficulty"] == 2) { $userrow["difficulty"] = $controlrow["diff2name"]; }
|
$userrow["nextlevel"] = $userrow['level'] < 99 ? number_format($levelrow[$userrow["charclass"]."_exp"]) : '<span class="light">None</span>';
|
||||||
elseif ($userrow["difficulty"] == 3) { $userrow["difficulty"] = $controlrow["diff3name"]; }
|
|
||||||
|
|
||||||
$charsheet = gettemplate("onlinechar");
|
$userrow['charclass'] = match ((int) $userrow['charclass']) {
|
||||||
$page = parsetemplate($charsheet, $userrow);
|
1 => $controlrow["class1name"],
|
||||||
display($page, "Character Information");
|
2 => $controlrow["class2name"],
|
||||||
|
3 => $controlrow["class3name"]
|
||||||
|
};
|
||||||
|
|
||||||
|
display(parsetemplate(gettemplate("onlinechar"), $userrow), "Character Information");
|
||||||
}
|
}
|
||||||
|
|
||||||
function showmap() {
|
function showmap()
|
||||||
|
{
|
||||||
global $userrow;
|
$array = ["content" => "<center><img src=\"images/map.gif\" alt=\"Map\" /></center>", "title" => "Map"];
|
||||||
|
echo parsetemplate("<html>\n" . gettemplate("minimal"), $array);
|
||||||
// Make page tags for XHTML validation.
|
|
||||||
$xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
|
|
||||||
. "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">\n"
|
|
||||||
. "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n";
|
|
||||||
|
|
||||||
$page = $xml . gettemplate("minimal");
|
|
||||||
$array = array("content"=>"<center><img src=\"images/map.gif\" alt=\"Map\" /></center>", "title"=>"Map");
|
|
||||||
echo parsetemplate($page, $array);
|
|
||||||
die();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function babblebox() {
|
function babblebox()
|
||||||
|
{
|
||||||
global $userrow;
|
global $userrow;
|
||||||
|
|
||||||
if (isset($_POST["babble"])) {
|
if (isset($_POST["babble"])) {
|
||||||
$safecontent = makesafe($_POST["babble"]);
|
$safecontent = makesafe($_POST["babble"]);
|
||||||
if ($safecontent == "" || $safecontent == " ") { //blank post. do nothing.
|
if (!empty($safecontent)) {
|
||||||
} else { $insert = doquery("INSERT INTO {{table}} SET id='',posttime=NOW(),author='".$userrow["charname"]."',babble='$safecontent'", "babble"); }
|
db()->query('INSERT INTO babble (posttime, author, babble) VALUES (CURRENT_TIMESTAMP, ?, ?);', [$userrow['username'], $safecontent]);
|
||||||
header("Location: index.php?do=babblebox");
|
}
|
||||||
die();
|
redirect('index.php?do=babblebox');
|
||||||
}
|
}
|
||||||
|
|
||||||
$babblebox = array("content"=>"");
|
$babblebox = ["content" => ""];
|
||||||
$bg = 1;
|
$bg = 1;
|
||||||
$babblequery = doquery("SELECT * FROM {{table}} ORDER BY id DESC LIMIT 20", "babble");
|
$query = db()->query('SELECT * FROM babble ORDER BY id DESC LIMIT 20;');
|
||||||
while ($babblerow = mysql_fetch_array($babblequery)) {
|
while ($babblerow = $query->fetchArray(SQLITE3_ASSOC)) {
|
||||||
if ($bg == 1) { $new = "<div style=\"width:98%; background-color:#eeeeee;\">[<b>".$babblerow["author"]."</b>] ".$babblerow["babble"]."</div>\n"; $bg = 2; }
|
if ($bg == 1) { $new = "<div style=\"width:98%; background-color:#eeeeee;\">[<b>".$babblerow["author"]."</b>] ".$babblerow["babble"]."</div>\n"; $bg = 2; }
|
||||||
else { $new = "<div style=\"width:98%; background-color:#ffffff;\">[<b>".$babblerow["author"]."</b>] ".stripslashes($babblerow["babble"])."</div>\n"; $bg = 1; }
|
else { $new = "<div style=\"width:98%; background-color:#ffffff;\">[<b>".$babblerow["author"]."</b>] ".stripslashes($babblerow["babble"])."</div>\n"; $bg = 1; }
|
||||||
$babblebox["content"] = $new . $babblebox["content"];
|
$babblebox["content"] = $new . $babblebox["content"];
|
||||||
}
|
}
|
||||||
$babblebox["content"] .= "<center><form action=\"index.php?do=babblebox\" method=\"post\"><input type=\"text\" name=\"babble\" size=\"15\" maxlength=\"120\" /><br /><input type=\"submit\" name=\"submit\" value=\"Babble\" /> <input type=\"reset\" name=\"reset\" value=\"Clear\" /></form></center>";
|
$babblebox["content"] .= "<center><form action=\"index.php?do=babblebox\" method=\"post\"><input type=\"text\" name=\"babble\" size=\"15\" maxlength=\"120\" /><br><input type=\"submit\" name=\"submit\" value=\"Babble\" /> <input type=\"reset\" name=\"reset\" value=\"Clear\" /></form></center>";
|
||||||
|
|
||||||
// Make page tags for XHTML validation.
|
|
||||||
$xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
|
|
||||||
. "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">\n"
|
|
||||||
. "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n";
|
|
||||||
$page = $xml . gettemplate("babblebox");
|
|
||||||
echo parsetemplate($page, $babblebox);
|
|
||||||
die();
|
|
||||||
|
|
||||||
|
echo parsetemplate("<html>\n" . gettemplate("babblebox"), $babblebox);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,7 +7,8 @@ if (file_exists('../.installed')) {
|
||||||
|
|
||||||
require_once '../src/lib.php';
|
require_once '../src/lib.php';
|
||||||
|
|
||||||
match ((int) $_GET['page'] ?? 1) {
|
$page = $_GET['page'] ?? 1;
|
||||||
|
match ((int) $page) {
|
||||||
2 => second(),
|
2 => second(),
|
||||||
3 => third(),
|
3 => third(),
|
||||||
4 => fourth(),
|
4 => fourth(),
|
||||||
|
@ -27,23 +28,21 @@ function first()
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<b>Dragon Knight Installation: Page One</b><br /><br />
|
<b>Dragon Knight Installation: Page One</b><br><br>
|
||||||
<b>NOTE:</b> Please ensure you have filled in the correct values in config.php before continuing. Installation will fail if these values are not correct. Also, the MySQL database needs to already exist. This installer script will take care of setting up its structure and content, but the database itself must already exist on your MySQL server before the installer will work.<br /><br />
|
<b>NOTE:</b> Please ensure you have filled in the correct values in config.php before continuing. Installation will fail if these values are not correct. Also, the MySQL database needs to already exist. This installer script will take care of setting up its structure and content, but the database itself must already exist on your MySQL server before the installer will work.<br><br>
|
||||||
Installation for Dragon Knight is a simple two-step process: set up the database tables, then create the admin user. After that, you're done.<br /><br />
|
Installation for Dragon Knight is a simple two-step process: set up the database tables, then create the admin user. After that, you're done.<br><br>
|
||||||
You have two options for database setup: complete or partial.
|
You have two options for database setup: complete or partial.
|
||||||
<ul>
|
<ul>
|
||||||
<li><b>Complete Setup</b> includes table structure and all default data (items, drops, monsters, levels, spells, towns) - after complete setup, the game is totally ready to run.</li>
|
<li><b>Complete Setup</b> includes table structure and all default data (items, drops, monsters, levels, spells, towns) - after complete setup, the game is totally ready to run.</li>
|
||||||
<li><b>Partial Setup</b> only creates the table structure, it does not populate the tables - use this if you are going to be creating and importing your own customized game data later.</li>
|
<li><b>Partial Setup</b> only creates the table structure, it does not populate the tables - use this if you are going to be creating and importing your own customized game data later.</li>
|
||||||
</ul>
|
</ul>
|
||||||
Click the appropriate button below for your preferred installation method.<br /><br />
|
Click the appropriate button below for your preferred installation method.<br><br>
|
||||||
<form action="install.php?page=2" method="post">
|
<form action="install.php?page=2" method="post">
|
||||||
<input type="submit" name="complete" value="Complete Setup" /><br /> - OR - <br /><input type="submit" name="partial" value="Partial Setup" />
|
<input type="submit" name="complete" value="Complete Setup" /><br> - OR - <br><input type="submit" name="partial" value="Partial Setup" />
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
HTML;
|
HTML;
|
||||||
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,7 +50,7 @@ function first()
|
||||||
*/
|
*/
|
||||||
function second()
|
function second()
|
||||||
{
|
{
|
||||||
echo "<html><head><title>Dragon Knight Installation</title></head><body><b>Dragon Knight Installation: Page Two</b><br /><br />";
|
echo "<html><head><title>Dragon Knight Installation</title></head><body><b>Dragon Knight Installation: Page Two</b><br><br>";
|
||||||
|
|
||||||
$full = isset($_POST["complete"]);
|
$full = isset($_POST["complete"]);
|
||||||
|
|
||||||
|
@ -64,7 +63,7 @@ function second()
|
||||||
);
|
);
|
||||||
SQL);
|
SQL);
|
||||||
|
|
||||||
echo $query === true ? 'Babble Box table created.<br />' : 'Error creating Babble Box table.';
|
echo $query === true ? 'Babble Box table created.<br>' : 'Error creating Babble Box table.';
|
||||||
|
|
||||||
$query = db()->exec(<<<SQL
|
$query = db()->exec(<<<SQL
|
||||||
CREATE TABLE control (
|
CREATE TABLE control (
|
||||||
|
@ -74,8 +73,6 @@ function second()
|
||||||
`gameopen` INTEGER NOT NULL DEFAULT 0,
|
`gameopen` INTEGER NOT NULL DEFAULT 0,
|
||||||
`gameurl` TEXT NOT NULL DEFAULT '',
|
`gameurl` TEXT NOT NULL DEFAULT '',
|
||||||
`adminemail` TEXT NOT NULL DEFAULT '',
|
`adminemail` TEXT NOT NULL DEFAULT '',
|
||||||
`forumtype` INTEGER NOT NULL DEFAULT 0,
|
|
||||||
`forumaddress` TEXT NOT NULL DEFAULT '',
|
|
||||||
`class1name` TEXT NOT NULL DEFAULT '',
|
`class1name` TEXT NOT NULL DEFAULT '',
|
||||||
`class2name` TEXT NOT NULL DEFAULT '',
|
`class2name` TEXT NOT NULL DEFAULT '',
|
||||||
`class3name` TEXT NOT NULL DEFAULT '',
|
`class3name` TEXT NOT NULL DEFAULT '',
|
||||||
|
@ -92,11 +89,11 @@ function second()
|
||||||
);
|
);
|
||||||
SQL);
|
SQL);
|
||||||
|
|
||||||
echo $query === true ? 'Control table created.<br />' : 'Error creating Control table.';
|
echo $query === true ? 'Control table created.<br>' : 'Error creating Control table.';
|
||||||
|
|
||||||
$query = db()->exec("INSERT INTO control VALUES (1, 'Dragon Knight', 250, 1, '', '', 1, '', 'Mage', 'Warrior', 'Paladin', 'Easy', 1, 'Medium', 1.2, 'Hard', 1.5, 1, 1, 1, 1);");
|
$query = db()->exec("INSERT INTO control VALUES (1, 'Dragon Knight', 250, 1, '', '', 1, '', 'Mage', 'Warrior', 'Paladin', 'Easy', 1, 'Medium', 1.2, 'Hard', 1.5, 1, 1, 1, 1);");
|
||||||
|
|
||||||
echo $query === true ? 'Control table populated.<br />' : 'Error populating Control table.';
|
echo $query === true ? 'Control table populated.<br>' : 'Error populating Control table.';
|
||||||
|
|
||||||
$query = db()->exec(<<<SQL
|
$query = db()->exec(<<<SQL
|
||||||
CREATE TABLE drops (
|
CREATE TABLE drops (
|
||||||
|
@ -109,7 +106,7 @@ function second()
|
||||||
);
|
);
|
||||||
SQL);
|
SQL);
|
||||||
|
|
||||||
echo $query == true ? 'Drops table created.<br />' : 'Error creating Drops table.';
|
echo $query == true ? 'Drops table created.<br>' : 'Error creating Drops table.';
|
||||||
|
|
||||||
if ($full) {
|
if ($full) {
|
||||||
$query = db()->exec(<<<SQL
|
$query = db()->exec(<<<SQL
|
||||||
|
@ -148,7 +145,7 @@ function second()
|
||||||
(32, 'Fortune Drop', 5, 1, 'goldbonus,10', 'X');
|
(32, 'Fortune Drop', 5, 1, 'goldbonus,10', 'X');
|
||||||
SQL);
|
SQL);
|
||||||
|
|
||||||
echo $query === true ? 'Drops table populated.<br />' : 'Error populating Drops table.';
|
echo $query === true ? 'Drops table populated.<br>' : 'Error populating Drops table.';
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = db()->exec(<<<SQL
|
$query = db()->exec(<<<SQL
|
||||||
|
@ -164,7 +161,7 @@ function second()
|
||||||
);
|
);
|
||||||
SQL);
|
SQL);
|
||||||
|
|
||||||
echo $query === true ? 'Forum table created.<br />' : 'Error creating Forum table.';
|
echo $query === true ? 'Forum table created.<br>' : 'Error creating Forum table.';
|
||||||
|
|
||||||
$query = db()->exec(<<<SQL
|
$query = db()->exec(<<<SQL
|
||||||
CREATE TABLE items (
|
CREATE TABLE items (
|
||||||
|
@ -177,7 +174,7 @@ function second()
|
||||||
);
|
);
|
||||||
SQL);
|
SQL);
|
||||||
|
|
||||||
echo $query === true ? 'Items table created.<br />' : 'Error creating Items table.';
|
echo $query === true ? 'Items table created.<br>' : 'Error creating Items table.';
|
||||||
|
|
||||||
if ($full) {
|
if ($full) {
|
||||||
$query = db()->exec(<<<SQL
|
$query = db()->exec(<<<SQL
|
||||||
|
@ -217,7 +214,7 @@ function second()
|
||||||
(33, 3, 'Destiny Aegis', 25000, 100, 'maxhp,50');
|
(33, 3, 'Destiny Aegis', 25000, 100, 'maxhp,50');
|
||||||
SQL);
|
SQL);
|
||||||
|
|
||||||
echo $query === true ? 'Items table populated.<br />' : 'Error populating Items table.';
|
echo $query === true ? 'Items table populated.<br>' : 'Error populating Items table.';
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = db()->exec(<<<SQL
|
$query = db()->exec(<<<SQL
|
||||||
|
@ -247,7 +244,7 @@ function second()
|
||||||
);
|
);
|
||||||
SQL);
|
SQL);
|
||||||
|
|
||||||
echo $query === true ? 'Levels table created.<br />' : 'Error creating Levels table.';
|
echo $query === true ? 'Levels table created.<br>' : 'Error creating Levels table.';
|
||||||
|
|
||||||
if ($full) {
|
if ($full) {
|
||||||
$query = db()->exec(<<<SQL
|
$query = db()->exec(<<<SQL
|
||||||
|
@ -354,7 +351,7 @@ function second()
|
||||||
(100, 16777215, 0, 0, 0, 0, 0, 0, 16777215, 0, 0, 0, 0, 0, 0, 16777215, 0, 0, 0, 0, 0, 0);
|
(100, 16777215, 0, 0, 0, 0, 0, 0, 16777215, 0, 0, 0, 0, 0, 0, 16777215, 0, 0, 0, 0, 0, 0);
|
||||||
SQL);
|
SQL);
|
||||||
|
|
||||||
echo $query === true ? 'Levels table populated.<br />' : 'Error populating Levels table.';
|
echo $query === true ? 'Levels table populated.<br>' : 'Error populating Levels table.';
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = db()->exec(<<<SQL
|
$query = db()->exec(<<<SQL
|
||||||
|
@ -371,7 +368,7 @@ function second()
|
||||||
);
|
);
|
||||||
SQL);
|
SQL);
|
||||||
|
|
||||||
echo $query === true ? 'Monsters table created.<br />' : 'Error creating Monsters table.';
|
echo $query === true ? 'Monsters table created.<br>' : 'Error creating Monsters table.';
|
||||||
|
|
||||||
if ($full) {
|
if ($full) {
|
||||||
$query = db()->exec(<<<SQL
|
$query = db()->exec(<<<SQL
|
||||||
|
@ -529,7 +526,7 @@ function second()
|
||||||
(151, 'Lucifuge', 600, 600, 400, 50, 10000, 10000, 2);
|
(151, 'Lucifuge', 600, 600, 400, 50, 10000, 10000, 2);
|
||||||
SQL);
|
SQL);
|
||||||
|
|
||||||
echo $query === true ? 'Monsters table populated.<br />' : 'Error populating Monsters table.';
|
echo $query === true ? 'Monsters table populated.<br>' : 'Error populating Monsters table.';
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = db()->exec(<<<SQL
|
$query = db()->exec(<<<SQL
|
||||||
|
@ -540,11 +537,11 @@ function second()
|
||||||
);
|
);
|
||||||
SQL);
|
SQL);
|
||||||
|
|
||||||
echo $query === true ? 'News table created.<br />' : 'Error creating News table.';
|
echo $query === true ? 'News table created.<br>' : 'Error creating News table.';
|
||||||
|
|
||||||
$query = db()->exec("INSERT INTO news VALUES (1, '2004-01-01 12:00:00', 'This is the first news post. Please use the admin control panel to add another one and make this one go away.');");
|
$query = db()->exec("INSERT INTO news VALUES (1, '2004-01-01 12:00:00', 'This is the first news post. Please use the admin control panel to add another one and make this one go away.');");
|
||||||
|
|
||||||
echo $query === true ? 'News table populated.<br />' : 'Error populating News table.';
|
echo $query === true ? 'News table populated.<br>' : 'Error populating News table.';
|
||||||
|
|
||||||
$query = db()->exec(<<<SQL
|
$query = db()->exec(<<<SQL
|
||||||
CREATE TABLE spells (
|
CREATE TABLE spells (
|
||||||
|
@ -556,7 +553,7 @@ function second()
|
||||||
);
|
);
|
||||||
SQL);
|
SQL);
|
||||||
|
|
||||||
echo $query === true ? 'Spells table created.<br />' : 'Error creating Spells table.';
|
echo $query === true ? 'Spells table created.<br>' : 'Error creating Spells table.';
|
||||||
|
|
||||||
if ($full) {
|
if ($full) {
|
||||||
$query = db()->exec(<<<SQL
|
$query = db()->exec(<<<SQL
|
||||||
|
@ -582,7 +579,7 @@ function second()
|
||||||
(19, 'Barrier', 30, 50, 5);
|
(19, 'Barrier', 30, 50, 5);
|
||||||
SQL);
|
SQL);
|
||||||
|
|
||||||
echo $query === true ? 'Spells table populated.<br />' : 'Error populating Spells table.';
|
echo $query === true ? 'Spells table populated.<br>' : 'Error populating Spells table.';
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = db()->exec(<<<SQL
|
$query = db()->exec(<<<SQL
|
||||||
|
@ -598,7 +595,7 @@ function second()
|
||||||
);
|
);
|
||||||
SQL);
|
SQL);
|
||||||
|
|
||||||
echo $query === true ? 'Towns table created.<br />' : 'Error creating Towns table.';
|
echo $query === true ? 'Towns table created.<br>' : 'Error creating Towns table.';
|
||||||
|
|
||||||
if ($full) {
|
if ($full) {
|
||||||
$query = db()->exec(<<<SQL
|
$query = db()->exec(<<<SQL
|
||||||
|
@ -613,7 +610,7 @@ function second()
|
||||||
(8, 'Endworld', -250, -250, 125, 9000, 160, '16,27,33');
|
(8, 'Endworld', -250, -250, 125, 9000, 160, '16,27,33');
|
||||||
SQL);
|
SQL);
|
||||||
|
|
||||||
echo $query === true ? 'Towns table populated.<br />' : 'Error populating Towns table.';
|
echo $query === true ? 'Towns table populated.<br>' : 'Error populating Towns table.';
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = db()->exec(<<<SQL
|
$query = db()->exec(<<<SQL
|
||||||
|
@ -622,13 +619,12 @@ function second()
|
||||||
`username` TEXT NOT NULL,
|
`username` TEXT NOT NULL,
|
||||||
`password` TEXT NOT NULL,
|
`password` TEXT NOT NULL,
|
||||||
`email` TEXT NOT NULL,
|
`email` TEXT NOT NULL,
|
||||||
`verify` INTEGER NOT NULL default 0,
|
`verify` TEXT NOT NULL default '',
|
||||||
`regdate` datetime NOT NULL default CURRENT_TIMESTAMP,
|
`regdate` datetime NOT NULL default CURRENT_TIMESTAMP,
|
||||||
`onlinetime` datetime NOT NULL default CURRENT_TIMESTAMP,
|
`onlinetime` datetime NOT NULL default CURRENT_TIMESTAMP,
|
||||||
`authlevel` INTEGER NOT NULL default 0,
|
`authlevel` INTEGER NOT NULL default 0,
|
||||||
`latitude` INTEGER NOT NULL default 0,
|
`latitude` INTEGER NOT NULL default 0,
|
||||||
`longitude` INTEGER NOT NULL default 0,
|
`longitude` INTEGER NOT NULL default 0,
|
||||||
`difficulty` INTEGER NOT NULL default 0,
|
|
||||||
`charclass` INTEGER NOT NULL default 0,
|
`charclass` INTEGER NOT NULL default 0,
|
||||||
`currentaction` TEXT NOT NULL default 'In Town',
|
`currentaction` TEXT NOT NULL default 'In Town',
|
||||||
`currentfight` INTEGER NOT NULL default 0,
|
`currentfight` INTEGER NOT NULL default 0,
|
||||||
|
@ -671,11 +667,10 @@ function second()
|
||||||
);
|
);
|
||||||
SQL);
|
SQL);
|
||||||
|
|
||||||
echo $query === true ? 'Users table created.<br />' : 'Error creating Users table.';
|
echo $query === true ? 'Users table created.<br>' : 'Error creating Users table.';
|
||||||
|
|
||||||
$time = round((microtime(true) - START), 4);
|
$time = round((microtime(true) - START), 4);
|
||||||
echo "<br />Database setup complete in $time seconds.<br /><br /><a href=\"install.php?page=3\">Click here to continue with installation.</a></body></html>";
|
echo "<br>Database setup complete in $time seconds.<br><br><a href=\"install.php?page=3\">Click here to continue with installation.</a></body></html>";
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -689,25 +684,22 @@ function third()
|
||||||
<title>Dragon Knight Installation</title>
|
<title>Dragon Knight Installation</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<b>Dragon Knight Installation: Page Three</b><br /><br />
|
<b>Dragon Knight Installation: Page Three</b><br><br>
|
||||||
Now you must create an administrator account so you can use the control panel. Fill out the form below to create your account. You will be able to customize the class names through the control panel once your admin account is created.<br /><br />
|
Now you must create an administrator account so you can use the control panel. Fill out the form below to create your account. You will be able to customize the class names through the control panel once your admin account is created.<br><br>
|
||||||
<form action="install.php?page=4" method="post">
|
<form action="install.php?page=4" method="post">
|
||||||
<table width="50%">
|
<table width="50%">
|
||||||
<tr><td width="20%" style="vertical-align:top;">Username:</td><td><input type="text" name="username" size="30" maxlength="30" /><br /><br /><br /></td></tr>
|
<tr><td width="20%" style="vertical-align:top;">Username:</td><td><input type="text" name="username" size="30" maxlength="30" /><br><br><br></td></tr>
|
||||||
<tr><td style="vertical-align:top;">Password:</td><td><input type="password" name="password1" size="30" maxlength="30" /></td></tr>
|
<tr><td style="vertical-align:top;">Password:</td><td><input type="password" name="password1" size="30" maxlength="30" /></td></tr>
|
||||||
<tr><td style="vertical-align:top;">Verify Password:</td><td><input type="password" name="password2" size="30" maxlength="30" /><br /><br /><br /></td></tr>
|
<tr><td style="vertical-align:top;">Verify Password:</td><td><input type="password" name="password2" size="30" maxlength="30" /><br><br><br></td></tr>
|
||||||
<tr><td style="vertical-align:top;">Email Address:</td><td><input type="text" name="email1" size="30" maxlength="100" /></td></tr>
|
<tr><td style="vertical-align:top;">Email Address:</td><td><input type="text" name="email1" size="30" maxlength="100" /></td></tr>
|
||||||
<tr><td style="vertical-align:top;">Verify Email:</td><td><input type="text" name="email2" size="30" maxlength="100" /><br /><br /><br /></td></tr>
|
<tr><td style="vertical-align:top;">Verify Email:</td><td><input type="text" name="email2" size="30" maxlength="100" /><br><br><br></td></tr>
|
||||||
<tr><td style="vertical-align:top;">Character Class:</td><td><select name="charclass"><option value="1">Mage</option><option value="2">Warrior</option><option value="3">Paladin</option></select></td></tr>
|
<tr><td style="vertical-align:top;">Character Class:</td><td><select name="charclass"><option value="1">Mage</option><option value="2">Warrior</option><option value="3">Paladin</option></select></td></tr>
|
||||||
<tr><td style="vertical-align:top;">Difficulty:</td><td><select name="difficulty"><option value="1">Easy</option><option value="2">Medium</option><option value="3">Hard</option></select></td></tr>
|
|
||||||
<tr><td colspan="2"><input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" /></td></tr>
|
<tr><td colspan="2"><input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" /></td></tr>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
HTML;
|
HTML;
|
||||||
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -767,11 +759,11 @@ function fourth()
|
||||||
<title>Dragon Knight Installation</title>
|
<title>Dragon Knight Installation</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<b>Dragon Knight Installation: Page Four</b><br /><br />
|
<b>Dragon Knight Installation: Page Four</b><br><br>
|
||||||
Your admin account was created successfully. Installation is complete.<br /><br />
|
Your admin account was created successfully. Installation is complete.<br><br>
|
||||||
Be sure to delete install.php from your Dragon Knight directory for security purposes.<br /><br />
|
Be sure to delete install.php from your Dragon Knight directory for security purposes.<br><br>
|
||||||
You are now ready to <a href="index.php">play the game</a>. Note that you must log in through the public section before being allowed into the control panel. Once logged in, an "Admin" link will appear in the Functions box of the left sidebar panel.<br /><br/>
|
You are now ready to <a href="index.php">play the game</a>. Note that you must log in through the public section before being allowed into the control panel. Once logged in, an "Admin" link will appear in the Functions box of the left sidebar panel.<br><br/>
|
||||||
Thank you for using Dragon Knight!<br /><br />-----<br /><br />
|
Thank you for using Dragon Knight!<br><br>-----<br><br>
|
||||||
<b>Optional:</b> Dragon Knight is a free product, and does not require registration of any sort. However, there is an
|
<b>Optional:</b> Dragon Knight is a free product, and does not require registration of any sort. However, there is an
|
||||||
optional "call home" function in the installer, which notifies the author of your game installation. The ONLY information
|
optional "call home" function in the installer, which notifies the author of your game installation. The ONLY information
|
||||||
transmitted with this function is the URL to your game. This is included mainly to satisfy the author's curiosity about
|
transmitted with this function is the URL to your game. This is included mainly to satisfy the author's curiosity about
|
||||||
|
@ -780,8 +772,6 @@ function fourth()
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
HTML;
|
HTML;
|
||||||
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -790,7 +780,7 @@ function fourth()
|
||||||
function fifth()
|
function fifth()
|
||||||
{
|
{
|
||||||
if (mail("sky@sharkk.net", "Dragon Knight Call Home", $_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"]) !== true) {
|
if (mail("sky@sharkk.net", "Dragon Knight Call Home", $_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"]) !== true) {
|
||||||
die('Dragon Knight was unable to send your URL. Please go back and try again, or just continue on to <a href=\"index.php\">the game</a>.');
|
exit('Dragon Knight was unable to send your URL. Please go back and try again, or just continue on to <a href=\"index.php\">the game</a>.');
|
||||||
}
|
}
|
||||||
|
|
||||||
echo <<<HTML
|
echo <<<HTML
|
||||||
|
@ -799,12 +789,10 @@ function fifth()
|
||||||
<title>Dragon Knight Installation</title>
|
<title>Dragon Knight Installation</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<b>Dragon Knight Installation: Page Five</b><br /><br />
|
<b>Dragon Knight Installation: Page Five</b><br><br>
|
||||||
Thank you for submitting your URL!<br /><br />
|
Thank you for submitting your URL!<br><br>
|
||||||
You are now ready to <a href="index.php">play the game</a>. Note that you must log in through the public section before being allowed into the control panel. Once logged in, an "Admin" link will appear in the Functions box of the left sidebar panel.
|
You are now ready to <a href="index.php">play the game</a>. Note that you must log in through the public section before being allowed into the control panel. Once logged in, an "Admin" link will appear in the Functions box of the left sidebar panel.
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
HTML;
|
HTML;
|
||||||
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,7 @@
|
||||||
|
|
||||||
// login.php :: Handles logins and cookies.
|
// login.php :: Handles logins and cookies.
|
||||||
|
|
||||||
if (!file_exists('../.installed')) {
|
if (!file_exists('../.installed')) redirect('install.php');
|
||||||
header('Location: install.php');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once '../src/lib.php';
|
require_once '../src/lib.php';
|
||||||
|
|
||||||
|
@ -16,10 +13,12 @@ match ($_GET['do'] ?? 'login') {
|
||||||
|
|
||||||
function login()
|
function login()
|
||||||
{
|
{
|
||||||
|
if (checkcookies() !== false) redirect('index.php');
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
$u = trim($_POST['username'] ?? '');
|
$u = trim($_POST['username'] ?? '');
|
||||||
|
|
||||||
$query = db()->query('SELECT * FROM users WHERE username = ? LIMIT 1;', [$u]);
|
$query = db()->query('SELECT id, username, password FROM users WHERE username = ? LIMIT 1;', [$u]);
|
||||||
if ($query === false) die("Invalid username or password. Please go back and try again.");
|
if ($query === false) die("Invalid username or password. Please go back and try again.");
|
||||||
$row = $query->fetchArray(SQLITE3_ASSOC);
|
$row = $query->fetchArray(SQLITE3_ASSOC);
|
||||||
if (!password_verify($_POST['password'] ?? '', $row['password'])) die("Invalid username or password. Please go back and try again.");
|
if (!password_verify($_POST['password'] ?? '', $row['password'])) die("Invalid username or password. Please go back and try again.");
|
||||||
|
|
377
public/users.php
377
public/users.php
|
@ -1,245 +1,252 @@
|
||||||
<?php // users.php :: Handles user account functions.
|
<?php
|
||||||
|
|
||||||
include('lib.php');
|
// users.php :: Handles user account functions.
|
||||||
$link = opendb();
|
|
||||||
|
|
||||||
if (isset($_GET["do"])) {
|
if (!file_exists('../.installed')) redirect('install.php');
|
||||||
|
|
||||||
$do = $_GET["do"];
|
require_once '../src/lib.php';
|
||||||
if ($do == "register") { register(); }
|
|
||||||
elseif ($do == "verify") { verify(); }
|
$controlrow = get_control_row();
|
||||||
elseif ($do == "lostpassword") { lostpassword(); }
|
|
||||||
elseif ($do == "changepassword") { changepassword(); }
|
$do = $_GET['do'] ?? 'register';
|
||||||
|
match ($do) {
|
||||||
}
|
'verify' => verify(),
|
||||||
|
'lostpassword' => lostpassword(),
|
||||||
|
'changepassword' => changepassword(),
|
||||||
|
default => register()
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a new account.
|
||||||
|
*/
|
||||||
|
function register()
|
||||||
|
{
|
||||||
|
global $controlrow;
|
||||||
|
|
||||||
function register() { // Register a new account.
|
|
||||||
|
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
|
||||||
|
|
||||||
if (isset($_POST["submit"])) {
|
if (isset($_POST["submit"])) {
|
||||||
|
$u = trim($_POST['username'] ?? '');
|
||||||
extract($_POST);
|
$e = trim($_POST['email1'] ?? '');
|
||||||
|
$e2 = trim($_POST['email2'] ?? '');
|
||||||
$errors = 0; $errorlist = "";
|
$p = $_POST['password1'] ?? '';
|
||||||
|
$p2 = $_POST['password2'] ?? '';
|
||||||
|
|
||||||
|
$errors = [];
|
||||||
|
|
||||||
// Process username.
|
// Process username.
|
||||||
if ($username == "") { $errors++; $errorlist .= "Username field is required.<br />"; }
|
if (empty($u) || strlen($u) < 3 || strlen($u) > 18 || !ctype_alnum(str_replace(' ', '', $u))) {
|
||||||
if (preg_match("/[^A-z0-9_\-]/", $username)==1) { $errors++; $errorlist .= "Username must be alphanumeric.<br />"; } // Thanks to "Carlos Pires" from php.net!
|
$errors[] = 'Username is required and must be between 3 and 18 characters long and contain only
|
||||||
$usernamequery = doquery("SELECT username FROM {{table}} WHERE username='$username' LIMIT 1","users");
|
alphanumeric characters and spaces.';
|
||||||
if (mysql_num_rows($usernamequery) > 0) { $errors++; $errorlist .= "Username already taken - unique username required.<br />"; }
|
}
|
||||||
|
|
||||||
// Process charname.
|
if (db()->exists('users', 'username', $u)) {
|
||||||
if ($charname == "") { $errors++; $errorlist .= "Character Name field is required.<br />"; }
|
$errors[] = 'Username already taken. Try another.';
|
||||||
if (preg_match("/[^A-z0-9_\-]/", $charname)==1) { $errors++; $errorlist .= "Character Name must be alphanumeric.<br />"; } // Thanks to "Carlos Pires" from php.net!
|
}
|
||||||
$characternamequery = doquery("SELECT charname FROM {{table}} WHERE charname='$charname' LIMIT 1","users");
|
|
||||||
if (mysql_num_rows($characternamequery) > 0) { $errors++; $errorlist .= "Character Name already taken - unique Character Name required.<br />"; }
|
|
||||||
|
|
||||||
// Process email address.
|
// Process email address.
|
||||||
if ($email1 == "" || $email2 == "") { $errors++; $errorlist .= "Email fields are required.<br />"; }
|
if (empty($e) || strlen($e) > 255 || !filter_var($e, FILTER_VALIDATE_EMAIL)) {
|
||||||
if ($email1 != $email2) { $errors++; $errorlist .= "Emails don't match.<br />"; }
|
$errors[] = 'Email is required must be a valid email address.';
|
||||||
if (! is_email($email1)) { $errors++; $errorlist .= "Email isn't valid.<br />"; }
|
}
|
||||||
$emailquery = doquery("SELECT email FROM {{table}} WHERE email='$email1' LIMIT 1","users");
|
|
||||||
if (mysql_num_rows($emailquery) > 0) { $errors++; $errorlist .= "Email already taken - unique email address required.<br />"; }
|
if ($e !== $e2) {
|
||||||
|
$errors[] = 'Verify Email must match.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (db()->exists('users', 'email', $e)) {
|
||||||
|
$errors[] = 'Email already taken. Forgot your password?';
|
||||||
|
}
|
||||||
|
|
||||||
// Process password.
|
// Process password.
|
||||||
if (trim($password1) == "") { $errors++; $errorlist .= "Password field is required.<br />"; }
|
if (empty($p) || strlen($p) < 6) {
|
||||||
if (preg_match("/[^A-z0-9_\-]/", $password1)==1) { $errors++; $errorlist .= "Password must be alphanumeric.<br />"; } // Thanks to "Carlos Pires" from php.net!
|
$errors[] = 'Password is required and must be at least 6 characters long.';
|
||||||
if ($password1 != $password2) { $errors++; $errorlist .= "Passwords don't match.<br />"; }
|
}
|
||||||
$password = md5($password1);
|
|
||||||
|
if ($p2 !== $p) {
|
||||||
if ($errors == 0) {
|
$errors[] = 'Verify Password must match.';
|
||||||
|
}
|
||||||
if ($controlrow["verifyemail"] == 1) {
|
|
||||||
$verifycode = "";
|
$password = password_hash($p, PASSWORD_ARGON2ID);
|
||||||
for ($i=0; $i<8; $i++) {
|
|
||||||
$verifycode .= chr(rand(65,90));
|
if (count($errors) !== 0) {
|
||||||
}
|
$err = "<ul>";
|
||||||
} else {
|
foreach ($errors as $error) $err .= "<li>$error</li>";
|
||||||
$verifycode='1';
|
$err .= "</ul>";
|
||||||
}
|
$page = "The following error(s) occurred when your account was being made:<br><span style=\"color:red;\">$err</span><br>Please go back and try again.";
|
||||||
|
} else {
|
||||||
$query = doquery("INSERT INTO {{table}} SET id='',regdate=NOW(),verify='$verifycode',username='$username',password='$password',email='$email1',charname='$charname',charclass='$charclass',difficulty='$difficulty'", "users") or die(mysql_error());
|
$token = ($controlrow['verifyemail'] == true) ? token(8) : 'g2g';
|
||||||
|
db()->query('INSERT INTO users (verify, username, password, email, charclass) VALUES (?, ?, ?, ?, ?)', [
|
||||||
if ($controlrow["verifyemail"] == 1) {
|
$token, $u, $password, $e, $_POST['charclass'] ?? 1
|
||||||
if (sendregmail($email1, $verifycode) == true) {
|
]);
|
||||||
$page = "Your account was created successfully.<br /><br />You should receive an Account Verification email shortly. You will need the verification code contained in that email before you are allowed to log in. Once you have received the email, please visit the <a href=\"users.php?do=verify\">Verification Page</a> to enter your code and start playing.";
|
|
||||||
|
if ($controlrow['verifyemail'] == true) {
|
||||||
|
if (sendregmail($e, $token)) {
|
||||||
|
$page = "Your account was created successfully.<br><br>You should receive an Account Verification email shortly. You will need the verification code contained in that email before you are allowed to log in. Once you have received the email, please visit the <a href=\"users.php?do=verify\">Verification Page</a> to enter your code and start playing.";
|
||||||
} else {
|
} else {
|
||||||
$page = "Your account was created successfully.<br /><br />However, there was a problem sending your verification email. Please check with the game administrator to help resolve this problem.";
|
$page = "Your account was created successfully.<br><br>However, there was a problem sending your verification email. Please check with the game administrator to help resolve this problem.";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$page = "Your account was created succesfully.<br /><br />You may now continue to the <a href=\"login.php?do=login\">Login Page</a> and continue playing ".$controlrow["gamename"]."!";
|
$page = "Your account was created succesfully.<br><br>You may now continue to the <a href=\"login.php?do=login\">Login Page</a> and continue playing ".$controlrow["gamename"]."!";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
|
||||||
|
|
||||||
$page = "The following error(s) occurred when your account was being made:<br /><span style=\"color:red;\">$errorlist</span><br />Please go back and try again.";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
if ($controlrow["verifyemail"] == true) {
|
||||||
$page = gettemplate("register");
|
$controlrow["verifytext"] = "<br><span class=\"small\">A verification code will be sent to the address above, and you will not be able to log in without first entering the code. Please be sure to enter your correct email address.</span>";
|
||||||
if ($controlrow["verifyemail"] == 1) {
|
|
||||||
$controlrow["verifytext"] = "<br /><span class=\"small\">A verification code will be sent to the address above, and you will not be able to log in without first entering the code. Please be sure to enter your correct email address.</span>";
|
|
||||||
} else {
|
} else {
|
||||||
$controlrow["verifytext"] = "";
|
$controlrow["verifytext"] = "";
|
||||||
}
|
}
|
||||||
$page = parsetemplate($page, $controlrow);
|
|
||||||
|
$page = parsetemplate(gettemplate("register"), $controlrow);
|
||||||
}
|
}
|
||||||
|
|
||||||
$topnav = "<a href=\"login.php?do=login\"><img src=\"images/button_login.gif\" alt=\"Log In\" border=\"0\" /></a><a href=\"users.php?do=register\"><img src=\"images/button_register.gif\" alt=\"Register\" border=\"0\" /></a><a href=\"help.php\"><img src=\"images/button_help.gif\" alt=\"Help\" border=\"0\" /></a>";
|
$topnav = "<a href=\"login.php?do=login\"><img src=\"images/button_login.gif\" alt=\"Log In\" border=\"0\" /></a><a href=\"users.php?do=register\"><img src=\"images/button_register.gif\" alt=\"Register\" border=\"0\" /></a><a href=\"help.php\"><img src=\"images/button_help.gif\" alt=\"Help\" border=\"0\" /></a>";
|
||||||
display($page, "Register", false, false, false);
|
display($page, "Register", false, false, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function verify() {
|
function verify()
|
||||||
|
{
|
||||||
if (isset($_POST["submit"])) {
|
if (isset($_POST["submit"])) {
|
||||||
extract($_POST);
|
$u = trim($_POST['username'] ?? '');
|
||||||
$userquery = doquery("SELECT username,email,verify FROM {{table}} WHERE username='$username' LIMIT 1","users");
|
$e = trim($_POST['email'] ?? '');
|
||||||
if (mysql_num_rows($userquery) != 1) { die("No account with that username."); }
|
$t = trim($_POST['token'] ?? '');
|
||||||
$userrow = mysql_fetch_array($userquery);
|
|
||||||
if ($userrow["verify"] == 1) { die("Your account is already verified."); }
|
$query = db()->query('SELECT id FROM users WHERE username=? AND email=? AND verify=? LIMIT 1;', [$u, $e, $t]);
|
||||||
if ($userrow["email"] != $email) { die("Incorrect email address."); }
|
if ($query === false) exit('Verification failed. Go back, double-check your details, and try again.');
|
||||||
if ($userrow["verify"] != $verify) { die("Incorrect verification code."); }
|
|
||||||
// If we've made it this far, should be safe to update their account.
|
db()->query("UPDATE users SET verify='g2g' WHERE username=?;", [$u]);
|
||||||
$updatequery = doquery("UPDATE {{table}} SET verify='1' WHERE username='$username' LIMIT 1","users");
|
|
||||||
display("Your account was verified successfully.<br /><br />You may now continue to the <a href=\"login.php?do=login\">Login Page</a> and start playing the game.<br /><br />Thanks for playing!","Verify Email",false,false,false);
|
display("Your account was verified successfully.<br><br>You may now continue to the <a href=\"login.php?do=login\">Login Page</a> and start playing the game.<br><br>Thanks for playing!","Verify Email",false,false,false);
|
||||||
}
|
}
|
||||||
$page = gettemplate("verify");
|
|
||||||
$topnav = "<a href=\"login.php?do=login\"><img src=\"images/button_login.gif\" alt=\"Log In\" border=\"0\" /></a><a href=\"users.php?do=register\"><img src=\"images/button_register.gif\" alt=\"Register\" border=\"0\" /></a><a href=\"help.php\"><img src=\"images/button_help.gif\" alt=\"Help\" border=\"0\" /></a>";
|
$topnav = "<a href=\"login.php?do=login\"><img src=\"images/button_login.gif\" alt=\"Log In\" border=\"0\" /></a><a href=\"users.php?do=register\"><img src=\"images/button_register.gif\" alt=\"Register\" border=\"0\" /></a><a href=\"help.php\"><img src=\"images/button_help.gif\" alt=\"Help\" border=\"0\" /></a>";
|
||||||
display($page, "Verify Email", false, false, false);
|
display(gettemplate("verify"), "Verify Email", false, false, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function lostpassword() {
|
function lostpassword()
|
||||||
|
{
|
||||||
if (isset($_POST["submit"])) {
|
if (isset($_POST["submit"])) {
|
||||||
extract($_POST);
|
$e = trim($_POST['email'] ?? '');
|
||||||
$userquery = doquery("SELECT email FROM {{table}} WHERE email='$email' LIMIT 1","users");
|
|
||||||
if (mysql_num_rows($userquery) != 1) { die("No account with that email address."); }
|
if (!db()->exists('users', 'email', $e)) exit("No account with that email address.");
|
||||||
$newpass = "";
|
|
||||||
for ($i=0; $i<8; $i++) {
|
$newpass = token(16);
|
||||||
$newpass .= chr(rand(65,90));
|
$hashed = password_hash($newpass, PASSWORD_ARGON2ID);
|
||||||
}
|
|
||||||
$md5newpass = md5($newpass);
|
db()->query('UPDATE users SET password=? WHERE email=?;', [$hashed, $e]);
|
||||||
$updatequery = doquery("UPDATE {{table}} SET password='$md5newpass' WHERE email='$email' LIMIT 1","users");
|
|
||||||
if (sendpassemail($email,$newpass) == true) {
|
if (sendpassemail($e, $newpass)) {
|
||||||
display("Your new password was emailed to the address you provided.<br /><br />Once you receive it, you may <a href=\"login.php?do=login\">Log In</a> and continue playing.<br /><br />Thank you.","Lost Password",false,false,false);
|
display("Your new password was emailed to the address you provided.<br><br>Once you receive it, you may <a href=\"login.php?do=login\">Log In</a> and continue playing.<br><br>Thank you.","Lost Password",false,false,false);
|
||||||
} else {
|
} else {
|
||||||
display("There was an error sending your new password.<br /><br />Please check with the game administrator for more information.<br /><br />We apologize for the inconvience.","Lost Password",false,false,false);
|
display("There was an error sending your new password.<br><br>Please check with the game administrator for more information.<br><br>We apologize for the inconvience.","Lost Password",false,false,false);
|
||||||
}
|
}
|
||||||
die();
|
|
||||||
}
|
}
|
||||||
$page = gettemplate("lostpassword");
|
|
||||||
$topnav = "<a href=\"login.php?do=login\"><img src=\"images/button_login.gif\" alt=\"Log In\" border=\"0\" /></a><a href=\"users.php?do=register\"><img src=\"images/button_register.gif\" alt=\"Register\" border=\"0\" /></a><a href=\"help.php\"><img src=\"images/button_help.gif\" alt=\"Help\" border=\"0\" /></a>";
|
$topnav = "<a href=\"login.php?do=login\"><img src=\"images/button_login.gif\" alt=\"Log In\" border=\"0\" /></a><a href=\"users.php?do=register\"><img src=\"images/button_register.gif\" alt=\"Register\" border=\"0\" /></a><a href=\"help.php\"><img src=\"images/button_help.gif\" alt=\"Help\" border=\"0\" /></a>";
|
||||||
display($page, "Lost Password", false, false, false);
|
display(gettemplate("lostpassword"), "Lost Password", false, false, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function changepassword() {
|
function changepassword()
|
||||||
|
{
|
||||||
if (isset($_POST["submit"])) {
|
if (isset($_POST["submit"])) {
|
||||||
extract($_POST);
|
$u = trim($_POST['username'] ?? '');
|
||||||
$userquery = doquery("SELECT * FROM {{table}} WHERE username='$username' LIMIT 1","users");
|
$p = $_POST['password'] ?? '';
|
||||||
if (mysql_num_rows($userquery) != 1) { die("No account with that username."); }
|
$np = $_POST['new_password'] ?? '';
|
||||||
$userrow = mysql_fetch_array($userquery);
|
$np2 = $_POST['new_password2'] ?? '';
|
||||||
if ($userrow["password"] != md5($oldpass)) { die("The old password you provided was incorrect."); }
|
|
||||||
if (preg_match("/[^A-z0-9_\-]/", $newpass1)==1) { die("New password must be alphanumeric."); } // Thanks to "Carlos Pires" from php.net!
|
$user = db()->query("SELECT password FROM users WHERE username=? LIMIT 1;", [$u]);
|
||||||
if ($newpass1 != $newpass2) { die("New passwords don't match."); }
|
$user = $user->fetchArray(SQLITE3_ASSOC);
|
||||||
$realnewpass = md5($newpass1);
|
if ($user === false) exit("No account with that username.");
|
||||||
$updatequery = doquery("UPDATE {{table}} SET password='$realnewpass' WHERE username='$username' LIMIT 1","users");
|
|
||||||
if (isset($_COOKIE["dkgame"])) { setcookie("dkgame", "", time()-100000, "/", "", 0); }
|
if (!password_verify($p, $user['password'])) exit("The old password you provided was incorrect.");
|
||||||
display("Your password was changed successfully.<br /><br />You have been logged out of the game to avoid cookie errors.<br /><br />Please <a href=\"login.php?do=login\">log back in</a> to continue playing.","Change Password",false,false,false);
|
|
||||||
die();
|
if (empty($np) || strlen($np) < 6) {
|
||||||
|
$errors[] = 'New password is required and must be at least 6 characters long.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($np2 !== $np) {
|
||||||
|
$errors[] = 'Verify New Password must match.';
|
||||||
|
}
|
||||||
|
|
||||||
|
$realnewpass = password_hash($np, PASSWORD_ARGON2ID);
|
||||||
|
db()->query('UPDATE users SET password=? WHERE username=?;', [$realnewpass, $u]);
|
||||||
|
|
||||||
|
set_cookie('dkgame', '', -3600);
|
||||||
|
|
||||||
|
display("Your password was changed successfully.<br><br>You have been logged out of the game to avoid errors.<br><br>Please <a href=\"login.php?do=login\">log back in</a> to continue playing.","Change Password",false,false,false);
|
||||||
}
|
}
|
||||||
$page = gettemplate("changepassword");
|
|
||||||
$topnav = "<a href=\"login.php?do=login\"><img src=\"images/button_login.gif\" alt=\"Log In\" border=\"0\" /></a><a href=\"users.php?do=register\"><img src=\"images/button_register.gif\" alt=\"Register\" border=\"0\" /></a><a href=\"help.php\"><img src=\"images/button_help.gif\" alt=\"Help\" border=\"0\" /></a>";
|
$topnav = "<a href=\"login.php?do=login\"><img src=\"images/button_login.gif\" alt=\"Log In\" border=\"0\" /></a><a href=\"users.php?do=register\"><img src=\"images/button_register.gif\" alt=\"Register\" border=\"0\" /></a><a href=\"help.php\"><img src=\"images/button_help.gif\" alt=\"Help\" border=\"0\" /></a>";
|
||||||
display($page, "Change Password", false, false, false);
|
display(gettemplate("changepassword"), "Change Password", false, false, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendpassemail($emailaddress, $password) {
|
function sendpassemail($emailaddress, $password)
|
||||||
|
{
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
global $controlrow;
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
|
||||||
extract($controlrow);
|
extract($controlrow);
|
||||||
|
|
||||||
$email = <<<END
|
|
||||||
You or someone using your email address submitted a Lost Password application on the $gamename server, located at $gameurl.
|
|
||||||
|
|
||||||
We have issued you a new password so you can log back into the game.
|
$email = <<<HTML
|
||||||
|
You or someone using your email address submitted a Lost Password application on the $gamename server, located at $gameurl.
|
||||||
|
|
||||||
Your new password is: $password
|
We have issued you a new password so you can log back into the game.
|
||||||
|
|
||||||
Thanks for playing.
|
Your new password is: $password
|
||||||
END;
|
|
||||||
|
Thanks for playing.
|
||||||
|
HTML;
|
||||||
|
|
||||||
$status = mymail($emailaddress, "$gamename Lost Password", $email);
|
$status = mymail($emailaddress, "$gamename Lost Password", $email);
|
||||||
return $status;
|
return $status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendregmail($emailaddress, $vercode) {
|
function sendregmail($emailaddress, $vercode)
|
||||||
|
{
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
global $controlrow;
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
|
||||||
extract($controlrow);
|
extract($controlrow);
|
||||||
$verurl = $gameurl . "?do=verify";
|
$verurl = $gameurl . "?do=verify";
|
||||||
|
|
||||||
$email = <<<END
|
|
||||||
You or someone using your email address recently signed up for an account on the $gamename server, located at $gameurl.
|
|
||||||
|
|
||||||
This email is sent to verify your registration email. In order to begin using your account, you must verify your email address.
|
$email = <<<HTML
|
||||||
Please visit the Verification Page ($verurl) and enter the code below to activate your account.
|
You or someone using your email address recently signed up for an account on the $gamename server, located at $gameurl.
|
||||||
Verification code: $vercode
|
|
||||||
|
|
||||||
If you were not the person who signed up for the game, please disregard this message. You will not be emailed again.
|
This email is sent to verify your registration email. In order to begin using your account, you must verify your email address.
|
||||||
END;
|
Please visit the Verification Page ($verurl) and enter the code below to activate your account.
|
||||||
|
Verification code: $vercode
|
||||||
|
|
||||||
|
If you were not the person who signed up for the game, please disregard this message. You will not be emailed again.
|
||||||
|
HTML;
|
||||||
|
|
||||||
$status = mymail($emailaddress, "$gamename Account Verification", $email);
|
$status = mymail($emailaddress, "$gamename Account Verification", $email);
|
||||||
return $status;
|
return $status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function mymail($to, $title, $body, $from = '') { // thanks to arto dot PLEASE dot DO dot NOT dot SPAM at artoaaltonen dot fi.
|
/**
|
||||||
|
* thanks to arto dot PLEASE dot DO dot NOT dot SPAM at artoaaltonen dot fi.
|
||||||
|
*/
|
||||||
|
function mymail($to, $title, $body, $from = '')
|
||||||
|
{
|
||||||
|
global $controlrow;
|
||||||
|
extract($controlrow);
|
||||||
|
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
$from = trim($from);
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
|
||||||
extract($controlrow);
|
|
||||||
|
|
||||||
|
|
||||||
$from = trim($from);
|
if (!$from) $from = '<'.$controlrow["adminemail"].'>';
|
||||||
|
|
||||||
if (!$from) {
|
$rp = $controlrow["adminemail"];
|
||||||
$from = '<'.$controlrow["adminemail"].'>';
|
$org = '$gameurl';
|
||||||
}
|
$mailer = 'PHP';
|
||||||
|
|
||||||
$rp = $controlrow["adminemail"];
|
$head = '';
|
||||||
$org = '$gameurl';
|
$head .= "Content-Type: text/plain \r\n";
|
||||||
$mailer = 'PHP';
|
$head .= "Date: ". date('r'). " \r\n";
|
||||||
|
$head .= "Return-Path: $rp \r\n";
|
||||||
|
$head .= "From: $from \r\n";
|
||||||
|
$head .= "Sender: $from \r\n";
|
||||||
|
$head .= "Reply-To: $from \r\n";
|
||||||
|
$head .= "Organization: $org \r\n";
|
||||||
|
$head .= "X-Sender: $from \r\n";
|
||||||
|
$head .= "X-Priority: 3 \r\n";
|
||||||
|
$head .= "X-Mailer: $mailer \r\n";
|
||||||
|
|
||||||
$head = '';
|
$body = str_replace("\r\n", "\n", $body);
|
||||||
$head .= "Content-Type: text/plain \r\n";
|
$body = str_replace("\n", "\r\n", $body);
|
||||||
$head .= "Date: ". date('r'). " \r\n";
|
|
||||||
$head .= "Return-Path: $rp \r\n";
|
|
||||||
$head .= "From: $from \r\n";
|
|
||||||
$head .= "Sender: $from \r\n";
|
|
||||||
$head .= "Reply-To: $from \r\n";
|
|
||||||
$head .= "Organization: $org \r\n";
|
|
||||||
$head .= "X-Sender: $from \r\n";
|
|
||||||
$head .= "X-Priority: 3 \r\n";
|
|
||||||
$head .= "X-Mailer: $mailer \r\n";
|
|
||||||
|
|
||||||
$body = str_replace("\r\n", "\n", $body);
|
return mail($to, $title, $body, $head);
|
||||||
$body = str_replace("\n", "\r\n", $body);
|
|
||||||
|
|
||||||
return mail($to, $title, $body, $head);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
|
@ -22,7 +22,6 @@ class Database extends SQLite3
|
||||||
{
|
{
|
||||||
$p = strpos($query, '?') !== false;
|
$p = strpos($query, '?') !== false;
|
||||||
$stmt = $this->prepare($query);
|
$stmt = $this->prepare($query);
|
||||||
|
|
||||||
foreach ($params ?? [] as $k => $v) $stmt->bindValue($p ? $k + 1 : $k, $v, $this->getSQLiteType($v));
|
foreach ($params ?? [] as $k => $v) $stmt->bindValue($p ? $k + 1 : $k, $v, $this->getSQLiteType($v));
|
||||||
|
|
||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
|
|
|
@ -1,37 +1,30 @@
|
||||||
<?php // explore.php :: Handles all map exploring, chances to fight, etc.
|
<?php
|
||||||
|
|
||||||
function move() {
|
// explore.php :: Handles all map exploring, chances to fight, etc.
|
||||||
|
|
||||||
|
function move()
|
||||||
|
{
|
||||||
global $userrow, $controlrow;
|
global $userrow, $controlrow;
|
||||||
|
|
||||||
if ($userrow["currentaction"] == "Fighting") { header("Location: index.php?do=fight"); die(); }
|
if ($userrow["currentaction"] == "Fighting") { header("Location: index.php?do=fight"); die(); }
|
||||||
|
|
||||||
$latitude = $userrow["latitude"];
|
$latitude = $userrow["latitude"];
|
||||||
$longitude = $userrow["longitude"];
|
$longitude = $userrow["longitude"];
|
||||||
if (isset($_POST["north"])) { $latitude++; if ($latitude > $controlrow["gamesize"]) { $latitude = $controlrow["gamesize"]; } }
|
if (isset($_POST["north"])) { $latitude++; if ($latitude > $controlrow["gamesize"]) { $latitude = $controlrow["gamesize"]; } }
|
||||||
if (isset($_POST["south"])) { $latitude--; if ($latitude < ($controlrow["gamesize"]*-1)) { $latitude = ($controlrow["gamesize"]*-1); } }
|
if (isset($_POST["south"])) { $latitude--; if ($latitude < ($controlrow["gamesize"]*-1)) { $latitude = ($controlrow["gamesize"]*-1); } }
|
||||||
if (isset($_POST["east"])) { $longitude++; if ($longitude > $controlrow["gamesize"]) { $longitude = $controlrow["gamesize"]; } }
|
if (isset($_POST["east"])) { $longitude++; if ($longitude > $controlrow["gamesize"]) { $longitude = $controlrow["gamesize"]; } }
|
||||||
if (isset($_POST["west"])) { $longitude--; if ($longitude < ($controlrow["gamesize"]*-1)) { $longitude = ($controlrow["gamesize"]*-1); } }
|
if (isset($_POST["west"])) { $longitude--; if ($longitude < ($controlrow["gamesize"]*-1)) { $longitude = ($controlrow["gamesize"]*-1); } }
|
||||||
|
|
||||||
$townquery = doquery("SELECT id FROM {{table}} WHERE latitude='$latitude' AND longitude='$longitude' LIMIT 1", "towns");
|
$town = get_town_by_xy($longitude, $latitude);
|
||||||
if (mysql_num_rows($townquery) > 0) {
|
if ($town !== false) {
|
||||||
$townrow = mysql_fetch_array($townquery);
|
require_once __DIR__ . '/towns.php';
|
||||||
include('towns.php');
|
travelto($town['id'], false);
|
||||||
travelto($townrow["id"], false);
|
return;
|
||||||
die();
|
|
||||||
}
|
|
||||||
|
|
||||||
$chancetofight = rand(1,5);
|
|
||||||
if ($chancetofight == 1) {
|
|
||||||
$action = "currentaction='Fighting', currentfight='1',";
|
|
||||||
} else {
|
|
||||||
$action = "currentaction='Exploring',";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$chancetofight = rand(1, 5);
|
||||||
$updatequery = doquery("UPDATE {{table}} SET $action latitude='$latitude', longitude='$longitude', dropcode='0' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
$action = $chancetofight === 1 ? "currentaction='Fighting', currentfight='1'," : "currentaction='Exploring',";
|
||||||
|
|
||||||
|
db()->query("UPDATE users SET $action latitude = ?, longitude = ?, dropcode = 0 WHERE id = ?;", [$latitude, $longitude, $userrow['id']]);
|
||||||
header("Location: index.php");
|
header("Location: index.php");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
260
src/fight.php
260
src/fight.php
|
@ -1,12 +1,12 @@
|
||||||
<?php // fight.php :: Handles all fighting action.
|
<?php // fight.php :: Handles all fighting action.
|
||||||
|
|
||||||
function fight() { // One big long function that determines the outcome of the fight.
|
function fight() { // One big long function that determines the outcome of the fight.
|
||||||
|
|
||||||
global $userrow, $controlrow;
|
global $userrow, $controlrow;
|
||||||
if ($userrow["currentaction"] != "Fighting") { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
if ($userrow["currentaction"] != "Fighting") { display("Cheat attempt detected.<br><br>Get a life, loser.", "Error"); }
|
||||||
$pagearray = array();
|
$pagearray = array();
|
||||||
$playerisdead = 0;
|
$playerisdead = 0;
|
||||||
|
|
||||||
$pagearray["magiclist"] = "";
|
$pagearray["magiclist"] = "";
|
||||||
$userspells = explode(",",$userrow["spells"]);
|
$userspells = explode(",",$userrow["spells"]);
|
||||||
$spellquery = doquery("SELECT id,name FROM {{table}}", "spells");
|
$spellquery = doquery("SELECT id,name FROM {{table}}", "spells");
|
||||||
|
@ -22,70 +22,66 @@ function fight() { // One big long function that determines the outcome of the f
|
||||||
}
|
}
|
||||||
if ($pagearray["magiclist"] == "") { $pagearray["magiclist"] = "<option value=\"0\">None</option>\n"; }
|
if ($pagearray["magiclist"] == "") { $pagearray["magiclist"] = "<option value=\"0\">None</option>\n"; }
|
||||||
$magiclist = $pagearray["magiclist"];
|
$magiclist = $pagearray["magiclist"];
|
||||||
|
|
||||||
$chancetoswingfirst = 1;
|
$chancetoswingfirst = 1;
|
||||||
|
|
||||||
// First, check to see if we need to pick a monster.
|
// First, check to see if we need to pick a monster.
|
||||||
if ($userrow["currentfight"] == 1) {
|
if ($userrow["currentfight"] == 1) {
|
||||||
|
|
||||||
if ($userrow["latitude"] < 0) { $userrow["latitude"] *= -1; } // Equalize negatives.
|
if ($userrow["latitude"] < 0) { $userrow["latitude"] *= -1; } // Equalize negatives.
|
||||||
if ($userrow["longitude"] < 0) { $userrow["longitude"] *= -1; } // Ditto.
|
if ($userrow["longitude"] < 0) { $userrow["longitude"] *= -1; } // Ditto.
|
||||||
$maxlevel = floor(max($userrow["latitude"]+5, $userrow["longitude"]+5) / 5); // One mlevel per five spaces.
|
$maxlevel = floor(max($userrow["latitude"]+5, $userrow["longitude"]+5) / 5); // One mlevel per five spaces.
|
||||||
if ($maxlevel < 1) { $maxlevel = 1; }
|
if ($maxlevel < 1) { $maxlevel = 1; }
|
||||||
$minlevel = $maxlevel - 2;
|
$minlevel = $maxlevel - 2;
|
||||||
if ($minlevel < 1) { $minlevel = 1; }
|
if ($minlevel < 1) { $minlevel = 1; }
|
||||||
|
|
||||||
|
|
||||||
// Pick a monster.
|
// Pick a monster.
|
||||||
$monsterquery = doquery("SELECT * FROM {{table}} WHERE level>='$minlevel' AND level<='$maxlevel' ORDER BY RAND() LIMIT 1", "monsters");
|
$monsterquery = doquery("SELECT * FROM {{table}} WHERE level>='$minlevel' AND level<='$maxlevel' ORDER BY RAND() LIMIT 1", "monsters");
|
||||||
$monsterrow = mysql_fetch_array($monsterquery);
|
$monsterrow = mysql_fetch_array($monsterquery);
|
||||||
$userrow["currentmonster"] = $monsterrow["id"];
|
$userrow["currentmonster"] = $monsterrow["id"];
|
||||||
$userrow["currentmonsterhp"] = rand((($monsterrow["maxhp"]/5)*4),$monsterrow["maxhp"]);
|
$userrow["currentmonsterhp"] = rand((($monsterrow["maxhp"]/5)*4),$monsterrow["maxhp"]);
|
||||||
if ($userrow["difficulty"] == 2) { $userrow["currentmonsterhp"] = ceil($userrow["currentmonsterhp"] * $controlrow["diff2mod"]); }
|
|
||||||
if ($userrow["difficulty"] == 3) { $userrow["currentmonsterhp"] = ceil($userrow["currentmonsterhp"] * $controlrow["diff3mod"]); }
|
|
||||||
$userrow["currentmonstersleep"] = 0;
|
$userrow["currentmonstersleep"] = 0;
|
||||||
$userrow["currentmonsterimmune"] = $monsterrow["immune"];
|
$userrow["currentmonsterimmune"] = $monsterrow["immune"];
|
||||||
|
|
||||||
$chancetoswingfirst = rand(1,10) + ceil(sqrt($userrow["dexterity"]));
|
$chancetoswingfirst = rand(1,10) + ceil(sqrt($userrow["dexterity"]));
|
||||||
if ($chancetoswingfirst > (rand(1,7) + ceil(sqrt($monsterrow["maxdam"])))) { $chancetoswingfirst = 1; } else { $chancetoswingfirst = 0; }
|
if ($chancetoswingfirst > (rand(1,7) + ceil(sqrt($monsterrow["maxdam"])))) { $chancetoswingfirst = 1; } else { $chancetoswingfirst = 0; }
|
||||||
|
|
||||||
unset($monsterquery);
|
unset($monsterquery);
|
||||||
unset($monsterrow);
|
unset($monsterrow);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next, get the monster statistics.
|
// Next, get the monster statistics.
|
||||||
$monsterquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["currentmonster"]."' LIMIT 1", "monsters");
|
$monsterquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["currentmonster"]."' LIMIT 1", "monsters");
|
||||||
$monsterrow = mysql_fetch_array($monsterquery);
|
$monsterrow = mysql_fetch_array($monsterquery);
|
||||||
$pagearray["monstername"] = $monsterrow["name"];
|
$pagearray["monstername"] = $monsterrow["name"];
|
||||||
|
|
||||||
// Do run stuff.
|
// Do run stuff.
|
||||||
if (isset($_POST["run"])) {
|
if (isset($_POST["run"])) {
|
||||||
|
|
||||||
$chancetorun = rand(4,10) + ceil(sqrt($userrow["dexterity"]));
|
$chancetorun = rand(4,10) + ceil(sqrt($userrow["dexterity"]));
|
||||||
if ($chancetorun > (rand(1,5) + ceil(sqrt($monsterrow["maxdam"])))) { $chancetorun = 1; } else { $chancetorun = 0; }
|
if ($chancetorun > (rand(1,5) + ceil(sqrt($monsterrow["maxdam"])))) { $chancetorun = 1; } else { $chancetorun = 0; }
|
||||||
|
|
||||||
if ($chancetorun == 0) {
|
if ($chancetorun == 0) {
|
||||||
$pagearray["yourturn"] = "You tried to run away, but were blocked in front!<br /><br />";
|
$pagearray["yourturn"] = "You tried to run away, but were blocked in front!<br><br>";
|
||||||
$pagearray["monsterhp"] = "Monster's HP: " . $userrow["currentmonsterhp"] . "<br /><br />";
|
$pagearray["monsterhp"] = "Monster's HP: " . $userrow["currentmonsterhp"] . "<br><br>";
|
||||||
$pagearray["monsterturn"] = "";
|
$pagearray["monsterturn"] = "";
|
||||||
if ($userrow["currentmonstersleep"] != 0) { // Check to wake up.
|
if ($userrow["currentmonstersleep"] != 0) { // Check to wake up.
|
||||||
$chancetowake = rand(1,15);
|
$chancetowake = rand(1,15);
|
||||||
if ($chancetowake > $userrow["currentmonstersleep"]) {
|
if ($chancetowake > $userrow["currentmonstersleep"]) {
|
||||||
$userrow["currentmonstersleep"] = 0;
|
$userrow["currentmonstersleep"] = 0;
|
||||||
$pagearray["monsterturn"] .= "The monster has woken up.<br />";
|
$pagearray["monsterturn"] .= "The monster has woken up.<br>";
|
||||||
} else {
|
} else {
|
||||||
$pagearray["monsterturn"] .= "The monster is still asleep.<br />";
|
$pagearray["monsterturn"] .= "The monster is still asleep.<br>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($userrow["currentmonstersleep"] == 0) { // Only do this if the monster is awake.
|
if ($userrow["currentmonstersleep"] == 0) { // Only do this if the monster is awake.
|
||||||
$tohit = ceil(rand($monsterrow["maxdam"]*.5,$monsterrow["maxdam"]));
|
$tohit = ceil(rand($monsterrow["maxdam"]*.5,$monsterrow["maxdam"]));
|
||||||
if ($userrow["difficulty"] == 2) { $tohit = ceil($tohit * $controlrow["diff2mod"]); }
|
|
||||||
if ($userrow["difficulty"] == 3) { $tohit = ceil($tohit * $controlrow["diff3mod"]); }
|
|
||||||
$toblock = ceil(rand($userrow["defensepower"]*.75,$userrow["defensepower"])/4);
|
$toblock = ceil(rand($userrow["defensepower"]*.75,$userrow["defensepower"])/4);
|
||||||
$tododge = rand(1,150);
|
$tododge = rand(1,150);
|
||||||
if ($tododge <= sqrt($userrow["dexterity"])) {
|
if ($tododge <= sqrt($userrow["dexterity"])) {
|
||||||
$tohit = 0; $pagearray["monsterturn"] .= "You dodge the monster's attack. No damage has been scored.<br />";
|
$tohit = 0; $pagearray["monsterturn"] .= "You dodge the monster's attack. No damage has been scored.<br>";
|
||||||
$persondamage = 0;
|
$persondamage = 0;
|
||||||
} else {
|
} else {
|
||||||
$persondamage = $tohit - $toblock;
|
$persondamage = $tohit - $toblock;
|
||||||
|
@ -95,7 +91,7 @@ function fight() { // One big long function that determines the outcome of the f
|
||||||
}
|
}
|
||||||
if ($persondamage < 1) { $persondamage = 1; }
|
if ($persondamage < 1) { $persondamage = 1; }
|
||||||
}
|
}
|
||||||
$pagearray["monsterturn"] .= "The monster attacks you for $persondamage damage.<br /><br />";
|
$pagearray["monsterturn"] .= "The monster attacks you for $persondamage damage.<br><br>";
|
||||||
$userrow["currenthp"] -= $persondamage;
|
$userrow["currenthp"] -= $persondamage;
|
||||||
if ($userrow["currenthp"] <= 0) {
|
if ($userrow["currenthp"] <= 0) {
|
||||||
$newgold = ceil($userrow["gold"]/2);
|
$newgold = ceil($userrow["gold"]/2);
|
||||||
|
@ -109,19 +105,19 @@ function fight() { // One big long function that determines the outcome of the f
|
||||||
$updatequery = doquery("UPDATE {{table}} SET currentaction='Exploring' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
$updatequery = doquery("UPDATE {{table}} SET currentaction='Exploring' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||||
header("Location: index.php");
|
header("Location: index.php");
|
||||||
die();
|
die();
|
||||||
|
|
||||||
// Do fight stuff.
|
// Do fight stuff.
|
||||||
} elseif (isset($_POST["fight"])) {
|
} elseif (isset($_POST["fight"])) {
|
||||||
|
|
||||||
// Your turn.
|
// Your turn.
|
||||||
$pagearray["yourturn"] = "";
|
$pagearray["yourturn"] = "";
|
||||||
$tohit = ceil(rand($userrow["attackpower"]*.75,$userrow["attackpower"])/3);
|
$tohit = ceil(rand($userrow["attackpower"]*.75,$userrow["attackpower"])/3);
|
||||||
$toexcellent = rand(1,150);
|
$toexcellent = rand(1,150);
|
||||||
if ($toexcellent <= sqrt($userrow["strength"])) { $tohit *= 2; $pagearray["yourturn"] .= "Excellent hit!<br />"; }
|
if ($toexcellent <= sqrt($userrow["strength"])) { $tohit *= 2; $pagearray["yourturn"] .= "Excellent hit!<br>"; }
|
||||||
$toblock = ceil(rand($monsterrow["armor"]*.75,$monsterrow["armor"])/3);
|
$toblock = ceil(rand($monsterrow["armor"]*.75,$monsterrow["armor"])/3);
|
||||||
$tododge = rand(1,200);
|
$tododge = rand(1,200);
|
||||||
if ($tododge <= sqrt($monsterrow["armor"])) {
|
if ($tododge <= sqrt($monsterrow["armor"])) {
|
||||||
$tohit = 0; $pagearray["yourturn"] .= "The monster is dodging. No damage has been scored.<br />";
|
$tohit = 0; $pagearray["yourturn"] .= "The monster is dodging. No damage has been scored.<br>";
|
||||||
$monsterdamage = 0;
|
$monsterdamage = 0;
|
||||||
} else {
|
} else {
|
||||||
$monsterdamage = $tohit - $toblock;
|
$monsterdamage = $tohit - $toblock;
|
||||||
|
@ -130,34 +126,32 @@ function fight() { // One big long function that determines the outcome of the f
|
||||||
$monsterdamage += ceil($monsterdamage * ($userrow["currentuberdamage"]/100));
|
$monsterdamage += ceil($monsterdamage * ($userrow["currentuberdamage"]/100));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$pagearray["yourturn"] .= "You attack the monster for $monsterdamage damage.<br /><br />";
|
$pagearray["yourturn"] .= "You attack the monster for $monsterdamage damage.<br><br>";
|
||||||
$userrow["currentmonsterhp"] -= $monsterdamage;
|
$userrow["currentmonsterhp"] -= $monsterdamage;
|
||||||
$pagearray["monsterhp"] = "Monster's HP: " . $userrow["currentmonsterhp"] . "<br /><br />";
|
$pagearray["monsterhp"] = "Monster's HP: " . $userrow["currentmonsterhp"] . "<br><br>";
|
||||||
if ($userrow["currentmonsterhp"] <= 0) {
|
if ($userrow["currentmonsterhp"] <= 0) {
|
||||||
$updatequery = doquery("UPDATE {{table}} SET currentmonsterhp='0' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
$updatequery = doquery("UPDATE {{table}} SET currentmonsterhp='0' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||||
header("Location: index.php?do=victory");
|
header("Location: index.php?do=victory");
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Monster's turn.
|
// Monster's turn.
|
||||||
$pagearray["monsterturn"] = "";
|
$pagearray["monsterturn"] = "";
|
||||||
if ($userrow["currentmonstersleep"] != 0) { // Check to wake up.
|
if ($userrow["currentmonstersleep"] != 0) { // Check to wake up.
|
||||||
$chancetowake = rand(1,15);
|
$chancetowake = rand(1,15);
|
||||||
if ($chancetowake > $userrow["currentmonstersleep"]) {
|
if ($chancetowake > $userrow["currentmonstersleep"]) {
|
||||||
$userrow["currentmonstersleep"] = 0;
|
$userrow["currentmonstersleep"] = 0;
|
||||||
$pagearray["monsterturn"] .= "The monster has woken up.<br />";
|
$pagearray["monsterturn"] .= "The monster has woken up.<br>";
|
||||||
} else {
|
} else {
|
||||||
$pagearray["monsterturn"] .= "The monster is still asleep.<br />";
|
$pagearray["monsterturn"] .= "The monster is still asleep.<br>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($userrow["currentmonstersleep"] == 0) { // Only do this if the monster is awake.
|
if ($userrow["currentmonstersleep"] == 0) { // Only do this if the monster is awake.
|
||||||
$tohit = ceil(rand($monsterrow["maxdam"]*.5,$monsterrow["maxdam"]));
|
$tohit = ceil(rand($monsterrow["maxdam"]*.5,$monsterrow["maxdam"]));
|
||||||
if ($userrow["difficulty"] == 2) { $tohit = ceil($tohit * $controlrow["diff2mod"]); }
|
|
||||||
if ($userrow["difficulty"] == 3) { $tohit = ceil($tohit * $controlrow["diff3mod"]); }
|
|
||||||
$toblock = ceil(rand($userrow["defensepower"]*.75,$userrow["defensepower"])/4);
|
$toblock = ceil(rand($userrow["defensepower"]*.75,$userrow["defensepower"])/4);
|
||||||
$tododge = rand(1,150);
|
$tododge = rand(1,150);
|
||||||
if ($tododge <= sqrt($userrow["dexterity"])) {
|
if ($tododge <= sqrt($userrow["dexterity"])) {
|
||||||
$tohit = 0; $pagearray["monsterturn"] .= "You dodge the monster's attack. No damage has been scored.<br />";
|
$tohit = 0; $pagearray["monsterturn"] .= "You dodge the monster's attack. No damage has been scored.<br>";
|
||||||
$persondamage = 0;
|
$persondamage = 0;
|
||||||
} else {
|
} else {
|
||||||
$persondamage = $tohit - $toblock;
|
$persondamage = $tohit - $toblock;
|
||||||
|
@ -167,7 +161,7 @@ function fight() { // One big long function that determines the outcome of the f
|
||||||
}
|
}
|
||||||
if ($persondamage < 1) { $persondamage = 1; }
|
if ($persondamage < 1) { $persondamage = 1; }
|
||||||
}
|
}
|
||||||
$pagearray["monsterturn"] .= "The monster attacks you for $persondamage damage.<br /><br />";
|
$pagearray["monsterturn"] .= "The monster attacks you for $persondamage damage.<br><br>";
|
||||||
$userrow["currenthp"] -= $persondamage;
|
$userrow["currenthp"] -= $persondamage;
|
||||||
if ($userrow["currenthp"] <= 0) {
|
if ($userrow["currenthp"] <= 0) {
|
||||||
$newgold = ceil($userrow["gold"]/2);
|
$newgold = ceil($userrow["gold"]/2);
|
||||||
|
@ -176,14 +170,14 @@ function fight() { // One big long function that determines the outcome of the f
|
||||||
$playerisdead = 1;
|
$playerisdead = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do spell stuff.
|
// Do spell stuff.
|
||||||
} elseif (isset($_POST["spell"])) {
|
} elseif (isset($_POST["spell"])) {
|
||||||
|
|
||||||
// Your turn.
|
// Your turn.
|
||||||
$pickedspell = $_POST["userspell"];
|
$pickedspell = $_POST["userspell"];
|
||||||
if ($pickedspell == 0) { display("You must select a spell first. Please go back and try again.", "Error"); die(); }
|
if ($pickedspell == 0) { display("You must select a spell first. Please go back and try again.", "Error"); die(); }
|
||||||
|
|
||||||
$newspellquery = doquery("SELECT * FROM {{table}} WHERE id='$pickedspell' LIMIT 1", "spells");
|
$newspellquery = doquery("SELECT * FROM {{table}} WHERE id='$pickedspell' LIMIT 1", "spells");
|
||||||
$newspellrow = mysql_fetch_array($newspellquery);
|
$newspellrow = mysql_fetch_array($newspellquery);
|
||||||
$spell = false;
|
$spell = false;
|
||||||
|
@ -192,66 +186,64 @@ function fight() { // One big long function that determines the outcome of the f
|
||||||
}
|
}
|
||||||
if ($spell != true) { display("You have not yet learned this spell. Please go back and try again.", "Error"); die(); }
|
if ($spell != true) { display("You have not yet learned this spell. Please go back and try again.", "Error"); die(); }
|
||||||
if ($userrow["currentmp"] < $newspellrow["mp"]) { display("You do not have enough Magic Points to cast this spell. Please go back and try again.", "Error"); die(); }
|
if ($userrow["currentmp"] < $newspellrow["mp"]) { display("You do not have enough Magic Points to cast this spell. Please go back and try again.", "Error"); die(); }
|
||||||
|
|
||||||
if ($newspellrow["type"] == 1) { // Heal spell.
|
if ($newspellrow["type"] == 1) { // Heal spell.
|
||||||
$newhp = $userrow["currenthp"] + $newspellrow["attribute"];
|
$newhp = $userrow["currenthp"] + $newspellrow["attribute"];
|
||||||
if ($userrow["maxhp"] < $newhp) { $newspellrow["attribute"] = $userrow["maxhp"] - $userrow["currenthp"]; $newhp = $userrow["currenthp"] + $newspellrow["attribute"]; }
|
if ($userrow["maxhp"] < $newhp) { $newspellrow["attribute"] = $userrow["maxhp"] - $userrow["currenthp"]; $newhp = $userrow["currenthp"] + $newspellrow["attribute"]; }
|
||||||
$userrow["currenthp"] = $newhp;
|
$userrow["currenthp"] = $newhp;
|
||||||
$userrow["currentmp"] -= $newspellrow["mp"];
|
$userrow["currentmp"] -= $newspellrow["mp"];
|
||||||
$pagearray["yourturn"] = "You have cast the ".$newspellrow["name"]." spell, and gained ".$newspellrow["attribute"]." Hit Points.<br /><br />";
|
$pagearray["yourturn"] = "You have cast the ".$newspellrow["name"]." spell, and gained ".$newspellrow["attribute"]." Hit Points.<br><br>";
|
||||||
} elseif ($newspellrow["type"] == 2) { // Hurt spell.
|
} elseif ($newspellrow["type"] == 2) { // Hurt spell.
|
||||||
if ($userrow["currentmonsterimmune"] == 0) {
|
if ($userrow["currentmonsterimmune"] == 0) {
|
||||||
$monsterdamage = rand((($newspellrow["attribute"]/6)*5), $newspellrow["attribute"]);
|
$monsterdamage = rand((($newspellrow["attribute"]/6)*5), $newspellrow["attribute"]);
|
||||||
$userrow["currentmonsterhp"] -= $monsterdamage;
|
$userrow["currentmonsterhp"] -= $monsterdamage;
|
||||||
$pagearray["yourturn"] = "You have cast the ".$newspellrow["name"]." spell for $monsterdamage damage.<br /><br />";
|
$pagearray["yourturn"] = "You have cast the ".$newspellrow["name"]." spell for $monsterdamage damage.<br><br>";
|
||||||
} else {
|
} else {
|
||||||
$pagearray["yourturn"] = "You have cast the ".$newspellrow["name"]." spell, but the monster is immune to it.<br /><br />";
|
$pagearray["yourturn"] = "You have cast the ".$newspellrow["name"]." spell, but the monster is immune to it.<br><br>";
|
||||||
}
|
}
|
||||||
$userrow["currentmp"] -= $newspellrow["mp"];
|
$userrow["currentmp"] -= $newspellrow["mp"];
|
||||||
} elseif ($newspellrow["type"] == 3) { // Sleep spell.
|
} elseif ($newspellrow["type"] == 3) { // Sleep spell.
|
||||||
if ($userrow["currentmonsterimmune"] != 2) {
|
if ($userrow["currentmonsterimmune"] != 2) {
|
||||||
$userrow["currentmonstersleep"] = $newspellrow["attribute"];
|
$userrow["currentmonstersleep"] = $newspellrow["attribute"];
|
||||||
$pagearray["yourturn"] = "You have cast the ".$newspellrow["name"]." spell. The monster is asleep.<br /><br />";
|
$pagearray["yourturn"] = "You have cast the ".$newspellrow["name"]." spell. The monster is asleep.<br><br>";
|
||||||
} else {
|
} else {
|
||||||
$pagearray["yourturn"] = "You have cast the ".$newspellrow["name"]." spell, but the monster is immune to it.<br /><br />";
|
$pagearray["yourturn"] = "You have cast the ".$newspellrow["name"]." spell, but the monster is immune to it.<br><br>";
|
||||||
}
|
}
|
||||||
$userrow["currentmp"] -= $newspellrow["mp"];
|
$userrow["currentmp"] -= $newspellrow["mp"];
|
||||||
} elseif ($newspellrow["type"] == 4) { // +Damage spell.
|
} elseif ($newspellrow["type"] == 4) { // +Damage spell.
|
||||||
$userrow["currentuberdamage"] = $newspellrow["attribute"];
|
$userrow["currentuberdamage"] = $newspellrow["attribute"];
|
||||||
$userrow["currentmp"] -= $newspellrow["mp"];
|
$userrow["currentmp"] -= $newspellrow["mp"];
|
||||||
$pagearray["yourturn"] = "You have cast the ".$newspellrow["name"]." spell, and will gain ".$newspellrow["attribute"]."% damage until the end of this fight.<br /><br />";
|
$pagearray["yourturn"] = "You have cast the ".$newspellrow["name"]." spell, and will gain ".$newspellrow["attribute"]."% damage until the end of this fight.<br><br>";
|
||||||
} elseif ($newspellrow["type"] == 5) { // +Defense spell.
|
} elseif ($newspellrow["type"] == 5) { // +Defense spell.
|
||||||
$userrow["currentuberdefense"] = $newspellrow["attribute"];
|
$userrow["currentuberdefense"] = $newspellrow["attribute"];
|
||||||
$userrow["currentmp"] -= $newspellrow["mp"];
|
$userrow["currentmp"] -= $newspellrow["mp"];
|
||||||
$pagearray["yourturn"] = "You have cast the ".$newspellrow["name"]." spell, and will gain ".$newspellrow["attribute"]."% defense until the end of this fight.<br /><br />";
|
$pagearray["yourturn"] = "You have cast the ".$newspellrow["name"]." spell, and will gain ".$newspellrow["attribute"]."% defense until the end of this fight.<br><br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$pagearray["monsterhp"] = "Monster's HP: " . $userrow["currentmonsterhp"] . "<br /><br />";
|
$pagearray["monsterhp"] = "Monster's HP: " . $userrow["currentmonsterhp"] . "<br><br>";
|
||||||
if ($userrow["currentmonsterhp"] <= 0) {
|
if ($userrow["currentmonsterhp"] <= 0) {
|
||||||
$updatequery = doquery("UPDATE {{table}} SET currentmonsterhp='0',currenthp='".$userrow["currenthp"]."',currentmp='".$userrow["currentmp"]."' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
$updatequery = doquery("UPDATE {{table}} SET currentmonsterhp='0',currenthp='".$userrow["currenthp"]."',currentmp='".$userrow["currentmp"]."' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||||
header("Location: index.php?do=victory");
|
header("Location: index.php?do=victory");
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Monster's turn.
|
// Monster's turn.
|
||||||
$pagearray["monsterturn"] = "";
|
$pagearray["monsterturn"] = "";
|
||||||
if ($userrow["currentmonstersleep"] != 0) { // Check to wake up.
|
if ($userrow["currentmonstersleep"] != 0) { // Check to wake up.
|
||||||
$chancetowake = rand(1,15);
|
$chancetowake = rand(1,15);
|
||||||
if ($chancetowake > $userrow["currentmonstersleep"]) {
|
if ($chancetowake > $userrow["currentmonstersleep"]) {
|
||||||
$userrow["currentmonstersleep"] = 0;
|
$userrow["currentmonstersleep"] = 0;
|
||||||
$pagearray["monsterturn"] .= "The monster has woken up.<br />";
|
$pagearray["monsterturn"] .= "The monster has woken up.<br>";
|
||||||
} else {
|
} else {
|
||||||
$pagearray["monsterturn"] .= "The monster is still asleep.<br />";
|
$pagearray["monsterturn"] .= "The monster is still asleep.<br>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($userrow["currentmonstersleep"] == 0) { // Only do this if the monster is awake.
|
if ($userrow["currentmonstersleep"] == 0) { // Only do this if the monster is awake.
|
||||||
$tohit = ceil(rand($monsterrow["maxdam"]*.5,$monsterrow["maxdam"]));
|
$tohit = ceil(rand($monsterrow["maxdam"]*.5,$monsterrow["maxdam"]));
|
||||||
if ($userrow["difficulty"] == 2) { $tohit = ceil($tohit * $controlrow["diff2mod"]); }
|
|
||||||
if ($userrow["difficulty"] == 3) { $tohit = ceil($tohit * $controlrow["diff3mod"]); }
|
|
||||||
$toblock = ceil(rand($userrow["defensepower"]*.75,$userrow["defensepower"])/4);
|
$toblock = ceil(rand($userrow["defensepower"]*.75,$userrow["defensepower"])/4);
|
||||||
$tododge = rand(1,150);
|
$tododge = rand(1,150);
|
||||||
if ($tododge <= sqrt($userrow["dexterity"])) {
|
if ($tododge <= sqrt($userrow["dexterity"])) {
|
||||||
$tohit = 0; $pagearray["monsterturn"] .= "You dodge the monster's attack. No damage has been scored.<br />";
|
$tohit = 0; $pagearray["monsterturn"] .= "You dodge the monster's attack. No damage has been scored.<br>";
|
||||||
$persondamage = 0;
|
$persondamage = 0;
|
||||||
} else {
|
} else {
|
||||||
if ($tohit <= $toblock) { $tohit = $toblock + 1; }
|
if ($tohit <= $toblock) { $tohit = $toblock + 1; }
|
||||||
|
@ -261,7 +253,7 @@ function fight() { // One big long function that determines the outcome of the f
|
||||||
}
|
}
|
||||||
if ($persondamage < 1) { $persondamage = 1; }
|
if ($persondamage < 1) { $persondamage = 1; }
|
||||||
}
|
}
|
||||||
$pagearray["monsterturn"] .= "The monster attacks you for $persondamage damage.<br /><br />";
|
$pagearray["monsterturn"] .= "The monster attacks you for $persondamage damage.<br><br>";
|
||||||
$userrow["currenthp"] -= $persondamage;
|
$userrow["currenthp"] -= $persondamage;
|
||||||
if ($userrow["currenthp"] <= 0) {
|
if ($userrow["currenthp"] <= 0) {
|
||||||
$newgold = ceil($userrow["gold"]/2);
|
$newgold = ceil($userrow["gold"]/2);
|
||||||
|
@ -270,29 +262,27 @@ function fight() { // One big long function that determines the outcome of the f
|
||||||
$playerisdead = 1;
|
$playerisdead = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do a monster's turn if person lost the chance to swing first. Serves him right!
|
// Do a monster's turn if person lost the chance to swing first. Serves him right!
|
||||||
} elseif ( $chancetoswingfirst == 0 ) {
|
} elseif ( $chancetoswingfirst == 0 ) {
|
||||||
$pagearray["yourturn"] = "The monster attacks before you are ready!<br /><br />";
|
$pagearray["yourturn"] = "The monster attacks before you are ready!<br><br>";
|
||||||
$pagearray["monsterhp"] = "Monster's HP: " . $userrow["currentmonsterhp"] . "<br /><br />";
|
$pagearray["monsterhp"] = "Monster's HP: " . $userrow["currentmonsterhp"] . "<br><br>";
|
||||||
$pagearray["monsterturn"] = "";
|
$pagearray["monsterturn"] = "";
|
||||||
if ($userrow["currentmonstersleep"] != 0) { // Check to wake up.
|
if ($userrow["currentmonstersleep"] != 0) { // Check to wake up.
|
||||||
$chancetowake = rand(1,15);
|
$chancetowake = rand(1,15);
|
||||||
if ($chancetowake > $userrow["currentmonstersleep"]) {
|
if ($chancetowake > $userrow["currentmonstersleep"]) {
|
||||||
$userrow["currentmonstersleep"] = 0;
|
$userrow["currentmonstersleep"] = 0;
|
||||||
$pagearray["monsterturn"] .= "The monster has woken up.<br />";
|
$pagearray["monsterturn"] .= "The monster has woken up.<br>";
|
||||||
} else {
|
} else {
|
||||||
$pagearray["monsterturn"] .= "The monster is still asleep.<br />";
|
$pagearray["monsterturn"] .= "The monster is still asleep.<br>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($userrow["currentmonstersleep"] == 0) { // Only do this if the monster is awake.
|
if ($userrow["currentmonstersleep"] == 0) { // Only do this if the monster is awake.
|
||||||
$tohit = ceil(rand($monsterrow["maxdam"]*.5,$monsterrow["maxdam"]));
|
$tohit = ceil(rand($monsterrow["maxdam"]*.5,$monsterrow["maxdam"]));
|
||||||
if ($userrow["difficulty"] == 2) { $tohit = ceil($tohit * $controlrow["diff2mod"]); }
|
|
||||||
if ($userrow["difficulty"] == 3) { $tohit = ceil($tohit * $controlrow["diff3mod"]); }
|
|
||||||
$toblock = ceil(rand($userrow["defensepower"]*.75,$userrow["defensepower"])/4);
|
$toblock = ceil(rand($userrow["defensepower"]*.75,$userrow["defensepower"])/4);
|
||||||
$tododge = rand(1,150);
|
$tododge = rand(1,150);
|
||||||
if ($tododge <= sqrt($userrow["dexterity"])) {
|
if ($tododge <= sqrt($userrow["dexterity"])) {
|
||||||
$tohit = 0; $pagearray["monsterturn"] .= "You dodge the monster's attack. No damage has been scored.<br />";
|
$tohit = 0; $pagearray["monsterturn"] .= "You dodge the monster's attack. No damage has been scored.<br>";
|
||||||
$persondamage = 0;
|
$persondamage = 0;
|
||||||
} else {
|
} else {
|
||||||
$persondamage = $tohit - $toblock;
|
$persondamage = $tohit - $toblock;
|
||||||
|
@ -302,7 +292,7 @@ function fight() { // One big long function that determines the outcome of the f
|
||||||
}
|
}
|
||||||
if ($persondamage < 1) { $persondamage = 1; }
|
if ($persondamage < 1) { $persondamage = 1; }
|
||||||
}
|
}
|
||||||
$pagearray["monsterturn"] .= "The monster attacks you for $persondamage damage.<br /><br />";
|
$pagearray["monsterturn"] .= "The monster attacks you for $persondamage damage.<br><br>";
|
||||||
$userrow["currenthp"] -= $persondamage;
|
$userrow["currenthp"] -= $persondamage;
|
||||||
if ($userrow["currenthp"] <= 0) {
|
if ($userrow["currenthp"] <= 0) {
|
||||||
$newgold = ceil($userrow["gold"]/2);
|
$newgold = ceil($userrow["gold"]/2);
|
||||||
|
@ -314,10 +304,10 @@ function fight() { // One big long function that determines the outcome of the f
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$pagearray["yourturn"] = "";
|
$pagearray["yourturn"] = "";
|
||||||
$pagearray["monsterhp"] = "Monster's HP: " . $userrow["currentmonsterhp"] . "<br /><br />";
|
$pagearray["monsterhp"] = "Monster's HP: " . $userrow["currentmonsterhp"] . "<br><br>";
|
||||||
$pagearray["monsterturn"] = "";
|
$pagearray["monsterturn"] = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
$newmonster = $userrow["currentmonster"];
|
$newmonster = $userrow["currentmonster"];
|
||||||
|
|
||||||
$newmonsterhp = $userrow["currentmonsterhp"];
|
$newmonsterhp = $userrow["currentmonsterhp"];
|
||||||
|
@ -327,56 +317,52 @@ function fight() { // One big long function that determines the outcome of the f
|
||||||
$newuberdefense = $userrow["currentuberdefense"];
|
$newuberdefense = $userrow["currentuberdefense"];
|
||||||
$newfight = $userrow["currentfight"] + 1;
|
$newfight = $userrow["currentfight"] + 1;
|
||||||
$newhp = $userrow["currenthp"];
|
$newhp = $userrow["currenthp"];
|
||||||
$newmp = $userrow["currentmp"];
|
$newmp = $userrow["currentmp"];
|
||||||
|
|
||||||
if ($playerisdead != 1) {
|
if ($playerisdead != 1) {
|
||||||
$pagearray["command"] = <<<END
|
$pagearray["command"] = <<<END
|
||||||
Command?<br /><br />
|
Command?<br><br>
|
||||||
<form action="index.php?do=fight" method="post">
|
<form action="index.php?do=fight" method="post">
|
||||||
<input type="submit" name="fight" value="Fight" /><br /><br />
|
<input type="submit" name="fight" value="Fight" /><br><br>
|
||||||
<select name="userspell"><option value="0">Choose One</option>$magiclist</select> <input type="submit" name="spell" value="Spell" /><br /><br />
|
<select name="userspell"><option value="0">Choose One</option>$magiclist</select> <input type="submit" name="spell" value="Spell" /><br><br>
|
||||||
<input type="submit" name="run" value="Run" /><br /><br />
|
<input type="submit" name="run" value="Run" /><br><br>
|
||||||
</form>
|
</form>
|
||||||
END;
|
END;
|
||||||
$updatequery = doquery("UPDATE {{table}} SET currentaction='Fighting',currenthp='$newhp',currentmp='$newmp',currentfight='$newfight',currentmonster='$newmonster',currentmonsterhp='$newmonsterhp',currentmonstersleep='$newmonstersleep',currentmonsterimmune='$newmonsterimmune',currentuberdamage='$newuberdamage',currentuberdefense='$newuberdefense' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
$updatequery = doquery("UPDATE {{table}} SET currentaction='Fighting',currenthp='$newhp',currentmp='$newmp',currentfight='$newfight',currentmonster='$newmonster',currentmonsterhp='$newmonsterhp',currentmonstersleep='$newmonstersleep',currentmonsterimmune='$newmonsterimmune',currentuberdamage='$newuberdamage',currentuberdefense='$newuberdefense' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||||
} else {
|
} else {
|
||||||
$pagearray["command"] = "<b>You have died.</b><br /><br />As a consequence, you've lost half of your gold. However, you have been given back a portion of your hit points to continue your journey.<br /><br />You may now continue back to <a href=\"index.php\">town</a>, and we hope you fair better next time.";
|
$pagearray["command"] = "<b>You have died.</b><br><br>As a consequence, you've lost half of your gold. However, you have been given back a portion of your hit points to continue your journey.<br><br>You may now continue back to <a href=\"index.php\">town</a>, and we hope you fair better next time.";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finalize page and display it.
|
// Finalize page and display it.
|
||||||
$template = gettemplate("fight");
|
$template = gettemplate("fight");
|
||||||
$page = parsetemplate($template,$pagearray);
|
$page = parsetemplate($template,$pagearray);
|
||||||
|
|
||||||
display($page, "Fighting");
|
display($page, "Fighting");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function victory() {
|
function victory() {
|
||||||
|
|
||||||
global $userrow, $controlrow;
|
global $userrow, $controlrow;
|
||||||
|
|
||||||
if ($userrow["currentmonsterhp"] != 0) { header("Location: index.php?do=fight"); die(); }
|
if ($userrow["currentmonsterhp"] != 0) { header("Location: index.php?do=fight"); die(); }
|
||||||
if ($userrow["currentfight"] == 0) { header("Location: index.php"); die(); }
|
if ($userrow["currentfight"] == 0) { header("Location: index.php"); die(); }
|
||||||
|
|
||||||
$monsterquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["currentmonster"]."' LIMIT 1", "monsters");
|
$monsterquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["currentmonster"]."' LIMIT 1", "monsters");
|
||||||
$monsterrow = mysql_fetch_array($monsterquery);
|
$monsterrow = mysql_fetch_array($monsterquery);
|
||||||
|
|
||||||
$exp = rand((($monsterrow["maxexp"]/6)*5),$monsterrow["maxexp"]);
|
$exp = rand((($monsterrow["maxexp"]/6)*5),$monsterrow["maxexp"]);
|
||||||
if ($exp < 1) { $exp = 1; }
|
if ($exp < 1) { $exp = 1; }
|
||||||
if ($userrow["difficulty"] == 2) { $exp = ceil($exp * $controlrow["diff2mod"]); }
|
|
||||||
if ($userrow["difficulty"] == 3) { $exp = ceil($exp * $controlrow["diff3mod"]); }
|
|
||||||
if ($userrow["expbonus"] != 0) { $exp += ceil(($userrow["expbonus"]/100)*$exp); }
|
if ($userrow["expbonus"] != 0) { $exp += ceil(($userrow["expbonus"]/100)*$exp); }
|
||||||
$gold = rand((($monsterrow["maxgold"]/6)*5),$monsterrow["maxgold"]);
|
$gold = rand((($monsterrow["maxgold"]/6)*5),$monsterrow["maxgold"]);
|
||||||
if ($gold < 1) { $gold = 1; }
|
if ($gold < 1) { $gold = 1; }
|
||||||
if ($userrow["difficulty"] == 2) { $gold = ceil($gold * $controlrow["diff2mod"]); }
|
|
||||||
if ($userrow["difficulty"] == 3) { $gold = ceil($gold * $controlrow["diff3mod"]); }
|
|
||||||
if ($userrow["goldbonus"] != 0) { $gold += ceil(($userrow["goldbonus"]/100)*$exp); }
|
if ($userrow["goldbonus"] != 0) { $gold += ceil(($userrow["goldbonus"]/100)*$exp); }
|
||||||
if ($userrow["experience"] + $exp < 16777215) { $newexp = $userrow["experience"] + $exp; $warnexp = ""; } else { $newexp = $userrow["experience"]; $exp = 0; $warnexp = "You have maxed out your experience points."; }
|
if ($userrow["experience"] + $exp < 16777215) { $newexp = $userrow["experience"] + $exp; $warnexp = ""; } else { $newexp = $userrow["experience"]; $exp = 0; $warnexp = "You have maxed out your experience points."; }
|
||||||
if ($userrow["gold"] + $gold < 16777215) { $newgold = $userrow["gold"] + $gold; $warngold = ""; } else { $newgold = $userrow["gold"]; $gold = 0; $warngold = "You have maxed out your experience points."; }
|
if ($userrow["gold"] + $gold < 16777215) { $newgold = $userrow["gold"] + $gold; $warngold = ""; } else { $newgold = $userrow["gold"]; $gold = 0; $warngold = "You have maxed out your experience points."; }
|
||||||
|
|
||||||
$levelquery = doquery("SELECT * FROM {{table}} WHERE id='".($userrow["level"]+1)."' LIMIT 1", "levels");
|
$levelquery = doquery("SELECT * FROM {{table}} WHERE id='".($userrow["level"]+1)."' LIMIT 1", "levels");
|
||||||
if (mysql_num_rows($levelquery) == 1) { $levelrow = mysql_fetch_array($levelquery); }
|
if (mysql_num_rows($levelquery) == 1) { $levelrow = mysql_fetch_array($levelquery); }
|
||||||
|
|
||||||
if ($userrow["level"] < 100) {
|
if ($userrow["level"] < 100) {
|
||||||
if ($newexp >= $levelrow[$userrow["charclass"]."_exp"]) {
|
if ($newexp >= $levelrow[$userrow["charclass"]."_exp"]) {
|
||||||
$newhp = $userrow["maxhp"] + $levelrow[$userrow["charclass"]."_hp"];
|
$newhp = $userrow["maxhp"] + $levelrow[$userrow["charclass"]."_hp"];
|
||||||
|
@ -387,14 +373,14 @@ function victory() {
|
||||||
$newattack = $userrow["attackpower"] + $levelrow[$userrow["charclass"]."_strength"];
|
$newattack = $userrow["attackpower"] + $levelrow[$userrow["charclass"]."_strength"];
|
||||||
$newdefense = $userrow["defensepower"] + $levelrow[$userrow["charclass"]."_dexterity"];
|
$newdefense = $userrow["defensepower"] + $levelrow[$userrow["charclass"]."_dexterity"];
|
||||||
$newlevel = $levelrow["id"];
|
$newlevel = $levelrow["id"];
|
||||||
|
|
||||||
if ($levelrow[$userrow["charclass"]."_spells"] != 0) {
|
if ($levelrow[$userrow["charclass"]."_spells"] != 0) {
|
||||||
$userspells = $userrow["spells"] . ",".$levelrow[$userrow["charclass"]."_spells"];
|
$userspells = $userrow["spells"] . ",".$levelrow[$userrow["charclass"]."_spells"];
|
||||||
$newspell = "spells='$userspells',";
|
$newspell = "spells='$userspells',";
|
||||||
$spelltext = "You have learned a new spell.<br />";
|
$spelltext = "You have learned a new spell.<br>";
|
||||||
} else { $spelltext = ""; $newspell=""; }
|
} else { $spelltext = ""; $newspell=""; }
|
||||||
|
|
||||||
$page = "Congratulations. You have defeated the ".$monsterrow["name"].".<br />You gain $exp experience. $warnexp <br />You gain $gold gold. $warngold <br /><br /><b>You have gained a level!</b><br /><br />You gain ".$levelrow[$userrow["charclass"]."_hp"]." hit points.<br />You gain ".$levelrow[$userrow["charclass"]."_mp"]." magic points.<br />You gain ".$levelrow[$userrow["charclass"]."_tp"]." travel points.<br />You gain ".$levelrow[$userrow["charclass"]."_strength"]." strength.<br />You gain ".$levelrow[$userrow["charclass"]."_dexterity"]." dexterity.<br />$spelltext<br />You can now continue <a href=\"index.php\">exploring</a>.";
|
$page = "Congratulations. You have defeated the ".$monsterrow["name"].".<br>You gain $exp experience. $warnexp <br>You gain $gold gold. $warngold <br><br><b>You have gained a level!</b><br><br>You gain ".$levelrow[$userrow["charclass"]."_hp"]." hit points.<br>You gain ".$levelrow[$userrow["charclass"]."_mp"]." magic points.<br>You gain ".$levelrow[$userrow["charclass"]."_tp"]." travel points.<br>You gain ".$levelrow[$userrow["charclass"]."_strength"]." strength.<br>You gain ".$levelrow[$userrow["charclass"]."_dexterity"]." dexterity.<br>$spelltext<br>You can now continue <a href=\"index.php\">exploring</a>.";
|
||||||
$title = "Courage and Wit have served thee well!";
|
$title = "Courage and Wit have served thee well!";
|
||||||
$dropcode = "";
|
$dropcode = "";
|
||||||
} else {
|
} else {
|
||||||
|
@ -407,14 +393,14 @@ function victory() {
|
||||||
$newdefense = $userrow["defensepower"];
|
$newdefense = $userrow["defensepower"];
|
||||||
$newlevel = $userrow["level"];
|
$newlevel = $userrow["level"];
|
||||||
$newspell = "";
|
$newspell = "";
|
||||||
$page = "Congratulations. You have defeated the ".$monsterrow["name"].".<br />You gain $exp experience. $warnexp <br />You gain $gold gold. $warngold <br /><br />";
|
$page = "Congratulations. You have defeated the ".$monsterrow["name"].".<br>You gain $exp experience. $warnexp <br>You gain $gold gold. $warngold <br><br>";
|
||||||
|
|
||||||
if (rand(1,30) == 1) {
|
if (rand(1,30) == 1) {
|
||||||
$dropquery = doquery("SELECT * FROM {{table}} WHERE mlevel <= '".$monsterrow["level"]."' ORDER BY RAND() LIMIT 1", "drops");
|
$dropquery = doquery("SELECT * FROM {{table}} WHERE mlevel <= '".$monsterrow["level"]."' ORDER BY RAND() LIMIT 1", "drops");
|
||||||
$droprow = mysql_fetch_array($dropquery);
|
$droprow = mysql_fetch_array($dropquery);
|
||||||
$dropcode = "dropcode='".$droprow["id"]."',";
|
$dropcode = "dropcode='".$droprow["id"]."',";
|
||||||
$page .= "This monster has dropped an item. <a href=\"index.php?do=drop\">Click here</a> to reveal and equip the item, or you may also move on and continue <a href=\"index.php\">exploring</a>.";
|
$page .= "This monster has dropped an item. <a href=\"index.php?do=drop\">Click here</a> to reveal and equip the item, or you may also move on and continue <a href=\"index.php\">exploring</a>.";
|
||||||
} else {
|
} else {
|
||||||
$dropcode = "";
|
$dropcode = "";
|
||||||
$page .= "You can now continue <a href=\"index.php\">exploring</a>.";
|
$page .= "You can now continue <a href=\"index.php\">exploring</a>.";
|
||||||
}
|
}
|
||||||
|
@ -424,79 +410,79 @@ function victory() {
|
||||||
}
|
}
|
||||||
|
|
||||||
$updatequery = doquery("UPDATE {{table}} SET currentaction='Exploring',level='$newlevel',maxhp='$newhp',maxmp='$newmp',maxtp='$newtp',strength='$newstrength',dexterity='$newdexterity',attackpower='$newattack',defensepower='$newdefense', $newspell currentfight='0',currentmonster='0',currentmonsterhp='0',currentmonstersleep='0',currentmonsterimmune='0',currentuberdamage='0',currentuberdefense='0',$dropcode experience='$newexp',gold='$newgold' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
$updatequery = doquery("UPDATE {{table}} SET currentaction='Exploring',level='$newlevel',maxhp='$newhp',maxmp='$newmp',maxtp='$newtp',strength='$newstrength',dexterity='$newdexterity',attackpower='$newattack',defensepower='$newdefense', $newspell currentfight='0',currentmonster='0',currentmonsterhp='0',currentmonstersleep='0',currentmonsterimmune='0',currentuberdamage='0',currentuberdefense='0',$dropcode experience='$newexp',gold='$newgold' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||||
|
|
||||||
|
|
||||||
display($page, $title);
|
display($page, $title);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function drop() {
|
function drop() {
|
||||||
|
|
||||||
global $userrow;
|
global $userrow;
|
||||||
|
|
||||||
if ($userrow["dropcode"] == 0) { header("Location: index.php"); die(); }
|
if ($userrow["dropcode"] == 0) { header("Location: index.php"); die(); }
|
||||||
|
|
||||||
$dropquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["dropcode"]."' LIMIT 1", "drops");
|
$dropquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["dropcode"]."' LIMIT 1", "drops");
|
||||||
$droprow = mysql_fetch_array($dropquery);
|
$droprow = mysql_fetch_array($dropquery);
|
||||||
|
|
||||||
if (isset($_POST["submit"])) {
|
if (isset($_POST["submit"])) {
|
||||||
|
|
||||||
$slot = $_POST["slot"];
|
$slot = $_POST["slot"];
|
||||||
|
|
||||||
if ($slot == 0) { display("Please go back and select an inventory slot to continue.","Error"); }
|
if ($slot == 0) { display("Please go back and select an inventory slot to continue.","Error"); }
|
||||||
|
|
||||||
if ($userrow["slot".$slot."id"] != 0) {
|
if ($userrow["slot".$slot."id"] != 0) {
|
||||||
|
|
||||||
$slotquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["slot".$slot."id"]."' LIMIT 1", "drops");
|
$slotquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["slot".$slot."id"]."' LIMIT 1", "drops");
|
||||||
$slotrow = mysql_fetch_array($slotquery);
|
$slotrow = mysql_fetch_array($slotquery);
|
||||||
|
|
||||||
$old1 = explode(",",$slotrow["attribute1"]);
|
$old1 = explode(",",$slotrow["attribute1"]);
|
||||||
if ($slotrow["attribute2"] != "X") { $old2 = explode(",",$slotrow["attribute2"]); } else { $old2 = array(0=>"maxhp",1=>0); }
|
if ($slotrow["attribute2"] != "X") { $old2 = explode(",",$slotrow["attribute2"]); } else { $old2 = array(0=>"maxhp",1=>0); }
|
||||||
$new1 = explode(",",$droprow["attribute1"]);
|
$new1 = explode(",",$droprow["attribute1"]);
|
||||||
if ($droprow["attribute2"] != "X") { $new2 = explode(",",$droprow["attribute2"]); } else { $new2 = array(0=>"maxhp",1=>0); }
|
if ($droprow["attribute2"] != "X") { $new2 = explode(",",$droprow["attribute2"]); } else { $new2 = array(0=>"maxhp",1=>0); }
|
||||||
|
|
||||||
$userrow[$old1[0]] -= $old1[1];
|
$userrow[$old1[0]] -= $old1[1];
|
||||||
$userrow[$old2[0]] -= $old2[1];
|
$userrow[$old2[0]] -= $old2[1];
|
||||||
if ($old1[0] == "strength") { $userrow["attackpower"] -= $old1[1]; }
|
if ($old1[0] == "strength") { $userrow["attackpower"] -= $old1[1]; }
|
||||||
if ($old1[0] == "dexterity") { $userrow["defensepower"] -= $old1[1]; }
|
if ($old1[0] == "dexterity") { $userrow["defensepower"] -= $old1[1]; }
|
||||||
if ($old2[0] == "strength") { $userrow["attackpower"] -= $old2[1]; }
|
if ($old2[0] == "strength") { $userrow["attackpower"] -= $old2[1]; }
|
||||||
if ($old2[0] == "dexterity") { $userrow["defensepower"] -= $old2[1]; }
|
if ($old2[0] == "dexterity") { $userrow["defensepower"] -= $old2[1]; }
|
||||||
|
|
||||||
$userrow[$new1[0]] += $new1[1];
|
$userrow[$new1[0]] += $new1[1];
|
||||||
$userrow[$new2[0]] += $new2[1];
|
$userrow[$new2[0]] += $new2[1];
|
||||||
if ($new1[0] == "strength") { $userrow["attackpower"] += $new1[1]; }
|
if ($new1[0] == "strength") { $userrow["attackpower"] += $new1[1]; }
|
||||||
if ($new1[0] == "dexterity") { $userrow["defensepower"] += $new1[1]; }
|
if ($new1[0] == "dexterity") { $userrow["defensepower"] += $new1[1]; }
|
||||||
if ($new2[0] == "strength") { $userrow["attackpower"] += $new2[1]; }
|
if ($new2[0] == "strength") { $userrow["attackpower"] += $new2[1]; }
|
||||||
if ($new2[0] == "dexterity") { $userrow["defensepower"] += $new2[1]; }
|
if ($new2[0] == "dexterity") { $userrow["defensepower"] += $new2[1]; }
|
||||||
|
|
||||||
if ($userrow["currenthp"] > $userrow["maxhp"]) { $userrow["currenthp"] = $userrow["maxhp"]; }
|
if ($userrow["currenthp"] > $userrow["maxhp"]) { $userrow["currenthp"] = $userrow["maxhp"]; }
|
||||||
if ($userrow["currentmp"] > $userrow["maxmp"]) { $userrow["currentmp"] = $userrow["maxmp"]; }
|
if ($userrow["currentmp"] > $userrow["maxmp"]) { $userrow["currentmp"] = $userrow["maxmp"]; }
|
||||||
if ($userrow["currenttp"] > $userrow["maxtp"]) { $userrow["currenttp"] = $userrow["maxtp"]; }
|
if ($userrow["currenttp"] > $userrow["maxtp"]) { $userrow["currenttp"] = $userrow["maxtp"]; }
|
||||||
|
|
||||||
$newname = addslashes($droprow["name"]);
|
$newname = addslashes($droprow["name"]);
|
||||||
$query = doquery("UPDATE {{table}} SET slot".$_POST["slot"]."name='$newname',slot".$_POST["slot"]."id='".$droprow["id"]."',$old1[0]='".$userrow[$old1[0]]."',$old2[0]='".$userrow[$old2[0]]."',$new1[0]='".$userrow[$new1[0]]."',$new2[0]='".$userrow[$new2[0]]."',attackpower='".$userrow["attackpower"]."',defensepower='".$userrow["defensepower"]."',currenthp='".$userrow["currenthp"]."',currentmp='".$userrow["currentmp"]."',currenttp='".$userrow["currenttp"]."',dropcode='0' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
$query = doquery("UPDATE {{table}} SET slot".$_POST["slot"]."name='$newname',slot".$_POST["slot"]."id='".$droprow["id"]."',$old1[0]='".$userrow[$old1[0]]."',$old2[0]='".$userrow[$old2[0]]."',$new1[0]='".$userrow[$new1[0]]."',$new2[0]='".$userrow[$new2[0]]."',attackpower='".$userrow["attackpower"]."',defensepower='".$userrow["defensepower"]."',currenthp='".$userrow["currenthp"]."',currentmp='".$userrow["currentmp"]."',currenttp='".$userrow["currenttp"]."',dropcode='0' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$new1 = explode(",",$droprow["attribute1"]);
|
$new1 = explode(",",$droprow["attribute1"]);
|
||||||
if ($droprow["attribute2"] != "X") { $new2 = explode(",",$droprow["attribute2"]); } else { $new2 = array(0=>"maxhp",1=>0); }
|
if ($droprow["attribute2"] != "X") { $new2 = explode(",",$droprow["attribute2"]); } else { $new2 = array(0=>"maxhp",1=>0); }
|
||||||
|
|
||||||
$userrow[$new1[0]] += $new1[1];
|
$userrow[$new1[0]] += $new1[1];
|
||||||
$userrow[$new2[0]] += $new2[1];
|
$userrow[$new2[0]] += $new2[1];
|
||||||
if ($new1[0] == "strength") { $userrow["attackpower"] += $new1[1]; }
|
if ($new1[0] == "strength") { $userrow["attackpower"] += $new1[1]; }
|
||||||
if ($new1[0] == "dexterity") { $userrow["defensepower"] += $new1[1]; }
|
if ($new1[0] == "dexterity") { $userrow["defensepower"] += $new1[1]; }
|
||||||
if ($new2[0] == "strength") { $userrow["attackpower"] += $new2[1]; }
|
if ($new2[0] == "strength") { $userrow["attackpower"] += $new2[1]; }
|
||||||
if ($new2[0] == "dexterity") { $userrow["defensepower"] += $new2[1]; }
|
if ($new2[0] == "dexterity") { $userrow["defensepower"] += $new2[1]; }
|
||||||
|
|
||||||
$newname = addslashes($droprow["name"]);
|
$newname = addslashes($droprow["name"]);
|
||||||
$query = doquery("UPDATE {{table}} SET slot".$_POST["slot"]."name='$newname',slot".$_POST["slot"]."id='".$droprow["id"]."',$new1[0]='".$userrow[$new1[0]]."',$new2[0]='".$userrow[$new2[0]]."',attackpower='".$userrow["attackpower"]."',defensepower='".$userrow["defensepower"]."',dropcode='0' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
$query = doquery("UPDATE {{table}} SET slot".$_POST["slot"]."name='$newname',slot".$_POST["slot"]."id='".$droprow["id"]."',$new1[0]='".$userrow[$new1[0]]."',$new2[0]='".$userrow[$new2[0]]."',attackpower='".$userrow["attackpower"]."',defensepower='".$userrow["defensepower"]."',dropcode='0' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||||
|
|
||||||
}
|
}
|
||||||
$page = "The item has been equipped. You can now continue <a href=\"index.php\">exploring</a>.";
|
$page = "The item has been equipped. You can now continue <a href=\"index.php\">exploring</a>.";
|
||||||
display($page, "Item Drop");
|
display($page, "Item Drop");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$attributearray = array("maxhp"=>"Max HP",
|
$attributearray = array("maxhp"=>"Max HP",
|
||||||
"maxmp"=>"Max MP",
|
"maxmp"=>"Max MP",
|
||||||
"maxtp"=>"Max TP",
|
"maxtp"=>"Max TP",
|
||||||
|
@ -506,35 +492,35 @@ function drop() {
|
||||||
"dexterity"=>"Dexterity",
|
"dexterity"=>"Dexterity",
|
||||||
"expbonus"=>"Experience Bonus",
|
"expbonus"=>"Experience Bonus",
|
||||||
"goldbonus"=>"Gold Bonus");
|
"goldbonus"=>"Gold Bonus");
|
||||||
|
|
||||||
$page = "The monster dropped the following item: <b>".$droprow["name"]."</b><br /><br />";
|
$page = "The monster dropped the following item: <b>".$droprow["name"]."</b><br><br>";
|
||||||
$page .= "This item has the following attribute(s):<br />";
|
$page .= "This item has the following attribute(s):<br>";
|
||||||
|
|
||||||
$attribute1 = explode(",",$droprow["attribute1"]);
|
$attribute1 = explode(",",$droprow["attribute1"]);
|
||||||
$page .= $attributearray[$attribute1[0]];
|
$page .= $attributearray[$attribute1[0]];
|
||||||
if ($attribute1[1] > 0) { $page .= " +" . $attribute1[1] . "<br />"; } else { $page .= $attribute1[1] . "<br />"; }
|
if ($attribute1[1] > 0) { $page .= " +" . $attribute1[1] . "<br>"; } else { $page .= $attribute1[1] . "<br>"; }
|
||||||
|
|
||||||
if ($droprow["attribute2"] != "X") {
|
if ($droprow["attribute2"] != "X") {
|
||||||
$attribute2 = explode(",",$droprow["attribute2"]);
|
$attribute2 = explode(",",$droprow["attribute2"]);
|
||||||
$page .= $attributearray[$attribute2[0]];
|
$page .= $attributearray[$attribute2[0]];
|
||||||
if ($attribute2[1] > 0) { $page .= " +" . $attribute2[1] . "<br />"; } else { $page .= $attribute2[1] . "<br />"; }
|
if ($attribute2[1] > 0) { $page .= " +" . $attribute2[1] . "<br>"; } else { $page .= $attribute2[1] . "<br>"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
$page .= "<br />Select an inventory slot from the list below to equip this item. If the inventory slot is already full, the old item will be discarded.";
|
$page .= "<br>Select an inventory slot from the list below to equip this item. If the inventory slot is already full, the old item will be discarded.";
|
||||||
$page .= "<form action=\"index.php?do=drop\" method=\"post\"><select name=\"slot\"><option value=\"0\">Choose One</option><option value=\"1\">Slot 1: ".$userrow["slot1name"]."</option><option value=\"2\">Slot 2: ".$userrow["slot2name"]."</option><option value=\"3\">Slot 3: ".$userrow["slot3name"]."</option></select> <input type=\"submit\" name=\"submit\" value=\"Submit\" /></form>";
|
$page .= "<form action=\"index.php?do=drop\" method=\"post\"><select name=\"slot\"><option value=\"0\">Choose One</option><option value=\"1\">Slot 1: ".$userrow["slot1name"]."</option><option value=\"2\">Slot 2: ".$userrow["slot2name"]."</option><option value=\"3\">Slot 3: ".$userrow["slot3name"]."</option></select> <input type=\"submit\" name=\"submit\" value=\"Submit\" /></form>";
|
||||||
$page .= "You may also choose to just continue <a href=\"index.php\">exploring</a> and give up this item.";
|
$page .= "You may also choose to just continue <a href=\"index.php\">exploring</a> and give up this item.";
|
||||||
|
|
||||||
display($page, "Item Drop");
|
display($page, "Item Drop");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function dead() {
|
function dead() {
|
||||||
|
|
||||||
$page = "<b>You have died.</b><br /><br />As a consequence, you've lost half of your gold. However, you have been given back a portion of your hit points to continue your journey.<br /><br />You may now continue back to <a href=\"index.php\">town</a>, and we hope you fair better next time.";
|
$page = "<b>You have died.</b><br><br>As a consequence, you've lost half of your gold. However, you have been given back a portion of your hit points to continue your journey.<br><br>You may now continue back to <a href=\"index.php\">town</a>, and we hope you fair better next time.";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
45
src/heal.php
45
src/heal.php
|
@ -1,33 +1,28 @@
|
||||||
<?php // heal.php :: Handles stuff from the Quick Spells menu. (Healing spells only... other spells are handled in fight.php.)
|
<?php
|
||||||
|
|
||||||
function healspells($id) {
|
// heal.php :: Handles stuff from the Quick Spells menu. (Healing spells only... other spells are handled in fight.php.)
|
||||||
|
|
||||||
|
function healspells($id)
|
||||||
|
{
|
||||||
global $userrow;
|
global $userrow;
|
||||||
|
|
||||||
$userspells = explode(",",$userrow["spells"]);
|
$userspells = explode(",", $userrow["spells"]);
|
||||||
$spellquery = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "spells");
|
$spellrow = get_spell($id);
|
||||||
$spellrow = mysql_fetch_array($spellquery);
|
|
||||||
|
|
||||||
// All the various ways to error out.
|
// All the various ways to error out.
|
||||||
$spell = false;
|
$spell = false;
|
||||||
foreach ($userspells as $a => $b) {
|
foreach ($userspells as $b) if ($b == $id) $spell = true;
|
||||||
if ($b == $id) { $spell = true; }
|
if ($spell !== true) display("You have not yet learned this spell. Please go back and try again.", "Error");
|
||||||
}
|
if ($spellrow["type"] != 1) display("This is not a healing spell. Please go back and try again.", "Error");
|
||||||
if ($spell != true) { display("You have not yet learned this spell. Please go back and try again.", "Error"); die(); }
|
if ($userrow["currentmp"] < $spellrow["mp"]) display("You do not have enough Magic Points to cast this spell. Please go back and try again.", "Error");
|
||||||
if ($spellrow["type"] != 1) { display("This is not a healing spell. Please go back and try again.", "Error"); die(); }
|
if ($userrow["currentaction"] == "Fighting") display("You cannot use the Quick Spells list during a fight. Please go back and select the Healing Spell you wish to use from the Spells box on the main fighting screen to continue.", "Error");
|
||||||
if ($userrow["currentmp"] < $spellrow["mp"]) { display("You do not have enough Magic Points to cast this spell. Please go back and try again.", "Error"); die(); }
|
if ($userrow["currenthp"] == $userrow["maxhp"]) display("Your Hit Points are already full. You don't need to use a Healing spell now.", "Error");
|
||||||
if ($userrow["currentaction"] == "Fighting") { display("You cannot use the Quick Spells list during a fight. Please go back and select the Healing Spell you wish to use from the Spells box on the main fighting screen to continue.", "Error"); die(); }
|
|
||||||
if ($userrow["currenthp"] == $userrow["maxhp"]) { display("Your Hit Points are already full. You don't need to use a Healing spell now.", "Error"); die(); }
|
|
||||||
|
|
||||||
$newhp = $userrow["currenthp"] + $spellrow["attribute"];
|
$newhp = $userrow["currenthp"] + $spellrow["attribute"];
|
||||||
if ($userrow["maxhp"] < $newhp) { $spellrow["attribute"] = $userrow["maxhp"] - $userrow["currenthp"]; $newhp = $userrow["currenthp"] + $spellrow["attribute"]; }
|
if ($userrow["maxhp"] < $newhp) { $spellrow["attribute"] = $userrow["maxhp"] - $userrow["currenthp"]; $newhp = $userrow["currenthp"] + $spellrow["attribute"]; }
|
||||||
$newmp = $userrow["currentmp"] - $spellrow["mp"];
|
$newmp = $userrow["currentmp"] - $spellrow["mp"];
|
||||||
|
|
||||||
$updatequery = doquery("UPDATE {{table}} SET currenthp='$newhp', currentmp='$newmp' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
|
||||||
|
|
||||||
display("You have cast the ".$spellrow["name"]." spell, and gained ".$spellrow["attribute"]." Hit Points. You can now continue <a href=\"index.php\">exploring</a>.", "Healing Spell");
|
|
||||||
die();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
db()->query('UPDATE users SET currenthp=?, currentmp=? WHERE id=?;', [$newhp, $newmp, $userrow['id']]);
|
||||||
|
|
||||||
|
display("You have cast the ".$spellrow["name"]." spell, and gained ".$spellrow["attribute"]." Hit Points. You can now continue <a href=\"index.php\">exploring</a>.", "Healing Spell");
|
||||||
|
}
|
||||||
|
|
96
src/lib.php
96
src/lib.php
|
@ -14,6 +14,15 @@ function db(): Database
|
||||||
return $GLOBALS['database'] ??= new Database(__DIR__ . '/../database.db');
|
return $GLOBALS['database'] ??= new Database(__DIR__ . '/../database.db');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redirect to a different URL, exit.
|
||||||
|
*/
|
||||||
|
function redirect(string $location): void
|
||||||
|
{
|
||||||
|
header("Location: $location");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
function gettemplate($templatename) { // SQL query for the template.
|
function gettemplate($templatename) { // SQL query for the template.
|
||||||
|
|
||||||
$filename = __DIR__ . "/../templates/" . $templatename . ".php";
|
$filename = __DIR__ . "/../templates/" . $templatename . ".php";
|
||||||
|
@ -118,21 +127,19 @@ function display($content, $title, $topnav=true, $leftnav=true, $rightnav=true,
|
||||||
if ($userrow["currentaction"] == "In Town") {
|
if ($userrow["currentaction"] == "In Town") {
|
||||||
$townquery = db()->query('SELECT * FROM towns WHERE latitude = ? AND longitude = ? LIMIT 1;', [$userrow["latitude"], $userrow["longitude"]]);
|
$townquery = db()->query('SELECT * FROM towns WHERE latitude = ? AND longitude = ? LIMIT 1;', [$userrow["latitude"], $userrow["longitude"]]);
|
||||||
$townrow = $townquery->fetchArray(SQLITE3_ASSOC);
|
$townrow = $townquery->fetchArray(SQLITE3_ASSOC);
|
||||||
$userrow["currenttown"] = "Welcome to <b>".$townrow["name"]."</b>.<br /><br />";
|
$userrow["currenttown"] = "Welcome to <b>".$townrow["name"]."</b>.<br><br>";
|
||||||
} else {
|
} else {
|
||||||
$userrow["currenttown"] = "";
|
$userrow["currenttown"] = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($controlrow["forumtype"] == 0) { $userrow["forumslink"] = ""; }
|
$userrow["forumslink"] = "<a href=\"forum.php\">Forum</a><br>";
|
||||||
elseif ($controlrow["forumtype"] == 1) { $userrow["forumslink"] = "<a href=\"forum.php\">Forum</a><br />"; }
|
|
||||||
elseif ($controlrow["forumtype"] == 2) { $userrow["forumslink"] = "<a href=\"".$controlrow["forumaddress"]."\">Forum</a><br />"; }
|
|
||||||
|
|
||||||
// Format various userrow stuffs...
|
// Format various userrow stuffs...
|
||||||
if ($userrow["latitude"] < 0) { $userrow["latitude"] = $userrow["latitude"] * -1 . "S"; } else { $userrow["latitude"] .= "N"; }
|
if ($userrow["latitude"] < 0) { $userrow["latitude"] = $userrow["latitude"] * -1 . "S"; } else { $userrow["latitude"] .= "N"; }
|
||||||
if ($userrow["longitude"] < 0) { $userrow["longitude"] = $userrow["longitude"] * -1 . "W"; } else { $userrow["longitude"] .= "E"; }
|
if ($userrow["longitude"] < 0) { $userrow["longitude"] = $userrow["longitude"] * -1 . "W"; } else { $userrow["longitude"] .= "E"; }
|
||||||
$userrow["experience"] = number_format($userrow["experience"]);
|
$userrow["experience"] = number_format($userrow["experience"]);
|
||||||
$userrow["gold"] = number_format($userrow["gold"]);
|
$userrow["gold"] = number_format($userrow["gold"]);
|
||||||
if ($userrow["authlevel"] == 1) { $userrow["adminlink"] = "<a href=\"admin.php\">Admin</a><br />"; } else { $userrow["adminlink"] = ""; }
|
if ($userrow["authlevel"] == 1) { $userrow["adminlink"] = "<a href=\"admin.php\">Admin</a><br>"; } else { $userrow["adminlink"] = ""; }
|
||||||
|
|
||||||
// HP/MP/TP bars.
|
// HP/MP/TP bars.
|
||||||
$stathp = ceil($userrow["currenthp"] / $userrow["maxhp"] * 100);
|
$stathp = ceil($userrow["currenthp"] / $userrow["maxhp"] * 100);
|
||||||
|
@ -164,13 +171,13 @@ function display($content, $title, $topnav=true, $leftnav=true, $rightnav=true,
|
||||||
$spellquery = db()->query('SELECT id, name, type FROM spells;');
|
$spellquery = db()->query('SELECT id, name, type FROM spells;');
|
||||||
$userspells = explode(",",$userrow["spells"]);
|
$userspells = explode(",",$userrow["spells"]);
|
||||||
$userrow["magiclist"] = "";
|
$userrow["magiclist"] = "";
|
||||||
foreach ($spellquery->fetchArray(SQLITE3_ASSOC) as $spellrow) {
|
while ($spellrow = $spellquery->fetchArray(SQLITE3_ASSOC)) {
|
||||||
$spell = false;
|
$spell = false;
|
||||||
foreach($userspells as $a => $b) {
|
foreach($userspells as $a => $b) {
|
||||||
if ($b == $spellrow["id"] && $spellrow["type"] == 1) { $spell = true; }
|
if ($b == $spellrow["id"] && $spellrow["type"] == 1) { $spell = true; }
|
||||||
}
|
}
|
||||||
if ($spell == true) {
|
if ($spell == true) {
|
||||||
$userrow["magiclist"] .= "<a href=\"index.php?do=spell:".$spellrow["id"]."\">".$spellrow["name"]."</a><br />";
|
$userrow["magiclist"] .= "<a href=\"index.php?do=spell:".$spellrow["id"]."\">".$spellrow["name"]."</a><br>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($userrow["magiclist"] == "") { $userrow["magiclist"] = "None"; }
|
if ($userrow["magiclist"] == "") { $userrow["magiclist"] = "None"; }
|
||||||
|
@ -179,13 +186,13 @@ function display($content, $title, $topnav=true, $leftnav=true, $rightnav=true,
|
||||||
$townslist = explode(",",$userrow["towns"]);
|
$townslist = explode(",",$userrow["towns"]);
|
||||||
$townquery2 = db()->query('SELECT * FROM towns ORDER BY id;');
|
$townquery2 = db()->query('SELECT * FROM towns ORDER BY id;');
|
||||||
$userrow["townslist"] = "";
|
$userrow["townslist"] = "";
|
||||||
foreach ($townquery2->fetchArray(SQLITE3_ASSOC) as $townrow2) {
|
while ($townrow2 = $townquery2->fetchArray(SQLITE3_ASSOC)) {
|
||||||
$town = false;
|
$town = false;
|
||||||
foreach($townslist as $a => $b) {
|
foreach($townslist as $a => $b) {
|
||||||
if ($b == $townrow2["id"]) { $town = true; }
|
if ($b == $townrow2["id"]) { $town = true; }
|
||||||
}
|
}
|
||||||
if ($town == true) {
|
if ($town == true) {
|
||||||
$userrow["townslist"] .= "<a href=\"index.php?do=gotown:".$townrow2["id"]."\">".$townrow2["name"]."</a><br />\n";
|
$userrow["townslist"] .= "<a href=\"index.php?do=gotown:".$townrow2["id"]."\">".$townrow2["name"]."</a><br>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -217,14 +224,14 @@ function checkcookies()
|
||||||
// COOKIE FORMAT:
|
// COOKIE FORMAT:
|
||||||
// {ID} {USERNAME} {PASSWORDHASH} {REMEMBERME}
|
// {ID} {USERNAME} {PASSWORDHASH} {REMEMBERME}
|
||||||
$theuser = explode(" ",$_COOKIE["dkgame"]);
|
$theuser = explode(" ",$_COOKIE["dkgame"]);
|
||||||
$query = db()->query('SELECT * FROM users WHERE id = ?, username = ?, password = ? LIMIT 1;', [$theuser[0], $theuser[1], $theuser[2]]);
|
$query = db()->query('SELECT * FROM users WHERE id = ? AND username = ? AND password = ? LIMIT 1;', [$theuser[0], $theuser[1], $theuser[2]]);
|
||||||
if ($query === false) {
|
if ($query === false) {
|
||||||
set_cookie('dkgame', '', -3600);
|
set_cookie('dkgame', '', -3600);
|
||||||
die("Invalid cookie data. Please log in again.");
|
die("Invalid cookie data. Please log in again.");
|
||||||
}
|
}
|
||||||
$row = $query->fetchArray(SQLITE3_ASSOC);
|
$row = $query->fetchArray(SQLITE3_ASSOC);
|
||||||
set_cookie('dkgame', implode(" ", $theuser), (int) $theuser[3] === 1 ? time() + 31536000 : 0);
|
set_cookie('dkgame', implode(" ", $theuser), (int) $theuser[3] === 1 ? time() + 31536000 : 0);
|
||||||
db()->exec('UPDATE users SET onlinetime = CURRENT_TIMESTAMP WHERE id = ? LIMIT 1;', [$theuser[0]]);
|
db()->exec('UPDATE users SET onlinetime = CURRENT_TIMESTAMP WHERE id = ?;', [$theuser[0]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $row;
|
return $row;
|
||||||
|
@ -254,3 +261,70 @@ function get_control_row(): array|false
|
||||||
if ($query === false) return false;
|
if ($query === false) return false;
|
||||||
return $query->fetchArray(SQLITE3_ASSOC);
|
return $query->fetchArray(SQLITE3_ASSOC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a town's data by it's coordinates.
|
||||||
|
*/
|
||||||
|
function get_town_by_xy(int $x, int $y): array|false
|
||||||
|
{
|
||||||
|
$query = db()->query('SELECT * FROM towns WHERE longitude = ? AND latitude = ? LIMIT 1;', [$x, $y]);
|
||||||
|
if ($query === false) return false;
|
||||||
|
return $query->fetchArray(SQLITE3_ASSOC);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a town's data by it's ID.
|
||||||
|
*/
|
||||||
|
function get_town_by_id(int $id): array|false
|
||||||
|
{
|
||||||
|
$query = db()->query('SELECT * FROM towns WHERE id = ? LIMIT 1;', [$id]);
|
||||||
|
if ($query === false) return false;
|
||||||
|
return $query->fetchArray(SQLITE3_ASSOC);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an item by it's ID.
|
||||||
|
*/
|
||||||
|
function get_item(int $id): array|false
|
||||||
|
{
|
||||||
|
$query = db()->query('SELECT * FROM items WHERE id=? LIMIT 1;', [$id]);
|
||||||
|
if ($query === false) return false;
|
||||||
|
return $query->fetchArray(SQLITE3_ASSOC);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a spell by it's ID.
|
||||||
|
*/
|
||||||
|
function get_spell(int $id): array|false
|
||||||
|
{
|
||||||
|
$query = db()->query('SELECT * FROM spells WHERE id=? LIMIT 1;', [$id]);
|
||||||
|
if ($query === false) return false;
|
||||||
|
return $query->fetchArray(SQLITE3_ASSOC);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translate a Specials keyword to it's string.
|
||||||
|
*/
|
||||||
|
function special_to_string(string $special): string
|
||||||
|
{
|
||||||
|
return match ($special) {
|
||||||
|
'maxhp' => 'Max HP',
|
||||||
|
'maxmp' => 'Max MP',
|
||||||
|
'maxtp' => 'Max TP',
|
||||||
|
'goldbonus' => 'Gold Bonus (%)',
|
||||||
|
'expbonus' => 'Experience Bonus (%)',
|
||||||
|
'strength' => 'Strength',
|
||||||
|
'dexterity' => 'Dexterity',
|
||||||
|
'attackpower' => 'Attack Power',
|
||||||
|
'defensepower' => 'Defense Power',
|
||||||
|
default => $special
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a pretty dope token.
|
||||||
|
*/
|
||||||
|
function token($length = 32): string
|
||||||
|
{
|
||||||
|
return bin2hex(random_bytes($length));
|
||||||
|
}
|
||||||
|
|
503
src/towns.php
503
src/towns.php
|
@ -1,368 +1,319 @@
|
||||||
<?php // towns.php :: Handles all actions you can do in town.
|
<?php
|
||||||
|
|
||||||
function inn() { // Staying at the inn resets all expendable stats to their max values.
|
// towns.php :: Handles all actions you can do in town.
|
||||||
|
|
||||||
global $userrow, $numqueries;
|
/**
|
||||||
|
* Staying at the inn resets all expendable stats to their max values.
|
||||||
|
*/
|
||||||
|
function inn()
|
||||||
|
{
|
||||||
|
global $userrow;
|
||||||
|
|
||||||
$townquery = doquery("SELECT name,innprice FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
$townrow = get_town_by_xy($userrow["longitude"], $userrow["latitude"]);
|
||||||
if (mysql_num_rows($townquery) != 1) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
if ($townrow === false) { display("Cheat attempt detected.<br><br>Get a life, loser.", "Error"); }
|
||||||
$townrow = mysql_fetch_array($townquery);
|
|
||||||
|
|
||||||
if ($userrow["gold"] < $townrow["innprice"]) { display("You do not have enough gold to stay at this Inn tonight.<br /><br />You may return to <a href=\"index.php\">town</a>, or use the direction buttons on the left to start exploring.", "Inn"); die(); }
|
if ($userrow["gold"] < $townrow["innprice"]) {
|
||||||
|
display("You do not have enough gold to stay at this Inn tonight.<br><br>You may return to <a href=\"index.php\">town</a>, or use the direction buttons on the left to start exploring.", "Inn");
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($_POST["submit"])) {
|
if (isset($_POST["submit"])) {
|
||||||
|
|
||||||
$newgold = $userrow["gold"] - $townrow["innprice"];
|
$newgold = $userrow["gold"] - $townrow["innprice"];
|
||||||
$query = doquery("UPDATE {{table}} SET gold='$newgold',currenthp='".$userrow["maxhp"]."',currentmp='".$userrow["maxmp"]."',currenttp='".$userrow["maxtp"]."' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
db()->query(
|
||||||
|
'UPDATE users SET gold=?, currenthp=?, currentmp=?, currenttp=? WHERE id=?',
|
||||||
|
[$newgold, $userrow['maxhp'], $userrow['maxmp'], $userrow['maxtp'], $userrow['id']
|
||||||
|
]);
|
||||||
$title = "Inn";
|
$title = "Inn";
|
||||||
$page = "You wake up feeling refreshed and ready for action.<br /><br />You may return to <a href=\"index.php\">town</a>, or use the direction buttons on the left to start exploring.";
|
$page = "You wake up feeling refreshed and ready for action.<br><br>You may return to <a href=\"index.php\">town</a>, or use the direction buttons on the left to start exploring.";
|
||||||
|
|
||||||
} elseif (isset($_POST["cancel"])) {
|
} elseif (isset($_POST["cancel"])) {
|
||||||
|
redirect('index.php');
|
||||||
header("Location: index.php"); die();
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$title = "Inn";
|
$title = "Inn";
|
||||||
$page = "Resting at the inn will refill your current HP, MP, and TP to their maximum levels.<br /><br />\n";
|
$page = <<<HTML
|
||||||
$page .= "A night's sleep at this Inn will cost you <b>" . $townrow["innprice"] . " gold</b>. Is that ok?<br /><br />\n";
|
Resting at the inn will refill your current HP, MP, and TP to their maximum levels.<br><br>
|
||||||
$page .= "<form action=\"index.php?do=inn\" method=\"post\">\n";
|
A night's sleep at this Inn will cost you <b>{$townrow["innprice"]} gold</b>. Is that ok?<br><br>
|
||||||
$page .= "<input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" />\n";
|
<form action="index.php?do=inn" method="post">
|
||||||
$page .= "</form>\n";
|
<input type="submit" name="submit" value="Yes" /> <input type="submit" name="cancel" value="No" />
|
||||||
|
</form>
|
||||||
|
HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
display($page, $title);
|
display($page, $title);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function buy() { // Displays a list of available items for purchase.
|
/**
|
||||||
|
* Displays a list of available items for purchase.
|
||||||
|
*/
|
||||||
|
function buy()
|
||||||
|
{
|
||||||
|
global $userrow;
|
||||||
|
|
||||||
global $userrow, $numqueries;
|
$townrow = get_town_by_xy($userrow['longitude'], $userrow['latitude']);
|
||||||
|
if ($townrow === false) display("Cheat attempt detected.<br><br>Get a life, loser.", "Error");
|
||||||
|
|
||||||
$townquery = doquery("SELECT name,itemslist FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
$items = db()->query("SELECT * FROM items WHERE id IN ({$townrow["itemslist"]});");
|
||||||
if (mysql_num_rows($townquery) != 1) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
$page = "Buying weapons will increase your Attack Power. Buying armor and shields will increase your Defense Power.<br><br>Click an item name to purchase it.<br><br>The following items are available at this town:<br><br>\n";
|
||||||
$townrow = mysql_fetch_array($townquery);
|
|
||||||
|
|
||||||
$itemslist = explode(",",$townrow["itemslist"]);
|
|
||||||
$querystring = "";
|
|
||||||
foreach($itemslist as $a=>$b) {
|
|
||||||
$querystring .= "id='$b' OR ";
|
|
||||||
}
|
|
||||||
$querystring = rtrim($querystring, " OR ");
|
|
||||||
|
|
||||||
$itemsquery = doquery("SELECT * FROM {{table}} WHERE $querystring ORDER BY id", "items");
|
|
||||||
$page = "Buying weapons will increase your Attack Power. Buying armor and shields will increase your Defense Power.<br /><br />Click an item name to purchase it.<br /><br />The following items are available at this town:<br /><br />\n";
|
|
||||||
$page .= "<table width=\"80%\">\n";
|
$page .= "<table width=\"80%\">\n";
|
||||||
while ($itemsrow = mysql_fetch_array($itemsquery)) {
|
while ($itemsrow = $items->fetchArray(SQLITE3_ASSOC)) {
|
||||||
if ($itemsrow["type"] == 1) { $attrib = "Attack Power:"; } else { $attrib = "Defense Power:"; }
|
$attrib = ($itemsrow["type"] == 1) ? "Attack Power:" : "Defense Power:";
|
||||||
$page .= "<tr><td width=\"4%\">";
|
$page .= "<tr><td width=\"4%\">";
|
||||||
if ($itemsrow["type"] == 1) { $page .= "<img src=\"images/icon_weapon.gif\" alt=\"weapon\" /></td>"; }
|
$page .= match ($itemsrow["type"]) {
|
||||||
if ($itemsrow["type"] == 2) { $page .= "<img src=\"images/icon_armor.gif\" alt=\"armor\" /></td>"; }
|
1 => '<img src="images/icon_weapon.gif" alt="weapon" /></td>',
|
||||||
if ($itemsrow["type"] == 3) { $page .= "<img src=\"images/icon_shield.gif\" alt=\"shield\" /></td>"; }
|
2 => '<img src="images/icon_armor.gif" alt="armor" /></td>',
|
||||||
if ($userrow["weaponid"] == $itemsrow["id"] || $userrow["armorid"] == $itemsrow["id"] || $userrow["shieldid"] == $itemsrow["id"]) {
|
3 => '<img src="images/icon_shield.gif" alt="shield" /></td>'
|
||||||
$page .= "<td width=\"32%\"><span class=\"light\">".$itemsrow["name"]."</span></td><td width=\"32%\"><span class=\"light\">$attrib ".$itemsrow["attribute"]."</span></td><td width=\"32%\"><span class=\"light\">Already purchased</span></td></tr>\n";
|
};
|
||||||
} else {
|
if ($userrow["weaponid"] == $itemsrow["id"] || $userrow["armorid"] == $itemsrow["id"] || $userrow["shieldid"] == $itemsrow["id"]) {
|
||||||
if ($itemsrow["special"] != "X") { $specialdot = "<span class=\"highlight\">*</span>"; } else { $specialdot = ""; }
|
$page .= "<td width=\"32%\"><span class=\"light\">".$itemsrow["name"]."</span></td><td width=\"32%\"><span class=\"light\">$attrib ".$itemsrow["attribute"]."</span></td><td width=\"32%\"><span class=\"light\">Already purchased</span></td></tr>\n";
|
||||||
$page .= "<td width=\"32%\"><b><a href=\"index.php?do=buy2:".$itemsrow["id"]."\">".$itemsrow["name"]."</a>$specialdot</b></td><td width=\"32%\">$attrib <b>".$itemsrow["attribute"]."</b></td><td width=\"32%\">Price: <b>".$itemsrow["buycost"]." gold</b></td></tr>\n";
|
} else {
|
||||||
}
|
if ($itemsrow["special"] != "X") { $specialdot = "<span class=\"highlight\">*</span>"; } else { $specialdot = ""; }
|
||||||
}
|
$page .= "<td width=\"32%\"><b><a href=\"index.php?do=buy2:".$itemsrow["id"]."\">".$itemsrow["name"]."</a>$specialdot</b></td><td width=\"32%\">$attrib <b>".$itemsrow["attribute"]."</b></td><td width=\"32%\">Price: <b>".$itemsrow["buycost"]." gold</b></td></tr>\n";
|
||||||
$page .= "</table><br />\n";
|
}
|
||||||
|
}
|
||||||
|
$page .= "</table><br>\n";
|
||||||
$page .= "If you've changed your mind, you may also return back to <a href=\"index.php\">town</a>.\n";
|
$page .= "If you've changed your mind, you may also return back to <a href=\"index.php\">town</a>.\n";
|
||||||
$title = "Buy Items";
|
$title = "Buy Items";
|
||||||
|
|
||||||
display($page, $title);
|
display($page, $title);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function buy2($id) { // Confirm user's intent to purchase item.
|
/**
|
||||||
|
* Confirm user's intent to purchase item.
|
||||||
|
*/
|
||||||
|
function buy2($id)
|
||||||
|
{
|
||||||
|
global $userrow;
|
||||||
|
|
||||||
global $userrow, $numqueries;
|
$townrow = get_town_by_xy($userrow['longitude'], $userrow['latitude']);
|
||||||
|
if ($townrow === false) display("Cheat attempt detected.<br><br>Get a life, loser.", "Error");
|
||||||
|
$townitems = explode(",", $townrow["itemslist"]);
|
||||||
|
if (!in_array($id, $townitems)) display("Cheat attempt detected.<br><br>Get a life, loser.", "Error");
|
||||||
|
|
||||||
$townquery = doquery("SELECT name,itemslist FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
$item = get_item($id);
|
||||||
if (mysql_num_rows($townquery) != 1) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
|
||||||
$townrow = mysql_fetch_array($townquery);
|
|
||||||
$townitems = explode(",",$townrow["itemslist"]);
|
|
||||||
if (! in_array($id, $townitems)) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
|
||||||
|
|
||||||
$itemsquery = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "items");
|
if ($userrow["gold"] < $item["buycost"]) {
|
||||||
$itemsrow = mysql_fetch_array($itemsquery);
|
display("You do not have enough gold to buy this item.<br><br>You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=buy\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Items");
|
||||||
|
}
|
||||||
|
|
||||||
if ($userrow["gold"] < $itemsrow["buycost"]) { display("You do not have enough gold to buy this item.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=buy\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Items"); die(); }
|
$type_to_row_mapping = [1 => 'weaponid', 2 => 'armorid', 3 => 'shieldid'];
|
||||||
|
$current_equipped_id = $userrow[$type_to_row_mapping[$item['type']] ?? 0];
|
||||||
|
|
||||||
if ($itemsrow["type"] == 1) {
|
if ($current_equipped_id != 0) {
|
||||||
if ($userrow["weaponid"] != 0) {
|
$item2 = get_item($current_equipped_id);
|
||||||
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["weaponid"]."' LIMIT 1", "items");
|
$page = "If you are buying the ".$item["name"].", then I will buy your ".$item2["name"]." for ".ceil($item2["buycost"] / 2)." gold. Is that ok?<br><br><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
||||||
$itemsrow2 = mysql_fetch_array($itemsquery2);
|
} else {
|
||||||
$page = "If you are buying the ".$itemsrow["name"].", then I will buy your ".$itemsrow2["name"]." for ".ceil($itemsrow2["buycost"]/2)." gold. Is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
$page = "You are buying the ".$item["name"].", is that ok?<br><br><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
||||||
} else {
|
}
|
||||||
$page = "You are buying the ".$itemsrow["name"].", is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
|
||||||
}
|
|
||||||
} elseif ($itemsrow["type"] == 2) {
|
|
||||||
if ($userrow["armorid"] != 0) {
|
|
||||||
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["armorid"]."' LIMIT 1", "items");
|
|
||||||
$itemsrow2 = mysql_fetch_array($itemsquery2);
|
|
||||||
$page = "If you are buying the ".$itemsrow["name"].", then I will buy your ".$itemsrow2["name"]." for ".ceil($itemsrow2["buycost"]/2)." gold. Is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
|
||||||
} else {
|
|
||||||
$page = "You are buying the ".$itemsrow["name"].", is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
|
||||||
}
|
|
||||||
} elseif ($itemsrow["type"] == 3) {
|
|
||||||
if ($userrow["shieldid"] != 0) {
|
|
||||||
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["shieldid"]."' LIMIT 1", "items");
|
|
||||||
$itemsrow2 = mysql_fetch_array($itemsquery2);
|
|
||||||
$page = "If you are buying the ".$itemsrow["name"].", then I will buy your ".$itemsrow2["name"]." for ".ceil($itemsrow2["buycost"]/2)." gold. Is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
|
||||||
} else {
|
|
||||||
$page = "You are buying the ".$itemsrow["name"].", is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$title = "Buy Items";
|
|
||||||
display($page, $title);
|
|
||||||
|
|
||||||
|
display($page, "Buy Items");
|
||||||
}
|
}
|
||||||
|
|
||||||
function buy3($id) { // Update user profile with new item & stats.
|
/**
|
||||||
|
* Update user profile with new item & stats.
|
||||||
|
*/
|
||||||
|
function buy3($id)
|
||||||
|
{
|
||||||
|
|
||||||
if (isset($_POST["cancel"])) { header("Location: index.php"); die(); }
|
if (isset($_POST["cancel"])) redirect('index.php');
|
||||||
|
|
||||||
global $userrow;
|
global $userrow;
|
||||||
|
|
||||||
$townquery = doquery("SELECT name,itemslist FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
$townrow = get_town_by_xy($userrow['longitude'], $userrow['latitude']);
|
||||||
if (mysql_num_rows($townquery) != 1) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
if ($townrow === false) display("Cheat attempt detected.<br><br>Get a life, loser.", "Error");
|
||||||
$townrow = mysql_fetch_array($townquery);
|
$townitems = explode(",", $townrow["itemslist"]);
|
||||||
$townitems = explode(",",$townrow["itemslist"]);
|
if (!in_array($id, $townitems)) display("Cheat attempt detected.<br><br>Get a life, loser.", "Error");
|
||||||
if (! in_array($id, $townitems)) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
|
||||||
|
|
||||||
$itemsquery = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "items");
|
$item = get_item($id);
|
||||||
$itemsrow = mysql_fetch_array($itemsquery);
|
|
||||||
|
|
||||||
if ($userrow["gold"] < $itemsrow["buycost"]) { display("You do not have enough gold to buy this item.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=buy\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Items"); die(); }
|
if ($userrow["gold"] < $item["buycost"]) {
|
||||||
|
display("You do not have enough gold to buy this item.<br><br>You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=buy\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Items");
|
||||||
|
}
|
||||||
|
|
||||||
if ($itemsrow["type"] == 1) { // weapon
|
$type_mapping = [
|
||||||
|
1 => ['id' => 'weaponid', 'name' => 'weaponname', 'power' => 'attackpower'],
|
||||||
|
2 => ['id' => 'armorid', 'name' => 'armorname', 'power' => 'defensepower'],
|
||||||
|
3 => ['id' => 'shieldid', 'name' => 'shieldname', 'power' => 'defensepower']
|
||||||
|
];
|
||||||
|
|
||||||
// Check if they already have an item in the slot.
|
// Validate item type
|
||||||
if ($userrow["weaponid"] != 0) {
|
if (!isset($type_mapping[$item["type"]])) {
|
||||||
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["weaponid"]."' LIMIT 1", "items");
|
display("Invalid item type.", "Error");
|
||||||
$itemsrow2 = mysql_fetch_array($itemsquery2);
|
}
|
||||||
} else {
|
|
||||||
$itemsrow2 = array("attribute"=>0,"buycost"=>0,"special"=>"X");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Special item fields.
|
// Retrieve current equipped item or create a default
|
||||||
$specialchange1 = "";
|
$current_equip_id = $userrow[$type_mapping[$item["type"]]['id']];
|
||||||
$specialchange2 = "";
|
if ($current_equip_id != 0) {
|
||||||
if ($itemsrow["special"] != "X") {
|
$item2 = get_item($current_equip_id);
|
||||||
$special = explode(",",$itemsrow["special"]);
|
} else {
|
||||||
$tochange = $special[0];
|
$item2 = ["attribute" => 0, "buycost" => 0, "special" => "X"];
|
||||||
$userrow[$tochange] = $userrow[$tochange] + $special[1];
|
}
|
||||||
$specialchange1 = "$tochange='".$userrow[$tochange]."',";
|
|
||||||
if ($tochange == "strength") { $userrow["attackpower"] += $special[1]; }
|
|
||||||
if ($tochange == "dexterity") { $userrow["defensepower"] += $special[1]; }
|
|
||||||
}
|
|
||||||
if ($itemsrow2["special"] != "X") {
|
|
||||||
$special2 = explode(",",$itemsrow2["special"]);
|
|
||||||
$tochange2 = $special2[0];
|
|
||||||
$userrow[$tochange2] = $userrow[$tochange2] - $special2[1];
|
|
||||||
$specialchange2 = "$tochange2='".$userrow[$tochange2]."',";
|
|
||||||
if ($tochange2 == "strength") { $userrow["attackpower"] -= $special2[1]; }
|
|
||||||
if ($tochange2 == "dexterity") { $userrow["defensepower"] -= $special2[1]; }
|
|
||||||
}
|
|
||||||
|
|
||||||
// New stats.
|
// Process special item effects
|
||||||
$newgold = $userrow["gold"] + ceil($itemsrow2["buycost"]/2) - $itemsrow["buycost"];
|
$specialFields = [];
|
||||||
$newattack = $userrow["attackpower"] + $itemsrow["attribute"] - $itemsrow2["attribute"];
|
$specialValues = [];
|
||||||
$newid = $itemsrow["id"];
|
$powerAdjustments = 0;
|
||||||
$newname = $itemsrow["name"];
|
|
||||||
$userid = $userrow["id"];
|
|
||||||
if ($userrow["currenthp"] > $userrow["maxhp"]) { $newhp = $userrow["maxhp"]; } else { $newhp = $userrow["currenthp"]; }
|
|
||||||
if ($userrow["currentmp"] > $userrow["maxmp"]) { $newmp = $userrow["maxmp"]; } else { $newmp = $userrow["currentmp"]; }
|
|
||||||
if ($userrow["currenttp"] > $userrow["maxtp"]) { $newtp = $userrow["maxtp"]; } else { $newtp = $userrow["currenttp"]; }
|
|
||||||
|
|
||||||
// Final update.
|
foreach ([$item, $item2] as $index => $process_item) {
|
||||||
$updatequery = doquery("UPDATE {{table}} SET $specialchange1 $specialchange2 gold='$newgold', attackpower='$newattack', weaponid='$newid', weaponname='$newname', currenthp='$newhp', currentmp='$newmp', currenttp='$newtp' WHERE id='$userid' LIMIT 1", "users");
|
if ($process_item["special"] != "X") {
|
||||||
|
$special = explode(",", $process_item["special"]);
|
||||||
|
$toChange = $special[0];
|
||||||
|
$changeAmount = $index === 0 ? $special[1] : -$special[1];
|
||||||
|
|
||||||
} elseif ($itemsrow["type"] == 2) { // Armor
|
$userrow[$toChange] += $changeAmount;
|
||||||
|
$specialFields[] = "$toChange = ?";
|
||||||
|
$specialValues[] = $userrow[$toChange];
|
||||||
|
|
||||||
// Check if they already have an item in the slot.
|
// Adjust attack or defense power
|
||||||
if ($userrow["armorid"] != 0) {
|
if ($toChange == "strength" || $toChange == "dexterity") {
|
||||||
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["armorid"]."' LIMIT 1", "items");
|
$powerType = $toChange == "strength" ? "attackpower" : "defensepower";
|
||||||
$itemsrow2 = mysql_fetch_array($itemsquery2);
|
$powerAdjustments += $changeAmount;
|
||||||
} else {
|
}
|
||||||
$itemsrow2 = array("attribute"=>0,"buycost"=>0,"special"=>"X");
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special item fields.
|
// Determine power and type-specific updates
|
||||||
$specialchange1 = "";
|
$currentType = $type_mapping[$item["type"]];
|
||||||
$specialchange2 = "";
|
$powerField = $currentType['power'];
|
||||||
if ($itemsrow["special"] != "X") {
|
$newPower = $userrow[$powerField] + $item["attribute"] - $item2["attribute"];
|
||||||
$special = explode(",",$itemsrow["special"]);
|
|
||||||
$tochange = $special[0];
|
|
||||||
$userrow[$tochange] = $userrow[$tochange] + $special[1];
|
|
||||||
$specialchange1 = "$tochange='".$userrow[$tochange]."',";
|
|
||||||
if ($tochange == "strength") { $userrow["attackpower"] += $special[1]; }
|
|
||||||
if ($tochange == "dexterity") { $userrow["defensepower"] += $special[1]; }
|
|
||||||
}
|
|
||||||
if ($itemsrow2["special"] != "X") {
|
|
||||||
$special2 = explode(",",$itemsrow2["special"]);
|
|
||||||
$tochange2 = $special2[0];
|
|
||||||
$userrow[$tochange2] = $userrow[$tochange2] - $special2[1];
|
|
||||||
$specialchange2 = "$tochange2='".$userrow[$tochange2]."',";
|
|
||||||
if ($tochange2 == "strength") { $userrow["attackpower"] -= $special2[1]; }
|
|
||||||
if ($tochange2 == "dexterity") { $userrow["defensepower"] -= $special2[1]; }
|
|
||||||
}
|
|
||||||
|
|
||||||
// New stats.
|
// Calculate new gold with trade-in value
|
||||||
$newgold = $userrow["gold"] + ceil($itemsrow2["buycost"]/2) - $itemsrow["buycost"];
|
$newGold = $userrow["gold"] + ceil($item2["buycost"]/2) - $item["buycost"];
|
||||||
$newdefense = $userrow["defensepower"] + $itemsrow["attribute"] - $itemsrow2["attribute"];
|
|
||||||
$newid = $itemsrow["id"];
|
|
||||||
$newname = $itemsrow["name"];
|
|
||||||
$userid = $userrow["id"];
|
|
||||||
if ($userrow["currenthp"] > $userrow["maxhp"]) { $newhp = $userrow["maxhp"]; } else { $newhp = $userrow["currenthp"]; }
|
|
||||||
if ($userrow["currentmp"] > $userrow["maxmp"]) { $newmp = $userrow["maxmp"]; } else { $newmp = $userrow["currentmp"]; }
|
|
||||||
if ($userrow["currenttp"] > $userrow["maxtp"]) { $newtp = $userrow["maxtp"]; } else { $newtp = $userrow["currenttp"]; }
|
|
||||||
|
|
||||||
// Final update.
|
// Ensure current HP/MP/TP don't exceed max values
|
||||||
$updatequery = doquery("UPDATE {{table}} SET $specialchange1 $specialchange2 gold='$newgold', defensepower='$newdefense', armorid='$newid', armorname='$newname', currenthp='$newhp', currentmp='$newmp', currenttp='$newtp' WHERE id='$userid' LIMIT 1", "users");
|
$newhp = min($userrow["currenthp"], $userrow["maxhp"]);
|
||||||
|
$newmp = min($userrow["currentmp"], $userrow["maxmp"]);
|
||||||
|
$newtp = min($userrow["currenttp"], $userrow["maxtp"]);
|
||||||
|
|
||||||
} elseif ($itemsrow["type"] == 3) { // Shield
|
$updateFields = array_merge(
|
||||||
|
$specialFields,
|
||||||
|
[
|
||||||
|
"gold = ?",
|
||||||
|
"{$powerField} = ?",
|
||||||
|
"{$currentType['id']} = ?",
|
||||||
|
"{$currentType['name']} = ?",
|
||||||
|
"currenthp = ?",
|
||||||
|
"currentmp = ?",
|
||||||
|
"currenttp = ?"
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
// Check if they already have an item in the slot.
|
$updateValues = array_merge(
|
||||||
if ($userrow["shieldid"] != 0) {
|
$specialValues,
|
||||||
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["shieldid"]."' LIMIT 1", "items");
|
[
|
||||||
$itemsrow2 = mysql_fetch_array($itemsquery2);
|
$newGold,
|
||||||
} else {
|
$newPower,
|
||||||
$itemsrow2 = array("attribute"=>0,"buycost"=>0,"special"=>"X");
|
$item["id"],
|
||||||
}
|
$item["name"],
|
||||||
|
$newhp,
|
||||||
|
$newmp,
|
||||||
|
$newtp,
|
||||||
|
$userrow["id"]
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
// Special item fields.
|
$stmt = db()->query("UPDATE users SET " . implode(", ", $updateFields) . " WHERE id = ?;", $updateValues);
|
||||||
$specialchange1 = "";
|
if ($stmt === false) exit("Failed to purchase and equip $id. Go back and try again.");
|
||||||
$specialchange2 = "";
|
|
||||||
if ($itemsrow["special"] != "X") {
|
|
||||||
$special = explode(",",$itemsrow["special"]);
|
|
||||||
$tochange = $special[0];
|
|
||||||
$userrow[$tochange] = $userrow[$tochange] + $special[1];
|
|
||||||
$specialchange1 = "$tochange='".$userrow[$tochange]."',";
|
|
||||||
if ($tochange == "strength") { $userrow["attackpower"] += $special[1]; }
|
|
||||||
if ($tochange == "dexterity") { $userrow["defensepower"] += $special[1]; }
|
|
||||||
}
|
|
||||||
if ($itemsrow2["special"] != "X") {
|
|
||||||
$special2 = explode(",",$itemsrow2["special"]);
|
|
||||||
$tochange2 = $special2[0];
|
|
||||||
$userrow[$tochange2] = $userrow[$tochange2] - $special2[1];
|
|
||||||
$specialchange2 = "$tochange2='".$userrow[$tochange2]."',";
|
|
||||||
if ($tochange2 == "strength") { $userrow["attackpower"] -= $special2[1]; }
|
|
||||||
if ($tochange2 == "dexterity") { $userrow["defensepower"] -= $special2[1]; }
|
|
||||||
}
|
|
||||||
|
|
||||||
// New stats.
|
|
||||||
$newgold = $userrow["gold"] + ceil($itemsrow2["buycost"]/2) - $itemsrow["buycost"];
|
|
||||||
$newdefense = $userrow["defensepower"] + $itemsrow["attribute"] - $itemsrow2["attribute"];
|
|
||||||
$newid = $itemsrow["id"];
|
|
||||||
$newname = $itemsrow["name"];
|
|
||||||
$userid = $userrow["id"];
|
|
||||||
if ($userrow["currenthp"] > $userrow["maxhp"]) { $newhp = $userrow["maxhp"]; } else { $newhp = $userrow["currenthp"]; }
|
|
||||||
if ($userrow["currentmp"] > $userrow["maxmp"]) { $newmp = $userrow["maxmp"]; } else { $newmp = $userrow["currentmp"]; }
|
|
||||||
if ($userrow["currenttp"] > $userrow["maxtp"]) { $newtp = $userrow["maxtp"]; } else { $newtp = $userrow["currenttp"]; }
|
|
||||||
|
|
||||||
// Final update.
|
|
||||||
$updatequery = doquery("UPDATE {{table}} SET $specialchange1 $specialchange2 gold='$newgold', defensepower='$newdefense', shieldid='$newid', shieldname='$newname', currenthp='$newhp', currentmp='$newmp', currenttp='$newtp' WHERE id='$userid' LIMIT 1", "users");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
display("Thank you for purchasing this item.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=buy\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Items");
|
|
||||||
|
|
||||||
|
display("Thank you for purchasing this item.<br><br>You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=buy\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Items");
|
||||||
}
|
}
|
||||||
|
|
||||||
function maps() { // List maps the user can buy.
|
/**
|
||||||
|
* List maps the user can buy.
|
||||||
|
*/
|
||||||
|
function maps()
|
||||||
|
{
|
||||||
|
global $userrow;
|
||||||
|
|
||||||
global $userrow, $numqueries;
|
$mappedtowns = explode(",", $userrow["towns"]);
|
||||||
|
|
||||||
$mappedtowns = explode(",",$userrow["towns"]);
|
$page = "Buying maps will put the town in your Travel To box, and it won't cost you as many TP to get there.<br><br>\n";
|
||||||
|
$page .= "Click a town name to purchase its map.<br><br>\n";
|
||||||
$page = "Buying maps will put the town in your Travel To box, and it won't cost you as many TP to get there.<br /><br />\n";
|
|
||||||
$page .= "Click a town name to purchase its map.<br /><br />\n";
|
|
||||||
$page .= "<table width=\"90%\">\n";
|
$page .= "<table width=\"90%\">\n";
|
||||||
|
|
||||||
$townquery = doquery("SELECT * FROM {{table}} ORDER BY id", "towns");
|
$towns = db()->query('SELECT * FROM towns ORDER BY id;');
|
||||||
while ($townrow = mysql_fetch_array($townquery)) {
|
while ($townrow = $towns->fetchArray(SQLITE3_ASSOC)) {
|
||||||
|
$latitude = ($townrow["latitude"] >= 0) ? $townrow["latitude"] . "N," : ($townrow["latitude"] * -1) . "S,";
|
||||||
if ($townrow["latitude"] >= 0) { $latitude = $townrow["latitude"] . "N,"; } else { $latitude = ($townrow["latitude"]*-1) . "S,"; }
|
$longitude = ($townrow["longitude"] >= 0) ? $townrow["longitude"] . "E" : ($townrow["longitude"] * -1) . "W";
|
||||||
if ($townrow["longitude"] >= 0) { $longitude = $townrow["longitude"] . "E"; } else { $longitude = ($townrow["longitude"]*-1) . "W"; }
|
|
||||||
|
|
||||||
$mapped = false;
|
$mapped = false;
|
||||||
foreach($mappedtowns as $a => $b) {
|
foreach($mappedtowns as $b) if ($b == $townrow["id"]) $mapped = true;
|
||||||
if ($b == $townrow["id"]) { $mapped = true; }
|
|
||||||
}
|
|
||||||
if ($mapped == false) {
|
if ($mapped == false) {
|
||||||
$page .= "<tr><td width=\"25%\"><a href=\"index.php?do=maps2:".$townrow["id"]."\">".$townrow["name"]."</a></td><td width=\"25%\">Price: ".$townrow["mapprice"]." gold</td><td width=\"50%\" colspan=\"2\">Buy map to reveal details.</td></tr>\n";
|
$page .= "<tr><td width=\"25%\"><a href=\"index.php?do=maps2:".$townrow["id"]."\">".$townrow["name"]."</a></td><td width=\"25%\">Price: ".$townrow["mapprice"]." gold</td><td width=\"50%\" colspan=\"2\">Buy map to reveal details.</td></tr>\n";
|
||||||
} else {
|
} else {
|
||||||
$page .= "<tr><td width=\"25%\"><span class=\"light\">".$townrow["name"]."</span></td><td width=\"25%\"><span class=\"light\">Already mapped.</span></td><td width=\"35%\"><span class=\"light\">Location: $latitude $longitude</span></td><td width=\"15%\"><span class=\"light\">TP: ".$townrow["travelpoints"]."</span></td></tr>\n";
|
$page .= "<tr><td width=\"25%\"><span class=\"light\">".$townrow["name"]."</span></td><td width=\"25%\"><span class=\"light\">Already mapped.</span></td><td width=\"35%\"><span class=\"light\">Location: $latitude $longitude</span></td><td width=\"15%\"><span class=\"light\">TP: ".$townrow["travelpoints"]."</span></td></tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$page .= "</table><br />\n";
|
$page .= "</table><br>\n";
|
||||||
$page .= "If you've changed your mind, you may also return back to <a href=\"index.php\">town</a>.\n";
|
$page .= "If you've changed your mind, you may also return back to <a href=\"index.php\">town</a>.\n";
|
||||||
|
|
||||||
display($page, "Buy Maps");
|
display($page, "Buy Maps");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function maps2($id) { // Confirm user's intent to purchase map.
|
/**
|
||||||
|
* Confirm user's intent to purchase map.
|
||||||
|
*/
|
||||||
|
function maps2($id)
|
||||||
|
{
|
||||||
|
global $userrow;
|
||||||
|
|
||||||
global $userrow, $numqueries;
|
$townrow = get_town_by_id($id);
|
||||||
|
|
||||||
$townquery = doquery("SELECT name,mapprice FROM {{table}} WHERE id='$id' LIMIT 1", "towns");
|
if ($userrow["gold"] < $townrow["mapprice"]) {
|
||||||
$townrow = mysql_fetch_array($townquery);
|
display("You do not have enough gold to buy this map.<br><br>You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=maps\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Maps");
|
||||||
|
}
|
||||||
|
|
||||||
if ($userrow["gold"] < $townrow["mapprice"]) { display("You do not have enough gold to buy this map.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=maps\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Maps"); die(); }
|
$page = "You are buying the ".$townrow["name"]." map. Is that ok?<br><br><form action=\"index.php?do=maps3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
||||||
|
|
||||||
$page = "You are buying the ".$townrow["name"]." map. Is that ok?<br /><br /><form action=\"index.php?do=maps3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
|
||||||
|
|
||||||
display($page, "Buy Maps");
|
display($page, "Buy Maps");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function maps3($id) { // Add new map to user's profile.
|
/**
|
||||||
|
* Add new map to user's profile.
|
||||||
|
*/
|
||||||
|
function maps3($id)
|
||||||
|
{
|
||||||
|
if (isset($_POST["cancel"])) redirect('index.php');
|
||||||
|
|
||||||
if (isset($_POST["cancel"])) { header("Location: index.php"); die(); }
|
global $userrow;
|
||||||
|
|
||||||
global $userrow, $numqueries;
|
$townrow = get_town_by_id($id);
|
||||||
|
|
||||||
$townquery = doquery("SELECT name,mapprice FROM {{table}} WHERE id='$id' LIMIT 1", "towns");
|
if ($userrow["gold"] < $townrow["mapprice"]) {
|
||||||
$townrow = mysql_fetch_array($townquery);
|
display("You do not have enough gold to buy this map.<br><br>You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=maps\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Maps");
|
||||||
|
}
|
||||||
if ($userrow["gold"] < $townrow["mapprice"]) { display("You do not have enough gold to buy this map.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=maps\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Maps"); die(); }
|
|
||||||
|
|
||||||
$mappedtowns = $userrow["towns"].",$id";
|
$mappedtowns = $userrow["towns"].",$id";
|
||||||
$newgold = $userrow["gold"] - $townrow["mapprice"];
|
$newgold = $userrow["gold"] - $townrow["mapprice"];
|
||||||
|
|
||||||
$updatequery = doquery("UPDATE {{table}} SET towns='$mappedtowns',gold='$newgold' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
db()->query('UPDATE users SET towns=?, gold=? WHERE id=?;', [$mappedtowns, $newgold, $userrow['id']]);
|
||||||
|
|
||||||
display("Thank you for purchasing this map.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=maps\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Maps");
|
|
||||||
|
|
||||||
|
display("Thank you for purchasing this map.<br><br>You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=maps\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Maps");
|
||||||
}
|
}
|
||||||
|
|
||||||
function travelto($id, $usepoints=true) { // Send a user to a town from the Travel To menu.
|
/**
|
||||||
|
* Send a user to a town from the Travel To menu.
|
||||||
|
*/
|
||||||
|
function travelto($id, bool $usepoints = true)
|
||||||
|
{
|
||||||
|
global $userrow;
|
||||||
|
|
||||||
global $userrow, $numqueries;
|
if ($userrow["currentaction"] == "Fighting") redirect('index.php?do=fight');
|
||||||
|
|
||||||
if ($userrow["currentaction"] == "Fighting") { header("Location: index.php?do=fight"); die(); }
|
$townrow = get_town_by_id($id);
|
||||||
|
|
||||||
$townquery = doquery("SELECT name,travelpoints,latitude,longitude FROM {{table}} WHERE id='$id' LIMIT 1", "towns");
|
if ($usepoints) {
|
||||||
$townrow = mysql_fetch_array($townquery);
|
|
||||||
|
|
||||||
if ($usepoints==true) {
|
|
||||||
if ($userrow["currenttp"] < $townrow["travelpoints"]) {
|
if ($userrow["currenttp"] < $townrow["travelpoints"]) {
|
||||||
display("You do not have enough TP to travel here. Please go back and try again when you get more TP.", "Travel To"); die();
|
display("You do not have enough TP to travel here. Please go back and try again when you get more TP.", "Travel To");
|
||||||
}
|
}
|
||||||
$mapped = explode(",",$userrow["towns"]);
|
$mapped = explode(",",$userrow["towns"]);
|
||||||
if (!in_array($id, $mapped)) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
if (!in_array($id, $mapped)) { display("Cheat attempt detected.<br><br>Get a life, loser.", "Error"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($userrow["latitude"] == $townrow["latitude"]) && ($userrow["longitude"] == $townrow["longitude"])) { display("You are already in this town. <a href=\"index.php\">Click here</a> to return to the main town screen.", "Travel To"); die(); }
|
if (($userrow["latitude"] == $townrow["latitude"]) && ($userrow["longitude"] == $townrow["longitude"])) {
|
||||||
|
display("You are already in this town. <a href=\"index.php\">Click here</a> to return to the main town screen.", "Travel To");
|
||||||
|
}
|
||||||
|
|
||||||
if ($usepoints == true) { $newtp = $userrow["currenttp"] - $townrow["travelpoints"]; } else { $newtp = $userrow["currenttp"]; }
|
$newtp = ($usepoints) ? $userrow["currenttp"] - $townrow["travelpoints"] : $userrow["currenttp"];
|
||||||
|
|
||||||
$newlat = $townrow["latitude"];
|
$newlat = $townrow["latitude"];
|
||||||
$newlon = $townrow["longitude"];
|
$newlon = $townrow["longitude"];
|
||||||
|
@ -371,20 +322,16 @@ function travelto($id, $usepoints=true) { // Send a user to a town from the Trav
|
||||||
// If they got here by exploring, add this town to their map.
|
// If they got here by exploring, add this town to their map.
|
||||||
$mapped = explode(",",$userrow["towns"]);
|
$mapped = explode(",",$userrow["towns"]);
|
||||||
$town = false;
|
$town = false;
|
||||||
foreach($mapped as $a => $b) {
|
foreach($mapped as $b) if ($b == $id) $town = true;
|
||||||
if ($b == $id) { $town = true; }
|
$mapped = implode(",", $mapped);
|
||||||
}
|
if ($town == false) $mapped .= ",$id";
|
||||||
$mapped = implode(",",$mapped);
|
|
||||||
if ($town == false) {
|
|
||||||
$mapped .= ",$id";
|
|
||||||
$mapped = "towns='".$mapped."',";
|
|
||||||
} else {
|
|
||||||
$mapped = "towns='".$mapped."',";
|
|
||||||
}
|
|
||||||
|
|
||||||
$updatequery = doquery("UPDATE {{table}} SET currentaction='In Town',$mapped currenttp='$newtp',latitude='$newlat',longitude='$newlon' WHERE id='$newid' LIMIT 1", "users");
|
$mapped = "towns='".$mapped."',";
|
||||||
|
|
||||||
|
db()->query("UPDATE users SET currentaction='In Town',$mapped currenttp=?, latitude=?, longitude=? WHERE id=?;", [
|
||||||
|
$newtp, $newlat, $newlon, $newid
|
||||||
|
]);
|
||||||
|
|
||||||
$page = "You have travelled to ".$townrow["name"].". You may now <a href=\"index.php\">enter this town</a>.";
|
$page = "You have travelled to ".$townrow["name"].". You may now <a href=\"index.php\">enter this town</a>.";
|
||||||
display($page, "Travel To");
|
display($page, "Travel To");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,28 +51,28 @@ a:hover {
|
||||||
<body><center>
|
<body><center>
|
||||||
<table width="90%"><tr>
|
<table width="90%"><tr>
|
||||||
<td width="150" style="border-right: solid 1px black;">
|
<td width="150" style="border-right: solid 1px black;">
|
||||||
<b><u>DK Administration</u></b><br /><br />
|
<b><u>DK Administration</u></b><br><br>
|
||||||
<b>Links:</b><br />
|
<b>Links:</b><br>
|
||||||
<a href="admin.php">Admin Home</a><br />
|
<a href="admin.php">Admin Home</a><br>
|
||||||
<a href="index.php">Game Home</a><br /><br />
|
<a href="index.php">Game Home</a><br><br>
|
||||||
<b>Primary Data:</b><br />
|
<b>Primary Data:</b><br>
|
||||||
<a href="admin.php?do=main">Main Settings</a><br />
|
<a href="admin.php?do=main">Main Settings</a><br>
|
||||||
<a href="admin.php?do=news">Add News Post</a><br />
|
<a href="admin.php?do=news">Add News Post</a><br>
|
||||||
<a href="admin.php?do=users">Edit Users</a><br /><br />
|
<a href="admin.php?do=users">Edit Users</a><br><br>
|
||||||
<b>Game Data:</b><br />
|
<b>Game Data:</b><br>
|
||||||
<a href="admin.php?do=items">Edit Items</a><br />
|
<a href="admin.php?do=items">Edit Items</a><br>
|
||||||
<a href="admin.php?do=drops">Edit Drops</a><br />
|
<a href="admin.php?do=drops">Edit Drops</a><br>
|
||||||
<a href="admin.php?do=towns">Edit Towns</a><br />
|
<a href="admin.php?do=towns">Edit Towns</a><br>
|
||||||
<a href="admin.php?do=monsters">Edit Monsters</a><br />
|
<a href="admin.php?do=monsters">Edit Monsters</a><br>
|
||||||
<a href="admin.php?do=levels">Edit Levels</a><br />
|
<a href="admin.php?do=levels">Edit Levels</a><br>
|
||||||
<a href="admin.php?do=spells">Edit Spells</a><br />
|
<a href="admin.php?do=spells">Edit Spells</a><br>
|
||||||
</td><td>
|
</td><td>
|
||||||
{{content}}
|
{{content}}
|
||||||
</td></tr></table>
|
</td></tr></table>
|
||||||
<br />
|
<br>
|
||||||
<table class="copyright" width="90%"><tr>
|
<table class="copyright" width="90%"><tr>
|
||||||
<td width="25%" align="center">Powered by <a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight</a></td><td width="25%" align="center">© 2003-2006 by renderse7en</td><td width="25%" align="center">{{totaltime}} Seconds, {{numqueries}} Queries</td><td width="25%" align="center">Version {{version}} {{build}}</td>
|
<td width="25%" align="center">Powered by <a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight</a></td><td width="25%" align="center">© 2003-2006 by renderse7en</td><td width="25%" align="center">{{totaltime}} Seconds, {{numqueries}} Queries</td><td width="25%" align="center">Version {{version}} {{build}}</td>
|
||||||
</center></body>
|
</center></body>
|
||||||
</html>
|
</html>
|
||||||
THEVERYENDOFYOU;
|
THEVERYENDOFYOU;
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -4,11 +4,11 @@ $template = <<<THEVERYENDOFYOU
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr><td colspan="2">Use the form below to change your password. All fields are required. New passwords must be 10 alphanumeric characters or less.</td></tr>
|
<tr><td colspan="2">Use the form below to change your password. All fields are required. New passwords must be 10 alphanumeric characters or less.</td></tr>
|
||||||
<tr><td width="20%">Username:</td><td><input type="text" name="username" size="30" maxlength="30" /></td></tr>
|
<tr><td width="20%">Username:</td><td><input type="text" name="username" size="30" maxlength="30" /></td></tr>
|
||||||
<tr><td>Old Password:</td><td><input type="password" name="oldpass" size="20" /></td></tr>
|
<tr><td>Old Password:</td><td><input type="password" name="password" /></td></tr>
|
||||||
<tr><td>New Password:</td><td><input type="password" name="newpass1" size="20" maxlength="10" /></td></tr>
|
<tr><td>New Password:</td><td><input type="password" name="new_password" /></td></tr>
|
||||||
<tr><td>Verify New Password:</td><td><input type="password" name="newpass2" size="20" maxlength="10" /><br /><br /><br /></td></tr>
|
<tr><td>Verify New Password:</td><td><input type="password" name="new_password2" /><br><br><br></td></tr>
|
||||||
<tr><td colspan="2"><input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" /></td></tr>
|
<tr><td colspan="2"><input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" /></td></tr>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
THEVERYENDOFYOU;
|
THEVERYENDOFYOU;
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -3,7 +3,7 @@ $template = <<<THEVERYENDOFYOU
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr><td class="title"><img src="images/title_fighting.gif" alt="Fighting" /></td></tr>
|
<tr><td class="title"><img src="images/title_fighting.gif" alt="Fighting" /></td></tr>
|
||||||
<tr><td>
|
<tr><td>
|
||||||
You are fighting a <b>{{monstername}}</b><br /><br />
|
You are fighting a <b>{{monstername}}</b><br><br>
|
||||||
{{monsterhp}}
|
{{monsterhp}}
|
||||||
{{yourturn}}
|
{{yourturn}}
|
||||||
{{monsterturn}}
|
{{monsterturn}}
|
||||||
|
@ -11,4 +11,4 @@ You are fighting a <b>{{monstername}}</b><br /><br />
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</table>
|
</table>
|
||||||
THEVERYENDOFYOU;
|
THEVERYENDOFYOU;
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -3,38 +3,38 @@ $template = <<<THEVERYENDOFYOU
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr><td class="title"><img src="images/button_location.gif" alt="Location" title="Location" /></td></tr>
|
<tr><td class="title"><img src="images/button_location.gif" alt="Location" title="Location" /></td></tr>
|
||||||
<tr><td>
|
<tr><td>
|
||||||
Currently: {{currentaction}}<br />
|
Currently: {{currentaction}}<br>
|
||||||
Latitude: {{latitude}}<br />
|
Latitude: {{latitude}}<br>
|
||||||
Longitude: {{longitude}}<br />
|
Longitude: {{longitude}}<br>
|
||||||
<a href="javascript:openmappopup()">View Map</a><br /><br />
|
<a href="javascript:openmappopup()">View Map</a><br><br>
|
||||||
<form action="index.php?do=move" method="post">
|
<form action="index.php?do=move" method="post">
|
||||||
<center>
|
<center>
|
||||||
<input name="north" type="submit" value="North" /><br />
|
<input name="north" type="submit" value="North" /><br>
|
||||||
<input name="west" type="submit" value="West" /><input name="east" type="submit" value="East" /><br />
|
<input name="west" type="submit" value="West" /><input name="east" type="submit" value="East" /><br>
|
||||||
<input name="south" type="submit" value="South" />
|
<input name="south" type="submit" value="South" />
|
||||||
</center>
|
</center>
|
||||||
</form>
|
</form>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</table><br />
|
</table><br>
|
||||||
|
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr><td class="title"><img src="images/button_towns.gif" alt="Towns" title="Towns" /></td></tr>
|
<tr><td class="title"><img src="images/button_towns.gif" alt="Towns" title="Towns" /></td></tr>
|
||||||
<tr><td>
|
<tr><td>
|
||||||
{{currenttown}}
|
{{currenttown}}
|
||||||
Travel To:<br />
|
Travel To:<br>
|
||||||
{{townslist}}
|
{{townslist}}
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</table><br />
|
</table><br>
|
||||||
|
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr><td class="title"><img src="images/button_functions.gif" alt="Functions" title="Functions" /></td></tr>
|
<tr><td class="title"><img src="images/button_functions.gif" alt="Functions" title="Functions" /></td></tr>
|
||||||
<tr><td>
|
<tr><td>
|
||||||
{{forumslink}}
|
{{forumslink}}
|
||||||
{{adminlink}}
|
{{adminlink}}
|
||||||
<a href="users.php?do=changepassword">Change Password</a><br />
|
<a href="users.php?do=changepassword">Change Password</a><br>
|
||||||
<a href="login.php?do=logout">Log Out</a><br />
|
<a href="login.php?do=logout">Log Out</a><br>
|
||||||
<a href="help.php">Help</a>
|
<a href="help.php">Help</a>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</table><br />
|
</table><br>
|
||||||
THEVERYENDOFYOU;
|
THEVERYENDOFYOU;
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -6,8 +6,8 @@ $template = <<<THEVERYENDOFYOU
|
||||||
<tr><td>Password:</td><td><input type="password" size="30" name="password" /></td></tr>
|
<tr><td>Password:</td><td><input type="password" size="30" name="password" /></td></tr>
|
||||||
<tr><td>Remember me?</td><td><input type="checkbox" name="rememberme" value="yes" /> Yes</td></tr>
|
<tr><td>Remember me?</td><td><input type="checkbox" name="rememberme" value="yes" /> Yes</td></tr>
|
||||||
<tr><td colspan="2"><input type="submit" name="submit" value="Log In" /></td></tr>
|
<tr><td colspan="2"><input type="submit" name="submit" value="Log In" /></td></tr>
|
||||||
<tr><td colspan="2">Checking the "Remember Me" option will store your login information in a cookie so you don't have to enter it next time you get online.<br /><br />Want to play? You gotta <a href="users.php?do=register">register your own character.</a><br /><br />You may also <a href="users.php?do=changepassword">change your password</a>, or <a href="users.php?do=lostpassword">request a new one</a> if you've lost yours.</td></tr>
|
<tr><td colspan="2">Checking the "Remember Me" option will store your login information in a cookie so you don't have to enter it next time you get online.<br><br>Want to play? You gotta <a href="users.php?do=register">register your own character.</a><br><br>You may also <a href="users.php?do=changepassword">change your password</a>, or <a href="users.php?do=lostpassword">request a new one</a> if you've lost yours.</td></tr>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
THEVERYENDOFYOU;
|
THEVERYENDOFYOU;
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,41 +1,39 @@
|
||||||
<?php
|
<?php
|
||||||
$template = <<<THEVERYENDOFYOU
|
$template = <<<HTML
|
||||||
Here is the character profile for <b>{{charname}}</b>.<br /><br />
|
Here is the character profile for <b>{{username}}</b>.<br><br>
|
||||||
When you're finished, you may <a href="index.php">return to town</a>.<br /><br />
|
When you're finished, you may <a href="index.php">return to town</a>.<br><br>
|
||||||
<table width="200">
|
<table width="200">
|
||||||
<tr><td class="title"><img src="images/button_character.gif" alt="Character" title="Character" /></td></tr>
|
<tr><td class="title"><img src="images/button_character.gif" alt="Character" title="Character" /></td></tr>
|
||||||
<tr><td>
|
<tr><td>
|
||||||
<b>{{charname}}</b><br /><br />
|
<b>{{username}}</b><br><br>
|
||||||
|
|
||||||
Difficulty: {{difficulty}}<br />
|
Class: {{charclass}}<br><br>
|
||||||
Class: {{charclass}}<br /><br />
|
|
||||||
|
|
||||||
Level: {{level}}<br />
|
Level: {{level}}<br>
|
||||||
Experience: {{experience}}<br />
|
Experience: {{experience}}<br>
|
||||||
Gold: {{gold}}<br />
|
Gold: {{gold}}<br>
|
||||||
Hit Points: {{currenthp}} / {{maxhp}}<br />
|
Hit Points: {{currenthp}} / {{maxhp}}<br>
|
||||||
Magic Points: {{currentmp}} / {{maxmp}}<br />
|
Magic Points: {{currentmp}} / {{maxmp}}<br>
|
||||||
Travel Points: {{currenttp}} / {{maxtp}}<br /><br />
|
Travel Points: {{currenttp}} / {{maxtp}}<br><br>
|
||||||
|
|
||||||
Strength: {{strength}}<br />
|
Strength: {{strength}}<br>
|
||||||
Dexterity: {{dexterity}}<br />
|
Dexterity: {{dexterity}}<br>
|
||||||
Attack Power: {{attackpower}}<br />
|
Attack Power: {{attackpower}}<br>
|
||||||
Defense Power: {{defensepower}}<br />
|
Defense Power: {{defensepower}}<br>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</table><br />
|
</table><br>
|
||||||
|
|
||||||
<table width="200">
|
<table width="200">
|
||||||
<tr><td class="title"><img src="images/button_inventory.gif" alt="Inventory" title="Inventory" /></td></tr>
|
<tr><td class="title"><img src="images/button_inventory.gif" alt="Inventory" title="Inventory" /></td></tr>
|
||||||
<tr><td>
|
<tr><td>
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr><td><img src="images/icon_weapon.gif" alt="Weapon" title="Weapon" /></td><td width="100%">Weapon: {{weaponname}}</td></tr>
|
<tr><td><img src="images/icon_weapon.gif" alt="Weapon" title="Weapon" /></td><td width="100%">Weapon: {{weaponname}}</td></tr>
|
||||||
<tr><td><img src="images/icon_armor.gif" alt="Armor" title="Armor" /></td><td width="100%">Armor: {{armorname}}</td></tr>
|
<tr><td><img src="images/icon_armor.gif" alt="Armor" title="Armor" /></td><td width="100%">Armor: {{armorname}}</td></tr>
|
||||||
<tr><td><img src="images/icon_shield.gif" alt="Shield" title="Shield" /></td><td width="100%">Shield: {{shieldname}}</td></tr>
|
<tr><td><img src="images/icon_shield.gif" alt="Shield" title="Shield" /></td><td width="100%">Shield: {{shieldname}}</td></tr>
|
||||||
</table>
|
</table>
|
||||||
Slot 1: {{slot1name}}<br />
|
Slot 1: {{slot1name}}<br>
|
||||||
Slot 2: {{slot2name}}<br />
|
Slot 2: {{slot2name}}<br>
|
||||||
Slot 3: {{slot3name}}
|
Slot 3: {{slot3name}}
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</table><br />
|
</table><br>
|
||||||
THEVERYENDOFYOU;
|
HTML;
|
||||||
?>
|
|
||||||
|
|
|
@ -80,11 +80,11 @@ winpops=window.open(popurl,"","width=520,height=520,scrollbars")
|
||||||
<td class="middle">{{content}}</td>
|
<td class="middle">{{content}}</td>
|
||||||
<td class="right">{{rightnav}}</td>
|
<td class="right">{{rightnav}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table><br />
|
</table><br>
|
||||||
<table class="copyright" width="90%"><tr>
|
<table class="copyright" width="90%"><tr>
|
||||||
<td width="25%" align="center">Powered by <a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight</a></td><td width="25%" align="center">© 2003-2006 by renderse7en</td><td width="25%" align="center">{{totaltime}} Seconds, {{numqueries}} Queries</td><td width="25%" align="center">Version {{version}} {{build}}</td>
|
<td width="25%" align="center">Powered by <a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight</a></td><td width="25%" align="center">© 2003-2006 by renderse7en</td><td width="25%" align="center">{{totaltime}} Seconds, {{numqueries}} Queries</td><td width="25%" align="center">Version {{version}} {{build}}</td>
|
||||||
</tr></table>
|
</tr></table>
|
||||||
</center></body>
|
</center></body>
|
||||||
</html>
|
</html>
|
||||||
THEVERYENDOFYOU;
|
THEVERYENDOFYOU;
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -2,17 +2,15 @@
|
||||||
$template = <<<THEVERYENDOFYOU
|
$template = <<<THEVERYENDOFYOU
|
||||||
<form action="users.php?do=register" method="post">
|
<form action="users.php?do=register" method="post">
|
||||||
<table width="80%">
|
<table width="80%">
|
||||||
<tr><td width="20%">Username:</td><td><input type="text" name="username" size="30" maxlength="30" /><br />Usernames must be 30 alphanumeric characters or less.<br /><br /><br /></td></tr>
|
<tr><td width="20%">Username:</td><td><input type="text" name="username" size="30" maxlength="30" /><br>Usernames must be 30 alphanumeric characters or less.<br><br><br></td></tr>
|
||||||
<tr><td>Password:</td><td><input type="password" name="password1" size="30" maxlength="10" /></td></tr>
|
<tr><td>Password:</td><td><input type="password" name="password1" size="30" maxlength="10" /></td></tr>
|
||||||
<tr><td>Verify Password:</td><td><input type="password" name="password2" size="30" maxlength="10" /><br />Passwords must be 10 alphanumeric characters or less.<br /><br /><br /></td></tr>
|
<tr><td>Verify Password:</td><td><input type="password" name="password2" size="30" maxlength="10" /><br>Passwords must be 10 alphanumeric characters or less.<br><br><br></td></tr>
|
||||||
<tr><td>Email Address:</td><td><input type="text" name="email1" size="30" maxlength="100" /></td></tr>
|
<tr><td>Email Address:</td><td><input type="text" name="email1" size="30" maxlength="100" /></td></tr>
|
||||||
<tr><td>Verify Email:</td><td><input type="text" name="email2" size="30" maxlength="100" />{{verifytext}}<br /><br /><br /></td></tr>
|
<tr><td>Verify Email:</td><td><input type="text" name="email2" size="30" maxlength="100" />{{verifytext}}<br><br><br></td></tr>
|
||||||
<tr><td>Character Name:</td><td><input type="text" name="charname" size="30" maxlength="30" /></td></tr>
|
|
||||||
<tr><td>Character Class:</td><td><select name="charclass"><option value="1">{{class1name}}</option><option value="2">{{class2name}}</option><option value="3">{{class3name}}</option></select></td></tr>
|
<tr><td>Character Class:</td><td><select name="charclass"><option value="1">{{class1name}}</option><option value="2">{{class2name}}</option><option value="3">{{class3name}}</option></select></td></tr>
|
||||||
<tr><td>Difficulty:</td><td><select name="difficulty"><option value="1">{{diff1name}}</option><option value="2">{{diff2name}}</option><option value="3">{{diff3name}}</option></select></td></tr>
|
<tr><td colspan="2">See <a href="help.php">Help</a> for more information about character classes.<br><br></td></tr>
|
||||||
<tr><td colspan="2">See <a href="help.php">Help</a> for more information about character classes and difficulty levels.<br /><br /></td></tr>
|
|
||||||
<tr><td colspan="2"><input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" /></td></tr>
|
<tr><td colspan="2"><input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" /></td></tr>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
THEVERYENDOFYOU;
|
THEVERYENDOFYOU;
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -3,17 +3,17 @@ $template = <<<THEVERYENDOFYOU
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr><td class="title"><img src="images/button_character.gif" alt="Character" title="Character" /></td></tr>
|
<tr><td class="title"><img src="images/button_character.gif" alt="Character" title="Character" /></td></tr>
|
||||||
<tr><td>
|
<tr><td>
|
||||||
<b>{{charname}}</b><br />
|
<b>{{username}}</b><br>
|
||||||
Level: {{level}}<br />
|
Level: {{level}}<br>
|
||||||
Exp: {{experience}}<br />
|
Exp: {{experience}}<br>
|
||||||
Gold: {{gold}}<br />
|
Gold: {{gold}}<br>
|
||||||
HP: {{currenthp}}<br />
|
HP: {{currenthp}}<br>
|
||||||
MP: {{currentmp}}<br />
|
MP: {{currentmp}}<br>
|
||||||
TP: {{currenttp}}<br />
|
TP: {{currenttp}}<br>
|
||||||
{{statbars}}<br />
|
{{statbars}}<br>
|
||||||
<a href="javascript:opencharpopup()">Extended Stats</a>
|
<a href="javascript:opencharpopup()">Extended Stats</a>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</table><br />
|
</table><br>
|
||||||
|
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr><td class="title"><img src="images/button_inventory.gif" alt="Inventory" title="Inventory" /></td></tr>
|
<tr><td class="title"><img src="images/button_inventory.gif" alt="Inventory" title="Inventory" /></td></tr>
|
||||||
|
@ -23,17 +23,17 @@ TP: {{currenttp}}<br />
|
||||||
<tr><td><img src="images/icon_armor.gif" alt="Armor" title="Armor" /></td><td width="100%">Armor: {{armorname}}</td></tr>
|
<tr><td><img src="images/icon_armor.gif" alt="Armor" title="Armor" /></td><td width="100%">Armor: {{armorname}}</td></tr>
|
||||||
<tr><td><img src="images/icon_shield.gif" alt="Shield" title="Shield" /></td><td width="100%">Shield: {{shieldname}}</td></tr>
|
<tr><td><img src="images/icon_shield.gif" alt="Shield" title="Shield" /></td><td width="100%">Shield: {{shieldname}}</td></tr>
|
||||||
</table>
|
</table>
|
||||||
Slot 1: {{slot1name}}<br />
|
Slot 1: {{slot1name}}<br>
|
||||||
Slot 2: {{slot2name}}<br />
|
Slot 2: {{slot2name}}<br>
|
||||||
Slot 3: {{slot3name}}
|
Slot 3: {{slot3name}}
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</table><br />
|
</table><br>
|
||||||
|
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr><td class="title"><img src="images/button_fastspells.gif" alt="Fast Spells" title="Fast Spells" /></td></tr>
|
<tr><td class="title"><img src="images/button_fastspells.gif" alt="Fast Spells" title="Fast Spells" /></td></tr>
|
||||||
<tr><td>
|
<tr><td>
|
||||||
{{magiclist}}
|
{{magiclist}}
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</table><br />
|
</table><br>
|
||||||
THEVERYENDOFYOU;
|
THEVERYENDOFYOU;
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -3,25 +3,24 @@ $template = <<<THEVERYENDOFYOU
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr><td class="title"><img src="images/button_character.gif" alt="Character" title="Character" /></td></tr>
|
<tr><td class="title"><img src="images/button_character.gif" alt="Character" title="Character" /></td></tr>
|
||||||
<tr><td>
|
<tr><td>
|
||||||
<b>{{charname}}</b><br /><br />
|
<b>{{username}}</b><br><br>
|
||||||
|
|
||||||
Difficulty: {{difficulty}}<br />
|
Class: {{charclass}}<br><br>
|
||||||
Class: {{charclass}}<br /><br />
|
|
||||||
|
|
||||||
Level: {{level}}<br />
|
Level: {{level}}<br>
|
||||||
Experience: {{experience}} {{plusexp}}<br />
|
Experience: {{experience}} {{plusexp}}<br>
|
||||||
Next Level: {{nextlevel}}<br />
|
Next Level: {{nextlevel}}<br>
|
||||||
Gold: {{gold}} {{plusgold}}<br />
|
Gold: {{gold}} {{plusgold}}<br>
|
||||||
Hit Points: {{currenthp}} / {{maxhp}}<br />
|
Hit Points: {{currenthp}} / {{maxhp}}<br>
|
||||||
Magic Points: {{currentmp}} / {{maxmp}}<br />
|
Magic Points: {{currentmp}} / {{maxmp}}<br>
|
||||||
Travel Points: {{currenttp}} / {{maxtp}}<br /><br />
|
Travel Points: {{currenttp}} / {{maxtp}}<br><br>
|
||||||
|
|
||||||
Strength: {{strength}}<br />
|
Strength: {{strength}}<br>
|
||||||
Dexterity: {{dexterity}}<br />
|
Dexterity: {{dexterity}}<br>
|
||||||
Attack Power: {{attackpower}}<br />
|
Attack Power: {{attackpower}}<br>
|
||||||
Defense Power: {{defensepower}}<br />
|
Defense Power: {{defensepower}}<br>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</table><br />
|
</table><br>
|
||||||
|
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr><td class="title"><img src="images/button_inventory.gif" alt="Inventory" title="Inventory" /></td></tr>
|
<tr><td class="title"><img src="images/button_inventory.gif" alt="Inventory" title="Inventory" /></td></tr>
|
||||||
|
@ -31,17 +30,17 @@ Defense Power: {{defensepower}}<br />
|
||||||
<tr><td><img src="images/icon_armor.gif" alt="Armor" title="Armor" /></td><td width="100%">Armor: {{armorname}}</td></tr>
|
<tr><td><img src="images/icon_armor.gif" alt="Armor" title="Armor" /></td><td width="100%">Armor: {{armorname}}</td></tr>
|
||||||
<tr><td><img src="images/icon_shield.gif" alt="Shield" title="Shield" /></td><td width="100%">Shield: {{shieldname}}</td></tr>
|
<tr><td><img src="images/icon_shield.gif" alt="Shield" title="Shield" /></td><td width="100%">Shield: {{shieldname}}</td></tr>
|
||||||
</table>
|
</table>
|
||||||
Slot 1: {{slot1name}}<br />
|
Slot 1: {{slot1name}}<br>
|
||||||
Slot 2: {{slot2name}}<br />
|
Slot 2: {{slot2name}}<br>
|
||||||
Slot 3: {{slot3name}}
|
Slot 3: {{slot3name}}
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</table><br />
|
</table><br>
|
||||||
|
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr><td class="title"><img src="images/button_spells.gif" alt="Spells" title="Spells" /></td></tr>
|
<tr><td class="title"><img src="images/button_spells.gif" alt="Spells" title="Spells" /></td></tr>
|
||||||
<tr><td>
|
<tr><td>
|
||||||
{{magiclist}}
|
{{magiclist}}
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</table><br />
|
</table><br>
|
||||||
THEVERYENDOFYOU;
|
THEVERYENDOFYOU;
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -3,7 +3,7 @@ $template = <<<THEVERYENDOFYOU
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr><td class="title"><img src="images/town_{{id}}.gif" alt="Welcome to {{name}}" title="Welcome to {{name}}" /></td></tr>
|
<tr><td class="title"><img src="images/town_{{id}}.gif" alt="Welcome to {{name}}" title="Welcome to {{name}}" /></td></tr>
|
||||||
<tr><td>
|
<tr><td>
|
||||||
<b>Town Options:</b><br />
|
<b>Town Options:</b><br>
|
||||||
<ul>
|
<ul>
|
||||||
<li /><a href="index.php?do=inn">Rest at the Inn</a>
|
<li /><a href="index.php?do=inn">Rest at the Inn</a>
|
||||||
<li /><a href="index.php?do=buy">Buy Weapons/Armor</a>
|
<li /><a href="index.php?do=buy">Buy Weapons/Armor</a>
|
||||||
|
@ -12,7 +12,7 @@ $template = <<<THEVERYENDOFYOU
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr><td><center>
|
<tr><td><center>
|
||||||
{{news}}
|
{{news}}
|
||||||
<br />
|
<br>
|
||||||
<table width="95%">
|
<table width="95%">
|
||||||
<tr><td width="50%">
|
<tr><td width="50%">
|
||||||
{{whosonline}}
|
{{whosonline}}
|
||||||
|
@ -23,4 +23,4 @@ $template = <<<THEVERYENDOFYOU
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</table>
|
</table>
|
||||||
THEVERYENDOFYOU;
|
THEVERYENDOFYOU;
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
$template = <<<THEVERYENDOFYOU
|
|
||||||
<form action="users.php?do=verify" method="post">
|
$template = <<<HTML
|
||||||
<table width="80%">
|
<form action="users.php?do=verify" method="post">
|
||||||
<tr><td colspan="2">Thank you for registering a character. Please enter your username, email address, and the verification code
|
<table width="80%">
|
||||||
that was emailed to you to unlock your character.</td></tr>
|
<tr><td colspan="2">Thank you for registering a character. Please enter your username, email address, and the verification code
|
||||||
<tr><td width="20%">Username:</td><td><input type="text" name="username" size="30" maxlength="30" /></td></tr>
|
that was emailed to you to unlock your character.</td></tr>
|
||||||
<tr><td>Email Address:</td><td><input type="text" name="email" size="30" maxlength="100" /></td></tr>
|
<tr><td width="20%">Username:</td><td><input type="text" name="username" size="30" maxlength="30" /></td></tr>
|
||||||
<tr><td>Verification Code:</td><td><input type="text" name="verify" size="10" maxlength="8" /><br /><br /><br /></td></tr>
|
<tr><td>Email Address:</td><td><input type="text" name="email" size="30" maxlength="100" /></td></tr>
|
||||||
<tr><td colspan="2"><input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" /></td></tr>
|
<tr><td>Verification Code:</td><td><input type="text" name="token" /><br><br><br></td></tr>
|
||||||
</table>
|
<tr><td colspan="2"><input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" /></td></tr>
|
||||||
</form>
|
</table>
|
||||||
THEVERYENDOFYOU;
|
</form>
|
||||||
?>
|
HTML;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user