Beta 4 Build 17
8.09.2006 - Build 17 (Haiku): - Moved stylesheets into .css files. - Added javascript tooltips for the class info when creating a new character. - Changed doquery() format - rewrote all calls to this function to match the new format. - Various changes to the structure of lib.php. - Implemented Anman's increased attack and defense spells (Blessed Strike & Stone Skin). - Fixed class display in profile view. - Began admin control panel. - Various little bitty fixes. - You can no longer gamble 0 gold. - Added new level stat type: life. - Monsters can now do excellent hits, and you can now dodge monsters. - Removed several columns from controlrow that are no longer used.
69
admin/control.php
Normal file
|
@ -0,0 +1,69 @@
|
|||
<?php // control.php :: editing the game's controlrow.
|
||||
|
||||
global $thetab;
|
||||
$thetab = 2;
|
||||
|
||||
function controlrow() {
|
||||
|
||||
global $controlrow;
|
||||
|
||||
if (isset($_POST["submit"])) {
|
||||
|
||||
$numerics = array("avatarmaxsize","showitemimages","botcheck","pvprefresh","pvptimeout","guildstartup","guildstartlvl","guildjoinlvl","guildupdate");
|
||||
$toggles = array("gameopen","showshout","showonline","showmonsterimages","verifyemail","compression","debug");
|
||||
$norequires = array("forumurl");
|
||||
|
||||
// Check errors.
|
||||
$errors = "";
|
||||
foreach($numerics as $a => $b) {
|
||||
if (!is_numeric($_POST[$b])) { $errors .= "$b is a numeric field. Please enter numbers only. Please go back and try again.<br />"; }
|
||||
}
|
||||
foreach($_POST as $a => $b) {
|
||||
if (trim($_POST[$a]) == "" && !in_array($a,$norequires)) { $errors .= "$a is a required field. Please enter a value. Please go back and try again.<br />"; }
|
||||
}
|
||||
if ($errors != "") { err($errors); }
|
||||
|
||||
// Check toggles.
|
||||
foreach($toggles as $a => $b) {
|
||||
if (!isset($_POST[$b])) { $_POST[$b] = "0"; }
|
||||
}
|
||||
|
||||
// Build query.
|
||||
$query = "";
|
||||
$columns = dorow(doquery("SHOW COLUMNS FROM {{table}}", "control"));
|
||||
foreach($columns as $a => $b) {
|
||||
if (isset($_POST[$b["Field"]])) { $query .= $b["Field"] . "='" . $_POST[$b["Field"]] . "',"; }
|
||||
}
|
||||
$query = rtrim($query, ",");
|
||||
|
||||
// Save settings & finish.
|
||||
doquery("UPDATE {{table}} SET $query WHERE id='1' LIMIT 1", "control");
|
||||
display("Main Settings", "The main settings were saved successfully. <br /><br />You may return <a href=\"index.php\">Home</a> or to the <a href=\"index.php?do=control\">Main Settings page</a>.");
|
||||
|
||||
}
|
||||
|
||||
extract($controlrow);
|
||||
|
||||
// Checkboxes.
|
||||
if ($gameopen == 1) { $controlrow["check_gameopen"] = "checked=\"checked\""; } else { $controlrow["check_gameopen"] = ""; }
|
||||
if ($showshout == 1) { $controlrow["check_showshout"] = "checked=\"checked\""; } else { $controlrow["check_showshout"] = ""; }
|
||||
if ($showonline == 1) { $controlrow["check_showonline"] = "checked=\"checked\""; } else { $controlrow["check_showonline"] = ""; }
|
||||
if ($showmonsterimages == 1) { $controlrow["check_showmonsterimages"] = "checked=\"checked\""; } else { $controlrow["check_showmonsterimages"] = ""; }
|
||||
if ($verifyemail == 1) { $controlrow["check_verifyemail"] = "checked=\"checked\""; } else { $controlrow["check_verifyemail"] = ""; }
|
||||
if ($compression == 1) { $controlrow["check_compression"] = "checked=\"checked\""; } else { $controlrow["check_compression"] = ""; }
|
||||
if ($debug == 1) { $controlrow["check_debug"] = "checked=\"checked\""; } else { $controlrow["check_debug"] = ""; }
|
||||
|
||||
// Item image dropdown.
|
||||
$itemimages = array(0=>"Off",1=>"Slot",2=>"ID");
|
||||
$controlrow["select_showitemimages"] = "";
|
||||
foreach($itemimages as $a => $b) {
|
||||
if ($controlrow["showitemimages"] == $a) { $selected = "selected=\"selected=\""; } else { $selected = ""; }
|
||||
$controlrow["select_showitemimages"] .= "<option value=\"$a\" $selected>$b</option>";
|
||||
}
|
||||
|
||||
$page = parsetemplate(gettemplate("control"), $controlrow);
|
||||
display("Main Settings", $page);
|
||||
|
||||
}
|
||||
|
||||
?>
|
31
admin/cookies.php
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php // cookies.php :: Handles cookies. (Mmm, tasty!)
|
||||
|
||||
function checkcookies() {
|
||||
|
||||
include("../config.php");
|
||||
|
||||
$row = false;
|
||||
|
||||
if (isset($_COOKIE["scourge"])) {
|
||||
|
||||
// COOKIE FORMAT:
|
||||
// {ID} {USERNAME} {PASSWORDHASH} {REMEMBERME}
|
||||
$theuser = explode(" ",$_COOKIE["scourge"]);
|
||||
if (!is_numeric($theuser[0])) { err("Invalid cookie data (Error 0). Please clear cookies and log in again."); }
|
||||
$row = dorow(doquery("SELECT * FROM {{table}} WHERE username='$theuser[1]' LIMIT 1", "accounts"));
|
||||
if ($row == false) { err("Invalid cookie data (Error 1). Please clear cookies and log in again."); }
|
||||
if ($row["id"] != $theuser[0]) { err("Invalid cookie data (Error 2). Please clear cookies and log in again."); }
|
||||
if (md5($row["password"] . "--" . $dbsettings["secretword"]) !== $theuser[2]) { err("Invalid cookie data (Error 3). Please clear cookies and log in again."); }
|
||||
|
||||
// If we've gotten this far, cookie should be valid, so write a new one.
|
||||
$newcookie = implode(" ",$theuser);
|
||||
if ($theuser[3] == 1) { $expiretime = time()+31536000; } else { $expiretime = 0; }
|
||||
setcookie ("scourge", $newcookie, $expiretime, "/", "", 0);
|
||||
|
||||
}
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
?>
|
18
admin/globals.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php // globals.php :: Storage for lots of super important arrays we're probably going to need eventually.
|
||||
|
||||
// Config.php.
|
||||
include("../config.php");
|
||||
if (trim($dbsettings["secretword"]) == "") { die("Invalid setting for secretword in config.php. This setting must never be blank."); }
|
||||
|
||||
// Control row.
|
||||
$controlrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control"));
|
||||
|
||||
// Account row.
|
||||
include("cookies.php");
|
||||
$acctrow = checkcookies();
|
||||
if ($acctrow == false) { die(header("Location: " . $controlrow["gameurl"] . "login.php?do=login")); }
|
||||
if ($acctrow["authlevel"] != 255) { die("You do not have access to this area."); }
|
||||
|
||||
$thetab = 1;
|
||||
|
||||
?>
|
BIN
admin/icons/bug.png
Normal file
After Width: | Height: | Size: 774 B |
BIN
admin/icons/cog.png
Normal file
After Width: | Height: | Size: 512 B |
BIN
admin/icons/coins.png
Normal file
After Width: | Height: | Size: 732 B |
BIN
admin/icons/cross.png
Normal file
After Width: | Height: | Size: 655 B |
BIN
admin/icons/delete.png
Normal file
After Width: | Height: | Size: 715 B |
BIN
admin/icons/flag_blue.png
Normal file
After Width: | Height: | Size: 671 B |
BIN
admin/icons/group.png
Normal file
After Width: | Height: | Size: 753 B |
BIN
admin/icons/house.png
Normal file
After Width: | Height: | Size: 806 B |
BIN
admin/icons/lightning.png
Normal file
After Width: | Height: | Size: 634 B |
BIN
admin/icons/pencil.png
Normal file
After Width: | Height: | Size: 450 B |
BIN
admin/icons/tick.png
Normal file
After Width: | Height: | Size: 537 B |
BIN
admin/icons/user.png
Normal file
After Width: | Height: | Size: 741 B |
BIN
admin/icons/world.png
Normal file
After Width: | Height: | Size: 923 B |
BIN
admin/icons/world_add.png
Normal file
After Width: | Height: | Size: 940 B |
BIN
admin/icons/world_delete.png
Normal file
After Width: | Height: | Size: 945 B |
BIN
admin/icons/world_edit.png
Normal file
After Width: | Height: | Size: 945 B |
BIN
admin/icons/wrench.png
Normal file
After Width: | Height: | Size: 610 B |
34
admin/index.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
include("lib.php");
|
||||
include("globals.php");
|
||||
|
||||
if (isset($_GET["do"])) {
|
||||
$do = $_GET["do"];
|
||||
switch ($do) {
|
||||
case "control": include("control.php"); controlrow(); break;
|
||||
case "realms": include("realms.php"); break;
|
||||
default: donothing();
|
||||
}
|
||||
} else { donothing(); }
|
||||
|
||||
function donothing() {
|
||||
|
||||
$accounts = dorow(doquery("SELECT * FROM {{table}}", "accounts"), "id");
|
||||
$pagerow["accounts"] = sizeof($accounts);
|
||||
|
||||
$characters = dorow(doquery("SELECT * FROM {{table}}", "users"), "id");
|
||||
$pagerow["characters"] = sizeof($characters);
|
||||
|
||||
$guildchars = dorow(doquery("SELECT * FROM {{table}} WHERE guild != 0", "users"), "id");
|
||||
$pagerow["guildchars"] = sizeof($guildchars);
|
||||
|
||||
$guilds = dorow(doquery("SELECT * FROM {{table}}", "guilds"), "id");
|
||||
$pagerow["guilds"] = sizeof($guilds);
|
||||
|
||||
$page = parsetemplate(gettemplate("index"), $pagerow);
|
||||
display("Administrator", $page);
|
||||
|
||||
}
|
||||
|
||||
?>
|
254
admin/lib.php
Normal file
|
@ -0,0 +1,254 @@
|
|||
<?php // lib.php :: Common functions used throughout the program.
|
||||
|
||||
// Setup for superglobal stuff that can't go in globals.php.
|
||||
$starttime = getmicrotime();
|
||||
$numqueries = 0;
|
||||
$link = opendb();
|
||||
$version = "Beta 4";
|
||||
$bnumber = "17";
|
||||
$bname = "Haiku";
|
||||
$bdate = "8.09.2006";
|
||||
|
||||
// Handling for servers with magic_quotes turned on.
|
||||
if (get_magic_quotes_gpc()) {
|
||||
|
||||
$_POST = array_map('uber_ss', $_POST);
|
||||
$_GET = array_map('uber_ss', $_GET);
|
||||
$_COOKIE = array_map('uber_ss', $_COOKIE);
|
||||
|
||||
}
|
||||
$_POST = array_map('uber_mres', $_POST);
|
||||
$_POST = array_map('uber_hsc', $_POST);
|
||||
$_GET = array_map('uber_mres', $_GET);
|
||||
$_GET = array_map('uber_hsc', $_GET);
|
||||
$_COOKIE = array_map('uber_mres', $_COOKIE);
|
||||
$_COOKIE = array_map('uber_hsc', $_COOKIE);
|
||||
|
||||
function uber_ss($value) {
|
||||
|
||||
$value = is_array($value) ?
|
||||
array_map('uber_ss', $value) :
|
||||
stripslashes($value);
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
function uber_mres($value) {
|
||||
|
||||
$value = is_array($value) ?
|
||||
array_map('uber_mres', $value) :
|
||||
mysql_real_escape_string($value);
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
function uber_hsc($value) {
|
||||
|
||||
$value = is_array($value) ?
|
||||
array_map('uber_hsc', $value) :
|
||||
htmlspecialchars($value);
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
function opendb() { // Open database connection.
|
||||
|
||||
include("../config.php");
|
||||
extract($dbsettings);
|
||||
$link = mysql_connect($server, $user, $pass) or err(mysql_error(),true);
|
||||
mysql_select_db($name) or err(mysql_error(),true);
|
||||
return $link;
|
||||
|
||||
}
|
||||
|
||||
function doquery($query, $table) { // Something of a tiny little database abstraction layer.
|
||||
|
||||
include("../config.php");
|
||||
global $numqueries;
|
||||
$sqlquery = mysql_query(str_replace("{{table}}", $dbsettings["prefix"] . "_" . $table, $query)) or die(mysql_error() . "<br /><br />$query");
|
||||
$numqueries++;
|
||||
return $sqlquery;
|
||||
|
||||
}
|
||||
|
||||
function dorow($sqlquery, $force = "") { // Abstraction layer part deux.
|
||||
|
||||
switch (mysql_num_rows($sqlquery)) {
|
||||
|
||||
case 0:
|
||||
$row = false;
|
||||
break;
|
||||
case 1:
|
||||
if ($force == "") {
|
||||
$row = mysql_fetch_assoc($sqlquery);
|
||||
} else {
|
||||
$temprow = mysql_fetch_assoc($sqlquery);
|
||||
$row[$temprow[$force]] = $temprow;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if ($force == "") {
|
||||
while ($temprow = mysql_fetch_assoc($sqlquery)) {
|
||||
$row[] = $temprow;
|
||||
}
|
||||
} else {
|
||||
while ($temprow = mysql_fetch_assoc($sqlquery)) {
|
||||
$row[$temprow[$force]] = $temprow;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
function gettemplate($templatename) { // SQL query for the template.
|
||||
|
||||
$filename = "templates/" . $templatename . ".php";
|
||||
include("$filename");
|
||||
return $template;
|
||||
|
||||
}
|
||||
|
||||
function parsetemplate($template, $array) { // Replace template with proper content. Also does languages.
|
||||
|
||||
foreach($array as $a => $b) {
|
||||
$template = str_replace("{{{$a}}}", $b, $template);
|
||||
}
|
||||
return $template;
|
||||
|
||||
}
|
||||
|
||||
function getmicrotime() { // Used for timing script operations.
|
||||
|
||||
list($usec, $sec) = explode(" ",microtime());
|
||||
return ((float)$usec + (float)$sec);
|
||||
|
||||
}
|
||||
|
||||
function is_email($email) { // Thanks to "mail(at)philipp-louis.de" from php.net!
|
||||
|
||||
return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i",$email));
|
||||
|
||||
}
|
||||
|
||||
function mymail($to, $title, $body, $from = '') { // thanks to arto dot PLEASE dot DO dot NOT dot SPAM at artoaaltonen dot fi.
|
||||
|
||||
global $controlrow;
|
||||
extract($controlrow);
|
||||
|
||||
|
||||
$from = trim($from);
|
||||
|
||||
if (!$from) {
|
||||
$from = '<$adminemail>';
|
||||
}
|
||||
|
||||
$rp = $adminemail;
|
||||
$org = '$gameurl';
|
||||
$mailer = 'PHP';
|
||||
|
||||
$head = '';
|
||||
$head .= "Content-Type: text/plain \r\n";
|
||||
$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);
|
||||
$body = str_replace("\n", "\r\n", $body);
|
||||
|
||||
return mail($to, $title, $body, $head);
|
||||
|
||||
}
|
||||
|
||||
function err($error, $system = false, $panels = true) { // Basic little error handler.
|
||||
|
||||
display("Error", $error, $panels);
|
||||
|
||||
}
|
||||
|
||||
function dotabs() {
|
||||
|
||||
global $thetab;
|
||||
|
||||
$tabs = array(
|
||||
1=>"<a href=\"index.php\"><img src=\"icons/house.png\" align=\"top\" alt=\"Home\" /> Home</a>",
|
||||
2=>"<a href=\"index.php?do=control\"><img src=\"icons/cog.png\" align=\"top\" alt=\"Config\" /> Config</a>",
|
||||
3=>"<a href=\"index.php?do=users\"><img src=\"icons/user.png\" align=\"top\" alt=\"Players\" /> Players</a>",
|
||||
4=>"<a href=\"index.php?do=items\"><img src=\"icons/coins.png\" align=\"top\" alt=\"Items\" /> Items</a>",
|
||||
5=>"<a href=\"index.php?do=monsters\"><img src=\"icons/bug.png\" align=\"top\" alt=\"Monsters\" /> Monsters</a>",
|
||||
6=>"<a href=\"index.php?do=spells\"><img src=\"icons/lightning.png\" align=\"top\" alt=\"Spells\" /> Spells</a>",
|
||||
7=>"<a href=\"index.php?do=guilds\"><img src=\"icons/group.png\" align=\"top\" alt=\"Guilds\" /> Guilds</a>",
|
||||
8=>"<a href=\"index.php?do=realms\"><img src=\"icons/world.png\" align=\"top\" alt=\"Realms\" /> Realms</a>",
|
||||
9=>"<a href=\"index.php?do=misc\"><img src=\"icons/flag_blue.png\" align=\"top\" alt=\"Misc.\" /> Misc.</a>",
|
||||
10=>"<a href=\"index.php?do=tools\"><img src=\"icons/wrench.png\" align=\"top\" alt=\"Tools\" /> Tools</a>"
|
||||
);
|
||||
|
||||
$tabstrip = "";
|
||||
foreach ($tabs as $a => $b) {
|
||||
if ($thetab == $a) { $style = "tab_on"; } else { $style = "tab_off"; }
|
||||
$tabstrip .= "<td class=\"$style\">$b</td>";
|
||||
}
|
||||
|
||||
return ($tabstrip);
|
||||
|
||||
}
|
||||
|
||||
function display($title, $content) { // Finalize page and output to browser.
|
||||
|
||||
include('../config.php');
|
||||
global $controlrow, $numqueries, $starttime, $version, $build;
|
||||
|
||||
if (!isset($controlrow)) {
|
||||
$controlrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control"));
|
||||
}
|
||||
|
||||
// Make page tags for XHTML validation.
|
||||
$page = "<?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 .= gettemplate("primary");
|
||||
|
||||
// Setup for primary page array indexes.
|
||||
$row = array();
|
||||
$row["gamename"] = $controlrow["gamename"];
|
||||
$row["pagetitle"] = $title;
|
||||
$row["version"] = $version;
|
||||
$row["numqueries"] = $numqueries;
|
||||
$row["totaltime"] = round(getmicrotime()-$starttime,4);
|
||||
$row["content"] = $content;
|
||||
$row["tabstrip"] = dotabs();
|
||||
|
||||
$page .= <<<THEVERYENDOFYOU
|
||||
<table cellspacing="0" cellpadding="3" style="width: 800px; border: solid 1px black; background-color: white; margin-top: 2px;">
|
||||
<tr>
|
||||
<td width="50%">
|
||||
Version <a href="index.php?do=version">{{version}}</a> / {{numqueries}} Queries / {{totaltime}} Seconds
|
||||
</td>
|
||||
<td width="50%" style="text-align:right;">
|
||||
<a href="http://www.dragonscourge.com">Dragon Scourge</a> © by <a href="http://www.renderse7en.com">renderse7en</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center></body>
|
||||
</html>
|
||||
THEVERYENDOFYOU;
|
||||
|
||||
// Finalize control array for output.
|
||||
$page = parsetemplate($page, $row);
|
||||
|
||||
if ($controlrow["compression"] == 1) { ob_start("ob_gzhandler"); }
|
||||
echo $page;
|
||||
die();
|
||||
|
||||
}
|
||||
|
||||
?>
|
321
admin/realms.php
Normal file
|
@ -0,0 +1,321 @@
|
|||
<?php
|
||||
|
||||
global $thetab;
|
||||
$thetab = 8;
|
||||
|
||||
if (isset($_GET["fn"])) {
|
||||
$fn = $_GET["fn"];
|
||||
switch ($fn) {
|
||||
case "realms": realms(); break;
|
||||
case "towns": towns(); break;
|
||||
case "story": storyline(); break;
|
||||
default: index();
|
||||
}
|
||||
} else { index(); }
|
||||
|
||||
function index() {
|
||||
|
||||
display("Realms", gettemplate("realms_index"));
|
||||
|
||||
}
|
||||
|
||||
function realms() {
|
||||
|
||||
if (isset($_GET["action"])) {
|
||||
$action = $_GET["action"];
|
||||
} else { $action = "list"; }
|
||||
|
||||
if ($action == "list") {
|
||||
|
||||
$realms = dorow(doquery("SELECT * FROM {{table}} ORDER BY id", "worlds"), "id");
|
||||
$alt = false;
|
||||
$pagerow["realmslist"] = "";
|
||||
foreach($realms as $a => $b) {
|
||||
extract($b);
|
||||
if ($alt) { $bg = "class=\"td_alt\""; $alt = false; } else { $bg = ""; $alt = true; }
|
||||
$pagerow["realmslist"] .= "<table cellspacing=\"0\" cellpadding=\"5\" width=\"75%\"><tr><td $bg width=\"75%\"><b>$name</b></td><td $bg><a href=\"index.php?do=realms&fn=realms&action=edit&id=$id\"><img src=\"icons/world_edit.png\" alt=\"Edit\" align=\"top\" /> Edit</a> <a href=\"index.php?do=realms&fn=realms&action=delete&id=$id\"><img src=\"icons/world_delete.png\" alt=\"Delete\" align=\"top\" /> Delete</a></td></tr></table>";
|
||||
}
|
||||
|
||||
display("Realms List", parsetemplate(gettemplate("realms_realms"), $pagerow));
|
||||
|
||||
} elseif ($action == "edit") {
|
||||
|
||||
if (!isset($_GET["id"]) || !is_numeric($_GET["id"])) { err("Invalid Realm ID number entered."); }
|
||||
$id = $_GET["id"];
|
||||
$therealm = dorow(doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "worlds"));
|
||||
if ($therealm == false) { err("The Realm you entered does not exist."); }
|
||||
|
||||
if (isset($_POST["submit"])) {
|
||||
|
||||
// Check numbers.
|
||||
$numerics = array("size");
|
||||
foreach($numerics as $a => $b) { if (!is_numeric($_POST[$b])) { err("The $b field must be a number."); } }
|
||||
|
||||
// Other stuff.
|
||||
if ($_POST["size"] < 0) { $_POST["size"] *= -1; }
|
||||
|
||||
// Update & finish.
|
||||
extract($_POST);
|
||||
$query = doquery("UPDATE {{table}} SET name='$name', size='$size' WHERE id='$id' LIMIT 1", "worlds");
|
||||
display("Edit a Realm", "The Realm was edited successfully. <a href=\"index.php?do=realms&fn=realms\">Click here</a> to return to the Realms List.");
|
||||
|
||||
}
|
||||
|
||||
display("Edit a Realm", parsetemplate(gettemplate("realms_realms_edit"), $therealm));
|
||||
|
||||
} elseif ($action == "new") {
|
||||
|
||||
if (isset($_POST["submit"])) {
|
||||
|
||||
// Check numbers.
|
||||
$numerics = array("size");
|
||||
foreach($numerics as $a => $b) { if (!is_numeric($_POST[$b])) { err("The $b field must be a number."); } }
|
||||
|
||||
// Other stuff.
|
||||
if ($_POST["size"] < 0) { $_POST["size"] *= -1; }
|
||||
|
||||
// Update & finish.
|
||||
extract($_POST);
|
||||
$query = doquery("INSERT INTO {{table}} SET id='', name='$name', size='$size'", "worlds");
|
||||
display("Add a Realm", "The Realm was created successfully. <a href=\"index.php?do=realms&fn=realms\">Click here</a> to return to the Realms List.");
|
||||
|
||||
}
|
||||
|
||||
display("Add a Realm", parsetemplate(gettemplate("realms_realms_add"), $therealm));
|
||||
|
||||
} elseif ($action == "delete") {
|
||||
|
||||
if (!isset($_GET["id"]) || !is_numeric($_GET["id"])) { err("Invalid Realm ID number entered."); }
|
||||
$id = $_GET["id"];
|
||||
$therealm = dorow(doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "worlds"));
|
||||
if ($therealm == false) { err("The Realm you entered does not exist."); }
|
||||
|
||||
if (isset($_POST["diediedie"])) {
|
||||
|
||||
$query = doquery("DELETE FROM {{table}} WHERE id='$id'", "worlds");
|
||||
display("Delete a Realm", "The Realm was deleted successfully. <a href=\"index.php?do=realms&fn=realms\">Click here</a> to return to the Realms List.");
|
||||
|
||||
} elseif (isset($_POST["abort"])) {
|
||||
|
||||
die(header("Location: index.php?do=realms&fn=realms"));
|
||||
|
||||
}
|
||||
|
||||
display("Delete a Realm", parsetemplate(gettemplate("realms_realms_delete"), $therealm));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function towns() {
|
||||
|
||||
if (isset($_GET["action"])) {
|
||||
$action = $_GET["action"];
|
||||
} else { $action = "list"; }
|
||||
|
||||
if ($action == "list") {
|
||||
|
||||
$towns = dorow(doquery("SELECT * FROM {{table}} ORDER BY id", "towns"), "id");
|
||||
$realms = dorow(doquery("SELECT * FROM {{table}} ORDER BY id", "worlds"), "id");
|
||||
$alt = false;
|
||||
$pagerow["townslist"] = "";
|
||||
foreach($towns as $a => $b) {
|
||||
extract($b);
|
||||
if ($alt) { $bg = "class=\"td_alt\""; $alt = false; } else { $bg = ""; $alt = true; }
|
||||
$pagerow["townslist"] .= "<table cellspacing=\"0\" cellpadding=\"5\" width=\"75%\"><tr><td $bg width=\"75%\"><b>$name</b> (".$realms[$b["world"]]["name"].")</td><td $bg><a href=\"index.php?do=realms&fn=towns&action=edit&id=$id\"><img src=\"icons/world_edit.png\" alt=\"Edit\" align=\"top\" /> Edit</a> <a href=\"index.php?do=realms&fn=towns&action=delete&id=$id\"><img src=\"icons/world_delete.png\" alt=\"Delete\" align=\"top\" /> Delete</a></td></tr></table>";
|
||||
}
|
||||
|
||||
display("Towns List", parsetemplate(gettemplate("realms_towns"), $pagerow));
|
||||
|
||||
} elseif ($action == "edit") {
|
||||
|
||||
if (!isset($_GET["id"]) || !is_numeric($_GET["id"])) { err("Invalid Town ID number entered."); }
|
||||
$id = $_GET["id"];
|
||||
$thetown = dorow(doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "towns"));
|
||||
if ($thetown == false) { err("The town you entered does not exist."); }
|
||||
|
||||
if (isset($_POST["submit"])) {
|
||||
|
||||
// Check numbers.
|
||||
$numerics = array("world","latitude","longitude","innprice","mapprice","travelpoints","itemminlvl","itemmaxlvl");
|
||||
foreach($numerics as $a => $b) { if (!is_numeric($_POST[$b])) { err("The $b field must be a number."); } }
|
||||
|
||||
// Update & finish.
|
||||
extract($_POST);
|
||||
$query = doquery("UPDATE {{table}} SET name='$name', world='$world', latitude='$latitude', longitude='$longitude', innprice='$innprice', mapprice='$mapprice', travelpoints='$travelpoints', itemminlvl='$itemminlvl', itemmaxlvl='$itemmaxlvl' WHERE id='$id' LIMIT 1", "towns");
|
||||
display("Edit a Town", "The town was edited successfully. <a href=\"index.php?do=realms&fn=towns\">Click here</a> to return to the Towns List.");
|
||||
|
||||
}
|
||||
|
||||
// Realms list.
|
||||
$realms = dorow(doquery("SELECT * FROM {{table}} ORDER BY id", "worlds"), "id");
|
||||
$thetown["realmselect"] = "";
|
||||
foreach($realms as $a => $b) {
|
||||
if ($thetown["world"] == $b["id"]) { $selected = "selected=\"selected\""; } else { $selected = ""; }
|
||||
$thetown["realmselect"] .= "<option value=\"".$b["id"]."\" $selected>".$b["name"]."</option>";
|
||||
}
|
||||
|
||||
// Realm max size.
|
||||
$thetown["realmsize"] = $realms[$thetown["world"]]["size"];
|
||||
|
||||
// Display.
|
||||
display("Edit a Town", parsetemplate(gettemplate("realms_towns_edit"), $thetown));
|
||||
|
||||
} elseif ($action == "new") {
|
||||
|
||||
if (isset($_POST["submit"])) {
|
||||
|
||||
// Check numbers.
|
||||
$numerics = array("world","latitude","longitude","innprice","mapprice","travelpoints","itemminlvl","itemmaxlvl");
|
||||
foreach($numerics as $a => $b) { if (!is_numeric($_POST[$b])) { err("The $b field must be a number."); } }
|
||||
|
||||
// Update & finish.
|
||||
extract($_POST);
|
||||
$query = doquery("INSERT INTO {{table}} SET id='', name='$name', world='$world', latitude='$latitude', longitude='$longitude', innprice='$innprice', mapprice='$mapprice', travelpoints='$travelpoints', itemminlvl='$itemminlvl', itemmaxlvl='$itemmaxlvl'", "towns");
|
||||
display("Add a Town", "The town was created successfully. <a href=\"index.php?do=realms&fn=towns\">Click here</a> to return to the Towns List.");
|
||||
|
||||
}
|
||||
|
||||
// Realms list.
|
||||
$realms = dorow(doquery("SELECT * FROM {{table}} ORDER BY id", "worlds"), "id");
|
||||
$thetown["realmselect"] = "";
|
||||
foreach($realms as $a => $b) {
|
||||
$thetown["realmselect"] .= "<option value=\"".$b["id"]."\">".$b["name"]."</option>";
|
||||
}
|
||||
|
||||
// Realm max size.
|
||||
$thetown["realmsize"] = $realms[$thetown["world"]]["size"];
|
||||
|
||||
// Display.
|
||||
display("Add a Town", parsetemplate(gettemplate("realms_towns_add"), $thetown));
|
||||
|
||||
} elseif ($action == "delete") {
|
||||
|
||||
if (!isset($_GET["id"]) || !is_numeric($_GET["id"])) { err("Invalid town ID number entered."); }
|
||||
$id = $_GET["id"];
|
||||
$thetown = dorow(doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "towns"));
|
||||
if ($thetown == false) { err("The town you entered does not exist."); }
|
||||
|
||||
if (isset($_POST["diediedie"])) {
|
||||
|
||||
$query = doquery("DELETE FROM {{table}} WHERE id='$id'", "towns");
|
||||
display("Delete a Town", "The town was deleted successfully. <a href=\"index.php?do=realms&fn=towns\">Click here</a> to return to the towns List.");
|
||||
|
||||
} elseif (isset($_POST["abort"])) {
|
||||
|
||||
die(header("Location: index.php?do=realms&fn=towns"));
|
||||
|
||||
}
|
||||
|
||||
display("Delete a Town", parsetemplate(gettemplate("realms_towns_delete"), $thetown));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function storyline() {
|
||||
|
||||
if (isset($_GET["action"])) {
|
||||
$action = $_GET["action"];
|
||||
} else { $action = "list"; }
|
||||
|
||||
if ($action == "list") {
|
||||
|
||||
$story = dorow(doquery("SELECT * FROM {{table}} ORDER BY id", "story"), "id");
|
||||
$alt = false;
|
||||
$pagerow["storylist"] = "";
|
||||
foreach($story as $a => $b) {
|
||||
extract($b);
|
||||
if ($alt) { $bg = "class=\"td_alt\""; $alt = false; } else { $bg = ""; $alt = true; }
|
||||
$pagerow["storylist"] .= "<table cellspacing=\"0\" cellpadding=\"5\" width=\"75%\"><tr><td $bg width=\"75%\"><b>$title</b></td><td $bg><a href=\"index.php?do=realms&fn=story&action=edit&id=$id\"><img src=\"icons/world_edit.png\" alt=\"Edit\" align=\"top\" /> Edit</a> <a href=\"index.php?do=realms&fn=story&action=delete&id=$id\"><img src=\"icons/world_delete.png\" alt=\"Delete\" align=\"top\" /> Delete</a></td></tr></table>";
|
||||
}
|
||||
|
||||
display("Story List", parsetemplate(gettemplate("realms_story"), $pagerow));
|
||||
|
||||
} elseif ($action == "edit") {
|
||||
|
||||
if (!isset($_GET["id"]) || !is_numeric($_GET["id"])) { err("Invalid Town ID number entered."); }
|
||||
$id = $_GET["id"];
|
||||
$thetown = dorow(doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "towns"));
|
||||
if ($thetown == false) { err("The town you entered does not exist."); }
|
||||
|
||||
if (isset($_POST["submit"])) {
|
||||
|
||||
// Check numbers.
|
||||
$numerics = array("world","latitude","longitude","innprice","mapprice","travelpoints","itemminlvl","itemmaxlvl");
|
||||
foreach($numerics as $a => $b) { if (!is_numeric($_POST[$b])) { err("The $b field must be a number."); } }
|
||||
|
||||
// Update & finish.
|
||||
extract($_POST);
|
||||
$query = doquery("UPDATE {{table}} SET name='$name', world='$world', latitude='$latitude', longitude='$longitude', innprice='$innprice', mapprice='$mapprice', travelpoints='$travelpoints', itemminlvl='$itemminlvl', itemmaxlvl='$itemmaxlvl' WHERE id='$id' LIMIT 1", "towns");
|
||||
display("Edit a Town", "The town was edited successfully. <a href=\"index.php?do=realms&fn=towns\">Click here</a> to return to the Towns List.");
|
||||
|
||||
}
|
||||
|
||||
// Realms list.
|
||||
$realms = dorow(doquery("SELECT * FROM {{table}} ORDER BY id", "worlds"), "id");
|
||||
$thetown["realmselect"] = "";
|
||||
foreach($realms as $a => $b) {
|
||||
if ($thetown["world"] == $b["id"]) { $selected = "selected=\"selected\""; } else { $selected = ""; }
|
||||
$thetown["realmselect"] .= "<option value=\"".$b["id"]."\" $selected>".$b["name"]."</option>";
|
||||
}
|
||||
|
||||
// Realm max size.
|
||||
$thetown["realmsize"] = $realms[$thetown["world"]]["size"];
|
||||
|
||||
// Display.
|
||||
display("Edit a Town", parsetemplate(gettemplate("realms_towns_edit"), $thetown));
|
||||
|
||||
} elseif ($action == "new") {
|
||||
|
||||
if (isset($_POST["submit"])) {
|
||||
|
||||
// Check numbers.
|
||||
$numerics = array("world","latitude","longitude","innprice","mapprice","travelpoints","itemminlvl","itemmaxlvl");
|
||||
foreach($numerics as $a => $b) { if (!is_numeric($_POST[$b])) { err("The $b field must be a number."); } }
|
||||
|
||||
// Update & finish.
|
||||
extract($_POST);
|
||||
$query = doquery("INSERT INTO {{table}} SET id='', name='$name', world='$world', latitude='$latitude', longitude='$longitude', innprice='$innprice', mapprice='$mapprice', travelpoints='$travelpoints', itemminlvl='$itemminlvl', itemmaxlvl='$itemmaxlvl'", "towns");
|
||||
display("Add a Town", "The town was created successfully. <a href=\"index.php?do=realms&fn=towns\">Click here</a> to return to the Towns List.");
|
||||
|
||||
}
|
||||
|
||||
// Realms list.
|
||||
$realms = dorow(doquery("SELECT * FROM {{table}} ORDER BY id", "worlds"), "id");
|
||||
$thetown["realmselect"] = "";
|
||||
foreach($realms as $a => $b) {
|
||||
$thetown["realmselect"] .= "<option value=\"".$b["id"]."\">".$b["name"]."</option>";
|
||||
}
|
||||
|
||||
// Realm max size.
|
||||
$thetown["realmsize"] = $realms[$thetown["world"]]["size"];
|
||||
|
||||
// Display.
|
||||
display("Add a Town", parsetemplate(gettemplate("realms_towns_add"), $thetown));
|
||||
|
||||
} elseif ($action == "delete") {
|
||||
|
||||
if (!isset($_GET["id"]) || !is_numeric($_GET["id"])) { err("Invalid town ID number entered."); }
|
||||
$id = $_GET["id"];
|
||||
$thetown = dorow(doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "towns"));
|
||||
if ($thetown == false) { err("The town you entered does not exist."); }
|
||||
|
||||
if (isset($_POST["diediedie"])) {
|
||||
|
||||
$query = doquery("DELETE FROM {{table}} WHERE id='$id'", "towns");
|
||||
display("Delete a Town", "The town was deleted successfully. <a href=\"index.php?do=realms&fn=towns\">Click here</a> to return to the towns List.");
|
||||
|
||||
} elseif (isset($_POST["abort"])) {
|
||||
|
||||
die(header("Location: index.php?do=realms&fn=towns"));
|
||||
|
||||
}
|
||||
|
||||
display("Delete a Town", parsetemplate(gettemplate("realms_towns_delete"), $thetown));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
37
admin/templates/control.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
$template = <<<END
|
||||
<h3>Configuration Settings</h3>
|
||||
These are the primary game settings that control various global aspects of your game.<br /><br />
|
||||
<form action="index.php?do=control" method="post">
|
||||
<table cellspacing="0" cellpadding="5" width="98%">
|
||||
<tr><td width="25%">Game Name</td><td><input type="text" name="gamename" size="20" maxlength="50" value="{{gamename}}" /><br /><span class="grey">The name of your game. Used in page titles and when sending email to new users.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%" class="td_alt">Game is Open?</td><td class="td_alt"><input type="checkbox" name="gameopen" value="1" {{check_gameopen}} /> Yes<br /><span class="grey">Should normally be left on, but you should turn off your game while performing any updates.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%">Game Path</td><td><input type="text" name="gamepath" size="40" maxlength="200" value="{{gamepath}}" /><br /><span class="grey">The full server path to your game. If you don't know this, please ask your host for assistance.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%" class="td_alt">Game URL</td><td class="td_alt"><input type="text" name="gameurl" size="40" maxlength="200" value="{{gameurl}}" /><br /><span class="grey">The full URL to your game.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%">Forum URL</td><td><input type="text" name="forumurl" size="40" maxlength="200" value="{{forumurl}}" /><br /><span class="grey">If you have a support forum for your game, enter its URL here - otherwise leave blank to disable this link.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%" class="td_alt">Avatar Path</td><td class="td_alt"><input type="text" name="avatarpath" size="40" maxlength="200" value="{{avatarpath}}" /><br /><span class="grey">The full server path to your avatar uploads folder.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%">Avatar URL</td><td><input type="text" name="avatarurl" size="40" maxlength="200" value="{{avatarurl}}" /><br /><span class="grey">The full URL to your avatar uploads folder.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%" class="td_alt">Avatar Max Filesize</td><td class="td_alt"><input type="text" name="avatarmaxsize" size="10" maxlength="10" value="{{avatarmaxsize}}" /><br /><span class="grey">Enter the maximum file size (in bytes) for uploaded avatars.<br />Range: 0 to 4294967295.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%">Show Babblebox?</td><td><input type="checkbox" name="showshout" value="1" {{check_showshout}} /> Yes<br /><span class="grey">Enables the Babblebox iframe in the right panel.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%" class="td_alt">Show Who's Online?</td><td class="td_alt"><input type="checkbox" name="showonline" value="1" {{check_showonline}} /> Yes<br /><span class="grey">Enables the Who's Online listing in the right panel.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%">Show Item Images?</td><td><select name="showitemimages">{{select_showitemimages}}</select><br /><span class="grey"><b>Slot</b> images use one image for all items in a given slot (e.g. weapons, shields, armor, etc.). <b>ID</b> images use an individual image for every item, based on the item's ID number.<br /><b>Only enable ID images if your /images/items/ folder contains an image for every item in the database, or else you'll get a lot of broken image tags.</b></span><br /><br /></td></tr>
|
||||
<tr><td width="25%" class="td_alt">Show Monster Images?</td><td class="td_alt"><input type="checkbox" name="showmonsterimages" value="1" {{check_showmonsterimages}} /> Yes<br /><span class="grey"><b>Only enable monster images if your /images/monsters/ folder contains an image for every monster in the database, or else you'll get a lot of broken image tags.</b></span><br /><br /></td></tr>
|
||||
<tr><td width="25%">Admin's Email</td><td><input type="text" name="adminemail" size="20" maxlength="200" value="{{adminemail}}" /><br /><span class="grey">This is the game owner's email address, used when sending email to new users.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%" class="td_alt">Enable Email Functions?</td><td class="td_alt"><input type="checkbox" name="verifyemail" value="1" {{check_verifyemail}} /> Yes<br /><span class="grey">Sends a verification letter to anyone who registers an account, to enforce valid email addresses. Also allows users to request new passwords if they lose/forget theirs.<br /><b>NOTE:</b> Some Windows servers may have issues if their php.ini settings are improperly configured. If you're on a Windows host and get a lot of email sending errors, disable this setting or contact your host for more information.</b></span><br /><br /></td></tr>
|
||||
<tr><td width="25%">Enable ZLib Compression?</td><td><input type="checkbox" name="compression" value="1" {{check_compression}} /> Yes<br /><span class="grey">Enables ZLib output compression, which reduces bandwidth and speeds up page access time for end-users.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%" class="td_alt">Enable Debug Info?</td><td class="td_alt"><input type="checkbox" name="debug" value="1" {{check_debug}} /> Yes<br /><span class="grey">Displays extra information (query count & page generation time) in the footer, and displays full MySQL query errors if they occur.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%">Bot Check</td><td><input type="text" name="botcheck" size="10" maxlength="10" value="{{botcheck}}" /><br /><span class="grey">Bot Check ensures that players are human by displaying a CAPTCHA challenge form every so often (random 1 in <i>n</i> chance) during exploring. Higher numbers show the Bot Check less often, but may not be as secure. Lower numbers will show the bot check more often, but may annoy some users. Enter 0 to disable the bot check completely.<br />Range: 0 to 4294967295.<br />Recommended: 255.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%" class="td_alt">PVP Refresh Time</td><td class="td_alt"><input type="text" name="pvprefresh" size="10" maxlength="10" value="{{pvprefresh}}" /><br /><span class="grey">The amount of time (in seconds) the mini PVP frame should wait before refreshing itself to check for new data. Low numbers may cause strain on your server if you have a lot of concurrent users.<br />Range: 0 to 4294967295.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%">PVP Timeout Limit</td><td><input type="text" name="pvptimeout" size="10" maxlength="10" value="{{pvptimeout}}" /><br /><span class="grey">The amount of time (in seconds) it takes for someone to remain inactive and cause the PVP battle to close.<br />Range: 0 to 4294967295.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%" class="td_alt">Guild Startup Cost</td><td class="td_alt"><input type="text" name="guildstartup" size="10" maxlength="10" value="{{guildstartup}}" /><br /><span class="grey">The amount of gold it takes for a player to start their own Guild.<br />Range: 0 to 4294967295.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%">Guild Start Level</td><td><input type="text" name="guildstartlvl" size="10" maxlength="10" value="{{guildstartlvl}}" /><br /><span class="grey">The minimum level a player must reach before being allowed to start a Guild.<br />Range: 0 to 4294967295.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%" class="td_alt">Guild Join Level</td><td class="td_alt"><input type="text" name="guildjoinlvl" size="10" maxlength="10" value="{{guildjoinlvl}}" /><br /><span class="grey">The minimum level a player must reach before being allowed to join a Guild.<br />Range: 0 to 4294967295.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%">Guild Update Time</td><td><input type="text" name="guildupdate" size="10" maxlength="10" value="{{guildupdate}}" /><br /><span class="grey">The amount of time (in hours) before automatically recalculating Guild Honor Points.<br />Range: 0 to 4294967295.</span><br /><br /></td></tr>
|
||||
<tr><td colspan="2" style="border-top: solid 2px black;"><center>
|
||||
<button type="submit" name="submit"><img src="icons/tick.png" align="top" /> Save</button> <button type="reset"><img src="icons/cross.png" align="top" /> Reset</button>
|
||||
</center></td></tr>
|
||||
</table>
|
||||
END;
|
||||
|
||||
?>
|
12
admin/templates/index.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
$template = <<<END
|
||||
<h3>Welcome to the Dragon Scourge Administrator.</h3>
|
||||
Please select a tab above to control various settings and attributes for your game.<br /><br />
|
||||
Your game has {{accounts}} accounts with {{characters}} active characters. {{guildchars}} are members of {{guilds}} Guilds.<br /><br />
|
||||
|
||||
<a href="../index.php">Click here</a> to return to your game.<br /><br /><br />
|
||||
<span class="grey">The awesome Silk icons, used throughout the control panel, were created by <a href="http://www.famfamfam.com/lab/icons/silk/" target="_new">FamFamFam.com</a>.</span>
|
||||
END;
|
||||
|
||||
?>
|
41
admin/templates/primary.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
$template = <<<END
|
||||
<head>
|
||||
<title>{{gamename}} :: {{pagetitle}}</title>
|
||||
<style type="text/css">
|
||||
body { font: 10px Verdana; background-image: url(../images/background1.jpg); padding: 0px; }
|
||||
table { font: 10px Verdana; }
|
||||
td { vertical-align: top; }
|
||||
input { font: 10px Verdana; }
|
||||
select { font: 10px Verdana; }
|
||||
img { border-style: none; }
|
||||
a { color: #996600; text-decoration: none; font-weight: bold; }
|
||||
a:hover { color: #663300; }
|
||||
.main { border: solid 1px black; }
|
||||
.grey { color: #888888; }
|
||||
.red { color: #ff0000; }
|
||||
.blue { color: #0000ff; }
|
||||
.big { font: 11px Verdana; background-color: #dddddd; border: solid 1px #aaaaaa; padding: 2px; margin-bottom: 3px; }
|
||||
.babble1 { background-color: #eeeeee; font: 10px Verdana; margin: 0px; padding: 2px; }
|
||||
.babble2 { background-color: #ffffff; font: 10px Verdana; margin: 0px; padding: 2px; }
|
||||
.tab_on { background-color: #ffffff; border: solid 1px black; border-bottom: none; padding: 5px; text-align: center; margin: 0px 2px; }
|
||||
.tab_off { background-color: #eeeeee; border: solid 1px black; padding: 5px; text-align: center; }
|
||||
.td_alt { background-color: #f0f0f0; }
|
||||
</style>
|
||||
</head>
|
||||
<body><center>
|
||||
|
||||
<table cellspacing="0" cellpadding="3" style="width: 800px;">
|
||||
<tr>
|
||||
{{tabstrip}}
|
||||
</tr>
|
||||
</table>
|
||||
<table cellspacing="0" cellpadding="3" style="width: 800px; height: 570px; border: solid 1px black; border-top: none; background-color: white; ">
|
||||
<tr><td style="padding: 10px;">
|
||||
{{content}}
|
||||
</td></tr>
|
||||
</table>
|
||||
END;
|
||||
|
||||
?>
|
9
admin/templates/realms_index.php
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
$template = <<<END
|
||||
<h3>Realms</h3>
|
||||
Please select which aspect of the Realms you wish to edit.<br /><br />
|
||||
[ <a href="index.php?do=realms&fn=realms">Realms</a> | <a href="index.php?do=realms&fn=towns">Towns</a> | <a href="index.php?do=realms&fn=story">Storyline</a> ]
|
||||
END;
|
||||
|
||||
?>
|
9
admin/templates/realms_realms.php
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
$template = <<<END
|
||||
<h3>Realms List</h3>
|
||||
Select a Realm from the list below to edit or delete it. You can also <a href="index.php?do=realms&fn=realms&action=new"><img src="icons/world_add.png" alt="Add" align="top" /> add a new Realm</a>.<br /><br />
|
||||
{{realmslist}}
|
||||
END;
|
||||
|
||||
?>
|
16
admin/templates/realms_realms_add.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
$template = <<<END
|
||||
<h3>Add a Realm</h3>
|
||||
<a href="index.php?do=realms&fn=realms">Back to Realms List</a><br /><br />
|
||||
<form action="index.php?do=realms&fn=realms&action=new" method="post">
|
||||
<table cellspacing="0" cellpadding="5" width="98%">
|
||||
<tr><td width="25%">Realm Name</td><td><input type="text" name="name" size="20" maxlength="30" /><br /><span class="grey">The name of this Realm.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%" class="td_alt">Realm Size</td><td class="td_alt"><input type="text" name="size" size="5" maxlength="5" /><br /><span class="grey">Realms are divided into four square quadrants. This number is the length/width of each individual quadrant.<br />Range: 0 to 65535.</span><br /><br /></td></tr>
|
||||
<tr><td colspan="2" style="border-top: solid 2px black;"><center>
|
||||
<button type="submit" name="submit"><img src="icons/tick.png" align="top" /> Save</button> <button type="reset"><img src="icons/cross.png" align="top" /> Reset</button>
|
||||
</center></td></tr>
|
||||
</table>
|
||||
END;
|
||||
|
||||
?>
|
17
admin/templates/realms_realms_delete.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
$template = <<<END
|
||||
<h3>Delete a Realm</h3>
|
||||
<a href="index.php?do=realms&fn=realms">Back to Realms List</a><br /><br />
|
||||
<form action="index.php?do=realms&fn=realms&action=delete&id={{id}}" method="post">
|
||||
<table cellspacing="0" cellpadding="5">
|
||||
<tr><td colspan="2" style="border-top: solid 2px black;"><center>
|
||||
Are you sure you want to delete {{name}}?
|
||||
</center></td></tr>
|
||||
<tr><td colspan="2" style="border-top: solid 2px black;"><center>
|
||||
<button type="submit" name="diediedie"><img src="icons/tick.png" align="top" /> Yes</button> <button type="submit" name="abort"><img src="icons/cross.png" align="top" /> No</button>
|
||||
</center></td></tr>
|
||||
</table>
|
||||
END;
|
||||
|
||||
?>
|
16
admin/templates/realms_realms_edit.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
$template = <<<END
|
||||
<h3>Edit a Realm</h3>
|
||||
<a href="index.php?do=realms&fn=realms">Back to Realms List</a><br /><br />
|
||||
<form action="index.php?do=realms&fn=realms&action=edit&id={{id}}" method="post">
|
||||
<table cellspacing="0" cellpadding="5" width="98%">
|
||||
<tr><td width="25%">Realm Name</td><td><input type="text" name="name" size="20" maxlength="30" value="{{name}}" /><br /><span class="grey">The name of this Realm.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%" class="td_alt">Realm Size</td><td class="td_alt"><input type="text" name="size" size="5" maxlength="5" value="{{size}}" /><br /><span class="grey">Realms are divided into four square quadrants. This number is the length/width of each individual quadrant. Range: 0 to 65535.</span><br /><br /></td></tr>
|
||||
<tr><td colspan="2" style="border-top: solid 2px black;"><center>
|
||||
<button type="submit" name="submit"><img src="icons/tick.png" align="top" /> Save</button> <button type="reset"><img src="icons/cross.png" align="top" /> Reset</button>
|
||||
</center></td></tr>
|
||||
</table>
|
||||
END;
|
||||
|
||||
?>
|
9
admin/templates/realms_story.php
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
$template = <<<END
|
||||
<h3>Story List</h3>
|
||||
Select a Chapter from the list below to edit or delete it. You can also <a href="index.php?do=realms&fn=story&action=new"><img src="icons/world_add.png" alt="Add" align="top" /> add a new Chapter</a>.<br /><br />
|
||||
{{storylist}}
|
||||
END;
|
||||
|
||||
?>
|
9
admin/templates/realms_towns.php
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
$template = <<<END
|
||||
<h3>Towns List</h3>
|
||||
Select a Town from the list below to edit or delete it. You can also <a href="index.php?do=realms&fn=towns&action=new"><img src="icons/world_add.png" alt="Add" align="top" /> add a new Town</a>.<br /><br />
|
||||
{{townslist}}
|
||||
END;
|
||||
|
||||
?>
|
23
admin/templates/realms_towns_add.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
$template = <<<END
|
||||
<h3>Add a Town</h3>
|
||||
<a href="index.php?do=realms&fn=towns">Back to Towns List</a><br /><br />
|
||||
<form action="index.php?do=realms&fn=towns&action=new" method="post">
|
||||
<table cellspacing="0" cellpadding="5" width="98%">
|
||||
<tr><td width="25%">Town Name</td><td><input type="text" name="name" size="20" maxlength="30" /><br /><span class="grey">The name of this Town.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%" class="td_alt">Realm</td><td class="td_alt"><select name="world">{{realmselect}}</select><br /><span class="grey">The Realm this Town is a part of.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%">Latitude</td><td><input type="text" name="latitude" size="5" maxlength="6" /><br /><span class="grey">The vertical location of this town on the map.<br />Must be within the map size of the selected Realm.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%" class="td_alt">Longitude</td><td class="td_alt"><input type="text" name="longitude" size="5" maxlength="6" /><br /><span class="grey">The horizontal location of this town on the map.<br />Must be within the map size of the selected Realm.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%">Inn Price</td><td><input type="text" name="innprice" size="5" maxlength="10" /><br /><span class="grey">The cost to stay at this town's Inn.<br />Range: 0 to 4294967295.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%" class="td_alt">Map Price</td><td class="td_alt"><input type="text" name="mapprice" size="5" maxlength="10" /><br /><span class="grey">The cost to buy the map to this town.<br />Range: 0 to 4294967295.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%">TP Price</td><td><input type="text" name="travelpoints" size="5" maxlength="5" /><br /><span class="grey">The travel points to jump to this town.<br />Range: 0 to 65535.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%" class="td_alt">Minimum Item Level</td><td class="td_alt"><input type="text" name="itemminlvl" size="5" maxlength="10" /><br /><span class="grey">The minimum base item level that will be generated in this town.<br />Range: 0 to 4294967295.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%">Maximum Item Level</td><td><input type="text" name="itemmaxlvl" size="5" maxlength="10"/><br /><span class="grey">The maximum base item level that will be generated in this town.<br />Range: 0 to 4294967295.</span><br /><br /></td></tr>
|
||||
<tr><td colspan="2" style="border-top: solid 2px black;"><center>
|
||||
<button type="submit" name="submit"><img src="icons/tick.png" align="top" /> Save</button> <button type="reset"><img src="icons/cross.png" align="top" /> Reset</button>
|
||||
</td></tr>
|
||||
</table>
|
||||
END;
|
||||
|
||||
?>
|
17
admin/templates/realms_towns_delete.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
$template = <<<END
|
||||
<h3>Delete a Town</h3>
|
||||
<a href="index.php?do=realms&fn=town">Back to Towns List</a><br /><br />
|
||||
<form action="index.php?do=realms&fn=towns&action=delete&id={{id}}" method="post">
|
||||
<table cellspacing="0" cellpadding="5">
|
||||
<tr><td colspan="2" style="border-top: solid 2px black;"><center>
|
||||
Are you sure you want to delete {{name}}?
|
||||
</center></td></tr>
|
||||
<tr><td colspan="2" style="border-top: solid 2px black;"><center>
|
||||
<button type="submit" name="diediedie"><img src="icons/tick.png" align="top" /> Yes</button> <button type="submit" name="abort"><img src="icons/cross.png" align="top" /> No</button>
|
||||
</center></td></tr>
|
||||
</table>
|
||||
END;
|
||||
|
||||
?>
|
23
admin/templates/realms_towns_edit.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
$template = <<<END
|
||||
<h3>Edit a Town</h3>
|
||||
<a href="index.php?do=realms&fn=towns">Back to Towns List</a><br /><br />
|
||||
<form action="index.php?do=realms&fn=towns&action=edit&id={{id}}" method="post">
|
||||
<table cellspacing="0" cellpadding="5" width="98%">
|
||||
<tr><td width="25%">Town Name</td><td><input type="text" name="name" size="20" maxlength="30" value="{{name}}" /><br /><span class="grey">The name of this Town.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%" class="td_alt">Realm</td><td class="td_alt"><select name="world">{{realmselect}}</select><br /><span class="grey">The Realm this Town is a part of.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%">Latitude</td><td><input type="text" name="latitude" size="5" maxlength="6" value="{{latitude}}" /><br /><span class="grey">The vertical location of this town on the map.<br />Range: -{{realmsize}} to {{realmsize}}.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%" class="td_alt">Longitude</td><td class="td_alt"><input type="text" name="longitude" size="5" maxlength="6" value="{{longitude}}" /><br /><span class="grey">The horizontal location of this town on the map.<br />Range: -{{realmsize}} to {{realmsize}}.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%">Inn Price</td><td><input type="text" name="innprice" size="5" maxlength="10" value="{{innprice}}" /><br /><span class="grey">The cost to stay at this town's Inn.<br />Range: 0 to 4294967295.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%" class="td_alt">Map Price</td><td class="td_alt"><input type="text" name="mapprice" size="5" maxlength="10" value="{{mapprice}}" /><br /><span class="grey">The cost to buy the map to this town.<br />Range: 0 to 4294967295.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%">TP Price</td><td><input type="text" name="travelpoints" size="5" maxlength="5" value="{{travelpoints}}" /><br /><span class="grey">The travel points to jump to this town.<br />Range: 0 to 65535.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%" class="td_alt">Minimum Item Level</td><td class="td_alt"><input type="text" name="itemminlvl" size="5" maxlength="10" value="{{itemminlvl}}" /><br /><span class="grey">The minimum base item level that will be generated in this town.<br />Range: 0 to 4294967295.</span><br /><br /></td></tr>
|
||||
<tr><td width="25%">Maximum Item Level</td><td><input type="text" name="itemmaxlvl" size="5" maxlength="10" value="{{itemmaxlvl}}" /><br /><span class="grey">The maximum base item level that will be generated in this town.<br />Range: 0 to 4294967295.</span><br /><br /></td></tr>
|
||||
<tr><td colspan="2" style="border-top: solid 2px black;"><center>
|
||||
<button type="submit" name="submit"><img src="icons/tick.png" align="top" /> Save</button> <button type="reset"><img src="icons/cross.png" align="top" /> Reset</button>
|
||||
</td></tr>
|
||||
</table>
|
||||
END;
|
||||
|
||||
?>
|
|
@ -1,6 +1,22 @@
|
|||
DRAGON SCOURGE
|
||||
Changelog
|
||||
|
||||
***** BETA FOUR *****
|
||||
|
||||
8.09.2006 - Build 17 (Haiku):
|
||||
- Moved stylesheets into .css files.
|
||||
- Added javascript tooltips for the class info when creating a new character.
|
||||
- Changed doquery() format - rewrote all calls to this function to match the new format.
|
||||
- Various changes to the structure of lib.php.
|
||||
- Implemented Anman's increased attack and defense spells (Blessed Strike & Stone Skin).
|
||||
- Fixed class display in profile view.
|
||||
- Began admin control panel.
|
||||
- Various little bitty fixes.
|
||||
- You can no longer gamble 0 gold.
|
||||
- Added new level stat type: life.
|
||||
- Monsters can now do excellent hits, and you can now dodge monsters.
|
||||
- Removed several columns from controlrow that are no longer used.
|
||||
|
||||
***** BETA THREE *****
|
||||
|
||||
4.26.2006 - Build 16 (Road Rage):
|
||||
|
|
|
@ -5,7 +5,7 @@ $dbsettings = Array(
|
|||
"user" => "", // MySQL username.
|
||||
"pass" => "", // MySQL password.
|
||||
"name" => "", // MySQL database name.
|
||||
"prefix" => "", // Prefix for table names.
|
||||
"prefix" => "sx", // Prefix for table names.
|
||||
"secretword" => ""); // Secret word used when hashing information for cookies.
|
||||
|
||||
?>
|
|
@ -12,7 +12,7 @@ function checkcookies() {
|
|||
// {ID} {USERNAME} {PASSWORDHASH} {REMEMBERME}
|
||||
$theuser = explode(" ",$_COOKIE["scourge"]);
|
||||
if (!is_numeric($theuser[0])) { err("Invalid cookie data (Error 0). Please clear cookies and log in again."); }
|
||||
$row = dorow(doquery("SELECT * FROM {{table}} WHERE username='$theuser[1]' LIMIT 1", "accounts"));
|
||||
$row = dorow(doquery("SELECT * FROM <<accounts>> WHERE username='$theuser[1]' LIMIT 1"));
|
||||
if ($row == false) { err("Invalid cookie data (Error 1). Please clear cookies and log in again."); }
|
||||
if ($row["id"] != $theuser[0]) { err("Invalid cookie data (Error 2). Please clear cookies and log in again."); }
|
||||
if (md5($row["password"] . "--" . $dbsettings["secretword"]) !== $theuser[2]) { err("Invalid cookie data (Error 3). Please clear cookies and log in again."); }
|
||||
|
|
83
css/primary.css
Normal file
|
@ -0,0 +1,83 @@
|
|||
body {
|
||||
font: 10px Verdana;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
table {
|
||||
font: 10px Verdana;
|
||||
}
|
||||
|
||||
td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
input {
|
||||
font: 10px Verdana;
|
||||
}
|
||||
|
||||
img {
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #996600;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #663300;
|
||||
}
|
||||
|
||||
.main {
|
||||
border: solid 1px black;
|
||||
}
|
||||
|
||||
.grey {
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.red {
|
||||
color: #ff0000;
|
||||
}
|
||||
|
||||
.blue {
|
||||
color: #0000ff;
|
||||
}
|
||||
|
||||
.big {
|
||||
font: 11px Verdana;
|
||||
background-color: #dddddd;
|
||||
border: solid 1px #aaaaaa;
|
||||
padding: 2px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
.babble1 {
|
||||
background-color: #eeeeee;
|
||||
font: 10px Verdana;
|
||||
margin: 0px;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.babble2 {
|
||||
background-color: #ffffff;
|
||||
font: 10px Verdana;
|
||||
margin: 0px;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.tip {
|
||||
font: 10px/12px Arial,Helvetica,sans-serif;
|
||||
border: solid 1px #666666;
|
||||
width: 270px;
|
||||
padding: 1px;
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
visibility: hidden;
|
||||
color: #333333;
|
||||
top: 20px;
|
||||
left: 90px;
|
||||
background-color: #ffffcc;
|
||||
layer-background-color: #ffffcc;
|
||||
}
|
36
explore.php
|
@ -39,25 +39,25 @@ function move() { // Primary exploring function. Move them with the compass butt
|
|||
// Breakout for story.
|
||||
if ($userrow["story"] != "0" && $userrow["storylat"] == $userrow["latitude"] && $userrow["storylon"] == $userrow["longitude"]) {
|
||||
$string = ltrim($string," ,");
|
||||
doquery("UPDATE {{table}} SET $string WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||
doquery("UPDATE <<users>> SET $string WHERE id='".$userrow["id"]."' LIMIT 1");
|
||||
die(header("Location: story.php"));
|
||||
}
|
||||
|
||||
// Breakout for towns.
|
||||
$row = dorow(doquery("SELECT * FROM {{table}} WHERE world='".$userrow["world"]."' AND latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns"));
|
||||
$row = dorow(doquery("SELECT * FROM <<towns>> WHERE world='".$userrow["world"]."' AND latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1"));
|
||||
if ($row != false) {
|
||||
$townslist = explode(",",$userrow["townslist"]);
|
||||
if (!in_array($row["id"], $townslist)) {
|
||||
$userrow["townslist"] .= ",".$row["id"];
|
||||
$string .= ", townslist='".$userrow["townslist"]."'";
|
||||
}
|
||||
doquery("UPDATE {{table}} SET currentaction='In Town' $string WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||
doquery("UPDATE <<users>> SET currentaction='In Town' $string WHERE id='".$userrow["id"]."' LIMIT 1");
|
||||
display("Exploring", parsetemplate(gettemplate("town_enter"), $row));
|
||||
}
|
||||
|
||||
// Decide if we want to pick a fight with someone.
|
||||
if (rand(1,5) == 1 && $userrow["currentaction"] != "In Town") {
|
||||
doquery("UPDATE {{table}} SET currentaction='Fighting' $string WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||
doquery("UPDATE <<users>> SET currentaction='Fighting' $string WHERE id='".$userrow["id"]."' LIMIT 1");
|
||||
die(header("Location: fight.php"));
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ function move() { // Primary exploring function. Move them with the compass butt
|
|||
|
||||
// If we've gotten this far, nothing has happened.
|
||||
$userrow["currentaction"] = "Exploring";
|
||||
doquery("UPDATE {{table}} SET currentaction='Exploring', dropidstring='0' $string WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||
doquery("UPDATE <<users>> SET currentaction='Exploring', dropidstring='0' $string WHERE id='".$userrow["id"]."' LIMIT 1");
|
||||
display("Exploring", gettemplate("explore"));
|
||||
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ function travel($id) { // Move them with the Travel To list.
|
|||
if ($userrow["exploreverify"] != "") { botkillah(); }
|
||||
|
||||
if (!is_numeric($id)) { err("Invalid action. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "towns");
|
||||
$query = doquery("SELECT * FROM <<towns>> WHERE id='$id' LIMIT 1");
|
||||
$row = dorow($query);
|
||||
|
||||
// Errors.
|
||||
|
@ -99,7 +99,7 @@ function travel($id) { // Move them with the Travel To list.
|
|||
$userrow["longitude"] = $row["longitude"];
|
||||
$userrow["latitude"] = $row["latitude"];
|
||||
$userrow["currenttp"] -= $row["travelpoints"];
|
||||
$query = doquery("UPDATE {{table}} SET dropidstring='0', latitude='".$userrow["latitude"]."', longitude='".$userrow["longitude"]."', currenttp='".$userrow["currenttp"]."', currentaction='In Town' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||
$query = doquery("UPDATE <<users>> SET dropidstring='0', latitude='".$userrow["latitude"]."', longitude='".$userrow["longitude"]."', currenttp='".$userrow["currenttp"]."', currentaction='In Town' WHERE id='".$userrow["id"]."' LIMIT 1");
|
||||
display("Exploring", parsetemplate(gettemplate("town_enter"), $row));
|
||||
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ function quickheal() { // Quick heal.
|
|||
// Now heal them.
|
||||
$userrow["currenthp"] = min($userrow["currenthp"] + $spells[$id]["value"], $userrow["maxhp"]);
|
||||
$userrow["currentmp"] = $userrow["currentmp"] - $spells[$id]["mp"];
|
||||
doquery("UPDATE {{table}} SET currenthp='".$userrow["currenthp"]."', currentmp='".$userrow["currentmp"]."' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||
doquery("UPDATE <<users>> SET currenthp='".$userrow["currenthp"]."', currentmp='".$userrow["currentmp"]."' WHERE id='".$userrow["id"]."' LIMIT 1");
|
||||
display("Exploring", gettemplate("explore_quickheal"));
|
||||
|
||||
}
|
||||
|
@ -136,23 +136,23 @@ function itemdrop() { // Handling for item drops from monsters.
|
|||
|
||||
if ($userrow["dropidstring"] == "0") { err("No item has been dropped. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
|
||||
$premodrow = dorow(doquery("SELECT * FROM {{table}} ORDER BY id","itemmodnames"));
|
||||
$premodrow = dorow(doquery("SELECT * FROM <<itemmodnames>> ORDER BY id"));
|
||||
foreach($premodrow as $a=>$b) {
|
||||
$modrow[$b["fieldname"]] = $b;
|
||||
}
|
||||
|
||||
$thenewitem = explode(",",$userrow["dropidstring"]);
|
||||
$newitem = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$thenewitem[1]."' LIMIT 1", "itembase"));
|
||||
$newprefix = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$thenewitem[0]."' LIMIT 1", "itemprefixes"));
|
||||
$newsuffix = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$thenewitem[2]."' LIMIT 1", "itemsuffixes"));
|
||||
$newitem = dorow(doquery("SELECT * FROM <<itembase>> WHERE id='".$thenewitem[1]."' LIMIT 1"));
|
||||
$newprefix = dorow(doquery("SELECT * FROM <<itemprefixes>> WHERE id='".$thenewitem[0]."' LIMIT 1"));
|
||||
$newsuffix = dorow(doquery("SELECT * FROM <<itemsuffixes>> WHERE id='".$thenewitem[2]."' LIMIT 1"));
|
||||
$newfullitem = builditem($newprefix, $newitem, $newsuffix, $modrow);
|
||||
$row["itemtable"] = parsetemplate(gettemplate("explore_drop_itemrow"), $newfullitem);
|
||||
|
||||
if ($userrow["item".$newitem["slotnumber"]."idstring"] != "0") {
|
||||
$theolditem = explode(",",$userrow["item".$newitem["slotnumber"]."idstring"]);
|
||||
$olditem = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$theolditem[1]."' LIMIT 1", "itembase"));
|
||||
$oldprefix = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$theolditem[0]."' LIMIT 1", "itemprefixes"));
|
||||
$oldsuffix = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$theolditem[2]."' LIMIT 1", "itemsuffixes"));
|
||||
$olditem = dorow(doquery("SELECT * FROM <<itembase>> WHERE id='".$theolditem[1]."' LIMIT 1"));
|
||||
$oldprefix = dorow(doquery("SELECT * FROM <<itemprefixes>> WHERE id='".$theolditem[0]."' LIMIT 1"));
|
||||
$oldsuffix = dorow(doquery("SELECT * FROM <<itemsuffixes>> WHERE id='".$theolditem[2]."' LIMIT 1"));
|
||||
$oldfullitem = builditem($oldprefix, $olditem, $oldsuffix, $modrow);
|
||||
$row["olditems"] = parsetemplate(gettemplate("town_buy_olditemrow"), $oldfullitem);
|
||||
} else {
|
||||
|
@ -223,11 +223,11 @@ function botkillah() { // Bust a cap in the asses of macro bots. Word.
|
|||
if (isset($_POST["submit"])) {
|
||||
|
||||
if (strtoupper($_POST["verify"]) == $userrow["exploreverify"]) {
|
||||
$query = doquery("UPDATE {{table}} SET exploreverify='',exploreverifyimage='' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||
$query = doquery("UPDATE <<users>> SET exploreverify='',exploreverifyimage='' WHERE id='".$userrow["id"]."' LIMIT 1");
|
||||
unlink("images/botcheck/".$userrow["exploreverifyimage"]);
|
||||
die(header("Location: index.php"));
|
||||
} else {
|
||||
$query = doquery("UPDATE {{table}} SET explorefailed=explorefailed+1 WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||
$query = doquery("UPDATE <<users>> SET explorefailed=explorefailed+1 WHERE id='".$userrow["id"]."' LIMIT 1");
|
||||
die(header("Location: index.php?do=humanity"));
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ function botkillah() { // Bust a cap in the asses of macro bots. Word.
|
|||
for($i=0; $i<8; $i++) { $randomext .= rand(0,9); }
|
||||
ImagePNG($im, "images/botcheck/$randomext".".png");
|
||||
ImageDestroy($im);
|
||||
$query = doquery("UPDATE {{table}} SET exploreverify='$new_string',exploreverifyimage='$randomext".".png' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||
$query = doquery("UPDATE <<users>> SET exploreverify='$new_string',exploreverifyimage='$randomext".".png' WHERE id='".$userrow["id"]."' LIMIT 1");
|
||||
|
||||
$pagerow["exploreverifyimage"] = $randomext.".png";
|
||||
|
||||
|
|
BIN
extras/Thumbs.db
Normal file
1170
extras/install.sql
44
fight.php
|
@ -10,7 +10,7 @@ if ($userrow["currentaction"] != "Fighting") { die(header("Location: index.php")
|
|||
|
||||
// Global monsterrow.
|
||||
if($userrow["currentmonsterid"] != 0) {
|
||||
$monsterquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["currentmonsterid"]."' LIMIT 1", "monsters");
|
||||
$monsterquery = doquery("SELECT * FROM <<monsters>> WHERE id='".$userrow["currentmonsterid"]."' LIMIT 1");
|
||||
$monsterrow = dorow($monsterquery);
|
||||
} else {
|
||||
rollmonster();
|
||||
|
@ -26,7 +26,7 @@ function rollmonster() {
|
|||
if($userrow["longitude"] < 0) { $longitude = $userrow["longitude"] * -1; } else { $longitude = $userrow["longitude"]; }
|
||||
$maxlevel = ceil(max($latitude, $longitude) / 5);
|
||||
$minlevel = $maxlevel - 3;
|
||||
$monsterquery = doquery("SELECT * FROM {{table}} WHERE world='".$userrow["world"]."' AND level >= $minlevel AND level <= $maxlevel ORDER BY RAND() LIMIT 1", "monsters");
|
||||
$monsterquery = doquery("SELECT * FROM <<monsters>> WHERE world='".$userrow["world"]."' AND level >= $minlevel AND level <= $maxlevel ORDER BY RAND() LIMIT 1");
|
||||
$monsterrow = dorow($monsterquery);
|
||||
|
||||
$userrow["currentmonsterhp"] = (ceil(rand($monsterrow["maxhp"] * .75, $monsterrow["maxhp"]) * $userrow["difficulty"]));
|
||||
|
@ -98,7 +98,7 @@ function dofight() {
|
|||
|
||||
} elseif (isset($_POST["run"])) {
|
||||
|
||||
if (rand(4,10) + ceil(sqrt($userrow["physdefense"])) < (rand(1,5) + ceil(sqrt($monsterrow["physattack"])))) {
|
||||
if (rand(4,10) + ceil(sqrt($userrow["dexterity"])) < (rand(1,5) + ceil(sqrt((0.75 * $monsterrow["physattack"]))))) {
|
||||
|
||||
monsterturn();
|
||||
$fightrow["message"] = "You tried to run away, but the monster blocked you!<br />";
|
||||
|
@ -126,7 +126,7 @@ function dofight() {
|
|||
|
||||
} else {
|
||||
|
||||
if (rand(1,10) + ceil(sqrt($userrow["physdefense"])) < (rand(1,7) + ceil(sqrt($monsterrow["physattack"])))) {
|
||||
if (rand(1,10) + ceil(sqrt($userrow["dexterity"])) < (rand(1,7) + ceil(sqrt((0.75 * $monsterrow["physattack"]))))) {
|
||||
|
||||
monsterturn();
|
||||
$fightrow["message"] = "The monster attacked before you were ready!<br />";
|
||||
|
@ -187,7 +187,7 @@ function playerturn() {
|
|||
|
||||
// Chance to make an excellent hit.
|
||||
$toexcellent = rand(0,150);
|
||||
if ($toexcellent <= sqrt($userrow["strength"])) {
|
||||
if ($toexcellent <= sqrt($userrow["dexterity"])) {
|
||||
$fightrow["playerphysdamage"] *= 2;
|
||||
$fightrow["playermagicdamage"] *= 2;
|
||||
$fightrow["playerfiredamage"] *= 2;
|
||||
|
@ -206,6 +206,7 @@ function playerturn() {
|
|||
}
|
||||
|
||||
// Now we add Per Turn mods.
|
||||
bonusattack();
|
||||
hpleech("player");
|
||||
mpleech("player");
|
||||
|
||||
|
@ -242,7 +243,28 @@ function monsterturn() {
|
|||
$fightrow["monsterlightdamage"] = max($lighthit - $lightblock, 0);
|
||||
}
|
||||
|
||||
// Chance to make an excellent hit.
|
||||
$toexcellent = rand(0,150);
|
||||
if ($toexcellent <= sqrt($monsterrow["dexterity"])) {
|
||||
$fightrow["monsterphysdamage"] *= 2;
|
||||
$fightrow["monstermagicdamage"] *= 2;
|
||||
$fightrow["monsterfiredamage"] *= 2;
|
||||
$fightrow["monsterlightdamage"] *= 2;
|
||||
$fightrow["message"] = "<b>Excellent hit!</b><br />";
|
||||
}
|
||||
|
||||
// Chance for player to dodge.
|
||||
$tododge = rand(0,200);
|
||||
if ($tododge <= sqrt($userrow["physdefense"])) {
|
||||
$fightrow["monsterphysdamage"] = 0;
|
||||
$fightrow["monstermagicdamage"] = 0;
|
||||
$fightrow["monsterfiredamage"] = 0;
|
||||
$fightrow["monsterlightdamage"] = 0;
|
||||
$fightrow["message"] = "<b>You dodged the monster's hit!</b><br />";
|
||||
}
|
||||
|
||||
// Now we add Per Turn mods.
|
||||
bonusdefense();
|
||||
hpleech("monster");
|
||||
|
||||
// Subtract all damage from player's hp.
|
||||
|
@ -267,6 +289,8 @@ function youwin() {
|
|||
if ($monsterrow["newstory"] != "0") {
|
||||
$userrow["story"] = $monsterrow["newstory"];
|
||||
}
|
||||
$userrow["bonusattack"] = 0;
|
||||
$userrow["bonusdefense"] = 0;
|
||||
|
||||
// Now we add Per Kill mods.
|
||||
hpgain();
|
||||
|
@ -288,9 +312,9 @@ function youwin() {
|
|||
if (rand(0,7) == 1) {
|
||||
|
||||
// Grab lots of stuff from the DB.
|
||||
$preitemsrow = dorow(doquery("SELECT * FROM {{table}} WHERE reqlevel>='".($userrow["level"] - 5)."' AND reqlevel<='".$userrow["level"]."' AND willdrop='1' ORDER BY RAND() LIMIT 1", "itembase"));
|
||||
$preprefixrow = dorow(doquery("SELECT * FROM {{table}} WHERE reqlevel<='".$userrow["level"]."' ORDER BY RAND() LIMIT 1", "itemprefixes"));
|
||||
$presuffixrow = dorow(doquery("SELECT * FROM {{table}} WHERE reqlevel<='".$userrow["level"]."' ORDER BY RAND() LIMIT 1", "itemsuffixes"));
|
||||
$preitemsrow = dorow(doquery("SELECT * FROM <<itembase>> WHERE reqlevel>='".($userrow["level"] - 5)."' AND reqlevel<='".$userrow["level"]."' AND willdrop='1' ORDER BY RAND() LIMIT 1", "itembase"));
|
||||
$preprefixrow = dorow(doquery("SELECT * FROM <<itemprefixes>> WHERE reqlevel<='".$userrow["level"]."' ORDER BY RAND() LIMIT 1", "itemprefixes"));
|
||||
$presuffixrow = dorow(doquery("SELECT * FROM <<itemsuffixes>> WHERE reqlevel<='".$userrow["level"]."' ORDER BY RAND() LIMIT 1", "itemsuffixes"));
|
||||
|
||||
$idstring = "";
|
||||
if (rand(0,4)==1) { $idstring .= $preprefixrow["id"] . ","; } else { $idstring .= "0,"; }
|
||||
|
@ -351,7 +375,7 @@ function youlose() {
|
|||
"deathpenalty"=>$userrow["deathpenalty"]);
|
||||
|
||||
// Then put them in town & reset fight stuff.
|
||||
$townrow = dorow(doquery("SELECT * FROM {{table}} WHERE world='".$userrow["world"]."' ORDER BY id ASC LIMIT 1", "towns"));
|
||||
$townrow = dorow(doquery("SELECT * FROM <<towns>> WHERE world='".$userrow["world"]."' ORDER BY id ASC LIMIT 1"));
|
||||
$userrow["latitude"] = $townrow["latitude"];
|
||||
$userrow["longitude"] = $townrow["longitude"];
|
||||
$userrow["currentaction"] = "In Town";
|
||||
|
@ -359,6 +383,8 @@ function youlose() {
|
|||
$userrow["currentmonsterid"] = 0;
|
||||
$userrow["currentmonsterhp"] = 0;
|
||||
$userrow["currenthp"] = ceil($userrow["maxhp"] / 4);
|
||||
$userrow["bonusattack"] = 0;
|
||||
$userrow["bonusdefense"] = 0;
|
||||
|
||||
// Update.
|
||||
updateuserrow();
|
||||
|
|
|
@ -61,4 +61,88 @@ function mpgain() {
|
|||
|
||||
}
|
||||
|
||||
function bonusattack() {
|
||||
|
||||
/***********
|
||||
Description: Chance to deal extra damage.
|
||||
Occurs: Per Turn.
|
||||
Applies To: Player only.
|
||||
Written By: Anman.
|
||||
***********/
|
||||
|
||||
global $userrow, $fightrow;
|
||||
|
||||
$first = $userrow["bonusattack"] * 0.25;
|
||||
$sec = $userrow["bonusattack"] * 0.5;
|
||||
$third = $userrow["bonusattack"] * 0.75;
|
||||
$rand = rand(0,100);
|
||||
|
||||
if ($rand <= $first) { $multiplier = 2; }
|
||||
elseif ($rand <= $sec) { $multiplier = 1.75; }
|
||||
elseif ($rand <= $third) { $multiplier = 1.5; }
|
||||
elseif ($rand <= $userrow["bonusattack"] && $rand > $third) { $multiplier = 1.25; }
|
||||
else { $multiplier = 1; }
|
||||
|
||||
$fightrow["playerphysdamage"] = floor($fightrow["playerphysdamage"] * $multiplier);
|
||||
|
||||
}
|
||||
|
||||
function bonusdefense() {
|
||||
|
||||
/***********
|
||||
Description: Chance to reduce incurred damage.
|
||||
Occurs: Per Turn.
|
||||
Applies To: Player only.
|
||||
Written By: Anman.
|
||||
***********/
|
||||
|
||||
global $userrow, $fightrow;
|
||||
|
||||
$first = $userrow["bonusdefense"] * 0.25;
|
||||
$sec = $userrow["bonusdefense"] * 0.5;
|
||||
$third = $userrow["bonusdefense"] * 0.75;
|
||||
$rand = rand(0,100);
|
||||
|
||||
if ($rand <= $first) { $multiplier = 0; }
|
||||
elseif ($rand <= $sec) { $multiplier = 0.25; }
|
||||
elseif ($rand <= $third) { $multiplier = 0.5; }
|
||||
elseif ($rand <= $userrow["bonusdefense"] && $rand > $third) { $multiplier = 0.75; }
|
||||
else { $multiplier = 1; }
|
||||
|
||||
$fightrow["monsterphysdamage"] = floor($fightrow["monsterphysdamage"] * $multiplier);
|
||||
$fightrow["monstermagicdamage"] = floor($fightrow["monstermagicdamage"] * $multiplier);
|
||||
$fightrow["monsterfiredamage"] = floor($fightrow["monsterfiredamage"] * $multiplier);
|
||||
$fightrow["monsterlightdamage"] = floor($fightrow["monsterlightdamage"] * $multiplier);
|
||||
|
||||
}
|
||||
|
||||
function bonusdefense_pvp() {
|
||||
|
||||
/***********
|
||||
Description: Chance to reduce incurred damage - PVP version.
|
||||
Occurs: Per Turn.
|
||||
Applies To: Player only.
|
||||
Written By: Anman.
|
||||
***********/
|
||||
|
||||
global $userrow, $monsterrow, $fightrow;
|
||||
|
||||
$first = $monsterrow["bonusdefense"] * 0.25;
|
||||
$sec = $monsterrow["bonusdefense"] * 0.5;
|
||||
$third = $monsterrow["bonusdefense"] * 0.75;
|
||||
$rand = rand(0,100);
|
||||
|
||||
if ($rand <= $first) { $multiplier = 0; }
|
||||
elseif ($rand <= $sec) { $multiplier = 0.25; }
|
||||
elseif ($rand <= $third) { $multiplier = 0.5; }
|
||||
elseif ($rand <= $monsterrow["bonusdefense"] && $rand > $third) { $multiplier = 0.75; }
|
||||
else { $multiplier = 1; }
|
||||
|
||||
$fightrow["playerphysdamage"] = floor($fightrow["playerphysdamage"] * $multiplier);
|
||||
$fightrow["playermagicdamage"] = floor($fightrow["playermagicdamage"] * $multiplier);
|
||||
$fightrow["playerfiredamage"] = floor($fightrow["playerfiredamage"] * $multiplier);
|
||||
$fightrow["playerlightdamage"] = floor($fightrow["playerlightdamage"] * $multiplier);
|
||||
|
||||
}
|
||||
|
||||
?>
|
14
globals.php
|
@ -5,7 +5,7 @@ include("config.php");
|
|||
if (trim($dbsettings["secretword"]) == "") { die("Invalid setting for secretword in config.php. This setting must never be blank."); }
|
||||
|
||||
// Control row.
|
||||
$controlrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control"));
|
||||
$controlrow = dorow(doquery("SELECT * FROM <<control>> WHERE id='1' LIMIT 1"));
|
||||
|
||||
// Account row.
|
||||
include("cookies.php");
|
||||
|
@ -15,25 +15,25 @@ if ($acctrow != false && $acctrow["characters"] == 0 && substr($_SERVER["REQUEST
|
|||
|
||||
// User row.
|
||||
if (substr($_SERVER["REQUEST_URI"], -19) != "login.php?do=logout") {
|
||||
$online = doquery("UPDATE {{table}} SET onlinetime=NOW() WHERE id='".$acctrow["activechar"]."' LIMIT 1", "users");
|
||||
$online = doquery("UPDATE <<users>> SET onlinetime=NOW() WHERE id='".$acctrow["activechar"]."' LIMIT 1");
|
||||
} else {
|
||||
$online = doquery("UPDATE {{table}} SET onlinetime = DATE_SUB(onlinetime, INTERVAL 11 MINUTE) WHERE id='".$acctrow["activechar"]."' LIMIT 1", "users");
|
||||
$online = doquery("UPDATE <<users>> SET onlinetime = DATE_SUB(onlinetime, INTERVAL 11 MINUTE) WHERE id='".$acctrow["activechar"]."' LIMIT 1");
|
||||
}
|
||||
$userrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$acctrow["activechar"]."' LIMIT 1", "users"));
|
||||
$userrow = dorow(doquery("SELECT * FROM <<users>> WHERE id='".$acctrow["activechar"]."' LIMIT 1"));
|
||||
if ($userrow != false) { $userrow = array_map("stripslashes", $userrow); }
|
||||
|
||||
// World row.
|
||||
$worldrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["world"]."' LIMIT 1", "worlds"));
|
||||
$worldrow = dorow(doquery("SELECT * FROM <<worlds>> WHERE id='".$userrow["world"]."' LIMIT 1"));
|
||||
|
||||
// Town row.
|
||||
if ($userrow["currentaction"] == "In Town") {
|
||||
$townrow = dorow(doquery("SELECT * FROM {{table}} WHERE world='".$userrow["world"]."' AND longitude='".$userrow["longitude"]."' AND latitude='".$userrow["latitude"]."' LIMIT 1", "towns"));
|
||||
$townrow = dorow(doquery("SELECT * FROM <<towns>> WHERE world='".$userrow["world"]."' AND longitude='".$userrow["longitude"]."' AND latitude='".$userrow["latitude"]."' LIMIT 1"));
|
||||
} else {
|
||||
$townrow = false;
|
||||
}
|
||||
|
||||
// Spells.
|
||||
$spells = dorow(doquery("SELECT * FROM {{table}} ORDER BY id", "spells"), "id");
|
||||
$spells = dorow(doquery("SELECT * FROM <<spells>> ORDER BY id", "spells"), "id");
|
||||
|
||||
// Global fightrow.
|
||||
$fightrow = array(
|
||||
|
|
110
guilds.php
|
@ -12,7 +12,7 @@ function guildmain() {
|
|||
if (!isset($_GET["list"])) { guildhome(); }
|
||||
}
|
||||
|
||||
$guilds = dorow(doquery("SELECT * FROM {{table}} WHERE isactive='1' ORDER BY honor", "guilds"), "id");
|
||||
$guilds = dorow(doquery("SELECT * FROM <<guilds>> WHERE isactive='1' ORDER BY honor"), "id");
|
||||
$row["guildlist"] = "<table style=\"width: 95%;\" cellspacing=\"0\" cellpadding=\"0\"><tr><td><b>Guild Name & Tag</b></td><td style=\"text-align: center;\"><b>Honor</b></td><td style=\"text-align: right;\"><b>Functions</b></td></tr>";
|
||||
$bgcolor = "background-color: #ffffff;";
|
||||
if ($guilds != false) {
|
||||
|
@ -35,7 +35,7 @@ function guildhome() {
|
|||
global $userrow, $controlrow;
|
||||
|
||||
if ($userrow["guild"] == 0) { err("You are not yet a member of any Guild. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
$guild = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds"));
|
||||
$guild = dorow(doquery("SELECT * FROM <<guilds>> WHERE id='".$userrow["guild"]."' LIMIT 1"));
|
||||
|
||||
if ($guild["lastupdate"] <= (mktime() - ($controlrow["guildupdate"] * 3600))) { $guild = guildupdate(); }
|
||||
|
||||
|
@ -55,7 +55,7 @@ function guildhome() {
|
|||
$pagerow["bank"] = number_format($guild["bank"]);
|
||||
|
||||
// Pull memberslist for select box.
|
||||
$members = dorow(doquery("SELECT * FROM {{table}} WHERE guild='".$userrow["guild"]."' ORDER BY guildrank", "users"), "id");
|
||||
$members = dorow(doquery("SELECT * FROM <<users>> WHERE guild='".$userrow["guild"]."' ORDER BY guildrank"), "id");
|
||||
$pagerow["memberselect"] = "<select name=\"charid\" style=\"font: 10px Arial;\">";
|
||||
foreach($members as $a => $b) {
|
||||
$pagerow["memberselect"] .= "<option value=\"".$b["id"]."\">".$b["charname"]." (Rank ".$b["guildrank"].")</option>\n";
|
||||
|
@ -63,7 +63,7 @@ function guildhome() {
|
|||
$pagerow["memberselect"] .= "</select>";
|
||||
|
||||
// Pull applications for selectbox.
|
||||
$apps = dorow(doquery("SELECT * FROM {{table}} WHERE guild='".$userrow["guild"]."' ORDER BY id", "guildapps"), "id");
|
||||
$apps = dorow(doquery("SELECT * FROM <<guildapps>> WHERE guild='".$userrow["guild"]."' ORDER BY id"), "id");
|
||||
if ($apps != false) {
|
||||
$pagerow["appselect"] = "<select name=\"charid\" style=\"font: 10px Arial;\">";
|
||||
foreach ($apps as $a => $b) {
|
||||
|
@ -91,7 +91,7 @@ function guildcreate() {
|
|||
// Errors.
|
||||
if ($userrow["gold"] < $controlrow["guildstartup"]) { err("You do not have enough gold to create a Guild. Starting your own Guild requires ".number_format($controlrow["guildstartup"])." gold. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
if ($userrow["guild"] != 0) { err("You are already a member of another Guild. You must renounce your current membership before starting your own Guild. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
$appquery = doquery("SELECT * FROM {{table}} WHERE charid='".$userrow["id"]."' LIMIT 1", "guildapps");
|
||||
$appquery = doquery("SELECT * FROM <<guildapps>> WHERE charid='".$userrow["id"]."' LIMIT 1");
|
||||
if (mysql_num_rows($appquery) != 0) { err("You have already applied to join another Guild. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
if ($userrow["level"] < $controlrow["guildstartlvl"]) { err("You cannot join a guild until you are at least Level ".$controlrow["guildstartlvl"].". Please continue playing until your character is Level ".$controlrow["guildstartlvl"].", then try again."); }
|
||||
|
||||
|
@ -130,10 +130,10 @@ function guildcreate() {
|
|||
$querystring .= "$a='$b',";
|
||||
}
|
||||
$querystring .= "id='',isactive='1',founder='".$userrow["id"]."', members='1'";
|
||||
$query = doquery("INSERT INTO {{table}} SET $querystring", "guilds");
|
||||
$query = doquery("INSERT INTO <<guilds>> SET $querystring");
|
||||
|
||||
// Now update the Founder's userrow.
|
||||
$query = doquery("UPDATE {{table}} SET gold=gold-".$controlrow["guildstartup"].", guild='".mysql_insert_id()."',guildrank='5',guildtag='$tagline',tagcolor='$color1',namecolor='$color2' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||
$query = doquery("UPDATE <<users>> SET gold=gold-".$controlrow["guildstartup"].", guild='".mysql_insert_id()."',guildrank='5',guildtag='$tagline',tagcolor='$color1',namecolor='$color2' WHERE id='".$userrow["id"]."' LIMIT 1");
|
||||
|
||||
// And we're done.
|
||||
display("Create a Guild", "Your guild was successfully created.<br /><br />You may now return to <a href=\"index.php\">the game</a>.");
|
||||
|
@ -156,7 +156,7 @@ function guildedit() {
|
|||
|
||||
global $userrow;
|
||||
|
||||
$guild = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds"));
|
||||
$guild = dorow(doquery("SELECT * FROM <<guilds>> WHERE id='".$userrow["guild"]."' LIMIT 1"));
|
||||
|
||||
// Errors.
|
||||
if ($userrow["guildrank"] < 5) { err("You do not have permission to edit the Guild settings. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
|
@ -194,8 +194,8 @@ function guildedit() {
|
|||
$querystring .= "$a='$b',";
|
||||
}
|
||||
$querystring .= "id=id";
|
||||
$query = doquery("UPDATE {{table}} SET $querystring WHERE id='".$guild["id"]."'", "guilds");
|
||||
$updatemem = doquery("UPDATE {{table}} SET namecolor='$color2', tagcolor='$color1' WHERE guild='".$guild["id"]."'", "users");
|
||||
$query = doquery("UPDATE <<guilds>> SET $querystring WHERE id='".$guild["id"]."'");
|
||||
$updatemem = doquery("UPDATE <<users>> SET namecolor='$color2', tagcolor='$color1' WHERE guild='".$guild["id"]."'");
|
||||
|
||||
// And we're done.
|
||||
display("Edit Guild", "Your guild was successfully edited.<br /><br />You may now return to <a href=\"index.php\">town</a> or to your <a href=\"index.php?do=guildhome\">Guild Hall</a>.");
|
||||
|
@ -219,22 +219,22 @@ function guildapp() {
|
|||
|
||||
$id = $_GET["id"];
|
||||
if (!is_numeric($id)) { err("Invalid input. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
$guild = dorow(doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "guilds"));
|
||||
$guild = dorow(doquery("SELECT * FROM <<guilds>> WHERE id='$id' LIMIT 1"));
|
||||
if ($guild == false) { err("Invalid input. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
|
||||
// Errors.
|
||||
if ($userrow["gold"] < $guild["joincost"]) { err("You do not have enough gold to join this Guild. Joining this Guild requires ".number_format($guild["joincost"])." gold. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
if ($userrow["guild"] != 0) { err("You are already a member of another Guild. You must renounce your current membership before joining this Guild. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
$appquery = doquery("SELECT * FROM {{table}} WHERE charid='".$userrow["id"]."' LIMIT 1", "guildapps");
|
||||
$appquery = doquery("SELECT * FROM <<guildapps>> WHERE charid='".$userrow["id"]."' LIMIT 1");
|
||||
if (mysql_num_rows($appquery) != 0) { err("You have already applied to join another Guild. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
if ($userrow["level"] < $controlrow["guildjoinlvl"]) { err("You cannot join a guild until you are at least Level ".$controlrow["guildjoinlvl"].". Please continue playing until your character is Level ".$controlrow["guildjoinlvl"].", then try again."); }
|
||||
|
||||
if (isset($_POST["yes"])) {
|
||||
|
||||
$query = doquery("INSERT INTO {{table}} SET id='',guild='$id',charid='".$userrow["id"]."',charname='".$userrow["charname"]."'", "guildapps");
|
||||
$update = doquery("UPDATE {{table}} SET bank=bank+".$guild["joincost"]." WHERE id='".$guild["id"]."' LIMIT 1", "guilds");
|
||||
$updatemem = doquery("UPDATE {{table}} SET gold=gold-".$guild["joincost"]." WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||
$send = doquery("INSERT INTO {{table}} SET id='', postdate=NOW(), senderid='0', sendername='".$guild["name"]."', recipientid='".$guild["founder"]."', recipientname='Guild Leader', status='0', title='New Guild Application', message='Someone has applied to join your Guild.<br /><br /><b>Do not reply to this message!</b>', gold='0'", "messages");
|
||||
$query = doquery("INSERT INTO <<guildapps>> SET id='',guild='$id',charid='".$userrow["id"]."',charname='".$userrow["charname"]."'");
|
||||
$update = doquery("UPDATE <<guilds>> SET bank=bank+".$guild["joincost"]." WHERE id='".$guild["id"]."' LIMIT 1");
|
||||
$updatemem = doquery("UPDATE <<users>> SET gold=gold-".$guild["joincost"]." WHERE id='".$userrow["id"]."' LIMIT 1");
|
||||
$send = doquery("INSERT INTO <<messages>> SET id='', postdate=NOW(), senderid='0', sendername='".$guild["name"]."', recipientid='".$guild["founder"]."', recipientname='Guild Leader', status='0', title='New Guild Application', message='Someone has applied to join your Guild.<br /><br /><b>Do not reply to this message!</b>', gold='0'");
|
||||
display("Join a Guild", "Thank you for applying to this Guild. If the Guild Leader approves your application, you will be notified via the Post Office.<br /><br />You may now return to <a href=\"index.php\">the game</a>.");
|
||||
|
||||
} elseif (isset($_POST["no"])) {
|
||||
|
@ -255,10 +255,10 @@ function guildmembers() {
|
|||
|
||||
$id = $_GET["id"];
|
||||
if (!is_numeric($id)) { err("Invalid input. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
$guild = dorow(doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "guilds"));
|
||||
$guild = dorow(doquery("SELECT * FROM <<guilds>> WHERE id='$id' LIMIT 1"));
|
||||
if ($guild == false) { err("Invalid input. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
|
||||
$guildmembers = dorow(doquery("SELECT * FROM {{table}} WHERE guild='$id' ORDER BY guildrank DESC", "users"), "id");
|
||||
$guildmembers = dorow(doquery("SELECT * FROM <<users>> WHERE guild='$id' ORDER BY guildrank DESC"), "id");
|
||||
$row["guildmembers"] = "<table style=\"width: 95%;\" cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"background-color: #dddddd; padding: 3px;\"><b>Name</b></td><td style=\"background-color: #dddddd; padding: 3px; text-align: right;\"><b>Rank</b></td></tr>\n";
|
||||
$bgcolor = "background-color: #ffffff;";
|
||||
if ($guildmembers != false) {
|
||||
|
@ -280,12 +280,12 @@ function guildbank() {
|
|||
global $userrow;
|
||||
extract($_POST);
|
||||
|
||||
$guild = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds"));
|
||||
$guild = dorow(doquery("SELECT * FROM <<guilds>> WHERE id='".$userrow["guild"]."' LIMIT 1"));
|
||||
|
||||
|
||||
if (isset($_POST["out"])) {
|
||||
|
||||
$member = dorow(doquery("SELECT * FROM {{table}} WHERE id='$charid' LIMIT 1", "users"));
|
||||
$member = dorow(doquery("SELECT * FROM <<users>> WHERE id='$charid' LIMIT 1"));
|
||||
|
||||
// Errors.
|
||||
if ($userrow["guildrank"] < 4) { err("You do not have permission to distribute Guild funds. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
|
@ -298,8 +298,8 @@ function guildbank() {
|
|||
if ($member["id"] == $userrow["id"]) { err("You cannot send Guild money to yourself. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
|
||||
// Do stuff.
|
||||
$send = doquery("INSERT INTO {{table}} SET id='', postdate=NOW(), senderid='0', sendername='".$guild["name"]."', recipientid='$charid', recipientname='".$member["charname"]."', status='0', title='Money from your Guild', message='Your Guild has sent you money from the Guild Bank.<br /><br /><b>Do not reply to this message!</b>', gold='$gold'", "messages");
|
||||
$update = doquery("UPDATE {{table}} SET bank=bank-$gold WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds");
|
||||
$send = doquery("INSERT INTO <<messages>> SET id='', postdate=NOW(), senderid='0', sendername='".$guild["name"]."', recipientid='$charid', recipientname='".$member["charname"]."', status='0', title='Money from your Guild', message='Your Guild has sent you money from the Guild Bank.<br /><br /><b>Do not reply to this message!</b>', gold='$gold'");
|
||||
$update = doquery("UPDATE <<guilds>> SET bank=bank-$gold WHERE id='".$userrow["guild"]."' LIMIT 1");
|
||||
display("Post Office", gettemplate("mailbox_sent"));
|
||||
|
||||
} elseif (isset($_POST["in"])) {
|
||||
|
@ -310,8 +310,8 @@ function guildbank() {
|
|||
if ($_POST["golddeposit"] > $userrow["gold"]) { err("You do not have that much money in your pocket."); }
|
||||
|
||||
// Do stuff.
|
||||
$update = doquery("UPDATE {{table}} SET bank=bank+".$_POST["golddeposit"]." WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds");
|
||||
$updatemem = doquery("UPDATE {{table}} SET gold=gold-".$_POST["golddeposit"]." WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||
$update = doquery("UPDATE <<guilds>> SET bank=bank+".$_POST["golddeposit"]." WHERE id='".$userrow["guild"]."' LIMIT 1");
|
||||
$updatemem = doquery("UPDATE <<users>> SET gold=gold-".$_POST["golddeposit"]." WHERE id='".$userrow["id"]."' LIMIT 1");
|
||||
display("Guild Bank", "Thank you for depositing money to the Guild Bank.<br /><br />You may now return to <a href=\"index.php\">Town</a> or to your <a href=\"index.php?do=guildhome\">Guild Hall</a>.");
|
||||
|
||||
}
|
||||
|
@ -323,8 +323,8 @@ function guildpromote() {
|
|||
global $userrow;
|
||||
extract($_POST);
|
||||
|
||||
$guild = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds"));
|
||||
$member = dorow(doquery("SELECT * FROM {{table}} WHERE id='$charid' LIMIT 1", "users"));
|
||||
$guild = dorow(doquery("SELECT * FROM <<guilds>> WHERE id='".$userrow["guild"]."' LIMIT 1"));
|
||||
$member = dorow(doquery("SELECT * FROM <<users>> WHERE id='$charid' LIMIT 1"));
|
||||
|
||||
if (isset($_POST["promote"])) {
|
||||
|
||||
|
@ -336,7 +336,7 @@ function guildpromote() {
|
|||
if ($member["guild"] != $userrow["guild"]) { err("That player is not in your Guild. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
|
||||
// Do stuff.
|
||||
$update = doquery("UPDATE {{table}} SET guildrank=guildrank+1 WHERE id='$charid' LIMIT 1", "users");
|
||||
$update = doquery("UPDATE <<users>> SET guildrank=guildrank+1 WHERE id='$charid' LIMIT 1");
|
||||
|
||||
} elseif (isset($_POST["demote"])) {
|
||||
|
||||
|
@ -349,7 +349,7 @@ function guildpromote() {
|
|||
if ($member["guildrank"] == 1) { guildremove(); }
|
||||
|
||||
// Do stuff.
|
||||
$update = doquery("UPDATE {{table}} SET guildrank=guildrank-1 WHERE id='$charid' LIMIT 1", "users");
|
||||
$update = doquery("UPDATE <<users>> SET guildrank=guildrank-1 WHERE id='$charid' LIMIT 1");
|
||||
|
||||
}
|
||||
|
||||
|
@ -362,9 +362,9 @@ function guildapprove() {
|
|||
global $userrow;
|
||||
extract($_POST);
|
||||
|
||||
$guild = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds"));
|
||||
$member = dorow(doquery("SELECT * FROM {{table}} WHERE id='$charid' LIMIT 1", "users"));
|
||||
$app = dorow(doquery("SELECT * FROM {{table}} WHERE guild='".$userrow["guild"]."' AND charid='$charid' LIMIT 1", "guildapps"));
|
||||
$guild = dorow(doquery("SELECT * FROM <<guilds>> WHERE id='".$userrow["guild"]."' LIMIT 1"));
|
||||
$member = dorow(doquery("SELECT * FROM <<users>> WHERE id='$charid' LIMIT 1"));
|
||||
$app = dorow(doquery("SELECT * FROM <<guildapps>> WHERE guild='".$userrow["guild"]."' AND charid='$charid' LIMIT 1"));
|
||||
|
||||
// Errors.
|
||||
if ($userrow["guildrank"] < 4) { err("You do not have permission to approve new members. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
|
@ -372,15 +372,15 @@ function guildapprove() {
|
|||
|
||||
// Do stuff.
|
||||
if (isset($_POST["approve"])) {
|
||||
$updatemem = doquery("UPDATE {{table}} SET guild='".$userrow["guild"]."', guildrank='1', guildtag='".$guild["tagline"]."', tagcolor='".$guild["color1"]."', namecolor='".$guild["color2"]."' WHERE id='".$app["charid"]."' LIMIT 1", "users");
|
||||
$updateguild = doquery("UPDATE {{table}} SET members=members+1 WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds");
|
||||
$deleteapp = doquery("DELETE FROM {{table}} WHERE guild='".$userrow["guild"]."' AND charid='$charid' LIMIT 1", "guildapps");
|
||||
$send = doquery("INSERT INTO {{table}} SET id='', postdate=NOW(), senderid='0', sendername='".$guild["name"]."', recipientid='$charid', recipientname='".$member["charname"]."', status='0', title='Guild Approval', message='The Guild has approved you for membership, and you are now a member of ".$guild["name"].". Congratulations!<br /><br /><b>Do not reply to this message!</b>', gold='0'", "messages");
|
||||
$updatemem = doquery("UPDATE <<users>> SET guild='".$userrow["guild"]."', guildrank='1', guildtag='".$guild["tagline"]."', tagcolor='".$guild["color1"]."', namecolor='".$guild["color2"]."' WHERE id='".$app["charid"]."' LIMIT 1");
|
||||
$updateguild = doquery("UPDATE <<guilds>> SET members=members+1 WHERE id='".$userrow["guild"]."' LIMIT 1");
|
||||
$deleteapp = doquery("DELETE FROM <<guildapps>> WHERE guild='".$userrow["guild"]."' AND charid='$charid' LIMIT 1");
|
||||
$send = doquery("INSERT INTO <<messages>> SET id='', postdate=NOW(), senderid='0', sendername='".$guild["name"]."', recipientid='$charid', recipientname='".$member["charname"]."', status='0', title='Guild Approval', message='The Guild has approved you for membership, and you are now a member of ".$guild["name"].". Congratulations!<br /><br /><b>Do not reply to this message!</b>', gold='0'");
|
||||
guildupdate();
|
||||
display("Approve Members", "Thank you for approving this user.<br /><br />You may now return to <a href=\"index.php\">Town</a> or to your <a href=\"index.php?do=guildhome\">Guild Hall</a>.");
|
||||
} else {
|
||||
$deleteapp = doquery("DELETE FROM {{table}} WHERE guild='".$userrow["guild"]."' AND charid='$charid' LIMIT 1", "guildapps");
|
||||
$send = doquery("INSERT INTO {{table}} SET id='', postdate=NOW(), senderid='0', sendername='".$guild["name"]."', recipientid='$charid', recipientname='".$member["charname"]."', status='0', title='Guild Denial', message='The Guild has denied your application for membership. Sorry.<br /><br /><b>Do not reply to this message!</b>', gold='0'", "messages");
|
||||
$deleteapp = doquery("DELETE FROM <<guilds>> WHERE guild='".$userrow["guild"]."' AND charid='$charid' LIMIT 1");
|
||||
$send = doquery("INSERT INTO <<messages>> SET id='', postdate=NOW(), senderid='0', sendername='".$guild["name"]."', recipientid='$charid', recipientname='".$member["charname"]."', status='0', title='Guild Denial', message='The Guild has denied your application for membership. Sorry.<br /><br /><b>Do not reply to this message!</b>', gold='0'");
|
||||
display("Approve Members", "Thank you for denying this user.<br /><br />You may now return to <a href=\"index.php\">Town</a> or to your <a href=\"index.php?do=guildhome\">Guild Hall</a>.");
|
||||
}
|
||||
|
||||
|
@ -391,14 +391,14 @@ function guildremove() {
|
|||
global $userrow;
|
||||
extract($_POST);
|
||||
|
||||
$guild = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds"));
|
||||
$member = dorow(doquery("SELECT * FROM {{table}} WHERE id='$charid' LIMIT 1", "users"));
|
||||
$guild = dorow(doquery("SELECT * FROM <<guilds>> WHERE id='".$userrow["guild"]."' LIMIT 1"));
|
||||
$member = dorow(doquery("SELECT * FROM <<users>> WHERE id='$charid' LIMIT 1"));
|
||||
|
||||
if (isset($_POST["yes"])) {
|
||||
|
||||
$update = doquery("UPDATE {{table}} SET members=members-1 WHERE id='".$guild["id"]."' LIMIT 1", "guilds");
|
||||
$updatemem = doquery("UPDATE {{table}} SET guild='0', guildrank='0', guildtag='', tagcolor='', namecolor='' WHERE id='$charid' LIMIT 1", "users");
|
||||
$send = doquery("INSERT INTO {{table}} SET id='', postdate=NOW(), senderid='0', sendername='".$guild["name"]."', recipientid='$charid', recipientname='".$member["charname"]."', status='0', title='Guild Removal', message='The Guild has removed you from their membership. Sorry.<br /><br /><b>Do not reply to this message!</b>', gold='0'", "messages");
|
||||
$update = doquery("UPDATE <<guilds>> SET members=members-1 WHERE id='".$guild["id"]."' LIMIT 1");
|
||||
$updatemem = doquery("UPDATE <<users>> SET guild='0', guildrank='0', guildtag='', tagcolor='', namecolor='' WHERE id='$charid' LIMIT 1");
|
||||
$send = doquery("INSERT INTO <<messages>> SET id='', postdate=NOW(), senderid='0', sendername='".$guild["name"]."', recipientid='$charid', recipientname='".$member["charname"]."', status='0', title='Guild Removal', message='The Guild has removed you from their membership. Sorry.<br /><br /><b>Do not reply to this message!</b>', gold='0'");
|
||||
guildupdate();
|
||||
display("Remove Members", "Thank you for removing this user.<br /><br />You may now return to <a href=\"index.php\">Town</a> or to your <a href=\"index.php?do=guildhome\">Guild Hall</a>.");
|
||||
|
||||
|
@ -419,14 +419,14 @@ function guildnews() {
|
|||
|
||||
global $userrow;
|
||||
|
||||
$guild = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds"));
|
||||
$guild = dorow(doquery("SELECT * FROM <<guilds>> WHERE id='".$userrow["guild"]."' LIMIT 1"));
|
||||
|
||||
// Errors.
|
||||
if ($userrow["guildrank"] < 5) { err("You do not have permission to edit Guild news. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
|
||||
if (isset($_POST["submit"])) {
|
||||
|
||||
$query = doquery("UPDATE {{table}} SET news='".$_POST["news"]."' WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds");
|
||||
$query = doquery("UPDATE <<guilds>> SET news='".$_POST["news"]."' WHERE id='".$userrow["guild"]."' LIMIT 1");
|
||||
display("Guild News", "Thank you for updating your Guild News.<br /><br />You may now return to <a href=\"index.php\">Town</a> or to your <a href=\"index.php?do=guildhome\">Guild Hall</a>.");
|
||||
|
||||
}
|
||||
|
@ -440,20 +440,20 @@ function guilddisband() {
|
|||
|
||||
global $userrow;
|
||||
|
||||
$guild = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds"));
|
||||
$guild = dorow(doquery("SELECT * FROM <<guilds>> WHERE id='".$userrow["guild"]."' LIMIT 1"));
|
||||
|
||||
// Errors.
|
||||
if ($userrow["id"] != $guild["founder"]) { err("You do not have permission to disband the Guild. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
|
||||
if (isset($_POST["yes"])) {
|
||||
|
||||
$guildmembers = dorow(doquery("SELECT * FROM {{table}} WHERE guild='".$guild["id"]."'", "users"), "id");
|
||||
$guildmembers = dorow(doquery("SELECT * FROM <<users>> WHERE guild='".$guild["id"]."'"), "id");
|
||||
foreach ($guildmembers as $a => $b) {
|
||||
$send = doquery("INSERT INTO {{table}} SET id='', postdate=NOW(), senderid='0', sendername='".$guild["name"]."', recipientid='".$b["id"]."', recipientname='".$b["charname"]."', status='0', title='Guild Disbanded', message='Your Guild leader has chosen to disband the guild. Your member status has been reset, and you can now apply to join another guild if you wish.<br /><br /><b>Do not reply to this message!</b>', gold='0'", "messages");
|
||||
$send = doquery("INSERT INTO <<messages>> SET id='', postdate=NOW(), senderid='0', sendername='".$guild["name"]."', recipientid='".$b["id"]."', recipientname='".$b["charname"]."', status='0', title='Guild Disbanded', message='Your Guild leader has chosen to disband the guild. Your member status has been reset, and you can now apply to join another guild if you wish.<br /><br /><b>Do not reply to this message!</b>', gold='0'");
|
||||
}
|
||||
$updatemem = doquery("UPDATE {{table}} SET guild='0', guildrank='0', guildtag='', tagcolor='', namecolor='' WHERE guild='".$guild["id"]."'", "users");
|
||||
$delete = doquery("DELETE FROM {{table}} WHERE id='".$guild["id"]."'", "guilds");
|
||||
$deletebb = doquery("DELETE FROM {{table}} WHERE guild='".$guild["id"]."'", "babblebox");
|
||||
$updatemem = doquery("UPDATE <<users>> SET guild='0', guildrank='0', guildtag='', tagcolor='', namecolor='' WHERE guild='".$guild["id"]."'");
|
||||
$delete = doquery("DELETE FROM <<guilds>> WHERE id='".$guild["id"]."'");
|
||||
$deletebb = doquery("DELETE FROM <<babblebox>> WHERE guild='".$guild["id"]."'");
|
||||
display("Disband Guild", "Thank you for disbanding your Guild.<br /><br />You may now return to <a href=\"index.php\">Town</a>.");
|
||||
|
||||
} elseif (isset($_POST["no"])) {
|
||||
|
@ -474,8 +474,8 @@ function guildleave() {
|
|||
|
||||
if (isset($_POST["yes"])) {
|
||||
|
||||
$updatemem = doquery("UPDATE {{table}} SET guild='0', guildrank='0', guildtag='', tagcolor='', namecolor='' WHERE id='".$userrow["id"]."'", "users");
|
||||
$update = doquery("UPDATE {{table}} SET members=members-1 WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds");
|
||||
$updatemem = doquery("UPDATE <<users>> SET guild='0', guildrank='0', guildtag='', tagcolor='', namecolor='' WHERE id='".$userrow["id"]."'");
|
||||
$update = doquery("UPDATE <<guilds>> SET members=members-1 WHERE id='".$userrow["guild"]."' LIMIT 1");
|
||||
guildupdate();
|
||||
display("Leave Guild", "Thank you for leaving your Guild.<br /><br />You may now return to <a href=\"index.php\">Town</a>.");
|
||||
|
||||
|
@ -493,8 +493,8 @@ function guildupdate() {
|
|||
|
||||
global $userrow;
|
||||
|
||||
$guild = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds"));
|
||||
$users = dorow(doquery("SELECT * FROM {{table}} WHERE guild='".$userrow["guild"]."'", "users"), "id");
|
||||
$guild = dorow(doquery("SELECT * FROM <<guilds>> WHERE id='".$userrow["guild"]."' LIMIT 1"));
|
||||
$users = dorow(doquery("SELECT * FROM <<users>> WHERE guild='".$userrow["guild"]."'"), "id");
|
||||
|
||||
$honor = $guild["members"];
|
||||
$totalexp = 0;
|
||||
|
@ -506,7 +506,7 @@ function guildupdate() {
|
|||
$honor += floor(sqrt($totalexp));
|
||||
|
||||
$lastupdate = mktime();
|
||||
$update = doquery("UPDATE {{table}} SET honor='$honor',lastupdate='$lastupdate' WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds");
|
||||
$update = doquery("UPDATE <<guilds>> SET honor='$honor',lastupdate='$lastupdate' WHERE id='".$userrow["guild"]."' LIMIT 1");
|
||||
|
||||
// Now update the array and send back to main guild function.
|
||||
$guild["honor"] = $honor;
|
||||
|
|
BIN
images/Thumbs.db
258
lib.php
|
@ -4,26 +4,53 @@
|
|||
$starttime = getmicrotime();
|
||||
$numqueries = 0;
|
||||
$link = opendb();
|
||||
$version = "Beta 3";
|
||||
$bnumber = "16";
|
||||
$bname = "Road Rage";
|
||||
$bdate = "4.26.2006";
|
||||
$version = "Beta 4";
|
||||
$bnumber = "17";
|
||||
$bname = "Haiku";
|
||||
$bdate = "8.09.2006";
|
||||
include("lib2.php");
|
||||
|
||||
// Handling for servers with magic_quotes turned on.
|
||||
// Example from php.net.
|
||||
if (get_magic_quotes_gpc()) {
|
||||
|
||||
$_POST = array_map('stripslashes_deep', $_POST);
|
||||
$_GET = array_map('stripslashes_deep', $_GET);
|
||||
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
|
||||
$_POST = array_map('uber_ss', $_POST);
|
||||
$_GET = array_map('uber_ss', $_GET);
|
||||
$_COOKIE = array_map('uber_ss', $_COOKIE);
|
||||
|
||||
}
|
||||
$_POST = array_map('addslashes_deep', $_POST);
|
||||
$_POST = array_map('makesafe', $_POST);
|
||||
$_GET = array_map('addslashes_deep', $_GET);
|
||||
$_GET = array_map('makesafe', $_GET);
|
||||
$_COOKIE = array_map('addslashes_deep', $_COOKIE);
|
||||
$_COOKIE = array_map('makesafe', $_COOKIE);
|
||||
$_POST = array_map('uber_mres', $_POST);
|
||||
$_POST = array_map('uber_hsc', $_POST);
|
||||
$_GET = array_map('uber_mres', $_GET);
|
||||
$_GET = array_map('uber_hsc', $_GET);
|
||||
$_COOKIE = array_map('uber_mres', $_COOKIE);
|
||||
$_COOKIE = array_map('uber_hsc', $_COOKIE);
|
||||
|
||||
function uber_ss($value) {
|
||||
|
||||
$value = is_array($value) ?
|
||||
array_map('uber_ss', $value) :
|
||||
stripslashes($value);
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
function uber_mres($value) {
|
||||
|
||||
$value = is_array($value) ?
|
||||
array_map('uber_mres', $value) :
|
||||
mysql_real_escape_string($value);
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
function uber_hsc($value) {
|
||||
|
||||
$value = is_array($value) ?
|
||||
array_map('uber_hsc', $value) :
|
||||
htmlspecialchars($value);
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
function opendb() { // Open database connection.
|
||||
|
||||
|
@ -35,11 +62,16 @@ function opendb() { // Open database connection.
|
|||
|
||||
}
|
||||
|
||||
function doquery($query, $table) { // Something of a tiny little database abstraction layer.
|
||||
function doquery($query) { // Something of a tiny little database abstraction layer.
|
||||
|
||||
include('config.php');
|
||||
global $numqueries;
|
||||
$sqlquery = mysql_query(str_replace("{{table}}", $dbsettings["prefix"] . "_" . $table, $query)) or die(mysql_error() . "<br /><br />$query");
|
||||
global $numqueries, $controlrow;
|
||||
$sqlquery = mysql_query(preg_replace('/<<([a-zA-Z0-9_\-]+)>>/', $dbsettings["prefix"].'_$1', $query));
|
||||
|
||||
if ($sqlquery == false) {
|
||||
if ($controlrow["debug"] == 1) { die(mysql_error() . "<br /><br />" . $query); } else { die("A MySQL query error occurred. Please contact the game administrator for more help."); }
|
||||
}
|
||||
|
||||
$numqueries++;
|
||||
return $sqlquery;
|
||||
|
||||
|
@ -95,18 +127,6 @@ function parsetemplate($template, $array) { // Replace template with proper cont
|
|||
|
||||
}
|
||||
|
||||
function prettydate($uglydate) { // Change the MySQL date format (YYYY-MM-DD) into something friendlier.
|
||||
|
||||
return date("F j, Y", mktime(0,0,0,substr($uglydate, 5, 2),substr($uglydate, 8, 2),substr($uglydate, 0, 4)));
|
||||
|
||||
}
|
||||
|
||||
function prettyforumdate($uglydate) { // Change the MySQL date format (YYYY-MM-DD) into something friendlier.
|
||||
|
||||
return date("F j, Y\<\b\\r \/\>G:i", mktime(0,0,0,substr($uglydate, 5, 2),substr($uglydate, 8, 2),substr($uglydate, 0, 4)));
|
||||
|
||||
}
|
||||
|
||||
function getmicrotime() { // Used for timing script operations.
|
||||
|
||||
list($usec, $sec) = explode(" ",microtime());
|
||||
|
@ -120,36 +140,6 @@ function is_email($email) { // Thanks to "mail(at)philipp-louis.de" from php.net
|
|||
|
||||
}
|
||||
|
||||
function stripslashes_deep($value) {
|
||||
|
||||
$value = is_array($value) ?
|
||||
array_map('stripslashes_deep', $value) :
|
||||
stripslashes($value);
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
function addslashes_deep($value) {
|
||||
|
||||
$value = is_array($value) ?
|
||||
array_map('addslashes_deep', $value) :
|
||||
addslashes($value);
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
function makesafe($d) {
|
||||
|
||||
$d = str_replace("\t","",$d);
|
||||
$d = str_replace("<","<",$d);
|
||||
$d = str_replace(">",">",$d);
|
||||
$d = str_replace("\n","",$d);
|
||||
$d = str_replace("|","??",$d);
|
||||
$d = str_replace(" "," ",$d);
|
||||
return $d;
|
||||
|
||||
}
|
||||
|
||||
function mymail($to, $title, $body, $from = '') { // thanks to arto dot PLEASE dot DO dot NOT dot SPAM at artoaaltonen dot fi.
|
||||
|
||||
global $controlrow;
|
||||
|
@ -188,133 +178,10 @@ function mymail($to, $title, $body, $from = '') { // thanks to arto dot PLEASE d
|
|||
function err($error, $system = false, $panels = true) { // Basic little error handler.
|
||||
|
||||
display("Error", $error, $panels);
|
||||
/*
|
||||
// Don't display major system errors (sql errors).
|
||||
if ($system == true) {
|
||||
if ($handle = fopen("errorlog/errorlog.txt", 'a')) {
|
||||
$written = fwrite($handle, $error."\n");
|
||||
fclose($handle);
|
||||
}
|
||||
if ($written != false) {
|
||||
display("Error", "A critical game system error has occurred.<br /><br />Please have the game administrator check the game error logs and fix the problem.<br /><br />Please <a href=\"index.php\">go back</a> and try again.");
|
||||
} else {
|
||||
display("Error", "A critical game system error has occurred. Additionally, an error occurred when trying to create a game error log entry. Please have the game administrator check the server logs and fix the problem.<br /><br />Please <a href=\"index.php\">go back</a> and try again.");
|
||||
}
|
||||
} else {
|
||||
display("Error", $error);
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
function updateuserrow() {
|
||||
|
||||
global $userrow;
|
||||
$userrow = array_map("addslashes", $userrow);
|
||||
|
||||
$querystring = "";
|
||||
foreach($userrow as $a=>$b) {
|
||||
$querystring .= "$a='$b',";
|
||||
}
|
||||
$querystring = rtrim($querystring, ",");
|
||||
|
||||
$query = doquery("UPDATE {{table}} SET $querystring WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||
|
||||
}
|
||||
|
||||
function builditem($prefix, $baseitem, $suffix, $modrow) { // Copy of town.php's builditem().
|
||||
|
||||
global $controlrow, $acctrow, $userrow;
|
||||
|
||||
// First setup the basic item attributes.
|
||||
$baseitem["baseid"] = $baseitem["id"];
|
||||
$baseitem["fullid"] = $baseitem["id"];
|
||||
$baseitem["attrtype"] = $modrow[$baseitem["basename"]]["prettyname"];
|
||||
$baseitem["basevalue"] = $baseitem["baseattr"];
|
||||
$baseitem["image"] = "";
|
||||
|
||||
// Next give pretty names to any item modifiers.
|
||||
$baseitem["itemmods"] = "";
|
||||
for($j=1; $j<7; $j++) {
|
||||
if ($baseitem["mod".$j."name"] != "") {
|
||||
$baseitem["itemmods"] .= $modrow[$baseitem["mod".$j."name"]]["prettyname"] . ": +" . $baseitem["mod".$j."attr"];
|
||||
if ($modrow[$baseitem["mod".$j."name"]]["percent"] == 1) { $baseitem["itemmods"] .= "%"; }
|
||||
$baseitem["itemmods"] .= "<br />\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Add prefix mods if applicable.
|
||||
if ($prefix != false) {
|
||||
$baseitem["fullid"] = $prefix["id"] . "," . $baseitem["fullid"];
|
||||
$baseitem["name"] = $prefix["name"] . " " . $baseitem["name"];
|
||||
$baseitem["buycost"] += $prefix["buycost"];
|
||||
$baseitem["sellcost"] += $prefix["sellcost"];
|
||||
$baseitem["reqlevel"] = max($baseitem["reqlevel"], $prefix["reqlevel"]);
|
||||
$baseitem["reqstrength"] += $prefix["reqstrength"];
|
||||
$baseitem["reqenergy"] += $prefix["reqenergy"];
|
||||
$baseitem["reqdexterity"] += $prefix["reqdexterity"];
|
||||
$baseitem["itemmods"] .= $modrow[$prefix["basename"]]["prettyname"] . ": +" . $prefix["baseattr"];
|
||||
if ($modrow[$prefix["basename"]]["percent"] == 1) { $baseitem["itemmods"] .= "%"; }
|
||||
$baseitem["itemmods"] .= "<br />\n";
|
||||
} else { $baseitem["fullid"] = "0," . $baseitem["fullid"]; }
|
||||
|
||||
// Add suffix mods if applicable.
|
||||
if ($suffix != false) {
|
||||
$baseitem["fullid"] .= "," . $suffix["id"];
|
||||
$baseitem["name"] .= " " . $suffix["name"];
|
||||
$baseitem["buycost"] += $suffix["buycost"];
|
||||
$baseitem["sellcost"] += $suffix["sellcost"];
|
||||
$baseitem["reqlevel"] = max($baseitem["reqlevel"], $suffix["reqlevel"]);
|
||||
$baseitem["reqstrength"] += $suffix["reqstrength"];
|
||||
$baseitem["reqenergy"] += $suffix["reqenergy"];
|
||||
$baseitem["reqdexterity"] += $suffix["reqdexterity"];
|
||||
$baseitem["itemmods"] .= $modrow[$suffix["basename"]]["prettyname"] . ": +" . $suffix["baseattr"];
|
||||
if ($modrow[$suffix["basename"]]["percent"] == 1) { $baseitem["itemmods"] .= "%"; }
|
||||
$baseitem["itemmods"] .= "<br />\n";
|
||||
} else { $baseitem["fullid"] .= ",0"; }
|
||||
|
||||
// Check requirements.
|
||||
$baseitem["requirements"] = true;
|
||||
if ($baseitem["reqlevel"] == 1) { $baseitem["level"] = ""; } else {
|
||||
$baseitem["level"] = "Required Level: " . $baseitem["reqlevel"];
|
||||
if ($baseitem["reqlevel"] > $userrow["level"]) {
|
||||
$baseitem["level"] = "<span class=\"red\">".$baseitem["level"]."</span>";
|
||||
$baseitem["requirements"] = false;
|
||||
}
|
||||
$baseitem["level"] .= "<br />\n";
|
||||
}
|
||||
if ($baseitem["reqstrength"] == 0) { $baseitem["strength"] = ""; } else {
|
||||
$baseitem["strength"] = "Required Strength: " . $baseitem["reqstrength"];
|
||||
if ($baseitem["reqstrength"] > $userrow["strength"]) {
|
||||
$baseitem["strength"] = "<span class=\"red\">".$baseitem["strength"]."</span>";
|
||||
$baseitem["requirements"] = false;
|
||||
}
|
||||
$baseitem["strength"] .= "<br />\n";
|
||||
}
|
||||
if ($baseitem["reqdexterity"] == 0) { $baseitem["dexterity"] = ""; } else {
|
||||
$baseitem["dexterity"] = "Required Dexterity: " . $baseitem["reqdexterity"];
|
||||
if ($baseitem["reqdexterity"] > $userrow["dexterity"]) {
|
||||
$baseitem["dexterity"] = "<span class=\"red\">".$baseitem["dexterity"]."</span>";
|
||||
$baseitem["requirements"] = false;
|
||||
}
|
||||
$baseitem["dexterity"] .= "<br />\n";
|
||||
}
|
||||
if ($baseitem["reqenergy"] == 0) { $baseitem["energy"] = ""; } else {
|
||||
$baseitem["energy"] = "Required Energy: " . $baseitem["reqenergy"];
|
||||
if ($baseitem["reqenergy"] > $userrow["energy"]) {
|
||||
$baseitem["energy"] = "<span class=\"red\">".$baseitem["energy"]."</span>";
|
||||
$baseitem["requirements"] = false;
|
||||
}
|
||||
$baseitem["energy"] .= "<br />\n";
|
||||
}
|
||||
|
||||
if ($controlrow["showimages"] == 1) {
|
||||
$baseitem["image"] = "<img src=\"images/items/".$baseitem["slotnumber"].$acctrow["imageformat"]."\" alt=\"".$baseitem["name"]."\" title=\"".$baseitem["name"]."\" />";
|
||||
}
|
||||
|
||||
// And send it back.
|
||||
return $baseitem;
|
||||
|
||||
}
|
||||
|
||||
function display($title, $content, $panels = true) { // Finalize page and output to browser.
|
||||
|
||||
|
@ -322,7 +189,7 @@ function display($title, $content, $panels = true) { // Finalize page and output
|
|||
global $controlrow, $userrow, $worldrow, $numqueries, $starttime, $version, $build;
|
||||
|
||||
if (!isset($controlrow)) {
|
||||
$controlrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control"));
|
||||
$controlrow = dorow(doquery("SELECT * FROM <<control>> WHERE id='1' LIMIT 1"));
|
||||
}
|
||||
|
||||
// Make page tags for XHTML validation.
|
||||
|
@ -337,10 +204,9 @@ function display($title, $content, $panels = true) { // Finalize page and output
|
|||
$row["pagetitle"] = $title;
|
||||
$row["background"] = "background" . $userrow["world"];
|
||||
$row["version"] = $version;
|
||||
$row["numqueries"] = $numqueries;
|
||||
$row["totaltime"] = round(getmicrotime()-$starttime,4);
|
||||
$row["content"] = $content;
|
||||
if ($controlrow["forumurl"] != "") { $row["forumslink"] = "<a href=\"".$controlrow["forumurl"]."\">Support Forums</a>"; } else { $row["forumslink"] = ""; }
|
||||
if ($controlrow["debug"] == 1) { $row["debug"] = "/ " . $numqueries . " Queries / " . round(getmicrotime()-$starttime,4) . " Seconds"; } else { $row["debug"] = ""; }
|
||||
|
||||
// Setup for side panels.
|
||||
include("panels.php");
|
||||
|
@ -357,7 +223,25 @@ function display($title, $content, $panels = true) { // Finalize page and output
|
|||
$row["bottomnav"] = "";
|
||||
}
|
||||
|
||||
//if(md5_file("templates/primary.php") != "0aeec5eb64ff875a697142528afe8fc7") { die("Primary template modified. Cannot continue."); }
|
||||
$page = rtrim($page, "<-!");
|
||||
|
||||
$page .= <<<THEVERYENDOFYOU
|
||||
<table cellspacing="0" cellpadding="3" style="width: 800px; border: solid 1px black; background-color: white; margin-top: 2px;">
|
||||
<tr>
|
||||
<td width="40%">
|
||||
Version <a href="index.php?do=version">{{version}}</a> {{debug}}
|
||||
</td>
|
||||
<td width="20%" style="text-align: center;">
|
||||
{{forumslink}}
|
||||
</td>
|
||||
<td width="40%" style="text-align:right;">
|
||||
<a href="http://www.dragonscourge.com">Dragon Scourge</a> © by <a href="http://www.renderse7en.com">renderse7en</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center></body>
|
||||
</html>
|
||||
THEVERYENDOFYOU;
|
||||
|
||||
// Finalize control array for output.
|
||||
$page = parsetemplate($page, $row);
|
||||
|
|
117
lib2.php
Normal file
|
@ -0,0 +1,117 @@
|
|||
<?php // lib2.php :: functions with an arguably narrower focus than the stuff in the primary library.
|
||||
|
||||
function updateuserrow() {
|
||||
|
||||
global $userrow;
|
||||
$userrow = array_map("addslashes", $userrow);
|
||||
|
||||
$querystring = "";
|
||||
foreach($userrow as $a=>$b) {
|
||||
$querystring .= "$a='$b',";
|
||||
}
|
||||
$querystring = rtrim($querystring, ",");
|
||||
|
||||
$query = doquery("UPDATE <<users>> SET $querystring WHERE id='".$userrow["id"]."' LIMIT 1");
|
||||
|
||||
}
|
||||
|
||||
function builditem($prefix, $baseitem, $suffix, $modrow) { // Copy of town.php's builditem().
|
||||
|
||||
global $controlrow, $acctrow, $userrow;
|
||||
|
||||
// First setup the basic item attributes.
|
||||
$baseitem["baseid"] = $baseitem["id"];
|
||||
$baseitem["fullid"] = $baseitem["id"];
|
||||
$baseitem["attrtype"] = $modrow[$baseitem["basename"]]["prettyname"];
|
||||
$baseitem["basevalue"] = $baseitem["baseattr"];
|
||||
$baseitem["image"] = "";
|
||||
|
||||
// Next give pretty names to any item modifiers.
|
||||
$baseitem["itemmods"] = "";
|
||||
for($j=1; $j<7; $j++) {
|
||||
if ($baseitem["mod".$j."name"] != "") {
|
||||
$baseitem["itemmods"] .= $modrow[$baseitem["mod".$j."name"]]["prettyname"] . ": +" . $baseitem["mod".$j."attr"];
|
||||
if ($modrow[$baseitem["mod".$j."name"]]["percent"] == 1) { $baseitem["itemmods"] .= "%"; }
|
||||
$baseitem["itemmods"] .= "<br />\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Add prefix mods if applicable.
|
||||
if ($prefix != false) {
|
||||
$baseitem["fullid"] = $prefix["id"] . "," . $baseitem["fullid"];
|
||||
$baseitem["name"] = $prefix["name"] . " " . $baseitem["name"];
|
||||
$baseitem["buycost"] += $prefix["buycost"];
|
||||
$baseitem["sellcost"] += $prefix["sellcost"];
|
||||
$baseitem["reqlevel"] = max($baseitem["reqlevel"], $prefix["reqlevel"]);
|
||||
$baseitem["reqstrength"] += $prefix["reqstrength"];
|
||||
$baseitem["reqenergy"] += $prefix["reqenergy"];
|
||||
$baseitem["reqdexterity"] += $prefix["reqdexterity"];
|
||||
$baseitem["itemmods"] .= $modrow[$prefix["basename"]]["prettyname"] . ": +" . $prefix["baseattr"];
|
||||
if ($modrow[$prefix["basename"]]["percent"] == 1) { $baseitem["itemmods"] .= "%"; }
|
||||
$baseitem["itemmods"] .= "<br />\n";
|
||||
} else { $baseitem["fullid"] = "0," . $baseitem["fullid"]; }
|
||||
|
||||
// Add suffix mods if applicable.
|
||||
if ($suffix != false) {
|
||||
$baseitem["fullid"] .= "," . $suffix["id"];
|
||||
$baseitem["name"] .= " " . $suffix["name"];
|
||||
$baseitem["buycost"] += $suffix["buycost"];
|
||||
$baseitem["sellcost"] += $suffix["sellcost"];
|
||||
$baseitem["reqlevel"] = max($baseitem["reqlevel"], $suffix["reqlevel"]);
|
||||
$baseitem["reqstrength"] += $suffix["reqstrength"];
|
||||
$baseitem["reqenergy"] += $suffix["reqenergy"];
|
||||
$baseitem["reqdexterity"] += $suffix["reqdexterity"];
|
||||
$baseitem["itemmods"] .= $modrow[$suffix["basename"]]["prettyname"] . ": +" . $suffix["baseattr"];
|
||||
if ($modrow[$suffix["basename"]]["percent"] == 1) { $baseitem["itemmods"] .= "%"; }
|
||||
$baseitem["itemmods"] .= "<br />\n";
|
||||
} else { $baseitem["fullid"] .= ",0"; }
|
||||
|
||||
// Check requirements.
|
||||
$baseitem["requirements"] = true;
|
||||
if ($baseitem["reqlevel"] == 1) { $baseitem["level"] = ""; } else {
|
||||
$baseitem["level"] = "Required Level: " . $baseitem["reqlevel"];
|
||||
if ($baseitem["reqlevel"] > $userrow["level"]) {
|
||||
$baseitem["level"] = "<span class=\"red\">".$baseitem["level"]."</span>";
|
||||
$baseitem["requirements"] = false;
|
||||
}
|
||||
$baseitem["level"] .= "<br />\n";
|
||||
}
|
||||
if ($baseitem["reqstrength"] == 0) { $baseitem["strength"] = ""; } else {
|
||||
$baseitem["strength"] = "Required Strength: " . $baseitem["reqstrength"];
|
||||
if ($baseitem["reqstrength"] > $userrow["strength"]) {
|
||||
$baseitem["strength"] = "<span class=\"red\">".$baseitem["strength"]."</span>";
|
||||
$baseitem["requirements"] = false;
|
||||
}
|
||||
$baseitem["strength"] .= "<br />\n";
|
||||
}
|
||||
if ($baseitem["reqdexterity"] == 0) { $baseitem["dexterity"] = ""; } else {
|
||||
$baseitem["dexterity"] = "Required Dexterity: " . $baseitem["reqdexterity"];
|
||||
if ($baseitem["reqdexterity"] > $userrow["dexterity"]) {
|
||||
$baseitem["dexterity"] = "<span class=\"red\">".$baseitem["dexterity"]."</span>";
|
||||
$baseitem["requirements"] = false;
|
||||
}
|
||||
$baseitem["dexterity"] .= "<br />\n";
|
||||
}
|
||||
if ($baseitem["reqenergy"] == 0) { $baseitem["energy"] = ""; } else {
|
||||
$baseitem["energy"] = "Required Energy: " . $baseitem["reqenergy"];
|
||||
if ($baseitem["reqenergy"] > $userrow["energy"]) {
|
||||
$baseitem["energy"] = "<span class=\"red\">".$baseitem["energy"]."</span>";
|
||||
$baseitem["requirements"] = false;
|
||||
}
|
||||
$baseitem["energy"] .= "<br />\n";
|
||||
}
|
||||
|
||||
if ($controlrow["showitemimages"] == 1) {
|
||||
$baseitem["image"] = "<img src=\"images/items/".$baseitem["slotnumber"].$acctrow["imageformat"]."\" alt=\"".$baseitem["name"]."\" title=\"".$baseitem["name"]."\" />";
|
||||
} elseif ($controlrow["showitemimages"] == 2) {
|
||||
$baseitem["image"] = "<img src=\"images/items/".$baseitem["id"].$acctrow["imageformat"]."\" alt=\"".$baseitem["name"]."\" title=\"".$baseitem["name"]."\" />";
|
||||
} else {
|
||||
$baseitem["image"] = "";
|
||||
}
|
||||
|
||||
// And send it back.
|
||||
return $baseitem;
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -18,7 +18,7 @@ function login() {
|
|||
// Setup.
|
||||
include("config.php");
|
||||
extract($_POST);
|
||||
$query = doquery("SELECT * FROM {{table}} WHERE username='$username' LIMIT 1", "accounts");
|
||||
$query = doquery("SELECT * FROM <<accounts>> WHERE username='$username' LIMIT 1");
|
||||
$row = dorow($query);
|
||||
|
||||
// Errors.
|
||||
|
|
24
mailbox.php
|
@ -8,7 +8,7 @@ function mailbox() {
|
|||
|
||||
global $userrow;
|
||||
|
||||
$messages = dorow(doquery("SELECT *, DATE_FORMAT(postdate, '%m.%d.%Y ~ %H:%i') AS fpostdate FROM {{table}} WHERE recipientid='".$userrow["id"]."' ORDER BY postdate DESC", "messages"), "id");
|
||||
$messages = dorow(doquery("SELECT *, DATE_FORMAT(postdate, '%m.%d.%Y ~ %H:%i') AS fpostdate FROM <<messages>> WHERE recipientid='".$userrow["id"]."' ORDER BY postdate DESC"), "id");
|
||||
$row["messages"] = "<table width=\"97%\">\n";
|
||||
|
||||
if ($messages == false) {
|
||||
|
@ -30,7 +30,7 @@ function outbox() {
|
|||
|
||||
global $userrow;
|
||||
|
||||
$messages = dorow(doquery("SELECT *, DATE_FORMAT(postdate, '%m.%d.%Y ~ %H:%i') AS fpostdate FROM {{table}} WHERE senderid='".$userrow["id"]."' ORDER BY postdate DESC", "messages"), "id");
|
||||
$messages = dorow(doquery("SELECT *, DATE_FORMAT(postdate, '%m.%d.%Y ~ %H:%i') AS fpostdate FROM <<messages>> WHERE senderid='".$userrow["id"]."' ORDER BY postdate DESC"), "id");
|
||||
$row["messages"] = "<table width=\"97%\">\n";
|
||||
|
||||
if ($messages == false) {
|
||||
|
@ -51,7 +51,7 @@ function letter() {
|
|||
global $userrow;
|
||||
|
||||
if (!is_numeric($_GET["id"])) { err("Invalid action. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
$message = dorow(doquery("SELECT *, DATE_FORMAT(postdate, '%m.%d.%Y ~ %H:%i') AS fpostdate FROM {{table}} WHERE id='".$_GET["id"]."' LIMIT 1", "messages"));
|
||||
$message = dorow(doquery("SELECT *, DATE_FORMAT(postdate, '%m.%d.%Y ~ %H:%i') AS fpostdate FROM <<messages>> WHERE id='".$_GET["id"]."' LIMIT 1"));
|
||||
if ($message == false) { err("Invalid action. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
if ($message["recipientid"] != $userrow["id"]) { err("Invalid action. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
|
||||
|
@ -65,11 +65,11 @@ function letter() {
|
|||
|
||||
// Reset status to old, and gold to zero, so they can't keep reading the message to get more money.
|
||||
if ($message["status"] == 0) {
|
||||
$statusquery = doquery("UPDATE {{table}} SET status='1', gold='0' WHERE id='".$_GET["id"]."' LIMIT 1", "messages");
|
||||
$statusquery = doquery("UPDATE <<messages>> SET status='1', gold='0' WHERE id='".$_GET["id"]."' LIMIT 1");
|
||||
}
|
||||
|
||||
// Pull the sender's userrow so we can show avatars.
|
||||
$sender = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$message["senderid"]."' LIMIT 1", "users"));
|
||||
$sender = dorow(doquery("SELECT * FROM <<users>> WHERE id='".$message["senderid"]."' LIMIT 1"));
|
||||
if ($sender["charpicture"] != "") {
|
||||
$message["senderavatar"] = "<img src=\"".$sender["charpicture"]."\" alt=\"".$sender["charname"]."\" width=\"50\" height=\"50\" />";
|
||||
} else {
|
||||
|
@ -86,7 +86,7 @@ function letterout() {
|
|||
global $userrow;
|
||||
|
||||
if (!is_numeric($_GET["id"])) { err("Invalid action. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
$message = dorow(doquery("SELECT *, DATE_FORMAT(postdate, '%m.%d.%Y ~ %H:%i') AS fpostdate FROM {{table}} WHERE id='".$_GET["id"]."' LIMIT 1", "messages"));
|
||||
$message = dorow(doquery("SELECT *, DATE_FORMAT(postdate, '%m.%d.%Y ~ %H:%i') AS fpostdate FROM <<messages>> WHERE id='".$_GET["id"]."' LIMIT 1"));
|
||||
if ($message == false) { err("Invalid action. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
if ($message["senderid"] != $userrow["id"]) { err("Invalid action. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
|
||||
|
@ -105,7 +105,7 @@ function mailnew() {
|
|||
extract($_POST);
|
||||
$errors = 0; $errorlist = "";
|
||||
if ($userrow["gold"] < 5) { $errors++; $errorlist .= "You do not have enough gold to cover the postage fee.<br />"; }
|
||||
$checkuser = dorow(doquery("SELECT * FROM {{table}} WHERE charname='$recipient' LIMIT 1", "users"));
|
||||
$checkuser = dorow(doquery("SELECT * FROM <<users>> WHERE charname='$recipient' LIMIT 1"));
|
||||
if ($checkuser == false) { $errors++; $errorlist .= "There is no player with that Character Name.<br />"; }
|
||||
if (trim($gold) != "") {
|
||||
if (!is_numeric($gold)) { $errors++; $errorlist .= "The Send Gold field must be a number.<br />"; }
|
||||
|
@ -124,7 +124,7 @@ function mailnew() {
|
|||
updateuserrow();
|
||||
|
||||
// And send the message.
|
||||
$send = doquery("INSERT INTO {{table}} SET id='', postdate=NOW(), senderid='".$userrow["id"]."', sendername='".$userrow["charname"]."', recipientid='".$checkuser["id"]."', recipientname='$recipient', status='0', title='$title', message='$message', gold='$gold'", "messages");
|
||||
$send = doquery("INSERT INTO <<messages>> SET id='', postdate=NOW(), senderid='".$userrow["id"]."', sendername='".$userrow["charname"]."', recipientid='".$checkuser["id"]."', recipientname='$recipient', status='0', title='$title', message='$message', gold='$gold'");
|
||||
display("Post Office", gettemplate("mailbox_sent"));
|
||||
|
||||
} else {
|
||||
|
@ -145,7 +145,7 @@ function mailreply() {
|
|||
global $userrow;
|
||||
|
||||
if (!is_numeric($_GET["id"])) { err("Invalid action. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
$origmessage = dorow(doquery("SELECT *, DATE_FORMAT(postdate, '%m.%d.%Y ~ %H:%i') AS fpostdate FROM {{table}} WHERE id='".$_GET["id"]."' LIMIT 1", "messages"));
|
||||
$origmessage = dorow(doquery("SELECT *, DATE_FORMAT(postdate, '%m.%d.%Y ~ %H:%i') AS fpostdate FROM <<messages>> WHERE id='".$_GET["id"]."' LIMIT 1"));
|
||||
if ($origmessage == false) { err("Invalid action. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
if ($origmessage["recipientid"] != $userrow["id"]) { err("Invalid action. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
|
||||
|
@ -155,7 +155,7 @@ function mailreply() {
|
|||
extract($_POST);
|
||||
$errors = 0; $errorlist = "";
|
||||
if ($userrow["gold"] < 5) { $errors++; $errorlist .= "You do not have enough gold to cover the postage fee.<br />"; }
|
||||
$checkuser = dorow(doquery("SELECT * FROM {{table}} WHERE charname='".$origmessage["sendername"]."' LIMIT 1", "users"));
|
||||
$checkuser = dorow(doquery("SELECT * FROM <<users>> WHERE charname='".$origmessage["sendername"]."' LIMIT 1"));
|
||||
if ($checkuser == false) { $errors++; $errorlist .= "There is no player with that Character Name.<br />"; }
|
||||
if (trim($gold) != "") {
|
||||
if (!is_numeric($gold)) { $errors++; $errorlist .= "The Send Gold field must be a number.<br />"; }
|
||||
|
@ -173,7 +173,7 @@ function mailreply() {
|
|||
updateuserrow();
|
||||
|
||||
// And send the message.
|
||||
$send = doquery("INSERT INTO {{table}} SET id='', postdate=NOW(), senderid='".$userrow["id"]."', sendername='".$userrow["charname"]."', recipientid='".$origmessage["senderid"]."', recipientname='".$origmessage["sendername"]."', status='0', title='$title', message='$message', gold='$gold'", "messages");
|
||||
$send = doquery("INSERT INTO <<messages>> SET id='', postdate=NOW(), senderid='".$userrow["id"]."', sendername='".$userrow["charname"]."', recipientid='".$origmessage["senderid"]."', recipientname='".$origmessage["sendername"]."', status='0', title='$title', message='$message', gold='$gold'");
|
||||
display("Post Office", gettemplate("mailbox_sent"));
|
||||
|
||||
} else {
|
||||
|
@ -197,7 +197,7 @@ function maildelete() {
|
|||
global $userrow;
|
||||
|
||||
if (!is_numeric($_GET["id"])) { err("Invalid action. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
$message = dorow(doquery("SELECT *, DATE_FORMAT(postdate, '%m.%d.%Y ~ %H:%i') AS fpostdate FROM {{table}} WHERE id='".$_GET["id"]."' LIMIT 1", "messages"));
|
||||
$message = dorow(doquery("SELECT *, DATE_FORMAT(postdate, '%m.%d.%Y ~ %H:%i') AS fpostdate FROM <<messages>> WHERE id='".$_GET["id"]."' LIMIT 1"));
|
||||
if ($message == false) { err("Invalid action. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
if ($message["recipientid"] != $userrow["id"]) { err("Invalid action. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
|
||||
|
|
4
map.php
|
@ -7,7 +7,7 @@ $perpix = 500 / ($worldrow["size"] * 2);
|
|||
$text = "&";
|
||||
|
||||
// First do towns.
|
||||
$towns = dorow(doquery("SELECT * FROM {{table}} WHERE world='".$worldrow["id"]."'", "towns"));
|
||||
$towns = dorow(doquery("SELECT * FROM <<towns>> WHERE world='".$worldrow["id"]."'"));
|
||||
$text .= "towns=".sizeof($towns)."&";
|
||||
$count = 0;
|
||||
foreach($towns as $a=>$b) {
|
||||
|
@ -31,7 +31,7 @@ $text .= "player_y=".$y."&";
|
|||
$text .= "player_name=".$userrow["charname"]."&";
|
||||
|
||||
// Then do everyone else.
|
||||
$users = dorow(doquery("SELECT * FROM {{table}} WHERE world='".$worldrow["id"]."' AND UNIX_TIMESTAMP(onlinetime) >= '".(time()-600)."' AND id != '".$userrow["id"]."'", "users"), "id");
|
||||
$users = dorow(doquery("SELECT * FROM <<users>> WHERE world='".$worldrow["id"]."' AND UNIX_TIMESTAMP(onlinetime) >= '".(time()-600)."' AND id != '".$userrow["id"]."'"), "id");
|
||||
$text .= "users=".count($users)."&";
|
||||
$count = 0;
|
||||
if ($users != false) {
|
||||
|
|
|
@ -7,7 +7,7 @@ $perpix = 100 / ($worldrow["size"] * 2);
|
|||
$text = "&";
|
||||
|
||||
// First do towns.
|
||||
$towns = dorow(doquery("SELECT * FROM {{table}} WHERE world='".$worldrow["id"]."'", "towns"));
|
||||
$towns = dorow(doquery("SELECT * FROM <<towns>> WHERE world='".$worldrow["id"]."'"));
|
||||
$text .= "towns=".sizeof($towns)."&";
|
||||
$count = 0;
|
||||
foreach($towns as $a=>$b) {
|
||||
|
@ -29,7 +29,7 @@ $text .= "player_x=".$x."&";
|
|||
$text .= "player_y=".$y."&";
|
||||
|
||||
// Then do everyone else.
|
||||
$users = dorow(doquery("SELECT * FROM {{table}} WHERE world='".$worldrow["id"]."' AND UNIX_TIMESTAMP(onlinetime) >= '".(time()-600)."' AND id != '".$userrow["id"]."'", "users"), "id");
|
||||
$users = dorow(doquery("SELECT * FROM <<users>> WHERE world='".$worldrow["id"]."' AND UNIX_TIMESTAMP(onlinetime) >= '".(time()-600)."' AND id != '".$userrow["id"]."'"), "id");
|
||||
$text .= "users=".count($users)."&";
|
||||
$count = 0;
|
||||
if ($users != false) {
|
||||
|
|
12
misc.php
|
@ -3,7 +3,7 @@
|
|||
function iddqd() {
|
||||
|
||||
global $acctrow;
|
||||
doquery("UPDATE {{table}} SET extra1='1' WHERE id='".$acctrow["id"]."' LIMIT 1", "accounts");
|
||||
doquery("UPDATE <<accounts>> SET extra1='1' WHERE id='".$acctrow["id"]."' LIMIT 1");
|
||||
$page = "\"Please don't take everything I say so seriously.\"<br /><i><a href=\"http://www.nin.com\">---Trent Reznor</a></i>";
|
||||
display("LMFAO!", $page);
|
||||
|
||||
|
@ -49,14 +49,14 @@ function babblebox2() {
|
|||
|
||||
// Add new shout.
|
||||
if (trim($_POST["babble"]) != "") {
|
||||
$insert = doquery("INSERT INTO {{table}} SET id='', posttime=NOW(), charid='".$userrow["id"]."', charname='".$userrow["charname"]."', content='".$_POST["babble"]."' $g2", "babblebox");
|
||||
$insert = doquery("INSERT INTO <<babblebox>> SET id='', posttime=NOW(), charid='".$userrow["id"]."', charname='".$userrow["charname"]."', content='".$_POST["babble"]."' $g2");
|
||||
}
|
||||
|
||||
// Only keep 20 shouts in DB at any one time.
|
||||
$check = doquery("SELECT * FROM {{table}} $g", "babblebox");
|
||||
$check = doquery("SELECT * FROM <<babblebox>> $g");
|
||||
if (mysql_num_rows($check) > 20) {
|
||||
$delete1 = dorow(doquery("SELECT id FROM {{table}} $g ORDER BY id LIMIT 1", "babblebox"));
|
||||
$delete2 = doquery("DELETE FROM {{table}} WHERE id='".$delete1["id"]."' LIMIT 1", "babblebox");
|
||||
$delete1 = dorow(doquery("SELECT id FROM <<babblebox>> $g ORDER BY id LIMIT 1"));
|
||||
$delete2 = doquery("DELETE FROM <<babblebox>> WHERE id='".$delete1["id"]."' LIMIT 1");
|
||||
}
|
||||
|
||||
// And we're done.
|
||||
|
@ -64,7 +64,7 @@ function babblebox2() {
|
|||
|
||||
}
|
||||
|
||||
$shouts = dorow(doquery("SELECT * FROM {{table}} $g ORDER BY id LIMIT 20", "babblebox"), "id");
|
||||
$shouts = dorow(doquery("SELECT * FROM <<babblebox>> $g ORDER BY id LIMIT 20"), "id");
|
||||
$row["shouts"] = "";
|
||||
$background = 1;
|
||||
if ($shouts != false) {
|
||||
|
|
|
@ -61,7 +61,7 @@ THEVERYENDOFYOU;
|
|||
$townstring .= ") AND world='".$userrow["world"]."'";
|
||||
|
||||
// Then we do the query.
|
||||
$traveltoquery = dorow(doquery("SELECT id,name FROM {{table}} WHERE $townstring ORDER BY id", "towns"), "id");
|
||||
$traveltoquery = dorow(doquery("SELECT id,name FROM <<towns>> WHERE $townstring ORDER BY id"), "id");
|
||||
|
||||
// Finally we build the link list.
|
||||
foreach ($traveltoquery as $a => $b) {
|
||||
|
@ -82,13 +82,13 @@ function panelright() {
|
|||
// Babblebox.
|
||||
if ($controlrow["showshout"] == 1) {
|
||||
$row["babblebox"] = "<div class=\"big\"><b>Babblebox</b></div>";
|
||||
$row["babblebox"] .= "<iframe src=\"index.php?do=babblebox\" name=\"sbox\" width=\"100%\" height=\"200\" 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>";
|
||||
$row["babblebox"] .= "<iframe src=\"index.php?do=babblebox\" name=\"sbox\" width=\"100%\" height=\"200\" 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><br /><br />";
|
||||
}
|
||||
|
||||
// Who's Online.
|
||||
if ($controlrow["showonline"] == 1) {
|
||||
$row["whosonline"] = "<div class=\"big\"><b>Who's Online</b></div>";
|
||||
$users = dorow(doquery("SELECT * FROM {{table}} WHERE UNIX_TIMESTAMP(onlinetime) >= '".(time()-600)."'", "users"), "id");
|
||||
$users = dorow(doquery("SELECT * FROM <<users>> WHERE UNIX_TIMESTAMP(onlinetime) >= '".(time()-600)."'"), "id");
|
||||
$number = count($users);
|
||||
$row["whosonline"] .= "There are <b>$number</b> user(s) online within the last 10 minutes: ";
|
||||
foreach ($users as $a => $b) {
|
||||
|
@ -113,7 +113,7 @@ function paneltop($loggedin = true) {
|
|||
if ($loggedin == true || isset($acctrow)) {
|
||||
|
||||
if ($userrow == false) { $userrow["charname"] = "No Characters Yet"; $userrow["guild"] = 0; }
|
||||
if ($acctrow["authlevel"] == 2) { $admin = " (<a href=\"admin/index.php\">Admin</a>)"; } else { $admin = ""; }
|
||||
if ($acctrow["authlevel"] == 255) { $admin = " (<a href=\"admin/index.php\">Admin</a>)"; } else { $admin = ""; }
|
||||
if ($userrow["guild"] != 0) {
|
||||
$charname = "[<span style=\"color: ".$userrow["tagcolor"].";\">".$userrow["guildtag"]."</span>]<span style=\"color: ".$userrow["namecolor"].";\">".$userrow["charname"]."</span>";
|
||||
} else {
|
||||
|
|
58
pvp.php
|
@ -13,15 +13,15 @@ donothing();
|
|||
function donothing() {
|
||||
|
||||
global $userrow, $monsterrow, $fightrow;
|
||||
$pvp = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["currentpvp"]."' LIMIT 1", "pvp"));
|
||||
$pvp = dorow(doquery("SELECT * FROM <<pvp>> WHERE id='".$userrow["currentpvp"]."' LIMIT 1"));
|
||||
|
||||
// Check if they need to accept challenge.
|
||||
if ($pvp["accepted"] == 0 && $pvp["player2id"] == $userrow["id"]) { challenged(); }
|
||||
|
||||
// Check if challenge has been declined.
|
||||
if ($pvp["accepted"] == 2) {
|
||||
$query = doquery("UPDATE {{table}} SET currentpvp='0',currentaction='In Town' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||
$query = doquery("DELETE FROM {{table}} WHERE id='".$pvp["id"]."' LIMIT 1", "pvp");
|
||||
$query = doquery("UPDATE <<users>> SET currentpvp='0',currentaction='In Town' WHERE id='".$userrow["id"]."' LIMIT 1");
|
||||
$query = doquery("DELETE FROM <<pvp>> WHERE id='".$pvp["id"]."' LIMIT 1");
|
||||
display("Duel Challenge", gettemplate("pvp_declined"));
|
||||
}
|
||||
|
||||
|
@ -39,9 +39,9 @@ function donothing() {
|
|||
function challenged() {
|
||||
|
||||
global $userrow, $monsterrow, $fightrow;
|
||||
$pvp = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["currentpvp"]."' LIMIT 1", "pvp"));
|
||||
$pvp = dorow(doquery("SELECT * FROM <<pvp>> WHERE id='".$userrow["currentpvp"]."' LIMIT 1"));
|
||||
if ($pvp == false) { die("Location: index.php"); }
|
||||
$newuserrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$pvp["player1id"]."' LIMIT 1", "users"));
|
||||
$newuserrow = dorow(doquery("SELECT * FROM <<users>> WHERE id='".$pvp["player1id"]."' LIMIT 1"));
|
||||
|
||||
if ($newuserrow["charpicture"] != "") {
|
||||
$newuserrow["avatar"] = "<img src=\"".$newuserrow["charpicture"]."\" alt=\"".$newuserrow["charname"]."\" width=\"50\" height=\"50\" />";
|
||||
|
@ -51,14 +51,14 @@ function challenged() {
|
|||
|
||||
if (isset($_POST["yes"])) {
|
||||
|
||||
$query = doquery("UPDATE {{table}} SET accepted='1' WHERE id='".$userrow["currentpvp"]."' LIMIT 1", "pvp");
|
||||
$query = doquery("UPDATE {{table}} SET currentaction='Duelling' WHERE id='".$pvp["player1id"]."' OR id='".$pvp["player2id"]."' LIMIT 2", "users");
|
||||
$query = doquery("UPDATE <<pvp>> SET accepted='1' WHERE id='".$userrow["currentpvp"]."' LIMIT 1");
|
||||
$query = doquery("UPDATE <<users>> SET currentaction='Duelling' WHERE id='".$pvp["player1id"]."' OR id='".$pvp["player2id"]."' LIMIT 2");
|
||||
dofight();
|
||||
|
||||
} elseif (isset($_POST["no"])) {
|
||||
|
||||
$query = doquery("UPDATE {{table}} SET accepted='2',playerturn=player1id WHERE id='".$userrow["currentpvp"]."' LIMIT 1", "pvp");
|
||||
$query = doquery("UPDATE {{table}} SET currentaction='In Town', currentpvp='0' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||
$query = doquery("UPDATE <<pvp>> SET accepted='2',playerturn=player1id WHERE id='".$userrow["currentpvp"]."' LIMIT 1");
|
||||
$query = doquery("UPDATE <<users>> SET currentaction='In Town', currentpvp='0' WHERE id='".$userrow["id"]."' LIMIT 1");
|
||||
display("Duel Challenge",parsetemplate(gettemplate("pvp_decline"),$newuserrow));
|
||||
|
||||
} else {
|
||||
|
@ -72,13 +72,13 @@ function challenged() {
|
|||
function dowait() {
|
||||
|
||||
global $userrow, $monsterrow, $fightrow;
|
||||
$pvp = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["currentpvp"]."' LIMIT 1", "pvp"));
|
||||
$pvp = dorow(doquery("SELECT * FROM <<pvp>> WHERE id='".$userrow["currentpvp"]."' LIMIT 1"));
|
||||
|
||||
// "monsterrow" now becomes the other player's character.
|
||||
if ($pvp["player1id"] == $userrow["id"]) {
|
||||
$monsterrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$pvp["player2id"]."' LIMIT 1", "users"));
|
||||
$monsterrow = dorow(doquery("SELECT * FROM <<users>> WHERE id='".$pvp["player2id"]."' LIMIT 1"));
|
||||
} else {
|
||||
$monsterrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$pvp["player1id"]."' LIMIT 1", "users"));
|
||||
$monsterrow = dorow(doquery("SELECT * FROM <<users>> WHERE id='".$pvp["player1id"]."' LIMIT 1"));
|
||||
}
|
||||
|
||||
$pagerow = array(
|
||||
|
@ -102,15 +102,15 @@ function dowait() {
|
|||
function dofight() {
|
||||
|
||||
global $userrow, $monsterrow, $fightrow, $spells;
|
||||
$pvp = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["currentpvp"]."' LIMIT 1", "pvp"));
|
||||
$pvp = dorow(doquery("SELECT * FROM <<pvp>> WHERE id='".$userrow["currentpvp"]."' LIMIT 1"));
|
||||
|
||||
// "monsterrow" now becomes the other player's character.
|
||||
if ($pvp["player1id"] == $userrow["id"]) {
|
||||
$nextplayer = $pvp["player2id"];
|
||||
$monsterrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$pvp["player2id"]."' LIMIT 1", "users"));
|
||||
$monsterrow = dorow(doquery("SELECT * FROM <<users>> WHERE id='".$pvp["player2id"]."' LIMIT 1"));
|
||||
} else {
|
||||
$nextplayer = $pvp["player1id"];
|
||||
$monsterrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$pvp["player1id"]."' LIMIT 1", "users"));
|
||||
$monsterrow = dorow(doquery("SELECT * FROM <<users>> WHERE id='".$pvp["player1id"]."' LIMIT 1"));
|
||||
}
|
||||
|
||||
if (isset($_POST["fight"])) {
|
||||
|
@ -120,7 +120,7 @@ function dofight() {
|
|||
updateopponent();
|
||||
|
||||
$fightrowimploded = $fightrow["playerphysdamage"].",".$fightrow["playermagicdamage"].",".$fightrow["playerfiredamage"].",".$fightrow["playerlightdamage"].",".$fightrow["message"];
|
||||
$query = doquery("UPDATE {{table}} SET fightrow='$fightrowimploded', playerturn='$nextplayer' WHERE id='".$pvp["id"]."' LIMIT 1", "pvp");
|
||||
$query = doquery("UPDATE <<pvp>> SET fightrow='$fightrowimploded', playerturn='$nextplayer' WHERE id='".$pvp["id"]."' LIMIT 1");
|
||||
|
||||
$pagerow = array(
|
||||
"message"=>$fightrow["message"],
|
||||
|
@ -156,7 +156,7 @@ function dofight() {
|
|||
updateopponent();
|
||||
|
||||
$fightrowimploded = $fightrow["playerphysdamage"].",".$fightrow["playermagicdamage"].",".$fightrow["playerfiredamage"].",".$fightrow["playerlightdamage"].",".$fightrow["message"];
|
||||
$query = doquery("UPDATE {{table}} SET fightrow='$fightrowimploded', playerturn='$nextplayer' WHERE id='".$pvp["id"]."' LIMIT 1", "pvp");
|
||||
$query = doquery("UPDATE <<pvp>> SET fightrow='$fightrowimploded', playerturn='$nextplayer' WHERE id='".$pvp["id"]."' LIMIT 1");
|
||||
|
||||
$pagerow = array(
|
||||
"message"=>$fightrow["message"],
|
||||
|
@ -255,7 +255,7 @@ function playerturn() {
|
|||
|
||||
// Chance to make an excellent hit.
|
||||
$toexcellent = rand(0,150);
|
||||
if ($toexcellent <= sqrt($userrow["strength"])) {
|
||||
if ($toexcellent <= sqrt($userrow["dexterity"])) {
|
||||
$fightrow["playerphysdamage"] *= 2;
|
||||
$fightrow["playermagicdamage"] *= 2;
|
||||
$fightrow["playerfiredamage"] *= 2;
|
||||
|
@ -265,7 +265,7 @@ function playerturn() {
|
|||
|
||||
// Chance for monster to dodge.
|
||||
$tododge = rand(0,200);
|
||||
if ($tododge <= sqrt($monsterrow["physdefense"])) {
|
||||
if ($tododge <= sqrt($monsterrow["dexterity"])) {
|
||||
$fightrow["playerphysdamage"] = 0;
|
||||
$fightrow["playermagicdamage"] = 0;
|
||||
$fightrow["playerfiredamage"] = 0;
|
||||
|
@ -274,6 +274,8 @@ function playerturn() {
|
|||
}
|
||||
|
||||
// Now we add Per Turn mods.
|
||||
bonusattack();
|
||||
bonusdefense_pvp();
|
||||
hpleech("player");
|
||||
mpleech("player");
|
||||
|
||||
|
@ -285,7 +287,7 @@ function playerturn() {
|
|||
function youwin() {
|
||||
|
||||
global $userrow, $monsterrow, $fightrow;
|
||||
$pvp = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["currentpvp"]."' LIMIT 1", "pvp"));
|
||||
$pvp = dorow(doquery("SELECT * FROM <<pvp>> WHERE id='".$userrow["currentpvp"]."' LIMIT 1"));
|
||||
|
||||
// "monsterrow" now becomes the other player's character.
|
||||
if ($pvp["player1id"] == $userrow["id"]) {
|
||||
|
@ -299,6 +301,8 @@ function youwin() {
|
|||
$userrow["currentaction"] = "In Town";
|
||||
$userrow["currentfight"] = 0;
|
||||
$userrow["currentpvp"] = 0;
|
||||
$userrow["bonusattack"] = 0;
|
||||
$userrow["bonusdefense"] = 0;
|
||||
|
||||
// Now we add Per Kill mods.
|
||||
hpgain();
|
||||
|
@ -311,7 +315,7 @@ function youwin() {
|
|||
updateopponent();
|
||||
updateuserrow();
|
||||
$fightrowimploded = $fightrow["playerphysdamage"].",".$fightrow["playermagicdamage"].",".$fightrow["playerfiredamage"].",".$fightrow["playerlightdamage"].",".$fightrow["message"];
|
||||
$query = doquery("UPDATE {{table}} SET fightrow='$fightrowimploded', playerturn='$nextplayer' WHERE id='".$pvp["id"]."' LIMIT 1", "pvp");
|
||||
$query = doquery("UPDATE <<pvp>> SET fightrow='$fightrowimploded', playerturn='$nextplayer' WHERE id='".$pvp["id"]."' LIMIT 1");
|
||||
|
||||
// And we're done.
|
||||
$pagerow = array(
|
||||
|
@ -336,12 +340,12 @@ function youwin() {
|
|||
function youlose() {
|
||||
|
||||
global $userrow, $monsterrow, $fightrow;
|
||||
$pvp = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["currentpvp"]."' LIMIT 1", "pvp"));
|
||||
$pvp = dorow(doquery("SELECT * FROM <<pvp>> WHERE id='".$userrow["currentpvp"]."' LIMIT 1""));
|
||||
|
||||
if ($pvp["player1id"] == $userrow["id"]) {
|
||||
$monsterrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$pvp["player2id"]."' LIMIT 1", "users"));
|
||||
$monsterrow = dorow(doquery("SELECT * FROM <<users>> WHERE id='".$pvp["player2id"]."' LIMIT 1"));
|
||||
} else {
|
||||
$monsterrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$pvp["player1id"]."' LIMIT 1", "users"));
|
||||
$monsterrow = dorow(doquery("SELECT * FROM <<users>> WHERE id='".$pvp["player1id"]."' LIMIT 1"));
|
||||
}
|
||||
|
||||
$tempfightrow = explode(",",$pvp["fightrow"]);
|
||||
|
@ -356,10 +360,12 @@ function youlose() {
|
|||
$userrow["currentfight"] = 0;
|
||||
$userrow["currentpvp"] = 0;
|
||||
$userrow["currenthp"] = ceil($userrow["maxhp"] / 4);
|
||||
$userrow["bonusattack"] = 0;
|
||||
$userrow["bonusdefense"] = 0;
|
||||
|
||||
// Update.
|
||||
updateuserrow();
|
||||
$query = doquery("DELETE FROM {{table}} WHERE id='".$pvp["id"]."' LIMIT 1", "pvp");
|
||||
$query = doquery("DELETE FROM <<pvp>> WHERE id='".$pvp["id"]."' LIMIT 1");
|
||||
|
||||
// And we're done.
|
||||
$pagerow = array(
|
||||
|
@ -391,7 +397,7 @@ function updateopponent() {
|
|||
}
|
||||
$querystring = rtrim($querystring, ",");
|
||||
|
||||
$query = doquery("UPDATE {{table}} SET $querystring WHERE id='".$monsterrow["id"]."' LIMIT 1", "users");
|
||||
$query = doquery("UPDATE <<users>> SET $querystring WHERE id='".$monsterrow["id"]."' LIMIT 1");
|
||||
|
||||
}
|
||||
|
||||
|
|
12
pvpmini.php
|
@ -4,22 +4,22 @@ include("lib.php");
|
|||
include("globals.php");
|
||||
|
||||
global $userrow, $controlrow;
|
||||
$row = dorow(doquery("SELECT *,UNIX_TIMESTAMP(turntime) as fturntime FROM {{table}} WHERE id='".$userrow["currentpvp"]."' LIMIT 1", "pvp"));
|
||||
$row = dorow(doquery("SELECT *,UNIX_TIMESTAMP(turntime) as fturntime FROM <<pvp>> WHERE id='".$userrow["currentpvp"]."' LIMIT 1"));
|
||||
|
||||
// Check for timeout.
|
||||
if ($row["fturntime"] < (time() - $controlrow["pvptimeout"])) {
|
||||
|
||||
// If the PVP was accepted, whoever timed out loses.
|
||||
if ($row["accepted"] == 1) {
|
||||
$monsterrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$row["player2id"]."' LIMIT 1", "users"));
|
||||
$monsterrow = dorow(doquery("SELECT * FROM <<users>> WHERE id='".$row["player2id"]."' LIMIT 1"));
|
||||
if ($monsterrow["level"] > $userrow["pvphighest"]) { $highest = ", pvphighest='".$monsterrow["level"]."'"; } else { $highest = ""; }
|
||||
doquery("UPDATE {{table}} SET currentpvp='0', currentaction='In Town', pvpwins = pvpwins + 1 $highest WHERE id='".$row["player1id"]."' LIMIT 1", "users");
|
||||
doquery("UPDATE {{table}} SET currentpvp='0', currentaction='In Town', pvplosses = pvplosses + 1 WHERE id='".$row["player2id"]."' LIMIT 1", "users");
|
||||
doquery("UPDATE <<users>> SET currentpvp='0', currentaction='In Town', pvpwins = pvpwins + 1 $highest WHERE id='".$row["player1id"]."' LIMIT 1");
|
||||
doquery("UPDATE <<users>> SET currentpvp='0', currentaction='In Town', pvplosses = pvplosses + 1 WHERE id='".$row["player2id"]."' LIMIT 1");
|
||||
} else {
|
||||
doquery("UPDATE {{table}} SET currentpvp='0', currentaction='In Town' WHERE id='".$row["player1id"]."' OR id='".$row["player2id"]."' LIMIT 2", "users");
|
||||
doquery("UPDATE <<users>> SET currentpvp='0', currentaction='In Town' WHERE id='".$row["player1id"]."' OR id='".$row["player2id"]."' LIMIT 2");
|
||||
}
|
||||
|
||||
$query2 = doquery("DELETE FROM {{table}} WHERE id='".$row["id"]."'", "pvp");
|
||||
$query2 = doquery("DELETE FROM <<pvp>> WHERE id='".$row["id"]."'");
|
||||
$pagerow["content"] = "The other player did not respond and this Duel has timed out. Thanks for playing.<br /><br />This window will refresh to the main screen in ".$controlrow["pvprefresh"]." seconds.";
|
||||
$pagerow["target"] = "_top";
|
||||
$pagerow["parentreload"] = "onload=\"setTimeout('top.location.href=\'index.php\'',".($controlrow["pvprefresh"] * 1000).")\"";
|
||||
|
|
10
scripts/tooltip.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
// Extended Tooltip Javascript
|
||||
// copyright 9th August 2002, 3rd July 2005
|
||||
// by Stephen Chapman, Felgall Pty Ltd
|
||||
|
||||
// permission is granted to use this javascript provided that the below code is not altered
|
||||
var DH = 0;var an = 0;var al = 0;var ai = 0;if (document.getElementById) {ai = 1; DH = 1;}else {if (document.all) {al = 1; DH = 1;} else { browserVersion = parseInt(navigator.appVersion); if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {an = 1; DH = 1;}}} function fd(oi, wS) {if (ai) return wS ? document.getElementById(oi).style:document.getElementById(oi); if (al) return wS ? document.all[oi].style: document.all[oi]; if (an) return document.layers[oi];}
|
||||
function pw() {return window.innerWidth != null? window.innerWidth: document.body.clientWidth != null? document.body.clientWidth:null;}
|
||||
function mouseX(evt) {if (evt.pageX) return evt.pageX; else if (evt.clientX)return evt.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft); else return null;}
|
||||
function mouseY(evt) {if (evt.pageY) return evt.pageY; else if (evt.clientY)return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); else return null;}
|
||||
function popUp(evt,oi) {if (DH) {var wp = pw(); ds = fd(oi,1); dm = fd(oi,0); st = ds.visibility; if (dm.offsetWidth) ew = dm.offsetWidth; else if (dm.clip.width) ew = dm.clip.width; if (st == "visible" || st == "show") { ds.visibility = "hidden"; } else {tv = mouseY(evt) + 20; lv = mouseX(evt) - (ew/4); if (lv < 2) lv = 2; else if (lv + ew > wp) lv -= ew/2; if (!an) {lv += 'px';tv += 'px';} ds.left = lv; ds.top = tv; ds.visibility = "visible";}}}
|
76
spells.php
|
@ -94,4 +94,80 @@ function prism($id) {
|
|||
|
||||
}
|
||||
|
||||
// Mad crazy ninja love to Anman for writing this spell. I've cleaned it up a bit to match the format of the rest of the code, but it's his spell.
|
||||
function blessedstrike($id) {
|
||||
|
||||
global $userrow, $monsterrow, $fightrow, $spells;
|
||||
$failed = 0;
|
||||
if ($userrow["currentmp"] < $spells[$id]["mp"]) { $return = "<span class=\"red\"><b>Spell Failed:</b> You do not have enough MP to cast that spell.</span><br />"; $failed = 1; }
|
||||
|
||||
if ($failed == 0) {
|
||||
|
||||
//now define the power of the spell. you can stack these spells, but the more you try to stack it the harder it will be to get a decent number out of the stack. Now, this spell is more of a bonus to a player compared to the defence spell. So for this reason, the ratio of stacking has been decreased from 100 to 90 and the minimum % to take of the spell is now 10% instead of 20%.
|
||||
$userrow["currentmp"] -= $spells[$id]["mp"];
|
||||
if ($userrow["bonusattack"] == 0) {
|
||||
$userrow["bonusattack"] = $spells[$id]["value"];
|
||||
} else {
|
||||
//if a more powerful inc attack spell is cast, replace the old value with the new one
|
||||
if ($userrow["bonusattack"] < $spells[$id]["value"]) {
|
||||
$userrow["bonusattack"] = $spells[$id]["value"];
|
||||
} else {
|
||||
//if the same or a weaker spell is cast, determine the maximum stack number and then apply..
|
||||
$newattmax = ((90 - $userrow["bonusattack"])+1) / 90;
|
||||
if ($newattmax < 0.1) { $newattmax = 0.1;}
|
||||
$newattmax = $spells[$id]["value"] * $newattmax;
|
||||
$newattmax = floor($newattmax);
|
||||
if ($newattmax < 1) { $newattmax = 1;}
|
||||
if ($spells[$id]["value"] > $newattmax) {$spells[$id]["value"] = $newattmax;}
|
||||
$userrow["bonusattack"] = $userrow["bonusattack"] + $spells[$id]["value"];
|
||||
}
|
||||
if ($userrow["bonusattack"] > 200) { $userrow["bonusattack"] = 200; }
|
||||
// *2 damage delt will never go above 50% chance. *1.75 damage will always be 50%
|
||||
}
|
||||
|
||||
$return = $userrow["charname"] . " casts " . $spells[$id]["name"] . ". Future attacks will be more powerful!<br />";
|
||||
|
||||
}
|
||||
|
||||
return($return);
|
||||
|
||||
}
|
||||
|
||||
// Mad crazy ninja love to Anman for writing this spell. I've cleaned it up a bit to match the format of the rest of the code, but it's his spell.
|
||||
function stoneskin($id) {
|
||||
|
||||
global $userrow, $monsterrow, $fightrow, $spells;
|
||||
$failed = 0;
|
||||
if ($userrow["currentmp"] < $spells[$id]["mp"]) { $return = "<span class=\"red\"><b>Spell Failed:</b> You do not have enough MP to cast that spell.</span><br />"; $failed = 1; }
|
||||
|
||||
if ($failed ==0 ) {
|
||||
|
||||
//now define the power of the spell. you can stack these spells, but the more you try to stack it the harder it will be to get a decent number out of the stack. The max will always be 100. This is because the spell works with percentages and 100 will always be the highest.
|
||||
$userrow["currentmp"] -= $spells[$id]["mp"];
|
||||
if ($userrow["bonusdefence"] == 0) {
|
||||
$userrow["bonusdefence"] = $spells[$id]["value"];
|
||||
} else {
|
||||
//if a more powerful defence spell is cast, replace the old value with the new one
|
||||
if ($userrow["bonusdefence"] < $spells[$id]["value"]) {
|
||||
$userrow["bonusdefence"] = $spells[$id]["value"];
|
||||
} else {
|
||||
//if the same or a weaker spell is cast, determine the maximum stack number and then apply..
|
||||
$newdefmax = ((100 - $userrow["bonusdefence"])+1) / 100;
|
||||
if ($newdefmax < 0.2) { $newdefmax = 0.2;}
|
||||
$newdefmax = $spells[$id]["value"] * $newdefmax;
|
||||
$newdefmax = floor($newdefmax);
|
||||
if ($newdefmax < 1) { $newdefmax = 1;}
|
||||
if ($spells[$id]["value"] > $newdefmax) {$spells[$id]["value"] = $newdefmax;}
|
||||
$userrow["bonusdefence"] = $userrow["bonusdefence"] + $spells[$id]["value"];
|
||||
}
|
||||
if ($userrow["bonusdefence"] > 200) { $userrow["bonusdefence"] = 200;}
|
||||
// all damage will never go above 50% chance. 0.25% damage will always be 50%
|
||||
}
|
||||
|
||||
$return = $userrow["charname"] . " casts " . $spells[$id]["name"] . ". Damage taken will be reduced!<br />";
|
||||
|
||||
}
|
||||
return($return);
|
||||
}
|
||||
|
||||
?>
|
30
story.php
|
@ -3,7 +3,7 @@
|
|||
include("lib.php");
|
||||
include("globals.php");
|
||||
|
||||
$story = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["story"]."' LIMIT 1", "story"));
|
||||
$story = dorow(doquery("SELECT * FROM <<story>> WHERE id='".$userrow["story"]."' LIMIT 1"));
|
||||
|
||||
// Decide which type of story to run.
|
||||
if ($story["targetmonster"] != "0") { storymonster(); }
|
||||
|
@ -17,7 +17,7 @@ function storyteleport() { // Sends to a new location, or just displays a chunk
|
|||
if (isset($_POST["submit"])) {
|
||||
|
||||
if ($story["nextstory"] != "0") {
|
||||
$nextstory = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$story["nextstory"]."' LIMIT 1", "story"));
|
||||
$nextstory = dorow(doquery("SELECT * FROM <<story>> WHERE id='".$story["nextstory"]."' LIMIT 1"));
|
||||
$userrow["story"] = $nextstory["id"];
|
||||
$userrow["storylat"] = $nextstory["latitude"];
|
||||
$userrow["storylon"] = $nextstory["longitude"];
|
||||
|
@ -41,7 +41,7 @@ function storyteleport() { // Sends to a new location, or just displays a chunk
|
|||
|
||||
$story["reward"] = "";
|
||||
if ($story["rewardname"] != "") {
|
||||
$premodrow = dorow(doquery("SELECT * FROM {{table}} ORDER BY id","itemmodnames"));
|
||||
$premodrow = dorow(doquery("SELECT * FROM <<itemmodnames>> ORDER BY id"));
|
||||
foreach($premodrow as $a=>$b) {
|
||||
$modrow[$b["fieldname"]] = $b;
|
||||
}
|
||||
|
@ -62,9 +62,9 @@ function storymonster() {
|
|||
|
||||
if (isset($_POST["submit"])) {
|
||||
|
||||
$monster = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$story["targetmonster"]."' LIMIT 1", "monsters"));
|
||||
$monster = dorow(doquery("SELECT * FROM <<monsters>> WHERE id='".$story["targetmonster"]."' LIMIT 1"));
|
||||
$querystring = "currentmonsterid='".$monster["id"]."', currentmonsterhp='".(ceil(rand($monster["maxhp"] * .75, $monster["maxhp"]) * $userrow["difficulty"]))."', currentaction='Fighting'";
|
||||
$update = doquery("UPDATE {{table}} SET $querystring WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||
$update = doquery("UPDATE <<users>> SET $querystring WHERE id='".$userrow["id"]."' LIMIT 1");
|
||||
die(header("Location: fight.php"));
|
||||
|
||||
}
|
||||
|
@ -78,23 +78,23 @@ function storyitem() {
|
|||
|
||||
global $userrow, $story;
|
||||
|
||||
$premodrow = dorow(doquery("SELECT * FROM {{table}} ORDER BY id","itemmodnames"));
|
||||
$premodrow = dorow(doquery("SELECT * FROM <<itemmodnames>> ORDER BY id"));
|
||||
foreach($premodrow as $a=>$b) {
|
||||
$modrow[$b["fieldname"]] = $b;
|
||||
}
|
||||
|
||||
$thenewitem = explode(",",$story["targetitem"]);
|
||||
$newitem = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$thenewitem[1]."' LIMIT 1", "itembase"));
|
||||
$newprefix = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$thenewitem[0]."' LIMIT 1", "itemprefixes"));
|
||||
$newsuffix = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$thenewitem[2]."' LIMIT 1", "itemsuffixes"));
|
||||
$newitem = dorow(doquery("SELECT * FROM <<itembase>> WHERE id='".$thenewitem[1]."' LIMIT 1"));
|
||||
$newprefix = dorow(doquery("SELECT * FROM <<itemprefixes>> WHERE id='".$thenewitem[0]."' LIMIT 1"));
|
||||
$newsuffix = dorow(doquery("SELECT * FROM <<itemsuffixes>> WHERE id='".$thenewitem[2]."' LIMIT 1"));
|
||||
$newfullitem = builditem($newprefix, $newitem, $newsuffix, $modrow);
|
||||
$story["itemtable"] = parsetemplate(gettemplate("explore_drop_itemrow"), $newfullitem);
|
||||
|
||||
if ($userrow["item".$newitem["slotnumber"]."idstring"] != "0") {
|
||||
$theolditem = explode(",",$userrow["item".$newitem["slotnumber"]."idstring"]);
|
||||
$olditem = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$theolditem[1]."' LIMIT 1", "itembase"));
|
||||
$oldprefix = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$theolditem[0]."' LIMIT 1", "itemprefixes"));
|
||||
$oldsuffix = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$theolditem[2]."' LIMIT 1", "itemsuffixes"));
|
||||
$olditem = dorow(doquery("SELECT * FROM <<itembase>> WHERE id='".$theolditem[1]."' LIMIT 1"));
|
||||
$oldprefix = dorow(doquery("SELECT * FROM <<itemprefixes>> WHERE id='".$theolditem[0]."' LIMIT 1"));
|
||||
$oldsuffix = dorow(doquery("SELECT * FROM <<itemsuffixes>> WHERE id='".$theolditem[2]."' LIMIT 1"));
|
||||
$oldfullitem = builditem($oldprefix, $olditem, $oldsuffix, $modrow);
|
||||
$story["olditems"] = parsetemplate(gettemplate("town_buy_olditemrow"), $oldfullitem);
|
||||
} else {
|
||||
|
@ -142,7 +142,7 @@ function storyitem() {
|
|||
}
|
||||
|
||||
if ($story["nextstory"] != "0") {
|
||||
$nextstory = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$story["nextstory"]."' LIMIT 1", "story"));
|
||||
$nextstory = dorow(doquery("SELECT * FROM <<story>> WHERE id='".$story["nextstory"]."' LIMIT 1"));
|
||||
$userrow["story"] = $nextstory["id"];
|
||||
$userrow["storylat"] = $nextstory["latitude"];
|
||||
$userrow["storylon"] = $nextstory["longitude"];
|
||||
|
@ -167,7 +167,7 @@ function storyitem() {
|
|||
if (isset($_POST["noitem"])) {
|
||||
|
||||
if ($story["nextstory"] != "0") {
|
||||
$nextstory = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$story["nextstory"]."' LIMIT 1", "story"));
|
||||
$nextstory = dorow(doquery("SELECT * FROM <<story>> WHERE id='".$story["nextstory"]."' LIMIT 1"));
|
||||
$userrow["story"] = $nextstory["id"];
|
||||
$userrow["storylat"] = $nextstory["latitude"];
|
||||
$userrow["storylon"] = $nextstory["longitude"];
|
||||
|
@ -191,7 +191,7 @@ function storyitem() {
|
|||
|
||||
$story["reward"] = "";
|
||||
if ($story["rewardname"] != "") {
|
||||
$premodrow = dorow(doquery("SELECT * FROM {{table}} ORDER BY id","itemmodnames"));
|
||||
$premodrow = dorow(doquery("SELECT * FROM <<itemmodnames>> ORDER BY id"));
|
||||
foreach($premodrow as $a=>$b) {
|
||||
$modrow[$b["fieldname"]] = $b;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
$template = <<<END
|
||||
{{babblebox}}
|
||||
<br /><br />
|
||||
{{whosonline}}
|
||||
END;
|
||||
|
||||
|
|
|
@ -14,21 +14,10 @@ Thank you.
|
|||
$template = <<<END
|
||||
<head>
|
||||
<title>{{gamename}} :: {{pagetitle}}</title>
|
||||
<link rel="stylesheet" href="css/primary.css" type="text/css" />
|
||||
<script type="text/javascript" src="scripts/tooltip.js"></script>
|
||||
<style type="text/css">
|
||||
body { font: 10px Verdana; background-image: url(images/{{background}}.jpg); padding: 0px; }
|
||||
table { font: 10px Verdana; }
|
||||
td { vertical-align: top; }
|
||||
input { font: 10px Verdana; }
|
||||
img { border-style: none; }
|
||||
a { color: #996600; text-decoration: none; font-weight: bold; }
|
||||
a:hover { color: #663300; }
|
||||
.main { border: solid 1px black; }
|
||||
.grey { color: #999999; }
|
||||
.red { color: #ff0000; }
|
||||
.blue { color: #0000ff; }
|
||||
.big { font: 11px Verdana; background-color: #dddddd; border: solid 1px #aaaaaa; padding: 2px; margin-bottom: 3px; }
|
||||
.babble1 { background-color: #eeeeee; font: 10px Verdana; margin: 0px; padding: 2px; }
|
||||
.babble2 { background-color: #ffffff; font: 10px Verdana; margin: 0px; padding: 2px; }
|
||||
body { background-image: url(images/{{background}}.jpg); }
|
||||
</style>
|
||||
</head>
|
||||
<body><center>
|
||||
|
@ -63,21 +52,6 @@ a:hover { color: #663300; }
|
|||
<td colspan="3" style="border-top: solid 1px #cccccc;">{{bottomnav}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table cellspacing="0" cellpadding="3" style="width: 800px; border: solid 1px black; background-color: white; margin-top: 2px;">
|
||||
<tr>
|
||||
<td width="40%">
|
||||
Version <a href="index.php?do=version">{{version}}</a> / {{numqueries}} Queries / {{totaltime}} Seconds
|
||||
</td>
|
||||
<td width="20%" style="text-align: center;">
|
||||
{{forumslink}}
|
||||
</td>
|
||||
<td width="40%" style="text-align:right;">
|
||||
<a href="http://www.dragonscourge.com">Dragon Scourge</a> © by <a href="http://www.renderse7en.com">renderse7en</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center></body>
|
||||
</html>
|
||||
END;
|
||||
|
||||
?>
|
|
@ -4,7 +4,8 @@ $template = <<<END
|
|||
You have Level Points to spend. Different character classes get extra bonuses to certain stats from level points. Your stat bonuses are listed below. Note that any fractions are rounded down, so it's in your best interest to make sure you're getting the most out of your level points.<br /><br />
|
||||
Class: {{classname}}<br />
|
||||
Damage Per Strength: {{damageperstrength}}<br />
|
||||
HP Per Dexterity: {{hpperdexterity}}<br />
|
||||
Defense Per Dexterity: {{defenseperdex}}<br />
|
||||
HP Per Life: {{hpperlife}}<br />
|
||||
MP Per Energy: {{mpperenergy}}<br /><br />
|
||||
You have <b>{{levelup}} point(s)</b> to spend.<br /><br />
|
||||
<form action="users.php?do=levelup" method="post">
|
||||
|
|
74
town.php
|
@ -7,7 +7,7 @@ if ($townrow == false) { die(header("Location: index.php")); }
|
|||
function dotown() { // Default town screen.
|
||||
|
||||
global $userrow;
|
||||
$newpm = doquery("SELECT * FROM {{table}} WHERE recipientid='".$userrow["id"]."' AND status='0'", "messages");
|
||||
$newpm = doquery("SELECT * FROM <<messages>> WHERE recipientid='".$userrow["id"]."' AND status='0'");
|
||||
if (mysql_num_rows($newpm) > 0) {
|
||||
$row["unread"] = "<b>(".mysql_num_rows($newpm)." new)</b>";
|
||||
} else {
|
||||
|
@ -32,7 +32,7 @@ function inn() { // Resting at the inn restores hp/mp/tp.
|
|||
$userrow["currentmp"] = $userrow["maxmp"];
|
||||
$userrow["currenttp"] = $userrow["maxtp"];
|
||||
$userrow["gold"] -= $townrow["innprice"];
|
||||
$query = doquery("UPDATE {{table}} SET currenthp='".$userrow["maxhp"]."', currentmp='".$userrow["maxmp"]."', currenttp='".$userrow["maxtp"]."', gold='".$userrow["gold"]."' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||
$query = doquery("UPDATE <<users>> SET currenthp='".$userrow["maxhp"]."', currentmp='".$userrow["maxmp"]."', currenttp='".$userrow["maxtp"]."', gold='".$userrow["gold"]."' WHERE id='".$userrow["id"]."' LIMIT 1");
|
||||
display("Rest at the Inn", gettemplate("town_inn2"));
|
||||
|
||||
} elseif (isset($_POST["abortmission"])) { die(header("Location: index.php")); }
|
||||
|
@ -47,7 +47,7 @@ function map() { // Buy maps to towns for the Travel To menu.
|
|||
|
||||
if (isset($_POST["three"])) {
|
||||
|
||||
$townquery = doquery("SELECT * FROM {{table}} WHERE id='".$_POST["id"]."' LIMIT 1", "towns");
|
||||
$townquery = doquery("SELECT * FROM <<towns>> WHERE id='".$_POST["id"]."' LIMIT 1");
|
||||
$townrow = dorow($townquery);
|
||||
|
||||
if ($userrow["gold"] < $townrow["mapprice"]) { err("You do not have enough gold to buy this map. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
|
@ -55,7 +55,7 @@ function map() { // Buy maps to towns for the Travel To menu.
|
|||
if ($townrow != false) {
|
||||
$userrow["townslist"] .= "," . $townrow["id"];
|
||||
$userrow["gold"] -= $townrow["mapprice"];
|
||||
$query = doquery("UPDATE {{table}} SET townslist='".$userrow["townslist"]."', gold='".$userrow["gold"]."' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||
$query = doquery("UPDATE <<users>> SET townslist='".$userrow["townslist"]."', gold='".$userrow["gold"]."' WHERE id='".$userrow["id"]."' LIMIT 1");
|
||||
display("Buy Maps", gettemplate("town_map3"));
|
||||
} else {
|
||||
err("Invalid action. Please <a href=\"index.php\">go back</a> and try again.");
|
||||
|
@ -63,7 +63,7 @@ function map() { // Buy maps to towns for the Travel To menu.
|
|||
|
||||
} elseif (isset($_POST["two"])) {
|
||||
|
||||
$townquery = doquery("SELECT * FROM {{table}} WHERE name='".$_POST["two"]."' LIMIT 1", "towns");
|
||||
$townquery = doquery("SELECT * FROM <<towns>> WHERE name='".$_POST["two"]."' LIMIT 1");
|
||||
$townrow = dorow($townquery);
|
||||
|
||||
if ($userrow["gold"] < $townrow["mapprice"]) { err("You do not have enough gold to buy this map. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
|
@ -76,7 +76,7 @@ function map() { // Buy maps to towns for the Travel To menu.
|
|||
|
||||
} else {
|
||||
|
||||
$townquery = doquery("SELECT * FROM {{table}} WHERE world='".$userrow["world"]."' ORDER BY id", "towns");
|
||||
$townquery = doquery("SELECT * FROM <<towns>> WHERE world='".$userrow["world"]."' ORDER BY id");
|
||||
$townrow = dorow($townquery);
|
||||
$townslist = explode(",",$userrow["townslist"]);
|
||||
|
||||
|
@ -116,10 +116,10 @@ function buy() { // Buy items from merchants.
|
|||
foreach($idstring as $a=>$b) { if(!is_numeric($b)) { err("Invalid action. Please <a href=\"index.php\">go back</a> and try again."); } }
|
||||
|
||||
// Get database info on new item.
|
||||
$newbaseitem = dorow(doquery("SELECT * FROM {{table}} WHERE id='$idstring[1]' LIMIT 1", "itembase"));
|
||||
$newprefix = dorow(doquery("SELECT * FROM {{table}} WHERE id='$idstring[0]' LIMIT 1", "itemprefixes"));
|
||||
$newsuffix = dorow(doquery("SELECT * FROM {{table}} WHERE id='$idstring[2]' LIMIT 1", "itemsuffixes"));
|
||||
$premodrow = dorow(doquery("SELECT * FROM {{table}} ORDER BY id","itemmodnames"));
|
||||
$newbaseitem = dorow(doquery("SELECT * FROM <<itembase>> WHERE id='$idstring[1]' LIMIT 1"));
|
||||
$newprefix = dorow(doquery("SELECT * FROM <<itemprefixes>> WHERE id='$idstring[0]' LIMIT 1"));
|
||||
$newsuffix = dorow(doquery("SELECT * FROM <<itemsuffixes>> WHERE id='$idstring[2]' LIMIT 1"));
|
||||
$premodrow = dorow(doquery("SELECT * FROM <<itemmodnames>> ORDER BY id"));
|
||||
|
||||
// Format the mod name row.
|
||||
foreach($premodrow as $a=>$b) {
|
||||
|
@ -132,9 +132,9 @@ function buy() { // Buy items from merchants.
|
|||
if ($userrow["item" . $newbaseitem["slotnumber"] . "idstring"] != "0") {
|
||||
|
||||
$oldidstring = explode(",",$userrow["item" . $newbaseitem["slotnumber"] . "idstring"]);
|
||||
$oldbaseitem = dorow(doquery("SELECT * FROM {{table}} WHERE id='$oldidstring[1]' LIMIT 1", "itembase"));
|
||||
$oldprefix = dorow(doquery("SELECT * FROM {{table}} WHERE id='$oldidstring[0]' LIMIT 1", "itemprefixes"));
|
||||
$oldsuffix = dorow(doquery("SELECT * FROM {{table}} WHERE id='$oldidstring[2]' LIMIT 1", "itemsuffixes"));
|
||||
$oldbaseitem = dorow(doquery("SELECT * FROM <<itembase>> WHERE id='$oldidstring[1]' LIMIT 1"));
|
||||
$oldprefix = dorow(doquery("SELECT * FROM <<itemprefixes>> WHERE id='$oldidstring[0]' LIMIT 1"));
|
||||
$oldsuffix = dorow(doquery("SELECT * FROM <<itemsuffixes>> WHERE id='$oldidstring[2]' LIMIT 1"));
|
||||
$oldfullitem = builditem($oldprefix, $oldbaseitem, $oldsuffix, $modrow);
|
||||
|
||||
} else { $oldfullitem = false; $oldprefix = false; $oldsuffix = false; }
|
||||
|
@ -189,10 +189,10 @@ function buy() { // Buy items from merchants.
|
|||
foreach($idstring as $a=>$b) { if(!is_numeric($b)) { err("Invalid action. Please <a href=\"index.php\">go back</a> and try again."); } }
|
||||
|
||||
// Get database info on new item.
|
||||
$newbaseitem = dorow(doquery("SELECT * FROM {{table}} WHERE id='$idstring[1]' LIMIT 1", "itembase"));
|
||||
$newprefix = dorow(doquery("SELECT * FROM {{table}} WHERE id='$idstring[0]' LIMIT 1", "itemprefixes"));
|
||||
$newsuffix = dorow(doquery("SELECT * FROM {{table}} WHERE id='$idstring[2]' LIMIT 1", "itemsuffixes"));
|
||||
$premodrow = dorow(doquery("SELECT * FROM {{table}} ORDER BY id","itemmodnames"));
|
||||
$newbaseitem = dorow(doquery("SELECT * FROM <<itembase>> WHERE id='$idstring[1]' LIMIT 1"));
|
||||
$newprefix = dorow(doquery("SELECT * FROM <<itemprefixes>> WHERE id='$idstring[0]' LIMIT 1"));
|
||||
$newsuffix = dorow(doquery("SELECT * FROM <<itemsuffixes>> WHERE id='$idstring[2]' LIMIT 1"));
|
||||
$premodrow = dorow(doquery("SELECT * FROM <<itemmodnames>> ORDER BY id"));
|
||||
|
||||
// Format the mod name row.
|
||||
foreach($premodrow as $a=>$b) {
|
||||
|
@ -205,9 +205,9 @@ function buy() { // Buy items from merchants.
|
|||
if ($userrow["item" . $newbaseitem["slotnumber"] . "idstring"] != "0") {
|
||||
|
||||
$oldidstring = explode(",",$userrow["item" . $newbaseitem["slotnumber"] . "idstring"]);
|
||||
$oldbaseitem = dorow(doquery("SELECT * FROM {{table}} WHERE id='$oldidstring[1]' LIMIT 1", "itembase"));
|
||||
$oldprefix = dorow(doquery("SELECT * FROM {{table}} WHERE id='$oldidstring[0]' LIMIT 1", "itemprefixes"));
|
||||
$oldsuffix = dorow(doquery("SELECT * FROM {{table}} WHERE id='$oldidstring[2]' LIMIT 1", "itemsuffixes"));
|
||||
$oldbaseitem = dorow(doquery("SELECT * FROM <<itembase>> WHERE id='$oldidstring[1]' LIMIT 1"));
|
||||
$oldprefix = dorow(doquery("SELECT * FROM <<itemprefixes>> WHERE id='$oldidstring[0]' LIMIT 1"));
|
||||
$oldsuffix = dorow(doquery("SELECT * FROM <<itemsuffixes>> WHERE id='$oldidstring[2]' LIMIT 1"));
|
||||
$oldfullitem = builditem($oldprefix, $oldbaseitem, $oldsuffix, $modrow);
|
||||
|
||||
} else { $oldfullitem = false; }
|
||||
|
@ -232,13 +232,13 @@ function buy() { // Buy items from merchants.
|
|||
} else {
|
||||
|
||||
// Grab lots of stuff from the DB.
|
||||
$preitemsrow = dorow(doquery("SELECT * FROM {{table}} WHERE reqlevel>='".$townrow["itemminlvl"]."' AND reqlevel<='".$townrow["itemmaxlvl"]."' ORDER BY RAND() LIMIT 10 ", "itembase"));
|
||||
$preprefixrow = dorow(doquery("SELECT * FROM {{table}} WHERE reqlevel<='".$userrow["level"]."'", "itemprefixes"));
|
||||
$presuffixrow = dorow(doquery("SELECT * FROM {{table}} WHERE reqlevel<='".$userrow["level"]."'", "itemsuffixes"));
|
||||
$allitemsrow = dorow(doquery("SELECT * FROM {{table}}", "itembase"));
|
||||
$allprefixrow = dorow(doquery("SELECT * FROM {{table}}", "itemprefixes"));
|
||||
$allsuffixrow = dorow(doquery("SELECT * FROM {{table}}", "itemsuffixes"));
|
||||
$premodrow = dorow(doquery("SELECT * FROM {{table}} ORDER BY id","itemmodnames"));
|
||||
$preitemsrow = dorow(doquery("SELECT * FROM <<itembase>> WHERE reqlevel>='".$townrow["itemminlvl"]."' AND reqlevel<='".$townrow["itemmaxlvl"]."' ORDER BY RAND() LIMIT 10"));
|
||||
$preprefixrow = dorow(doquery("SELECT * FROM <<itemprefixes>> WHERE reqlevel<='".$userrow["level"]."'"));
|
||||
$presuffixrow = dorow(doquery("SELECT * FROM <<itemsuffixes>> WHERE reqlevel<='".$userrow["level"]."'"));
|
||||
$allitemsrow = dorow(doquery("SELECT * FROM <<itembase>>"));
|
||||
$allprefixrow = dorow(doquery("SELECT * FROM <<itemprefixes>>"));
|
||||
$allsuffixrow = dorow(doquery("SELECT * FROM <<itemsuffixes>>"));
|
||||
$premodrow = dorow(doquery("SELECT * FROM <<itemmodnames>> ORDER BY id"));
|
||||
|
||||
// Format the rows.
|
||||
foreach($allitemsrow as $a=>$b) {
|
||||
|
@ -306,7 +306,7 @@ function gamble() {
|
|||
// Bet amount errors.
|
||||
if (trim($amount) == "") { err("Invalid bet amount. Please <a href=\"index.php?do=gamble\">go back</a> and try again."); }
|
||||
if (!is_numeric($amount)) { err("Invalid bet amount. Please <a href=\"index.php?do=gamble\">go back</a> and try again."); }
|
||||
if ($amount < 0) { err("Invalid bet amount. Please <a href=\"index.php?do=gamble\">go back</a> and try again."); }
|
||||
if ($amount <= 0) { err("Invalid bet amount. Please <a href=\"index.php?do=gamble\">go back</a> and try again."); }
|
||||
if ($userrow["gold"] < $amount) { err("Invalid bet amount. Please <a href=\"index.php?do=gamble\">go back</a> and try again."); }
|
||||
|
||||
if ($mode == "hard") {
|
||||
|
@ -316,11 +316,11 @@ function gamble() {
|
|||
|
||||
if ($thecup == $thewin) {
|
||||
$userrow["gold"] += ($amount * 10);
|
||||
doquery("UPDATE {{table}} SET gold=gold+($amount * 10) WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||
doquery("UPDATE <<users>> SET gold=gold+($amount * 10) WHERE id='".$userrow["id"]."' LIMIT 1");
|
||||
display("Gamble", "You won!<br /><br />You just picked up <b>".($amount * 10)." Gold</b>.<br /><br />Care to <a href=\"index.php?do=gamble&mode=hard\">try again</a> or would you rather go back to <a href=\"index.php\">town</a>?");
|
||||
} else {
|
||||
$userrow["gold"] -= $amount;
|
||||
doquery("UPDATE {{table}} SET gold=gold-$amount WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||
doquery("UPDATE <<users>> SET gold=gold-$amount WHERE id='".$userrow["id"]."' LIMIT 1");
|
||||
display("Gamble", "You lost!<br /><br />Sorry buddy, but we're gonna have to take your <b>".$amount." Gold</b>.<br /><br />Care to <a href=\"index.php?do=gamble&mode=hard\">try again</a> or would you rather go back to <a href=\"index.php\">town</a>?");
|
||||
}
|
||||
|
||||
|
@ -333,11 +333,11 @@ function gamble() {
|
|||
|
||||
if ($thecup == $thewin) {
|
||||
$userrow["gold"] += ($amount * 2);
|
||||
doquery("UPDATE {{table}} SET gold=gold+($amount * 2) WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||
doquery("UPDATE <<users>> SET gold=gold+($amount * 2) WHERE id='".$userrow["id"]."' LIMIT 1");
|
||||
display("Gamble", "You won!<br /><br />You just picked up <b>".($amount * 2)." Gold</b>.<br /><br />Care to <a href=\"index.php?do=gamble\">try again</a> or would you rather go back to <a href=\"index.php\">town</a>?");
|
||||
} else {
|
||||
$userrow["gold"] -= $amount;
|
||||
doquery("UPDATE {{table}} SET gold=gold-$amount WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||
doquery("UPDATE <<users>> SET gold=gold-$amount WHERE id='".$userrow["id"]."' LIMIT 1");
|
||||
display("Gamble", "You lost!<br /><br />Sorry buddy, but we're gonna have to take your <b>".$amount." Gold</b>.<br /><br />Care to <a href=\"index.php?do=gamble\">try again</a> or would you rather go back to <a href=\"index.php\">town</a>?");
|
||||
}
|
||||
|
||||
|
@ -425,7 +425,7 @@ function bank() {
|
|||
|
||||
function halloffame() {
|
||||
|
||||
$top = dorow(doquery("SELECT *, DATE_FORMAT(birthdate, '%m.%d.%Y') AS fregdate FROM {{table}} ORDER BY experience DESC LIMIT 25", "users"), "id");
|
||||
$top = dorow(doquery("SELECT *, DATE_FORMAT(birthdate, '%m.%d.%Y') AS fregdate FROM <<users>> ORDER BY experience DESC LIMIT 25"), "id");
|
||||
$row["halltable"] = "";
|
||||
$i = 1;
|
||||
|
||||
|
@ -455,7 +455,7 @@ function duel() {
|
|||
|
||||
global $userrow;
|
||||
|
||||
$row = dorow(doquery("SELECT * FROM {{table}} WHERE UNIX_TIMESTAMP(onlinetime) >= '".(time()-600)."' AND world='".$userrow["world"]."' AND latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' AND id !='".$userrow["id"]."' ORDER BY id", "users"), "id");
|
||||
$row = dorow(doquery("SELECT * FROM <<users>> WHERE UNIX_TIMESTAMP(onlinetime) >= '".(time()-600)."' AND world='".$userrow["world"]."' AND latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' AND id !='".$userrow["id"]."' ORDER BY id"), "id");
|
||||
|
||||
$list = "";
|
||||
if ($row == false) {
|
||||
|
@ -483,7 +483,7 @@ function duelchallenge() {
|
|||
if(isset($_GET["uid"])) {
|
||||
if (!is_numeric($_GET["uid"])) { err("Invalid UID."); }
|
||||
if ($_GET["uid"] == $userrow["id"]) { err("You cannot duel yourself."); }
|
||||
$newuserrow = dorow(doquery("SELECT *,UNIX_TIMESTAMP(onlinetime) as fonlinetime FROM {{table}} WHERE id='".$_GET["uid"]."' LIMIT 1", "users"));
|
||||
$newuserrow = dorow(doquery("SELECT *,UNIX_TIMESTAMP(onlinetime) as fonlinetime FROM <<users>> WHERE id='".$_GET["uid"]."' LIMIT 1"));
|
||||
if ($newuserrow == false) { err("That user doesn't exist."); }
|
||||
if ($newuserrow["account"] == $userrow["account"]) { err("You cannot duel another character on your own account."); }
|
||||
if ($newuserrow["fonlinetime"] <= (time() - 600)) { err("That user is not online."); }
|
||||
|
@ -492,8 +492,8 @@ function duelchallenge() {
|
|||
} else { err("Invalid UID."); }
|
||||
|
||||
// No errors, so create the PVP record and update everyone's userrow.
|
||||
$query = doquery("INSERT INTO {{table}} SET id='',player1id='".$userrow["id"]."',player2id='".$newuserrow["id"]."',player1name='".$userrow["charname"]."',player2name='".$newuserrow["charname"]."',playerturn='".$newuserrow["id"]."',turntime=NOW(),fightrow=''","pvp");
|
||||
$query2 = doquery("UPDATE {{table}} SET currentpvp='".mysql_insert_id()."' WHERE id='".$newuserrow["id"]."' OR id='".$userrow["id"]."' LIMIT 2", "users");
|
||||
$query = doquery("INSERT INTO <<pvp>> SET id='',player1id='".$userrow["id"]."',player2id='".$newuserrow["id"]."',player1name='".$userrow["charname"]."',player2name='".$newuserrow["charname"]."',playerturn='".$newuserrow["id"]."',turntime=NOW(),fightrow=''");
|
||||
$query2 = doquery("UPDATE <<users>> SET currentpvp='".mysql_insert_id()."' WHERE id='".$newuserrow["id"]."' OR id='".$userrow["id"]."' LIMIT 2");
|
||||
display("Duel Challenge",parsetemplate(gettemplate("pvp_challenge"),$newuserrow));
|
||||
|
||||
}
|
||||
|
|
65
users.php
|
@ -39,7 +39,7 @@ function register() {
|
|||
// Process username.
|
||||
if (trim($username) == "") { $errors++; $errorlist .= "Username field is required.<br />"; }
|
||||
if (preg_match("/[^A-z0-9_\-]/", $username)==1) { $errors++; $errorlist .= "Username must be alphanumeric.<br />"; } // Thanks to "Carlos Pires" from php.net!
|
||||
$usernamequery = doquery("SELECT username FROM {{table}} WHERE username='$username' LIMIT 1","accounts");
|
||||
$usernamequery = doquery("SELECT username FROM <<accounts>> WHERE username='$username' LIMIT 1");
|
||||
if (mysql_num_rows($usernamequery) > 0) { $errors++; $errorlist .= "Username already taken - unique username required.<br />"; }
|
||||
|
||||
// Process password.
|
||||
|
@ -52,7 +52,7 @@ function register() {
|
|||
if (trim($email1) == "") { $errors++; $errorlist .= "Email field is required.<br />"; }
|
||||
if ($email1 != $email2) { $errors++; $errorlist .= "Emails don't match.<br />"; }
|
||||
if (! is_email($email1)) { $errors++; $errorlist .= "Email isn't valid.<br />"; }
|
||||
$emailquery = doquery("SELECT emailaddress FROM {{table}} WHERE emailaddress='$email1' LIMIT 1","accounts");
|
||||
$emailquery = doquery("SELECT emailaddress FROM <<accounts>> WHERE emailaddress='$email1' LIMIT 1");
|
||||
if (mysql_num_rows($emailquery) > 0) { $errors++; $errorlist .= "Email already taken - unique email address required.<br />"; }
|
||||
|
||||
// Process other stuff.
|
||||
|
@ -72,7 +72,7 @@ function register() {
|
|||
}
|
||||
|
||||
// Now update.
|
||||
$query = doquery("INSERT INTO {{table}} SET id='',regdate=NOW(),regip='".$_SERVER["REMOTE_ADDR"]."',verifycode='$verifycode',username='$username',password='$password',emailaddress='$email1',language='English',imageformat='$imageformat', minimap='$minimap'", "accounts") or die(mysql_error());
|
||||
$query = doquery("INSERT INTO <<accounts>> SET id='',regdate=NOW(),regip='".$_SERVER["REMOTE_ADDR"]."',verifycode='$verifycode',username='$username',password='$password',emailaddress='$email1',language='English',imageformat='$imageformat', minimap='$minimap'") or die(mysql_error());
|
||||
|
||||
// Send confirmation email if necessary.
|
||||
if ($controlrow["verifyemail"] == 1) {
|
||||
|
@ -134,7 +134,7 @@ function profile() {
|
|||
// Setup for viewing other people's profiles.
|
||||
if(isset($_GET["uid"])) {
|
||||
if (!is_numeric($_GET["uid"])) { err("Invalid UID."); }
|
||||
$newuserrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$_GET["uid"]."' LIMIT 1", "users"));
|
||||
$newuserrow = dorow(doquery("SELECT * FROM <<users>> WHERE id='".$_GET["uid"]."' LIMIT 1"));
|
||||
if ($newuserrow == false) { err("No such UID."); }
|
||||
$template = "users_onlinechar";
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ function profile() {
|
|||
if ($newuserrow["levelup"] != 0 || $newuserrow["levelspell"] != 0) { $newuserrow["levelpointscharnotice"] = "You have Level/Spell Points available."; } else { $newuserrow["levelpointscharnotice"] = ""; }
|
||||
|
||||
// Class.
|
||||
$class = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["charclass"]."' LIMIT 1", "classes"));
|
||||
$class = dorow(doquery("SELECT * FROM <<classes>> WHERE id='".$newuserrow["charclass"]."' LIMIT 1"));
|
||||
$newuserrow["charclass"] = $class["name"];
|
||||
|
||||
display("Extended Profile",parsetemplate(gettemplate($template),$newuserrow));
|
||||
|
@ -216,7 +216,7 @@ function settings() {
|
|||
// Process email address.
|
||||
if (trim($email) == "") { $errors++; $errorlist .= "Email field is required.<br />"; }
|
||||
if (! is_email($email)) { $errors++; $errorlist .= "Email isn't valid.<br />"; }
|
||||
$emailquery = doquery("SELECT emailaddress FROM {{table}} WHERE emailaddress='$email' AND id != '".$acctrow["id"]."' LIMIT 1","accounts");
|
||||
$emailquery = doquery("SELECT emailaddress FROM <<accounts>> WHERE emailaddress='$email' AND id != '".$acctrow["id"]."' LIMIT 1");
|
||||
if (mysql_num_rows($emailquery) > 0) { $errors++; $errorlist .= "Email already taken - unique email address required.<br />"; }
|
||||
|
||||
// Process other stuff.
|
||||
|
@ -225,7 +225,7 @@ function settings() {
|
|||
|
||||
if ($errors == 0) {
|
||||
|
||||
$query = doquery("UPDATE {{table}} SET $password emailaddress='$email', imageformat='$imageformat', minimap='$minimap' WHERE id='".$acctrow["id"]."' LIMIT 1", "accounts");
|
||||
$query = doquery("UPDATE <<accounts>> SET $password emailaddress='$email', imageformat='$imageformat', minimap='$minimap' WHERE id='".$acctrow["id"]."' LIMIT 1");
|
||||
|
||||
if (isset($newpass)) {
|
||||
setcookie("scourge", "", (time()-3600), "/", "", 0);
|
||||
|
@ -269,10 +269,10 @@ function characters() {
|
|||
|
||||
// Change the active character for the account.
|
||||
if (!is_numeric($_POST["makeactive"])) { err("Invalid UID."); }
|
||||
$newuserrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$_POST["makeactive"]."' LIMIT 1", "users"));
|
||||
$newuserrow = dorow(doquery("SELECT * FROM <<users>> WHERE id='".$_POST["makeactive"]."' LIMIT 1"));
|
||||
if ($newuserrow == false) { err("No such UID."); }
|
||||
if ($newuserrow["account"] != $acctrow["id"]) { err("You don't own that UID."); }
|
||||
$setnewchar = doquery("UPDATE {{table}} SET activechar='".$_POST["makeactive"]."' WHERE id='".$acctrow["id"]."' LIMIT 1", "accounts");
|
||||
$setnewchar = doquery("UPDATE <<accounts>> SET activechar='".$_POST["makeactive"]."' WHERE id='".$acctrow["id"]."' LIMIT 1");
|
||||
die(header("Location: users.php?do=characters"));
|
||||
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ function characters() {
|
|||
} else { $row["newcharlink"] = ""; }
|
||||
|
||||
// Grab characters.
|
||||
$charrow = dorow(doquery("SELECT *, DATE_FORMAT(birthdate, '%m.%d.%Y') AS fregdate FROM {{table}} WHERE account='".$acctrow["id"]."' ORDER BY birthdate", "users"), "id");
|
||||
$charrow = dorow(doquery("SELECT *, DATE_FORMAT(birthdate, '%m.%d.%Y') AS fregdate FROM <<users>> WHERE account='".$acctrow["id"]."' ORDER BY birthdate"), "id");
|
||||
|
||||
foreach($charrow as $a=>$b) {
|
||||
|
||||
|
@ -348,7 +348,7 @@ function charnew() {
|
|||
// Process charname.
|
||||
if (trim($charname) == "") { $errors++; $errorlist .= "Character Name field is required.<br />"; }
|
||||
if (preg_match("/[^A-z\ 0-9_\-]/", $charname)==1) { $errors++; $errorlist .= "Character names can only contain letters, numbers, spaces and hyphens.<br />"; } // Thanks to "Carlos Pires" from php.net!
|
||||
$characternamequery = doquery("SELECT charname FROM {{table}} WHERE charname='$charname' LIMIT 1","users");
|
||||
$characternamequery = doquery("SELECT charname FROM <<users>> WHERE charname='$charname' LIMIT 1");
|
||||
if (mysql_num_rows($characternamequery) > 0) { $errors++; $errorlist .= "Character Name already taken - unique Character Name required.<br />"; }
|
||||
|
||||
// Upload new charpicture, if required.
|
||||
|
@ -379,13 +379,13 @@ function charnew() {
|
|||
// Get bonuses and multipliers from classes/difficulties tables.
|
||||
$expbonus = 0;
|
||||
$goldbonus = 0;
|
||||
$classes = dorow(doquery("SELECT * FROM {{table}} WHERE id='$charclass' LIMIT 1", "classes"));
|
||||
$classes = dorow(doquery("SELECT * FROM <<classes>> WHERE id='$charclass' LIMIT 1"));
|
||||
if ($classes != false) {
|
||||
$expbonus += $classes["expbonus"];
|
||||
$goldbonus += $classes["goldbonus"];
|
||||
} else { $errors++; $errorlist .= "Invalid character class"; }
|
||||
|
||||
$difficulties = dorow(doquery("SELECT * FROM {{table}} WHERE id='$difficulty' LIMIT 1", "difficulties"));
|
||||
$difficulties = dorow(doquery("SELECT * FROM <<difficulties>> WHERE id='$difficulty' LIMIT 1"));
|
||||
if ($difficulties != false) {
|
||||
$expbonus += $difficulties["expbonus"];
|
||||
$goldbonus += $difficulties["goldbonus"];
|
||||
|
@ -396,13 +396,13 @@ function charnew() {
|
|||
if ($errors == 0) {
|
||||
|
||||
// Now everything's cool. Create new character row.
|
||||
$query = doquery("INSERT INTO {{table}} SET id='', account='".$acctrow["id"]."', birthdate=NOW(), lastip='".$_SERVER["REMOTE_ADDR"]."', onlinetime=NOW(), charname='$charname', charpicture='$newcharpicture', charclass='$charclass', difficulty='$difficulty', deathpenalty='$deathpenalty', expbonus='$expbonus', goldbonus='$goldbonus'", "users");
|
||||
$query = doquery("INSERT INTO <<users>> SET id='', account='".$acctrow["id"]."', birthdate=NOW(), lastip='".$_SERVER["REMOTE_ADDR"]."', onlinetime=NOW(), charname='$charname', charpicture='$newcharpicture', charclass='$charclass', difficulty='$difficulty', deathpenalty='$deathpenalty', expbonus='$expbonus', goldbonus='$goldbonus'");
|
||||
|
||||
// Update account row.
|
||||
$default = "";
|
||||
if (isset($setdefault)) { $default = "activechar='".mysql_insert_id()."', "; }
|
||||
if ($acctrow["characters"] == 0) { $default = "activechar='".mysql_insert_id()."', "; }
|
||||
$query2 = doquery("UPDATE {{table}} SET $default characters=characters+1 WHERE id='".$acctrow["id"]."' LIMIT 1", "accounts");
|
||||
$query2 = doquery("UPDATE <<accounts>> SET $default characters=characters+1 WHERE id='".$acctrow["id"]."' LIMIT 1");
|
||||
|
||||
// And we're finished.
|
||||
die(header("Location: users.php?do=characters"));
|
||||
|
@ -421,15 +421,17 @@ function charnew() {
|
|||
}
|
||||
|
||||
|
||||
$classes = dorow(doquery("SELECT * FROM {{table}} ORDER BY id", "classes"));
|
||||
$classes = dorow(doquery("SELECT * FROM <<classes>> ORDER BY id"));
|
||||
$row["charclass"] = "";
|
||||
$row["classdesc"] = "";
|
||||
$count = 1;
|
||||
foreach($classes as $a=>$b) {
|
||||
$row["charclass"] .= "<option value=\"".$b["id"]."\">".$b["name"]."</option>";
|
||||
$row["classdesc"] .= "<a title=\"".$b["description"]."\">".$b["name"]."</a> | ";
|
||||
$row["classdesc"] .= "<div id=\"t$count\" class=\"tip\">".$b["description"]."</div><a href=\"#\" onmouseout=\"popUp(event,'t$count')\" onmouseover=\"popUp(event,'t$count')\" onclick=\"return false\">".$b["name"]."</a> | ";
|
||||
$count++;
|
||||
}
|
||||
$row["classdesc"] = rtrim($row["classdesc"], " |");
|
||||
$difficulty = dorow(doquery("SELECT * FROM {{table}} ORDER BY id", "difficulties"));
|
||||
$difficulty = dorow(doquery("SELECT * FROM <<difficulties>> ORDER BY id"));
|
||||
$row["difficulty"] = "";
|
||||
foreach($difficulty as $a=>$b) {
|
||||
$row["difficulty"] .= "<option value=\"".$b["id"]."\">".$b["name"]."</option>";
|
||||
|
@ -448,7 +450,7 @@ function charedit() {
|
|||
|
||||
// Change the active character for the account.
|
||||
if (!is_numeric($_GET["uid"])) { err("Invalid UID."); }
|
||||
$newuserrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$_GET["uid"]."' LIMIT 1", "users"));
|
||||
$newuserrow = dorow(doquery("SELECT * FROM <<users>> WHERE id='".$_GET["uid"]."' LIMIT 1"));
|
||||
if ($newuserrow == false) { err("No such UID."); }
|
||||
if ($newuserrow["account"] != $acctrow["id"]) { err("You don't own that UID."); }
|
||||
|
||||
|
@ -483,7 +485,7 @@ function charedit() {
|
|||
}
|
||||
|
||||
// Now everything's cool.
|
||||
$query = doquery("UPDATE {{table}} SET charpicture='$newcharpicture' WHERE id='".$newuserrow["id"]."' LIMIT 1", "users");
|
||||
$query = doquery("UPDATE <<users>> SET charpicture='$newcharpicture' WHERE id='".$newuserrow["id"]."' LIMIT 1");
|
||||
die(header("Location: users.php?do=characters"));
|
||||
|
||||
} elseif (isset($_POST["delete"])) {
|
||||
|
@ -494,11 +496,11 @@ function charedit() {
|
|||
} elseif (isset($_POST["ultrakill"])) {
|
||||
|
||||
// First we delete the char.
|
||||
$query = doquery("DELETE FROM {{table}} WHERE id='".$newuserrow["id"]."'", "users");
|
||||
$query = doquery("DELETE FROM <<users>> WHERE id='".$newuserrow["id"]."'");
|
||||
|
||||
// Then we gotta update acctrow accordingly.
|
||||
$query2 = dorow(doquery("SELECT * FROM {{table}} WHERE account='".$acctrow["id"]."' ORDER BY id LIMIT 1", "users"));
|
||||
$query3 = doquery("UPDATE {{table}} SET characters=characters-1, activechar='".$query2["id"]."' WHERE id='".$acctrow["id"]."' LIMIT 1", "accounts");
|
||||
$query2 = dorow(doquery("SELECT * FROM <<users>> WHERE account='".$acctrow["id"]."' ORDER BY id LIMIT 1"));
|
||||
$query3 = doquery("UPDATE <<accounts>> SET characters=characters-1, activechar='".$query2["id"]."' WHERE id='".$acctrow["id"]."' LIMIT 1");
|
||||
die(header("Location: users.php?do=characters"));
|
||||
|
||||
} elseif (isset($_POST["wimpout"])) {
|
||||
|
@ -518,7 +520,7 @@ function levelup() {
|
|||
|
||||
if ($userrow["levelup"] == 0) { err("You do not currently have any Level Points to spend."); }
|
||||
|
||||
$classrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["charclass"]."' LIMIT 1", "classes"));
|
||||
$classrow = dorow(doquery("SELECT * FROM <<classes>> WHERE id='".$userrow["charclass"]."' LIMIT 1"));
|
||||
|
||||
if (isset($_POST["submit"])) {
|
||||
|
||||
|
@ -542,8 +544,13 @@ function levelup() {
|
|||
break;
|
||||
case "dex":
|
||||
$userrow["dexterity"]++;
|
||||
$userrow["maxhp"] += (1 * $classrow["hpperdexterity"]);
|
||||
$userrow["currenthp"] += (1 * $classrow["hpperdexterity"]);
|
||||
$userrow["physdefense"] += (1 * $classrow["defenseperdex"]);
|
||||
$userrow["levelup"]--;
|
||||
break;
|
||||
case "lif":
|
||||
$userrow["life"]++;
|
||||
$userrow["maxhp"] += (1 * $classrow["hpperlife"]);
|
||||
$userrow["currenthp"] += (1 * $classrow["hpperlife"]);
|
||||
$userrow["levelup"]--;
|
||||
break;
|
||||
case "enr":
|
||||
|
@ -559,6 +566,7 @@ function levelup() {
|
|||
|
||||
// Round down any fractions.
|
||||
$userrow["physattack"] = floor($userrow["physattack"]);
|
||||
$userrow["physdefense"] = floor($userrow["physdefense"]);
|
||||
$userrow["maxhp"] = floor($userrow["maxhp"]);
|
||||
$userrow["maxmp"] = floor($userrow["maxmp"]);
|
||||
|
||||
|
@ -570,11 +578,12 @@ function levelup() {
|
|||
|
||||
$row["dropdowns"] = "";
|
||||
for($i=0; $i<$userrow["levelup"]; $i++) {
|
||||
$row["dropdowns"] .= "<div style=\"padding-bottom: 5px;\"><select name=\"$i\"><option value=\"0\">Pick One</option><option value=\"str\">Strength</option><option value=\"dex\">Dexterity</option><option value=\"enr\">Energy</option></select></div>\n";
|
||||
$row["dropdowns"] .= "<div style=\"padding-bottom: 5px;\"><select name=\"$i\"><option value=\"0\">Pick One</option><option value=\"str\">Strength</option><option value=\"dex\">Dexterity</option><option value=\"lif\">Life</option><option value=\"enr\">Energy</option></select></div>\n";
|
||||
}
|
||||
$row["classname"] = $classrow["name"];
|
||||
$row["damageperstrength"] = $classrow["damageperstrength"];
|
||||
$row["hpperdexterity"] = $classrow["hpperdexterity"];
|
||||
$row["defenseperdex"] = $classrow["defenseperdex"];
|
||||
$row["hpperlife"] = $classrow["hpperlife"];
|
||||
$row["mpperenergy"] = $classrow["mpperenergy"];
|
||||
$row["levelup"] = $userrow["levelup"];
|
||||
|
||||
|
|
|
@ -6,11 +6,11 @@ if (isset($_GET["code"])) {
|
|||
$code = $_GET["code"];
|
||||
} else { die("Invalid account verification code."); }
|
||||
|
||||
$query = doquery("SELECT * FROM {{table}} WHERE verifycode='$code' LIMIT 1", "accounts");
|
||||
$query = doquery("SELECT * FROM <<accounts>> WHERE verifycode='$code' LIMIT 1");
|
||||
if (mysql_num_rows($query) != 1) {
|
||||
die("Invalid account verification code.");
|
||||
} else {
|
||||
$update = doquery("UPDATE {{table}} SET verifycode='1' WHERE verifycode='$code' LIMIT 1", "accounts");
|
||||
$update = doquery("UPDATE <<accounts>> SET verifycode='1' WHERE verifycode='$code' LIMIT 1");
|
||||
}
|
||||
display("Account Verification",gettemplate("users_verified"), false);
|
||||
|
||||
|
|