Initial commit

This commit is contained in:
root
2020-08-17 19:16:42 -04:00
commit 61584e0eb2
600 changed files with 50518 additions and 0 deletions

3
lotgd-web/lotgd/lib/.htaccess Executable file
View File

@ -0,0 +1,3 @@
<Files *.php>
deny from all
</Files>

View File

@ -0,0 +1,100 @@
<?php
/**
* Page explaining what LotGD is
*
* This page is part of the about page system
* and is MightyE explaining what LotGD is. It
* also contains a way in which a server admin
* can display information about his/her server.
*
* @copyright Copyright © 2002-2005, Eric Stevens & JT Traub, © 2006-2009, Dragonprime Development Team
* @version Lotgd 1.1.2 DragonPrime Edition
* @package Core
* @subpackage Library
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode
*/
$order=array("1","2");
while (list($key,$val)=each($order)){
switch($val){
case "2":
/* NOTICE
* NOTICE Server admins may put their own information here,
* NOTICE please leave the main about body untouched.
* NOTICE
*/
rawoutput("<hr>");
$impressum = getsetting("impressum", "");
if ($impressum > "") {
require_once("lib/nltoappon.php");
output_notl("%s", nltoappon($impressum));
}
break;
case "1":
/* NOTICE
* NOTICE This section may not be modified, please modify the
* NOTICE Server Specific section above.
* NOTICE
*/
output("`@Legend of the Green Dragon`nBy Eric Stevens & JT Traub`n`n");
output("`cLoGD version ");
output_notl("$logd_version`c");
/*
* This section may not be modified, please modify the Server
* Specific section above.
*/
output("MightyE tells you, \"`2Legend of the Green Dragon is a remake of and homage to the classic BBS Door game, Legend of the Red Dragon (aka LoRD) by <a href='http://www.rtsoft.com' target='_blank'>Seth Able Robinson</a>.`@\"", true);
output("`n`n`@\"`2LoRD is now owned by Gameport (<a href='http://www.gameport.com/bbs/lord.html' target='_blank'>http://www.gameport.com/bbs/lord.html</a>), and they retain exclusive rights to the LoRD name and game. ", true);
output("That's why all content in Legend of the Green Dragon is new, with only a very few nods to the original game, such as the buxom barmaid, Violet, and the handsome bard, Seth.`@\"`n`n");
/*
* This section may not be modified, please modify the Server
* Specific section above.
*/
output("`@\"`2Although serious effort was made to preserve the original feel of the game, numerous departures were taken from the original game to enhance playability, and to adapt it to the web.`@\"`n`n");
/*
* This section may not be modified, please modify the Server
* Specific section above.
*/
output("`@\"`2LoGD (after version 0.9.7) is released under a <a href='http://creativecommons.org/licenses/by-nc-sa/2.0/' target='_blank'>Creative Commons License</a>, which essentially means that the source code to the game, and all derivatives of the game must remain open and available upon request.", true);
output("Version 0.9.7 and before are still available under the <a href='http://www.gnu.org/licenses/gpl.html' target='_blank'>GNU General Public License</a> though 0.9.7 will be the last release under that license.", true);
output("To use any of the new features requires using the 1.0.0 code. You may explicitly not place code from versions after 0.9.7 into 0.9.7 and release the combined derivative work under the GPL.`@\"`n`n", true);
/*
* This section may not be modified, please modify the Server
* Specific section above.
*/
output("`@\"`2You may download the latest official version of LoGD at <a href='http://dragonprime.net/' target='_blank'>DragonPrime</a> and you can play the Classic version at <a href='http://lotgd.net/'>http://lotgd.net</a>.`@\"`n`n",true);
//output("`@\"`2The most recent *UNSTABLE* pre-release snapshot is available from <a href='http://dragonprime.net/users/Kendaer/' target='_blank'>http://dragonprime.net/users/Kendaer/</a>.", true);
output("You should attempt to use this code only if you are comfortable with PHP and MySQL and willing to manually keep your code up to date.`@\"`n`n");
/*
* This section may not be modified, please modify the Server
* Specific section above.
*/
output("`@\"`2Additionally, there is an active modder community located at <a href='http://dragonprime.net' target='_blank'>DragonPrime</a> which may help you find additional features which you may wish to add to your game.", true);
output("For these additional features you will find active support within the DragonPrime community.`@\"`n`n");
/*
* This section may not be modified, please modify the Server
* Specific section above.
*/
output("`@\"`2LoGD is programmed in PHP with a MySQL backend.");
output("It is known to run on Windows and Linux with appropriate setups.");
output("The core code has been actively written by Eric Stevens and JT Traub, with some pieces by other authors (denoted in the source at these locations), and the code has been released under a <a href='http://creativecommons.org/licenses/by-nc-sa/2.0/' target='_blank'>Creative Commons License</a>.", true);
output("Users of the source are bound to the terms therein.`n",true);
output("The DragonPrime Development Team took over responsibility for code development on January 1<sup>st</sup>, 2006 and continues to maintain and add to features of the core code.`@\"`n`n",true);
/*
* This section may not be modified, please modify the Server
* Specific section above.
*/
output("`@\"`2Users of the source are free to view and modify the source, but original copyright information, and original text from the about page must be preserved, though they may be added to.`@\"`n`n");
output("`@\"`2We hope you enjoy the game!`@\"");
/*
* This section may not be modified, please modify the Server
* Specific section above.
*/
break;
}
}
addnav("About LoGD");
addnav("Game Setup Info","about.php?op=setup");
addnav("Module Info","about.php?op=listmodules");
addnav("License Info", "about.php?op=license");
modulehook("about");
?>

View File

@ -0,0 +1,37 @@
<?php
/**
* Page explaining the LotGD license
*
* This page is part of the about system
* and is MightyE explaining the new license
* in an easy to understand way.
*
* @copyright Copyright © 2002-2005, Eric Stevens & JT Traub, © 2006-2009, Dragonprime Development Team
* @version Lotgd 1.1.2 DragonPrime Edition
* @package Core
* @subpackage Library
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode
*/
addnav("About LoGD");
addnav("About LoGD","about.php");
addnav("Game Setup Info","about.php?op=setup");
addnav("Module Info","about.php?op=listmodules");
output("`@MightyE tells you, \"`2We're going to take a few moments to try and explain this new license and the reasons behind it in plain English.");
output("The legalese for the license can be found online at <a href='http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode' target='_blank'>http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode</a> and should be read and understood in detail before you use this code.`@\"`n`n", true);
output("`@\"`2This new license was chosen because of a failing with the GPL.");
output("It only covered distribution of source if and only if binaries were distributed.`@\"`n`n");
output("`@\"`2In a web environment, specifically an interpreted web environment such as PHP, merely installing a game does not constitute distribution, and therefore people were taking our work, making modifications to it and not releasing the source code to their modifications so that the entire community could benefit.");
output("They worked with the letter but not the spirit of the law.`@\"`n`n");
output("`@\"`2Investigation on the part of the authors however, led to the fact that the right of public performance was one of the rights normally restricted to copyright holders, AND that computer programs, specifically video games and interactive ones such as Legend of the Green Dragon were considered to be publically performed if run from a public server.`@\"`n`n");
output("`@\"`2The new license restricts public performance of the work unless the source code of the modified work is made available on demand.`@\"`n`n");
output("`@\"`2In plain English, this means that if you put this game on a web server and allow people 'outside of a normal circle of family and its social acquaintances' to play there, then you are publically performing this work and MUST either a) make any and ALL changes which you make to the game available on request (note this doesn't have to be available via the online source display link, but they must be able to ask you for the code AND receive a complete copy), b) make arrangements privately with the authors wherein they grant you a special license, or c) remove the code entirely from the machine.`@\"`n`n");
output("`@\"`2We do recognize that people want to have areas of their game which are theirs and theirs alone.");
output("To that end we will make the following exception to the normal requirements for source code distribution -- any module file which is not modified or derived from a module file included in the base distribution AND which does not require any other modules AND which does not require any modifications to the core code (code distributed with the base release) may be withheld at the authors discretion.`@\"`n`n");
output("`@\"`2We also want to make very clear that version 0.9.7 (also known as version 0.9.7+jt) was the final version released under the GPL.");
output("All versions, starting with the 0.9.8-prerelease code are only licensed under the Creative Commons license.");
output("We EXPLICITLY deny the right to import any code from a 0.9.8-prerelease or later release into a 0.9.7 and earlier release.");
output("Allowing this would cause that imported code to be released under the GPL and that is not something we wish to allow.");
output("Authors of modifications to 0.9.7 will need to re-release their modifications as derivatives/modifications to 0.9.8 code and place them under the same Creative Commons license.");
output("It must be done by the original author since only the original author has the right to change the copyright or license upon their work.");
output("[Additionally, reworking the modifications will be a good idea anyway as the mechanism for making modifications is substantially cleaner/clearer starting with the 0.9.8-prerelease code.]`@\"");
?>

View File

@ -0,0 +1,77 @@
<?php
/**
* Page displaying active modules
*
* This page is part of the about system
* and displays the name, version, author
* and download location of all the active
* modules on the server. Modules are sorted
* by category, and are displayed in a table.
*
* @copyright Copyright © 2002-2005, Eric Stevens & JT Traub, © 2006-2009, Dragonprime Development Team
* @version Lotgd 1.1.2 DragonPrime Edition
* @package Core
* @subpackage Library
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode
*/
addnav("About LoGD");
addnav("About LoGD","about.php");
addnav("Game Setup Info","about.php?op=setup");
addnav("License Info", "about.php?op=license");
$sql = "SELECT * from " . db_prefix("modules") . " WHERE active=1 ORDER BY category,formalname";
$result = db_query($sql);
$mname = translate_inline("Module Name");
$mver = translate_inline("Version");
$mauth = translate_inline("Module Author");
$mdown = translate_inline("Download Location");
rawoutput("<table border='0' cellpadding='2' cellspacing='1' bgcolor='#999999'>",true);
rawoutput("<tr class='trhead'><td>$mname</td><td>$mver</td><td>$mauth</td><td>$mdown</td></tr>",true);
if (db_num_rows($result) == 0) {
rawoutput("<tr class='trlight'><td colspan='4' align='center'>");
output("`i-- No modules installed --`i");
rawoutput("</td></tr>");
}
$cat = "";
$i=0;
while ($row = db_fetch_assoc($result)) {
$i++;
if ($cat != $row['category']) {
rawoutput("<tr class='trhead'><td colspan='4' align='left'>");
output($row['category']);
rawoutput(":</td></tr>");
$cat = $row['category'];
}
rawoutput("<tr class='".($i%2?"trlight":"trdark")."'>");
rawoutput("<td valign='top'>");
output_notl("`&%s`0", $row['formalname']);
rawoutput("<td valign='top'>",true);
output_notl("`^%s`0", $row['version']);
rawoutput("</td><td valign='top'>");
output_notl("`^%s`0", $row['moduleauthor'], true);
rawoutput("</td><td nowrap valign='top'>");
if ($row['download'] == "core_module") {
rawoutput("<a href='http://dragonprime.net/index.php?module=Downloads;catd=4' target='_blank'>");
output("Core Distribution");
rawoutput("</a>");
} elseif ($row['download']) {
// We should check all legeal protocols
$protocols = array("http","https","ftp","ftps");
$protocol = explode(":",$row['download'],2);
$protocol = $protocol[0];
// This will take care of download strings such as: not publically released or contact admin
if (!in_array($protocol,$protocols)){
output("`\$Contact Admin for Release");
}else{
rawoutput("<a href='{$row['download']}' target='_blank'>");
output("Download");
rawoutput("</a>");
}
} else {
output("`\$Not publically released.`0");
}
rawoutput("</td>");
rawoutput("</tr>");
}
rawoutput("</table>");
?>

View File

@ -0,0 +1,88 @@
<?php
/**
* Page displays some of the game settings
*
* This page is part of the about system
* and displays some of the game settings
* so that users know some details about
* the server.
*
* @copyright Copyright © 2002-2005, Eric Stevens & JT Traub, © 2006-2009, Dragonprime Development Team
* @version Lotgd 1.1.2 DragonPrime Edition
* @package Core
* @subpackage Library
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode
*/
addnav("About LoGD");
addnav("About LoGD","about.php");
addnav("Module Info","about.php?op=listmodules");
addnav("License Info", "about.php?op=license");
$setup = array(
"Game Setup,title",
"pvp"=>"Enable Slay Other Players,viewonly",
"pvpday"=>"Player Fights per day,viewonly",
"pvpimmunity"=>"Days that new players are safe from PvP,viewonly",
"pvpminexp"=>"Amount of experience when players become killable in PvP,viewonly",
"soap"=>"Clean user posts (filters bad language and splits words over 45 chars long),viewonly",
"newplayerstartgold"=>"Amount of gold to start a new character with,viewonly",
"New Days,title",
"fightsforinterest"=>"Player must have fewer than how many forest fights to earn interest?,viewonly",
"maxinterest"=>"Max Interest Rate (%),viewonly",
"mininterest"=>"Min Interest Rate (%),viewonly",
"daysperday"=>"Game days per calendar day,viewonly",
"specialtybonus"=>"Extra daily uses in specialty area,viewonly",
"Bank settings,title",
"borrowperlevel"=>"Max amount player can borrow per level,viewonly",
"allowgoldtransfer"=>"Are players allowed to transfer gold,viewonly",
"transferperlevel"=>"Max amount player can transfer per level of recipient (if transfers are enabled),viewonly",
"mintransferlev"=>"Minimum level a player has to be before they can transfer gold (if transfers are enabled),viewonly",
"transferreceive"=>"Total transfers a player can receive in one play day (if transfers are enabled),viewonly",
"maxtransferout"=>"Max amount total a player can transfer to others per level (if transfers are enabled),viewonly",
"Forest,title",
"turns"=>"Forest Fights per day,viewonly",
"dropmingold"=>"Forest Creatures always drop at least 1/4 of possible gold,viewonly",
"Mail Settings,title",
"mailsizelimit"=>"Message size limit per message,viewonly",
"inboxlimit"=>"Limit # of messages in inbox,viewonly",
"oldmail"=>"Automatically delete old messages after (days),viewonly",
"Content Expiration,title",
"expirecontent"=>"Days to keep comments and news? (0 for infinite),viewonly",
"expiretrashacct"=>"Days to keep accounts that were never logged in to? (0 for infinite),viewonly",
"expirenewacct"=>"Days to keep level 1 accounts with no dragon kills? (0 for infinite),viewonly",
"expireoldacct"=>"Days to keep all other accounts? (0 for infinite),viewonly",
"LOGINTIMEOUT"=>"Seconds of inactivity before auto-logoff,viewonly"
);
$useful = array(
"Useful Information,title",
"dayduration"=>"Day Duration,viewonly",
"curgametime"=>"Current game time,viewonly",
"curservertime"=>"Current Server Time,viewonly",
"lastnewday"=>"Last new day,viewonly",
"nextnewday"=>"Next new day,viewonly"
);
$secstonextday = secondstonextgameday($details);
$useful_vals = array(
"dayduration"=>round(($details['dayduration']/60/60),0)." hours",
"curgametime"=>getgametime(),
"curservertime"=>date("Y-m-d h:i:s a"),
"lastnewday"=>date("h:i:s a",strtotime("-{$details['realsecssofartoday']} seconds")),
"nextnewday"=>date("h:i:s a",strtotime("+{$details['realsecstotomorrow']} seconds"))." (".date("H\\h i\\m s\\s",$secstonextday).")"
);
output("`@<h3>Settings for this game</h3>`n`n",true);
$args = array('settings'=>array(),'values'=>array());
$args = modulehook("showsettings", $args);
$form = array_merge($setup, $args['settings']);
$form = array_merge($form, $useful);
$vals = array_merge($settings, $args['values']);
$vals = array_merge($vals, $useful_vals);
showform($form,$vals,true);
?>

87
lotgd-web/lotgd/lib/addnews.php Executable file
View File

@ -0,0 +1,87 @@
<?php
// addnews ready (duh ;))
// translator ready
// mail ready
/**
* News functions
*
* Contains functions for adding news
* items.
*
* @copyright Copyright © 2002-2005, Eric Stevens & JT Traub, © 2006-2009, Dragonprime Development Team
* @version Lotgd 1.1.2 DragonPrime Edition
* @package Core
* @subpackage Library
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode
*/
/**
* Adds a news item for the current user
*
* @param $text The text of the news
* @param $arguments... The sprintf style replacement
* @param $hidefrombio Set to true to hide from bio
* @return resource The result resource from the inserting query
* @see addnews_for_user()
* @uses addnews_for_user() Function actually adds the news item to the database
*/
function addnews(){
// Format: addnews($text[, $sprintf_style_replacement1
// [, $sprintf_style_replacement2...]]
// [, $hidefrombio]);
// We can pass arrays for the sprintf style replacements, which
// represent separate translation sets in the same format as output().
// Eg:
// addnews("%s defeated %s in %s `n%s","Joe","Hank","the Inn",
// array("\"Your mother smelt of elderberries,\" taunted %s.",
// "Joe"));
// Note that the sub-translation does need its own %s location in the
// master output.
global $session;
$args = func_get_args();
array_unshift($args, $session['user']['acctid']);
return call_user_func_array("addnews_for_user", $args);
}
/**
* Adds a news item for a user
*
* @param $user The id of the user for the news
* @param $text The text of the news
* @param $arguments... The sprintf style replacement
* @param $hidefrombio Set to true to hide from bio
* @return resource The result resource from the inserting query
* @see addnews()
*/
function addnews_for_user()
{
global $translation_namespace;
// this works just like addnews, except it can be used to add a message
// to a different player other than the triggering player.
$args = func_get_args();
$user = array_shift($args);
$news = array_shift($args);
$hidefrombio = false;
if (count($args)>0){
$arguments=array();
foreach($args as $key=>$val){
if ($key==count($args)-1 && $val===true){
//if the last argument is true, we're hiding from bio;
//don't put this in the array.
$hidefrombio=true;
}else{
array_push($arguments,$val);
}
}
$arguments = serialize($arguments);
}else{
$arguments="";
}
if ($hidefrombio === true) $user = 0;
$sql = "INSERT INTO " . db_prefix("news") .
" (newstext,newsdate,accountid,arguments,tlschema) VALUES ('" .
addslashes($news) . "','" . date("Y-m-d H:i:s") . "'," .
$user .",'".addslashes($arguments)."','".$translation_namespace."')";
return db_query($sql);
}
?>

1492
lotgd-web/lotgd/lib/all_tables.php Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,54 @@
<?php
// addnews ready
// translator ready
// mail ready
/**
* URL <-> array functions
*
* @copyright Copyright © 2002-2005, Eric Stevens & JT Traub, © 2006-2009, Dragonprime Development Team
* @version Lotgd 1.1.2 DragonPrime Edition
* @package Core
* @subpackage Library
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode
*/
/**
* Turns an array into an URL argument string
*
* Takes an array and encodes it in key=val&key=val form.
* Does not add starting ?
*
* @param array $array The array to turn into an URL
* @return string The URL
*/
function arraytourl($array){
//takes an array and encodes it in key=val&key=val form.
$url="";
$i=0;
foreach($array as $key=>$val){
if ($i>0) $url.="&";
$i++;
$url.=rawurlencode($key)."=".rawurlencode($val);
}
return $url;
}
/**
* Takes an array and returns its arguments in an array
*
* @param string $url The URL
* @return array The arguments from the URL
*/
function urltoarray($url){
//takes a URL and returns its arguments in array form.
if (strpos($url,"?")!==false){
$url = substr($array,strpos($url,"?")+1);
}
$a = explode("&",$url);
$array = array();
foreach($a as $val){
$b = explode("=",$val);
$array[urldecode($b[0])] = urldecode($b[1]);
}
return $array;
}
?>

View File

@ -0,0 +1,39 @@
<?php
// translator ready
// addnews ready
// mail ready
/**
* Misc array functions
*
* Contains functions that perform
* various functions on arrays.
*
* @copyright Copyright © 2002-2005, Eric Stevens & JT Traub, © 2006-2009, Dragonprime Development Team
* @version Lotgd 1.1.2 DragonPrime Edition
* @package Core
* @subpackage Library
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode
*/
/**
* Turns the given parameter into a string
*
* If the given parameter is an array or object,
* it is serialized, and the serialized string is
* return.
*
* Otherwise, the parameter is cast as a string
* and returned.
*
* @param mixed $array
* @return string The parameter converted to a string
*/
function createstring($array){
if (is_array($array) || is_object($array)){
$out = serialize($array);
} else {
$out = (string)$array;
}
return $out;
}
?>

View File

@ -0,0 +1,348 @@
<?php
// translator ready
// addnews ready
// mail ready
/**
*
*
* @copyright Copyright © 2002-2005, Eric Stevens & JT Traub, © 2006-2009, Dragonprime Development Team
* @version Lotgd 1.1.2 DragonPrime Edition
* @package Core
* @subpackage Library
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode
*/
require_once("lib/substitute.php");
function activate_buffs($tag) {
global $session, $badguy, $count;
tlschema("buffs");
$result = array();
$result['invulnerable'] = 0;
$result['dmgmod'] = 1;
$result['compdmgmod'] = 1;
$result['badguydmgmod'] = 1;
$result['atkmod'] = 1;
$result['compatkmod'] = 1;
$result['badguyatkmod'] = 1;
$result['defmod'] = 1;
$result['compdefmod'] = 1;
$result['badguydefmod'] = 1;
$result['lifetap'] = array();
$result['dmgshield'] = array();
foreach($session['bufflist'] as $key=>$buff) {
if (array_key_exists('suspended',$buff) && $buff['suspended']) continue;
if ($buff['schema']) tlschema($buff['schema']);
if (isset($buff['startmsg'])) {
if (is_array($buff['startmsg'])) {
$buff['startmsg'] = str_replace("`%", "`%%", $buff['startmsg']);
$msg = sprintf_translate($buff['startmsg']);
$msg = substitute("`5".$msg."`0`n");
output_notl($msg); //Here it's already translated
}else{
$msg = substitute_array("`5".$buff['startmsg']."`0`n");
output($msg);
}
unset($session['bufflist'][$key]['startmsg']);
}
// Figure out activate based on buff features
$activate = false;
if ($tag == "roundstart") {
if (isset($buff['regen'])) $activate = true;
if (isset($buff['minioncount'])) $activate = true;
} else if ($tag == "offense") {
if (isset($buff['invulnerable']) && $buff['invulnerable'])
$activate = true;
if (isset($buff['atkmod'])) $activate = true;
if (isset($buff['dmgmod'])) $activate = true;
if (isset($buff['badguydefmod'])) $activate = true;
if (isset($buff['lifetap'])) $activate = true;
if (isset($buff['damageshield'])) $activate = true;
} else if ($tag == "defense") {
if (isset($buff['invulnerable']) && $buff['invulnerable'])
$activate = true;
if (isset($buff['defmod'])) $activate = true;
if (isset($buff['badguyatkmod'])) $activate = true;
if (isset($buff['badguydmgmod'])) $activate = true;
if (isset($buff['lifetap'])) $activate = true;
if (isset($buff['damageshield'])) $activate = true;
}
// If this should activate now and it hasn't already activated,
// do the round message and mark it.
if ($activate && (!array_key_exists('used',$buff) || !$buff['used'])) {
// mark it used.
$session['bufflist'][$key]['used'] = 1;
// if it has a 'round message', run it.
if (isset($buff['roundmsg'])) {
if (is_array($buff['roundmsg'])) {
$buff['roundmsg'] = str_replace("`%", "`%%", $buff['roundmsg']);
$msg = sprintf_translate($buff['roundmsg']);
$msg = substitute("`5".$msg."`0`n");
output_notl($msg); //Here it's already translated
}else{
$msg = substitute_array("`5".$buff['roundmsg']."`0`n");
output($msg);
}
}
}
// Now, calculate any effects and run them if needed.
if (isset($buff['invulnerable']) && $buff['invulnerable']) {
$result['invulnerable'] = 1;
}
if (isset($buff['atkmod'])) {
$result['atkmod'] *= $buff['atkmod'];
if (isset($buff['aura']) && $buff['aura']) {
$result['compatkmod'] *= $buff['atkmod'];
}
}
if (isset($buff['badguyatkmod'])) {
$result['badguyatkmod'] *= $buff['badguyatkmod'];
}
if (isset($buff['defmod'])) {
$result['defmod'] *= $buff['defmod'];
if (isset($buff['aura']) && $buff['aura']) {
$result['compdefmod'] *= $buff['defmod'];
}
}
if (isset($buff['badguydefmod'])) {
$result['badguydefmod'] *= $buff['badguydefmod'];
}
if (isset($buff['dmgmod'])) {
$result['dmgmod'] *= $buff['dmgmod'];
if (isset($buff['aura']) && $buff['aura']) {
$result['compdmgmod'] *= $buff['dmgmod'];
}
}
if (isset($buff['badguydmgmod'])) {
$result['badguydmgmod'] *= $buff['badguydmgmod'];
}
if (isset($buff['lifetap'])) {
array_push($result['lifetap'], $buff);
}
if (isset($buff['damageshield'])) {
array_push($result['dmgshield'], $buff);
}
if (isset($buff['regen']) && $tag == "roundstart" && $badguy['istarget'] == true) {
$hptoregen = (int)$buff['regen'];
$hpdiff = $session['user']['maxhitpoints'] - $session['user']['hitpoints'];
// Don't regen if we are above max hp
if ($hpdiff < 0) $hpdiff = 0;
if ($hpdiff < $hptoregen) $hptoregen = $hpdiff;
$session['user']['hitpoints'] += $hptoregen;
// Now, take abs value just incase this was a damaging buff
$hptoregen = abs($hptoregen);
if ($hptoregen == 0) $msg = $buff['effectnodmgmsg'];
else $msg = $buff['effectmsg'];
if (is_array($msg)) {
$msg = sprintf_translate($msg);
$msg = substitute("`)".$msg."`0`n", array("{damage}"), array($hptoregen));
output_notl($msg); //Here it's already translated
}elseif ($msg!="") {
$msg = substitute_array("`)".$msg."`0`n", array("{damage}"), array($hptoregen));
output($msg);
}
if (isset($buff['aura']) && $buff['aura'] == true) {
global $companions;
$auraeffect = (int)round($buff['regen']/3);
if (is_array($companions) && count($companions)>0 && $auraeffect != 0) {
foreach ($companions as $name => $companion) {
$unset = false;
// Need this for <PHP 5 support
$companion = &$companions[$name];
// if a companion is damaged AND ( a companion ist still alive OR ( a companion is unconscious AND it's a healing effect))
if ($companion['hitpoints'] < $companion['maxhitpoints'] && ($companion['hitpoints'] > 0 || ($companion['cannotdie'] == true && $auraeffect > 0))) {
$hptoregen = min($auraeffect, $companion['maxhitpoints']-$companion['hitpoints']);
$companion['hitpoints'] += $hptoregen;
$msg = substitute_array("`)".$buff['auramsg']."`0`n", array("{damage}","{companion}"),array($hptoregen,$companion['name']));
output($msg);
if ($hptoregen < 0 && $companion['hitpoints'] <= 0) {
if (isset($companion['dyingtext'])) {
tlschema("battle");
output($companion['dyingtext']);
tlschema();
}
if (isset($companion['cannotdie']) && $companion['cannotdie'] == true) {
$companion['hitpoints'] = 0;
} else {
$unset = true;
}
}
}
if (!$unset) $newcompanions[$name] = $companion;
}
$companions = $newcompanions; // Seemed to need this...
}
}
}
if (isset($buff['minioncount']) && $tag == "roundstart" && ((isset($buff['areadamage']) && $buff['areadamage'] == true) || $badguy['istarget'] == true) && $badguy['dead'] == false) {
$who = -1;
if (isset($buff['maxbadguydamage']) &&
$buff['maxbadguydamage'] <> 0) {
$max = $buff['maxbadguydamage'];
$min = isset($buff['minbadguydamage'])?$buff['minbadguydamage']:0;
$who = 0;
} else {
$max = isset($buff['maxgoodguydamage'])?$buff['maxgoodguydamage']:0;
$min = isset($buff['mingoodguydamage'])?$buff['mingoodguydamage']:0;
$who = 1;
}
$minioncounter = 1;
while ($minioncounter <= $buff['minioncount'] && $who >= 0) {
$damage = e_rand($min, $max);
if ($who == 0) {
$badguy['creaturehealth'] -= $damage;
if ($badguy['creaturehealth'] <= 0) {
$badguy['istarget'] = false;
$badguy['dead'] = true;
$count = 1;
}
} else if ($who == 1) {
$session['user']['hitpoints'] -= $damage;
}
if ($damage < 0) {
$msg = $buff['effectfailmsg'];
} else if ($damage == 0) {
$msg = $buff['effectnodmgmsg'];
} else if ($damage > 0) {
$msg = $buff['effectmsg'];
}
if (is_array($msg)) {
$msg = sprintf_translate($msg);
$msg = substitute("`)".$msg."`0`n", array("{damage}"), array(abs($damage)));
output_notl($msg); //Here it's already translated
}else if ($msg>"") {
$msg = substitute_array("`)".$msg."`0`n", array("{damage}"), array(abs($damage)));
output($msg);
}
if ($badguy['dead'] == true) break;
$minioncounter++;
}
}
if ($buff['schema']) tlschema();
}
tlschema();
return $result;
}
function process_lifetaps($ltaps, $damage) {
global $session, $badguy;
tlschema("buffs");
foreach($ltaps as $buff) {
if (isset($buff['suspended']) && $buff['suspended']) continue;
if ($buff['schema']) tlschema($buff['schema']);
$healhp = $session['user']['maxhitpoints'] - $session['user']['hitpoints'];
if ($healhp < 0) {
$healhp = 0;
}
if ($healhp == 0) {
$msg = isset($buff['effectnodmgmsg'])?$buff['effectnodmgmsg']:"";
} else {
if ($healhp > $damage * $buff['lifetap']) {
$healhp = round($damage * $buff['lifetap'], 0);
}
if ($healhp < 0) {
$healhp = 0;
}
if ($healhp > 0) {
$msg = isset($buff['effectmsg'])?$buff['effectmsg']:"";
} else if ($healhp == 0) {
$msg = isset($buff['effectfailmsg'])?$buff['effectfailmsg']:"";
}
}
$session['user']['hitpoints'] += $healhp;
if (is_array($msg)) {
$msg = sprintf_translate($msg);
$msg = substitute("`)".$msg."`0`n", array("{damage}"), array($healhp));
output_notl($msg); //Here it's already translated
}else if ($msg>"") {
$msg = substitute_array("`)".$msg."`0`n", array("{damage}"), array($healhp));
output($msg);
}
if ($buff['schema']) tlschema();
}
tlschema();
}
function process_dmgshield($dshield, $damage) {
global $session, $badguy;
tlschema("buffs");
foreach($dshield as $buff) {
if (isset($buff['suspended']) && $buff['suspended']) {
continue;
}
if ($buff['schema']) {
tlschema($buff['schema']);
}
$realdamage = round($damage * $buff['damageshield'], 0);
if ($realdamage < 0) {
$realdamage = 0;
}
$msg = "";
if ($realdamage > 0) {
if (isset($buff['effectmsg'])) {
$msg = $buff['effectmsg'];
}
} else if ($realdamage == 0) {
if (isset($buff['effectfailmsg'])) {
$msg = $buff['effectfailmsg'];
}
}
$badguy['creaturehealth'] -= $realdamage;
if ($badguy['creaturehealth'] <= 0) {
$badguy['istarget'] = false;
$badguy['dead'] = true;
$count = 1;
}
if (is_array($msg)) {
$msg = sprintf_translate($msg);
$msg = substitute("`)".$msg."`0`n", array("{damage}"), array($realdamage));
output_notl($msg); //Here it's already translated
}else if ($msg>"") {
$msg = substitute_array("`)".$msg."`0`n", array("{damage}"), array($realdamage));
output($msg);
}
if ($buff['schema']) {
tlschema();
}
}
tlschema();
}
function expire_buffs() {
global $session, $badguy;
tlschema("buffs");
foreach($session['bufflist'] as $key=>$buff) {
if (array_key_exists('suspended',$buff) && $buff['suspended']) continue;
if ($buff['schema']) tlschema($buff['schema']);
if (array_key_exists('used',$buff) && $buff['used']) {
$session['bufflist'][$key]['used'] = 0;
if ($session['bufflist'][$key]['rounds']>0) {
$session['bufflist'][$key]['rounds']--;
}
if ((int)$session['bufflist'][$key]['rounds'] == 0) {
if (isset($buff['wearoff']) && $buff['wearoff']) {
if (is_array($buff['wearoff'])) {
$buff['wearoff'] = str_replace("`%", "`%%", $buff['wearoff']);
$msg = sprintf_translate($buff['wearoff']);
$msg = substitute("`5".$msg."`0`n");
output_notl($msg); //Here it's already translated
}else{
$msg = substitute_array("`5".$buff['wearoff']."`0`n");
output($msg);
}
}
//unset($session['bufflist'][$key]);
strip_buff($key);
}
}
if ($buff['schema']) tlschema();
}
tlschema();
}
?>

View File

@ -0,0 +1,279 @@
<?php
// translator ready
// addnews ready
// mail ready
require_once("lib/bell_rand.php");
require_once("lib/e_rand.php");
require_once("lib/buffs.php");
function rolldamage(){
global $badguy,$session,$creatureattack,$creatureatkmod,$adjustment;
global $creaturedefmod,$defmod,$atkmod,$buffset,$atk,$def,$options;
if ($badguy['creaturehealth']>0 && $session['user']['hitpoints']>0){
if ($options['type']=='pvp') {
$adjustedcreaturedefense = $badguy['creaturedefense'];
} else {
$adjustedcreaturedefense =
($creaturedefmod*$badguy['creaturedefense'] /
($adjustment*$adjustment));
}
$creatureattack = $badguy['creatureattack']*$creatureatkmod;
$adjustedselfdefense = ($session['user']['defense'] * $adjustment * $defmod);
/*
debug("Base creature defense: " . $badguy['creaturedefense']);
debug("Creature defense mod: $creaturedefmod");
debug("Adjustment: $adjustment");
debug("Adjusted creature defense: $adjustedcreaturedefense");
debug("Adjusted creature attack: $creatureattack");
debug("Adjusted self defense: $adjustedselfdefense");
*/
while(!isset($creaturedmg) || !isset($selfdmg) || $creaturedmg==0 && $selfdmg==0){
$atk = $session['user']['attack']*$atkmod;
if (e_rand(1,20)==1 && $options['type'] != "pvp") $atk*=3;
/*
debug("Attack score: $atk");
*/
$patkroll = bell_rand(0,$atk);
/*
debug("Player Attack roll: $patkroll");
*/
// Set up for crit detection
$atk = $patkroll;
$catkroll = bell_rand(0,$adjustedcreaturedefense);
/*
debug("Creature defense roll: $catkroll");
*/
$creaturedmg = 0-(int)($catkroll - $patkroll);
if ($creaturedmg<0) {
$creaturedmg = (int)($creaturedmg/2);
$creaturedmg = round($buffset['badguydmgmod'] *
$creaturedmg, 0);
}
if ($creaturedmg > 0) {
$creaturedmg = round($buffset['dmgmod']*$creaturedmg,0);
}
$pdefroll = bell_rand(0,$adjustedselfdefense);
$catkroll = bell_rand(0,$creatureattack);
/*
debug("Creature attack roll: $catkroll");
debug("Player defense roll: $pdefroll");
*/
$selfdmg = 0-(int)($pdefroll - $catkroll);
if ($selfdmg<0) {
$selfdmg=(int)($selfdmg/2);
$selfdmg = round($selfdmg*$buffset['dmgmod'], 0);
}
if ($selfdmg > 0) {
$selfdmg = round($selfdmg*$buffset['badguydmgmod'], 0);
}
}
}else{
$creaturedmg=0;
$selfdmg=0;
}
// Handle god mode's invulnerability
if ($buffset['invulnerable']) {
$creaturedmg = abs($creaturedmg);
$selfdmg = -abs($selfdmg);
}
return array("creaturedmg"=>(isset($creaturedmg)?$creaturedmg:0),"selfdmg"=>(isset($selfdmg)?$selfdmg:0));
}
function report_power_move($crit, $dmg) {
global $session;
$uatk = $session['user']['attack'];
if ($crit > $uatk) {
$power = 0;
if ($crit > $uatk*4) {
$msg = "`&`bYou execute a `%MEGA`& power move!!!`b`n";
$power=1;
} elseif ($crit > $uatk*3) {
$msg = "`&`bYou execute a `^DOUBLE`& power move!!!`b`n";
$power=1;
} elseif ($crit > $uatk*2) {
$msg = "`&`bYou execute a power move!!!`b`0`n";
$power=1;
}elseif ($crit > ($uatk * 1.5)) {
$msg = "`7`bYou execute a minor power move!`b`0`n";
$power=1;
}
if ($power) {
tlschema("battle");
output($msg);
tlschema();
$dmg += e_rand($crit/4, $crit/2);
$dmg = max($dmg, 1);
}
}
return $dmg;
}
function suspend_buffs($susp=false, $msg=false){
global $session, $badguy;
$suspendnotify = 0;
reset($session['bufflist']);
while (list($key,$buff)=each($session['bufflist'])){
if (array_key_exists('suspended', $buff) && $buff['suspended'])
continue;
// Suspend non pvp allowed buffs when in pvp
if ($susp && (!isset($buff[$susp]) || !$buff[$susp])) {
$session['bufflist'][$key]['suspended'] = 1;
$suspendnotify = 1;
}
// reset the 'used this round state'
$buff['used']=0;
}
if ($suspendnotify) {
$schema = false;
if ($msg === false) {
$schema = "battle";
$msg = "`&The gods have suspended some of your enhancements!`n";
}
if ($schema) tlschema($schema);
output($msg);
if ($schema) tlschema();
}
}
function suspend_buff_by_name($name, $msg=false) {
global $session;
// If it's not already suspended.
if ($session['bufflist'][$name] &&
!$session['bufflist'][$name]['suspended']) {
$session['bufflist'][$name]['suspended'] = 1;
// And notify.
$schema = false;
if ($msg === false) {
$schema = "battle";
$msg = "`&The gods have suspended some of your enhancements!`n";
}
if ($schema) tlschema($schema);
output($msg);
if ($schema) tlschema();
}
}
function unsuspend_buff_by_name($name, $msg=false) {
global $session;
// If it's not already suspended.
if ($session['bufflist'][$name] &&
$session['bufflist'][$name]['suspended']) {
$session['bufflist'][$name]['suspended'] = 0;
// And notify.
$schema = false;
if ($msg === false) {
$schema = "battle";
$msg = "`&The gods have restored all suspended enhancements.`n`n";
}
if ($schema) tlschema($schema);
output($msg);
if ($schema) tlschema();
}
}
function is_buff_active($name) {
global $session;
// If it's not already suspended.
return (($session['bufflist'][$name] && !$session['bufflist'][$name]['suspended'])?1:0);
}
function unsuspend_buffs($susp=false,$msg=false) {
global $session, $badguy;
$unsuspendnotify = 0;
reset($session['bufflist']);
while (list($key,$buff)=each($session['bufflist'])){
if (array_key_exists("expireafterfight",$buff) && $buff['expireafterfight']) unset($session['bufflist'][$key]);
elseif (array_key_exists("suspended",$buff) && $buff['suspended'] && $susp && (!array_key_exists($susp, $buff) || !$buff[$susp])) {
$session['bufflist'][$key]['suspended'] = 0;
$unsuspendnotify=1;
}
}
if ($unsuspendnotify) {
$schema = false;
if ($msg === false) {
$schema = "battle";
$msg = "`&The gods have restored all suspended enhancements.`n`n";
}
if ($schema) tlschema($schema);
output($msg);
if ($schema) tlschema();
}
}
function apply_bodyguard($level){
global $session, $badguy;
if (!isset($session['bufflist']['bodyguard'])) {
switch($level){
case 1:
$badguyatkmod=1.05;
$defmod=0.95;
$rounds=-1;
break;
case 2:
$badguyatkmod=1.1;
$defmod=0.9;
$rounds=-1;
break;
case 3:
$badguyatkmod=1.2;
$defmod=0.8;
$rounds=-1;
break;
case 4:
$badguyatkmod=1.3;
$defmod=0.7;
$rounds=-1;
break;
case 5:
$badguyatkmod=1.4;
$defmod=0.6;
$rounds=-1;
break;
}
apply_buff('bodyguard' , array(
"startmsg"=>"`\${badguy}'s bodyguard protects them!",
"name"=>"`&Bodyguard",
"wearoff"=>"The bodyguard seems to have fallen asleep.",
"badguyatkmod"=>$badguyatkmod,
"defmod"=>$defmod,
"rounds"=>$rounds,
"allowinpvp"=>1,
"expireafterfight"=>1,
"schema"=>"pvp"
)
);
}
}
function apply_skill($skill,$l){
global $session;
if ($skill=="godmode"){
apply_buff('godmode',array(
"name"=>"`&GOD MODE",
"rounds"=>1,
"wearoff"=>"You feel mortal again.",
"atkmod"=>25,
"defmod"=>25,
"invulnerable"=>1,
"startmsg"=>"`&`bYou feel godlike.`b",
"schema"=>"skill"
));
}
modulehook("apply-specialties");
}
?>

630
lotgd-web/lotgd/lib/bell_rand.php Executable file
View File

@ -0,0 +1,630 @@
<?php
// addnews ready
// translator ready
// mail ready
$bell_curve=0;
function bell_rand($min=false,$max=false){
global $bell_curve;
if ($min===false && $max===false) {
//no value passed, assume 0 min, and 1 max.
$min=0;
$max=1;
}
if ($max===false){ // here got something mixed up in the previous versions
//only one value passed, assume it is the max.
$max = $min;
$min = 0;
}
if($min>$max){
//min is bigger than max, switch.
$x = $max;
$max = $min;
$min = $x;
}
if (($min-$max)==0){
//equal values, return one of them.
return $min;
}
if (!is_array($bell_curve)){
$bell_curve = array(
3 => -0.716599,
4 => -0.708501841,
5 => -0.688258942,
6 => -0.676113203,
7 => -0.659918884,
8 => -0.651821725,
9 => -0.639675985,
10 => -0.631578826,
11 => -0.627530246,
12 => -0.619433087,
13 => -0.611335927,
14 => -0.607287348,
15 => -0.599190188,
16 => -0.595141608,
17 => -0.591093029,
18 => -0.587044449,
19 => -0.582995869,
20 => -0.57894729,
21 => -0.57489871,
22 => -0.57085013,
23 => -0.56680155,
24 => -0.562752971,
25 => -0.558704391,
26 => -0.554655811,
28 => -0.550607232,
29 => -0.546558652,
31 => -0.542510072,
32 => -0.538461492,
34 => -0.534412913,
35 => -0.530364333,
37 => -0.526315753,
39 => -0.522267174,
41 => -0.518218594,
43 => -0.514170014,
45 => -0.510121434,
47 => -0.506072855,
50 => -0.502024275,
52 => -0.497975695,
54 => -0.493927115,
57 => -0.489878536,
60 => -0.485829956,
63 => -0.481781376,
66 => -0.477732797,
69 => -0.473684217,
72 => -0.469635637,
75 => -0.465587057,
79 => -0.461538478,
83 => -0.457489898,
86 => -0.453441318,
90 => -0.449392739,
95 => -0.445344159,
99 => -0.441295579,
104 => -0.437246999,
108 => -0.43319842,
113 => -0.42914984,
118 => -0.42510126,
124 => -0.421052681,
129 => -0.417004101,
135 => -0.412955521,
141 => -0.408906941,
147 => -0.404858362,
154 => -0.400809782,
161 => -0.396761202,
168 => -0.392712623,
175 => -0.388664043,
183 => -0.384615463,
191 => -0.380566883,
199 => -0.376518304,
207 => -0.372469724,
216 => -0.368421144,
226 => -0.364372565,
235 => -0.360323985,
245 => -0.356275405,
256 => -0.352226825,
266 => -0.348178246,
277 => -0.344129666,
289 => -0.340081086,
301 => -0.336032506,
313 => -0.331983927,
326 => -0.327935347,
340 => -0.323886767,
354 => -0.319838188,
368 => -0.315789608,
383 => -0.311741028,
399 => -0.307692448,
415 => -0.303643869,
431 => -0.299595289,
448 => -0.295546709,
466 => -0.29149813,
485 => -0.28744955,
504 => -0.28340097,
523 => -0.27935239,
544 => -0.275303811,
565 => -0.271255231,
587 => -0.267206651,
609 => -0.263158072,
633 => -0.259109492,
657 => -0.255060912,
682 => -0.251012332,
708 => -0.246963753,
734 => -0.242915173,
762 => -0.238866593,
790 => -0.234818014,
820 => -0.230769434,
850 => -0.226720854,
881 => -0.222672274,
914 => -0.218623695,
947 => -0.214575115,
982 => -0.210526535,
1017 => -0.206477955,
1054 => -0.202429376,
1091 => -0.198380796,
1130 => -0.194332216,
1171 => -0.190283637,
1212 => -0.186235057,
1255 => -0.182186477,
1298 => -0.178137897,
1344 => -0.174089318,
1390 => -0.170040738,
1438 => -0.165992158,
1488 => -0.161943579,
1539 => -0.157894999,
1591 => -0.153846419,
1645 => -0.149797839,
1700 => -0.14574926,
1757 => -0.14170068,
1816 => -0.1376521,
1876 => -0.133603521,
1938 => -0.129554941,
2002 => -0.125506361,
2068 => -0.121457781,
2135 => -0.117409202,
2204 => -0.113360622,
2275 => -0.109312042,
2348 => -0.105263463,
2423 => -0.101214883,
2500 => -0.097166303,
2579 => -0.093117723,
2660 => -0.089069144,
2743 => -0.085020564,
2828 => -0.080971984,
2916 => -0.076923405,
3005 => -0.072874825,
3097 => -0.068826245,
3192 => -0.064777665,
3288 => -0.060729086,
3387 => -0.056680506,
3489 => -0.052631926,
3593 => -0.048583346,
3700 => -0.044534767,
3809 => -0.040486187,
3920 => -0.036437607,
4035 => -0.032389028,
4152 => -0.028340448,
4272 => -0.024291868,
4394 => -0.020243288,
4520 => -0.016194709,
4648 => -0.012146129,
4779 => -0.008097549,
4913 => -0.00404897,
5050 => 0, // 5th percentile
5190 => 0.00404819,
5334 => 0.00809677,
5480 => 0.012145349,
5629 => 0.016193929,
5782 => 0.020242509,
5938 => 0.024291088,
6097 => 0.028339668,
6260 => 0.032388248,
6426 => 0.036436828,
6595 => 0.040485407,
6768 => 0.044533987,
6944 => 0.048582567,
7123 => 0.052631146,
7307 => 0.056679726,
7493 => 0.060728306,
7684 => 0.064776886,
7878 => 0.068825465,
8076 => 0.072874045,
8277 => 0.076922625,
8482 => 0.080971205,
8692 => 0.085019784,
8904 => 0.089068364,
9121 => 0.093116944,
9342 => 0.097165523,
9566 => 0.101214103,
9795 => 0.105262683,
10027 => 0.109311263,
10264 => 0.113359842,
10504 => 0.117408422,
10749 => 0.121457002,
10997 => 0.125505581,
11250 => 0.129554161,
11507 => 0.133602741,
11768 => 0.137651321,
12033 => 0.1416999,
12302 => 0.14574848,
12576 => 0.14979706,
12854 => 0.153845639,
13136 => 0.157894219,
13422 => 0.161942799,
13712 => 0.165991379,
14007 => 0.170039958,
14306 => 0.174088538,
14609 => 0.178137118,
14917 => 0.182185697,
15229 => 0.186234277,
15545 => 0.190282857,
15866 => 0.194331437,
16190 => 0.198380016,
16519 => 0.202428596,
16853 => 0.206477176,
17190 => 0.210525755,
17532 => 0.214574335,
17879 => 0.218622915,
18229 => 0.222671495,
18584 => 0.226720074,
18943 => 0.230768654,
19306 => 0.234817234,
19674 => 0.238865814,
20045 => 0.242914393,
20421 => 0.246962973,
20801 => 0.251011553,
21186 => 0.255060132,
21574 => 0.259108712,
21966 => 0.263157292,
22363 => 0.267205872,
22763 => 0.271254451,
23168 => 0.275303031,
23576 => 0.279351611,
23989 => 0.28340019,
24405 => 0.28744877,
24825 => 0.29149735,
25249 => 0.29554593,
25677 => 0.299594509,
26109 => 0.303643089,
26544 => 0.307691669,
26983 => 0.311740248,
27425 => 0.315788828,
27871 => 0.319837408,
28321 => 0.323885988,
28774 => 0.327934567,
29230 => 0.331983147,
29690 => 0.336031727,
30153 => 0.340080306,
30619 => 0.344128886,
31089 => 0.348177466,
31561 => 0.352226046,
32037 => 0.356274625,
32515 => 0.360323205,
32997 => 0.364371785,
33481 => 0.368420365,
33968 => 0.372468944,
34458 => 0.376517524,
34950 => 0.380566104,
35445 => 0.384614683,
35942 => 0.388663263,
36442 => 0.392711843,
36944 => 0.396760423,
37448 => 0.400809002,
37955 => 0.404857582,
38463 => 0.408906162,
38974 => 0.412954741,
39486 => 0.417003321,
40001 => 0.421051901,
40517 => 0.425100481,
41034 => 0.42914906,
41553 => 0.43319764,
42074 => 0.43724622,
42596 => 0.441294799,
43119 => 0.445343379,
43644 => 0.449391959,
44170 => 0.453440539,
44696 => 0.457489118,
45224 => 0.461537698,
45753 => 0.465586278,
46282 => 0.469634857,
46812 => 0.473683437,
47342 => 0.477732017,
47873 => 0.481780597,
48405 => 0.485829176,
48936 => 0.489877756,
49468 => 0.493926336,
50000 => 0.497974916,
50532 => 0.502023495,
51064 => 0.506072075,
51595 => 0.510120655,
52127 => 0.514169234,
52658 => 0.518217814,
53188 => 0.522266394,
53718 => 0.526314974,
54247 => 0.530363553,
54776 => 0.534412133,
55304 => 0.538460713,
55830 => 0.542509292,
56356 => 0.546557872,
56881 => 0.550606452,
57404 => 0.554655032,
57926 => 0.558703611,
58447 => 0.562752191,
58966 => 0.566800771,
59483 => 0.57084935,
59999 => 0.57489793,
60514 => 0.57894651,
61026 => 0.58299509,
61537 => 0.587043669,
62045 => 0.591092249,
62552 => 0.595140829,
63056 => 0.599189408,
63558 => 0.603237988,
64058 => 0.607286568,
64555 => 0.611335148,
65050 => 0.615383727,
65542 => 0.619432307,
66032 => 0.623480887,
66519 => 0.627529466,
67003 => 0.631578046,
67485 => 0.635626626,
67963 => 0.639675206,
68439 => 0.643723785,
68911 => 0.647772365,
69381 => 0.651820945,
69847 => 0.655869525,
70310 => 0.659918104,
70770 => 0.663966684,
71226 => 0.668015264,
71679 => 0.672063843,
72129 => 0.676112423,
72575 => 0.680161003,
73017 => 0.684209583,
73456 => 0.688258162,
73891 => 0.692306742,
74323 => 0.696355322,
74751 => 0.700403901,
75175 => 0.704452481,
75595 => 0.708501061,
76011 => 0.712549641,
76424 => 0.71659822,
76832 => 0.7206468,
77237 => 0.72469538,
77637 => 0.728743959,
78034 => 0.732792539,
78426 => 0.736841119,
78814 => 0.740889699,
79199 => 0.744938278,
79579 => 0.748986858,
79955 => 0.753035438,
80326 => 0.757084017,
80694 => 0.761132597,
81057 => 0.765181177,
81416 => 0.769229757,
81771 => 0.773278336,
82121 => 0.777326916,
82468 => 0.781375496,
82810 => 0.785424076,
83147 => 0.789472655,
83481 => 0.793521235,
83810 => 0.797569815,
84134 => 0.801618394,
84455 => 0.805666974,
84771 => 0.809715554,
85083 => 0.813764134,
85391 => 0.817812713,
85694 => 0.821861293,
85993 => 0.825909873,
86288 => 0.829958452,
86578 => 0.834007032,
86864 => 0.838055612,
87146 => 0.842104192,
87424 => 0.846152771,
87698 => 0.850201351,
87967 => 0.854249931,
88232 => 0.85829851,
88493 => 0.86234709,
88750 => 0.86639567,
89003 => 0.87044425,
89251 => 0.874492829,
89496 => 0.878541409,
89736 => 0.882589989,
89973 => 0.886638568,
90205 => 0.890687148,
90434 => 0.894735728,
90658 => 0.898784308,
90879 => 0.902832887,
91096 => 0.906881467,
91308 => 0.910930047,
91518 => 0.914978626,
91723 => 0.919027206,
91924 => 0.923075786,
92122 => 0.927124366,
92316 => 0.931172945,
92507 => 0.935221525,
92693 => 0.939270105,
92877 => 0.943318685,
93056 => 0.947367264,
93232 => 0.951415844,
93405 => 0.955464424,
93574 => 0.959513003,
93740 => 0.963561583,
93903 => 0.967610163,
94062 => 0.971658743,
94218 => 0.975707322,
94371 => 0.979755902,
94520 => 0.983804482,
94666 => 0.987853061,
94810 => 0.991901641,
94950 => 0.995950221,
95087 => 1, // 95th Percentile
95221 => 1.00404738,
95352 => 1.00809596,
95480 => 1.01214454,
95606 => 1.016193119,
95728 => 1.020241699,
95848 => 1.024290279,
95965 => 1.028338859,
96080 => 1.032387438,
96191 => 1.036436018,
96300 => 1.040484598,
96407 => 1.044533177,
96511 => 1.048581757,
96613 => 1.052630337,
96712 => 1.056678917,
96808 => 1.060727496,
96903 => 1.064776076,
96995 => 1.068824656,
97084 => 1.072873236,
97172 => 1.076921815,
97257 => 1.080970395,
97340 => 1.085018975,
97421 => 1.089067554,
97500 => 1.093116134,
97577 => 1.097164714,
97652 => 1.101213294,
97725 => 1.105261873,
97796 => 1.109310453,
97865 => 1.113359033,
97932 => 1.117407612,
97998 => 1.121456192,
98062 => 1.125504772,
98124 => 1.129553352,
98184 => 1.133601931,
98243 => 1.137650511,
98300 => 1.141699091,
98355 => 1.14574767,
98409 => 1.14979625,
98461 => 1.15384483,
98512 => 1.15789341,
98562 => 1.161941989,
98610 => 1.165990569,
98656 => 1.170039149,
98702 => 1.174087728,
98745 => 1.178136308,
98788 => 1.182184888,
98829 => 1.186233468,
98870 => 1.190282047,
98909 => 1.194330627,
98946 => 1.198379207,
98983 => 1.202427786,
99018 => 1.206476366,
99053 => 1.210524946,
99086 => 1.214573526,
99119 => 1.218622105,
99150 => 1.222670685,
99180 => 1.226719265,
99210 => 1.230767845,
99238 => 1.234816424,
99266 => 1.238865004,
99292 => 1.242913584,
99318 => 1.246962163,
99343 => 1.251010743,
99367 => 1.255059323,
99391 => 1.259107903,
99413 => 1.263156482,
99435 => 1.267205062,
99456 => 1.271253642,
99477 => 1.275302221,
99496 => 1.279350801,
99515 => 1.283399381,
99534 => 1.287447961,
99552 => 1.29149654,
99569 => 1.29554512,
99585 => 1.2995937,
99601 => 1.303642279,
99617 => 1.307690859,
99632 => 1.311739439,
99646 => 1.315788019,
99660 => 1.319836598,
99674 => 1.323885178,
99687 => 1.327933758,
99699 => 1.331982337,
99711 => 1.336030917,
99723 => 1.340079497,
99734 => 1.344128077,
99744 => 1.348176656,
99755 => 1.352225236,
99765 => 1.356273816,
99774 => 1.360322396,
99784 => 1.364370975,
99793 => 1.368419555,
99801 => 1.372468135,
99809 => 1.376516714,
99817 => 1.380565294,
99825 => 1.384613874,
99832 => 1.388662454,
99839 => 1.392711033,
99846 => 1.396759613,
99853 => 1.400808193,
99859 => 1.404856772,
99865 => 1.408905352,
99871 => 1.412953932,
99876 => 1.417002512,
99882 => 1.421051091,
99887 => 1.425099671,
99892 => 1.429148251,
99896 => 1.43319683,
99901 => 1.43724541,
99905 => 1.44129399,
99910 => 1.44534257,
99914 => 1.449391149,
99917 => 1.453439729,
99921 => 1.457488309,
99925 => 1.461536888,
99928 => 1.465585468,
99931 => 1.469634048,
99934 => 1.473682628,
99937 => 1.477731207,
99940 => 1.481779787,
99943 => 1.485828367,
99946 => 1.489876946,
99948 => 1.493925526,
99950 => 1.497974106,
99953 => 1.502022686,
99955 => 1.506071265,
99957 => 1.510119845,
99959 => 1.514168425,
99961 => 1.518217005,
99963 => 1.522265584,
99965 => 1.526314164,
99966 => 1.530362744,
99968 => 1.534411323,
99969 => 1.538459903,
99971 => 1.542508483,
99972 => 1.546557063,
99974 => 1.550605642,
99975 => 1.554654222,
99976 => 1.558702802,
99977 => 1.562751381,
99978 => 1.566799961,
99979 => 1.570848541,
99980 => 1.574897121,
99981 => 1.5789457,
99982 => 1.58299428,
99983 => 1.58704286,
99984 => 1.591091439,
99985 => 1.595140019,
99986 => 1.603237179,
99987 => 1.607285758,
99988 => 1.615382918,
99989 => 1.623480077,
99990 => 1.627528657,
99991 => 1.635625816,
99992 => 1.647771556,
99993 => 1.655868715,
99994 => 1.672063034,
99995 => 1.684208773,
99996 => 1.704451672,
99997 => 1.712548831
);
}
$r = mt_rand(0,100000);
//echo $r." = ";
reset($bell_curve);
while (list($key,$val)=each($bell_curve)){
if ($key>=$r) {
return $min + $val * ($max-$min);
}
}
//We're above 0.99997
return $min + $val * ($max-$min);
//below optomizations don't work atm.
echo $r." = ";
$index="0.00000";
for ($n = 0; $n<strlen($r); $n++){
$f = substr($r,0,$n);
if (isset($bell_curve[(float)$f])) $index = $f;
}
if (strlen($index)>=7){
return $min + $bell_curve[(float)$f] * ($max-$min);
}
$o = strlen($f)-2;
$o = pow(10,$o); // $o is orders of magnitude of our current closest index match
for ($n = 0; $n<10000; $n++){
$x = $n / $o;
if (isset($bell_curve[(float)($f+$x)])) return $min + $bell_curve[(float)($f+$x)] * ($max-$min);
if (isset($bell_curve[(float)($f-$x)])) return $min + $bell_curve[(float)($f-$x)] * ($max-$min);
}
echo "\n<br>Unable to locate random value, \$r was $r<br>\n";
}
?>

212
lotgd-web/lotgd/lib/buffs.php Executable file
View File

@ -0,0 +1,212 @@
<?php
// addnews ready
// translator ready
// mail ready
$buffreplacements = array();
$debuggedbuffs = array();
function calculate_buff_fields(){
global $session, $badguy, $buffreplacements, $debuggedbuffs;
if (!$session['bufflist']) return;
//run temp stats
reset($session['bufflist']);
while (list($buffname,$buff)=each($session['bufflist'])){
if (!isset($buff['tempstats_calculated'])){
while (list($property,$value)=each($buff)){
if (substr($property,0,9)=='tempstat-'){
apply_temp_stat(substr($property,9),$value);
}
}//end while
$session['bufflist'][$buffname]['tempstats_calculated']=true;
}//end if
}//end while
//process calculated buff fields.
reset($session['bufflist']);
if (!is_array($buffreplacements)) $buffreplacements = array();
while (list($buffname,$buff)=each($session['bufflist'])){
if (!isset($buff['fields_calculated'])){
while (list($property,$value)=each($buff)){
//calculate dynamic buff fields
$origstring = $value;
//Simple <module|variable> replacements for get_module_pref('variable','module')
$value = preg_replace("/<([A-Za-z0-9]+)\\|([A-Za-z0-9]+)>/","get_module_pref('\\2','\\1')",$value);
//simple <variable> replacements for $session['user']['variable']
$value = preg_replace("/<([A-Za-z0-9]+)>/","\$session['user']['\\1']",$value);
if (!defined("OLDSU")) {
define("OLDSU", $session['user']['superuser']);
}
if ($value != $origstring){
if (strtolower(substr($value,0,6))=="debug:"){
$errors="";
$origstring = substr($origstring,6);
$value = substr($value,6);
if (!isset($debuggedbuffs[$buffname])) $debuggedbuffs[$buffname]=array();
ob_start();
$val = eval("return $value;");
$errors = ob_get_contents();
ob_end_clean();
if (!isset($debuggedbuffs[$buffname][$property])){
if ($errors==""){
debug("Buffs[$buffname][$property] evaluates successfully to $val");
}else{
debug("Buffs[$buffname][$property] has an evaluation error<br>"
.htmlentities($origstring, ENT_COMPAT, getsetting("charset", "ISO-8859-1"))." becomes <br>"
.htmlentities($value, ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."<br>"
.$errors);
$val="";
}
$debuggedbuffs[$buffname][$property]=true;
}
$origstring="debug:".$origstring;
$value="debug".$value;
}else{
$val = eval("return $value;");
}
}else{
$val = $value;
}
$session['user']['superuser'] = OLDSU;
//Avoiding PHP bug 27646
// (http://bugs.php.net/bug.php?id=27646&edit=2) -
// Unserialize doesn't recognize NAN, -INF and INF
if (function_exists('is_nan')) {
if (is_numeric($val) &&
(is_nan($val) || is_infinite($val)))
$val=$value;
} else {
// We have an older version of PHP, so, let's try
// something else.
$l = strtolower("$val");
if ((substr($l, 3) == "nan") || (substr($l, -3) == "inf"))
$val = $value;
}
if (!isset($output)) $output = "";
if ($output == "" && (string)$val != (string)$origstring){
$buffreplacements[$buffname][$property] = $origstring;
$session['bufflist'][$buffname][$property] = $val;
}//end if
unset($val);
}//end while
$session['bufflist'][$buffname]['fields_calculated']=true;
}//end if
}//end while
}//end function
function restore_buff_fields(){
global $session, $buffreplacements;
if (is_array($buffreplacements)){
reset($buffreplacements);
while (list($buffname,$val)=each($buffreplacements)){
reset($val);
while (list($property,$value)=each($val)){
if (isset($session['bufflist'][$buffname])){
$session['bufflist'][$buffname][$property] = $value;
unset($session['bufflist'][$buffname]['fields_calculated']);
}//end if
}//end while
unset($buffreplacements[$buffname]);
}//end while
}//end if
//restore temp stats
if (!is_array($session['bufflist'])) $session['bufflist'] = array();
reset($session['bufflist']);
while (list($buffname,$buff)=each($session['bufflist'])){
if (array_key_exists("tempstats_calculated",$buff) && $buff['tempstats_calculated']){
reset($buff);
while (list($property,$value)=each($buff)){
if (substr($property,0,9)=='tempstat-'){
apply_temp_stat(substr($property,9),-$value);
}
}//end while
unset($session['bufflist'][$buffname]['tempstats_calculated']);
}//end if
}//end while
}//end function
function apply_buff($name,$buff){
global $session,$buffreplacements, $translation_namespace;
if (!isset($buff['schema']) || $buff['schema'] == "") {
$buff['schema'] = $translation_namespace;
}
if (isset($buffreplacements[$name])) unset($buffreplacements[$name]);
if (isset($session['bufflist'][$name])){
//we'll need to unapply buff fields before applying this buff since
//it's already set.
restore_buff_fields();
}
$buff = modulehook("modify-buff", array("name"=>$name, "buff"=>$buff));
$session['bufflist'][$name] = $buff['buff'];
calculate_buff_fields();
}
function apply_companion($name,$companion,$ignorelimit=false){
global $session, $companions;
if (!is_array($companions)) {
$companions = @unserialize($session['user']['companions']);
}
$companionsallowed = getsetting("companionsallowed", 1);
$args = modulehook("companionsallowed", array("maxallowed"=>$companionsallowed));
$companionsallowed = $args['maxallowed'];
$current = 0;
foreach ($companions as $thisname=>$thiscompanion) {
if (isset($companion['ignorelimit']) && $companion['ignorelimit'] == true) {
} else {
if ($thisname != $name)
++$current;
}
}
if ($current < $companionsallowed || $ignorelimit == true) {
if (isset($companions[$name])) {
unset($companions[$name]);
}
if (!isset($companion['ignorelimit']) && $ignorelimit == true) {
$companion['ignorelimit'] = true;
}
$companions[$name] = $companion;
$session['user']['companions'] = createstring($companions);
return true; // success!
} else {
debug("Failed to add companion due to restrictions regarding the maximum amount of companions allowed.");
return false;
}
}
function strip_buff($name){
global $session, $buffreplacements;
restore_buff_fields();
if (isset($session['bufflist'][$name]))
unset($session['bufflist'][$name]);
if (isset($buffreplacements[$name]))
unset($buffreplacements[$name]);
calculate_buff_fields();
}
function strip_all_buffs(){
global $session;
$thebuffs = $session['bufflist'];
reset($thebuffs);
while (list($buffname,$buff)=each($thebuffs)){
strip_buff($buffname);
}
}
function has_buff($name){
global $session;
if (isset($session['bufflist'][$name])) return true;
return false;
}
?>

138
lotgd-web/lotgd/lib/censor.php Executable file
View File

@ -0,0 +1,138 @@
<?php
// translator ready
// addnews ready
// mail ready
function soap($input,$debug=false,$skiphook=false){
global $session;
require_once("lib/sanitize.php");
$final_output = $input;
// $output is the color code-less (fully sanitized) input against which
// we search.
$output = full_sanitize($input);
// the mask of displayable chars that should be masked out;
// X displays, _ masks.
$mix_mask = str_pad("",strlen($output),"X");
if (getsetting("soap",1)){
$search = nasty_word_list();
$exceptions = array_flip(good_word_list());
$changed_content = false;
while (list($key,$word)=each($search)){
do {
if ($word > "")
$times = preg_match_all($word,$output,$matches);
else
$times = 0;
for ($x=0; $x<$times; $x++){
if (strlen($matches[0][$x]) < strlen($matches[1][$x])){
$shortword = $matches[0][$x];
$longword = $matches[1][$x];
}else{
$shortword = $matches[1][$x];
$longword = $matches[0][$x];
}
if (isset($exceptions[strtolower($longword)])){
$x--;
$times--;
if ($debug)
output("This word is ok because it was caught by an exception: `b`^%s`7`b`n",$longword);
}else{
if ($debug)
output("`7This word is not ok: \"`%%s`7\"; it blocks on the pattern `i%s`i at \"`\$%s`7\".`n",$longword,$word,$shortword);
// if the word should be filtered, drop it from the
// search terms ($output), and mask its bytes out of
// the output mask.
$len = strlen($shortword);
$pad = str_pad("",$len,"_");
//while (($p = strpos($output,$shortword))!==false){
$p = strpos($output,$shortword);
$output = substr($output,0,$p) . $pad .
substr($output,$p+$len);
$mix_mask = substr($mix_mask,0,$p) . $pad .
substr($mix_mask,$p+$len);
//}
$changed_content = true;
}//end if
}//end for
} while ($times > 0);
}
$y = 0; //position within final output
$pad = '#@%$!';
for ($x=0; $x<strlen($mix_mask); $x++){
while (substr($final_output,$y,1)=="`"){
$y+=2; //when encountering appo encoding, skip over it.
}
//this character should be masked out.
if (substr($mix_mask,$x,1)=="_"){
$final_output = substr($final_output,0,$y) .
substr($pad,$x % strlen($pad),1) .
substr($final_output,$y+1);
}
$y++;
}
if ($session['user']['superuser'] & SU_EDIT_COMMENTS &&
$changed_content){
output("`0The filter would have tripped on \"`#%s`0\" but since you're a moderator, I'm going to be lenient on you. The text would have read, \"`#%s`0\"`n`n",$input,$final_output);
return $input;
}else{
if ($changed_content && !$skiphook)
modulehook("censor", array("input"=>$input));
return $final_output;
}
}else{
return $final_output;
}
}
function good_word_list(){
$sql = "SELECT * FROM " . db_prefix("nastywords") . " WHERE type='good'";
$result = db_query_cached($sql,"goodwordlist");
$row = db_fetch_assoc($result);
return explode(" ",$row['words']);
}
function nasty_word_list(){
$search = datacache("nastywordlist",600);
if ($search!==false && is_array($search)) return $search;
$sql = "SELECT * FROM " . db_prefix("nastywords") . " WHERE type='nasty'";
$result = db_query($sql);
$row = db_fetch_assoc($result);
$search = " ".$row['words']." ";
$search = preg_replace('/(?<=.)(?<!\\\\)\'(?=.)/', '\\\'', $search);
$search = str_replace("a",'[a4@<40><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]',$search);
$search = str_replace("b",'[b<>]',$search);
$search = str_replace("d",'[d<><64><EFBFBD>]',$search);
$search = str_replace("e",'[e3<65><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]',$search);
$search = str_replace("n",'[n<><6E>]',$search);
$search = str_replace("o",'[o<><6F>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]',$search);
$search = str_replace("p",'[p<><70><EFBFBD>]',$search);
$search = str_replace("r",'[r<>]',$search);
// $search = str_replace("s",'[sz$<24>]',$search);
$search = preg_replace('/(?<!\\\\)s/','[sz$<24>]',$search);
$search = str_replace("t",'[t7+]',$search);
$search = str_replace("u",'[u<><75><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]',$search);
$search = str_replace("x",'[xפ]',$search);
$search = str_replace("y",'[yݥ<79><DDA5>]',$search);
//these must happen in exactly this order:
$search = str_replace("l",'[l1!<21>]',$search);
$search = str_replace("i",'[li1!<21><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]',$search);
$search = str_replace("k",'c',$search);
$search = str_replace("c",'[c\\(k穢]',$search);
$start = "'\\b";
$end = "\\b'iU";
$ws = "[^[:space:]\\t]*"; //whitespace (\w is not hungry enough)
//space not preceeded by a star
$search = preg_replace("'(?<!\\*) '",")+$end ",$search);
//space not anteceeded by a star
$search = preg_replace("' (?!\\*)'"," $start(",$search);
//space preceeded by a star
$search = str_replace("* ",")+$ws$end ",$search);
//space anteceeded by a star
$search = str_replace(" *"," $start$ws(",$search);
$search = "$start(".trim($search).")+$end";
$search = str_replace("$start()+$end","",$search);
$search = explode(" ",$search);
updatedatacache("nastywordlist",$search);
return $search;
}
?>

View File

@ -0,0 +1,65 @@
<?php
function char_cleanup($id, $type)
{
// this function handles the grunt work of character cleanup.
// Run any modules hooks who want to deal with character deletion, or stop it
$return = modulehook("delete_character",
array("acctid"=>$id, "deltype"=>$type, "dodel"=>true));
if(!$return['dodel']) return false;
// delete the output field from the accounts_output table introduced in 1.1.1
db_query("DELETE FROM " . db_prefix("accounts_output") . " WHERE acctid=$id;");
// delete the comments the user posted, necessary to have the systemcomments with acctid 0 working
db_query("DELETE FROM " . db_prefix("commentary") . " WHERE author=$id;");
// Clean up any clan positions held by this character
$sql = "SELECT clanrank,clanid FROM " . db_prefix("accounts") .
" WHERE acctid=$id";
$res = db_query($sql);
$row = db_fetch_assoc($res);
if ($row['clanid'] != 0 && $row['clanrank'] == CLAN_LEADER) {
$cid = $row['clanid'];
// We need to auto promote or disband the clan.
$sql = "SELECT name,acctid,clanrank FROM " . db_prefix("accounts") .
" WHERE clanid=$cid AND clanrank > " . CLAN_APPLICANT . " AND acctid<>$id ORDER BY clanrank DESC, clanjoindate";
$res = db_query($sql);
if (db_num_rows($res)) {
// Okay, we can promote if needed
$row = db_fetch_assoc($res);
if ($row['clanrank'] != CLAN_LEADER) {
// No other leaders, promote this one
$id1 = $row['acctid'];
$sql = "UPDATE " . db_prefix("accounts") .
" SET clanrank=" . CLAN_LEADER . " WHERE acctid=$id1";
db_query($sql);
}
} else {
// this clan needs to be disbanded.
$sql = "DELETE FROM " . db_prefix("clans") . " WHERE clanid=$cid";
db_query($sql);
// And just in case we goofed, no players associated with a
// deleted clan This shouldn't be important, but.
$sql = "UPDATE " . db_prefix("accounts") . " SET clanid=0,clanrank=0,clanjoindate='0000-00-00 00:00;00' WHERE clanid=$cid";
db_query($sql);
}
}
// Delete any module user prefs
module_delete_userprefs($id);
// Delete any mail to or from the user
db_query('DELETE FROM ' . db_prefix('mail') . ' WHERE msgto=' . $id . ' OR msgfrom=' . $id);
// Delete any news from the user
db_query('DELETE FROM ' . db_prefix('news') . ' WHERE accountid=' . $id);
return true;
}
?>

View File

@ -0,0 +1,48 @@
<?php
// translator ready
// addnews ready
// mail ready
function checkban($login=false){
global $session;
if (isset($session['banoverride']) && $session['banoverride'])
return false;
if ($login===false){
$ip=$_SERVER['REMOTE_ADDR'];
$id=$_COOKIE['lgi'];
}else{
$sql = "SELECT lastip,uniqueid,banoverride,superuser FROM " . db_prefix("accounts") . " WHERE login='$login'";
$result = db_query($sql);
$row = db_fetch_assoc($result);
if ($row['banoverride'] || ($row['superuser'] &~ SU_DOESNT_GIVE_GROTTO)){
$session['banoverride']=true;
return false;
}
db_free_result($result);
$ip=$row['lastip'];
$id=$row['uniqueid'];
}
$sql = "SELECT * FROM " . db_prefix("bans") . " where ((substring('$ip',1,length(ipfilter))=ipfilter AND ipfilter<>'') OR (uniqueid='$id' AND uniqueid<>'')) AND (banexpire='0000-00-00' OR banexpire>='".date("Y-m-d")."')";
$result = db_query($sql);
if (db_num_rows($result)>0){
$session=array();
tlschema("ban");
$session['message'].=translate_inline("`n`4You fall under a ban currently in place on this website:`n");
while ($row = db_fetch_assoc($result)) {
$session['message'].=$row['banreason']."`n";
if ($row['banexpire']=='0000-00-00')
$session['message'].=translate_inline(" `\$This ban is permanent!`0");
else
$session['message'].=sprintf_translate(" `^This ban will be removed `\$after`^ %s.`0",date("M d, Y",strtotime($row['banexpire'])));
$sql = "UPDATE " . db_prefix("bans") . " SET lasthit='".date("Y-m-d H:i:s")."' WHERE ipfilter='{$row['ipfilter']}' AND uniqueid='{$row['uniqueidid']}'";
db_query($sql);
$session['message'].="`n";
}
$session['message'].=translate_inline("`4If you wish, you may appeal your ban with the petition link.");
tlschema();
header("Location: index.php");
exit();
}
db_free_result($result);
}
?>

View File

@ -0,0 +1,46 @@
<?php
page_header("Clan Halls");
$registrar=getsetting('clanregistrar','`%Karissa');
addnav("Clan Options");
output("`b`c`&Clan Halls`c`b");
if ($op=="apply"){
require_once("lib/clan/applicant_apply.php");
}elseif ($op=="new"){
require_once("lib/clan/applicant_new.php");
}else{
output("`7You stand in the center of a great marble lobby filled with pillars.");
output("All around the walls of the lobby are various doors which lead to various clan halls.");
output("The doors each possess a variety of intricate mechanisms which are obviously elaborate locks designed to be opened only by those who have been educated on how to operate them.");
output("Nearby, you watch another warrior glance about nervously to make sure no one is watching before touching various levers and knobs on the door.");
output("With a large metallic \"Chunk\" the lock on the door disengages, and the door swings silently open, admitting the warrior before slamming shut.`n`n");
output("In the center of the lobby sits a highly polished desk, behind which sits `%%s`7, the clan registrar.",$registrar);
output("She can take your filing for a new clan, or accept your application to an existing clan.`n`n");
/*//*/ modulehook("clan-enter");
if ($op=="withdraw"){
$session['user']['clanid']=0;
$session['user']['clanrank']=CLAN_APPLICANT;
$session['user']['clanjoindate']='0000-00-00 00:00:00';
output("`7You tell `%%s`7 that you're no longer interested in joining %s.",$registrar, $claninfo['clanname']);
output("She reaches into her desk, withdraws your application, and tears it up. \"`5You wouldn't have been happy there anyhow, I don't think,`7\" as she tosses the shreds in her trash can.");
$claninfo = array();
$sql = "DELETE FROM " . db_prefix("mail") . " WHERE msgfrom=0 AND seen=0 AND subject='".serialize($apply_subj)."'";
db_query($sql);
output("You are not a member of any clan.");
addnav("Apply for Membership to a Clan","clan.php?op=apply");
addnav("Apply for a New Clan","clan.php?op=new");
}else{
if (isset($claninfo['clanid']) && $claninfo["clanid"]>0){
//applied for membership to a clan
output("`7You approach `%%s`7 who smiles at you, but lets you know that your application to %s hasn't yet been accepted.",$registrar,$claninfo['clanname']);
output("Perhaps you'd like to take a seat in the waiting area, she suggests.");
addnav("Waiting Area","clan.php?op=waiting");
addnav("Withdraw Application","clan.php?op=withdraw");
}else{
//hasn't applied for membership to any clan.
output("You are not a member of any clan.");
addnav("Apply for Membership to a Clan","clan.php?op=apply");
addnav("Apply for a New Clan","clan.php?op=new");
}
}
}
?>

View File

@ -0,0 +1,72 @@
<?php
$to = (int)httpget('to');
if ($to>0){
output("`%%s`7 accepts your application, files it in her out box, and folds her hands on the desk, staring at you.",$registrar);
output("You stand there staring blankly back at her for a few minutes before she suggests that perhaps you'd like to take a seat in the waiting area.");
addnav("Return to the Lobby","clan.php");
addnav("Waiting Area","clan.php?op=waiting");
$session['user']['clanid']=$to;
$session['user']['clanrank']=CLAN_APPLICANT;
$session['user']['clanjoindate']=date("Y-m-d H:i:s");
$sql = "SELECT acctid FROM " . db_prefix("accounts") . " WHERE clanid='{$session['user']['clanid']}' AND clanrank>=".CLAN_OFFICER;
$result = db_query($sql);
$sql = "DELETE FROM . ". db_prefix("mail") . " WHERE msgfrom=0 AND seen=0 AND subject='".serialize($apply_subj)."'";
db_query($sql);
while ($row = db_fetch_assoc($result)){
$msg = array("`^You have a new clan applicant! `&%s`^ has completed a membership application for your clan!",$session['user']['name']);
systemmail($row['acctid'],$apply_subj,$msg);
}
// send reminder mail if clan of choice has a description
$sql = "SELECT * FROM " . db_prefix("clans") . " WHERE clanid='$to'";
$res = db_query_cached($sql, "clandata-$to", 3600);
$row = db_fetch_assoc($res);
if ( nltoappon($row['clandesc']) != "" ) {
$subject = "Clan Application Reminder";
$mail = "`&Did you remember to read the description of the clan of your choice before applying? Note that some clans may have requirements that you have to fulfill before you can become a member. If you are not accepted into the clan of your choice anytime soon, it may be because you have not fulfilled these requirements. For your convenience, the description of the clan you are applying to is reproduced below.`n`n`c`#%s`@ <`^%s`@>`0`c`n%s";
systemmail($session['user']['acctid'],array($subject),array($mail, $row['clanname'], $row['clanshort'], nltoappon($row['clandesc'])));
}
}else{
$sql = "SELECT MAX(" . db_prefix("clans") . ".clanid) AS clanid,MAX(clanname) AS clanname,count(" . db_prefix("accounts") . ".acctid) AS c FROM " . db_prefix("clans") . " INNER JOIN " . db_prefix("accounts") . " ON " . db_prefix("clans") . ".clanid=" . db_prefix("accounts") . ".clanid WHERE " . db_prefix("accounts") . ".clanrank > ".CLAN_APPLICANT." GROUP BY " . db_prefix("clans") . ".clanid ORDER BY c DESC";
$result = db_query($sql);
if (db_num_rows($result)>0){
output("`7You ask %s`7 for a clan membership application form.",$registrar);
output("She opens a drawer in her desk and pulls out a form. It contains only two lines: Name and Clan Name.");
output("You furrow your brow, not sure if you really like having to deal with all this red tape, and get set to concentrate really hard in order to complete the form.");
output("Noticing your attempt to write on the form with your %s, %s`7 claims the form back from you, writes %s`7 on the first line, and asks you the name of the clan that you'd like to join:`n`n",$session['user']['weapon'],$registrar,$session['user']['name']);
for ($i=0;$i<db_num_rows($result);$i++){
$row = db_fetch_assoc($result);
if ($row['c']==0){
$sql = "DELETE FROM " . db_prefix("clans") . " WHERE clanid={$row['clanid']}";
db_query($sql);
}else{
/*//*/ $row = modulehook("clan-applymember", $row);
/*//*/ if (isset($row['handled']) && $row['handled']) continue;
$memb_n = translate_inline("(%s members)");
$memb_1 = translate_inline("(%s member)");
if ($row['c'] == 1) {
$memb = sprintf($memb_1, $row['c']);
} else {
$memb = sprintf($memb_n, $row['c']);
}
output_notl("&#149; <a href='clan.php?op=apply&to=%s'>%s</a> %s`n",
$row['clanid'],
full_sanitize(htmlentities($row['clanname'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))),
$memb, true);
addnav("","clan.php?op=apply&to={$row['clanid']}");
}
}
addnav("Return to the Lobby","clan.php");
}else{
output("`7You ask %s`7 for a clan membership application form.",$registrar);
output("She stares at you blankly for a few moments, then says, \"`5Sorry pal, no one has had enough gumption to start up a clan yet. Maybe that should be you, eh?`7\"");
addnav("Apply for a New Clan","clan.php?op=new");
addnav("Return to the Lobby","clan.php");
}
}
?>

View File

@ -0,0 +1,103 @@
<?php
$apply = httpget('apply');
if ($apply==1){
$ocn = httppost('clanname');
$ocs = httppost('clanshort');
$clanname = stripslashes($ocn);
$clanname = full_sanitize($clanname);
$clanname = preg_replace("'[^[:alpha:] \\'-]'","",$clanname);
$clanname = addslashes($clanname);
httppostset('clanname', $clanname);
$clanshort = full_sanitize($ocs);
$clanshort = preg_replace("'[^[:alpha:]]'","",$clanshort);
httppostset('clanshort', $clanshort);
$sql = "SELECT * FROM " . db_prefix("clans") . " WHERE clanname='$clanname'";
$result = db_query($sql);
$e = array (translate_inline("%s`7 looks over your form but informs you that your clan name must consist only of letters, spaces, apostrophes, or dashes. Also, your short name can consist only of letters. She hands you a blank form."),
translate_inline("%s`7 looks over your form but informs you that you must have at least 5 and no more than 50 characters in your clan's name (and they must consist only of letters, spaces, apostrophes, or dashes), then hands you a blank form."),
translate_inline("%s`7 looks over your form but informs you that you must have at least 2 and no more than 5 characters in your clan's short name (and they must all be letters), then hands you a blank form."),
translate_inline("%s`7 looks over your form but informs you that the clan name %s is already taken, and hands you a blank form."),
translate_inline("%s`7 looks over your form but informs you that the short name %s is already taken, and hands you a blank form."),
translate_inline("%s`7 asks for the %s gold to start the clan, but you seem to be unable to produce the fees."),
translate_inline("%s`7 asks for the %s gold and %s gems to start the clan, but you seem to be unable to produce the fees."),
translate_inline("%s`7 asks for the %s gems to start the clan, but you seem to be unable to produce the fees."),
translate_inline("She takes your application, and stamps it \"`\$DENIED`7\"."),
);
if ($clanname!=$ocn || $clanshort!=$ocs){
output_notl($e[0],$registrar);
clanform();
addnav("Return to the Lobby","clan.php");
}elseif (strlen($clanname)<5 || strlen($clanname)>50){
output_notl($e[1],$registrar);
clanform();
addnav("Return to the Lobby","clan.php");
}elseif (strlen($clanshort)<2 || strlen($clanshort)>5){
output_notl($e[2],$registrar);
clanform();
addnav("Return to the Lobby","clan.php");
}elseif (db_num_rows($result)>0){
output_notl($e[3],$registrar,stripslashes($clanname));
clanform();
addnav("Return to the Lobby","clan.php");
}else{
$sql = "SELECT * FROM " . db_prefix("clans") . " WHERE clanshort='$clanshort'";
$result = db_query($sql);
if (db_num_rows($result)>0){
output_notl($e[4],$registrar,stripslashes($clanshort));
clanform();
addnav("Return to the Lobby","clan.php");
}else{
if ($session['user']['gold']<$gold || $session['user']['gems']<$gems){
if ($gold>0 && $gems<=0) output_notl($e[5],$registrar,$gold);
elseif ($gems>0 && $gold<=0) output_notl($e[7],$registrar,$gems);
else output_notl($e[6],$registrar,$gold,$gems);
output_notl($e[8],$registrar);
addnav("Return to the Lobby","clan.php");
}else{
/*//*/ $args = array("ocn"=>$ocn, "ocs"=>$ocs, "clanname"=>$clanname, "clanshort"=>$clanshort);
/*//*/ $args = modulehook("process-createclan", $args);
/*//*/ if (isset($args['blocked']) && $args['blocked']){
/*//*/ output_notl(sprintf_translate($args['blockmsg']));
/*//*/ clanform();
/*//*/ addnav("Return to the Lobby","clan.php");
/*//*/ } else {
$sql = "INSERT INTO " . db_prefix("clans") . " (clanname,clanshort) VALUES ('$clanname','$clanshort')";
db_query($sql);
$id = db_insert_id();
$session['user']['clanid'] = $id;
$session['user']['clanrank']=CLAN_LEADER+1; //+1 because he is the founder
$session['user']['clanjoindate']=date("Y-m-d H:i:s");
$session['user']['gold']-=$gold;
$session['user']['gems']-=$gems;
debuglog("has started a new clan (<$clanshort> $clanname) for $gold gold and $gems gems.");
output("%s`7 looks over your form, and finding that everything seems to be in order, she takes your fees, stamps the form \"`\$APPROVED`7\" and files it in a drawer.`n`n",$registrar);
output("Congratulations, you've created a new clan named %s!",stripslashes($clanname));
addnav("Enter your clan hall","clan.php");
/*//*/ }
}
}
}
}else{
output("`7You approach %s`7 and inquire about starting a new clan.",$registrar);
output("She tells you that there are three requirements to starting a clan.");
output("First, you have to decide on a full name for your clan.");
output("Second, you have to decide on an abbreviation for your clan.");
output("Third you have to decide on whether or not you're willing to give up the fees that are required to start the clan.");
output("This fee is used to tailor the locks on your clan door to you and your members.`n");
output("The fees are as follows:`nGold: `^%s`7`nGems: `%%s`7",$gold,$gems);
addnav("Return to the Lobby","clan.php");
$e1 = translate_inline("`n`n\"`5Since you do not have enough gold with you, I cannot allow you to apply for a clan,`7\" she says.");
$e2 = translate_inline("`n`n\"`5Since you do not have enough gems with you, I cannot allow you to apply for a clan,`7\" she says.");
$e3 = translate_inline("`n`n\"`5If you're ok with these three requirements, please fill out the following form,`7\" she says, handing you a sheet of paper.");
if ($session['user']['gold']<$gold){
output_notl($e1);
}else{
if ($session['user']['gems']<$gems){
output_notl($e2,$registrar);
}else{
output_notl($e3,$registrar);
clanform();
}
}
}
?>

View File

@ -0,0 +1,76 @@
<?php
modulehook("collapse{", array("name"=>"clanentry"));
output("Having pressed the secret levers and turned the secret knobs on the lock of the door to your clan's hall, you gain entrance and chat with your clan mates.`n`n");
modulehook("}collapse");
$sql = "SELECT name FROM " . db_prefix("accounts") . " WHERE acctid={$claninfo['motdauthor']}";
$result = db_query($sql);
$row = db_fetch_assoc($result);
$motdauthname = $row['name'];
$sql = "SELECT name FROM " . db_prefix("accounts") . " WHERE acctid={$claninfo['descauthor']}";
$result = db_query($sql);
$row = db_fetch_assoc($result);
$descauthname = $row['name'];
if ($claninfo['clanmotd'] != '') {
rawoutput("<div style='margin-left: 15px; padding-left: 15px;'>");
output("`&`bCurrent MoTD:`b `#by %s`2`n",$motdauthname);
output_notl(nltoappon($claninfo['clanmotd'])."`n");
rawoutput("</div>");
output_notl("`n");
}
commentdisplay("", "clan-{$claninfo['clanid']}","Speak",25,($claninfo['customsay']>''?$claninfo['customsay']:"says"));
modulehook("clanhall");
if ($claninfo['clandesc'] != '') {
modulehook("collapse{", array("name"=>"collapsedesc"));
output("`n`n`&`bCurrent Description:`b `#by %s`2`n",$descauthname);
output_notl(nltoappon($claninfo['clandesc']));
modulehook("}collapse");
}
$sql = "SELECT count(*) AS c, clanrank FROM " . db_prefix("accounts") . " WHERE clanid={$claninfo['clanid']} GROUP BY clanrank DESC";
$result = db_query($sql);
// begin collapse
modulehook("collapse{", array("name"=>"clanmemberdet"));
output("`n`n`bMembership Details:`b`n");
$leaders = 0;
while ($row = db_fetch_assoc($result)){
output_notl($ranks[$row['clanrank']].": `0".$row['c']."`n");
if ($row['clanrank']>CLAN_OFFICER) $leaders += $row['c'];
}
output("`n");
$noleader = translate_inline("`^There is currently no leader! Promoting %s`^ to leader as they are the highest ranking member (or oldest member in the event of a tie).`n`n");
if ($leaders==0){
//There's no leader here, probably because the leader's account
//expired.
$sql = "SELECT name,acctid,clanrank FROM " . db_prefix("accounts") . " WHERE clanid={$session['user']['clanid']} AND clanrank > " . CLAN_APPLICANT . " ORDER BY clanrank DESC, clanjoindate";
$result = db_query($sql);
if (db_num_rows($result)) {
$row = db_fetch_assoc($result);
$sql = "UPDATE " . db_prefix("accounts") . " SET clanrank=".CLAN_LEADER." WHERE acctid={$row['acctid']}";
db_query($sql);
output_notl($noleader,$row['name']);
if ($row['acctid']==$session['user']['acctid']){
//if it's the current user, we'll need to update their
//session in order for the db write to take effect.
$session['user']['clanrank']=CLAN_LEADER;
}
} else {
// There are no viable leaders. But we cannot disband the clan
// here.
}
}
// end collapse
modulehook("}collapse");
if ($session['user']['clanrank']>CLAN_MEMBER){
addnav("Update MoTD / Clan Desc","clan.php?op=motd");
}
addnav("M?View Membership","clan.php?op=membership");
addnav("Online Members","list.php?op=clan");
addnav("Your Clan's Waiting Area","clan.php?op=waiting");
addnav("Withdraw From Your Clan","clan.php?op=withdrawconfirm");
?>

View File

@ -0,0 +1,107 @@
<?php
addnav("Clan Hall","clan.php");
addnav("Clan Options");
output("This is your current clan membership:`n");
$setrank = httpget('setrank');
$whoacctid = (int)httpget('whoacctid');
if ($setrank>"") {
$sql="SELECT name,login,clanrank FROM ".db_prefix("accounts")." WHERE acctid=$whoacctid LIMIT 1";
$result=db_query($sql);
$row=db_fetch_assoc($result);
$who = $row['login'];
$whoname = $row['name'];
if ($setrank>""){
$args = modulehook("clan-setrank", array("setrank"=>$setrank, "login"=>$who, "name"=>$whoname, "acctid"=>$whoacctid, "clanid"=>$session['user']['clanid'], "oldrank"=>$row['clanrank']));
if (!(isset($args['handled']) && $args['handled'])) {
$sql = "UPDATE " . db_prefix("accounts") . " SET clanrank=GREATEST(0,least({$session['user']['clanrank']},$setrank)) WHERE login='$who'";
db_query($sql);
debuglog("Player {$session['user']['name']} changed rank of {$whoname} to {$setrank}.", $whoacctid);
}
}
}
$remove = httpget('remove');
if ($remove>""){
$sql = "SELECT name,login,clanrank FROM " . db_prefix("accounts") . " WHERE acctid='$remove'";
$row = db_fetch_assoc(db_query($sql));
$args = modulehook("clan-setrank", array("setrank"=>0, "login"=>$row['login'], "name"=>$row['name'], "acctid"=>$remove, "clanid"=>$session['user']['clanid'], "oldrank"=>$row['clanrank']));
$sql = "UPDATE " . db_prefix("accounts") . " SET clanrank=".CLAN_APPLICANT.",clanid=0,clanjoindate='0000-00-00 00:00:00' WHERE acctid='$remove' AND clanrank<={$session['user']['clanrank']}";
db_query($sql);
debuglog("Player {$session['user']['name']} removed player {$row['login']} from {$claninfo['clanname']}.", $remove);
//delete unread application emails from this user.
//breaks if the applicant has had their name changed via
//dragon kill, superuser edit, or lodge color change
require_once("lib/safeescape.php");
$subj = safeescape(serialize(array($apply_short, $row['name'])));
$sql = "DELETE FROM " . db_prefix("mail") . " WHERE msgfrom=0 AND seen=0 AND subject='$subj'";
db_query($sql);
}
$sql = "SELECT name,login,acctid,clanrank,laston,clanjoindate,dragonkills,level FROM " . db_prefix("accounts") . " WHERE clanid={$claninfo['clanid']} ORDER BY clanrank DESC ,dragonkills DESC,level DESC,clanjoindate";
$result = db_query($sql);
rawoutput("<table border='0' cellpadding='2' cellspacing='0'>");
$rank = translate_inline("Rank");
$name = translate_inline("Name");
$lev = translate_inline("Level");
$dk = translate_inline("Dragon Kills");
$jd = translate_inline("Join Date");
$lo = translate_inline("Last On");
$ops = translate_inline("Operations");
$promote = translate_inline("Promote");
$demote = translate_inline("Demote");
$stepdown = translate_inline("`\$Step down as founder");
$remove = translate_inline("Remove From Clan");
$confirm = translate_inline("Are you sure you wish to remove this member from your clan?");
rawoutput("<tr class='trhead'><td>$rank</td><td>$name</td><td>$lev</td><td>$dk</td><td>$jd</td><td>$lo</td>".($session['user']['clanrank']>CLAN_MEMBER?"<td>$ops</td>":"")."</tr>",true);
$i=0;
$tot = 0;
require_once("lib/clan/func.php");
while ($row=db_fetch_assoc($result)){
$i++;
$tot += $row['dragonkills'];
rawoutput("<tr class='".($i%2?"trlight":"trdark")."'>");
rawoutput("<td>");
output_notl($ranks[$row['clanrank']]);
rawoutput("</td><td>");
$link = "bio.php?char=".$row['acctid']."&ret=".urlencode($_SERVER['REQUEST_URI']);
rawoutput("<a href='$link'>", true);
addnav("", $link);
output_notl("`&%s`0", $row['name']);
rawoutput("</a>");
rawoutput("</td><td align='center'>");
output_notl("`^%s`0",$row['level']);
rawoutput("</td><td align='center'>");
output_notl("`\$%s`0",$row['dragonkills']);
rawoutput("</td><td>");
output_notl("`3%s`0",$row['clanjoindate']);
rawoutput("</td><td>");
output_notl("`#%s`0",reltime(strtotime($row['laston'])));
rawoutput("</td>");
if ($session['user']['clanrank']>CLAN_MEMBER){
rawoutput("<td>");
if ($row['clanrank']<$session['user']['clanrank'] && $row['clanrank']<CLAN_FOUNDER){
rawoutput("[ <a href='clan.php?op=membership&setrank=".clan_nextrank($ranks,$row['clanrank'])."&who=".rawurlencode($row['login'])."&whoname=".rawurlencode($row['name'])."&whoacctid=".$row['acctid']."'>$promote</a> | ");
addnav("","clan.php?op=membership&setrank=".clan_nextrank($ranks,$row['clanrank'])."&who=".rawurlencode($row['login'])."&whoname=".rawurlencode($row['name'])."&whoacctid=".$row['acctid']);
}else{
output_notl("[ `)%s`0 | ", $promote);
}
if ($row['clanrank']<=$session['user']['clanrank'] && $row['clanrank']>CLAN_APPLICANT && $row['login']!=$session['user']['login'] && clan_previousrank($ranks,$row['clanrank']) > 0){
rawoutput("<a href='clan.php?op=membership&setrank=".clan_previousrank($ranks,$row['clanrank'])."&whoacctid=".$row['acctid']."'>$demote</a> | ");
addnav("","clan.php?op=membership&setrank=".clan_previousrank($ranks,$row['clanrank'])."&whoacctid=".$row['acctid']);
}elseif ($row['clanrank']==CLAN_FOUNDER && $row['clanrank']>CLAN_APPLICANT && $row['login']==$session['user']['login']){
output_notl("<a href='clan.php?op=membership&setrank=".clan_previousrank($ranks,$row['clanrank'])."&whoacctid=".$row['acctid']."'>$stepdown</a> | ",true);
addnav("","clan.php?op=membership&setrank=".clan_previousrank($ranks,$row['clanrank'])."&whoacctid=".$row['acctid']);
} else {
output_notl("`)%s`0 | ", $demote);
}
if ($row['clanrank'] <= $session['user']['clanrank'] && $row['login']!=$session['user']['login']){
rawoutput("<a href='clan.php?op=membership&remove=".$row['acctid']."' onClick=\"return confirm('$confirm');\">$remove</a> ]");
addnav("","clan.php?op=membership&remove=".$row['acctid']);
}else{
output_notl("`)%s`0 ]", $remove);
}
rawoutput("</td>");
}
rawoutput("</tr>");
}
rawoutput("</table>");
output("`n`n`^This clan has a total of `\$%s`^ dragon kills.",$tot);
?>

View File

@ -0,0 +1,71 @@
<?php
page_header("Update Clan Description / MoTD");
addnav("Clan Options");
if ($session['user']['clanrank']>=CLAN_OFFICER){
$clanmotd = substr(httppost('clanmotd'),0,4096);
if (httppostisset('clanmotd') &&
stripslashes($clanmotd)!=$claninfo['clanmotd']){
$sql = "UPDATE " . db_prefix("clans") . " SET clanmotd='$clanmotd',motdauthor={$session['user']['acctid']} WHERE clanid={$claninfo['clanid']}";
db_query($sql);
invalidatedatacache("clandata-{$claninfo['clanid']}");
$claninfo['clanmotd']=stripslashes($clanmotd);
output("Updating MoTD`n");
$claninfo['motdauthor']=$session['user']['acctid'];
}
$clandesc = httppost('clandesc');
if (httppostisset('clandesc') &&
stripslashes($clandesc)!=$claninfo['clandesc'] &&
$claninfo['descauthor']!=4294967295){
$sql = "UPDATE " . db_prefix("clans") . " SET clandesc='".addslashes(substr(stripslashes($clandesc),0,4096))."',descauthor={$session['user']['acctid']} WHERE clanid={$claninfo['clanid']}";
db_query($sql);
invalidatedatacache("clandata-{$claninfo['clanid']}");
output("Updating description`n");
$claninfo['clandesc']=stripslashes($clandesc);
$claninfo['descauthor']=$session['user']['acctid'];
}
$customsay = httppost('customsay');
if (httppostisset('customsay') && $customsay!=$claninfo['customsay'] && $session['user']['clanrank']>=CLAN_LEADER){
$sql = "UPDATE " . db_prefix("clans") . " SET customsay='$customsay' WHERE clanid={$claninfo['clanid']}";
db_query($sql);
invalidatedatacache("clandata-{$claninfo['clanid']}");
output("Updating custom say line`n");
$claninfo['customsay']=stripslashes($customsay);
}
$sql = "SELECT name FROM " . db_prefix("accounts") . " WHERE acctid={$claninfo['motdauthor']}";
$result = db_query($sql);
$row = db_fetch_assoc($result);
$motdauthname = $row['name'];
$sql = "SELECT name FROM " . db_prefix("accounts") . " WHERE acctid={$claninfo['descauthor']}";
$result = db_query($sql);
$row = db_fetch_assoc($result);
$descauthname = $row['name'];
output("`&`bCurrent MoTD:`b `#by %s`2`n",$motdauthname);
output_notl(nltoappon($claninfo['clanmotd'])."`n");
output("`&`bCurrent Description:`b `#by %s`2`n",$descauthname);
output_notl(nltoappon($claninfo['clandesc'])."`n");
rawoutput("<form action='clan.php?op=motd' method='POST'>");
addnav("","clan.php?op=motd");
output("`&`bMoTD:`b `7(4096 chars)`n");
rawoutput("<textarea name='clanmotd' cols='50' rows='10' class='input' style='width: 66%'>".htmlentities($claninfo['clanmotd'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."</textarea><br>");
output("`n`&`bDescription:`b `7(4096 chars)`n");
$blocked = translate_inline("Your clan has been blocked from posting a description.`n");
if ($claninfo['descauthor']==INT_MAX){
output_notl($blocked);
}else{
rawoutput("<textarea name='clandesc' cols='50' rows='10' class='input' style='width: 66%'>".htmlentities($claninfo['clandesc'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."</textarea><br>");
}
if ($session['user']['clanrank']>=CLAN_LEADER){
output("`n`&`bCustom Talk Line`b `7(blank means \"says\" -- 15 chars max)`n");
rawoutput("<input name='customsay' value=\"".htmlentities($claninfo['customsay'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\" class='input' maxlength=\"15\"><br/>");
}
$save = translate_inline("Save");
rawoutput("<input type='submit' class='button' value='$save'>");
rawoutput("</form>");
}else{
output("You do not have authority to change your clan's motd or description.");
}
addnav("Return to your clan hall","clan.php");
?>

View File

@ -0,0 +1,19 @@
<?php
page_header("Clan Hall for %s", full_sanitize($claninfo['clanname']));
addnav("Clan Options");
if ($op==""){
require_once("lib/clan/clan_default.php");
}elseif ($op=="motd"){
require_once("lib/clan/clan_motd.php");
}elseif ($op=="membership"){
require_once("lib/clan/clan_membership.php");
}elseif ($op=="withdrawconfirm"){
output("Are you sure you want to withdraw from your clan?");
addnav("Withdraw?");
addnav("No","clan.php");
addnav("!?Yes","clan.php?op=withdraw");
}elseif ($op=="withdraw"){
require_once("lib/clan/clan_withdraw.php");
}
?>

View File

@ -0,0 +1,56 @@
<?php
modulehook("clan-withdraw", array('clanid'=>$session['user']['clanid'], 'clanrank'=>$session['user']['clanrank'], 'acctid'=>$session['user']['acctid']));
if ($session['user']['clanrank']>=CLAN_LEADER){
//first test to see if we were the leader.
$sql = "SELECT count(*) AS c FROM " . db_prefix("accounts") . " WHERE clanid={$session['user']['clanid']} AND clanrank>=".CLAN_LEADER." AND acctid<>{$session['user']['acctid']}";
$result = db_query($sql);
$row = db_fetch_assoc($result);
if ($row['c']==0){
//we were the solitary leader.
$sql = "SELECT name,acctid,clanrank FROM " . db_prefix("accounts") . " WHERE clanid={$session['user']['clanid']} AND clanrank > " . CLAN_APPLICANT . " AND acctid<>{$session['user']['acctid']} ORDER BY clanrank DESC, clanjoindate LIMIT 1";
$result = db_query($sql);
if ($row = db_fetch_assoc($result)){
//there is no alternate leader, let's promote the
//highest ranking member (or oldest member in the
//event of a tie). This will capture even people
//who applied for membership.
$sql = "UPDATE " . db_prefix("accounts") . " SET clanrank=".CLAN_LEADER." WHERE acctid={$row['acctid']}";
db_query($sql);
output("`^Promoting %s`^ to leader as they are the highest ranking member (or oldest member in the event of a tie).`n`n",$row['name']);
}else{
//There are no other members, we need to delete the clan.
modulehook("clan-delete", array("clanid"=>$session['user']['clanid']));
$sql = "DELETE FROM " . db_prefix("clans") . " WHERE clanid={$session['user']['clanid']}";
db_query($sql);
//just in case we goofed, we don't want to have to worry
//about people being associated with a deleted clan.
$sql = "UPDATE " . db_prefix("accounts") . " SET clanid=0,clanrank=".CLAN_APPLICANT.",clanjoindate='0000-00-00 00:00:00' WHERE clanid={$session['user']['clanid']}";
db_query($sql);
output("`^As you were the last member of this clan, it has been deleted.");
}
}else{
//we don't have to do anything special with this clan as
//although we were leader, there is another leader already
//to take our place.
}
}else{
//we don't have to do anything special with this clan as we were
//not the leader, and so there should still be other members.
}
$sql = "SELECT acctid FROM " . db_prefix("accounts") . " WHERE clanid='{$session['user']['clanid']}' AND clanrank>=".CLAN_OFFICER." AND acctid<>'{$session['user']['acctid']}'";
$result = db_query($sql);
$withdraw_subj = array("`\$Clan Withdraw: `&%s`0",$session['user']['name']);
$msg = array("`^One of your clan members has resigned their membership. `&%s`^ has surrendered their position within your clan!",$session['user']['name']);
$sql = "DELETE FROM " . db_prefix("mail") . " WHERE msgfrom=0 AND seen=0 AND subject='".serialize($withdraw_subj)."'";
db_query($sql);
while ($row = db_fetch_assoc($result)){
systemmail($row['acctid'],$withdraw_subj,$msg);
}
$session['user']['clanid']=0;
$session['user']['clanrank']=CLAN_APPLICANT;
$session['user']['clanjoindate']="0000-00-00 00:00:00";
output("`&You have withdrawn from your clan.");
addnav("Clan Options");
addnav("Return to the Lobby","clan.php");
?>

View File

@ -0,0 +1,95 @@
<?php
if ($session['user']['superuser'] & SU_EDIT_COMMENTS){
$clanname = httppost('clanname');
if ($clanname) $clanname = full_sanitize($clanname);
$clanshort = httppost('clanshort');
if ($clanshort) $clanshort = full_sanitize($clanshort);
if ($clanname>"" && $clanshort>""){
$sql = "UPDATE " . db_prefix("clans") . " SET clanname='$clanname',clanshort='$clanshort' WHERE clanid='$detail'";
output("Updating clan names`n");
db_query($sql);
invalidatedatacache("clandata-$detail");
}
if (httppost('block')>""){
$blockdesc = translate_inline("Description blocked for inappropriate usage.");
$sql = "UPDATE " . db_prefix("clans") . " SET descauthor=4294967295, clandesc='$blockdesc' where clanid='$detail'";
output("Blocking public description`n");
db_query($sql);
invalidatedatacache("clandata-$detail");
}elseif (httppost('unblock')>""){
$sql = "UPDATE " . db_prefix("clans") . " SET descauthor=0, clandesc='' where clanid='$detail'";
output("UNblocking public description`n");
db_query($sql);
invalidatedatacache("clandata-$detail");
}
}
$sql = "SELECT * FROM " . db_prefix("clans") . " WHERE clanid='$detail'";
$result1 = db_query_cached($sql, "clandata-$detail", 3600);
$row1 = db_fetch_assoc($result1);
if ($session['user']['superuser'] & SU_EDIT_COMMENTS){
rawoutput("<div id='hidearea'>");
rawoutput("<form action='clan.php?detail=$detail' method='POST'>");
addnav("","clan.php?detail=$detail");
output("Superuser / Moderator renaming:`n");
output("Long Name: ");
rawoutput("<input name='clanname' value=\"".htmlentities($row1['clanname'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\" maxlength=50 size=50>");
output("`nShort Name: ");
rawoutput("<input name='clanshort' value=\"".htmlentities($row1['clanshort'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\" maxlength=5 size=5>");
output_notl("`n");
$save = translate_inline("Save");
rawoutput("<input type='submit' class='button' value=\"$save\">");
$snu = htmlentities(translate_inline("Save & UNblock public description"), ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
$snb = htmlentities(translate_inline("Save & Block public description"), ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
if ($row1['descauthor']=="4294967295")
rawoutput("<input type='submit' name='unblock' value=\"$snu\" class='button'>");
else
rawoutput("<input type='submit' name='block' value=\"$snb\" class='button'>");
rawoutput("</form>");
rawoutput("</div>");
rawoutput("<script language='JavaScript'>var hidearea = document.getElementById('hidearea');hidearea.style.visibility='hidden';hidearea.style.display='none';</script>",true);
$e = translate_inline("Edit Clan Info");
rawoutput("<a href='#' onClick='hidearea.style.visibility=\"visible\"; hidearea.style.display=\"inline\"; return false;'>$e</a>",true);
output_notl("`n");
}
output_notl(nltoappon($row1['clandesc']));
if ( nltoappon($row1['clandesc']) != "" ) output ("`n`n");
output("`0This is the current clan membership of %s < %s >:`n",$row1['clanname'],$row1['clanshort']);
page_header("Clan Membership for %s &lt;%s&gt;", full_sanitize($row1['clanname']), full_sanitize($row1['clanshort']));
addnav("Clan Options");
$rank = translate_inline("Rank");
$name = translate_inline("Name");
$dk = translate_inline("Dragon Kills");
$jd = translate_inline("Join Date");
rawoutput("<table border='0' cellpadding='2' cellspacing='0'>");
rawoutput("<tr class='trhead'><td>$rank</td><td>$name</td><td>$dk</td><td>$jd</td></tr>");
$i=0;
$sql = "SELECT acctid,name,login,clanrank,clanjoindate,dragonkills FROM " . db_prefix("accounts") . " WHERE clanid=$detail ORDER BY clanrank DESC,clanjoindate";
$result = db_query($sql);
$tot = 0;
//little hack with the hook...can't think of any other way
$ranks = array(CLAN_APPLICANT=>"`!Applicant`0",CLAN_MEMBER=>"`#Member`0",CLAN_OFFICER=>"`^Officer`0",CLAN_LEADER=>"`&Leader`0", CLAN_FOUNDER=>"`\$Founder");
$args = modulehook("clanranks", array("ranks"=>$ranks, "clanid"=>$detail));
$ranks = translate_inline($args['ranks']);
//end
while ($row=db_fetch_assoc($result)){
$i++;
$tot += $row['dragonkills'];
rawoutput("<tr class='".($i%2?"trlight":"trdark")."'>");
rawoutput("<td>");
output_notl($ranks[$row['clanrank']]); //translated earlier
rawoutput("</td><td>");
$link = "bio.php?char=".$row['acctid']."&ret=".urlencode($_SERVER['REQUEST_URI']);
rawoutput("<a href='$link'>");
addnav("", $link);
output_notl("`&%s`0", $row['name']);
rawoutput("</a>");
rawoutput("</td><td align='center'>");
output_notl("`\$%s`0", $row['dragonkills']);
rawoutput("</td><td>");
output_notl("`3%s`0", $row['clanjoindate']);
rawoutput("</td></tr>");
}
rawoutput("</table>");
output("`n`n`^This clan has a total of `\$%s`^ dragon kills.",$tot);
?>

View File

@ -0,0 +1,49 @@
<?php
/**
* Clan functions
*
* This file contains functions
* that are specific to the clan
* system.
*
* @copyright Copyright © 2002-2005, Eric Stevens & JT Traub, © 2006-2009, Dragonprime Development Team
* @version Lotgd 1.1.2 DragonPrime Edition
* @package Core
* @subpackage Library
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode
*/
/**
* Returns the numeric value of the next rank from the given array
*
* @param array $ranks The ranks
* @param int $current The numeric value of the current rank
* @return int The numeric value of the next rank
*/
function clan_nextrank($ranks,$current) {
$temp=array_pop($ranks);
$ranks=array_keys($ranks);
while (count($ranks)>0) {
$key=array_shift($ranks);
if ($key>$current) return $key;
}
return 30;
}
/**
* Returns the numeric value of the previous rank from the given array
*
* @param array $ranks The ranks
* @param int $current The numeric value of the current rank
* @return int The numeric value of the previous rank
*/
function clan_previousrank($ranks,$current) {
$temp=array_pop($ranks);
$ranks=array_keys($ranks);
while (count($ranks)>0) {
$key=array_pop($ranks);
if ($key<$current) return $key;
}
return 0;
}
?>

View File

@ -0,0 +1,43 @@
<?php
page_header("Clan Listing");
$registrar=getsetting('clanregistrar','`%Karissa');
addnav("Clan Options");
$sql = "SELECT MAX(" . db_prefix("clans") . ".clanid) AS clanid, MAX(clanshort) AS clanshort, MAX(clanname) AS clanname,count(" . db_prefix("accounts") . ".acctid) AS c FROM " . db_prefix("clans") . " LEFT JOIN " . db_prefix("accounts") . " ON " . db_prefix("clans") . ".clanid=" . db_prefix("accounts") . ".clanid AND clanrank>".CLAN_APPLICANT." GROUP BY " . db_prefix("clans") . ".clanid ORDER BY c DESC";
$result = db_query($sql);
if (db_num_rows($result)>0){
output("`7You ask %s`7 for the clan listings. She points you toward a marquee board near the entrance of the lobby that lists the clans.`0`n`n",$registrar);
$v = 0;
$memb_n = translate_inline("(%s members)");
$memb_1 = translate_inline("(%s member)");
rawoutput('<table cellspacing="0" cellpadding="2" align="left">');
while ($row = db_fetch_assoc($result)){
if ($row['c']==0){
$sql = "DELETE FROM " . db_prefix("clans") . " WHERE clanid={$row['clanid']}";
db_query($sql);
}else{
rawoutput('<tr class="' . ($v%2?"trlight":"trdark").'"><td>', true);
if ($row['c'] == 1) {
$memb = sprintf($memb_1, $row['c']);
} else {
$memb = sprintf($memb_n, $row['c']);
}
output_notl("&#149; &#60;%s&#62; <a href='clan.php?detail=%s'>%s</a> %s`n",
$row['clanshort'],
$row['clanid'],
full_sanitize(htmlentities($row['clanname']), ENT_COMPAT, getsetting("charset", "ISO-8859-1")),
$memb, true);
rawoutput('</td></tr>');
addnav("","clan.php?detail={$row['clanid']}");
$v++;
}
}
rawoutput("</table>", true);
addnav("Return to the Lobby","clan.php");
}else{
output("`7You ask %s`7 for the clan listings. She stares at you blankly for a few moments, then says, \"`5Sorry pal, no one has had enough gumption to start up a clan yet. Maybe that should be you, eh?`7\"",$registrar);
addnav("Apply for a New Clan","clan.php?op=new");
addnav("Return to the Lobby","clan.php");
}
page_footer();
?>

View File

@ -0,0 +1,14 @@
<?php
page_header("Clan Halls");
addnav("Clan Options");
output("`b`c`&Clan Halls`c`b");
output("You stroll off to the side where there are some plush leather chairs, and take a seat.");
output("There are several other warriors sitting here talking amongst themselves.");
output("Some Ye Olde Muzak is coming from a fake rock sitting at the base of a potted bush.`n`n");
commentdisplay("", "waiting","Speak",25);
if ($session['user']['clanrank']==CLAN_APPLICANT) {
addnav("Return to the Lobby","clan.php");
} else {
addnav("Return to your Clan Rooms","clan.php");
}
?>

View File

@ -0,0 +1,629 @@
<?php
// translator ready
// addnews ready
// mail ready
require_once("lib/datetime.php");
require_once("lib/sanitize.php");
require_once("lib/http.php");
$comsecs = array();
function commentarylocs() {
global $comsecs, $session;
if (is_array($comsecs) && count($comsecs)) return $comsecs;
$vname = getsetting("villagename", LOCATION_FIELDS);
$iname = getsetting("innname", LOCATION_INN);
tlschema("commentary");
$comsecs['village'] = sprintf_translate("%s Square", $vname);
if ($session['user']['superuser'] & ~SU_DOESNT_GIVE_GROTTO) {
$comsecs['superuser']=translate_inline("Grotto");
}
$comsecs['shade']=translate_inline("Land of the Shades");
$comsecs['grassyfield']=translate_inline("Grassy Field");
$comsecs['inn']="$iname";
$comsecs['motd']=translate_inline("MotD");
$comsecs['veterans']=translate_inline("Veterans Club");
$comsecs['hunterlodge']=translate_inline("Hunter's Lodge");
$comsecs['gardens']=translate_inline("Gardens");
$comsecs['waiting']=translate_inline("Clan Hall Waiting Area");
if (getsetting("betaperplayer", 1) == 1 && @file_exists("pavilion.php")) {
$comsecs['beta']=translate_inline("Pavilion");
}
tlschema();
// All of the ones after this will be translated in the modules.
$comsecs = modulehook("moderate", $comsecs);
rawoutput(tlbutton_clear());
return $comsecs;
}
function addcommentary() {
global $session, $emptypost;
$section = httppost('section');
$talkline = httppost('talkline');
$schema = httppost('schema');
$comment = trim(httppost('insertcommentary'));
$counter = httppost('counter');
$remove = URLDecode(httpget('removecomment'));
if ($remove>0) {
$return = '/' . httpget('returnpath');
$section = httpget('section');
$sql = "SELECT " .
db_prefix("commentary").".*,".db_prefix("accounts").".name,".
db_prefix("accounts").".acctid, ".db_prefix("accounts").".clanrank,".
db_prefix("clans").".clanshort FROM ".db_prefix("commentary").
" INNER JOIN ".db_prefix("accounts")." ON ".
db_prefix("accounts").".acctid = " . db_prefix("commentary").
".author LEFT JOIN ".db_prefix("clans")." ON ".
db_prefix("clans").".clanid=".db_prefix("accounts").
".clanid WHERE commentid=$remove";
$row = db_fetch_assoc(db_query($sql));
$sql = "INSERT LOW_PRIORITY INTO ".db_prefix("moderatedcomments").
" (moderator,moddate,comment) VALUES ('{$session['user']['acctid']}','".date("Y-m-d H:i:s")."','".addslashes(serialize($row))."')";
db_query($sql);
$sql = "DELETE FROM ".db_prefix("commentary")." WHERE commentid='$remove';";
db_query($sql);
invalidatedatacache("comments-$section");
invalidatedatacache("comments-or11");
$session['user']['specialinc']==''; //just to make sure he was not in a special
$return = cmd_sanitize($return);
$return = substr($return,strrpos($return,"/")+1);
if (strpos($return,"?")===false && strpos($return,"&")!==false){
$x = strpos($return,"&");
$return = substr($return,0,$x-1)."?".substr($return,$x+1);
}
debug($return);
redirect($return);
}
if (array_key_exists('commentcounter',$session) &&
$session['commentcounter']==$counter) {
if ($section || $talkline || $comment) {
$tcom = color_sanitize($comment);
if ($tcom == "" || $tcom == ":" || $tcom == "::" || $tcom == "/me")
$emptypost = 1;
else injectcommentary($section, $talkline, $comment, $schema);
}
}
}
function injectsystemcomment($section,$comment) {
//function lets gamemasters put in comments without a user association...be careful, it is not trackable who posted it
if (strncmp($comment, "/game", 5) !== 0) {
$comment = "/game" . $comment;
}
injectrawcomment($section,0,$comment);
}
function injectrawcomment($section, $author, $comment)
{
$sql = "INSERT INTO " . db_prefix("commentary") . " (postdate,section,author,comment) VALUES ('".date("Y-m-d H:i:s")."','$section',$author,\"$comment\")";
db_query($sql);
invalidatedatacache("comments-{$section}");
// invalidate moderation screen also.
invalidatedatacache("comments-or11");
}
function injectcommentary($section, $talkline, $comment, $schema=false) {
global $session,$doublepost, $translation_namespace;
if ($schema===false) $schema=$translation_namespace;
// Make the comment pristine so that we match on it correctly.
$comment = stripslashes($comment);
tlschema("commentary");
$doublepost=0;
$emptypost = 0;
$colorcount = 0;
if ($comment !="") {
$commentary = str_replace("`n","",soap($comment));
$y = strlen($commentary);
for ($x=0;$x<$y;$x++){
if (substr($commentary,$x,1)=="`"){
$colorcount++;
if ($colorcount>=getsetting("maxcolors",10)){
$commentary = substr($commentary,0,$x).color_sanitize(substr($commentary,$x));
$x=$y;
}
$x++;
}
}
$args = array('commentline'=>$commentary, 'commenttalk'=>$talkline);
$args = modulehook("commentary", $args);
$commentary = $args['commentline'];
$talkline = $args['commenttalk'];
tlschema($schema);
$talkline = translate_inline($talkline);
tlschema();
$commentary = preg_replace("'([^[:space:]]{45,45})([^[:space:]])'","\\1 \\2",$commentary);
$commentary = addslashes($commentary);
// do an emote if the area has a custom talkline and the user
// isn't trying to emote already.
if ($talkline!="says" && substr($commentary,0,1)!=":" &&
substr($commentary,0,2)!="::" &&
substr($commentary,0,3)!="/me" &&
substr($commentary,0,5) != "/game") {
$commentary = ":`3$talkline, \\\"`#$commentary`3\\\"";
}
if (substr($commentary,0,5)=="/game" && ($session['user']['superuser']&SU_IS_GAMEMASTER)==SU_IS_GAMEMASTER) {
//handle game master inserts now, allow double posts
injectsystemcomment($section,$commentary);
} else {
$sql = "SELECT comment,author FROM " . db_prefix("commentary") . " WHERE section='$section' ORDER BY commentid DESC LIMIT 1";
$result = db_query($sql);
$row = db_fetch_assoc($result);
db_free_result($result);
if ($row['comment']!=stripslashes($commentary) ||
$row['author']!=$session['user']['acctid']){
injectrawcomment($section, $session['user']['acctid'],
$commentary);
$session['user']['laston']=date("Y-m-d H:i:s");
} else {
$doublepost = 1;
}
}
tlschema();
}
}
function commentdisplay($intro, $section, $message="Interject your own commentary?",$limit=10,$talkline="says",$schema=false) {
// Let's add a hook for modules to block commentary sections
$args = modulehook("blockcommentarea", array("section"=>$section));
if (isset($args['block']) && ($args['block'] == "yes"))
return;
if ($intro) output($intro);
viewcommentary($section, $message, $limit, $talkline, $schema);
}
function viewcommentary($section,$message="Interject your own commentary?",$limit=10,$talkline="says",$schema=false) {
global $session,$REQUEST_URI,$doublepost, $translation_namespace;
global $emptypost;
rawoutput("<a name='$section'></a>");
// Let's add a hook for modules to block commentary sections
$args = modulehook("blockcommentarea", array("section"=>$section));
if (isset($args['block']) && ($args['block'] == "yes"))
return;
if ($schema === false)
$schema=$translation_namespace;
tlschema("commentary");
$nobios = array("motd.php"=>true);
if (!array_key_exists(basename($_SERVER['SCRIPT_NAME']),$nobios)) $nobios[basename($_SERVER['SCRIPT_NAME'])] = false;
if ($nobios[basename($_SERVER['SCRIPT_NAME'])])
$linkbios=false;
else
$linkbios=true;
if ($message=="X") $linkbios=true;
if ($doublepost) output("`\$`bDouble post?`b`0`n");
if ($emptypost) output("`\$`bWell, they say silence is a virtue.`b`0`n");
$clanrankcolors=array("`!","`#","`^","`&","`\$");
// Needs to be here because scrolling through the commentary pages, entering a bio, then scrolling again forward
// then re-entering another bio will lead to $com being smaller than 0 and this will lead to an SQL error later on.
$com=(int)httpget("comscroll");
if ($com < 0) $com = 0;
$cc = false;
if (httpget("comscroll") !==false && (int)$session['lastcom']==$com+1)
$cid = (int)$session['lastcommentid'];
else
$cid = 0;
$session['lastcom'] = $com;
if ($com > 0 || $cid > 0) {
// Find newly added comments.
$sql = "SELECT COUNT(commentid) AS newadded FROM " .
db_prefix("commentary") . " LEFT JOIN " .
db_prefix("accounts") . " ON " .
db_prefix("accounts") . ".acctid = " .
db_prefix("commentary"). ".author WHERE section='$section' AND " .
"(".db_prefix("accounts").".locked=0 or ".db_prefix('accounts').".locked is null) AND commentid > '$cid'";
$result = db_query($sql);
$row = db_fetch_assoc($result);
$newadded = $row['newadded'];
} else {
$newadded = 0;
}
$commentbuffer = array();
if ($cid == 0) {
$sql = "SELECT ". db_prefix("commentary") . ".*, " .
db_prefix("accounts").".name, " .
db_prefix("accounts").".acctid, " .
db_prefix("accounts").".clanrank, " .
db_prefix("clans") . ".clanshort FROM " .
db_prefix("commentary") . " LEFT JOIN " .
db_prefix("accounts") . " ON " .
db_prefix("accounts") . ".acctid = " .
db_prefix("commentary"). ".author LEFT JOIN " .
db_prefix("clans") . " ON " .
db_prefix("clans") . ".clanid=" .
db_prefix("accounts") .
".clanid WHERE section = '$section' AND " .
"( ".db_prefix("accounts") . ".locked=0 OR ".db_prefix("accounts") .".locked is null ) ".
"ORDER BY commentid DESC LIMIT " .
($com*$limit).",$limit";
if ($com==0 && strstr( $_SERVER['REQUEST_URI'], "/moderate.php" ) !== $_SERVER['REQUEST_URI'] )
$result = db_query_cached($sql,"comments-{$section}");
else
$result = db_query($sql);
while($row = db_fetch_assoc($result)) $commentbuffer[] = $row;
} else {
$sql = "SELECT " . db_prefix("commentary") . ".*, " .
db_prefix("accounts").".name, " .
db_prefix("accounts").".acctid, " .
db_prefix("accounts").".clanrank, " .
db_prefix("clans").".clanshort FROM " .
db_prefix("commentary") . " LEFT JOIN " .
db_prefix("accounts") . " ON " .
db_prefix("accounts") . ".acctid = " .
db_prefix("commentary"). ".author LEFT JOIN " .
db_prefix("clans") . " ON " . db_prefix("clans") . ".clanid=" .
db_prefix("accounts") .
".clanid WHERE section = '$section' AND " .
"( ".db_prefix("accounts") . ".locked=0 OR ".db_prefix("accounts") .".locked is null ) ".
"AND commentid > '$cid' " .
"ORDER BY commentid ASC LIMIT $limit";
$result = db_query($sql);
while ($row = db_fetch_assoc($result)) $commentbuffer[] = $row;
$commentbuffer = array_reverse($commentbuffer);
}
$rowcount = count($commentbuffer);
if ($rowcount > 0)
$session['lastcommentid'] = $commentbuffer[0]['commentid'];
$counttoday=0;
for ($i=0; $i < $rowcount; $i++){
$row = $commentbuffer[$i];
$row['comment'] = comment_sanitize($row['comment']);
$commentids[$i] = $row['commentid'];
if (date("Y-m-d",strtotime($row['postdate']))==date("Y-m-d")){
if ($row['name']==$session['user']['name']) $counttoday++;
}
$x=0;
$ft="";
for ($x=0;strlen($ft)<5 && $x<strlen($row['comment']);$x++){
if (substr($row['comment'],$x,1)=="`" && strlen($ft)==0) {
$x++;
}else{
$ft.=substr($row['comment'],$x,1);
}
}
$link = "bio.php?char=" . $row['acctid'] .
"&ret=".URLEncode($_SERVER['REQUEST_URI']);
if (substr($ft,0,2)=="::")
$ft = substr($ft,0,2);
elseif (substr($ft,0,1)==":")
$ft = substr($ft,0,1);
elseif (substr($ft,0,3)=="/me")
$ft = substr($ft,0,3);
$row['comment'] = holidayize($row['comment'],'comment');
$row['name'] = holidayize($row['name'],'comment');
if ($row['clanrank']) {
$row['name'] = ($row['clanshort']>""?"{$clanrankcolors[ceil($row['clanrank']/10)]}&lt;`2{$row['clanshort']}{$clanrankcolors[ceil($row['clanrank']/10)]}&gt; `&":"").$row['name'];
}
if ($ft=="::" || $ft=="/me" || $ft==":"){
$x = strpos($row['comment'],$ft);
if ($x!==false){
if ($linkbios)
$op[$i] = str_replace("&amp;","&",HTMLEntities(substr($row['comment'],0,$x), ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`0<a href='$link' style='text-decoration: none'>\n`&{$row['name']}`0</a>\n`& ".str_replace("&amp;","&",HTMLEntities(substr($row['comment'],$x+strlen($ft)), ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`0`n";
else
$op[$i] = str_replace("&amp;","&",HTMLEntities(substr($row['comment'],0,$x), ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`0`&{$row['name']}`0`& ".str_replace("&amp;","&",HTMLEntities(substr($row['comment'],$x+strlen($ft)), ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`0`n";
$rawc[$i] = str_replace("&amp;","&",HTMLEntities(substr($row['comment'],0,$x), ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`0`&{$row['name']}`0`& ".str_replace("&amp;","&",HTMLEntities(substr($row['comment'],$x+strlen($ft)), ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`0`n";
}
}
if ($ft=="/game" && !$row['name']) {
$x = strpos($row['comment'],$ft);
if ($x!==false){
$op[$i] = str_replace("&amp;","&",HTMLEntities(substr($row['comment'],0,$x), ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`0`&".str_replace("&amp;","&",HTMLEntities(substr($row['comment'],$x+strlen($ft)), ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`0`n";
}
}
if (!isset($op) || !is_array($op)) $op = array();
if (!array_key_exists($i,$op) || $op[$i] == "") {
if ($linkbios)
$op[$i] = "`0<a href='$link' style='text-decoration: none'>`&{$row['name']}`0</a>`3 says, \"`#".str_replace("&amp;","&",HTMLEntities($row['comment'], ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`3\"`0`n";
elseif (substr($ft,0,5)=='/game' && !$row['name'])
$op[$i] = str_replace("&amp;","&",HTMLEntities($row['comment'], ENT_COMPAT, getsetting("charset", "ISO-8859-1")));
else
$op[$i] = "`&{$row['name']}`3 says, \"`#".str_replace("&amp;","&",HTMLEntities($row['comment'], ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`3\"`0`n";
$rawc[$i] = "`&{$row['name']}`3 says, \"`#".str_replace("&amp;","&",HTMLEntities($row['comment'], ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`3\"`0`n";
}
if (!array_key_exists('timestamp', $session['user']['prefs']))
$session['user']['prefs']['timestamp'] = 0;
$session['user']['prefs']['timeoffset'] = round($session['user']['prefs']['timeoffset'],1);
if ($session['user']['prefs']['timestamp']==1) {
if (!isset($session['user']['prefs']['timeformat'])) $session['user']['prefs']['timeformat'] = "[m/d h:ia]";
$time = strtotime($row['postdate']) + ($session['user']['prefs']['timeoffset'] * 60 * 60);
$s=date("`7" . $session['user']['prefs']['timeformat'] . "`0 ",$time);
$op[$i] = $s.$op[$i];
}elseif ($session['user']['prefs']['timestamp']==2) {
$s=reltime(strtotime($row['postdate']));
$op[$i] = "`7($s)`0 ".$op[$i];
}
if ($message=="X")
$op[$i]="`0({$row['section']}) ".$op[$i];
if ($row['postdate']>=$session['user']['recentcomments'])
$op[$i]="<img src='images/new.gif' alt='&gt;' width='3' height='5' align='absmiddle'> ".$op[$i];
addnav("",$link);
$auth[$i] = $row['author'];
if (isset($rawc[$i])) {
$rawc[$i] = full_sanitize($rawc[$i]);
$rawc[$i] = htmlentities($rawc[$i], ENT_QUOTES, getsetting("charset", "ISO-8859-1"));
}
}
$i--;
$outputcomments=array();
$sect="x";
$moderating=false;
if (($session['user']['superuser'] & SU_EDIT_COMMENTS) && $message=="X")
$moderating=true;
$del=translate_inline("Del");
$scriptname=substr($_SERVER['SCRIPT_NAME'],strrpos($_SERVER['SCRIPT_NAME'],"/")+1);
$pos=strpos($_SERVER['REQUEST_URI'],"?");
$return=$scriptname.($pos==false?"":substr($_SERVER['REQUEST_URI'],$pos));
$one=(strstr($return,"?")==false?"?":"&");
for (;$i>=0;$i--){
$out="";
if ($moderating){
if ($session['user']['superuser'] & SU_EDIT_USERS){
$out.="`0[ <input type='checkbox' name='comment[{$commentids[$i]}]'> | <a href='user.php?op=setupban&userid=".$auth[$i]."&reason=".rawurlencode($rawc[$i])."'>Ban</a> ]&nbsp;";
addnav("","user.php?op=setupban&userid=$auth[$i]&reason=".rawurlencode($rawc[$i]));
}else{
$out.="`0[ <input type='checkbox' name='comment[{$commentids[$i]}]'> ]&nbsp;";
}
$matches=array();
preg_match("/[(]([^)]*)[)]/",$op[$i],$matches);
$sect=trim($matches[1]);
if (substr($sect,0,5)!="clan-" || $sect==$section){
if (substr($sect,0,4)!="pet-"){
$out.=$op[$i];
if (!isset($outputcomments[$sect]) ||
!is_array($outputcomments[$sect]))
$outputcomments[$sect]=array();
array_push($outputcomments[$sect],$out);
}
}
}else{
if ($session['user']['superuser'] & SU_EDIT_COMMENTS) {
$out.="`2[<a href='".$return.$one."removecomment={$commentids[$i]}&section=$section&returnpath=".URLEncode($return)."'>$del</a>`2]`0&nbsp;";
addnav("",$return.$one."removecomment={$commentids[$i]}&section=$section&returnpath=".URLEncode($return)."");
}
$out.=$op[$i];
if (!array_key_exists($sect,$outputcomments) || !is_array($outputcomments[$sect]))
$outputcomments[$sect]=array();
array_push($outputcomments[$sect],$out);
}
}
if ($moderating){
$scriptname=substr($_SERVER['SCRIPT_NAME'],strrpos($_SERVER['SCRIPT_NAME'],"/")+1);
addnav("","$scriptname?op=commentdelete&return=".URLEncode($_SERVER['REQUEST_URI']));
$mod_Del1 = htmlentities(translate_inline("Delete Checked Comments"), ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
$mod_Del2 = htmlentities(translate_inline("Delete Checked & Ban (3 days)"), ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
$mod_Del_confirm = addslashes(htmlentities(translate_inline("Are you sure you wish to ban this user and have you specified the exact reason for the ban, i.e. cut/pasted their offensive comments?"), ENT_COMPAT, getsetting("charset", "ISO-8859-1")));
$mod_reason = translate_inline("Reason:");
$mod_reason_desc = htmlentities(translate_inline("Banned for comments you posted."), ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
output_notl("<form action='$scriptname?op=commentdelete&return=".URLEncode($_SERVER['REQUEST_URI'])."' method='POST'>",true);
output_notl("<input type='submit' class='button' value=\"$mod_Del1\">",true);
output_notl("<input type='submit' class='button' name='delnban' value=\"$mod_Del2\" onClick=\"return confirm('$mod_Del_confirm');\">",true);
output_notl("`n$mod_reason <input name='reason0' size='40' value=\"$mod_reason_desc\" onChange=\"document.getElementById('reason').value=this.value;\">",true);
}
//output the comments
ksort($outputcomments);
reset($outputcomments);
$sections = commentarylocs();
$needclose = 0;
while (list($sec,$v)=each($outputcomments)){
if ($sec!="x") {
if($needclose) modulehook("}collapse");
output_notl("`n<hr><a href='moderate.php?area=%s'>`b`^%s`0`b</a>`n",
$sec, isset($sections[$sec]) ? $sections[$sec] : "($sec)", true);
addnav("", "moderate.php?area=$sec");
modulehook("collapse{",array("name"=>"com-".$sec));
$needclose = 1;
} else {
modulehook("collapse{",array("name"=>"com-".$section));
$needclose = 1;
}
reset($v);
while (list($key,$val)=each($v)){
$args = array('commentline'=>$val);
$args = modulehook("viewcommentary", $args);
$val = $args['commentline'];
output_notl($val, true);
}
}
if ($moderating && $needclose) {
modulehook("}collapse");
$needclose = 0;
}
if ($moderating){
output_notl("`n");
rawoutput("<input type='submit' class='button' value=\"$mod_Del1\">");
rawoutput("<input type='submit' class='button' name='delnban' value=\"$mod_Del2\" onClick=\"return confirm('$mod_Del_confirm');\">");
output_notl("`n%s ", $mod_reason);
rawoutput("<input name='reason' size='40' id='reason' value=\"$mod_reason_desc\">");
rawoutput("</form>");
output_notl("`n");
}
if ($session['user']['loggedin']) {
$args = modulehook("insertcomment", array("section"=>$section));
if (array_key_exists("mute",$args) && $args['mute'] &&
!($session['user']['superuser'] & SU_EDIT_COMMENTS)) {
output_notl("%s", $args['mutemsg']);
} elseif ($counttoday<($limit/2) ||
($session['user']['superuser']&~SU_DOESNT_GIVE_GROTTO)
|| !getsetting('postinglimit',1)){
if ($message!="X"){
$message="`n`@$message`n";
output($message);
talkform($section,$talkline,$limit,$schema);
}
}else{
$message="`n`@$message`n";
output($message);
output("Sorry, you've exhausted your posts in this section for now.`0`n");
}
}
$jump = false;
if (!isset($session['user']['prefs']['nojump']) || $session['user']['prefs']['nojump'] == false) {
$jump = true;
}
$firstu = translate_inline("&lt;&lt; First Unseen");
$prev = translate_inline("&lt; Previous");
$ref = translate_inline("Refresh");
$next = translate_inline("Next &gt;");
$lastu = translate_inline("Last Page &gt;&gt;");
if ($rowcount>=$limit || $cid>0){
$sql = "SELECT count(commentid) AS c FROM " . db_prefix("commentary") . " WHERE section='$section' AND postdate > '{$session['user']['recentcomments']}'";
$r = db_query($sql);
$val = db_fetch_assoc($r);
$val = round($val['c'] / $limit + 0.5,0) - 1;
if ($val>0){
$first = comscroll_sanitize($REQUEST_URI)."&comscroll=".($val);
$first = str_replace("?&","?",$first);
if (!strpos($first,"?")) $first = str_replace("&","?",$first);
$first .= "&refresh=1";
if ($jump) {
$first .= "#$section";
}
output_notl("<a href=\"$first\">$firstu</a>",true);
addnav("",$first);
}else{
output_notl($firstu,true);
}
$req = comscroll_sanitize($REQUEST_URI)."&comscroll=".($com+1);
$req = str_replace("?&","?",$req);
if (!strpos($req,"?")) $req = str_replace("&","?",$req);
$req .= "&refresh=1";
if ($jump) {
$req .= "#$section";
}
output_notl("<a href=\"$req\">$prev</a>",true);
addnav("",$req);
}else{
output_notl("$firstu $prev",true);
}
$last = appendlink(comscroll_sanitize($REQUEST_URI),"refresh=1");
// Okay.. we have some smart-ass (or stupidass, you guess) players
// who think that the auto-reload firefox plugin is a good way to
// avoid our timeouts. Won't they be surprised when I take that little
// hack away.
$last = appendcount($last);
$last = str_replace("?&","?",$last);
if ($jump) {
$last .= "#$section";
}
//if (!strpos($last,"?")) $last = str_replace("&","?",$last);
//debug($last);
output_notl("&nbsp;<a href=\"$last\">$ref</a>&nbsp;",true);
addnav("",$last);
if ($com>0 || ($cid > 0 && $newadded > $limit)){
$req = comscroll_sanitize($REQUEST_URI)."&comscroll=".($com-1);
$req = str_replace("?&","?",$req);
if (!strpos($req,"?")) $req = str_replace("&","?",$req);
$req .= "&refresh=1";
if ($jump) {
$req .= "#$section";
}
output_notl(" <a href=\"$req\">$next</a>",true);
addnav("",$req);
output_notl(" <a href=\"$last\">$lastu</a>",true);
}else{
output_notl("$next $lastu",true);
}
if (!$cc) db_free_result($result);
tlschema();
if ($needclose) modulehook("}collapse");
}
function talkform($section,$talkline,$limit=10,$schema=false){
require_once("lib/forms.php");
global $REQUEST_URI,$session,$translation_namespace;
if ($schema===false) $schema=$translation_namespace;
tlschema("commentary");
$jump = false;
if (isset($session['user']['prefs']['nojump']) && $session['user']['prefs']['nojump'] == true) {
$jump = true;
}
$counttoday=0;
if (substr($section,0,5)!="clan-"){
$sql = "SELECT author FROM " . db_prefix("commentary") . " WHERE section='$section' AND postdate>'".date("Y-m-d 00:00:00")."' ORDER BY commentid DESC LIMIT $limit";
$result = db_query($sql);
while ($row=db_fetch_assoc($result)){
if ($row['author']==$session['user']['acctid']) $counttoday++;
}
if (round($limit/2,0)-$counttoday <= 0 && getsetting('postinglimit',1)){
if ($session['user']['superuser']&~SU_DOESNT_GIVE_GROTTO){
output("`n`)(You'd be out of posts if you weren't a superuser or moderator.)`n");
}else{
output("`n`)(You are out of posts for the time being. Once some of your existing posts have moved out of the comment area, you'll be allowed to post again.)`n");
return false;
}
}
}
if (translate_inline($talkline,$schema)!="says")
$tll = strlen(translate_inline($talkline,$schema))+11;
else $tll=0;
$req = comscroll_sanitize($REQUEST_URI)."&comment=1";
$req = str_replace("?&","?",$req);
if (!strpos($req,"?")) $req = str_replace("&","?",$req);
if ($jump) {
$req .= "#$section";
}
addnav("",$req);
output_notl("<form action=\"$req\" method='POST' autocomplete='false'>",true);
previewfield("insertcommentary", $session['user']['name'], $talkline, true, array("size"=>"40", "maxlength"=>200-$tll));
rawoutput("<input type='hidden' name='talkline' value='$talkline'>");
rawoutput("<input type='hidden' name='schema' value='$schema'>");
rawoutput("<input type='hidden' name='counter' value='{$session['counter']}'>");
$session['commentcounter'] = $session['counter'];
if ($section=="X"){
$vname = getsetting("villagename", LOCATION_FIELDS);
$iname = getsetting("innname", LOCATION_INN);
$sections = commentarylocs();
reset ($sections);
output_notl("<select name='section'>",true);
while (list($key,$val)=each($sections)){
output_notl("<option value='$key'>$val</option>",true);
}
output_notl("</select>",true);
}else{
output_notl("<input type='hidden' name='section' value='$section'>",true);
}
$add = htmlentities(translate_inline("Add"), ENT_QUOTES, getsetting("charset", "ISO-8859-1"));
output_notl("<input type='submit' class='button' value='$add'>`n",true);
if (round($limit/2,0)-$counttoday < 3 && getsetting('postinglimit',1)){
output("`)(You have %s posts left today)`n`0",(round($limit/2,0)-$counttoday));
}
rawoutput("<div id='previewtext'></div></form>");
tlschema();
}
?>

View File

@ -0,0 +1,87 @@
<?php
// addnews ready
// translator ready
// mail ready
$defines = array();
function myDefine($name,$value){
global $defines;
define($name,$value);
$defines[$name] = $value;
}
//Superuser constants
myDefine("SU_MEGAUSER",1);
myDefine("SU_EDIT_MOUNTS",2);
myDefine("SU_EDIT_CREATURES",4);
myDefine("SU_EDIT_PETITIONS",8);
myDefine("SU_EDIT_COMMENTS",16);
myDefine("SU_EDIT_DONATIONS",32);
myDefine("SU_EDIT_USERS",64);
myDefine("SU_EDIT_CONFIG",128);
myDefine("SU_INFINITE_DAYS",256);
myDefine("SU_EDIT_EQUIPMENT",512);
myDefine("SU_EDIT_PAYLOG",1024);
myDefine("SU_DEVELOPER",2048);
myDefine("SU_POST_MOTD",4096);
myDefine("SU_DEBUG_OUTPUT",8192);
myDefine("SU_MODERATE_CLANS",16384);
myDefine("SU_EDIT_RIDDLES",32768);
myDefine("SU_MANAGE_MODULES",65536);
myDefine("SU_AUDIT_MODERATION",131072);
myDefine("SU_IS_TRANSLATOR",262144);
myDefine("SU_RAW_SQL", 524288);
myDefine("SU_VIEW_SOURCE", 1048576);
myDefine("SU_NEVER_EXPIRE", 2097152);
myDefine("SU_EDIT_ITEMS", 4194304);
myDefine("SU_GIVE_GROTTO", 8388608);
myDefine("SU_OVERRIDE_YOM_WARNING", 16777216);
myDefine("SU_SHOW_PHPNOTICE", 33554432);
myDefine("SU_IS_GAMEMASTER", 67108864);
myDefine("SU_ANYONE_CAN_SET",SU_DEBUG_OUTPUT | SU_INFINITE_DAYS | SU_OVERRIDE_YOM_WARNING | SU_SHOW_PHPNOTICE);
myDefine("SU_DOESNT_GIVE_GROTTO",SU_DEBUG_OUTPUT | SU_INFINITE_DAYS | SU_VIEW_SOURCE|SU_NEVER_EXPIRE);
myDefine("SU_HIDE_FROM_LEADERBOARD",SU_MEGAUSER | SU_EDIT_DONATIONS | SU_EDIT_USERS | SU_EDIT_CONFIG | SU_INFINITE_DAYS | SU_DEVELOPER | SU_RAW_SQL);
myDefine("NO_ACCOUNT_EXPIRATION", SU_HIDE_FROM_LEADERBOARD|SU_NEVER_EXPIRE);
//likely privs which indicate a visible admin.
myDefine("SU_GIVES_YOM_WARNING", SU_EDIT_COMMENTS | SU_EDIT_USERS | SU_EDIT_CONFIG | SU_POST_MOTD);
//Clan constants
//Changed for v1.1.0 Dragonprime Edition to extend clan possibilities
myDefine("CLAN_APPLICANT",0);
myDefine("CLAN_MEMBER",10);
myDefine("CLAN_OFFICER",20);
myDefine("CLAN_LEADER",30);
myDefine("CLAN_FOUNDER",31);
//Location Constants
myDefine("LOCATION_FIELDS","Degolburg");
myDefine("LOCATION_INN","The Boar's Head Inn");
//Gender Constants
myDefine("SEX_MALE",0);
myDefine("SEX_FEMALE",1);
//Miscellaneous
myDefine("INT_MAX",4294967295);
myDefine("RACE_UNKNOWN","Horrible Gelatinous Blob");
//Character Deletion Types
myDefine("CHAR_DELETE_AUTO",1);
myDefine("CHAR_DELETE_MANUAL",2);
myDefine("CHAR_DELETE_PERMADEATH",3); //reserved for the future -- I don't have any plans this way currently, but it seemed appropriate to have it here.
myDefine("CHAR_DELETE_SUICIDE",4);
// Constants used in lib/modules - for providing more information about the
// status of the module
myDefine("MODULE_NO_INFO",0);
myDefine("MODULE_INSTALLED",1);
myDefine("MODULE_VERSION_OK",2);
myDefine("MODULE_NOT_INSTALLED",4);
myDefine("MODULE_FILE_NOT_PRESENT",8);
myDefine("MODULE_VERSION_TOO_LOW",16);
myDefine("MODULE_ACTIVE",32);
myDefine("MODULE_INJECTED",64);
?>

158
lotgd-web/lotgd/lib/creatures.php Executable file
View File

@ -0,0 +1,158 @@
<?php
function creature_stats($level){
$stats = array();
$stats['creaturelevel'] = $level;
$stats['creaturehealth'] = creature_health($level);
$stats['creatureattack'] = creature_attack($level);
$stats['creaturedefense'] = creature_defense($level);
$stats['creatureexp'] = creature_exp($level);
$stats['creaturegold'] = creature_gold($level);
return $stats;
}
function creature_health($level){
switch ($level) {
case 1:
case 2:
case 3:
case 4:
$health = $level * 11 - 1;
break;
case 5:
$health = 53;
break;
case 6:
case 7:
case 8:
case 9:
$health = $level * 10 + 4;
break;
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
$health = $level * 10 + 5;
break;
case 16:
$health = 166;
break;
case 17:
$health = 178;
break;
case 18:
$health = 190;
break;
}
return $health;
}
function creature_attack($level){
$attack = 1;
for($i=1;$i<$level;++$i){
$attack+=2;
}
return $attack;
}
function creature_defense($level){
$defense = 0;
switch ($level){
// Always fall through
case 18:
++$defense;
case 17:
$defense+=2;
case 16:
++$defense;
case 15:
++$defense;
case 14:
$defense+=2;
case 13:
++$defense;
case 12:
$defense+=2;
case 11:
++$defense;
case 10:
++$defense;
case 9:
$defense+=2;
case 8:
++$defense;
case 7:
$defense+=2;
case 6:
++$defense;
case 5:
++$defense;
case 4:
$defense += 2;
case 3:
++$defense;
case 2:
$defense += 2;
case 1:
++$defense;
}
return $defense;
}
function creature_exp($level){
switch($level){
case 1:
case 2:
case 3:
$exp = $level * 10 + 4;
break;
case 4:
case 5:
$exp = $level * 10 + 5;
break;
case 6:
case 7:
$exp = $level * 11;
break;
case 8:
case 9:
$exp = $level * 12 - 7;
break;
case 10:
case 11:
case 12:
$exp = round(13.5*$level-21.17);
break;
case 13:
case 14:
case 15:
case 16:
$exp = round(0.5*$level*$level+2.5*$level+39);
break;
default:
$exp = 0;
break;
}
return $exp;
}
function creature_gold($level){
switch($level){
case 1:
case 2:
case 3:
case 4:
$gold = round(-4.5*$level*$level*$level+22*$level*$level+26.5*$level-8);
break;
case 17:
case 18:
$gold = 0;
break;
default:
$gold = round(-0.1673326*$level*$level+36.590909*$level+19.904594);
break;
}
return $gold;
}
?>

138
lotgd-web/lotgd/lib/datacache.php Executable file
View File

@ -0,0 +1,138 @@
<?php
// translator ready
// addnews ready
// mail ready
//This is a data caching library intended to lighten the load on lotgd.net
//use of this library is not recommended for most installations as it raises
//the issue of some race conditions which are mitigated on high volume
//sites but which could cause odd behavior on low volume sites, with out
//offering much if any advantage.
//basically the idea behind this library is to provide a non-blocking
//storage mechanism for non-critical data.
$datacache = array();
$datacachefilepath = "";
$checkedforolddatacaches = false;
define("DATACACHE_FILENAME_PREFIX","datacache_");
function datacache($name,$duration=60){
global $datacache;
if (getsetting("usedatacache",0)){
if (isset($datacache[$name])){
// we've already loaded this data cache this page hit and we
// can simply return it.
return $datacache[$name];
}else{
//we haven't loaded this data cache this page hit.
$fullname = makecachetempname($name);
if (file_exists($fullname) &&
filemtime($fullname) > strtotime("-$duration seconds")){
//the cache file *does* exist, and is not overly old.
$fullfile = @file_get_contents($fullname);
if ($fullfile > ""){
$datacache[$name] = @unserialize($fullfile);
return $datacache[$name];
}else{
return false;
}
}
}
}
// The field didn't exist, or it was too old.
return false;
}
//do NOT send simply a false value in to array or it will bork datacache in to
//thinking that no data is cached or we are outside of the cache period.
function updatedatacache($name,$data){
global $datacache;
if (getsetting("usedatacache",0)){
$fullname = makecachetempname($name);
$datacache[$name] = $data; //serialize($array);
$fp = fopen($fullname,"w");
if ($fp){
if (!fwrite($fp,serialize($data))){
}else{
}
fclose($fp);
}else{
}
return true;
}
//debug($datacache);
return false;
}
//we want to be able to invalidate data caches when we know we've done
//something which would change the data.
function invalidatedatacache($name,$full=false){
global $datacache;
if (getsetting("usedatacache",0)){
if(!$full) $fullname = makecachetempname($name);
else $fullname = $name;
if (file_exists($fullname)) @unlink($fullname);
unset($datacache[$name]);
}
}
//Invalidates *all* caches, which contain $name at the beginning of their filename.
function massinvalidate($name) {
if (getsetting("usedatacache",0)){
$name = DATACACHE_FILENAME_PREFIX.$name;
global $datacachefilepath;
if ($datacachefilepath=="")
$datacachefilepath = getsetting("datacachepath","/tmp");
$dir = @dir($datacachefilepath);
if(is_object($dir)) {
while(false !== ($file = $dir->read())) {
if (strpos($file, $name) !== false) {
invalidatedatacache($dir->path."/".$file,true);
}
}
$dir->close();
}
}
}
function makecachetempname($name){
//one place to sanitize names for data caches.
global $datacache, $datacachefilepath,$checkedforolddatacaches;
if ($datacachefilepath=="")
$datacachefilepath = getsetting("datacachepath","/tmp");
//let's make sure that someone can't trick us in to
$name = DATACACHE_FILENAME_PREFIX.preg_replace("'[^A-Za-z0-9.-]'","",$name);
$fullname = $datacachefilepath."/".$name;
//clean out double slashes (this also blocks file wrappers woot)
$fullname = preg_replace("'//'","/",$fullname);
$fullname = preg_replace("'\\\\'","\\",$fullname);
if ($checkedforolddatacaches==false){
$checkedforolddatacaches=true;
// we want this to be 1 in 100 chance per page hit, not per data
// cache call.
// Once a hundred page hits, we want to clean out old caches.
// if (mt_rand(1,100)<2){
// $handle = opendir($datacachefilepath);
// while (($file = readdir($handle)) !== false) {
// if (substr($file,0,strlen(DATACACHE_FILENAME_PREFIX)) ==
// DATACACHE_FILENAME_PREFIX){
// $fn = $datacachefilepath."/".$file;
// $fn = preg_replace("'//'","/",$fn);
// $fn = preg_replace("'\\\\'","\\",$fn);
// if (is_file($fn) &&
// filemtime($fn) < strtotime("-24 hours")){
// unlink($fn);
// }else{
// }
// }
// }
// }
}
return $fullname;
}
?>

166
lotgd-web/lotgd/lib/datetime.php Executable file
View File

@ -0,0 +1,166 @@
<?php
// addnews ready
// translator ready
// mail ready
function reltime($date,$short=true){
$now = strtotime("now");
$x = abs($now - $date);
$d = (int)($x/86400);
$x = $x % 86400;
$h = (int)($x/3600);
$x = $x % 3600;
$m = (int)($x/60);
$x = $x % 60;
$s = (int)($x);
if ($short){
$array=array("d"=>"d","h"=>"h","m"=>"m","s"=>"s");
$array=translate_inline($array,"datetime");
if ($d > 0)
$o = $d.$array['d'].($h>0?$h.$array['h']:"");
elseif ($h > 0)
$o = $h.$array['h'].($m>0?$m.$array['m']:"");
elseif ($m > 0)
$o = $m.$array['m'].($s>0?$s.$array['s']:"");
else
$o = $s.$array['s'];
/* if ($d > 0)
$o = sprintf("%3s%2s",$d.$array['d'],($h>0?$h.$array['h']:""));
elseif ($h > 0)
$o = sprintf("%3s%2s",$h.$array['h'],($m>0?$m.$array['m']:""));
elseif ($m > 0)
$o = sprintf("%3s%2s",$m.$array['m'],($s>0?$s.$array['s']:""));
else
$o = sprintf("%5s", $s.$array['s']);
$o = str_replace(" ", "&nbsp;", $o);*/
}else{
$array=array("day"=>"day","days"=>"days","hour"=>"hour","hours"=>"hours","minute"=>"minute","minutes"=>"minutes","second"=>"second","seconds"=>"second");
$array=translate_inline($array,"datetime"); //translate it... tl-ready now
if ($d > 0)
$o = "$d ".($d>1?$array['days']:$array['day']).($h>0?", $h ".($h>1?$array['hours']:$array['hour']):"");
elseif ($h > 0)
$o = "$h ".($h>1?$array['hours']:$array['hour']).($m>0?", $m ".($m>1?$array['minutes']:$array['minute']):"");
elseif ($m > 0)
$o = "$m ".($m>1?$array['minutes']:$array['minute']).($s>0?", $s ".($s>1?$array['seconds']:$array['second']):"");
else
$o = "$s ".($s>0?$array['seconds']:$array['second']);
}
return $o;
}
function relativedate($indate){
$laston = round((strtotime("now")-strtotime($indate)) / 86400,0) . " days";
tlschema("datetime");
if (substr($laston,0,2)=="1 ")
$laston=translate_inline("1 day");
elseif (date("Y-m-d",strtotime($laston)) == date("Y-m-d"))
$laston=translate_inline("Today");
elseif (date("Y-m-d",strtotime($laston)) == date("Y-m-d",strtotime("-1 day")))
$laston=translate_inline("Yesterday");
elseif (strpos($indate,"0000-00-00")!==false)
$laston = translate_inline("Never");
else {
$laston= sprintf_translate("%s days", round((strtotime("now")-strtotime($indate)) / 86400,0));
rawoutput(tlbutton_clear());
}
tlschema();
return $laston;
}
function checkday() {
global $session,$revertsession,$REQUEST_URI;
if ($session['user']['loggedin']){
output_notl("<!--CheckNewDay()-->",true);
if(is_new_day()){
$post = $_POST;
unset($post['i_am_a_hack']);
if (count($post) > 0){
$session['user']['lasthit'] = "0000-00-00 00:00:00";
return;
} else {
$session=$revertsession;
$session['user']['restorepage']=$REQUEST_URI;
$session['allowednavs']=array();
addnav("","newday.php");
redirect("newday.php");
}
}
}
}
function is_new_day($now=0){
global $session;
if ($session['user']['lasthit'] == "0000-00-00 00:00:00") {
return true;
}
$t1 = gametime();
$t2 = convertgametime(strtotime($session['user']['lasthit']." +0000"));
$d1 = gmdate("Y-m-d",$t1);
$d2 = gmdate("Y-m-d",$t2);
if ($d1!=$d2){
return true;
}
return false;
}
function getgametime(){
return gmdate("g:i a",gametime());
}
function gametime(){
$time = convertgametime(strtotime("now"));
return $time;
}
function convertgametime($intime,$debug=false){
//adjust the requested time by the game offset
$intime -= getsetting("gameoffsetseconds",0);
// we know that strtotime gives us an identical timestamp for
// everywhere in the world at the same time, if it is provided with
// the GMT offset:
$epoch = strtotime(getsetting("game_epoch",gmdate("Y-m-d 00:00:00 O",strtotime("-30 days"))));
$now = strtotime(gmdate("Y-m-d H:i:s O",$intime));
$logd_timestamp = ($now - $epoch) * getsetting("daysperday",4);
if ($debug){
echo "Game Timestamp: ".$logd_timestamp.", which makes it ".gmdate("Y-m-d H:i:s",$logd_timestamp)."<br>";
}
return $logd_timestamp;
}
function gametimedetails(){
$ret = array();
$ret['now'] = date("Y-m-d 00:00:00");
$ret['gametime'] = gametime();
$ret['daysperday'] = getsetting("daysperday", 4);
$ret['secsperday'] = 86400/$ret['daysperday'];
$ret['today'] = strtotime(gmdate("Y-m-d 00:00:00 O", $ret['gametime']));
$ret['tomorrow'] =
strtotime(gmdate("Y-m-d H:i:s O",$ret['gametime'])." + 1 day");
$ret['tomorrow'] = strtotime(gmdate("Y-m-d 00:00:00 O",$ret['tomorrow']));
// Why isn't this
// $ret['tomorrow'] =
// strtotime(gmdate("Y-m-d 00:00:00 O",$ret['gametime'])." + 1 day");
$ret['secssofartoday'] = $ret['gametime'] - $ret['today'];
$ret['secstotomorrow'] = $ret['tomorrow']-$ret['gametime'];
$ret['realsecssofartoday'] = $ret['secssofartoday'] / $ret['daysperday'];
$ret['realsecstotomorrow'] = $ret['secstotomorrow'] / $ret['daysperday'];
$ret['dayduration'] = ($ret['tomorrow']-$ret['today'])/$ret['daysperday'];
return $ret;
}
function secondstonextgameday($details=false) {
if ($details===false) $details = gametimedetails();
return strtotime("{$details['now']} + {$details['realsecstotomorrow']} seconds");
}
function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
?>

View File

@ -0,0 +1,33 @@
<?php
// addnews ready
// translator ready
// mail ready
require_once("lib/errorhandling.php");
require_once("lib/datacache.php");
/* * * *
* Avaiable values for DBTYPE:
*
* - mysql: The default value. Are you unsure take this.
* - mysqli_oos: The MySQLi extension of PHP5, object oriented style
* - mysqli_proc: The MySQLi extension of PHP5, procedural style
*
*/
define('DBTYPE',"mysql");
$dbinfo = array();
$dbinfo['queriesthishit']=0;
switch(DBTYPE) {
case 'mysql':
require('lib/dbwrapper_mysql.php');
break;
case 'mysqli_oos':
require('lib/dbwrapper_mysqli_oos.php');
break;
case 'mysqli_proc':
require('lib/dbwrapper_mysqli_proc.php');
break;
}
?>

View File

@ -0,0 +1,197 @@
<?php
function db_query($sql, $die=true){
if (defined("DB_NODB") && !defined("LINK")) return array();
global $session,$dbinfo;
$dbinfo['queriesthishit']++;
$fname = DBTYPE."_query";
$starttime = getmicrotime();
$r = $fname($sql, LINK);
if (!$r && $die === true) {
if (defined("IS_INSTALLER")){
return array();
}else{
if ($session['user']['superuser'] & SU_DEVELOPER || 1){
require_once("lib/show_backtrace.php");
die(
"<pre>".HTMLEntities($sql, ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."</pre>"
.db_error(LINK)
.show_backtrace()
);
}else{
die("A most bogus error has occurred. I apologise, but the page you were trying to access is broken. Please use your browser's back button and try again.");
}
}
}
$endtime = getmicrotime();
if ($endtime - $starttime >= 1.00 && ($session['user']['superuser'] & SU_DEBUG_OUTPUT)){
$s = trim($sql);
if (strlen($s) > 800) $s = substr($s,0,400)." ... ".substr($s,strlen($s)-400);
debug("Slow Query (".round($endtime-$starttime,2)."s): ".(HTMLEntities($s, ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`n");
}
unset($dbinfo['affected_rows']);
$dbinfo['affected_rows']=db_affected_rows();
$dbinfo['querytime'] += $endtime-$starttime;
return $r;
}
//& at the start returns a reference to the data array.
//since it's possible this array is large, we'll save ourselves
//the overhead of duplicating the array, then destroying the old
//one by returning a reference instead.
function &db_query_cached($sql,$name,$duration=900){
//this function takes advantage of the data caching library to make
//all of the other db_functions act just like MySQL queries but rely
//instead on disk cached data.
//if (getsetting("usedatacache", 0) == 1) debug("DataCache: $name");
//standard is 15 minutes, als hooks don't need to be cached *that* often, normally you invalidate the cache properly
global $dbinfo;
$data = datacache($name,$duration);
if (is_array($data)){
reset($data);
$dbinfo['affected_rows']=-1;
return $data;
}else{
$result = db_query($sql);
$data = array();
while ($row = db_fetch_assoc($result)) {
$data[] = $row;
}
updatedatacache($name,$data);
reset($data);
return $data;
}
}
if (file_exists("lib/dbremote.php")) {
require_once("lib/dbremote.php");
}
function db_error($link=false){
$fname = DBTYPE."_error";
if ($link!==false)
$r = @$fname($link);
else
$r = @$fname();
if ($r=="" && defined("DB_NODB") && !defined("DB_INSTALLER_STAGE4")) return "The database connection was never established";
return $r;
}
function db_fetch_assoc(&$result){
if (is_array($result)){
//cached data
if (list($key,$val)=each($result))
return $val;
else
return false;
}else{
$fname = DBTYPE."_fetch_assoc";
$r = $fname($result);
return $r;
}
}
function db_insert_id(){
if (defined("DB_NODB") && !defined("LINK")) return -1;
$fname = DBTYPE."_insert_id";
$r = $fname(LINK);
return $r;
}
function db_num_rows($result){
if (is_array($result)){
return count($result);
}else{
if (defined("DB_NODB") && !defined("LINK")) return 0;
$fname = DBTYPE."_num_rows";
$r = @$fname($result); //Whyfor turn off error reporting here?
return $r;
}
}
function db_affected_rows($link=false){
global $dbinfo;
if (isset($dbinfo['affected_rows'])) {
return $dbinfo['affected_rows'];
}
if (defined("DB_NODB") && !defined("LINK")) return 0;
$fname = DBTYPE."_affected_rows";
if ($link===false) {
$r = $fname(LINK);
}else{
$r = $fname($link);
}
return $r;
}
function db_pconnect($host,$user,$pass){
$fname = DBTYPE."_pconnect";
$r = $fname($host,$user,$pass);
return $r;
}
function db_connect($host,$user,$pass){
$fname = DBTYPE."_connect";
$r = $fname($host,$user,$pass);
return $r;
}
function db_get_server_version()
{
$fname = DBTYPE."_get_server_info";
if (defined("LINK")) $r = $fname(LINK);
else $r = $fname();
return $r;
}
function db_select_db($dbname){
$fname = DBTYPE."_select_db";
if(!defined("LINK")) $r = $fname($dbname);
else $r = $fname($dbname, LINK);
return $r;
}
function db_free_result($result){
if (is_array($result)){
//cached data
unset($result);
}else{
if (defined("DB_NODB") && !defined("LINK")) return false;
$fname = DBTYPE."_free_result";
$r = $fname($result);
return $r;
}
}
function db_table_exists($tablename){
if (defined("DB_NODB") && !defined("LINK")) return false;
$fname = DBTYPE."_query";
$exists = $fname("SELECT 1 FROM `$tablename` LIMIT 0");
if ($exists) return true;
return false;
}
function db_prefix($tablename, $force=false) {
global $DB_PREFIX;
if ($force === false) {
$special_prefixes = array();
// The following file should be used to override or modify the
// special_prefixes array to be correct for your site. Do NOT
// do this unles you know EXACTLY what this means to you, your
// game, your county, your state, your nation, your planet and
// your universe!
if (file_exists("prefixes.php")) require_once("prefixes.php");
$prefix = $DB_PREFIX;
if (isset($special_prefixes[$tablename])) {
$prefix = $special_prefixes[$tablename];
}
} else {
$prefix = $force;
}
return $prefix . $tablename;
}
?>

View File

@ -0,0 +1,210 @@
<?php
// addnews ready
// translator ready
// mail ready
function db_query($sql, $die=true){
if (defined("DB_NODB") && !defined("LINK")) return array();
global $session,$dbinfo,$mysqli_resource;
$dbinfo['queriesthishit']++;
// $fname = DBTYPE."_query";
$starttime = getmicrotime();
//$r = $fname($sql);
$r = $mysqli_resource->Query($sql);
if (!$r && $die === true) {
if (defined("IS_INSTALLER")){
return array();
}else{
if ($session['user']['superuser'] & SU_DEVELOPER || 1){
require_once("lib/show_backtrace.php");
die(
"<pre>".HTMLEntities($sql, ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."</pre>"
.db_error(LINK)
.show_backtrace()
);
}else{
die("A most bogus error has occurred. I apologise, but the page you were trying to access is broken. Please use your browser's back button and try again.");
}
}
}
$endtime = getmicrotime();
if ($endtime - $starttime >= 1.00 && ($session['user']['superuser'] & SU_DEBUG_OUTPUT)){
$s = trim($sql);
if (strlen($s) > 800) $s = substr($s,0,400)." ... ".substr($s,strlen($s)-400);
debug("Slow Query (".round($endtime-$starttime,2)."s): ".(HTMLEntities($s, ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`n");
}
unset($dbinfo['affected_rows']);
$dbinfo['affected_rows']=db_affected_rows();
$dbinfo['querytime'] += $endtime-$starttime;
return $r;
}
//& at the start returns a reference to the data array.
//since it's possible this array is large, we'll save ourselves
//the overhead of duplicating the array, then destroying the old
//one by returning a reference instead.
function &db_query_cached($sql,$name,$duration=900){
//this function takes advantage of the data caching library to make
//all of the other db_functions act just like MySQL queries but rely
//instead on disk cached data.
//if (getsetting("usedatacache", 0) == 1) debug("DataCache: $name");
//standard is 15 minutes, als hooks don't need to be cached *that* often, normally you invalidate the cache properly
global $dbinfo;
$data = datacache($name,$duration);
if (is_array($data)){
reset($data);
$dbinfo['affected_rows']=-1;
return $data;
}else{
$result = db_query($sql);
$data = array();
while ($row = db_fetch_assoc($result)) {
$data[] = $row;
}
updatedatacache($name,$data);
reset($data);
return $data;
}
}
if (file_exists("lib/dbremote.php")) {
require_once("lib/dbremote.php");
}
function db_error(){
global $mysqli_resource;
$r = $mysqli_resource->error;
if ($r=="" && defined("DB_NODB") && !defined("DB_INSTALLER_STAGE4")) return "The database connection was never established";
return $r;
}
function db_fetch_assoc(&$result){
if (is_array($result)){
//cached data
if (list($key,$val)=each($result))
return $val;
else
return false;
}else{
//$fname = DBTYPE."_fetch_assoc";
//$r = $fname($result);
$r = $result->Fetch_Assoc();
return $r;
}
}
function db_insert_id(){
global $mysqli_resource;
if (defined("DB_NODB") && !defined("LINK")) return -1;
//$fname = DBTYPE."_insert_id";
//$r = $fname();
$r = $mysqli_resource->insert_id;
return $r;
}
function db_num_rows($result){
if (is_array($result)){
return count($result);
}else{
if (defined("DB_NODB") && !defined("LINK")) return 0;
$r = $result->num_rows;
return $r;
}
}
function db_affected_rows($link=false){
global $dbinfo, $mysqli_resource;
if (isset($dbinfo['affected_rows'])) {
return $dbinfo['affected_rows'];
}
if (defined("DB_NODB") && !defined("LINK")) return 0;
$r = $mysqli_resource->affected_rows;
return $r;
}
function db_pconnect($host,$user,$pass){
global $mysqli_resource;
// Constants cannot be an object
// MySQLi do not know a pconnect
$mysqli_resource = New MySQLi($host, $user, $pass);
if($mysqli_resource) {
return true;
}
else {
return false;
}
}
function db_connect($host,$user,$pass){
global $mysqli_resource;
// Constants cannot be an object
$mysqli_resource = New MySQLi($host, $user, $pass);
if($mysqli_resource) {
return true;
}
else {
return false;
}
}
function db_get_server_version() {
global $mysqli_resource;
return $mysqli_resource->server_info;
}
function db_select_db($dbname){
global $mysqli_resource;
$r = $mysqli_resource->select_db($dbname);
return $r;
}
function db_free_result($result){
if (is_array($result)){
//cached data
unset($result);
}else{
if (defined("DB_NODB") && !defined("LINK")) return false;
$result->Free();
return true;
}
}
function db_table_exists($tablename){
global $mysqli_resource;
if (defined("DB_NODB") && !defined("LINK")) return false;
$exists = $mysqli_resource->Query("SELECT 1 FROM `$tablename` LIMIT 0");
if ($exists) return true;
return false;
}
function db_prefix($tablename, $force=false) {
global $DB_PREFIX;
if ($force === false) {
$special_prefixes = array();
// The following file should be used to override or modify the
// special_prefixes array to be correct for your site. Do NOT
// do this unles you know EXACTLY what this means to you, your
// game, your county, your state, your nation, your planet and
// your universe!
if (file_exists("prefixes.php")) require_once("prefixes.php");
$prefix = $DB_PREFIX;
if (isset($special_prefixes[$tablename])) {
$prefix = $special_prefixes[$tablename];
}
} else {
$prefix = $force;
}
return $prefix . $tablename;
}
?>

View File

@ -0,0 +1,203 @@
<?php
// addnews ready
// translator ready
// mail ready
function db_query($sql, $die=true){
if (defined("DB_NODB") && !defined("LINK")) return array();
global $session,$dbinfo,$mysqli_resource;
$dbinfo['queriesthishit']++;
// $fname = DBTYPE."_query";
$starttime = getmicrotime();
//$r = $fname($sql);
$r = mysqli_Query($mysqli_resource, $sql);
if (!$r && $die === true) {
if (defined("IS_INSTALLER")){
return array();
}else{
if ($session['user']['superuser'] & SU_DEVELOPER || 1){
require_once("lib/show_backtrace.php");
die(
"<pre>".HTMLEntities($sql, ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."</pre>"
.db_error(LINK)
.show_backtrace()
);
}else{
die("A most bogus error has occurred. I apologise, but the page you were trying to access is broken. Please use your browser's back button and try again.");
}
}
}
$endtime = getmicrotime();
if ($endtime - $starttime >= 1.00 && ($session['user']['superuser'] & SU_DEBUG_OUTPUT)){
$s = trim($sql);
if (strlen($s) > 800) $s = substr($s,0,400)." ... ".substr($s,strlen($s)-400);
debug("Slow Query (".round($endtime-$starttime,2)."s): ".(HTMLEntities($s, ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`n");
}
unset($dbinfo['affected_rows']);
$dbinfo['affected_rows']=db_affected_rows();
$dbinfo['querytime'] += $endtime-$starttime;
return $r;
}
//& at the start returns a reference to the data array.
//since it's possible this array is large, we'll save ourselves
//the overhead of duplicating the array, then destroying the old
//one by returning a reference instead.
function &db_query_cached($sql,$name,$duration=900){
//this function takes advantage of the data caching library to make
//all of the other db_functions act just like MySQL queries but rely
//instead on disk cached data.
//if (getsetting("usedatacache", 0) == 1) debug("DataCache: $name");
//standard is 15 minutes, als hooks don't need to be cached *that* often, normally you invalidate the cache properly
global $dbinfo;
$data = datacache($name,$duration);
if (is_array($data)){
reset($data);
$dbinfo['affected_rows']=-1;
return $data;
}else{
$result = db_query($sql);
$data = array();
while ($row = db_fetch_assoc($result)) {
$data[] = $row;
}
updatedatacache($name,$data);
reset($data);
return $data;
}
}
if (file_exists("lib/dbremote.php")) {
require_once("lib/dbremote.php");
}
function db_error(){
global $mysqli_resource;
$r = mysqli_error($mysqli_resource);
if ($r=="" && defined("DB_NODB") && !defined("DB_INSTALLER_STAGE4")) return "The database connection was never established";
return $r;
}
function db_fetch_assoc(&$result){
if (is_array($result)){
//cached data
if (list($key,$val)=each($result))
return $val;
else
return false;
}else{
$r = mysqli_fetch_assoc($result);
return $r;
}
}
function db_insert_id(){
global $mysqli_resource;
if (defined("DB_NODB") && !defined("LINK")) return -1;
$r = mysqli_insert_id($mysqli_resource);
return $r;
}
function db_num_rows($result){
if (is_array($result)){
return count($result);
}else{
if (defined("DB_NODB") && !defined("LINK")) return 0;
$r = mysqli_num_rows($result);
return $r;
}
}
function db_affected_rows($link=false){
global $dbinfo, $mysqli_resource;
if (isset($dbinfo['affected_rows'])) {
return $dbinfo['affected_rows'];
}
if (defined("DB_NODB") && !defined("LINK")) return 0;
$r = mysqli_affected_rows($mysqli_resource);
return $r;
}
function db_pconnect($host,$user,$pass){
global $mysqli_resource;
$mysqli_resource = mysqli_connect($host, $user, $pass);
if($mysqli_resource) {
return true;
}
else {
return false;
}
}
function db_connect($host,$user,$pass){
global $mysqli_resource;
$mysqli_resource = mysqli_connect($host, $user, $pass);
if($mysqli_resource) {
return true;
}
else {
return false;
}
}
function db_get_server_version() {
global $mysqli_resource;
return mysqli_get_server_info($mysqli_resource);
}
function db_select_db($dbname){
global $mysqli_resource;
$r = mysqli_select_db($mysqli_resource, $dbname);
return $r;
}
function db_free_result($result){
if (is_array($result)){
//cached data
unset($result);
}else{
if (defined("DB_NODB") && !defined("LINK")) return false;
mysqli_free_result($result);
return true;
}
}
function db_table_exists($tablename){
global $mysqli_resource;
if (defined("DB_NODB") && !defined("LINK")) return false;
$exists = $mysqli_resource->Query("SELECT 1 FROM `$tablename` LIMIT 0");
if ($exists) return true;
return false;
}
function db_prefix($tablename, $force=false) {
global $DB_PREFIX;
if ($force === false) {
$special_prefixes = array();
// The following file should be used to override or modify the
// special_prefixes array to be correct for your site. Do NOT
// do this unles you know EXACTLY what this means to you, your
// game, your county, your state, your nation, your planet and
// your universe!
if (file_exists("prefixes.php")) require_once("prefixes.php");
$prefix = $DB_PREFIX;
if (isset($special_prefixes[$tablename])) {
$prefix = $special_prefixes[$tablename];
}
} else {
$prefix = $force;
}
return $prefix . $tablename;
}
?>

View File

@ -0,0 +1,44 @@
<?php
// translator ready
// addnews ready
// mail ready
function debuglog($message,$target=false,$user=false,$field=false,$value=false,$consolidate=true){
if ($target===false) $target=0;
static $needsdebuglogdelete = true;
global $session;
$args = func_get_args();
if ($user === false) $user = $session['user']['acctid'];
$corevalue = $value;
$id=0;
if ($field !== false && $value !==false && $consolidate){
$sql = "SELECT * FROM ".db_prefix("debuglog")." WHERE actor=$user AND field='$field' AND date>'".date("Y-m-d 00:00:00")."'";
$result = db_query($sql);
if (db_num_rows($result)>0){
$row = db_fetch_assoc($result);
$value = $row['value']+$value;
$message = $row['message'];
$id = $row['id'];
}
}
if ($corevalue!==false) $message.=" ($corevalue)";
if ($field===false) $field="";
if ($value===false) $value=0;
if ($id > 0){
$sql = "UPDATE ".db_prefix("debuglog")."
SET
date='".date("Y-m-d H:i:s")."',
actor='$user',
target='$target',
message='".addslashes($message)."',
field='$field',
value='$value'
WHERE
id=$id
";
}else{
$sql = "INSERT INTO " . db_prefix("debuglog") . " (id,date,actor,target,message,field,value) VALUES($id,'".date("Y-m-d H:i:s")."',$user,$target,'".addslashes($message)."','$field','$value')";
}
db_query($sql);
}
?>

10
lotgd-web/lotgd/lib/dhms.php Executable file
View File

@ -0,0 +1,10 @@
<?php
// addnews ready
// translator ready
// mail ready
function dhms($secs,$dec=false){
if ($dec===false) $secs=round($secs,0);
return (int)($secs/86400).translate_inline("d","datetime").(int)($secs/3600%24).translate_inline("h","datetime").(int)($secs/60%60).translate_inline("m","datetime").($secs%60).($dec?substr($secs-(int)$secs,1):"").translate_inline("s","datetime");
//use multiple translate_inlines as this function is not called too often...if you deactive stats...
}
?>

View File

@ -0,0 +1,43 @@
<?php
// addnews ready
// translator ready
// mail ready
function dump_item($item){
$out = "";
if (is_array($item)) $temp = $item;
else $temp = @unserialize($item);
if (is_array($temp)) {
$out .= "array(" . count($temp) . ") {<div style='padding-left: 20pt;'>";
while(list($key, $val) = @each($temp)) {
$out .= "'$key' = '" . dump_item($val) . "'`n";
}
$out .= "</div>}";
} else {
$out .= $item;
}
return $out;
}
function dump_item_ascode($item,$indent="\t"){
$out = "";
if (is_array($item)) $temp = $item;
else $temp = @unserialize($item);
if (is_array($temp)) {
$out .= "array(\n$indent";
$row = array();
while(list($key, $val) = @each($temp)) {
array_push($row,"'$key'=&gt;" . dump_item_ascode($val,$indent."\t"));
}
if (strlen(join(", ",$row)) > 80){
$out .= join(",\n$indent",$row);
}else{
$out .= join(", ",$row);
}
$out .= "\n$indent)";
} else {
$out .= "'".htmlentities(addslashes($item), ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."'";
}
return $out;
}
?>

152
lotgd-web/lotgd/lib/e_dom.js Executable file
View File

@ -0,0 +1,152 @@
/*
* translator ready
* addnews ready
* mail ready
*/
//Javascript Generic DOM
//By Eric Stevens
//
function fetchDOM(filename){
var xmldom;
if (document.implementation &&
document.implementation.createDocument){
//Mozilla style browsers
xmldom = document.implementation.createDocument("", "", null);
} else if (window.ActiveXObject) {
//IE style browsers
xmldom = new ActiveXObject("Microsoft.XMLDOM");
}
xmldom.async=false;
try {
xmldom.load(filename);
} catch(e){
xmldom.parseXML("<b>Failed to load "+filename+"</b>");
}
return xmldom;
}
if (document.implementation && document.implementation.createDocument){
var dom = document.implementation.createDocument("","",null);
}else{
var dom = new ActiveXObject("Microsoft.XMLDOM");
}
function fetchDOMasync(filename,args,theCode){
var xmldom;
try {
xmldom = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmldom = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmldom = false;
}
}
if (!xmldom && typeof XMLHttpRequest!='undefined') {
xmldom = new XMLHttpRequest();
}
xmldom.onreadystatechange = function(){
if (xmldom.readyState == 4) {
theCode();
}
};
xmldom.open("POST",filename,true);
xmldom.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
xmldom.send(args);
return xmldom;
}
function createXML(node){
if (!node) return "<b>You cannot pass null to createXML</b>";
if (node.xml)
return node.xml;
var out = "";
if (node.nodeType==1){
var x=0;
out = "<" + node.nodeName;
for (x=0; x < node.attributes.length; x++){
out = out + " " + node.attributes[x].name + "=\"" + HTMLencode(node.attributes[x].nodeValue) + "\"";
}
out = out + ">";
for (x=0; x < node.childNodes.length; x++){
out = out + createXML(node.childNodes[x]);
}
out = out + "</" + node.nodeName + ">";
}else if(node.nodeType==3){
out = out + HTMLencode(node.nodeValue);
}
return out;
}
function selectSingleNode(node,name){
var nextName = "";
if (name.indexOf("/") > 0){
nextName = name.substring(name.indexOf("/")+1);
name = name.substring(0,name.indexOf("/"));
}
for (var x=0; x<node.childNodes.length; x++){
if (node.childNodes[x].nodeName == name) {
if (nextName == ""){
return node.childNodes[x];
}else{
return selectSingleNode(node.childNodes[x],nextName);
}
}
}
}
function nodeText(node){
var out="";
for (y=0; y<node.childNodes.length; y++){
if (node.childNodes[y].nodeType==3){
out+=node.childNodes[y].nodeValue;
}else if(node.childNodes[y].nodeType==1){
out += nodeText(node.childNodes[y]);
}
}
return out;
}
function parseRSS(xml,htmlescape){
var rss = selectSingleNode(xml,"rss");
var channel = selectSingleNode(rss,"channel");
var feed = new Array();
//collect rss headers
feed["title"] = HTMLencode(nodeText(selectSingleNode(channel,"title")),htmlescape);
feed["link"] = HTMLencode(nodeText(selectSingleNode(channel,"link")),htmlescape);
feed["description"] = HTMLencode(nodeText(selectSingleNode(channel,"description")),htmlescape);
var image = selectSingleNode(channel,"image");
feed["image"] = new Array();
feed["image"]["title"] = HTMLencode(nodeText(selectSingleNode(image,"title")),htmlescape);
feed["image"]["url"] = HTMLencode(nodeText(selectSingleNode(image,"url")),htmlescape);
feed["image"]["link"] = HTMLencode(nodeText(selectSingleNode(image,"link")),htmlescape);
feed["items"] = new Array();
//collect rss items
var node;
var y=0;
for (var x=0; x<channel.childNodes.length; x++){
node = channel.childNodes[x];
if (node.nodeType==1){ //standard element
if (node.nodeName == "item"){
feed['items'][y] = new Array();
feed['items'][y]['title'] = HTMLencode(nodeText(selectSingleNode(node,"title")),htmlescape);
feed['items'][y]['link'] = HTMLencode(nodeText(selectSingleNode(node,"link")),htmlescape);
feed['items'][y]['description'] = HTMLencode(nodeText(selectSingleNode(node,"description")),htmlescape);
feed['items'][y]['pubdate'] = HTMLencode(nodeText(selectSingleNode(node,"pubDate")),htmlescape);
y=y+1;
}
}
}
return feed;
}
function HTMLencode(input){
if (input == null){
return "";
}else{
return input.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
}
}
function HTMLdecode(input){
if (input == null){
return "";
}else{
return input.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"').replace(/&amp;/g,"&");
}
}

7
lotgd-web/lotgd/lib/e_dom.php Executable file
View File

@ -0,0 +1,7 @@
<?php
// translator ready
// mail ready
// addnews ready
// mail ready
rawoutput("<script language='JavaScript' src='lib/e_dom.js'></script>");
?>

41
lotgd-web/lotgd/lib/e_rand.php Executable file
View File

@ -0,0 +1,41 @@
<?php
// addnews ready
// translator ready
// mail ready
function make_seed(){
list($usec, $sec) = explode(' ', microtime());
return (float) $sec + ((float) $usec * 100000);
}
function e_rand($min=false,$max=false){
if ($min===false) return @mt_rand();
$min = round($min);
if ($max===false) return @mt_rand($min);
$max = round($max);
if ($min==$max) return $min;
//do NOT ask me why the following line can be executed, it makes no sense,
// but it *does* get executed.
if ($min==0 && $max==0) return 0;
if ($min<$max){
return @mt_rand($min,$max);
}else if($min>$max){
return @mt_rand($max,$min);
}
}
function r_rand($min=false,$max=false){
if ($min===false) return mt_rand();
$min*=1000;
if ($max===false) return (mt_rand($min)/1000);
$max*=1000;
if ($min==$max) return ($min/1000);
//do NOT ask me why the following line can be executed, it makes no sense,
// but it *does* get executed.
if ($min==0 && $max==0) return 0;
if ($min<$max){
return (@mt_rand($min,$max)/1000);
}else if($min>$max){
return (@mt_rand($max,$min)/1000);
}
}
?>

View File

@ -0,0 +1,133 @@
<?php
function logd_error_handler($errno, $errstr, $errfile, $errline){
global $session;
static $in_error_handler = 0;
// If we have used the @ operator, just don't report anything!
if (!error_reporting()) return;
$in_error_handler++;
if ($in_error_handler > 1){//prevents the error handler from being re-called when we're already within a call of it.
if ($errno & (E_USER_WARNING | E_WARNING)){
echo "PHP Warning: \"$errstr\"<br>in <b>$errfile</b> at <b>$errline</b>. Additionally this occurred while within logd_error_handler().<br>";
}elseif ($errno & (E_USER_ERROR | E_ERROR)){
echo "PHP ERROR: \"$errstr\"<br>in <b>$errfile</b> at <b>$errline</b>. Additionally this occurred while within logd_error_handler().<br>";
}
$in_error_handler--;
return;
}
switch($errno){
case E_NOTICE:
case E_USER_NOTICE:
if (getsetting('show_notices', 0) &&
$session['user']['superuser'] & SU_SHOW_PHPNOTICE) {
debug("PHP Notice: \"$errstr\"<br>in <b>$errfile</b> at <b>$errline</b>.");
}
break;
case E_WARNING:
case E_USER_WARNING:
require_once("lib/show_backtrace.php");
tlschema("errorhandler");
output("PHP Warning: \"%s\"`nin `b%s`b at `b%s`b.`n",$errstr,$errfile,$errline,true);
tlschema();
$backtrace = show_backtrace();
rawoutput($backtrace);
if (getsetting("notify_on_warn",0) > ""){
//$args = func_get_args();
//call_user_func_array("logd_error_notify",$args);
logd_error_notify($errno, $errstr, $errfile, $errline, $backtrace);
}
break;
case E_ERROR:
case E_USER_ERROR:
require_once("lib/show_backtrace.php");
echo sprintf("PHP ERROR: \"%s\"<br>in <b>%s</b> at <b>%s</b>.<br>",$errstr,$errfile,$errline);
$backtrace = show_backtrace();
echo $backtrace;
if (getsetting("notify_on_error",0) > ""){
//$args = func_get_args();
//call_user_func_array("logd_error_notify",$args);
logd_error_notify($errno, $errstr, $errfile, $errline, $backtrace);
}
die();
break;
}
$in_error_handler--;
}
function logd_error_notify($errno, $errstr, $errfile, $errline, $backtrace){
global $session;
$sendto = explode(";",getsetting("notify_address",""));
$howoften = getsetting("notify_every",30);
reset($sendto);
$data = datacache("error_notify",86400);
if (!is_array($data)){
$data = array('firstrun'=>true,'errors'=>array());
}else{
$data['firstrun'] = false;
}
$do_notice = false;
if (!array_key_exists($errstr,$data['errors'])){
$do_notice = true;
}elseif (strtotime("now") - ($data['errors'][$errstr]) > $howoften * 60) {
$do_notice = true;
}
if ($data['firstrun']){
debug("First run, not notifying users.");
}else{
if ($do_notice){
/***
* Set up the mime bits
**/
require_once("sanitize.php");
$notice_text = "This is a multi-part message in MIME format.";
$userstr = "";
if ($session && isset($session['user']['name']) && isset($sesson['user']['acctid'])) {
$userstr = "Error triggered by user " . $session['user']['name'] . " (" . $session['user']['acctid'] . ")\n";
}
$plain_text = "$userstr$errstr in $errfile ($errline)\n".sanitize_html($backtrace);
$html_text = "<html><body>$errstr in $errfile ($errline)<hr>$backtrace</body></html>";
$semi_rand = md5(time());
$mime_boundary = "==MULTIPART_BOUNDARY_$semi_rand";
$mime_boundary_header = chr(34) . $mime_boundary . chr(34);
$subject = "{$_SERVER['HTTP_HOST']} $level";
$body = "$notice_text
--$mime_boundary
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
$plain_text
--$mime_boundary
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
$html_text
--$mime_boundary--";
/***
* Mime bits are set up,
**/
while (list($key,$email)=each($sendto)){
debug("Notifying $email of this error.");
mail($email, $subject, $body,
"From: " . $from . "\n" .
"MIME-Version: 1.0\n" .
"Content-Type: multipart/alternative;\n" .
" boundary=" . $mime_boundary_header);
}
//mark the time that notice was last sent for this error.
$data['errors'][$errstr] = strtotime("now");
}else{
debug("Not notifying users for this error, it's only been ".round((strtotime("now") - $data['errors'][$errstr]) / 60,2)." minutes.");
}
}
updatedatacache("error_notify",$data);
debug($data);
}
set_error_handler("logd_error_handler");
?>

View File

@ -0,0 +1,38 @@
<?php
// addnews ready
// translator ready
// mail ready
// Set error reporting to all but notice (for now)
if (defined('E_DEPRECATED')) {
error_reporting (E_ALL ^ (E_NOTICE | E_DEPRECATED));
} else {
error_reporting (E_ALL ^ E_NOTICE);
}
#error_reporting (E_ALL);
function set_magic_quotes(&$vars) {
if (is_array($vars)) {
reset($vars);
while (list($key,$val) = each($vars))
set_magic_quotes($vars[$key]);
}else{
$vars = addslashes($vars);
}
}
//do some cleanup here to make sure magic_quotes_gpc is ON
if (!get_magic_quotes_gpc()){
set_magic_quotes($_GET);
set_magic_quotes($_POST);
set_magic_quotes($_SESSION);
set_magic_quotes($_COOKIE);
set_magic_quotes($HTTP_GET_VARS);
set_magic_quotes($HTTP_POST_VARS);
set_magic_quotes($HTTP_COOKIE_VARS);
ini_set("magic_quotes_gpc",1);
}
// magic_quotes_runtime is OFF
//set_magic_quotes_runtime(0);
?>

69
lotgd-web/lotgd/lib/events.php Executable file
View File

@ -0,0 +1,69 @@
<?php
// addnews ready
// translator ready
// mail ready
require_once("lib/constants.php");
require_once("lib/http.php");
// This file encapsulates all the special event handling for most locations
// Returns whether or not the description should be skipped
function handle_event($location, $baseLink=false, $needHeader=false)
{
if ($baseLink === false){
global $PHP_SELF;
$baseLink = substr($PHP_SELF,strrpos($PHP_SELF,"/")+1)."?";
}else{
//debug("Base link was specified as $baseLink");
//debug(debug_backtrace());
}
global $session, $playermount, $badguy;
$skipdesc = false;
tlschema("events");
$allowinactive = false;
$eventhandler = httpget('eventhandler');
if (($session['user']['superuser'] & SU_DEVELOPER) && $eventhandler!=""){
$allowinactive = true;
$array = preg_split("/[:-]/", $eventhandler);
if ($array[0] == "module") {
$session['user']['specialinc'] = "module:" . $array[1];
} else {
$session['user']['specialinc'] = "";
}
}
$_POST['i_am_a_hack'] = 'true';
if ($session['user']['specialinc']!=""){
$specialinc = $session['user']['specialinc'];
$session['user']['specialinc'] = "";
if ($needHeader !== false) {
page_header($needHeader);
}
output("`^`c`bSomething Special!`c`b`0");
if (strchr($specialinc, ":")) {
//$array = split(":", $specialinc);
$array = explode(":", $specialinc);
$starttime = getmicrotime();
module_do_event($location, $array[1], $allowinactive,$baseLink);
$endtime = getmicrotime();
if (($endtime - $starttime >= 1.00 && ($session['user']['superuser'] & SU_DEBUG_OUTPUT))){
debug("Slow Event (".round($endtime-$starttime,2)."s): $hookname - {$row['modulename']}`n");
}
}
if (checknavs()) {
// The page rendered some linkage, so we just want to exit.
page_footer();
} else {
$skipdesc=true;
$session['user']['specialinc'] = "";
$session['user']['specialmisc'] = "";
httpset("op", "");
}
}
tlschema();
return $skipdesc;
}
?>

View File

@ -0,0 +1,30 @@
<?php
// translator ready
// addnews ready
// mail ready
// phpDocumentor ready
/**
* Returns the experience needed to advance to the next level.
*
* @param int $curlevel The current level of the player.
* @param int $label The current number of dragonkills.
* @return int The amount of experience needed to advance to the next level.
*/
function exp_for_next_level($curlevel, $curdk)
{
$exparray = array(1=>100,2=>400,3=>1002,4=>1912,5=>3140,6=>4707,
7=>6641,8=>8985, 9=>11795,10=>15143,11=>19121,12=>23840,
13=>29437,14=>36071,15=>43930);
if ($curlevel < 1) return 0;
while(list($key,$val) = each($exparray)) {
$exparray[$key] = round($val + ($curdk/4) * $key * 100, 0);
}
if ($curlevel > 15) $curlevel = 15;
$exprequired = $exparray[$curlevel];
return $exprequired;
}
?>

View File

@ -0,0 +1,72 @@
<?php
// translator ready
// addnews ready
// mail ready
require_once("lib/constants.php");
$lastexpire = strtotime(getsetting("last_char_expire","0000-00-00 00:00:00"));
$needtoexpire = strtotime("-23 hours");
if ($lastexpire < $needtoexpire){
savesetting("last_char_expire",date("Y-m-d H:i:s"));
$old = getsetting("expireoldacct",45);
$new = getsetting("expirenewacct",10);
$trash = getsetting("expiretrashacct",1);
# First, get the account ids to delete the user prefs.
$sql1 = "SELECT login,acctid,dragonkills,level FROM " . db_prefix("accounts") . " WHERE (superuser&".NO_ACCOUNT_EXPIRATION.")=0 AND (1=0\n".($old>0?"OR (laston < \"".date("Y-m-d H:i:s",strtotime("-$old days"))."\")\n":"").($new>0?"OR (laston < \"".date("Y-m-d H:i:s",strtotime("-$new days"))."\" AND level=1 AND dragonkills=0)\n":"").($trash>0?"OR (regdate < date_add(NOW(),interval -".$trash." day) AND laston < regdate)\n":"").")";
$result1 = db_query($sql1);
$acctids = array();
$pinfo = array();
$dk0lvl = 0;
$dk0ct = 0;
$dk1lvl = 0;
$dk1ct = 0;
$dks = 0;
while($row1 = db_fetch_assoc($result1)) {
require_once("lib/charcleanup.php");
if(!char_cleanup($row1['acctid'], CHAR_DELETE_AUTO)) continue;
array_push($acctids,$row1['acctid']);
array_push($pinfo,"{$row1['login']}:dk{$row1['dragonkills']}-lv{$row1['level']}");
if ($row1['dragonkills']==0) {
$dk0lvl += $row1['level'];
$dk0ct++;
}else if($row1['dragonkills']==1){
$dk1lvl += $row1['level'];
$dk1ct++;
}
$dks += $row1['dragonkills'];
}
//Log which accounts were deleted.
$msg = "[{$dk0ct}] with 0 dk avg lvl [".round($dk0lvl/max(1,$dk0ct),2)."]\n";
$msg .= "[{$dk1ct}] with 1 dk avg lvl [".round($dk1lvl/max(1,$dk1ct),2)."]\n";
$msg .= "Avg DK: [".round($dks/max(1,count($acctids)),2)."]\n";
$msg .= "Accounts: ".join($pinfo,", ");
require_once("lib/gamelog.php");
gamelog("Deleted ".count($acctids)." accounts:\n$msg","char expiration");
# Now delete the accounts themselves
// one less search pass, and a guarantee that the same accounts selected
// above are the ones deleted here.
if (count($acctids)) {
$sql = "DELETE FROM " . db_prefix("accounts") .
" WHERE acctid IN (".join($acctids,",").")";
db_query($sql);
}
$old-=5;
$sql = "SELECT acctid,emailaddress FROM " . db_prefix("accounts") . " WHERE 1=0 ".($old>0?"OR (laston < \"".date("Y-m-d H:i:s",strtotime("-$old days"))."\")\n":"")." AND emailaddress!='' AND sentnotice=0 AND (superuser&".NO_ACCOUNT_EXPIRATION.")=0";
$result = db_query($sql);
$subject = translate_inline("LoGD Character Expiration");
$body = sprintf_translate("One or more of your characters in Legend of the Green Dragon at %s is about to expire. If you wish to keep this character, you should log on to him or her soon!",getsetting("serverurl","http://".$_SERVER['SERVER_NAME'].($_SERVER['SERVER_PORT'] == 80?"":":".$_SERVER['SERVER_PORT']).dirname($_SERVER['REQUEST_URI'])));
while ($row = db_fetch_assoc($result)) {
mail($row['emailaddress'],$subject,
$body,
"From: ".getsetting("gameadminemail","postmaster@localhost.com")
);
$sql = "UPDATE " . db_prefix("accounts") . " SET sentnotice=1 WHERE acctid='{$row['acctid']}'";
db_query($sql);
}
}
?>

View File

@ -0,0 +1,561 @@
<?php
// addnews ready
// mail ready
// translation ready
//
/**
* Outputs a list of all enemies and the player.
*
* @param array $enemies The enemies to be displayed.
*/
function show_enemies($enemies) {
global $enemycounter, $session;
foreach ($enemies as $index => $badguy) {
if ((isset($badguy['istarget']) && $badguy['istarget'] == true) && $enemycounter > 1)
$ccode = "`#";
else
$ccode = "`2";
if (isset($badguy['hidehitpoints']) && $badguy['hidehitpoints'] == true) {
$health = "???";
} else {
$health = $badguy['creaturehealth'];
}
if ($session['user']['alive']){
output("%s%s%s%s's Hitpoints%s (Level %s): `6%s`0`n",$ccode,(isset($badguy['istarget'])&&$badguy['istarget']&&$enemycounter>1)?"*":"", $badguy['creaturename'],$ccode,$ccode, $badguy['creaturelevel'],$badguy['creaturehealth']>0?$health:translate_inline("`7DEAD`0"));
}else{
output("`2%s`2's Soulpoints: `6%s`0`n",$badguy['creaturename'],$badguy['creaturehealth']>0?$health:translate_inline("`7DEFEATED`0"));
}
}
if ($session['user']['alive']){
output("`2YOUR Hitpoints: `6%s`0`n",$session['user']['hitpoints']);
}else{
output("`2YOUR Soulpoints: `6%s`0`n",$session['user']['hitpoints']);
}
}
/**
* This function prepares the fight, sets up options and gives hook a hook to change options on a per-player basis.
*
* @param array $options The options given by a module or basics.
* @return array The complete options.
*/
function prepare_fight($options=false) {
global $companions;
$basicoptions = array(
"maxattacks"=>getsetting("maxattacks", 4),
);
if (!is_array($options)) {
$options = array();
}
$fightoptions = $options + $basicoptions;
$fightoptions = modulehook("fightoptions", $fightoptions);
// We'll also reset the companions here...
prepare_companions();
return $fightoptions;
}
/**
* This functions prepares companions to be able to take part in a fight. Uses global copies.
*
*/
function prepare_companions() {
global $companions;
$newcompanions = array();
if (is_array($companions)) {
foreach ($companions as $name => $companion) {
if (!isset($companion['suspended']) || $companion['suspended'] == false) {
$companion['used'] = false;
}
$newcompanions[$name] = $companion;
}
}
$companions = $newcompanions;
}
/**
* Suspends companions on a given parameter.
*
* @param string $susp The type of suspension
* @param mixed $nomsg The message to be displayed upon suspending. If false, no message will be displayed.
*/
function suspend_companions($susp, $nomsg=false) {
global $companions;
$newcompanions = array();
$suspended = false;
if (is_array($companions)) {
foreach ($companions as $name => $companion) {
if ($susp) {
if (isset($companion[$susp]) && $companion[$susp] == true) {
} else {
if (isset($companion['suspended']) && $companion['suspended'] == true){
} else {
$suspended = true;
$companion['suspended'] = true;
}
}
}
$newcompanions[$name] = $companion;
}
}
if ($suspended) {
$schema = false;
if ($nomsg === false) {
$schema = "battle";
$nomsg = "`&Your companions stand back during this fight!`n";
}
if ($nomsg !== true){
if ($schema) tlschema($schema);
output($nomsg);
if ($schema) tlschema();
}
}
$companions = $newcompanions;
}
/**
* Enables suspended companions.
*
* @param string $susp The type of suspension
* @param mixed $nomsg The message to be displayed upon unsuspending. If false, no message will be displayed.
*/
function unsuspend_companions($susp, $nomsg=false) {
global $companions;
$notify = false;
$newcompanions = array();
if (is_array($companions)) {
foreach ($companions as $name => $companion) {
if (isset($companion['suspended']) && $companion['suspended'] == true) {
$notify = true;
$companion['suspended'] = false;
}
$newcompanions[$name] = $companion;
}
}
if ($notify) {
$schema = false;
if ($nomsg === false) {
$schema = "battle";
$nomsg = "`&Your companions return to stand by your side!`n";
}
if ($nomsg !== true){
if ($schema) tlschema($schema);
output($nomsg);
if ($schema) tlschema();
}
}
$companions = $newcompanions;
}
/**
* Automatically chooses the first still living enemy as target for attacks.
*
* @param array $localenemies The stack of enemies to find a valid one from.
* @return array $localenemies The stack with changed targetting.
*/
function autosettarget($localenemies) {
$targetted = 0;
if (is_array($localenemies)) {
foreach ($localenemies as $index=>$badguy) {
$localenemies[$index] += array("dead"=>false, "istarget"=>false); // This line will add these two indices if they haven't been set.
if (count($localenemies) == 1)
$localenemies[$index]['istarget'] = true;
if ($localenemies[$index]['istarget'] == true && $localenemies[$index]['dead'] == false)
$targetted++;
}
}
if (!$targetted && is_array($localenemies)) {
foreach ($localenemies as $index=>$badguy) {
if ($localenemies[$index]['dead'] == false && (!isset($badguy['cannotbetarget']) || $badguy['cannotbetarget'] === false)) {
$localenemies[$index]['istarget'] = true;
$targetted = true;
break;
} else {
continue;
}
}
}
return $localenemies;
}
/**
* Based upon the type of the companion different actions are performed and the companion is marked as "used" after that.
*
* @param array $companion The companion itself
* @param string $activate The stage of activation. Can be one of these: "fight", "defend", "heal" or "magic".
* @return array The changed companion
*/
function report_companion_move($companion, $activate="fight") {
global $badguy,$session,$creatureattack,$creatureatkmod,$adjustment;
global $creaturedefmod,$defmod,$atkmod,$atk,$def,$count,$defended,$needtosstopfighting;
if (isset($companion['suspended']) && $companion['suspended'] == true) {
return $companion;
}
if ($activate == "fight" && isset($companion['abilities']['fight']) && $companion['abilities']['fight'] == true && $companion['used'] == false) {
$roll = rollcompaniondamage($companion);
$damage_done = $roll['creaturedmg'];
$damage_received = $roll['selfdmg'];
if ($damage_done==0){
output("`^%s`4 tries to hit %s but `\$MISSES!`n",$companion['name'],$badguy['creaturename']);
}else if ($damage_done<0){
output("`^%s`4 tries to hit %s but %s `\$RIPOSTES`4 for `^%s`4 points of damage!`n",$companion['name'],$badguy['creaturename'], $badguy['creaturename'], abs($damage_done));
$companion['hitpoints']+=$damage_done;
}else{
output("`^%s`4 hits %s for `^%s`4 points of damage!`n",$companion['name'],$badguy['creaturename'],$damage_done);
$badguy['creaturehealth']-=$damage_done;
}
if ($badguy['creaturehealth'] >= 0) {
if ($damage_received==0){
output("`^%s`4 tries to hit `\$%s`4 but `^MISSES!`n",$badguy['creaturename'], $companion['name']);
}else if ($damage_received<0){
output("`^%s`4 tries to hit `\$%s`4 but %s `^RIPOSTES`4 for `^%s`4 points of damage!`n",$badguy['creaturename'], $companion['name'], $companion['name'], abs($damage_received));
$badguy['creaturehealth']+=$damage_received;
}else{
output("`^%s`4 hits `\$%s`4 for `\$%s`4 points of damage!`n",$badguy['creaturename'],$companion['name'],$damage_received);
$companion['hitpoints']-=$damage_received;
}
}
$companion['used'] = true;
} else if ($activate == "heal" && isset($companion['abilities']['heal']) && $companion['abilities']['heal'] == true && $companion['used'] == false) {
// This one will be tricky! We are looking for the first target which can be healed. This can be the player himself
// or any other companion or our fellow companion himself.
// But if our little friend is the second companion, all other companions will have been copied to the newenemies
// array already ...
if ($session['user']['hitpoints'] < $session['user']['maxhitpoints']) {
$hptoheal = min($companion['abilities']['heal'], $session['user']['maxhitpoints'] - $session['user']['hitpoints']);
$session['user']['hitpoints'] += $hptoheal;
$companion['used'] = true;
$msg = $companion['healmsg'];
if ($msg == "") $msg = "{companion} heals your wounds. You regenerate {damage} hitpoints.";
$msg = substitute_array("`)".$msg."`0`n", array("{companion}","{damage}"),array($companion['name'],$hptoheal));
tlschema(isset($companion['schema'])?$companion['schema']:"battle");
output($msg);
tlschema();
} else {
// Okay. We really have to do this :(
global $newcompanions;
$mynewcompanions = $newcompanions;
if (!is_array($mynewcompanions)) $mynewcompanions = array();
$healed = false;
foreach ($mynewcompanions as $myname => $mycompanion) {
if ($mycompanion['hitpoints'] >= $mycompanion['maxhitpoints'] || $healed || (isset($companion['cannotbehealed']) && $companion['cannotbehealed'] == true)) {
continue;
} else {
$hptoheal = min($companion['abilities']['heal'], $mycompanion['maxhitpoints'] - $mycompanion['hitpoints']);
$mycompanion['hitpoints'] += $hptoheal;
$companion['used'] = true;
$msg = $companion['healcompanionmsg'];
if ($msg == "") $msg = "{companion} heals {target}'s wounds. {target} regenerates {damage} hitpoints.";
$msg = substitute_array("`)".$msg."`0`n", array("{companion}","{damage}","{target}"),array($companion['name'],$hptoheal,$mycompanion['name']));
tlschema(isset($companion['schema'])?$companion['schema']:"battle");
output($msg);
tlschema();
$healed = true;
$newcompanions[$myname] = $mycompanion;
}
}
if (!$healed) {
global $companions,$name;
$mycompanions = $companions;
$foundmyself = false;
foreach ($mycompanions as $myname => $mycompanion) {
if (!$foundmyself || (isset($companion['cannotbehealed']) && $companion['cannotbehealed'] == true)) {
if ($myname == $name) {
$foundmyself = true;
}
continue;
} else {
//There's someone hiding behind us...
foreach ($mycompanions as $myname => $mycompanion) {
if ($mycompanion['hitpoints'] >= $mycompanion['maxhitpoints'] || $healed) {
continue;
} else {
$hptoheal = min($companion['abilities']['heal'], $mycompanion['maxhitpoints'] - $mycompanion['hitpoints']);
$mycompanion['hitpoints'] += $hptoheal;
$companion['used'] = true;
$msg = $companion['healcompanionmsg'];
if ($msg == "") $msg = "{companion} heals {target}'s wounds. {target} regenerates {damage} hitpoints.";
$msg = substitute_array("`)".$msg."`0`n", array("{companion}","{damage}","{target}"),array($companion['name'],$hptoheal,$mycompanion['name']));
tlschema(isset($companion['schema'])?$companion['schema']:"battle");
output($msg);
tlschema();
$healed = true;
$companions[$myname] = $mycompanion;
} // else // These
} // foreach // are
} // else // some
} // foreach // totally
} // if // senseless
} // else // comments.
unset($mynewcompanions);
unset($mycompanions);
$roll = rollcompaniondamage($companion);
$damage_done = $roll['creaturedmg'];
$damage_received = $roll['selfdmg'];
if ($badguy['creaturehealth'] >= 0) {
if ($damage_received==0){
output("`^%s`4 tries to hit `\$%s`4 but `^MISSES!`n",$badguy['creaturename'], $companion['name']);
}else if ($damage_received<0){
output("`^%s`4 tries to hit `\$%s`4 but %s `^RIPOSTES`4 for `^%s`4 points of damage!`n",$badguy['creaturename'], $companion['name'], $companion['name'], abs($damage_received));
$badguy['creaturehealth']+=$damage_received;
}else{
output("`^%s`4 hits `\$%s`4 for `\$%s`4 points of damage!`n",$badguy['creaturename'],$companion['name'],$damage_received);
$companion['hitpoints']-=$damage_received;
}
}
$companion['used'] = true;
} else if ($activate == "defend" && isset($companion['abilities']['defend']) && $companion['abilities']['defend'] == true && $defended == false && $companion['used'] == false) {
$defended = 1;
$roll = rollcompaniondamage($companion);
$damage_done = $roll['creaturedmg'];
$damage_received = $roll['selfdmg'];
if ($damage_done==0){
output("`^%s`4 tries to hit %s but `^MISSES!`n",$companion['name'],$badguy['creaturename']);
}else if ($damage_done<0){
output("`^%s`4 tries to hit %s but %s `^RIPOSTES`4 for `^%s`4 points of damage!`n",$companion['name'],$badguy['creaturename'], $badguy['creaturename'], abs($damage_done));
$companion['hitpoints']+=$damage_done;
}else{
output("`^%s`4 hits %s for `\$%s`4 points of damage!`n",$companion['name'],$badguy['creaturename'],$damage_done);
$badguy['creaturehealth']-=$damage_done;
}
if ($badguy['creaturehealth'] >= 0) {
if ($damage_received==0){
output("`^%s`4 tries to hit `\$%s`4 but `^MISSES!`n",$badguy['creaturename'], $companion['name']);
}else if ($damage_received<0){
output("`^%s`4 tries to hit `\$%s`4 but %s `^RIPOSTES`4 for `^%s`4 points of damage!`n",$badguy['creaturename'], $companion['name'], $companion['name'], abs($damage_received));
$badguy['creaturehealth']+=$damage_received;
}else{
output("`^%s`4 hits `\$%s`4 for `\$%s`4 points of damage!`n",$badguy['creaturename'],$companion['name'],$damage_received);
$companion['hitpoints']-=$damage_received;
}
}
$companion['used'] = true;
} else if ($activate == "magic" && isset($companion['abilities']['magic']) && $companion['abilities']['magic'] == true && $companion['used'] == false) {
$roll = rollcompaniondamage($companion);
$damage_done = abs($roll['creaturedmg']);
if ($damage_done==0){
$msg = $companion['magicfailmsg'];
if ($msg == "") $msg = "{companion} shoots a magical arrow at {badguy} but misses.";
$msg = substitute_array("`)".$msg."`0`n", array("{companion}"), array($companion['name']));
tlschema(isset($companion['schema'])?$companion['schema']:"battle");
output($msg);
tlschema();
}else{
if (isset($companion['magicmsg'])) {
$msg = $companion['magicmsg'];
} else {
$msg = "{companion} shoots a magical arrow at {badguy} and deals {damage} damage.";
}
$msg = substitute_array("`)".$msg."`0`n", array("{companion}","{damage}"), array($companion['name'],$damage_done));
tlschema(isset($companion['schema'])?$companion['schema']:"battle");
output($msg);
tlschema();
$badguy['creaturehealth']-=$damage_done;
}
$companion['hitpoints'] -= $companion['abilities']['magic'];
$companion['used'] = true;
}
if ($badguy['creaturehealth'] <= 0) {
$badguy['dead'] = true;
$badguy['istarget'] = false;
$count = 1;
$needtosstopfighting = true;
}
if ($companion['hitpoints'] <= 0) {
if (isset($companion['dyingtext']) && $companion['dyingtext']>"") {
$msg = $companion['dyingtext'];
} else {
$msg = "`5Your companion catches his last breath before it dies.";
}
tlschema(isset($companion['schema'])?$companion['schema']:"battle");
output("`5".$msg."`0`n");
tlschema();
if (isset($companion['cannotdie']) && $companion['cannotdie'] == true) {
$companion['hitpoints'] = 0;
}else{
return false;
}
}
return $companion;
}
/**
* Based upon the companion's stats damage values are calculated.
*
* @param array $companion
* @return array
*/
function rollcompaniondamage($companion){
global $badguy,$creatureattack,$creatureatkmod,$adjustment,$options;
global $creaturedefmod,$compdefmod,$compatkmod,$buffset,$atk,$def;
if ($badguy['creaturehealth']>0 && $companion['hitpoints']>0){
if ($options['type']=='pvp') {
$adjustedcreaturedefense = $badguy['creaturedefense'];
} else {
$adjustedcreaturedefense =
($creaturedefmod*$badguy['creaturedefense'] /
($adjustment*$adjustment));
}
$creatureattack = $badguy['creatureattack']*$creatureatkmod;
$adjustedselfdefense = ($companion['defense'] * $adjustment * $compdefmod);
/*
debug("Base creature defense: " . $badguy['creaturedefense']);
debug("Creature defense mod: $creaturedefmod");
debug("Adjustment: $adjustment");
debug("Adjusted creature defense: $adjustedcreaturedefense");
debug("Adjusted creature attack: $creatureattack");
debug("Adjusted self defense: $adjustedselfdefense");
*/
while(!isset($creaturedmg) || !isset($selfdmg) || $creaturedmg==0 && $selfdmg==0){
$atk = $companion['attack']*$compatkmod;
if (e_rand(1,20)==1 && $options['type'] != "pvp") $atk*=3;
/*
debug("Attack score: $atk");
*/
$patkroll = bell_rand(0,$atk);
/*
debug("Player Attack roll: $patkroll");
*/
// Set up for crit detection
$atk = $patkroll;
$catkroll = bell_rand(0,$adjustedcreaturedefense);
/*
debug("Creature defense roll: $catkroll");
*/
$creaturedmg = 0-(int)($catkroll - $patkroll);
if ($creaturedmg<0) {
$creaturedmg = (int)($creaturedmg/2);
$creaturedmg = round($buffset['badguydmgmod'] * $creaturedmg, 0);
}
if ($creaturedmg > 0) {
$creaturedmg = round($buffset['compdmgmod']*$creaturedmg,0);
}
$pdefroll = bell_rand(0,$adjustedselfdefense);
$catkroll = bell_rand(0,$creatureattack);
/*
debug("Creature attack roll: $catkroll");
debug("Player defense roll: $pdefroll");
*/
$selfdmg = 0-(int)($pdefroll - $catkroll);
if ($selfdmg<0) {
$selfdmg=(int)($selfdmg/2);
$selfdmg = round($selfdmg*$buffset['compdmgmod'], 0);
}
if ($selfdmg > 0) {
$selfdmg = round($selfdmg*$buffset['badguydmgmod'], 0);
}
}
}else{
$creaturedmg=0;
$selfdmg=0;
}
// Handle god mode's invulnerability
if ($buffset['invulnerable']) {
$creaturedmg = abs($creaturedmg);
$selfdmg = -abs($selfdmg);
}
return array("creaturedmg"=>(isset($creaturedmg)?$creaturedmg:0),"selfdmg"=>(isset($selfdmg)?$selfdmg:0));
}
/**
* Adds a new creature to the badguy array.
*
* @param mixed $creature A standard badguy array. If numeric, the corresponding badguy will be loaded from the database.
*/
function battle_spawn($creature) {
global $enemies, $newenemies, $badguy,$nextindex;
if (!isset($nextindex)) {
$nextindex = count($enemies);
} else {
$nextindex++;
}
if(is_numeric($creature)) {
$sql = "SELECT * FROM " . db_prefix("creatures") . " WHERE creatureid = $creature LIMIT 1";
$result = db_query($sql);
if ($row = db_fetch_assoc($result)) {
$newenemies[$nextindex] = $row;
output("`^%s`2 summons `^%s`2 for help!`n", $badguy['creaturename'], $row['creaturename']);
}
} else if(is_array($creature)){
$newenemies[$nextindex] = $creature;
}
ksort($newenemies);
}
/**
* Allows creatures to heal themselves or another badguy.
*
* @param int $amount Amount of helath to be restored
* @param mixed $target If false badguy will heal itself otherwise the enemy with this index.
*/
function battle_heal($amount, $target=false) {
global $newenemies, $enemies, $badguy;
if ($amount > 0) {
if ($target === false) {
$badguy['creaturehealth']+=$amount;
output("`^%s`2 heals itself for `^%s`2 hitpoints.", $badguy['creaturename'], $amount);
} else {
if (isset($newenemies[$target])) {
// Target had its turn already...
if ($newenemies[$target]['dead'] == false) {
$newenemies[$target]['creaturehealth'] += $amount;
output("`^%s`2 heal `^%s`2 for `^%s`2 hitpoints.", $badguy['creaturename'], $newenemies[$target]['creaturename'], $amount);
}
}else{
if ($enemies[$target]['dead'] == false) {
$enemies[$target]['creaturehealth'] += $amount;
output("`^%s`2 heal `^%s`2 for `^%s`2 hitpoints.", $badguy['creaturename'], $enemies[$target]['creaturename'], $amount);
}
}
}
}
}
/**
* Executes the given script or loads the script and then executes it.
*
* @param mixed $script If numeric the corresponding script will be loaded from the database, otherwise the script to be executed.
*/
function execute_ai_script($script) {
global $unsetme;
if (is_numeric($script)) {
$script = load_ai_script($script);
}
if ($script > "") {
eval($script);
}
}
/**
* Returns an A.I. Script form the database
*
* @param int $spriptid The id for the script
* @return string The script itself. An empty string is returned, if script is found.
*/
function load_ai_script($scriptid) {
if ($scriptid == 0) {
return "";
} else {
$sql = "SELECT script FROM ".db_prefix("ai")." WHERE scriptid = $scriptid";
$result = db_query($sql);
$row = db_fetch_assoc($result);
return $row['script'];
}
}
?>

View File

@ -0,0 +1,64 @@
<?php
// translator ready
// addnews ready
// mail ready
function fightnav($allowspecial=true, $allowflee=true,$script=false){
global $PHP_SELF,$session,$newenemies,$companions;
tlschema("fightnav");
if ($script===false){
$script = substr($PHP_SELF,strrpos($PHP_SELF,"/")+1)."?";
}else{
if (!strpos($script,"?")) {
$script.="?";
// }elseif (substr($script,strlen($script)-1)!="&" && !substr($script,strlen($script)-1)=="?"){
}elseif (substr($script,strlen($script)-1)!="&"){
$script.="&";
}
}
$fight = "Fight";
$run = "Run";
if (!$session['user']['alive']) {
$fight = "F?Torment";
$run = "R?Flee";
}
addnav($fight,$script."op=fight");
if ($allowflee) {
addnav($run,$script."op=run");
}
if ($session['user']['superuser'] & SU_DEVELOPER) {
addnav("Abort", $script);
}
if (getsetting("autofight",0)) {
addnav("Automatic Fighting");
addnav("5?For 5 Rounds", $script."op=fight&auto=five");
addnav("1?For 10 Rounds", $script."op=fight&auto=ten");
$auto = getsetting("autofightfull",0);
if (($auto == 1 || ($auto == 2 && !$allowflee)) && count($newenemies)==1) {
addnav("U?Until End", $script."op=fight&auto=full");
} elseif ($auto == 1 || ($auto == 2 && !$allowflee)) {
addnav("U?Until current enemy dies", $script."op=fight&auto=full");
}
}
if ($allowspecial) {
addnav("Special Abilities");
modulehook("fightnav-specialties", array("script"=>$script));
if ($session['user']['superuser'] & SU_DEVELOPER) {
addnav("`&Super user`0","");
addnav("!?`&&#149; __GOD MODE",$script."op=fight&skill=godmode",true);
}
modulehook("fightnav", array("script"=>$script));
}
if (count($newenemies) > 1) {
addnav("Targets");
foreach ($newenemies as $index=>$badguy){
if ($badguy['creaturehealth'] <= 0 || (isset($badguy['dead']) && $badguy['dead'] == true)) continue;
addnav(array("%s%s`0",(isset($badguy['istarget'])&&$badguy['istarget'])?"`#*`0":"", $badguy['creaturename']), $script."op=fight&newtarget=$index");
}
}
tlschema();
}
?>

View File

@ -0,0 +1,50 @@
<?php
// translator ready
// addnews ready
// mail ready
$baseaccount = array();
function do_forced_nav($anonymous,$overrideforced){
global $baseaccount, $session,$REQUEST_URI;
rawoutput("<!--\nAllowAnonymous: ".($anonymous?"True":"False")."\nOverride Forced Nav: ".($overrideforced?"True":"False")."\n-->");
if (isset($session['loggedin']) && $session['loggedin']){
$sql = "SELECT * FROM ".db_prefix("accounts")." WHERE acctid = '".$session['user']['acctid']."'";
$result = db_query($sql);
if (db_num_rows($result)==1){
$session['user']=db_fetch_assoc($result);
$baseaccount = $session['user'];
$session['bufflist']=unserialize($session['user']['bufflist']);
if (!is_array($session['bufflist'])) $session['bufflist']=array();
$session['user']['dragonpoints']=unserialize($session['user']['dragonpoints']);
$session['user']['prefs']=unserialize($session['user']['prefs']);
if (!is_array($session['user']['dragonpoints'])) $session['user']['dragonpoints']=array();
if (is_array(unserialize($session['user']['allowednavs']))){
$session['allowednavs']=unserialize($session['user']['allowednavs']);
}else{
$session['allowednavs']=array($session['user']['allowednavs']);
}
if (!$session['user']['loggedin'] || ( (date("U") - strtotime($session['user']['laston'])) > getsetting("LOGINTIMEOUT",900)) ){
$session=array();
redirect("index.php?op=timeout","Account not logged in but session thinks they are.");
}
}else{
$session=array();
$session['message']=translate_inline("`4Error, your login was incorrect`0","login");
redirect("index.php","Account Disappeared!");
}
db_free_result($result);
if (isset($session['allowednavs'][$REQUEST_URI]) && $session['allowednavs'][$REQUEST_URI] && $overrideforced!==true){
$session['allowednavs']=array();
}else{
if ($overrideforced!==true){
redirect("badnav.php","Navigation not allowed to $REQUEST_URI");
}
}
}else{
if (!$anonymous){
$session['message']=translate_inline("You are not logged in, this may be because your session timed out.","login");
redirect("index.php?op=timeout","Not logged in: $REQUEST_URI");
}
}
}
?>

56
lotgd-web/lotgd/lib/forest.php Executable file
View File

@ -0,0 +1,56 @@
<?php
// addnews ready
// translator ready
// mail ready
require_once("lib/villagenav.php");
function forest($noshowmessage=false) {
global $session,$playermount;
tlschema("forest");
// mass_module_prepare(array("forest", "validforestloc"));
addnav("Heal");
addnav("H?Healer's Hut","healer.php");
addnav("Fight");
addnav("L?Look for Something to Kill","forest.php?op=search");
if ($session['user']['level']>1)
addnav("S?Go Slumming","forest.php?op=search&type=slum");
addnav("T?Go Thrillseeking","forest.php?op=search&type=thrill");
if (getsetting("suicide", 0)) {
if (getsetting("suicidedk", 10) <= $session['user']['dragonkills']) {
addnav("*?Search `\$Suicidally`0", "forest.php?op=search&type=suicide");
}
}
if ($session['user']['level']>=15 && $session['user']['seendragon']==0){
// Only put the green dragon link if we are a location which
// should have a forest. Don't even ask how we got into a forest()
// call if we shouldn't have one. There is at least one way via
// a superuser link, but it shouldn't happen otherwise.. We just
// want to make sure however.
$isforest = 0;
$vloc = modulehook('validforestloc', array());
foreach($vloc as $i=>$l) {
if ($session['user']['location'] == $i) {
$isforest = 1;
break;
}
}
if ($isforest || count($vloc)==0) {
addnav("G?`@Seek Out the Green Dragon","forest.php?op=dragon");
}
}
addnav("Other");
villagenav();
if ($noshowmessage!=true){
output("`c`7`bThe Forest`b`0`c");
output("The Forest, home to evil creatures and evildoers of all sorts.`n`n");
output("The thick foliage of the forest restricts your view to only a few yards in most places.");
output("The paths would be imperceptible except for your trained eye.");
output("You move as silently as a soft breeze across the thick moss covering the ground, wary to avoid stepping on a twig or any of the numerous pieces of bleached bone that populate the forest floor, lest you betray your presence to one of the vile beasts that wander the forest.`n");
modulehook("forest-desc");
}
modulehook("forest", array());
module_display_events("forest", "forest.php");
tlschema();
}
?>

View File

@ -0,0 +1,207 @@
<?php
// addnews ready
// translator ready
// mail ready
require_once("lib/taunt.php");
require_once("lib/e_rand.php");
require_once("lib/pageparts.php");
require_once("lib/output.php");
function forestvictory($enemies,$denyflawless=false){
global $session, $options;
$diddamage = false;
$creaturelevel = 0;
$gold = 0;
$exp = 0;
$expbonus = 0;
$count = 0;
$totalbackup = 0;
foreach ($enemies as $index=>$badguy) {
if (getsetting("dropmingold",0)){
$badguy['creaturegold']= e_rand(round($badguy['creaturegold']/4), round(3*$badguy['creaturegold']/4));
}else{
$badguy['creaturegold']=e_rand(0,$badguy['creaturegold']);
}
$gold += $badguy['creaturegold'];
tlschema("battle");
if(isset($badguy['creaturelose'])) $msg = translate_inline($badguy['creaturelose']);
tlschema();
if(isset($msg)) output_notl("`b`&%s`0`b`n",$msg);
output("`b`\$You have slain %s!`0`b`n",$badguy['creaturename']);
$count++;
// If any creature did damage, we have no flawless fight. Easy as that.
if ($badguy['diddamage'] == 1) {
$diddamage = true;
}
$creaturelevel = max($creaturelevel, $badguy['creaturelevel']);
if (!$denyflawless && isset($badguy['denyflawless']) && $badguy['denyflawless']>"") {
$denyflawless = $badguy['denyflawless'];
}
$expbonus += round(($badguy['creatureexp'] * (1 + .25 * ($badguy['creaturelevel']-$session['user']['level']))) - $badguy['creatureexp'],0);
}
$multibonus = $count>1?1:0;
$expbonus += $session['user']['dragonkills'] * $session['user']['level'] * $multibonus;
$totalexp = 0;
foreach ($options['experience'] as $index=>$experience) {
$totalexp += $experience;
}
// We now have the total experience which should have been gained during the fight.
// Now we will calculate the average exp per enemy.
$exp = round($totalexp / $count);
$gold = e_rand(round($gold/$count),round($gold/$count)*round(($count+1)*pow(1.2, $count-1),0));
$expbonus = round ($expbonus/$count,0);
if ($gold) {
output("`#You receive `^%s`# gold!`n",$gold);
debuglog("received gold for slaying a monster.",false,false,"forestwin",$badguy['creaturegold']);
}
// No gem hunters allowed!
$args = modulehook("alter-gemchance", array("chance"=>getsetting("forestgemchance", 25)));
$gemchances = $args['chance'];
if ($session['user']['level'] < 15 && e_rand(1,$gemchances) == 1) {
output("`&You find A GEM!`n`#");
$session['user']['gems']++;
debuglog("found gem when slaying a monster.",false,false,"forestwingem",1);
}
if (getsetting("instantexp",false) == true) {
$expgained = 0;
foreach ($options['experiencegained'] as $index=>$experience) {
$expgained += $experience;
}
$diff = $expgained - $exp;
$expbonus += $diff;
if (floor($exp + $expbonus) < 0) {
$expbonus = -$exp+1;
}
if ($expbonus>0){
$expbonus = round($expbonus * pow(1+(getsetting("addexp", 5)/100), $count-1),0);
output("`#***Because of the difficult nature of this fight, you are awarded an additional `^%s`# experience! `n",$expbonus);
} elseif ($expbonus<0){
output("`#***Because of the simplistic nature of this fight, you are penalized `^%s`# experience! `n",abs($expbonus));
}
if (count($enemies) > 1) {
output("During this fight you received `^%s`# total experience!`n`0",$exp+$expbonus);
}
$session['user']['experience']+=$expbonus;
} else {
if (floor($exp + $expbonus) < 0) {
$expbonus = -$exp+1;
}
if ($expbonus>0){
$expbonus = round($expbonus * pow(1+(getsetting("addexp", 5)/100), $count-1),0);
output("`#***Because of the difficult nature of this fight, you are awarded an additional `^%s`# experience! `n(%s + %s = %s) ",$expbonus,$exp,abs($expbonus),$exp+$expbonus);
} elseif ($expbonus<0){
output("`#***Because of the simplistic nature of this fight, you are penalized `^%s`# experience! `n(%s - %s = %s) ",abs($expbonus),$exp,abs($expbonus),$exp+$expbonus);
}
output("You receive `^%s`# total experience!`n`0",$exp+$expbonus);
$session['user']['experience']+=($exp+$expbonus);
}
$session['user']['gold']+=$gold;
// Increase the level for each enemy by one half, so flawless fights can be achieved for
// fighting multiple low-level critters
if (!$creaturelevel)
$creaturelevel = $badguy['creaturelevel'];
else
$creaturelevel+=(0.5*($count-1));
if (!$diddamage) {
output("`c`b`&~~ Flawless Fight! ~~`0`b`c");
if ($denyflawless){
output("`c`\$%s`0`c", translate_inline($denyflawless));
}elseif ($session['user']['level']<=$creaturelevel){
output("`c`b`\$You receive an extra turn!`0`b`c`n");
$session['user']['turns']++;
}else{
output("`c`\$A more difficult fight would have yielded an extra turn.`0`c`n");
}
}
if ($session['user']['hitpoints'] <= 0) {
output("With your dying breath you spy a small stand of mushrooms off to the side.");
output("You recognize them as some of the ones that the healer had drying in the hut and taking a chance, cram a handful into your mouth.");
output("Even raw they have some restorative properties.`n");
$session['user']['hitpoints'] = 1;
}
}
function forestdefeat($enemies,$where="in the forest"){
global $session;
$percent=getsetting('forestexploss',10);
addnav("Daily news","news.php");
$names = array();
$killer = false;
foreach ($enemies as $index=>$badguy) {
$names[] = $badguy['creaturename'];
if (isset($badguy['killedplayer']) && $badguy['killedplayer'] == true) $killer = $badguy;
if (isset($badguy['creaturewin']) && $badguy['creaturewin'] > "") {
$msg = translate_inline($badguy['creaturewin'],"battle");
output_notl("`b`&%s`0`b`n",$msg);
}
}
if($killer) $badguy = $killer;
elseif(!isset($badguy['creaturename'])) $badguy = $enemies[0];
if (count($names) > 1) $lastname = array_pop($names);
$enemystring = join(", ", $names);
$and = translate_inline("and");
if (isset($lastname) && $lastname > "") $enemystring = "$enemystring $and $lastname";
$taunt = select_taunt_array();
if (is_array($where)) {
$where=sprintf_translate($where);
} else {
$where=translate_inline($where);
}
addnews("`%%s`5 has been slain %s by %s.`n%s",$session['user']['name'],$where,$badguy['creaturename'],$taunt);
$session['user']['alive']=false;
debuglog("lost gold when they were slain $where",false,false,"forestlose",-$session['user']['gold']);
$session['user']['gold']=0;
$session['user']['hitpoints']=0;
$session['user']['experience']=round($session['user']['experience']*(1-($percent/100)),0);
output("`4All gold on hand has been lost!`n");
output("`4%s %% of experience has been lost!`b`n",$percent);
output("You may begin fighting again tomorrow.");
page_footer();
}
function buffbadguy($badguy){
global $session;
static $dk = false; // This will save us a lot of trouble when going through
// this function more than once...
if ($dk === false) {
//make badguys get harder as you advance in dragon kills.
$dk = 0;
while(list($key, $val)=each($session['user']['dragonpoints'])) {
if ($val=="at" || $val=="de") $dk++;
}
$dk += (int)(($session['user']['maxhitpoints']-($session['user']['level']*10))/5);
// How many of the dk points should actually be used.
// We want to add .05 for every 100 dragonkills.
$add = ($session['user']['dragonkills']/100)*.05;
$dk = round($dk * (.25 + $add));
}
$expflux = round($badguy['creatureexp']/10,0);
$expflux = e_rand(-$expflux,$expflux);
$badguy['creatureexp']+=$expflux;
$atkflux = e_rand(0, $dk);
$defflux = e_rand(0, ($dk-$atkflux));
$hpflux = ($dk - ($atkflux+$defflux)) * 5;
$badguy['creatureattack']+=$atkflux;
$badguy['creaturedefense']+=$defflux;
$badguy['creaturehealth']+=$hpflux;
if (getsetting("disablebonuses", 1)) {
$bonus = 1 + .03*($atkflux+$defflux) + .001*$hpflux;
$badguy['creaturegold'] = round($badguy['creaturegold']*$bonus, 0);
$badguy['creatureexp'] = round($badguy['creatureexp']*$bonus, 0);
}
$badguy = modulehook("creatureencounter",$badguy);
debug("DEBUG: $dk modification points total.");
debug("DEBUG: +$atkflux allocated to attack.");
debug("DEBUG: +$defflux allocated to defense.");
debug("DEBUG: +".($hpflux/5)."*5 to hitpoints.");
return modulehook("buffbadguy",$badguy);
}
?>

217
lotgd-web/lotgd/lib/forms.php Executable file
View File

@ -0,0 +1,217 @@
<?php
function previewfield($name, $startdiv=false, $talkline="says", $showcharsleft=true, $info=false, $default=false) {
global $schema,$session;
$talkline = translate_inline($talkline, $schema);
$youhave = translate_inline("You have ");
$charsleft = translate_inline(" characters left.");
if ($startdiv === false)
$startdiv = "";
rawoutput("<script language='JavaScript'>
function previewtext$name(t,l){
var out = \"<span class=\\'colLtWhite\\'>".addslashes(appoencode($startdiv))." \";
var end = '</span>';
var x=0;
var y='';
var z='';
var max=document.getElementById('input$name');
var charsleft='';");
if ($talkline !== false) {
rawoutput(" if (t.substr(0,2)=='::'){
x=2;
out += '</span><span class=\\'colLtWhite\\'>';
}else if (t.substr(0,1)==':'){
x=1;
out += '</span><span class=\\'colLtWhite\\'>';
}else if (t.substr(0,3)=='/me'){
x=3;
out += '</span><span class=\\'colLtWhite\\'>';");
if ($session['user']['superuser']&SU_IS_GAMEMASTER) {
rawoutput("
}else if (t.substr(0,5)=='/game'){
x=5;
out = '<span class=\\'colLtWhite\\'>';");
}
rawoutput(" }else{
out += '</span><span class=\\'colDkCyan\\'>".addslashes(appoencode($talkline)).", \"</span><span class=\\'colLtCyan\\'>';
end += '</span><span class=\\'colDkCyan\\'>\"';
}");
}
if ($showcharsleft == true) {
/* if (translate_inline($talkline,$schema)!="says")
$tll = strlen(translate_inline($talkline,$schema))+11;
else $tll=0; // Don't know why needed
rawoutput(" if (x!=0) {
if (max.maxlength!=200-$tll) max.maxlength=200-$tll;
l=200-$tll; */ // Don't know why needed
rawoutput(" if (x!=0) {
if (max.maxLength!=200) max.maxLength=200;
l=200;
} else {
max.maxLength=l;
}
if (l-t.length<0) charsleft +='<span class=\\'colLtRed\\'>';
charsleft += '".$youhave."'+(l-t.length)+'".$charsleft."<br>';
if (l-t.length<0) charsleft +='</span>';
document.getElementById('charsleft$name').innerHTML=charsleft+'<br/>';");
}
rawoutput(" for (; x < t.length; x++){
y = t.substr(x,1);
if (y=='<'){
out += '&lt;';
continue;
}else if(y=='>'){
out += '&gt;';
continue;
}else if(y=='\\n'){
out += '<br />';
continue;
}else if (y=='`'){
if (x < t.length-1){
z = t.substr(x+1,1);
if (z=='0'){
out += '</span>';
}else if (z=='1'){
out += '</span><span class=\\'colDkBlue\\'>';
}else if (z=='2'){
out += '</span><span class=\\'colDkGreen\\'>';
}else if (z=='3'){
out += '</span><span class=\\'colDkCyan\\'>';
}else if (z=='4'){
out += '</span><span class=\\'colDkRed\\'>';
}else if (z=='5'){
out += '</span><span class=\\'colDkMagenta\\'>';
}else if (z=='6'){
out += '</span><span class=\\'colDkYellow\\'>';
}else if (z=='7'){
out += '</span><span class=\\'colDkWhite\\'>';
}else if (z=='q'){
out += '</span><span class=\\'colDkOrange\\'>';
}else if (z=='!'){
out += '</span><span class=\\'colLtBlue\\'>';
}else if (z=='@'){
out += '</span><span class=\\'colLtGreen\\'>';
}else if (z=='#'){
out += '</span><span class=\\'colLtCyan\\'>';
}else if (z=='$'){
out += '</span><span class=\\'colLtRed\\'>';
}else if (z=='%'){
out += '</span><span class=\\'colLtMagenta\\'>';
}else if (z=='^'){
out += '</span><span class=\\'colLtYellow\\'>';
}else if (z=='&'){
out += '</span><span class=\\'colLtWhite\\'>';
}else if (z=='Q'){
out += '</span><span class=\\'colLtOrange\\'>';
}else if (z==')'){
out += '</span><span class=\\'colLtBlack\\'>';
}else if (z=='r'){
out += '</span><span class=\\'colRose\\'>';
}else if (z=='R'){
out += '</span><span class=\\'colRose\\'>';
}else if (z=='v'){
out += '</span><span class=\\'coliceviolet\\'>';
}else if (z=='V'){
out += '</span><span class=\\'colBlueViolet\\'>';
}else if (z=='g'){
out += '</span><span class=\\'colXLtGreen\\'>';
}else if (z=='G'){
out += '</span><span class=\\'colXLtGreen\\'>';
}else if (z=='T'){
out += '</span><span class=\\'colDkBrown\\'>';
}else if (z=='t'){
out += '</span><span class=\\'colLtBrown\\'>';
}else if (z=='~'){
out += '</span><span class=\\'colBlack\\'>';
}else if (z=='j'){
out += '</span><span class=\\'colMdGrey\\'>';
}else if (z=='J'){
out += '</span><span class=\\'colMdBlue\\'>';
}else if (z=='e'){
out += '</span><span class=\\'colDkRust\\'>';
}else if (z=='E'){
out += '</span><span class=\\'colLtRust\\'>';
}else if (z=='l'){
out += '</span><span class=\\'colDkLinkBlue\\'>';
}else if (z=='L'){
out += '</span><span class=\\'colLtLinkBlue\\'>';
}else if (z=='x'){
out += '</span><span class=\\'colburlywood\\'>';
}else if (z=='X'){
out += '</span><span class=\\'colbeige\\'>';
}else if (z=='y'){
out += '</span><span class=\\'colkhaki\\'>';
}else if (z=='Y'){
out += '</span><span class=\\'coldarkkhaki\\'>';
}else if (z=='k'){
out += '</span><span class=\\'colaquamarine\\'>';
}else if (z=='K'){
out += '</span><span class=\\'coldarkseagreen\\'>';
}else if (z=='p'){
out += '</span><span class=\\'collightsalmon\\'>';
}else if (z=='P'){
out += '</span><span class=\\'colsalmon\\'>';
}else if (z=='m'){
out += '</span><span class=\\'colwheat\\'>';
}else if (z=='M'){
out += '</span><span class=\\'coltan\\'>';
}
x++;
}
}else{
out += y;
}
}
document.getElementById(\"previewtext$name\").innerHTML=out+end+'<br/>';
}
</script>
");
if ($charsleft == true) {
rawoutput("<span id='charsleft$name'></span>");
}
if (!is_array($info)) {
if ($default) {
rawoutput("<input name='$name' id='input$name' maxlength='255' onKeyUp='previewtext$name(document.getElementById(\"input$name\").value,200);' value='$default'>");
} else {
rawoutput("<input name='$name' id='input$name' maxlength='255' onKeyUp='previewtext$name(document.getElementById(\"input$name\").value,200);'>");
}
} else {
if (isset($info['maxlength'])) {
$l = $info['maxlength'];
} else {
$l=200;
}
if (isset($info['type']) && $info['type'] == 'textarea') {
rawoutput("<textarea name='$name' id='input$name' onKeyUp='previewtext$name(document.getElementById(\"input$name\").value,$l);' ");
} else {
rawoutput("<input name='$name' id='input$name' onKeyUp='previewtext$name(document.getElementById(\"input$name\").value,$l);' ");
}
foreach ($info as $key=>$val){
rawoutput("$key='$val'");
}
if (isset($info['type']) && $info['type'] == 'textarea') {
rawoutput(">");
if ($default) {
rawoutput($default);
}
rawoutput("</textarea>");
} else {
if ($default) {
rawoutput(" value='$default'>");
} else {
rawoutput(">");
}
}
}
rawoutput("<div id='previewtext$name'></div>");
rawoutput("
<script language='JavaScript'>
input$name.addEvent('keyup', function(){
window.localStorage['value'] = input$name.value;
window.localStorage['timestamp'] = (new Date()). getTime();
}, false);
input$name.value = window.localStorage['value'];
</script>
");
}
?>

13
lotgd-web/lotgd/lib/gamelog.php Executable file
View File

@ -0,0 +1,13 @@
<?php
function gamelog($message,$category="general",$filed=false){
global $session;
$sql = "INSERT INTO ".db_prefix("gamelog")." (message,category,filed,date,who) VALUES (
'".addslashes($message)."',
'".addslashes($category)."',
'".($filed?"1":"0")."',
'".date("Y-m-d H:i:s")."',
'".(int)$session['user']['acctid']."'
)";
db_query($sql);
}
?>

View File

@ -0,0 +1,42 @@
<?php
if ($session['user']['gravefights']<=0){
output("`\$`bYour soul can bear no more torment in this afterlife.`b`0");
$op="";
httpset('op', "");
}else{
require_once("lib/extended-battle.php");
suspend_companions("allowinshades", true);
if (module_events("graveyard", getsetting("gravechance", 0)) != 0) {
if (!checknavs()) {
// If we're going back to the graveyard, make sure to reset
// the special and the specialmisc
$session['user']['specialinc'] = "";
$session['user']['specialmisc'] = "";
$skipgraveyardtext=true;
$op = "";
httpset("op", "");
} else {
page_footer();
}
} else {
$session['user']['gravefights']--;
$battle=true;
$sql = "SELECT * FROM " . db_prefix("creatures") . " WHERE graveyard=1 ORDER BY rand(".e_rand().") LIMIT 1";
$result = db_query($sql);
$badguy = db_fetch_assoc($result);
$level = $session['user']['level'];
$shift = 0;
if ($level < 5) $shift = -1;
$badguy['creatureattack'] = 9 + $shift + (int)(($level-1) * 1.5);
// Make graveyard creatures easier.
$badguy['creaturedefense'] = (int)((9 + $shift + (($level-1) * 1.5)));
$badguy['creaturedefense'] *= .7;
$badguy['creaturehealth'] = $level * 5 + 50;
$badguy['creatureexp'] = e_rand(10 + round($level/3),20 + round($level/3));
$badguy['creaturelevel'] = $level;
$attackstack['enemies'][0] = $badguy;
$attackstack['options']['type'] = 'graveyard';
$session['user']['badguy']=createstring($attackstack);
}
}
?>

View File

@ -0,0 +1,21 @@
<?php
if (!$skipgraveyardtext) {
output("`)`c`bThe Graveyard`b`c");
output("Your spirit wanders into a lonely graveyard, overgrown with sickly weeds which seem to grab at your spirit as you float past them.");
output("Around you are the remains of many broken tombstones, some lying on their faces, some shattered to pieces.");
output("You can almost hear the wails of the souls trapped within each plot lamenting their fates.`n`n");
output("In the center of the graveyard is an ancient looking mausoleum which has been worn by the effects of untold years.");
output("A sinister looking gargoyle adorns the apex of its roof; its eyes seem to follow you, and its mouth gapes with sharp stone teeth.");
output("The plaque above the door reads `\$%s`), Overlord of Death`).",$deathoverlord);
modulehook("graveyard-desc");
}
modulehook("graveyard");
if ($session['user']['gravefights']) {
addnav("Look for Something to Torment","graveyard.php?op=search");
}
addnav("Places");
addnav("W?List Warriors","list.php");
addnav("S?Return to the Shades","shades.php");
addnav("M?Enter the Mausoleum","graveyard.php?op=enter");
module_display_events("graveyard", "graveyard.php");
?>

View File

@ -0,0 +1,16 @@
<?php
$max = $session['user']['level'] * 5 + 50;
$favortoheal = round(10 * ($max-$session['user']['soulpoints'])/$max);
output("`)`b`cThe Mausoleum`c`b");
output("You enter the mausoleum and find yourself in a cold, stark marble chamber.");
output("The air around you carries the chill of death itself.");
output("From the darkness, two black eyes stare into your soul.");
output("A clammy grasp seems to clutch your mind, and fill it with the words of the Overlord of Death, `\$%s`) himself.`n`n",$deathoverlord);
output("\"`7Your mortal coil has forsaken you. Now you turn to me. There are those within this land that have eluded my grasp and possess a life beyond life. To prove your worth to me and earn my favor, go out and torment their souls. Should you gain enough of my favor, I will reward you.`)\"");
addnav(array("Question `\$%s`0 about the worth of your soul",$deathoverlord),"graveyard.php?op=question");
addnav(array("Restore Your Soul (%s favor)", $favortoheal),"graveyard.php?op=restore");
addnav("Places");
addnav("S?Land of the Shades","shades.php");
addnav("G?Return to the Graveyard","graveyard.php");
modulehook("mausoleum");
?>

View File

@ -0,0 +1,15 @@
<?php
output("`\$%s`) is impressed with your actions, and grants you the power to haunt a foe.`n`n",$deathoverlord);
$search = translate_inline("Search");
rawoutput("<form action='graveyard.php?op=haunt2' method='POST'>");
addnav("","graveyard.php?op=haunt2");
output("Who would you like to haunt? ");
rawoutput("<input name='name' id='name'>");
rawoutput("<input type='submit' class='button' value='$search'>");
rawoutput("</form>");
rawoutput("<script language='JavaScript'>document.getElementById('name').focus()</script>");
addnav("Places");
addnav("S?Land of the Shades","shades.php");
addnav("G?The Graveyard","graveyard.php");
addnav("M?Return to the Mausoleum","graveyard.php?op=enter");
?>

View File

@ -0,0 +1,46 @@
<?php
$string="%";
$name = httppost('name');
for ($x=0;$x<strlen($name);$x++){
$string .= substr($name,$x,1)."%";
}
$sql = "SELECT login,name,level FROM " . db_prefix("accounts") . " WHERE name LIKE '".addslashes($string)."' AND locked=0 ORDER BY level,login";
$result = db_query($sql);
if (db_num_rows($result)<=0){
output("`\$%s`) could find no one who matched the name you gave him.",$deathoverlord);
}elseif(db_num_rows($result)>100){
output("`\$%s`) thinks you should narrow down the number of people you wish to haunt.",$deathoverlord);
$search = translate_inline("Search");
rawoutput("<form action='graveyard.php?op=haunt2' method='POST'>");
addnav("","graveyard.php?op=haunt2");
output("Who would you like to haunt? ");
rawoutput("<input name='name' id='name'>");
rawoutput("<input type='submit' class='button' value='$search'>");
rawoutput("</form>");
rawoutput("<script language='JavaScript'>document.getElementById('name').focus()</script>",true);
}else{
output("`\$%s`) will allow you to try to haunt these people:`n",$deathoverlord);
$name = translate_inline("Name");
$lev = translate_inline("Level");
rawoutput("<table cellpadding='3' cellspacing='0' border='0'>");
rawoutput("<tr class='trhead'><td>$name</td><td>$lev</td></tr>");
for ($i=0;$i<db_num_rows($result);$i++){
$row = db_fetch_assoc($result);
rawoutput("<tr class='".($i%2?"trlight":"trdark")."'><td><a href='graveyard.php?op=haunt3&name=".HTMLEntities($row['login'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."'>");
output_notl("%s", $row['name']);
rawoutput("</a></td><td>");
output_notl("%s", $row['level']);
rawoutput("</td></tr>",true);
addnav("","graveyard.php?op=haunt3&name=".HTMLEntities($row['login'], ENT_COMPAT, getsetting("charset", "ISO-8859-1")));
}
rawoutput("</table>",true);
}
addnav(array("Question `\$%s`0 about the worth of your soul",$deathoverlord),"graveyard.php?op=question");
$max = $session['user']['level'] * 5 + 50;
$favortoheal = round(10 * ($max-$session['user']['soulpoints'])/$max);
addnav(array("Restore Your Soul (%s favor)",$favortoheal),"graveyard.php?op=restore");
addnav("Places");
addnav("S?Land of the Shades","shades.php");
addnav("G?The Graveyard","graveyard.php");
addnav("M?Return to the Mausoleum","graveyard.php?op=enter");
?>

View File

@ -0,0 +1,59 @@
<?php
output("`)`c`bThe Mausoleum`b`c");
$name = httpget('name');
$sql = "SELECT name,level,hauntedby,acctid FROM " . db_prefix("accounts") . " WHERE login='$name'";
$result = db_query($sql);
if (db_num_rows($result)>0){
$row = db_fetch_assoc($result);
if ($row['hauntedby']!=""){
output("That person has already been haunted, please select another target");
}else{
$session['user']['deathpower']-=25;
$roll1 = e_rand(0,$row['level']);
$roll2 = e_rand(0,$session['user']['level']);
if ($roll2>$roll1){
output("You have successfully haunted `7%s`)!", $row['name']);
$sql = "UPDATE " . db_prefix("accounts") . " SET hauntedby='".addslashes($session['user']['name'])."' WHERE login='$name'";
db_query($sql);
addnews("`7%s`) haunted `7%s`)!",$session['user']['name'],$row['name']);
$subj = array("`)You have been haunted");
$body = array("`)You have been haunted by `&%s`).",$session['user']['name']);
require("lib/systemmail.php");
systemmail($row['acctid'], $subj, $body);
}else{
addnews("`7%s`) unsuccessfully haunted `7%s`)!",$session['user']['name'],$row['name']);
switch (e_rand(0,5)){
case 0:
$msg = "Just as you were about to haunt `7%s`) good, they sneezed, and missed it completely.";
break;
case 1:
$msg = "You haunt `7%s`) real good like, but unfortunately they're sleeping and are completely unaware of your presence.";
break;
case 2:
$msg = "You're about to haunt `7%s`), but trip over your ghostly tail and land flat on your, um... face.";
break;
case 3:
$msg = "You go to haunt `7%s`) in their sleep, but they look up at you, and roll over mumbling something about eating sausage just before going to bed.";
break;
case 4:
$msg = "You wake `7%s`) up, who looks at you for a moment before declaring, \"Neat!\" and trying to catch you.";
break;
case 5:
$msg = "You go to scare `7%s`), but catch a glimpse of yourself in the mirror and panic at the sight of a ghost!";
break;
}
output($msg, $row['name']);
}
}
}else{
output("`\$%s`) has lost their concentration on this person, you cannot haunt them now.",$deathoverlord);
}
addnav(array("Question `\$%s`0 about the worth of your soul",$deathoverlord),"graveyard.php?op=question");
$max = $session['user']['level'] * 5 + 50;
$favortoheal = round(10 * ($max-$session['user']['soulpoints'])/$max);
addnav(array("Restore Your Soul (%s favor)", $favortoheal),"graveyard.php?op=restore");
addnav("Places");
addnav("S?Land of the Shades","shades.php");
addnav("G?The Graveyard","graveyard.php");
addnav("M?Return to the Mausoleum","graveyard.php?op=enter");
?>

View File

@ -0,0 +1,24 @@
<?php
$max = $session['user']['level'] * 5 + 50;
$favortoheal = round(10 * ($max-$session['user']['soulpoints'])/$max);
if ($session['user']['deathpower']>=100) {
output("`\$%s`) speaks, \"`7You have impressed me indeed. I shall grant you the ability to visit your foes in the mortal world.`)\"",$deathoverlord);
addnav(array("%s Favors",sanitize($deathoverlord)));
addnav("H?Haunt a foe (25 favor)","graveyard.php?op=haunt");
addnav("e?Resurrection (100 favor)","graveyard.php?op=resurrection");
addnav("Other");
}elseif ($session['user']['deathpower'] >= 25){
output("`\$%s`) speaks, \"`7I am moderately impressed with your efforts. A minor favor I now grant to you, but continue my work, and I may yet have more power to bestow.`)\"",$deathoverlord);
addnav(array("%s Favors",sanitize($deathoverlord)));
addnav("H?Haunt a foe (25 favor)","graveyard.php?op=haunt");
addnav("Other");
}else{
output("`\$%s`) speaks, \"`7I am not yet impressed with your efforts. Continue my work, and we may speak further.`)\"",$deathoverlord);
}
output("`n`nYou have `6%s`) favor with `\$%s`).", $session['user']['deathpower'],$deathoverlord);
addnav(array("Restore Your Soul (%s favor)",$favortoheal),"graveyard.php?op=restore");
addnav("Places");
addnav("S?Land of the Shades","shades.php");
addnav("G?Return to the Graveyard","graveyard.php");
modulehook("ramiusfavors");
?>

View File

@ -0,0 +1,21 @@
<?php
output("`)`b`cThe Mausoleum`c`b");
$max = $session['user']['level'] * 5 + 50;
$favortoheal = round(10 * ($max-$session['user']['soulpoints'])/$max);
if ($session['user']['soulpoints']<$max){
if ($session['user']['deathpower']>=$favortoheal){
output("`\$%s`) calls you weak for needing restoration, but as you have enough favor with him, he grants your request at the cost of `4%s`) favor.",$deathoverlord, $favortoheal);
$session['user']['deathpower']-=$favortoheal;
$session['user']['soulpoints']=$max;
}else{
output("`\$%s`) curses you and throws you from the Mausoleum, you must gain more favor with him before he will grant restoration.",$deathoverlord);
}
}else{
output("`\$%s`) sighs and mumbles something about, \"`7just 'cause they're dead, does that mean they don't have to think?`)\"`n`n",$deathoverlord);
output("Perhaps you'd like to actually `ineed`i restoration before you ask for it.");
}
addnav(array("Question `\$%s`0 about the worth of your soul",$deathoverlord),"graveyard.php?op=question");
addnav("Places");
addnav("S?Land of the Shades","shades.php");
addnav("G?Return to the Graveyard","graveyard.php");
?>

View File

@ -0,0 +1,19 @@
<?php
output("`\$%s`0 waves his skeletal arms as he begins to command the very fabric of life.`n`n",$deathoverlord);
// Note to translators. The text spoken by Ramius here is backwards
// English. You might choose to maintain it in tact, or you might choose
// to translate it to your language, and reverse the letters that way. A
// few words have been replaced with latin counterparts to make it a
// little harder to identify that they are just backwards english.
// tu shall have resurrection
// rise from the dead o servant
// power over death is mine
// your life ego grant tu again
// for ego know tu shall return to me again
output("\"`)Noitcerruser evah llahs ut...`\$\" The air begins to crackle around you.`n`n");
output("\"`)Tnavres o htaed eht morf esir.`\$\" Your soul begins to burn with the pain of a thousand frosty fires.`n`n");
output("\"`)Enim si htaed revo rewop.`\$\" Gradually you begin to become aware that the fires are dimming and are replaced by the blinding pain last known by your body before it fell.`n`n");
output("\"`)Niaga ut tnarg oge efil ruoy.`\$\" You begin to look around you, and you watch as your muscles knit themselves back together.`n`n");
output("\"`)Niaga em ot nruter llahs ut wonk oge rof.`\$\" With a gasp, you laboriously again draw your first breath.");
addnav("Continue","newday.php?resurrection=true");
?>

View File

@ -0,0 +1,22 @@
<?php
// addnews ready
// translator ready
// mail ready
require_once("lib/modules.php");
function holidayize($text,$type='unknown'){
global $session;
if (!isset($session['user']['prefs']['ihavenocheer']))
$session['user']['prefs']['ihavenocheer'] = 0;
if ($session['user']['prefs']['ihavenocheer']) {
return $text;
}
$args = array('text'=>$text,'type'=>$type);
$args = modulehook("holiday", $args);
$text = $args['text'];
return $text;
}
?>

83
lotgd-web/lotgd/lib/http.php Executable file
View File

@ -0,0 +1,83 @@
<?php
// translator ready
// addnews ready
// mail ready
function httpget($var){
global $HTTP_GET_VARS;
$res = isset($_GET[$var]) ? $_GET[$var] : false;
if ($res === false) {
$res = isset($HTTP_GET_VARS[$var]) ? $HTTP_GET_VARS[$var] : false;
}
return $res;
}
function httpallget() {
return $_GET;
}
function httpset($var, $val,$force=false){
global $HTTP_GET_VARS;
if (isset($_GET[$var]) || $force) $_GET[$var] = $val;
if (isset($HTTP_GET_VARS[$var])) $HTTP_GET_VARS[$var] = $val;
}
function httppost($var){
global $HTTP_POST_VARS;
$res = isset($_POST[$var]) ? $_POST[$var] : false;
if ($res === false) {
$res = isset($HTTP_POST_VARS[$var]) ?
$HTTP_POST_VARS[$var] : false;
}
return $res;
}
function httppostisset($var) {
global $HTTP_POST_VARS;
$res = isset($_POST[$var]) ? 1 : 0;
if ($res === 0) {
$res = isset($HTTP_POST_VARS[$var]) ? 1 : 0;
}
return $res;
}
function httppostset($var, $val, $sub=false){
global $HTTP_POST_VARS;
if ($sub === false) {
if (isset($_POST[$var])) $_POST[$var] = $val;
if (isset($HTTP_POST_VARS[$var])) $HTTP_POST_VARS[$var] = $val;
} else {
if (isset($_POST[$var]) && isset($_POST[$var][$sub]))
$_POST[$var][$sub]=$val;
if (isset($HTTP_POST_VARS[$var]) && isset($HTTP_POST_VARS[$var][$sub]))
$HTTP_POST_VARS[$var][$sub]=$val;
}
}
function httpallpost(){
return $_POST;
}
function postparse($verify=false, $subval=false){
if ($subval) $var = $_POST[$subval];
else $var = $_POST;
reset($var);
$sql = "";
$keys = "";
$vals = "";
$i = 0;
while(list($key, $val) = each($var)) {
if ($verify === false || isset($verify[$key])) {
if (is_array($val)) $val = addslashes(serialize($val));
$sql .= (($i > 0) ? "," : "") . "$key='$val'";
$keys .= (($i > 0) ? "," : "") . "$key";
$vals .= (($i > 0) ? "," : "") . "'$val'";
$i++;
}
}
return array($sql, $keys, $vals);
}
?>

View File

@ -0,0 +1,24 @@
<?php
// translator ready
// addnews ready
// mail ready
function increment_specialty($colorcode, $spec=false){
global $session;
if ($spec !== false) {
$revertspec = $session['user']['specialty'];
$session['user']['specialty'] = $spec;
}
tlschema("skills");
if ($session['user']['specialty']!=""){
$specialties = modulehook("incrementspecialty",
array("color"=>$colorcode));
}else{
output("`7You have no direction in the world, you should rest and make some important decisions about your life.`0`n");
}
tlschema();
if ($spec !== false) {
$session['user']['specialty'] = $revertspec;
}
}
?>

View File

@ -0,0 +1,127 @@
<?php
$act = httpget('act');
if ($act==""){
output("%s`0 looks at you sort-of sideways like.",$barkeep);
output("He never was the sort who would trust a man any farther than he could throw them, which gave dwarves a decided advantage, except in provinces where dwarf tossing was made illegal.");
output("%s`0 polishes a glass, holds it up to the light of the door as another patron opens it to stagger out into the street.",$barkeep);
output("He then makes a face, spits on the glass and goes back to polishing it.");
output("\"`%What d'ya want?`0\" he asks gruffly.");
addnav_notl(sanitize($barkeep));
addnav("Bribe","inn.php?op=bartender&act=bribe");
addnav("Drinks");
modulehook("ale", array());
}elseif ($act=="bribe"){
$g1 = $session['user']['level']*10;
$g2 = $session['user']['level']*50;
$g3 = $session['user']['level']*100;
$type = httpget('type');
if ($type==""){
output("While you know that you won't always get what you want, sometimes the way to a man's information is through your purse.");
output("It's also always been said that more is better.`n`n");
output("How much would you like to offer him?");
addnav("1 gem","inn.php?op=bartender&act=bribe&type=gem&amt=1");
addnav("2 gems","inn.php?op=bartender&act=bribe&type=gem&amt=2");
addnav("3 gems","inn.php?op=bartender&act=bribe&type=gem&amt=3");
addnav(array("%s gold", $g1),"inn.php?op=bartender&act=bribe&type=gold&amt=$g1");
addnav(array("%s gold", $g2),"inn.php?op=bartender&act=bribe&type=gold&amt=$g2");
addnav(array("%s gold", $g3),"inn.php?op=bartender&act=bribe&type=gold&amt=$g3");
}else{
$amt = httpget('amt');
if ($type=="gem"){
if ($session['user']['gems']<$amt){
$try=false;
output("You don't have %s gems!", $amt);
}else{
$chance = $amt*30;
$session['user']['gems']-=$amt;
debuglog("spent $amt gems on bribing $barkeep");
$try=true;
}
}else{
if ($session['user']['gold']<$amt){
output("You don't have %s gold!", $amt);
$try=false;
}else{
$try=true;
$sfactor = 50/90;
$fact = $amt/$session['user']['level'];
$chance = ($fact - 10)*$sfactor + 25;
$session['user']['gold']-=$amt;
debuglog("spent $amt gold bribing $barkeep");
}
}
if ($try){
if (e_rand(0,100)<$chance){
output("%s`0 leans over the counter toward you. \"`%What can I do for you, kid?`0\" he asks.",$barkeep);
addnav("What do you want?");
if (getsetting("pvp",1)) {
addnav("Who's upstairs?","inn.php?op=bartender&act=listupstairs");
}
addnav("Tell me about colors","inn.php?op=bartender&act=colors");
if (getsetting("allowspecialswitch", true))
addnav("Switch specialty","inn.php?op=bartender&act=specialty");
}else{
output("%s`0 begins to wipe down the counter top, an act that really needed doing a long time ago.",$barkeep);
if ($type == "gem") {
if ($amt == 1) {
output("When he's finished, your gem is gone.");
} else{
output("When he's finished, your gems are gone.");
}
} else {
output("When he's finished, your gold is gone.");
}
output("You inquire about the loss, and he stares blankly back at you.");
addnav(array("B?Talk to %s`0 again",$barkeep),"inn.php?op=bartender");
}
}else{
output("`n`n%s`0 stands there staring at you blankly.",$barkeep);
addnav(array("B?Talk to %s`0 the Barkeep",$barkeep),"inn.php?op=bartender");
}
}
}else if ($act=="listupstairs"){
addnav("Refresh the list","inn.php?op=bartender&act=listupstairs");
output("%s`0 lays out a set of keys on the counter top, and tells you which key opens whose room. The choice is yours, you may sneak in and attack any one of them.",$barkeep);
pvplist($iname,"pvp.php", "?act=attack&inn=1");
}else if($act=="colors"){
output("%s`0 leans on the bar. \"`%So you want to know about colors, do you?`0\" he asks.",$barkeep);
output("You are about to answer when you realize the question was posed in the rhetoric.");
output("%s`0 continues, \"`%To do colors, here's what you need to do.",$barkeep);
output(" First, you use a &#0096; mark (found right above the tab key) followed by 1, 2, 3, 4, 5, 6, 7, !, @, #, $, %, ^, &.", true);
output("Each of those corresponds with a color to look like this:");
output_notl("`n`1&#0096;1 `2&#0096;2 `3&#0096;3 `4&#0096;4 `5&#0096;5 `6&#0096;6 `7&#0096;7 ",true);
output_notl("`n`!&#0096;! `@&#0096;@ `#&#0096;# `\$&#0096;\$ `%&#0096;% `^&#0096;^ `&&#0096;& `n",true);
output("`% Got it?`0\" You can practice below:");
rawoutput("<form action=\"$REQUEST_URI\" method='POST'>",true);
$testtext = httppost('testtext');
output("You entered %s`n", prevent_colors(HTMLEntities($testtext, ENT_COMPAT, getsetting("charset", "ISO-8859-1"))), true);
output("It looks like %s`n", $testtext);
$try = translate_inline("Try");
rawoutput("<input name='testtext' id='input'>");
rawoutput("<input type='submit' class='button' value='$try'>");
rawoutput("</form>");
rawoutput("<script language='javascript'>document.getElementById('input').focus();</script>");
output("`0`n`nThese colors can be used in your name, and in any conversations you have.");
addnav("",$REQUEST_URI);
}else if($act=="specialty"){
$specialty = httpget('specialty');
if ($specialty==""){
output("\"`2I want to change my specialty,`0\" you announce to %s`0.`n`n",$barkeep);
output("With out a word, %s`0 grabs you by the shirt, pulls you over the counter, and behind the barrels behind him.",$barkeep);
output("There, he rotates the tap on a small keg labeled \"Fine Swill XXX\"`n`n");
output("You look around for the secret door that you know must be opening nearby when %s`0 rotates the tap back, and lifts up a freshly filled foamy mug of what is apparently his fine swill, blue-green tint and all.`n`n",$barkeep);
output("\"`3What? Were you expecting a secret room?`0\" he asks. \"`3Now then, you must be more careful about how loudly you say that you want to change your specialty, not everyone looks favorably on that sort of thing.`n`n");
output("`0\"`3What new specialty did you have in mind?`0\"");
$specialities = modulehook("specialtynames");
foreach($specialities as $key=>$name) {
addnav($name,cmd_sanitize($REQUEST_URI)."&specialty=$key");
}
}else{
output("\"`3Ok then,`0\" %s`0 says, \"`3You're all set.`0\"`n`n\"`2That's it?`0\" you ask him.`n`n",$barkeep);
output("\"`3Yep. What'd you expect, some sort of fancy arcane ritual???`0\" %s`0 begins laughing loudly.",$barkeep);
output("\"`3You're all right, kid... just don't ever play poker, eh?`0`n`n");
output("\"`3Oh, one more thing. Your old use points and skill level still apply to that skill, you'll have to build up some points in this one to be very good at it.`0\"");
$session['user']['specialty']=$specialty;
}
}
?>

View File

@ -0,0 +1,64 @@
<?php
if ($com=="" && !$comment && $op!="fleedragon") {
if (module_events("inn", getsetting("innchance", 0)) != 0) {
if (checknavs()) {
page_footer();
} else {
$skipinndesc = true;
$session['user']['specialinc'] = "";
$session['user']['specialmisc'] = "";
$op = "";
httpset("op", "");
}
}
}
addnav("Things to do");
$args = modulehook("blockcommentarea", array("section"=>"inn"));
if (!isset($args['block']) || $args['block'] != 'yes') {
addnav("Converse with patrons","inn.php?op=converse");
}
addnav(array("B?Talk to %s`0 the Barkeep",$barkeep),"inn.php?op=bartender");
addnav("Other");
addnav("Get a room (log out)","inn.php?op=room");
if (!$skipinndesc) {
if ($op=="strolldown"){
output("You stroll down the stairs of the inn, once again ready for adventure!`n");
} elseif ($op=="fleedragon") {
output("You pelt into the inn as if the Devil himself is at your heels. Slowly you catch your breath and look around.`n");
output("%s`0 catches your eye and then looks away in disgust at your cowardice!`n`n",$partner);
output("You `\$lose`0 a charm point.`n`n");
if ($session['user']['charm'] > 0) $session['user']['charm']--;
} else {
output("You duck into a dim tavern that you know well.");
output("The pungent aroma of pipe tobacco fills the air.`n");
}
output("You wave to several patrons that you know.");
if ($session['user']['sex']) {
output("You give a special wave and wink to %s`0 who is tuning his harp by the fire.",$partner);
} else {
output("You give a special wave and wink to %s`0 who is serving drinks to some locals.",$partner);
}
output("%s`0 the innkeep stands behind his counter, chatting with someone.",$barkeep);
$chats = array(
translate_inline("dragons"),
translate_inline(getsetting("bard", "`^Seth")),
translate_inline(getsetting("barmaid", "`%Violet")),
translate_inline("`#MightyE"),
translate_inline("fine drinks"),
$partner,
);
$chats = modulehook("innchatter", $chats);
$talk = $chats[e_rand(0, count($chats)-1)];
output("You can't quite make out what he is saying, but it's something about %s`0.`n`n", $talk);
output("The clock on the mantle reads `6%s`0.`n", getgametime());
modulehook("inn-desc", array());
}
modulehook("inn", array());
module_display_events("inn", "inn.php");
?>

View File

@ -0,0 +1,74 @@
<?php
$config = unserialize($session['user']['donationconfig']);
$expense = round(($session['user']['level']*(10+log($session['user']['level']))),0);
$pay = httpget('pay');
if ($pay){
if ($pay == 2 || $session['user']['gold']>=$expense ||
$session['user']['boughtroomtoday']){
if ($session['user']['loggedin']){
if (!$session['user']['boughtroomtoday']) {
if ($pay == 2) {
$fee = getsetting("innfee", "5%");
if (strpos($fee, "%"))
$expense += round($expense * $fee / 100,0);
else
$expense += $fee;
$session['user']['goldinbank']-=$expense;
} else {
$session['user']['gold']-=$expense;
}
$session['user']['boughtroomtoday']=1;
debuglog("spent $expense gold on an inn room");
}
$session['user']['location']=$iname;
$session['user']['loggedin']=0;
$session['user']['restorepage']="inn.php?op=strolldown";
saveuser();
}
$session=array();
redirect("index.php");
}else{
output("\"Aah, so that's how it is,\" %s`0 says as he puts the key he had retrieved back on to its hook behind his counter.",$barkeep);
output("Perhaps you'd like to get sufficient funds before you attempt to engage in local commerce.");
}
}else{
if ($session['user']['boughtroomtoday']){
output("You already paid for a room for the day.");
addnav("Go to room","inn.php?op=room&pay=1");
}else{
modulehook("innrooms");
output("You stroll over to the bartender and request a room.");
output("He eyes you up and says, \"It will cost `\$%s`0 gold for the night in a standard room.", $expense);
$fee = getsetting("innfee", "5%");
if (strpos($fee, "%")) {
$bankexpense = $expense + round($expense * $fee / 100,0);
} else {
$bankexpense = $expense + $fee;
}
if ($session['user']['goldinbank'] >= $bankexpense && $bankexpense != $expense) {
output("And since you are such a fine person, I'll even offer you a rate of `\$%s`0 gold if you pay direct from the bank.", $bankexpense);
if (strpos($fee, "%")) {
output("That includes a %s transaction fee.", $fee);
} else {
output("That includes a transaction fee of %s gold.",
$fee);
}
}
$bodyguards = array("Butch","Bruce","Alfonozo","Guido","Bruno","Bubba","Al","Chuck","Brutus","Nunzio","Terrance","Mitch","Rocco","Spike","Gregor","Sven","Draco");
output("`n`n\"Also, let me tell you about our new 'Bodyguard Assistance Program' &#151; BAP. You see, you hire one of my guards here, and they'll protect you should anyone happen to, er, pick the locks of your room,\" he says as he gestures to a series of men sitting at one of the inn's tables drinking ale.", true);
output("They range in size from a skinny shifty-eyed fellow who appears barely able to lift his stein to a great bear of a fellow.");
output("This bruiser has a tattoo of a heart with \"Mom\" written across it on his huge bicep, and goes to take a sip from his ale, but instead crushes his stein, squirting it all over the skinny fellow who doesn't voice any objection for obvious reasons.");
output("\"We call it the BAP program because when someone tries to sneak into your room, BAP BAP BAP, our guys go to work.");
output("There's only two conditions: you pay your fee up front, and the guard you choose gets to keep a portion of the rewards from any fights.\"");
output("`n`nNot wanting to part with your money when the fields offer a place to sleep, you debate the issue.");
output("You realize, however, that the inn is a considerably safer place to sleep.");
output("It is far harder for vagabonds to get you in your room while you sleep.");
output("Also, those bodyguards sound pretty safe to you.");
//output("`n`bNote, bodyguard levels not yet implemented`b`n");
addnav(array("Give him %s gold", $expense),"inn.php?op=room&pay=1");
if ($session['user']['goldinbank'] >= $bankexpense) {
addnav(array("Pay %s gold from bank", $bankexpense),"inn.php?op=room&pay=2");
}
}
}
?>

View File

@ -0,0 +1,149 @@
<?php
$default_settings = array(
"transferperlevel"=>25,
"maxtransferout"=>25,
"charset"=>"iso-8859-1",
"transferreceive"=>3,
"borrowperlevel"=>20,
"allowgoldtransfer"=>0,
"mintransferlev"=>3,
"instantexp"=>false,
"allowclans"=>false,
"LOGINTIMEOUT"=>900,
"goldtostartclan"=>10000,
"gemstostartclan"=>15,
"beta"=>0,
"betaperplayer"=>1,
"villagename"=>LOCATION_FIELDS,
"gameoffsetseconds"=>0,
"daysperday"=>4,
"serverlanguages"=>"en,English,fr,FranÁais,dk,Danish,de,Deutsch,es,EspaÒol,it,Italian",
"expiretrashacct"=>1,
"expirenewacct"=>10,
"expireoldacct"=>45,
"gameadminemail"=>"postmaster@localhost.com",
"allowcreation"=>1,
"spaceinname"=>0,
"blockdupeemail"=>0,
"requireemail"=>0,
"requirevalidemail"=>0,
"defaultsuperuser"=>0,
"newplayerstartgold"=>50,
"maxrestartgold"=>300,
"maxrestartgems"=>10,
"forestchance"=>15,
"multifightdk"=>10,
"multichance"=>25,
"multibasemin"=>2,
"multibasemax"=>3,
"multislummin"=>0,
"multislummax"=>1,
"multithrillmin"=>1,
"multithrillmax"=>2,
"multisuimin"=>2,
"multisuimax"=>4,
"allowpackofmonsters"=>true,
"gardenchance"=>0,
"deathoverlord"=>'`$Ramius',
"homecurtime"=>1,
"homenewdaytime"=>1,
"homenewestplayer"=>1,
"newestplayer"=>"",
"OnlineCountLast"=>0,
"OnlineCount"=>0,
"maxonline"=>0,
"loginbanner"=>"*BETA* This is a BETA of this website, things are likely to change now and again, as it is under active development *BETA*",
"homeskinselect"=>1,
"defaultskin"=>"jade.htm",
"innname"=>LOCATION_INN,
"barkeep"=>"`tCedrik",
"impressum"=>"",
"companionsallowed"=>1,
"soap"=>1,
"clanregistrar"=>"`%Karissa",
"maxcolors"=>10,
"postinglimit"=>1,
"game_epoch"=>gmdate("Y-m-d 00:00:00 O",strtotime("-30 days")),
"usedatacache"=>0,
"show_notices"=>0,
"notify_on_warn"=>0,
"notify_on_error"=>0,
"notify_address"=>"",
"notify_every"=>30,
"last_char_expire"=>"0000-00-00 00:00:00",
"maxattacks"=>4,
"autofight"=>0,
"autofightfull"=>0,
"suicide"=>0,
"suicidedk"=>10,
"dropmingold"=>0,
"forestgemchance"=>25,
"instantexp"=>false,
"addexp"=>5,
"forestexploss"=>10,
"disablebonuses"=>1,
"gravechance"=>0,
"pvp"=>1,
"allowspecialswitch"=>true,
"innchance"=>0,
"bard"=>"`^Seth",
"barmaid"=>"`%Violet",
"innfee"=>"5%",
"inboxlimit"=>50,
"oldmail"=>14,
"onlyunreadmails"=>true,
"mailsizelimit"=>1024,
"expirecontent"=>180,
"lastdboptimize"=>date("y-m-d h:i:s"),
"paypalcurrency"=>"USD",
"logdnet"=>0,
"serverurl"=>"http://".$_SERVER['SERVER_NAME'].($_SERVER['SERVER_PORT'] == 80?"":":".$_SERVER['SERVER_PORT']).dirname($_SERVER['REQUEST_URI']),
"defaultlanguage"=>"en",
"serverdesc"=>"Another LoGD Server",
"logdnetserver"=>"http://logdnet.logd.com/",
"paypalemail"=>"",
"paypaltext"=>"legend of the green dragon site donation from",
"paypalcountry-code"=>"us",
"emailpetitions"=>0,
"multimaster"=>1,
"pvpimmunity"=>5,
"pvpminexp"=>1500,
"pvpdeflose"=>5,
"pvpattgain"=>10,
"pvpattlose"=>10,
"pvpdefgain"=>10,
"curltimeout"=>5,
"pvptimeout"=>600,
"allowoddadminrenames"=>0,
"dictionary"=>"/usr/share/dict/words",
"enabletranslation"=>true,
"collecttexts"=>false,
"cachetranslations"=>0,
"tl_maxallowed"=>0,
"permacollect"=>0,
"maxlistsize"=>100,
"refereraward"=>25,
"referminlevel"=>4,
"superuseryommessage"=>"Asking an admin for gems, gold, weapons, armor, or anything else which you have not earned will not be honored. If you are experiencing problems with the game, please use the 'Petition for Help' link instead of contacting an admin directly.",
"officermoderate"=>0,
"motditems"=>5,
"turns"=>10,
"maxinterest"=>10,
"mininterest"=>1,
"pvpday"=>3,
"fightsforinterest"=>4,
"maxgoldforinterest"=>100000,
"resurrectionturns"=>-6,
"gravefightsperday"=>10,
"newdaycron"=>0,
"newdaySemaphore"=>"0000-00-00 00:00:00",
"selfdelete"=>0,
"allowfeed"=>0,
"displaymasternews"=>1,
"companionslevelup"=>1,
"edittitles"=>1,
"automaster"=>1,
"villagechance"=>0,
"enablecompanions"=>true,
);
?>

View File

@ -0,0 +1,60 @@
<?php
function create_db($dbname){
output("`n`2Attempting to create your database...`n");
$sql = "CREATE DATABASE $dbname";
mysql_query($sql);
$error = mysql_error();
if ($error == ""){
if (mysql_select_db($dbname)){
output("`@Success!`2 I was able to create the database and connect to it!`n");
}else{
output("`\$It seems I was not successful.`2 I didn't get any errors trying to create the database, but I was not able to connect to it.");
output("I'm not sure what would have caused this error, you might try asking around in <a href='http://lotgd.net/forum/' target='_blank'>the LotGD.net forums</a>.");
}
}else{
output("`\$It seems I was not successful.`2 ");
output("The error returned by the database server was:");
rawoutput("<blockquote>$error</blockquote>");
}
}
$tipid=0;
function tip(){
global $tipid;
$tip = translate_inline("Tip");
output_notl("<div style='cursor: pointer; cursor: hand; display: inline;' onMouseOver=\"tip$tipid.style.visibility='visible'; tip$tipid.style.display='inline';\" onMouseOut=\"tip$tipid.style.visibility='hidden'; tip$tipid.style.display='none';\">`i[ `b{$tip}`b ]`i",true);
rawoutput("<div class='debug' id='tip$tipid' style='position: absolute; width: 200px; max-width: 200px; float: right;'>");
$args = func_get_args();
call_user_func_array("output",$args);
rawoutput("</div></div>");
rawoutput("<script language='JavaScript'>var tip$tipid = document.getElementById('tip$tipid'); tip$tipid.style.visibility='hidden'; tip$tipid.style.display='none';</script>");
$tipid++;
}
function descriptors($prefix=""){
require_once("lib/all_tables.php");
$array = get_all_tables();
$out = array();
while (list($key,$val)=each($array)){
$out[$prefix.$key]=$val;
}
return $out;
}
//This function is borrowed from the php manual.
function return_bytes($val) {
$val = trim($val);
$last = strtolower($val{strlen($val)-1});
switch($last) {
// The 'G' modifier is available since PHP 5.1.0
case 'g':
$val *= 1024;
case 'm':
$val *= 1024;
case 'k':
$val *= 1024;
}
return $val;
}
?>

View File

@ -0,0 +1,877 @@
<?php
$creaturefields = "(creatureid,creaturename,creaturelevel,creatureweapon,creaturelose,creaturewin,creaturegold,creatureexp,creaturehealth,creatureattack,creaturedefense,creatureaiscript,createdby,forest,graveyard,oldcreatureexp)";
$creaturefields111 = "(creatureid,creaturename,creaturelevel,creatureweapon,creaturelose,creaturewin,creaturegold,creatureexp,creaturehealth,creatureattack,creaturedefense,creatureaiscript,createdby,forest,graveyard)";
$sql_upgrade_statements = array(
"-1"=>array(), //needed just as a placeholder for new installs.
"0.9"=>array(
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (1, 'Thieving Kender', 1, 'Whirling Hoopak', 'You only wish you could pickpocket your money back from the thief.', NULL, 36, 14, 10, 1, 1, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (2, 'Rude Student', 1, 'Worn Textbook', 'You have sent this student to permanent detention.', '', 36, 14, 10, 1, 1, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (3, 'Baby Unicorn', 1, 'Blunt Horn', 'You feel like a real jerk killing something so pretty.', '', 36, 14, 10, 1, 1, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (4, 'Small Purple Mouse', 1, 'Lashing pink tail', 'It is written in black and white: this strange technicolor mouse is no more.', '', 36, 14, 10, 1, 1, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (5, 'Grunting Piggy', 1, 'Wiggly Snout', 'Mmm...Bacon', NULL, 36, 14, 10, 1, 1, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (6, 'Dumb Old Eyesore', 2, 'Nagging complaints', 'All she ever did was nag...nag...nag...', NULL, 97, 24, 21, 3, 3, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (7, 'Pygmy Marmoset', 2, 'Pieces of treebark', 'The strange little monkey falls from the trees and lies still.', NULL, 97, 24, 21, 3, 3, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (8, 'Burly Man', 15, 'Amazing Absorbency', 'Fantasize, fantasize about Burly ...Eeeh, Eeeh, Eeeh!', NULL, 531, 189, 155, 29, 21, NULL, 'Bluspring', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (9, 'Screaming Banshee', 2, 'Hauntingly Beautiful Voice', 'You plunge your weapon into her breast, silencing her song.', '', 97, 24, 21, 3, 3, '', 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (10, 'Ursa Minor', 2, 'Twinkling Lights', 'After an astronomical battle, Ursa Minor is the one seeing stars', NULL, 97, 24, 21, 3, 3, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (11, 'Stone Troll', 2, 'Gaping Maw', 'That troll is stone cold ugly.', NULL, 97, 24, 21, 3, 3, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (12, 'Slithering Asp', 2, 'Hypnotic eyes', 'You break the deadly gaze of the snake to save your own life.', '', 97, 24, 21, 3, 3, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (13, 'Windan The Barbarian', 2, 'Feathered Spear', 'He really was just a feather-weight', NULL, 97, 24, 21, 3, 3, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (14, 'Studious Young Sorceror', 2, 'Newly memorized spells', 'Perhaps she should have studied harder.', '', 97, 24, 21, 3, 3, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (15, 'Four and Twenty Blackbirds', 3, 'Freshly Baked Pies', 'Now isn''t this a dainty dish to set before a king?', NULL, 148, 34, 32, 5, 4, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (16, 'Amazon', 3, 'Bow and Arrow', 'The beautiful warrior lass has lost a battle for the first time.', NULL, 148, 34, 32, 5, 4, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (17, 'Overbearing Mother', 3, '9pm Curfew', 'With one fell swoop you save your social life!', '', 148, 34, 32, 5, 4, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (18, 'Huge Bald Programmer', 3, 'Shining Forehead', 'You feel as if you have seen this man before in the village.', '', 148, 34, 32, 5, 4, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (19, 'Someone''s Grandfather', 3, 'Stories that go nowhere', 'This reminds you of the time you needed a new heel for your shoe.', '', 148, 34, 32, 5, 4, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (20, 'Juvenile Delinquent', 3, 'Poor Attitude', 'With a satisfying thump, you knock the smirk right off his face.', '', 148, 34, 32, 5, 4, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (21, 'Beautiful Woodland Sprite', 3, 'Kindness and tranquility', 'You really cut that wood sprite down to size.', '', 148, 34, 32, 5, 4, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (22, 'Society Belle', 3, 'Southern Charm', 'Now she will never be on time for the ball!', NULL, 148, 34, 32, 5, 4, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (23, 'Giant Goldfish Cracker', 3, 'Annoying Commercial Jingles', 'Now *there* is a fish that smiled till you bit his head off.', NULL, 148, 34, 32, 5, 4, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (24, 'Angry Mob', 4, 'Torches', 'There is no justice for an angry mob.', '', 162, 45, 43, 7, 6, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (25, 'Polar Bear', 4, 'Terrible claws', 'That bear really needed an attitude adjustment.', '', 162, 45, 43, 7, 6, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (26, 'Decaying Skeleton', 4, 'Rusty Sword', 'His leg ought to make a good toy for your dog.', NULL, 162, 45, 43, 7, 6, NULL, 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (27, 'Willie the Wonder Hampster', 4, 'Nuclear Sunflower Seeds', 'You smile a grim smile at Willie and quietly munch on some seeds.', '', 162, 45, 43, 7, 6, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (28, 'Winged Demon Of Death', 4, 'Red Glare', 'You cut off the Demon''s head, to be sure of its death.', NULL, 162, 45, 43, 7, 6, NULL, 'foilwench', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (29, 'Small Dragon', 4, 'Hot air', 'For one moment you thought THIS was the Green Dragon, but alas not.', NULL, 162, 45, 43, 7, 6, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (30, 'Monstrous Dustbunny', 4, 'Sneezing fits', 'You sweep the poor bunny under the rug when no one is looking.', '', 162, 45, 43, 7, 6, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (31, 'Small Rabbit', 4, 'Sharp Pointy Teeth', 'To think you almost ran away!', NULL, 162, 45, 43, 7, 6, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (32, 'Mature Unicorn', 5, 'Powerful Horn', 'A unicorn is a thing of beauty, even in death.', '', 198, 55, 53, 9, 7, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (33, 'Gnome Necromancer', 5, 'Skeleton Familiar', 'Once you killed its familiar that Gnome was really weak.', NULL, 198, 55, 53, 9, 7, NULL, 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (34, 'Purple Dinosaur', 5, 'Helpful Nature', 'There seems to be a person inside that strange dino. You wonder why.', NULL, 198, 55, 53, 9, 7, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (35, 'Orc Emmisary', 5, 'Diplomacy', 'You never were the diplomatic type.', NULL, 198, 55, 53, 9, 7, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (36, 'Dark Spiritling', 5, 'Dark Magic', 'The spiritling gasps a final breath as you end its pitiful life.', '', 198, 55, 53, 9, 7, '', 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (37, 'Enchanted Toilet', 5, 'Ninja Flushing Action', 'That was just weird.', '', 198, 55, 53, 9, 7, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (38, 'Giant Water Elemental', 5, 'Torrential Downpours', 'The giant creature is reduced a meager spring shower.', '', 198, 55, 53, 9, 7, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (39, 'Violins', 5, 'Off-Key notes', 'Won''t someone PLEASE stop the violins?', NULL, 198, 55, 53, 9, 7, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (40, 'Whirled Peas', 5, 'Green Slime', 'We should all pray for whirled peas.', NULL, 198, 55, 53, 9, 7, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (41, 'Magic Mushroom', 6, 'Swirling Colors', 'Guess you don''t need to go ask Alice now.', '', 234, 66, 64, 11, 8, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (42, 'Invisible Man', 6, 'Something Invisible and Sharp', 'You really aren''t sure if it is dead, or just hiding...after all it is invisible.', '', 234, 66, 64, 11, 8, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (43, 'Clown of Death', 6, 'Balloon Animals from Beyond', 'You give the clown''s nose a honk just for fun before you leave.', '', 234, 66, 64, 11, 8, '', 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (44, 'Heart of Stone', 6, 'Unromantic Thoughts', 'Aww, now look, you broke its heart!', NULL, 234, 66, 64, 11, 8, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (45, 'Troll Warrior', 6, 'Steel Broadsword', 'Wow, he smelled bad enough alive, can you imagine how he''ll smell tomorrow?', NULL, 234, 66, 64, 11, 8, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (46, 'Bettie the Amazing Kung-Fu Butterfly', 6, 'Stupendous Kung-Fu Wings', 'You survived a battle to the death with a butterfly. You must be so proud.', NULL, 234, 66, 64, 11, 8, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (47, 'Golden Goose', 6, '14 Karat Gold Eggs', 'You have slain the goose but it is too heavy to take back to town. All that wealth wasted.', NULL, 234, 66, 64, 11, 8, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (48, 'Black Tiger', 6, 'Claws', 'You ponder the tiger''s body thinking what a good rug it might make.', '', 234, 66, 64, 11, 8, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (49, 'Lambert the Sheepish Lion', 6, 'Timid Growling', 'You marched in like a lion and he died like a lamb.', '', 234, 66, 64, 11, 8, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (50, 'Marsha of the Jungle', 7, 'Trained Monkeys', 'Poor Marsha, she thought those monkeys were better trained.', '', 268, 77, 74, 13, 10, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (51, 'Moe', 7, 'Two Knives', 'Maybe those knives weren''t so great.', '', 268, 77, 74, 13, 10, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (52, 'Coffin', 7, 'Terrifying Premonitions', 'Best way to get rid of the coffin is Robitussin.', NULL, 268, 77, 74, 13, 10, NULL, 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (53, 'Green Alligator', 7, 'Crushing Jaws', 'Crikey! That thing could have killed you!', NULL, 268, 77, 74, 13, 10, NULL, 'foilwench', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (54, 'Lindsey, Daughter of Erin the Ninja Squirrel', 7, 'A Peanut Shooter', 'All these squirrels are nuts.', '', 268, 77, 74, 13, 10, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (55, 'Wizarding School Senior Student', 7, 'Memory Charm', 'Drat! He took your memory before you killed him. Who are you anyway?', NULL, 268, 77, 74, 13, 10, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (56, 'Enchanted Laundry Basket', 7, 'Stinky Socks of Terror', 'So that''s what happens to lost socks!', NULL, 268, 77, 74, 13, 10, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (57, 'Carrot Top', 7, 'Phone Company Slogans', 'That has got to be the most satisfying kill you ever made.', NULL, 268, 77, 74, 13, 10, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (58, 'Macintosh Computer', 7, 'Amazingly Bright Colors', 'So THAT''S what happens when you right-click a Mac.', NULL, 268, 77, 74, 13, 10, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (59, 'Interior Designer', 8, 'Color-coordinating Sword and Shield', 'You didn''t like his style.', '', 302, 89, 84, 15, 11, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (60, 'Daughter of the Devil', 8, 'Sinfully Good Looks', 'She is the girl your mom always warned you about.', NULL, 302, 89, 84, 15, 11, NULL, 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (61, 'Wild Horses', 8, 'Dragging', 'I guess the saying is true, wild horses can''t drag you away.', '', 302, 89, 84, 15, 11, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (62, 'Steam Elemental', 8, 'Scalding jets of air', 'There was just enough steam left to make an espresso.', '', 302, 89, 84, 15, 11, '', 'foilwench', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (63, 'Gordon the Cheese Eater', 8, 'Odiferous Nature', 'You sure cut that cheese....eater.', '', 302, 89, 84, 15, 11, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (64, 'Narcoleptic', 8, 'Drowsiness', 'This narcoleptic won''t be waking up anytime soon.', '', 302, 89, 84, 15, 11, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (65, 'Swarm of Bees', 8, 'Stinging', 'You feel like a pincushion, but you are alive.', '', 302, 89, 84, 15, 11, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (66, 'Halfling Mage', 8, 'Painful Spells', 'That fight wasn''t half as difficult as you thought it would be.', '', 302, 89, 84, 15, 11, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (67, 'Citizen of Eythgim Village', 9, 'Slurs', 'Geeze, what did you ever do to him?', NULL, 336, 101, 94, 17, 13, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (68, 'Old Hag', 9, 'Red Red Rose', 'It is her turn to sleep an enchanted sleep.', '', 336, 101, 94, 17, 13, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (69, 'Charging Buffalo', 9, 'Stampeding Hoofs', 'Do you know how to stop a charging buffalo? Take away his credit card!', NULL, 336, 101, 94, 17, 13, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (70, 'Pawn', 9, 'Simple Tactics', 'Well, that was a bad move.', '', 336, 101, 94, 17, 13, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (71, 'Romulan', 9, 'Wrong-Genre Confusion', 'You think to yourself they look tougher on TV.', '', 336, 101, 94, 17, 13, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (72, 'Large Griffon', 9, 'Beak and Claws', 'The mythical creature is no more.', '', 336, 101, 94, 17, 13, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (73, 'Cliche Bond Movie Villain', 9, 'Cell-phone of Death', 'Well, really, who throws a cell phone? I mean, that really, really hurt!', '', 336, 101, 94, 17, 13, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (74, 'Fuzzy Ferret', 9, 'Disarming Cuteness', 'Who knew ferrets were so violent!', NULL, 336, 101, 94, 17, 13, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (75, 'Starving Artist', 9, 'Pointy Paintbrushes', 'This guy really painted himself into a corner.', '', 336, 101, 94, 17, 13, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (76, 'Guard from Eythgim Village', 10, 'Rapier', 'The people from that village seem angry!', NULL, 369, 114, 105, 19, 14, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (77, 'Garden Gnome', 10, 'Painful Tackiness', 'Stupid garden gnomes. What are they doing in the forest anyway?', '', 369, 114, 105, 19, 14, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (78, 'Chicken', 10, 'Squawking', 'Good fortune smiles upon you - you will eat well tonight.', '', 369, 114, 105, 19, 14, '', 'foilwench', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (79, 'Marksman', 10, 'Deadly Aim', 'He took so long to aim, you just walked up and kicked him.', '', 369, 114, 105, 19, 14, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (80, 'Enchanted Tissue Box', 10, 'Cold Germs', 'You pick up the box and put it in your pocket. You never know when a tissue might come in handy.', '', 369, 114, 105, 19, 14, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (81, 'Ghostly Woodsman', 10, 'Phantom Axe', 'You aren''t sure how you did it, but you killed something that was already dead. Good for you.', NULL, 369, 114, 105, 19, 14, NULL, 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (82, 'Zombie', 10, 'Rotting Flesh', 'He really went to pieces, didn''t he?', NULL, 369, 114, 105, 19, 14, NULL, 'foilwench', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (83, 'Fortula the Plains Cat', 10, 'Claws and Teeth', 'That plains cat is now plain dead.', '', 369, 114, 105, 19, 14, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (84, 'Erin the Ninja Squirrel', 10, 'Acorn Tossing Madness', 'That squirrel was a little crazy.', '', 369, 114, 105, 19, 14, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (85, 'Bluebird of Happiness', 11, 'Uplifting Melody', 'Happiness is over-rated anyway.', '', 402, 127, 115, 21, 15, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (86, 'Potato Newscaster', 11, 'Personal Opinions', 'It''s ok, he was just a common ''tater.', '', 402, 127, 115, 21, 15, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (87, 'Pygmy Dragon', 11, 'Fire Breath', 'You hope he wasn''t a relative of the Green Dragon.', '', 402, 127, 115, 21, 15, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (88, 'Zealous Photographer', 11, 'Flashing Lights', 'The things beautiful people have to put up with.', NULL, 402, 127, 115, 21, 15, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (89, 'Gary Larson', 11, 'Strange Cartoons', 'You still don''t get it.', NULL, 402, 127, 115, 21, 15, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (90, 'Soldier from Eythgim Village', 11, 'Battle Cry', 'Eythgim seems to be waging a personal war with you.', '', 402, 127, 115, 21, 15, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (91, '80''s Glam Rocker', 11, 'Blinding Makeup', 'You know your motto, Live and let die.', NULL, 402, 127, 115, 21, 15, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (92, 'Vigilante', 11, 'Sack of Doorknobs', 'This carnage disgusts you.', '', 402, 127, 115, 21, 15, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (93, 'The Devil', 11, 'Eternal Damnation', 'For being the Devil, he really wasn''t so hot.', NULL, 402, 127, 115, 21, 15, NULL, 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (94, 'Mercenary', 12, 'Blood-chilling Stare', 'You could use an ale.', '', 435, 141, 125, 23, 17, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (95, 'Magic Mirror', 12, 'Flattering Remarks', 'Mirror, Mirror, on the Ground, it is your death that you have found.', NULL, 435, 141, 125, 23, 17, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (96, 'Broadway Extra', 12, 'Memorable Showtunes', 'This extra is really on her own now.', '', 435, 141, 125, 23, 17, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (97, 'Butter the Sprite', 12, 'Magic Pixie Dust', 'Butter? What kind of a name is Butter?', NULL, 435, 141, 125, 23, 17, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (98, 'Father Time', 12, 'Old Age', 'Your victory is not comforting. You know he will still catch up to you.', '', 435, 141, 125, 23, 17, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (99, 'Eythgim Village Archers', 12, 'Flaming Arrows', 'The tree is burning, you''d better try to put it out.', NULL, 435, 141, 125, 23, 17, NULL, 'foilwench', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (100, 'Animate Stormcloud', 12, 'Lightning', 'The storm is no more. You can see the light of day peeking through the last of the clouds.', '', 435, 141, 125, 23, 17, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (101, 'Three Toed Sloth', 12, 'Slow Responses', 'Your swift moves were too fast for this sloth.', '', 435, 141, 125, 23, 17, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (102, 'Death', 12, 'Cold Grasp', 'There it is! Death!!!!!', NULL, 435, 141, 125, 23, 17, NULL, 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (103, 'Cerberus', 13, 'Three Drooling Maws', 'Each one''s breath was worse than the last.', '', 467, 156, 135, 25, 18, '', 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (104, 'Man from deep, deep, dark, dark, deep, dark woods', 13, 'Snarling and Biting', 'The creature from the deep, deep, dark, dark, deep, dark woods is finally dead.', '', 467, 156, 135, 25, 18, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (105, 'Devil in a Blue Dress', 13, 'Alluring Promises', 'You really prefer black dresses anyway.', '', 467, 156, 135, 25, 18, '', 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (106, 'Giant', 13, 'Smashing Club', 'Geeze, he almost fell on you!', NULL, 467, 156, 135, 25, 18, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (107, 'Commander of the Eythgim Army', 13, 'Winning Tactics', 'You have bested their army by killing its master.', NULL, 467, 156, 135, 25, 18, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (108, 'Ice Dragon', 13, 'Frost Breath', 'You defeated him, but caught a cold.', NULL, 467, 156, 135, 25, 18, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (109, 'Pushmi Pullyew', 13, 'Conflictory Arguments', 'That strange creature couldn''t tell if it was coming or going.', NULL, 467, 156, 135, 25, 18, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (110, 'Whale', 13, 'Tail', 'You know Violet isn''t going to believe a Whale attacked you in the forest.', '', 467, 156, 135, 25, 18, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (111, 'Gorma The Leper', 13, 'Contagious Disease', 'It looks like the leper''s fighting strategy has fallen apart...', NULL, 467, 156, 135, 25, 18, NULL, 'foilwench', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (112, 'Samurai Master', 14, 'Daisho', 'You bow to the fallen master before you walk away.', '', 499, 172, 145, 27, 20, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (113, 'Bartender', 14, 'Duck', 'That''s not a Duck! It''s a Chicken!', NULL, 499, 172, 145, 27, 20, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (114, 'Prince of Eythgim Village', 14, 'Bribes of Gold', 'You are not easily bribed, and he was a mortal enemy.', '', 499, 172, 145, 27, 20, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (115, 'Loch Ness Monster', 14, 'Shocking Appearance', 'Why in the world would that monster be in this forest. You must have been dreaming!', '', 499, 172, 145, 27, 20, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (116, 'Fuzzie Wuzzie', 14, 'Male Pattern Baldness', 'Fuzzie Wuzzie wasn''t very fuzzie, was he?', NULL, 499, 172, 145, 27, 20, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (117, 'Princess of Eythgim Village', 15, 'Beguiling Words', 'She tried to tempt you, but you resisted.', NULL, 531, 189, 155, 29, 21, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (118, 'Ugly Harpy', 14, 'Poisonous Breath', 'Her breath was worse than her bite.', '', 499, 172, 145, 27, 20, '', 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (119, 'Field Mouse', 14, 'Chewing', 'That was some powerful mouse!', NULL, 499, 172, 145, 27, 20, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (120, 'Monarch of Eythgim Village', 16, 'Royal Commands', 'I guess this makes you king of their Village.', NULL, 563, 207, 166, 31, 22, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (121, 'Cyclops Warrior', 15, 'Fire Eye', 'The dead Cyclops'' one eye stares at you blankly.', NULL, 531, 189, 155, 29, 21, NULL, 'foilwench', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (122, 'Cupid', 15, 'Pink Arrows of Love', 'You have slain Cupid. You shall never find true love.', '', 531, 189, 155, 29, 21, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (123, 'Tabloid Writer', 15, 'Far-fetched Stories', 'If you ask me, SHE was the six-armed alien who gave birth to the world''s largest infant Elvis impersonator.', '', 531, 189, 155, 29, 21, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (124, 'Evil Wizard', 15, 'Tormented Souls', 'You have set the tortured souls free.', '', 531, 189, 155, 29, 21, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (125, 'Artemis, Goddess of the Hunt', 15, 'Winged Stags', 'The moon itself shall weep for the slain Artemis.', '', 531, 189, 155, 29, 21, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (126, 'Centaur Archer', 15, 'Deadly Marksmanship', 'The twisted man-beast lies still.', '', 531, 189, 155, 29, 21, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (127, 'Mime', 15, 'Something Imaginary', 'His death is a rather sad charade.', '', 531, 189, 155, 29, 21, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (128, 'Chili Chef', 15, 'Insanity Peppers', 'Man, that''s good chili!', '', 531, 189, 155, 29, 21, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (129, 'Brownie', 16, 'Miniscule weapons', 'The tiny warrior dies with a faint squeal.', '', 563, 207, 166, 31, 22, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (130, 'Darkness', 16, 'Self-induced Terror', 'You are afraid of the dark no longer.', '', 563, 207, 166, 31, 22, '', 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (131, 'Mountain King', 16, 'God-like Fury', 'The King has died, long live the King!', '', 563, 207, 166, 31, 22, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (134, 'Loneliness', 17, 'Silence', 'What is the sound of one hand clapping?', 'What is the sound of one hand clapping?', 36, 0, 1, 0, 0, NULL, NULL, 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (135, 'Loneliness', 18, 'Silence', 'What is the sound of one hand clapping?', 'What is the sound of one hand clapping?', 0, 0, 1, 0, 25, NULL, NULL, 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (136, 'Le Chat dans le chapeau', 15, 'Rhyming Nonsense', 'In spanish, El Gato en el sombrero.', '', 531, 189, 155, 29, 21, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (138, 'Whopper With Cheese', 8, 'Abundant Cholesterol', 'This is one whopper that won''t show up on your hips tomorrow.', NULL, 302, 89, 84, 15, 11, NULL, 'foilwench', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (139, 'Swarming Ladybugs', 3, 'Stinking Residue', 'Those Ladybugs weren''t very ladylike.', NULL, 148, 34, 32, 5, 4, NULL, 'foilwench', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (140, 'Football Fan', 6, 'Raucous Cheers', 'This fan doesn''t have much to cheer about.', NULL, 234, 66, 64, 11, 8, NULL, 'foilwench', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (141, 'King Agrippa', 13, 'Flaming Wingnuts', 'As you stare at his smoking corpse, you marvel at the ineffectiveness of flaming wingnuts.', NULL, 467, 156, 135, 25, 18, NULL, 'foilwench', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (142, 'Cherubically Charming Child', 1, 'Curious Questions', 'You think it was the alliteration that did him in.', NULL, 36, 14, 10, 1, 1, NULL, 'foilwench', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (143, 'Haberdasher', 5, 'Heavy Hat', 'Hats have gone out of style anyway.', NULL, 198, 55, 53, 9, 7, NULL, 'foilwench', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (144, 'Rush Hour Driver', 11, 'Road Rage', 'It was a no-win situation, speeding on these forest paths. The driver had it coming.', NULL, 402, 127, 115, 21, 15, NULL, 'foilwench', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (145, 'Sorority Girl in Nightie', 7, 'Pillow Fighting Action', 'It''s too bad she''s dead... you liked her action.', '', 268, 77, 74, 13, 10, '', 'foilwench', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (146, 'Ulysses Wulfgang', 14, 'Ridiculous Lies', 'Death to lies! Death to Ulysses Wulfgang!', '', 499, 172, 145, 27, 20, '', 'Joe', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (147, 'Crazy Audrey', 9, 'Ravenous Kittens', 'With a well placed stomp, Audrey and the kittens are no more.', NULL, 336, 101, 94, 17, 13, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (148, 'Shining Happy People', 5, 'Hand Holding Terror', 'They just wanted to be your friend. You meanie.', NULL, 198, 55, 53, 9, 7, NULL, 'foilwench', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (149, 'Elsabutt', 8, 'Gravitational Pull', 'This is indeed a grave situation.', '', 302, 89, 84, 15, 11, '', 'foilwench', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (150, 'Mr. Bear', 2, 'Overwhelming Sleepiness', 'Mr. Bear was too tired to finish playing with you and went back to napping.', '', 97, 24, 21, 3, 3, '', 'foilwench', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (151, 'Everquest Junkie', 12, '1337 Sp34k', 'D00d U pwned that guy!', NULL, 435, 141, 125, 23, 17, NULL, 'foilwench', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (152, 'Little Cocobean', 4, 'Her Special Roast', 'She really made your heart race and pound, but now she has crumbled to the ground', NULL, 162, 45, 43, 7, 6, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (153, 'Humongous Hairball', 5, 'Incredible Drain-Clogging Power', 'The hairball and all its accompanying gook have been washed out to sea!', NULL, 198, 55, 53, 9, 7, NULL, 'foilwench', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (154, 'Iron Chef', 4, 'Sizzling Eel Flambe!', 'You have rendered the Chef Ironless! He''s now simply a copper/tin alloy!', NULL, 162, 45, 43, 7, 6, NULL, 'foilwench', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (155, 'The Government', 7, 'Taxes', 'That''s a tax return you''ll be taking to the bank!', NULL, 268, 77, 74, 13, 10, NULL, 'Bluspring', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (156, 'Bar Fly', 1, 'Alcoholism', 'Good thing you got him before cirrhosis did!', NULL, 36, 14, 10, 1, 1, NULL, 'Bluspring', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (157, 'Methane Man', 7, 'Unfriendly Gasses', 'Must have been that bean he ate!', NULL, 268, 77, 74, 13, 10, NULL, 'foilwench', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (158, 'Wooly Mammoth', 8, 'Wildebeest Sidekick', 'You climb atop the Mammoth''s remains and declare yourself king (or queen) for a day!', NULL, 302, 89, 84, 15, 11, NULL, 'foilwench', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (159, 'Nasty Nevin', 10, 'Bossy Mom', 'Wrecked\\'em? Darn near killed \\'em!', NULL, 369, 114, 105, 19, 14, NULL, 'Joe', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (160, 'The Gar Man', 3, 'Jar of Cotton Balls', 'There is but one Gar Man! And now he''s just fluff!', '', 148, 34, 32, 5, 4, '', 'foilwench', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (161, 'Hiker', 1, 'Walking Stick', 'His last words were \"...I must protect the dragon.\"', '', 36, 14, 10, 1, 1, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (162, 'Camper', 2, 'Marshmallow-roasting Stick', 'With her dying breath she gasps \"...and I never saw the dragon.\"', NULL, 97, 24, 21, 3, 3, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (163, 'Forest Ranger', 3, 'Hunting Rifle', 'In his pack you find a copy of \"Dragon Seeking for Dummies.\"', '', 148, 34, 32, 5, 4, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (164, 'Tree-Hugger', 4, 'Propaganda Leaflets', 'The leaflet reads \"Who Will Protect The Helpless Dragon?\"', '', 162, 45, 43, 7, 6, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (165, 'Forest Dwelling Hermit', 5, 'Hand-Made Sling', 'He speaks only these words as he dies: \"You must leave the Dragon''s Forest.\"', NULL, 198, 55, 53, 9, 7, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (166, 'Member of Dragon Lovers Anonymous', 6, 'Stuffed Dragon Toy', 'When one wears a pin saying \"Dragon Lovers Anonymous\" they really are not as anonymous as they might think.', '', 234, 66, 64, 11, 8, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (167, 'Initiate Dragon Watcher', 7, 'Binoculars', 'All he could say was \"Shhh, you are scaring the dragons!\"', NULL, 268, 77, 74, 13, 10, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (168, 'Dragon Watcher, Junior Class', 8, 'Annoyance', 'You find a dragon-watching textbook in his backpack.', NULL, 302, 89, 84, 15, 11, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (169, 'Dragon-watcher Senior Class', 9, 'Spelunking Equipment', 'You find a copy of \"Cave-Dwelling Dragons, and Where to Find Them\" in his pack.', '', 336, 101, 94, 17, 13, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (170, 'Master Dragon Watcher', 10, 'Stealth', 'You wonder who watches the watchers.', '', 369, 114, 105, 19, 14, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (171, 'Initiate Dragon Tamer', 11, '10-foot dragon pole', 'Good thing for you that pole only works on 10-foot dragons!', NULL, 402, 127, 115, 21, 15, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (172, 'Junior Dragon Tamer', 12, 'Large Whip', 'If he cannot tell the difference between you and a dragon, he has much work to do.', '', 435, 141, 125, 23, 17, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (173, 'Senior Dragon Tamer', 13, 'Very Large Hoop', 'You regret killing him. You wanted to see him make a dragon jump through that hoop.', '', 467, 156, 135, 25, 18, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (174, 'Master Dragon Tamer', 14, 'Tame Dragon', 'Once you killed the master, the dragon ran away', NULL, 499, 172, 145, 27, 20, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (175, 'Dragon Rider in Training', 15, 'Mechanical Bull', 'They learn to ride dragons using a mechanical bull?', NULL, 531, 189, 155, 29, 21, NULL, 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (176, 'Dragon Rider', 16, 'Flying Dragon', 'A well-aimed strike grounds the flying dragon and his rider.', '', 563, 207, 166, 31, 22, '', 'Appleshiner', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (177, 'Batling', 1, 'Tiny flapping wings', 'Silly batling!', '', 36, 14, 10, 1, 1, '', 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (178, 'Small Bat', 2, 'Slightly venomous fangs', 'The small mammal falls to the ground lifeless.', '', 97, 24, 21, 3, 3, '', 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (179, 'Medium Sized Bat', 3, 'Screeching Cries', 'You killed it just to shut it up.', NULL, 148, 34, 32, 5, 4, NULL, 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (180, 'Large Bat', 4, 'Guano', 'You feel the need to take a bath.', '', 162, 45, 43, 7, 6, '', 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (181, 'Giant Bat', 5, 'Clinging and Biting', 'Why do movie bats always fly at people''s hair?', NULL, 198, 55, 53, 9, 7, NULL, 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (182, 'Vampire Batling', 6, 'Pricking teeth', 'He resembled a mosquito more than a vampire bat.', '', 234, 66, 64, 11, 8, '', 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (183, 'Small Vampire Bat', 7, 'Deadly Fangs', 'You kick at the annoying pest as it lies on the ground.', '', 268, 77, 74, 13, 10, '', 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (184, 'Medium Sized Vampire Bat', 8, 'Echoing Sounds', 'Who decides that this bat is a \"Medium\"? Maybe he is a giant bat who hasn''t bloomed yet.', NULL, 302, 89, 84, 15, 11, NULL, 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (185, 'Huge Vampire Bat', 9, 'Blood-Sucking', 'You gave more blood to the Red Cross.', '', 336, 101, 94, 17, 13, '', 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (186, 'Vampire in Bat Form', 10, 'Bad Romanian Accent', '\"I vant to suk your blooood!\"', NULL, 369, 114, 105, 19, 14, NULL, 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (187, 'Vampire-Bat Prince', 11, 'Death Grip', 'You thought bats were Republicans.', '', 402, 127, 115, 21, 15, '', 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (188, 'Vampire Bat King', 12, 'Red Eyes', 'You decide to leave before the rest of the bats come to find their king.', '', 435, 141, 125, 23, 17, '', 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (189, 'Sorcerous Vampire', 13, 'Petrifying Spells', 'A cold shiver goes down your spine. You would rather be with Violet.', '', 467, 156, 135, 25, 18, '', 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (219, 'Seductive Vampiress', 14, 'Sultry Moves', 'It was a shame to kill her.', NULL, 499, 172, 145, 27, 20, NULL, 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("masters") . " VALUES (1,'Mireraband',1,'Small Dagger','Well done %w`&, I should have guessed you\\'d grown some.','As I thought, %w`^, your skills are no match for my own!',NULL,NULL,12,2,2)",
"INSERT INTO " . db_prefix("masters") . " VALUES (2,'Fie',2,'Short Sword','Well done %w`&, you really know how to use your %x.','You should have known you were no match for my %X',NULL,NULL,22,4,4)",
"INSERT INTO " . db_prefix("masters") . " VALUES (3,'Glynyc',3,'Hugely Spiked Mace','Aah, defeated by the likes of you! Next thing you know, Mireraband will be hunting me down!','Haha, maybe you should go back to Mireraband\\'s class.',NULL,NULL,33,6,6)",
"INSERT INTO " . db_prefix("masters") . " VALUES (4,'Guth',4,'Spiked Club','Ha! Hahaha, excellent fight %w`&! Haven\\'t had a battle like that since I was in the RAF!','Back in the RAF, we\\'d have eaten the likes of you alive! Go work on your skills some old boy!',NULL,NULL,44,8,8)",
"INSERT INTO " . db_prefix("masters") . " VALUES (5,'Un<55>lith',5,'Thought Control','Your mind is greater than mine. I concede defeat.','Your mental powers are lacking. Meditate on this failure and perhaps some day you will defeat me.',NULL,NULL,55,10,10)",
"INSERT INTO " . db_prefix("masters") . " VALUES (6,'Adwares',6,'Dwarven Battle Axe','Ach! Y\\' do hold yer %x with skeel!','Har! Y\\' do be needin moore praktise y\\' wee cub!',NULL,NULL,66,12,12)",
"INSERT INTO " . db_prefix("masters") . " VALUES (7,'Gerrard',7,'Battle Bow','Hmm, mayhaps I underestimated you.','As I thought.',NULL,NULL,77,14,14)",
"INSERT INTO " . db_prefix("masters") . " VALUES (8,'Ceiloth',8,'Orkos Broadsword','Well done %w`&, I can see that great things lie in the future for you!','You are becoming powerful, but not yet that powerful.',NULL,NULL,88,16,16)",
"INSERT INTO " . db_prefix("masters") . " VALUES (9,'Dwiredan',9,'Twin Swords','Perhaps I should have considered your %x...','Perhaps you\\'ll reconsider my twin swords before you try that again?',NULL,NULL,99,18,18)",
"INSERT INTO " . db_prefix("masters") . " VALUES (10,'Sensei Noetha',10,'Martial Arts Skills','Your style was superior, your form greater. I bow to you.','Learn to adapt your style, and you shal prevail.',NULL,NULL,110,20,20)",
"INSERT INTO " . db_prefix("masters") . " VALUES (11,'Celith',11,'Throwing Halos','Wow, how did you dodge all those halos?','Watch out for that last halo, it\\'s coming back this way!',NULL,NULL,121,22,22)",
"INSERT INTO " . db_prefix("masters") . " VALUES (12,'Gadriel the Elven Ranger',12,'Elven Long Bow','I can accept that you defeated me, because after all elves are immortal while you are not, so the victory will be mine.','Do not forget that elves are immortal. Mortals will likely never defeat one of the fey.',NULL,NULL,132,24,24)",
"INSERT INTO " . db_prefix("masters") . " VALUES (13,'Adoawyr',13,'Gargantuan Broad Sword','If I could have picked up this sword, I probably would have done better!','Haha, I couldn\\'t even pick the sword UP and I still won!',NULL,NULL,143,26,26)",
"INSERT INTO " . db_prefix("masters") . " VALUES (14,'Yoresh',14,'Death Touch','Well, you evaded my touch. I salute you!','Watch out for my touch next time!',NULL,NULL,154,28,28)",
"INSERT INTO " . db_prefix("news") . " VALUES (1,'`^A strange awakening takes place in the world.`0',now(), 0, '', '')",
),
"0.9.1"=>array(
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5\"`6Just wait for my revenge, `4%W`6. It will be swift!`5\" %w declares.','Bluspring')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5\"`6I\\'m really going to enjoy this new `4%x`6 that %w`6 had,`5\" exclaimed %W.','joe')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5\"`6Aah, so `bthat\\'s`b what `4%X`6 is for!`5\" exclaimed %W','joe')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5\"`6Oh man! I didn\\'t think you had it in you, `5%W`6,`5\" %w exclaims.','Bluspring')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5%W was overheard saying, \"`6%p `4%x`6 was no match for my `4%X`6!`5\"','Bluspring')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5\"`6You know, you really shouldn\\'t have a `4%x`6 unless you know how to use it,`5\" suggested %W.','Bluspring')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5\"`6`bARRRGGGGGGG`b!!`5\" %w screams in frustration.','Bluspring')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5\"`6How could I be so feeble?`5\" %w laments.','Bluspring')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5\"`6I must not be as sturdy as I thought...!`5\" %w concedes.','Bluspring')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5\"`6Watch your back, `4%W`6, I am coming for you!`5\" %w warns.','Bluspring')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5\"`6This both sucks and blows!`5\" wails %w.','Bluspring')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5\"`6I see London, I see France, I see `4%w\\'s`6 underpants!`5\" reveals %W.','Bluspring')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5\"`6The Healer\\'s Hut can\\'t help you now, `4%w`6!`5\" chides %W.','Bluspring')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5%W smiles. \"`6You are too slow. You are too weak.`5\"','Bluspring')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5%w bangs %p head against a stone...\"`6Stupid, stupid, stupid!`5\" %o was heard to say.','Bluspring')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5\"`6My ego can\\'t take much more of this bruising!`5\" exclaims %w.','Bluspring')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5\"`6Why didn\\'t I become a successful doctor like my father suggested?`5\" wonders %w aloud.','Bluspring')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5\"`6Maybe `bnext`b time you won\\'t be so cocky!`5\" laughs %W','Bluspring')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5\"`6A baby could wield a `4%x `6better than that!`5\" %W proclaims.','Bluspring')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5\"`6You should have just stayed in bed,`5\" %W suggests.','Bluspring')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5\"`6Well isn\\'t that a kick in the crotch?!`5\" %w observes.','Bluspring')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5\"`6Come back when you learn how to fight,`5\" %W scoffs.','Bluspring')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5\"`6Next time, eat your Wheaties,`5\" %W suggests.','Bluspring')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5 \"`6You are dishonorable, `4%W`6!`5\" %w cries.','Bluspring')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5\"`4%w`6, your lack of posture is a disgrace,`5\" %W states. ','Bluspring')",
"INSERT INTO " . db_prefix("taunts") . " VALUES (0,'`5\"`6You know, `4%w`6 really had it coming to %s after all those things `bI`b said about `b%p`b mom`5,\" commented %W.','Joe')",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Rake',48,1,0)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Trowel',225,2,0)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Spade',585,3,0)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Adze',990,4,0)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Gardening Hoe',1575,5,0)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Torch',2250,6,0)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Pitchfork',2790,7,0)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Shovel',3420,8,0)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Hedge Trimmers',4230,9,0)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Hatchet',5040,10,0)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Carving Knife',5850,11,0)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Rusty Iron Wood-Chopping Axe',6840,12,0)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Dull Steel Wood-chopping Axe',8010,13,0)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Sharp Steel Wood-chopping Axe',9000,14,0)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Woodsman\\'s Axe',10350,15,0)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Fuzzy Slippers',48,1,0)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Flannel Pajamas',225,2,0)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Homespun Longjohns',585,3,0)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Homespun Undershirt',990,4,0)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Knitted Socks',1575,5,0)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Knitted Gloves',2250,6,0)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Old Leather Boots',2790,7,0)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Homespun Pants',3420,8,0)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Homespun Tunic',4230,9,0)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Gypsy Cape',5040,10,0)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Old Leather Cap',5850,11,0)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Old Leather Bracers',6840,12,0)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Traveller\\'s Shield',8010,13,0)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Old Leather Pants',9000,14,0)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Old Leather Tunic',10350,15,0)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Pebbles',48,1,1)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Stones',225,2,1)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Rocks',585,3,1)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Small Treebranch',990,4,1)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Large Treebranch',1575,5,1)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Thickly Padded Sparring Pole',2250,6,1)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Thinly Padded Sparring Pole',2790,7,1)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Wooden Stave',3420,8,1)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Wooden Practice Sword',4230,9,1)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Blunt Bronze Short Sword',5040,10,1)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Well Crafted Bronze Short Sword',5850,11,1)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Rusty Steel Short Sword',6840,12,1)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Dull Steel Short Sword',8010,13,1)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Sharp Steel Short Sword',9000,14,1)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Pages\\'s Short Sword',10350,15,1)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Flip-Flops',48,1,1)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Swimsuit and Towel',225,2,1)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Cotton Undershirt',585,3,1)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Wool Socks',990,4,1)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Wool Gloves',1575,5,1)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Leather Boots',2250,6,1)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Leather Cap',2790,7,1)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Leather Bracers',3420,8,1)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Leather Leggings',4230,9,1)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Leather Tunic',5040,10,1)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Hooded Leather Cape',5850,11,1)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Deerskin Leggings',6840,12,1)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Deerskin Belt',8010,13,1)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Deerskin Tunic',9000,14,1)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Small Rawhide Shield',10350,15,1)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Dull Bronze Sword',48,1,2)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Bronze Sword',225,2,2)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Well Crafted Bronze Sword',585,3,2)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Dull Iron Sword',990,4,2)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Iron Sword',1575,5,2)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Enchanted Sword',9000,14,2)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Well Crafted Iron Sword',2250,6,2)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Rusty Steel Sword',2790,7,2)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Dull Steel Sword',3420,8,2)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Well Crafted Steel Sword',4230,9,2)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Engraved Steel Sword',5040,10,2)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Steel Sword with Jeweled Hilt',5850,11,2)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Golden Hilted Sword',6840,12,2)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Platinum Hilted Sword',8010,13,2)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Adept\\'s Sword',10350,15,2)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Workboots',48,1,2)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Overalls',225,2,2)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Sturdy Leather Gloves',585,3,2)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Sturdy Leather Bracers',990,4,2)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Sturdy Leather Boots',1575,5,2)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Sturdy Leather Helm',2250,6,2)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Sturdy Leather Pants',2790,7,2)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Sturdy Leather Tunic',3420,8,2)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Sturdy Leather Cloak',4230,9,2)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Woodsman\\'s Helm',5040,10,2)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Woodsman\\'s Gauntlets',5850,11,2)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Woodsman\\'s Bracers',6840,12,2)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Woodsman\\'s Greaves',8010,13,2)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Woodsman\\'s Tunic',9000,14,2)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Woodsman\\'s Kite Shield',10350,15,2)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Steel Longsword',48,1,3)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Etched Steel Longsword',585,3,3)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Polished Steel Longsword',225,2,3)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Well Balanced Steel Longsword',990,4,3)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Perfectly Balanced Steel Longsword',1575,5,3)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Engraved Steel Longsword',2250,6,3)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Longsword with Silver-plated Hilt',2790,7,3)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Longsword with Gold-plated Hilt',3420,8,3)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Longsword with Solid Gold Hilt',4230,9,3)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Longsword with Solid Platinum Hilt',5040,10,3)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Moonsilver Longsword',5850,11,3)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Autumngold Longsword',6840,12,3)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Elfsilver Longsword',8010,13,3)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Enchanted Longsword',9000,14,3)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Wolfmaster\\'s Longsword',10350,15,3)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Showercap and Towel',48,1,3)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Bathrobe',225,2,3)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Wolfskin Gloves',585,3,3)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Wolfskin-lined Boots',990,4,3)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Wolfskin Bracers',1575,5,3)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Wolfskin Pants',2250,6,3)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Wolfskin Tunic',2790,7,3)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Hooded Wolfskin Cape',3420,8,3)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Wolfmaster\\'s Bracers',4230,9,3)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Wolfmaster\\'s Gauntlets',5040,10,3)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Wolfmasters Helm',5850,11,3)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Wolfmaster\\'s Leggings',6840,12,3)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Wolfmaster\\'s Belted Jerkin',8010,13,3)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Wolfhide Cape',9000,14,3)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Shield of the Wolf Master',10350,15,3)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Poorly Balanced Bastard Sword',48,1,4)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Tarnished Bastard Sword',225,2,4)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Iron Bastard Sword',585,3,4)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Steel Bastard Sword',990,4,4)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Well Balanced Steel Bastard Sword',1575,5,4)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Perfectly Balanced Bastard Sword',2250,6,4)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Rune-etched Bastard Sword',2790,7,4)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Bronze-inlay Bastard Sword',3420,8,4)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Silver-inlay Bastard Sword',4230,9,4)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Gold-inlay Bastard Sword',5040,10,4)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Nightsilver Bastard Sword',5850,11,4)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Morning-gold Bastard Sword',6840,12,4)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Truesplendor Bastard Sword',8010,13,4)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Enchanted Elfgold Bastard Sword',9000,14,4)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Noble\\'s Bastard Sword',10350,15,4)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Sweat Pants',48,1,4)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Sweat Shirt',225,2,4)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Studded Leather Helm',585,3,4)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Studded Leather Gauntlets',990,4,4)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Hardened Leather Boots',1575,5,4)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Studded Leather Leggings',2250,6,4)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Studded Leather Tunic',2790,7,4)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Tanner\\'s Cape',3420,8,4)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Rusty Chainmail Helm',4230,9,4)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Rusty Chainmail Gauntlets',5040,10,4)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Rusty Chainmail Bracers',5850,11,4)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Rusty Chainmail Boots',6840,12,4)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Rusty Chainmail Greaves',8010,13,4)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Rusty Chainmail Tunic',9000,14,4)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Large Iron Buckler',10350,15,4)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Tarnished Iron Claymore',48,1,5)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Polished Iron Claymore',225,2,5)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Rusty Steel Claymore',585,3,5)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Steel Claymore',990,4,5)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Finely Crafted Steel Claymore',1575,5,5)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Scottish Broadsword',2250,6,5)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Viking War Sword',2790,7,5)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Barbarian\\'s Sword',3420,8,5)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Scottish Basket-Hilt Claymore',4230,9,5)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Agincourt Steel Sword',5040,10,5)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Celtic Combat Sword',5850,11,5)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Norseman\\'s Sword',6840,12,5)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Knight\\'s Sword',8010,13,5)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Heraldic Lion Claymore',9000,14,5)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Dragon Soldier\\'s Claymore',10350,15,5)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Bunny Slippers',48,1,5)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Feety Pajamas',225,2,5)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Comfortable Leather Undergarments',585,3,5)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Heavy Chainmail Helm',990,4,5)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Heavy Chainmail Gauntlets',1575,5,5)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Heavy Chainmail Bracers',2250,6,5)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Heavy Chainmail Boots',2790,7,5)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Heavy Chainmail Greaves',3420,8,5)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Heavy Chainmail Tunic',4230,9,5)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dragon Soldier\\'s Bracers',5040,10,5)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dragon Soldier\\'s Gauntlets',5850,11,5)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dragon Soldier\\'s Boots',6840,12,5)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dragon Soldier\\'s Greaves',8010,13,5)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dragon Soldier\\'s Chestplate',9000,14,5)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dragon Soldier\\'s Shield',10350,15,5)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Two Broken Short Swords',48,1,6)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Two Short Swords',225,2,6)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Iron Scimitars',585,3,6)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Balanced Scimitars',990,4,6)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Tarnished Steel Scimitars',1575,5,6)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Rusty Steel Scimitars',2250,6,6)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Steel Scimitars',2790,7,6)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Bronze Hilted Steel Scimitars',3420,8,6)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Gold Hilted Steel Scimitars',4230,9,6)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Platinum Hilted Steel Scimitars',5040,10,6)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Well Crafted Adamantite Scimitars',5850,11,6)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Perfectly Crafted Adamantite Scimitars',6840,12,6)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Enchanted Scimitars',8010,13,6)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Drow Crafted Scimitars',9000,14,6)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Unicorn Blood-Forged Scimitars',10350,15,6)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Bluejeans',48,1,6)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Flannel Shirt',225,2,6)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Well Crafted Bronze Helm',585,3,6)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Well Crafted Bronze Gauntlets',990,4,6)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Well Crafted Bronze Bracers',1575,5,6)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Well Crafted Bronze Boots',2250,6,6)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Well Crafted Bronze Greaves',2790,7,6)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Well Crafted Bronze Chestplate',3420,8,6)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Enchanted Bronze Helm',4230,9,6)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Enchanted Bronze Gauntlets',5040,10,6)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Enchanted Bronze Bracers',5850,11,6)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Enchanted Bronze Boots',6840,12,6)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Enchanted Bronze Greaves',8010,13,6)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Enchanted Bronze Chestplate',9000,14,6)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Hooded Unicorn Skin Cloak',10350,15,6)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Chipped Iron Axe',48,1,7)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Iron Axe',225,2,7)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Rusty Steel Axe',585,3,7)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Fine Steel Axe',990,4,7)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Lumberjack\\'s Axe',1575,5,7)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Low Quality Battle Axe',2250,6,7)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Medium Quality Battle Axe',2790,7,7)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'High Quality Battle Axe',3420,8,7)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Double Bladed Axe',4230,9,7)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Double Bladed Battle Axe',5040,10,7)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Gold Plated Battle Axe',5850,11,7)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Platinum Hilted Battle Axe',6840,12,7)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Enchanted Battle Axe',8010,13,7)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Dwarf Smith\\'s Battle Axe',9000,14,7)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Dwarf Warrior\\'s Battle Axe',10350,15,7)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Barrel',48,1,7)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Lampshade',225,2,7)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Perfectly Crafted Steel Helm',585,3,7)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Perfectly Crafted Steel Gauntlets',990,4,7)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Perfectly Crafted Steel Boots',1575,5,7)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Perfectly Crafted Steel Bracers',2250,6,7)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Perfectly Crafted Steel Greaves',2790,7,7)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Perfectly Crafted Steel Chestplate',3420,8,7)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Griffon-Feather Cloak',4230,9,7)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dwarven Chainmail Helm',5040,10,7)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dwarven Chainmail Gauntlets',5850,11,7)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dwarven Chainmail Boots',6840,12,7)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dwarven Chainmail Bracers',8010,13,7)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dwarven Chainmail Greaves',9000,14,7)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dwarven Chainmail Chestplate',10350,15,7)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Broken Iron Mace',48,1,8)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Tarnished Iron Mace',225,2,8)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Polished Iron Mace',585,3,8)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Well Crafted Iron Mace',990,4,8)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Polished Steel Mace',1575,5,8)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Well Crafted Steel Mace',2250,6,8)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Poorly Balanced Double Mace',2790,7,8)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Well Balanced Double Mace',3420,8,8)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Battle Mace',4230,9,8)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'War Chieftain\\'s Battle Mace',5040,10,8)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'War Chieftain\\'s Morning Star',5850,11,8)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Adamantite Morning Star',6840,12,8)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Dwarf Crafted Morning Star',8010,13,8)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Dwarf Warlord\\'s Morning Star',9000,14,8)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Enchanted Morning Star',10350,15,8)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Fig Leaf',48,1,8)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Kilt',225,2,8)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Majestic Gold Helm',585,3,8)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Majestic Gold Gauntlets',990,4,8)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Majestic Gold Boots',1575,5,8)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Bracers',2250,6,8)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Majestic Gold Greaves',2790,7,8)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Majestic Gold Chestplate',3420,8,8)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Majestic Gold Shield',4230,9,8)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Gold-Threaded Cloak',5040,10,8)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Enchanted Ruby Ring',5850,11,8)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Enchanted Sapphire Ring',6840,12,8)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Enchanted Jade Ring',8010,13,8)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Enchanted Amethyst Ring',9000,14,8)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Enchanted Diamond Ring',10350,15,8)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Boot Knife',48,1,9)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Target Knife',225,2,9)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Blackjack',585,3,9)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Throwing Star',990,4,9)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Hira-Shuriken',1575,5,9)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Throwing Spike',2250,6,9)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Atlatl',2790,7,9)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Qilamitautit Bolo',3420,8,9)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'War Quoait',4230,9,9)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Cha Kran',5040,10,9)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Fei Piau',5850,11,9)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Jen Piau',6840,12,9)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Gau dim Piau',8010,13,9)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Enchanted Throwing Axe',9000,14,9)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Teksolo\\'s Ninja Stars',10350,15,9)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Button',48,1,9)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Elven Silk Nightclothes',225,2,9)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Elven Silk Gloves',585,3,9)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Elven Silk Slippers',990,4,9)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Elven Silk Wristband',1575,5,9)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Leggings',2250,6,9)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Elven Silk Tunic',2790,7,9)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Elven Silk Cloak',3420,8,9)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Ring of Night',4230,9,9)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Ring of Day',5040,10,9)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Ring of Solitude',5850,11,9)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Ring of Peace',6840,12,9)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Ring of Courage',8010,13,9)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Ring of Virtue',9000,14,9)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Ring of Life',10350,15,9)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Farmer\\'s Bow & Wooden Arrows',48,1,10)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Farmer\\'s Bow & Stone Tipped Arrows',225,2,10)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Farmer\\'s Bow & Steel Tipped Arrows',585,3,10)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Hunter\\'s Bow & Wooden Arrows',990,4,10)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Hunter\\'s Bow & Stone Tipped Arrows',1575,5,10)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Hunter\\'s Bow & Steel Tipped Arrows',2250,6,10)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Ranger\\'s Bow & Wooden Arrows',2790,7,10)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Ranger\\'s Bow & Stone Tipped Arrows',3420,8,10)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Ranger\\'s Bow & Steel Tipped Arrows',4230,9,10)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Longbow',5040,10,10)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Crossbow',5850,11,10)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Elvish Longbow',6840,12,10)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Elvish Longbow & Flame Tipped Arrows',8010,13,10)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Elvish Longbow & Enchanted Arrows',9000,14,10)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Longbow of the Elf King',10350,15,10)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Pegasus\\' Hooded Cloak',5040,10,10)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Pegasus\\' Chestplate',4230,9,10)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Pegasus\\' Greaves',3420,8,10)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Pegasus\\' Boots',2790,7,10)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Pegasus\\' Gorget',2250,6,10)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Pegasus\\' Bracers',1575,5,10)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Pegasus\\' Gauntlets',990,4,10)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Pegasus\\' Helm',585,3,10)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Platform Shoes',225,2,10)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Leisure Suit',48,1,10)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Pegasus Feather Pendant',5850,11,10)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Pegasus Feather Belt',6840,12,10)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Pegasus\\' Emblazoned Shield',8010,13,10)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Pegasus\\' Emblazoned Ring',9000,14,10)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Pegasus\\' Emblazoned Crown',10350,15,10)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'MightyE\\'s Long Sword',225,2,11)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'MightyE\\'s Short Sword',48,1,11)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'MightyE\\'s Bastard Sword',585,3,11)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'MightyE\\'s Scimitars',990,4,11)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'MightyE\\'s Battle Axe',1575,5,11)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'MightyE\\'s Throwing Hammer',2250,6,11)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'MightyE\\'s Morning Star',2790,7,11)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'MightyE\\'s Compound Bow',3420,8,11)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'MightyE\\'s Rapier',4230,9,11)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'MightyE\\'s Sabre',5040,10,11)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'MightyE\\'s Light Sabre',5850,11,11)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'MightyE\\'s Wakizashi',6840,12,11)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'MightyE\\'s 2-Handed War Sword',8010,13,11)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'MightyE\\'s 2-handed War Axe',9000,14,11)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'MightyE\\'s Claymore',10350,15,11)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'New Clothes',48,1,11)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Chicken Suit',225,2,11)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Gauntlets of Grace',585,3,11)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Bracer of Beauty',990,4,11)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Helm of Health',1575,5,11)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Greaves of Good Fortune',2250,6,11)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Boots of Bravery',2790,7,11)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Tunic of Tolerance',3420,8,11)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Cloak of Confidence',4230,9,11)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Ring of Righteousness',5040,10,11)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Necklace of Narcissism',5850,11,11)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Pendant of Power',6840,12,11)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Breastplate of Benevolence',8010,13,11)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Shield of Superiority',9000,14,11)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Scepter of Strength',10350,15,11)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Spell of Fire',48,1,12)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Spell of Earthquake',225,2,12)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Spell of Flood',585,3,12)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Spell of Hurricane',990,4,12)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Spell of Mind Control',1575,5,12)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Spell of Lightning',2250,6,12)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Spell of Weakness',2790,7,12)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Spell of Fear',3420,8,12)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Spell of Poison',4230,9,12)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Spell of Spirit Possession',5040,10,12)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Spell of Despair',5850,11,12)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Spell of Bat Summoning',6840,12,12)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Spell of Wolf Summoning',8010,13,12)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Spell of Unicorn Summoning',9000,14,12)",
"INSERT INTO " . db_prefix("weapons") . " VALUES (0,'Spell of Dragon Summoning',10350,15,12)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dragon Skin Leather Helm',48,1,12)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dragon Skin Leather Gauntlets',225,2,12)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dragon Skin Leather Boots',585,3,12)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dragon Skin Leather Bracers',990,4,12)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dragon Skin Leather Leggings',1575,5,12)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dragon Skin Leather Tunic',2250,6,12)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dragon Skin Leather Cloak',2790,7,12)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dragon Scale Helm',3420,8,12)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dragon Scale Gauntlets',4230,9,12)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dragon Scale Boots',5040,10,12)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dragon Scale Bracers',5850,11,12)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dragon Scale Greaves',6840,12,12)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dragon Scale Chestplate',8010,13,12)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dragon Scale Cloak',9000,14,12)",
"INSERT INTO " . db_prefix("armor") . " VALUES (0,'Dragon Talon Shield',10350,15,12)",
),
"0.9.2"=>array(
),
"0.9.3"=>array(),
"0.9.4"=>array(),
"0.9.5"=>array(),
"0.9.6"=>array(
),
"0.9.7"=>array(
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (220, 'Frenzied vampire bats', 15, 'Numerous attacks', 'Why are there so many darn bats in this forest?', NULL, 531, 189, 155, 29, 21, NULL, 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (221, 'Vampirus,the Bat God', 16, 'Godly Power', 'You are even more god-like then he!', '', 563, 207, 166, 31, 22, '', 'Appleshiner', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (222, 'Old Man Winter', 9, 'Bitter Cold', 'You shake your fist over his dead, pathetic corpse.', NULL, 336, 101, 94, 17, 13, NULL, NULL, 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (223, 'Deranged Gnome', 1, 'A Cloth Draped Mirror', 'What happens when I do THIS?', NULL, 36, 14, 10, 1, 1, NULL, NULL, 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (224, 'Water Sprite', 1, 'Burst of Water', 'That was refreshing.', NULL, 36, 14, 10, 1, 1, NULL, NULL, 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (225, 'Water Nymph', 3, 'A torrent of water', 'I didn''t need a bath, thank you.', NULL, 148, 34, 32, 5, 4, NULL, NULL, 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (226, 'Lady of the Lake', 10, 'Excalibur', 'Take that, you watery tart!', NULL, 369, 114, 105, 19, 14, NULL, NULL, 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (227, 'Cunning Sapling', 1, 'Arrrr!', 'Ah Ha! A toothpick!', NULL, 36, 14, 10, 1, 1, NULL, NULL, 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (228, 'Pirate Tree', 5, 'A loud ARRRRR!', 'Arrrrrr! indeed.', NULL, 198, 55, 53, 9, 7, NULL, NULL, 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (229, 'Undead Centurion', 5, 'Bronze Spear', 'Hmm Not too good at combat the second time around, either.', NULL, 198, 55, 53, 9, 7, NULL, NULL, 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (230, 'Insane Bard', 2, 'Iambic Pentameter', 'Slings and Arrows of outrageous fortune? Nope. Just the can o'' Whoopass.', NULL, 97, 24, 21, 3, 3, NULL, NULL, 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (231, 'Twig Man', 1, 'Brambles and Briars', 'I snapped him like a.. well, twig.', NULL, 36, 14, 10, 1, 1, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (232, 'Rabid Mouse', 1, 'Little Bitty Teeth', 'Those little teeth HURT!', NULL, 36, 14, 10, 1, 1, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (233, 'Stray Cat', 1, 'A Midnight Serenade', 'Finally! Peace in the night!', NULL, 36, 14, 10, 1, 1, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (234, 'Big Hairy Spider', 1, 'Sticky stringy webs', 'I *HATE* spiders!', NULL, 36, 14, 10, 1, 1, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (235, 'Goblin Lackey', 1, 'Dull Knife', 'Who knew goblins had lackeys?', NULL, 36, 14, 10, 1, 1, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (236, 'Crazy Chihuahua', 1, 'Fast food cravings', 'Here taco, taco, taco.', '', 36, 14, 10, 1, 1, '', 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (237, 'Looney Rabbit', 1, 'Wisecracks', 'Th- Th- That''s all folks!', NULL, 36, 14, 10, 1, 1, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (238, 'Undead Oarsman', 1, 'Rotten Oar', 'Funny... I didn''t see any water around here.', '', 36, 14, 10, 1, 1, '', 'Hank', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (239, 'Lost Ghostling', 2, 'Sad Weeping', 'Well, I''m sure that helped him on his way...', '', 97, 24, 21, 3, 3, '', 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (240, 'Angry Titmouse', 2, 'Incessant Chattering', 'You swat the little bird out of the air with little effort.', '', 97, 24, 21, 3, 3, '', 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (241, 'Fabianist Youth Member', 2, 'Marxist Doctrine', 'Socialize THAT.', NULL, 97, 24, 21, 3, 3, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (242, 'Little Bogeyman', 2, 'Noises in the Dark', 'Hmm, not so scary when you have grown up...', '', 97, 24, 21, 3, 3, '', 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (243, 'Big Bogeyman', 3, 'Fingers poking you as you sleep.', 'Ok... that was weird. But not scary... Nope not at all... I think I''ll leave the light on at the inn tonight though.', '', 148, 34, 32, 5, 4, '', 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (244, 'Coblynau', 2, 'Ill tempered tricks', 'Maybe I better leave him part of my lunch next time.', '', 97, 24, 21, 3, 3, '', 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (245, 'Jack O''Lantern', 2, 'Eternal Wandering', 'The light has gone out of his life.', NULL, 97, 24, 21, 3, 3, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (246, 'Fresh Ghoul', 2, 'Long Pointed Nails', 'You leave him to the mercies of the other ghouls.', '', 97, 24, 21, 3, 3, '', 'Hank', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (247, 'Dry Skeleton', 2, 'a Rusty Dagger', 'The skeleton crumbles into a pile of dust.', NULL, 97, 24, 21, 3, 3, NULL, 'Hank', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (248, 'Newly Dead Zombie', 2, 'Fists', 'Maybe now it can rest in peace.', NULL, 97, 24, 21, 3, 3, NULL, 'Hank', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (249, 'Faerie hound', 2, 'Glowing Eyes', 'The embers in the eye sockets dim and sputter out.', NULL, 97, 24, 21, 3, 3, NULL, 'Hank', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (250, 'Apprentice Necromancer', 3, 'Life Draining Spells', 'He gasps a final breath and melts into a tarry liquid.', NULL, 148, 34, 32, 5, 4, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (251, 'Doppleganger', 3, 'Shape changing', 'You kill the doppleganger and he returns to his true form.', NULL, 148, 34, 32, 5, 4, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (252, 'Forest Thief', 3, 'Poisoned Short Sword', 'His pockets were almost empty. I guess he wasn''t much of a thief.', '', 148, 34, 32, 5, 4, '', 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (253, 'Mouldy Skeleton', 3, 'Rotten Fists', 'Heeeeey, didn''t you see him in town last week?', NULL, 148, 34, 32, 5, 4, NULL, 'Hank', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (254, 'Angry Fairy', 3, 'Furious Fairy Dust', 'He disappears in a cloud of fairy dust.', NULL, 148, 34, 32, 5, 4, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (255, 'Goblin Hunter', 3, 'a Shortbow', 'Only one? Don''t they usually travel in packs?', NULL, 148, 34, 32, 5, 4, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (256, 'Bobcat Cub', 3, 'Sharp Claws', 'Even the cute fuzzy kittens are evil in this place.', NULL, 148, 34, 32, 5, 4, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (257, 'Animate Junkheap', 3, 'Stench of 1000 rotten potatoes', 'Just call you the De-Animator!', NULL, 148, 34, 32, 5, 4, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (258, 'Necromancer', 4, 'Strength Draining Touch', 'In a cloud of black smoke, his body wafts away on the breeze.', '', 162, 45, 43, 7, 6, '', 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (259, 'Reed Golem', 4, 'Fists of Thorns', 'The only thing left was a tiny bale of hay.', NULL, 162, 45, 43, 7, 6, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (260, 'Goblin Shaman', 4, 'Primitive Magic', '\"Oooga Booga,\" indeed.', NULL, 162, 45, 43, 7, 6, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (261, 'Steam Spirit', 4, 'Scalding Steam', 'Not so hot now, eh?', NULL, 162, 45, 43, 7, 6, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (262, 'Restless Zombie', 4, 'Broken Longsword', 'Finally he is at peace.', NULL, 162, 45, 43, 7, 6, NULL, 'Hank', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (263, 'Zombie Soldier', 4, 'Rusted Spear', 'His final orders were to march to hell.', '', 162, 45, 43, 7, 6, '', 'Hank', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (264, 'Dark Imp', 4, 'Nagging Doubts', 'The imp implodes in a ball of flame.', NULL, 162, 45, 43, 7, 6, NULL, 'Hank', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (265, 'Giant Spider', 4, 'Fangs that glisten with poison', 'I really, really hate spiders.', '', 162, 45, 43, 7, 6, '', 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (266, 'Undead Kitten', 4, 'Mews of Doom', 'Another evil cat sent to hell C.O.D.', NULL, 162, 45, 43, 7, 6, NULL, 'Hank', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (267, 'Flying Dagger', 4, 'Sharpened Steel Point', 'The dagger shatters when it hits the ground.', NULL, 162, 45, 43, 7, 6, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (268, 'Goblin Warrior', 5, 'Bent Short Sword', 'Gone... and forgotten.', '', 198, 55, 53, 9, 7, '', 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (269, 'Experienced Necromancer', 5, 'a small group of Zombies', 'The necromancer turns into a pile of black sand and blows away.', NULL, 198, 55, 53, 9, 7, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (270, 'Flame Sprite', 5, 'Searing Flame', 'You cooled him off in a hurry...', NULL, 198, 55, 53, 9, 7, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (271, 'Mud Man', 5, 'Enchanted Mud', 'Defeated, the Mud Man dries up in the warm sun.', NULL, 198, 55, 53, 9, 7, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (272, 'Lupe the Hypnotic Chihuahua', 5, 'The stare of doom', 'You manage to break free of those deep hypnotic eyes...', NULL, 198, 55, 53, 9, 7, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (273, 'Ghoul', 5, 'Hunger for Flesh', 'The ghoul falls to the ground, a bit of flesh between his teeth.', NULL, 198, 55, 53, 9, 7, NULL, 'Hank', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (274, 'Seedy Cutthroat', 5, 'Sharpened Daggers', 'One more bandit removed from this forest.', NULL, 198, 55, 53, 9, 7, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (275, 'Ogre', 5, 'Broken treebranch', 'Boy, thats a face not even a mother could love.', NULL, 198, 55, 53, 9, 7, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (276, 'Crazy Woodsman', 5, 'Dull axe', 'Chopped him down to size...', NULL, 198, 55, 53, 9, 7, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (277, 'Flying Drakeling', 5, 'a Lashing Tail', 'You swat the small, majestic beast out of the air.', NULL, 198, 55, 53, 9, 7, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (278, 'Forest Cat', 6, 'Menacing Claws', 'Here kitty, kitty, kitty.', '', 234, 66, 64, 11, 8, '', 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (279, 'Journeyman Necromancer', 6, 'An Undead Giant', 'The necromancer drifts away on a cloud of black smoke.', '', 234, 66, 64, 11, 8, '', 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (280, 'Frigid Skeleton', 6, 'The Cold of the Grave', 'I''ll bet one of these guys could cool ale at the inn.', '', 234, 66, 64, 11, 8, '', 'Hank', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (281, 'Frost Spirit', 6, 'Bone Chilling Cold', 'Puttin down another cold one.', '', 234, 66, 64, 11, 8, '', 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (282, 'Dragon Slayer''s ghost', 6, 'Warnings of Doom', 'Everybody wondered what happened to him.', NULL, 234, 66, 64, 11, 8, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (283, 'Ettin Mage', 6, 'Double threat spells', 'Two heads are not better than one in this case. Just more to lop off.', '', 234, 66, 64, 11, 8, '', 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (284, 'Insane Brownie', 6, 'Faerie spells', 'This one''s nuts!', NULL, 234, 66, 64, 11, 8, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (285, 'Ghostly Wolfpack', 6, 'Ghostly Howls', 'Quiet settles in around you. Finally.', NULL, 234, 66, 64, 11, 8, NULL, 'Hank', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (286, 'Wood Golem', 6, 'Oaken Fists', 'The truth gave you life and the truth set you free.', '', 234, 66, 64, 11, 8, '', 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (287, 'Diseased Ent', 6, 'Twisted Branches', 'There must be fifty ways to cut your lumber. (Groan)', '', 234, 66, 64, 11, 8, '', 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (288, 'Dark Druid', 7, 'Corrupted Nature', 'He lost me at the corrupt it to save it part.', NULL, 268, 77, 74, 13, 10, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (289, 'Lizard Man Scout', 7, 'Marginal Archery', 'I know where I can get him made into a nice pair of boots.', '', 268, 77, 74, 13, 10, '', 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (290, 'Diabolic Footman', 7, 'A Demon Forged Mace', 'His armor sizzles and he melts as he crumples to the ground.', NULL, 268, 77, 74, 13, 10, NULL, 'Hank', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (291, 'Gargantuan Tree Spider', 7, 'Projectile Webbing', 'After you lop him in half, you realize he''s not so big.', NULL, 268, 77, 74, 13, 10, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (292, 'Flaming Zombie', 7, 'Fists covered in Flame', 'You extinguish the flame of life and the zombie falls to the ground, smoking.', NULL, 268, 77, 74, 13, 10, NULL, 'Hank', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (293, 'Eldritch Wizard', 7, 'Spells of Darkness', 'You slice him in two only to watch his body disappear, leaving an empty robe behind.', NULL, 268, 77, 74, 13, 10, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (294, 'Master Necromancer', 7, 'An Army of the Dead', 'You kill the necromancer and his minions disintegrate before your eyes.', NULL, 268, 77, 74, 13, 10, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (295, 'Animate Darkness', 7, 'The Darkness of a Thousand Nights', 'Light Slowly returns to this part of the forest.', '', 268, 77, 74, 13, 10, '', 'Hank', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (296, 'Temple Guardian Statue', 7, 'Marble Fists', 'So, where''s the temple?', NULL, 268, 77, 74, 13, 10, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (297, 'Owlbear', 7, 'Claws and a bearhug', 'I don''t even want to know how they breed these.', '', 268, 77, 74, 13, 10, '', 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (298, 'The Man In Black', 8, 'Necromantic Spells', 'Finally, I got my chance to kill him.', '', 302, 89, 84, 15, 11, '', 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (299, 'Gnome Illusionist', 8, 'Fearsome Illusions', 'It was all in his head.', '', 302, 89, 84, 15, 11, '', 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (300, 'Demon Skeleton', 8, 'Diabolic Runes', 'The spirits of its victims drag the skeleton back to hell.', '', 302, 89, 84, 15, 11, '', 'Hank', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (301, 'Insane Master Druid', 8, 'The land Itself', 'His evil laughter dies with him.', NULL, 302, 89, 84, 15, 11, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (302, 'Water Elementalist', 8, 'Water Based Spells', 'He''s all wet.', NULL, 302, 89, 84, 15, 11, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (303, 'Earth Elementalist', 8, 'Earth Based Spells', 'He fought kind of Dirty.', '', 302, 89, 84, 15, 11, '', 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (304, 'Ettin Warrior', 8, 'Two Clubs of Iron', 'They did all right until they hit each other.', NULL, 302, 89, 84, 15, 11, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (305, 'Forest Giant', 8, 'An Uprooted Tree', 'Ho, Ho, Ho that, green man.', NULL, 302, 89, 84, 15, 11, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (306, 'Demoniac Knight', 8, 'A Diabolic Lance', 'Good night, Sir Knight.', '', 302, 89, 84, 15, 11, '', 'Hank', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (307, 'Giant Zombie', 8, 'Gigantic Fists', 'They DO smell worse when they are bigger!', NULL, 302, 89, 84, 15, 11, NULL, 'Hank', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (308, 'Frost Spectre', 9, 'The Chill Touch of the Grave', 'As you recover from the fight, the Spectre melts away into the shadows.', NULL, 336, 101, 94, 17, 13, NULL, 'Hank', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (309, 'Small Forest Dragon', 9, 'Snapping Jaws', 'Dragon? Check. Green? Check. Huge? Nope.', '', 336, 101, 94, 17, 13, '', 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (310, 'A Pack of Carnivorous Lemurs', 9, 'Hoots and Howls', 'What the heck is a Lemur??', NULL, 336, 101, 94, 17, 13, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (311, 'Albino Crypt Bear', 9, 'Foul Stench and Claws', 'You dispatch the bear and wonder if there are more lurking about.', NULL, 336, 101, 94, 17, 13, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (312, 'Black Knight of The Vale', 9, 'Ebony Sword', 'As he dies, he curses you and tells you that you will never defeat the dragon.', NULL, 336, 101, 94, 17, 13, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (313, 'Elmearian Spy', 9, 'Small Dagger', 'He eats his information before he dies, so you learn nothing from him.', NULL, 336, 101, 94, 17, 13, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (314, 'Stalking Shadow', 9, 'Fingers of Darkness', 'You send the ceature back to where it came from.', NULL, 336, 101, 94, 17, 13, NULL, 'Hank', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (315, 'Necromantic Archmagus', 9, 'Screams of a Thousand Souls', 'With his dying breath he explodes into a pillar of black flame!', NULL, 336, 101, 94, 17, 13, NULL, 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (316, 'Iron Golem', 9, 'Rusted Fists', 'The golem seizes up and you push him over.', '', 336, 101, 94, 17, 13, '', 'Hank', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (317, 'A Hell Hound', 9, 'Fiery Breath', 'He bursts into flames and is sucked into the earth.', NULL, 336, 101, 94, 17, 13, NULL, 'Hank', 1, 1, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (318, 'Corporate Lackey', 7, 'Buzzwords', 'Well, you sure reprioritized his downsizing.', NULL, 268, 77, 74, 13, 10, NULL, 'Moonchilde', 1, 0, NULL)",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields VALUES (319, 'SCO Lawyer', 8, 'Court Papers', 'There''s one lawyer who''ll never trouble you again!', NULL, 302, 89, 84, 15, 11, NULL, 'Moonchilde', 1, 1, NULL)",
'INSERT INTO ' . db_prefix("nastywords") . ' VALUES ("*damn* *dyke *fuck* *nigger* *phuck* *shit* amcik andskota arschloch arse* ass asshole atouche ayir bastard bitch* boiolas bollock* buceta butt* butt-pirate cabron cawk cazzo chink chraa chuj cipa clit cock* cum cunt* dago daygo dego dick* dike dildo dirsa dupa dziwka ejaculate ejackulate ekrem* ekto enculer faen fag* fanculo fanny fatass fcuk feces feg felcher ficken fitta fitte flikker foreskin phuck fuk* fut futkretzn fuxor gay gook guiena hell helvete hoer* honkey honky hor hore huevon hui injun jism jizz kanker* kawk kike klootzak knulle kraut kuk kuksuger kurac kurwa kusi* kyrp<72>* leitch lesbian lesbo mamhoon masturbat* merd merde mibun monkleigh mouliewop muie mulkku muschi nazis nepesaurio nigga* nigger nutsack orospu paska* pendejo penis perse phuck picka pierdol* pillu* pimmel pimpis piss* pizda poontsee poop porn preteen preud prick pron pula pule pusse pussy puta puto qahbeh queef* queer* qweef rautenberg schaffer scheiss* scheisse schlampe schmuck screw scrotum sharmuta sharmute shemale shipal shiz skribz skurwysyn slut smut sphencter shpincter spic spierdalaj splooge suka teets teez testicle tits titties titty twat twaty vittu votze wank* wetback* whoar whore wichser woose wop yed zabourah", "nasty")',
"INSERT INTO " . db_prefix("mounts") . " VALUES (1, 'Pony', 'This docile beast is young yet.', 'Horses', 'a:5:{s:4:\"name\";s:13:\"`&Pony Attack\";s:8:\"roundmsg\";s:26:\"Your pony fights with you!\";s:6:\"rounds\";s:2:\"20\";s:6:\"atkmod\";s:3:\"1.2\";s:8:\"activate\";s:7:\"offense\";}', 6, 0, 1, 1, 'You strap your {weapon} to your pony\\'s saddle bags, and head out for some adventure!', '`&Remembering that is has been quite some time since you last fed your pony, you decide this is a perfect time to relax and allow it to graze the field a bit. You doze off enjoying this peaceful serenity.`0', '`&You dismount in the field to allow your pony to graze for a moment even though it has recently been fully fed. As you lean back in the grass to watch the clouds, your pony whickers softly and trots off into the underbrush. You search for a while before returning to the fields hoping that it\\'ll return. A short time later, your pony trots back into the clearing holding its head high, looking much more energized and with a very equine grin on its face.`0', 20, 'all', 0)",
"INSERT INTO " . db_prefix("mounts") . " VALUES (2, 'Gelding', 'This powerful beast is fiercely loyal.', 'Horses', 'a:5:{s:4:\"name\";s:16:\"`&Gelding Attack\";s:8:\"roundmsg\";s:29:\"Your gelding fights with you!\";s:6:\"rounds\";s:2:\"40\";s:6:\"atkmod\";s:3:\"1.2\";s:8:\"activate\";s:7:\"offense\";}', 10, 0, 1, 2, 'You strap your {weapon} to your gelding\\'s saddle bags, and head out for some adventure!', '`&Remembering that is has been quite some time since you last fed your gelding, you decide this is a perfect time to relax and allow it to graze the field a bit. You doze off enjoying this peaceful serenity.`0', '`&You dismount in the field to allow your gelding to graze for a moment even though it has recently been fully fed. As you lean back in the grass to watch the clouds, your gelding whickers softly and trots off into the underbrush. You search for a while before returning to the fields hoping that it\\'ll return. A short time later, your gelding trots back into the clearing holding its head high, looking much more energized and with a very equine grin on its face.`n`nAnd here you thought geldings weren\\'t equipped that way any longer!`0', 25, 'all', 0)",
"INSERT INTO " . db_prefix("mounts") . " VALUES (3, 'Stallion', 'This noble beast is huge and powerful!', 'Horses', 'a:5:{s:4:\"name\";s:17:\"`&Stallion Attack\";s:8:\"roundmsg\";s:30:\"Your stallion fights with you!\";s:6:\"rounds\";s:2:\"60\";s:6:\"atkmod\";s:3:\"1.2\";s:8:\"activate\";s:7:\"offense\";}', 16, 0, 1, 3, 'You strap your {weapon} to your stallion\\'s saddle bags, and head out for some adventure!', '`&Remembering that is has been quite some time since you last fed your stallion, you decide this is a perfect time to relax and allow it to graze the field a bit. You doze off enjoying this peaceful serenity.`0', '`&You dismount in the field to allow your stallion to graze for a moment even though it has recently been fully fed. As you lean back in the grass to watch the clouds, your stallion whickers softly and trots off into the underbrush. You search for a while before returning to the fields hoping that it\\'ll return. A short time later, your stallion trots back into the clearing holding its head high, looking much more energized and with a very equine grin on its face.`0', 30, 'all', 0)",
),
"0.9.8-prerelease.1"=>array(
"UPDATE " . db_prefix("petitions") . " SET closedate = date WHERE status=2",
"UPDATE " . db_prefix("masters") . " SET creaturewin='Learn to adapt your style, and you shall prevail.' WHERE creaturename='Sensei Noetha'",
"UPDATE " . db_prefix("logdnet") . " SET lastping=lastupdate",
"UPDATE " . db_prefix("accounts") . " SET attack=attack-1,race=\"Troll\" WHERE race='1'",
"UPDATE " . db_prefix("accounts") . " SET defense=defense-1,race=\"Elf\" WHERE race='2'",
"UPDATE " . db_prefix("accounts") . " SET race=\"Human\" WHERE race='3'",
"UPDATE " . db_prefix("accounts") . " SET race=\"Dwarf\" WHERE race='4'",
"UPDATE " . db_prefix("accounts") . " SET race=\"Horrible Gelatinous Blob\" WHERE race='0'",
"UPDATE " . db_prefix("accounts") . " SET location=\"The Boar's Head Inn\" WHERE location='1'",
"UPDATE " . db_prefix("accounts") . " SET location=\"Degolburg\" WHERE location='0'",
"UPDATE " . db_prefix("accounts") . " SET password=md5(password) WHERE length(password) < 32",
"UPDATE " . db_prefix("accounts") . " SET password=md5(password)",
"UPDATE " . db_prefix("nastywords") . " SET type='nasty'",
),
"0.9.8-prerelease.2"=>array(),
"0.9.8-prerelease.3"=>array(),
"0.9.8-prerelease.4"=>array(),
"0.9.8-prerelease.5"=>array(),
"0.9.8-prerelease.6"=>array(
"REPLACE INTO " . db_prefix("masters") . " VALUES (1,'Mireraband',1,'Small Dagger','Well done %w`&, I should have guessed you\\'d grown some.','As I thought, %w`^, your skills are no match for my own!',NULL,NULL,12,2,2)",
"REPLACE INTO " . db_prefix("masters") . " VALUES (2,'Fie',2,'Short Sword','Well done %w`&, you really know how to use your %x.','You should have known you were no match for my %X',NULL,NULL,22,4,4)",
"REPLACE INTO " . db_prefix("masters") . " VALUES (4,'Guth',4,'Spiked Club','Ha! Hahaha, excellent fight %w`&! Haven\\'t had a battle like that since I was in the RAF!','Back in the RAF, we\\'d have eaten the likes of you alive! Go work on your skills some old boy!',NULL,NULL,44,8,8)",
"REPLACE INTO " . db_prefix("masters") . " VALUES (6,'Adwares',6,'Dwarven Battle Axe','Ach! Y\\' do hold yer %x with skeel!','Har! Y\\' do be needin moore praktise y\\' wee cub!',NULL,NULL,66,12,12)",
"REPLACE INTO " . db_prefix("masters") . " VALUES (8,'Ceiloth',8,'Orkos Broadsword','Well done %w`&, I can see that great things lie in the future for you!','You are becoming powerful, but not yet that powerful.',NULL,NULL,88,16,16)",
"REPLACE INTO " . db_prefix("masters") . " VALUES (9,'Dwiredan',9,'Twin Swords','Perhaps I should have considered your %x...','Perhaps you\\'ll reconsider my twin swords before you try that again?',NULL,NULL,99,18,18)",
),
"0.9.8-prerelease.7"=>array(),
"0.9.8-prerelease.8"=>array(),
"0.9.8-prerelease.9"=>array(),
"0.9.8-prerelease.10"=>array(),
"0.9.8-prerelease.11"=>array(
"UPDATE " . db_prefix("accounts") . " SET specialty='' WHERE specialty='0'",
),
"0.9.8-prerelease.12"=>array(
"1|UPDATE " . db_prefix("creatures") . " SET forest=1",
"1|UPDATE " . db_prefix("creatures") . " SET graveyard=1 where location=1",
),
"0.9.8-prerelease.13"=>array(),
"0.9.8-prerelease.14"=>array(),
"0.9.8-prerelease.14a"=>array(
"INSERT INTO " . db_prefix("titles") . " VALUES (1, 0, '', 'Farmboy', 'Farmgirl')",
"INSERT INTO " . db_prefix("titles") . " VALUES (2, 1, '', 'Page', 'Page')",
"INSERT INTO " . db_prefix("titles") . " VALUES (3, 2, '', 'Squire', 'Squire')",
"INSERT INTO " . db_prefix("titles") . " VALUES (4, 3, '', 'Gladiator', 'Gladiatrix')",
"INSERT INTO " . db_prefix("titles") . " VALUES (5, 4, '', 'Legionnaire', 'Legioness')",
"INSERT INTO " . db_prefix("titles") . " VALUES (6, 5, '', 'Centurion', 'Centurioness')",
"INSERT INTO " . db_prefix("titles") . " VALUES (7, 6, '', 'Sir', 'Madam')",
"INSERT INTO " . db_prefix("titles") . " VALUES (8, 7, '', 'Reeve', 'Reeve')",
"INSERT INTO " . db_prefix("titles") . " VALUES (9, 8, '', 'Steward', 'Steward')",
"INSERT INTO " . db_prefix("titles") . " VALUES (10, 9, '', 'Mayor', 'Mayoress')",
"INSERT INTO " . db_prefix("titles") . " VALUES (11, 10, '', 'Baron', 'Baroness')",
"INSERT INTO " . db_prefix("titles") . " VALUES (12, 11, '', 'Count', 'Countess')",
"INSERT INTO " . db_prefix("titles") . " VALUES (13, 12, '', 'Viscount', 'Viscountess')",
"INSERT INTO " . db_prefix("titles") . " VALUES (14, 13, '', 'Marquis', 'Marchioness')",
"INSERT INTO " . db_prefix("titles") . " VALUES (15, 14, '', 'Chancellor', 'Chancelloress')",
"INSERT INTO " . db_prefix("titles") . " VALUES (16, 15, '', 'Prince', 'Princess')",
"INSERT INTO " . db_prefix("titles") . " VALUES (17, 16, '', 'King', 'Queen')",
"INSERT INTO " . db_prefix("titles") . " VALUES (18, 17, '', 'Emperor', 'Empress')",
"INSERT INTO " . db_prefix("titles") . " VALUES (19, 18, '', 'Angel', 'Angel')",
"INSERT INTO " . db_prefix("titles") . " VALUES (20, 19, '', 'Archangel', 'Archangel')",
"INSERT INTO " . db_prefix("titles") . " VALUES (21, 20, '', 'Principality', 'Principality')",
"INSERT INTO " . db_prefix("titles") . " VALUES (22, 21, '', 'Power', 'Power')",
"INSERT INTO " . db_prefix("titles") . " VALUES (23, 22, '', 'Virtue', 'Virtue')",
"INSERT INTO " . db_prefix("titles") . " VALUES (24, 23, '', 'Dominion', 'Dominion')",
"INSERT INTO " . db_prefix("titles") . " VALUES (25, 24, '', 'Throne', 'Throne')",
"INSERT INTO " . db_prefix("titles") . " VALUES (26, 25, '', 'Cherub', 'Cherub')",
"INSERT INTO " . db_prefix("titles") . " VALUES (27, 26, '', 'Seraph', 'Seraph')",
"INSERT INTO " . db_prefix("titles") . " VALUES (28, 27, '', 'Demigod', 'Demigoddess')",
"INSERT INTO " . db_prefix("titles") . " VALUES (29, 28, '', 'Titan', 'Titaness')",
"INSERT INTO " . db_prefix("titles") . " VALUES (30, 29, '', 'Archtitan', 'Archtitaness')",
"INSERT INTO " . db_prefix("titles") . " VALUES (31, 30, '', 'Undergod', 'Undergoddess')",
"INSERT INTO " . db_prefix("titles") . " VALUES (32, 31, '', 'God', 'Goddess')",
),
"1.0.0"=>array(),
"1.0.1"=>array(),
"1.0.2"=>array(),
"1.0.3"=>array(),
"1.0.4"=>array(),
"1.0.5"=>array(),
"1.0.6"=>array(),
"1.1.0 Dragonprime Edition"=>array(
"UPDATE " . db_prefix("accounts") . " SET clanrank = clanrank * 10",
"INSERT INTO " . db_prefix("settings") . " VALUES ('newdaycron', '0')",
"INSERT INTO " . db_prefix("settings") . " VALUES ('charset', 'ISO-8859-1')",
"INSERT INTO " . db_prefix("settings") . " VALUES ('allowspecialswitch', '1')",
),
"1.1.1 Dragonprime Edition"=>array(
"INSERT INTO " . db_prefix("settings") . " VALUES ('allowclans','1')",
"INSERT INTO " . db_prefix("settings") . " VALUES ('resurrectionturns','-6')",
"DROP TABLE IF EXISTS " . db_prefix("module_navhooks") . ";",
"DROP TABLE IF EXISTS " . db_prefix("module_pagehooks") . ";",
"DROP TABLE IF EXISTS " . db_prefix("module_settingdesc") . ";",
"DROP TABLE IF EXISTS " . db_prefix("module_prefdesc") . ";",
"DROP TABLE IF EXISTS " . db_prefix("items") . ";",
"ALTER TABLE " . db_prefix("creatures"). " DROP oldcreatureexp;",
"INSERT INTO " . db_prefix("settings") . " VALUES ('serverlanguages','en,English,fr,Fran<61>ais,dk,Danish,de,Deutsch,es,Espa<70>ol,it,Italian')",
"INSERT INTO " . db_prefix("creatures") . " $creaturefields111 VALUES (320, 'Gypsy Bandit', 14, 'Gemmed Dagger', 'That will put an end to his thieving days.', 'You''re dead, he''s free to take what he will.', 499, 172, 145, 27, 20, 'global \$badguy, \$session;\r\n\r\nif (!isset(\$badguy[\\'spellpoints\\'])) {\r\n \$badguy[\\'spellpoints\\'] = 1;\r\n}\r\n\r\n\$gold = round(\$session[\\'user\\'][\\'gold\\'] * 0.2);\r\nif (e_rand(0,7) == 0 && \$gold > 200 && \$badguy[\\'spellpoints\\'] == 1) {\r\n rawoutput(\"<br /><b><span style=''color: white''>The pickpocket takes <span style=''color: gold''>\$gold gold</span>!</span></b><br /><br />\");\r\n \$session[\\'user\\'][\\'gold\\'] -= \$gold;\r\n \$badguy[\\'creaturegold\\'] += \$gold;\r\n \$badguy[\\'spellpoints\\']--;\r\n}', 'Talisman', 1, 0)",
"INSERT INTO " . db_prefix("companions") . " (`companionid`, `name`, `category`, `description`, `attack`, `attackperlevel`, `defense`, `defenseperlevel`, `maxhitpoints`, `maxhitpointsperlevel`, `abilities`, `cannotdie`, `cannotbehealed`, `companionlocation`, `companionactive`, `companioncostdks`, `companioncostgems`, `companioncostgold`, `jointext`, `dyingtext`, `allowinshades`, `allowinpvp`, `allowintrain`) VALUES (1, 'Mortimer teh javelin man', 'Knight', 'A rough and ready warrior. Beneath his hardened exterior, one can detect a man of strong honour.', 5, 2, 1, 2, 20, 20, 'a:4:{s:5:\"fight\";s:1:\"1\";s:4:\"heal\";s:1:\"0\";s:5:\"magic\";s:1:\"0\";s:6:\"defend\";b:0;}', 0, 0, '".getsetting("villagename", LOCATION_FIELDS)."', 1, 0, 4, 573, '`^Greetings unto thee, my friend. Let us go forth and conquer the evils of this world together!', '`4Argggggh! I am slain! Shuffling off my mortal coil. Fare thee well, my friends.', 1, 0, 0)",
"INSERT INTO " . db_prefix("companions") . " (`companionid`, `name`, `category`, `description`, `attack`, `attackperlevel`, `defense`, `defenseperlevel`, `maxhitpoints`, `maxhitpointsperlevel`, `abilities`, `cannotdie`, `cannotbehealed`, `companionlocation`, `companionactive`, `companioncostdks`, `companioncostgems`, `companioncostgold`, `jointext`, `dyingtext`, `allowinshades`, `allowinpvp`, `allowintrain`) VALUES (2, 'Florenz', 'Healer', 'With a slight build, Florenz is better suited as a healer than a fighter.', 1, 1, 5, 5, 15, 10, 'a:4:{s:4:\"heal\";s:1:\"2\";s:5:\"magic\";s:1:\"0\";s:5:\"fight\";b:0;s:6:\"defend\";b:0;}', 0, 0, '".getsetting("villagename", LOCATION_FIELDS)."', 1, 0, 3, 1000, 'Thank ye for thy faith in my skills. I shall endeavour to keep ye away from Ramius'' claws.', 'O Discordia!', 1, 0, 0)",
),
"1.1.2 Dragonprime Edition"=>array(
),
);
?>

View File

@ -0,0 +1,86 @@
<?php
output("`@`c`bWelcome to Legend of the Green Dragon`b`c`0");
output("`2This is the installer script for Legend of the Green Dragon, by Eric Stevens & JT Traub.`n");
output("`nIn order to install and use Legend of the Green Dragon (LoGD), you must agree to the license under which it is deployed.`n");
output("`n`&This game is a small project into which we have invested a tremendous amount of personal effort, and we provide this to you absolutely free of charge.`2");
output("Please understand that if you modify our copyright, or otherwise violate the license, you are not only breaking international copyright law (which includes penalties which are defined in whichever country you live), but you're also defeating the spirit of open source, and ruining any good faith which we have demonstrated by providing our blood, sweat, and tears to you free of charge. You should also know that by breaking the license even one time, it is within our rights to require you to permanently cease running LoGD forever.`n");
output("`nPlease note that in order to use the installer, you must have cookies enabled in your browser.`n");
if (DB_CHOSEN){
$sql = "SELECT count(*) AS c FROM accounts WHERE superuser & ".SU_MEGAUSER;
$result = db_query($sql);
$row = db_fetch_assoc($result);
if ($row['c'] == 0){
$needsauthentication = false;
}
if (httppost("username")>""){
debug(md5(md5(stripslashes(httppost("password")))), true);
$version = getsetting("installer_version","-1");
if ($version == "-1") {
// Passwords weren't encrypted in these versions
$sql = "SELECT * FROM ".db_prefix("accounts")." WHERE login='".mysql_real_escape_string(httppost("username"))."' AND password='".mysql_real_escape_string(httppost("password"))."' AND superuser & ".SU_MEGAUSER;
}else $sql = "SELECT * FROM ".db_prefix("accounts")." WHERE login='".mysql_real_escape_string(httppost("username"))."' AND password='".md5(md5(stripslashes(httppost("password"))))."' AND superuser & ".SU_MEGAUSER;
$result = db_query($sql);
if (db_num_rows($result) > 0){
$row = db_fetch_assoc($result);
debug($row['password'], true);
debug(httppost('password'), true);
// Okay, we have a username with megauser, now we need to do
// some hackery with the password.
$needsauthentication=true;
$p = stripslashes(httppost("password"));
$p1 = md5($p);
$p2 = md5($p1);
debug($p2, true);
if (getsetting("installer_version", "-1") == "-1") {
debug("HERE I AM", true);
// Okay, they are upgrading from 0.9.7 they will have
// either a non-encrypted password, or an encrypted singly
// password.
if (strlen($row['password']) == 32 &&
$row['password'] == $p1) {
$needsauthentication = false;
} elseif ($row['password'] == $p) {
$needsauthentication = false;
}
} elseif ($row['password'] == $p2) {
$needsauthentication = false;
}
if ($needsauthentication === false) {
redirect("installer.php?stage=1");
}
output("`\$That username / password was not found, or is not an account with sufficient privileges to perform the upgrade.`n");
}else{
$needsauthentication=true;
output("`\$That username / password was not found, or is not an account with sufficient privileges to perform the upgrade.`n");
}
}else{
$sql = "SELECT count(*) AS c FROM ".db_prefix("accounts")." WHERE superuser & ".SU_MEGAUSER;
$result = db_query($sql);
$row = db_fetch_assoc($result);
if ($row['c']>0){
$needsauthentication=true;
}else{
$needsauthentication=false;
}
}
}else{
$needsauthentication=false;
}
//if a user with appropriate privs is already logged in, let's let them past.
if ($session['user']['superuser'] & SU_MEGAUSER) $needsauthentication=false;
if ($needsauthentication){
$session['stagecompleted']=-1;
rawoutput("<form action='installer.php?stage=0' method='POST'>");
output("`%In order to upgrade this LoGD installation, you will need to provide the username and password of a superuser account with the MEGAUSER privilege`n");
output("`^Username: `0");
rawoutput("<input name='username'><br>");
output("`^Password: `0");
rawoutput("<input type='password' name='password'><br>");
$submit = translate_inline("Submit");
rawoutput("<input type='submit' value='$submit' class='button'>");
rawoutput("</form>");
}else{
output("`nPlease continue on to the next page, \"License Agreement.\"");
}
?>

View File

@ -0,0 +1,40 @@
<?php
require_once("lib/pullurl.php");
$license = join("",pullurl("http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode"));
$license = str_replace("\n","",$license);
$license = str_replace("\r","",$license);
$shortlicense=array();
preg_match_all("'<body[^>]*>(.*)</body>'",$license,$shortlicense);
$license = $shortlicense[1][0];
output("`@`c`bLicense Agreement`b`c`0");
output("`2Before continuing, you must read and understand the following license agreement.`0`n`n");
if (md5($license)=="484d213db9a69e79321feafb85915ff1"){
$cdomain = "http://creativecommons.org";
$license = preg_replace("/(href|src)\=\"([^(http)])(\/)?/", "$1=\"".$cdomain."$2", $license);
rawoutput("<div style='width: 100%; height; 350px; max-height: 350px; overflow: auto; color: #FFFFFF; background-color: #000000; padding: 10px;'>".$license."</div>");
}else{
output("`^Warning, the Creative Commons license has changed, or could not be retrieved from the Creative Commons server.");
output("You should check with the game authors to ensure that the below license agrees with the license under which it was released.");
output("The license may be referenced at <a target='_blank' href='http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode'>the Creative Commons site</a>.",true);
}
$license = join("",file("LICENSE.txt"));
$license = preg_replace("/[^\na-zA-Z0-9!?.,;:'\"\\/\\()@ -\\]\\[]/","",$license);
$licensemd5s = array(
'e281e13a86d4418a166d2ddfcd1e8032'=>true
);
if (isset($licensemd5s[md5($license)])){
// Reload it so we get the right line breaks, etc.
//$license = file("LICENSE.txt");
$license = htmlentities($license, ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
$license = nl2br($license);
//$license = preg_replace("/<br[^>]*>\s+<br[^>]*>/i","<p>",$license);
//$license = preg_replace("/<br[^>]*>/i","",$license);
output("`n`n`b`@Plain Text:`b`n`7");
rawoutput($license);
}else{
output("`^The license file (LICENSE.txt) has been modified. Please obtain a new copy of the game's code, this file has been tampered with.");
output("Expected MD5 in (".join(array_keys($licensemd5s),",")."), but got ".md5($license));
$stage=-1;
$session['stagecompleted']=-1;
}
?>

View File

@ -0,0 +1,55 @@
<?php
output("`@`c`bSuperuser Accounts`b`c");
debug($logd_version, true);
$sql = "SELECT login, password FROM ".db_prefix("accounts")." WHERE superuser & ".SU_MEGAUSER;
$result = db_query($sql);
if (db_num_rows($result)==0){
if (httppost("name")>""){
$showform=false;
if (httppost("pass1")!=httppost("pass2")){
output("`\$Oops, your passwords don't match.`2`n");
$showform=true;
}elseif (strlen(httppost("pass1"))<6){
output("`\$Whoa, that's a short password, you really should make it longer.`2`n");
$showform=true;
}else{
// Give the superuser a decent set of privs so they can
// do everything needed without having to first go into
// the user editor and give themselves privs.
$su = SU_MEGAUSER | SU_EDIT_MOUNTS | SU_EDIT_CREATURES |
SU_EDIT_PETITIONS | SU_EDIT_COMMENTS | SU_EDIT_DONATIONS |
SU_EDIT_USERS | SU_EDIT_CONFIG | SU_INFINITE_DAYS |
SU_EDIT_EQUIPMENT | SU_EDIT_PAYLOG | SU_DEVELOPER |
SU_POST_MOTD | SU_MODERATE_CLANS | SU_EDIT_RIDDLES |
SU_MANAGE_MODULES | SU_AUDIT_MODERATION | SU_RAW_SQL |
SU_VIEW_SOURCE | SU_NEVER_EXPIRE;
$name = httppost("name");
$pass = md5(md5(stripslashes(httppost("pass1"))));
$sql = "DELETE FROM ".db_prefix("accounts")." WHERE login='$name'";
db_query($sql);
$sql = "INSERT INTO " .db_prefix("accounts") ." (login,password,superuser,name,ctitle,regdate) VALUES('$name','$pass',$su,'`%Admin `&$name`0','`%Admin', NOW())";
db_query($sql);
output("`^Your superuser account has been created as `%Admin `&$name`^!");
savesetting("installer_version",$logd_version);
}
}else{
$showform=true;
savesetting("installer_version",$logd_version);
}
if ($showform){
rawoutput("<form action='installer.php?stage=$stage' method='POST'>");
output("Enter a name for your superuser account:");
rawoutput("<input name='name' value=\"".htmlentities(httppost("name"), ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\">");
output("`nEnter a password: ");
rawoutput("<input name='pass1' type='password'>");
output("`nConfirm your password: ");
rawoutput("<input name='pass2' type='password'>");
$submit = translate_inline("Create");
rawoutput("<br><input type='submit' value='$submit' class='button'>");
rawoutput("</form>");
}
}else{
output("`#You already have a superuser account set up on this server.");
savesetting("installer_version",$logd_version);
}
?>

View File

@ -0,0 +1,3 @@
<?php
output("`#By continuing with this installation, you indicate your agreement with the terms of the license found on the previous page (License Agreement).");
?>

View File

@ -0,0 +1,54 @@
<?php
require_once("lib/installer/installer_functions.php");
rawoutput("<form action='installer.php?stage=4' method='POST'>");
output("`@`c`bDatabase Connection Information`b`c`2");
output("In order to run Legend of the Green Dragon, your server must have access to a MySQL database.");
output("If you are not sure if you meet this need, talk to server's Internet Service Provider (ISP), and make sure they offer MySQL databases.");
output("If you are running on your own machine or a server under your control, you can download and install MySQL from <a href='http://www.mysql.com/' target='_blank'>the MySQL website</a> for free.`n",true);
if (file_exists("dbconnect.php")){
output("There appears to already be a database setup file (dbconnect.php) in your site root, you can proceed to the next step.");
}else{
output("`nIt looks like this is a new install of Legend of the Green Dragon.");
output("First, thanks for installing LoGD!");
output("In order to connect to the database server, I'll need the following information.");
output("`iIf you are unsure of the answer to any of these questions, please check with your server's ISP, or read the documentation on MySQL`i`n");
output("`nWhat is the address of your database server?`n");
rawoutput("<input name='DB_HOST' value=\"".htmlentities($session['dbinfo']['DB_HOST'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\">");
tip("If you are running LoGD from the same server as your database, use 'localhost' here. Otherwise, you will have to find out what the address is of your database server. Your server's ISP might be able to provide this information.");
output("`nWhat is the username you use to connect to the database server?`n");
rawoutput("<input name='DB_USER' value=\"".htmlentities($session['dbinfo']['DB_USER'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\">");
tip("This username does not have to be the same one you use to connect to the database server for administrative reasons. However, in order to use this installer, and to install some of the modules, the account you provide here must have the ability to create, modify, and drop tables. If you want the installer to create a new database for LoGD, the account will also have to have the ability to create databases. Finally, to run the game, this account must at a minimum be able to select, insert, update, and delete records, and be able to lock tables. If you're uncertain, grant the account the following privileges: SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, and ALTER.");
output("`nWhat is the password for this username?`n");
rawoutput("<input name='DB_PASS' value=\"".htmlentities($session['dbinfo']['DB_PASS'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\">");
tip("The password is necessary here in order for the game to successfully connect to the database server. This information is not shared with anyone, it is simply used to configure the game.");
output("`nWhat is the name of the database you wish to install LoGD in?`n");
rawoutput("<input name='DB_NAME' value=\"".htmlentities($session['dbinfo']['DB_NAME'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\">");
tip("Database servers such as MySQL can control many different databases. This is very useful if you have many different programs each needing their own database. Each database has a unique name. Provide the name you wish to use for LoGD in this field.");
output("`nDo you want to use datacaching (high load optimization)?`n");
rawoutput("<select name='DB_USEDATACACHE'>");
rawoutput("<option value=\"1\" ".($session['dbinfo']['DB_USEDATACACHE']?'selected=\"selected\"':'').">".translate_inline("Yes")."</option>");
rawoutput("<option value=\"0\" ".(!$session['dbinfo']['DB_USEDATACACHE']?'selected=\"selected\"':'').">".translate_inline("No")."</option>");
rawoutput("</select>");
tip("Do you want to use a datacache for the sql queries? Many internal queries produce the same results and can be cached. This feature is *highly* recommended to use as the MySQL server is usually high frequented. When using in an environment where Safe Mode is enabled; this needs to be a path that has the same UID as the web server runs.");
output("`nIf yes, what is the path to the datacache directory?`n");
rawoutput("<input name='DB_DATACACHEPATH' value=\"".htmlentities($session['dbinfo']['DB_DATACACHEPATH'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\">");
tip("If you have chosen to use the datacache function, you have to enter a path here to where temporary files may be stored. Verify that you have the proper permission (777) set to this folder, else you will have lots of errors. Do NOT end with a slash / ... just enter the dir");
/*
$yes = translate_inline("Yes");
$no = translate_inline("No");
output("`nShould I attempt to create this database if it does not exist?`n");
rawoutput("<select name='DB_CREATE'><option value='1'>$yes</option><option value='0'>$no</option></select>");
tip("If this database doesn't exist, I'll try to create it for you if you like.");
*/
$submit="Test this connection information.";
output_notl("`n`n<input type='submit' value='$submit' class='button'>",true);
}
rawoutput("</form>");
?>

View File

@ -0,0 +1,196 @@
<?php
require_once("lib/dbwrapper.php");
if (httppostisset("DB_HOST")) {
$session['dbinfo']['DB_HOST']=httppost("DB_HOST");
$session['dbinfo']['DB_USER']=httppost("DB_USER");
$session['dbinfo']['DB_PASS']=httppost("DB_PASS");
$session['dbinfo']['DB_NAME']=httppost("DB_NAME");
$session['dbinfo']['DB_USEDATACACHE']=(bool)httppost("DB_USEDATACACHE");
$session['dbinfo']['DB_DATACACHEPATH']=httppost("DB_DATACACHEPATH");
}
output("`@`c`bTesting the Database Connection`b`c`2");
output("Trying to establish a connection with the database:`n");
ob_start();
$link = db_connect($session['dbinfo']['DB_HOST'], $session['dbinfo']['DB_USER'], $session['dbinfo']['DB_PASS']);
$error = ob_get_contents();
ob_end_clean();
if (!$link){
output("`\$Blast! I wasn't able to connect to the database server with the information you provided!");
output("`2This means that either the database server address, database username, or database password you provided were wrong, or else the database server isn't running.");
output("The specific error the database returned was:");
rawoutput("<blockquote>".$error."</blockquote>");
output("If you believe you provided the correct information, make sure that the database server is running (check documentation for how to determine this).");
output("Otherwise, you should return to the previous step, \"Database Info\" and double-check that the information provided there is accurate.");
$session['stagecompleted']=3;
}else{
output("`^Yahoo, I was able to connect to the database server!");
output("`2This means that the database server address, database username, and database password you provided were probably accurate, and that your database server is running and accepting connections.`n");
output("`nI'm now going to attempt to connect to the LoGD database you provided.`n");
if (httpget("op")=="trycreate"){
require_once 'lib/installer/installer_functions.php';
create_db($session['dbinfo']['DB_NAME']);
}
if (!db_select_db($session['dbinfo']['DB_NAME'])){
output("`\$Rats! I was not able to connect to the database.");
$error = db_error();
if ($error=="Unknown database '{$session['dbinfo']['DB_NAME']}'"){
output("`2It looks like the database for LoGD hasn't been created yet.");
output("I can attempt to create it for you if you like, but in order for that to work, the account you provided has to have permissions to create a new database.");
output("If you're not sure what this means, it's safe to try to create this database, but you should double check that you've typed the name correctly by returning to the previous stage before you try it.`n");
output("`nTo try to create the database, <a href='installer.php?stage=4&op=trycreate'>click here</a>.`n",true);
}else{
output("`2This is probably because the username and password you provided doesn't have permission to connect to the database.`n");
}
output("`nThe exact error returned from the database server was:");
rawoutput("<blockquote>$error</blockquote>");
$session['stagecompleted']=3;
}else{
output("`n`^Excellent, I was able to connect to the database!`n");
define("DB_INSTALLER_STAGE4", true);
output("`n`@Tests`2`n");
output("I'm now going to run a series of tests to determine what the permissions of this account are.`n");
$issues = array();
output("`n`^Test: `#Creating a table`n");
//try to destroy the table if it's already here.
$sql = "DROP TABLE IF EXISTS logd_environment_test";
db_query($sql,false);
$sql = "CREATE TABLE logd_environment_test (a int(11) unsigned not null)";
db_query($sql);
if ($error=db_error()){
output("`2Result: `\$Fail`n");
rawoutput("<blockquote>$error</blockquote>");
array_push($issues,"`^Warning:`2 The installer will not be able to create the tables necessary to install LoGD. If these tables already exist, or you have created them manually, then you can ignore this. Also, many modules rely on being able to create tables, so you will not be able to use these modules.");
}else{
output("`2Result: `@Pass`n");
}
output("`n`^Test: `#Modifying a table`n");
$sql = "ALTER TABLE logd_environment_test CHANGE a b varchar(50) not null";
db_query($sql);
if ($error=db_error()){
output("`2Result: `\$Fail`n");
rawoutput("<blockquote>$error</blockquote>");
array_push($issues,"`^Warning:`2 The installer will not be able to modify existing tables (if any) to line up with new configurations. Also, many modules rely on table modification permissions, so you will not be able to use these modules.");
}else{
output("`2Result: `@Pass`n");
}
output("`n`^Test: `#Creating an index`n");
$sql = "ALTER TABLE logd_environment_test ADD INDEX(b)";
db_query($sql);
if ($error=db_error()){
output("`2Result: `\$Fail`n");
rawoutput("<blockquote>$error</blockquote>");
array_push($issues,"`^Warning:`2 The installer will not be able to create indices on your tables. Indices are extremely important for an active server, but can be done without on a small server.");
}else{
output("`2Result: `@Pass`n");
}
output("`n`^Test: `#Inserting a row`n");
$sql = "INSERT INTO logd_environment_test (b) VALUES ('testing')";
db_query($sql);
if ($error=db_error()){
output("`2Result: `\$Fail`n");
rawoutput("<blockquote>$error</blockquote>");
array_push($issues,"`\$Critical:`2 The game will not be able to function with out the ability to insert rows.");
$session['stagecompleted']=3;
}else{
output("`2Result: `@Pass`n");
}
output("`n`^Test: `#Selecting a row`n");
$sql = "SELECT * FROM logd_environment_test";
db_query($sql);
if ($error=db_error()){
output("`2Result: `\$Fail`n");
rawoutput("<blockquote>$error</blockquote>");
array_push($issues,"`\$Critical:`2 The game will not be able to function with out the ability to select rows.");
$session['stagecompleted']=3;
}else{
output("`2Result: `@Pass`n");
}
output("`n`^Test: `#Updating a row`n");
$sql = "UPDATE logd_environment_test SET b='MightyE'";
db_query($sql);
if ($error=db_error()){
output("`2Result: `\$Fail`n");
rawoutput("<blockquote>$error</blockquote>");
array_push($issues,"`\$Critical:`2 The game will not be able to function with out the ability to update rows.");
$session['stagecompleted']=3;
}else{
output("`2Result: `@Pass`n");
}
output("`n`^Test: `#Deleting a row`n");
$sql = "DELETE FROM logd_environment_test";
db_query($sql);
if ($error=db_error()){
output("`2Result: `\$Fail`n");
rawoutput("<blockquote>$error</blockquote>");
array_push($issues,"`\$Critical:`2 The game database will grow very large with out the ability to delete rows.");
$session['stagecompleted']=3;
}else{
output("`2Result: `@Pass`n");
}
output("`n`^Test: `#Locking a table`n");
$sql = "LOCK TABLES logd_environment_test WRITE";
db_query($sql);
if ($error = db_error()) {
output("`2Result: `\$Fail`n");
rawoutput("<blockquote>$error</blockquote>");
array_push($issues,"`\$Critical:`2 The game will not run correctly without the ability to lock tables.");
$session['stagecompleted']=3;
} else {
output("`2Result: `@Pass`n");
}
output("`n`^Test: `#Unlocking a table`n");
$sql = "UNLOCK TABLES";
db_query($sql);
if ($error = db_error()) {
output("`2Result: `\$Fail`n");
rawoutput("<blockquote>$error</blockquote>");
array_push($issues,"`\$Critical:`2 The game will not run correctly without the ability to unlock tables.");
$session['stagecompleted']=3;
} else {
output("`2Result: `@Pass`n");
}
output("`n`^Test: `#Deleting a table`n");
$sql = "DROP TABLE logd_environment_test";
db_query($sql);
if ($error=db_error()){
output("`2Result: `\$Fail`n");
rawoutput("<blockquote>$error</blockquote>");
array_push($issues,"`^Warning:`2 The installer will not be able to delete old tables (if any). Also, many modules need to be able to delete the tables they put in place when they are uninstalled. Although the game will function, you may end up with a lot of old data sitting around.");
}else{
output("`2Result: `@Pass`n");
}
output("`n`^Test: `#Checking datacache`n");
if (!$session['dbinfo']['DB_USEDATACACHE']) {
output("-----skipping, not selected-----`n");
} else {
$fp = @fopen($session['dbinfo']['DB_DATACACHEPATH']."/dummy.php","w+");
if ($fp){
if (fwrite($fp, $dbconnect)!==false){
output("`2Result: `@Pass`n");
}else{
output("`2Result: `\$Fail`n");
rawoutput("<blockquote>");
array_push($issues,"`^I was not able to write to your datacache directory!`n");
}
fclose($fp);
@unlink($session['dbinfo']['DB_DATACACHEPATH']."/dummy.php");
}else{
output("`2Result: `\$Fail`n");
array_push($issues,"`^I was not able to write to your datacache directory! Check your permissions there!`n");
}
}
output("`n`^Overall results:`2`n");
if (count($issues)==0){
output("You've passed all the tests, you're ready for the next stage.");
}else{
rawoutput("<ul>");
output("<li>".join("</li>\n<li>",$issues)."</li>",true);
rawoutput("</ul>");
output("Even if all of the above issues are merely warnings, you will probably periodically see database errors as a result of them.");
output("It would be a good idea to resolve these permissions issues before attempting to run this game.");
output("For you technical folk, the specific permissions suggested are: SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER and LOCK TABLES.");
output("I'm sorry, this is not something I can do for you.");
}
}
}
?>

View File

@ -0,0 +1,72 @@
<?php
require_once("lib/installer/installer_functions.php");
if (httppostisset("DB_PREFIX") > ""){
$session['dbinfo']['DB_PREFIX'] = httppost("DB_PREFIX");
}
if ($session['dbinfo']['DB_PREFIX'] > "" && substr($session['dbinfo']['DB_PREFIX'],-1)!="_")
$session['dbinfo']['DB_PREFIX'] .= "_";
$descriptors = descriptors($session['dbinfo']['DB_PREFIX']);
$unique=0;
$game=0;
$missing=0;
$conflict = array();
$link = mysql_connect($session['dbinfo']['DB_HOST'],$session['dbinfo']['DB_USER'],$session['dbinfo']['DB_PASS']);
mysql_select_db($session['dbinfo']['DB_NAME']);
$sql = "SHOW TABLES";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)){
list($key,$val)=each($row);
if (isset($descriptors[$val])){
$game++;
array_push($conflict,$val);
}else{
$unique++;
}
}
$missing = count($descriptors)-$game;
if ($missing*10 < $game){
//looks like an upgrade
$upgrade=true;
}else{
$upgrade=false;
}
if (httpget("type")=="install") $upgrade=false;
if (httpget("type")=="upgrade") $upgrade=true;
$session['dbinfo']['upgrade']=$upgrade;
if ($upgrade){
output("`@This looks like a game upgrade.");
output("`^If this is not an upgrade from a previous version of LoGD, <a href='installer.php?stage=5&type=install'>click here</a>.",true);
output("`2Otherwise, continue on to the next step.");
}else{
//looks like a clean install
$upgrade=false;
output("`@This looks like a fresh install.");
output("`2If this is not a fresh install, but rather an upgrade from a previous version of LoGD, chances are that you installed LoGD with a table prefix. If that's the case, enter the prefix below. If you are still getting this message, it's possible that I'm just spooked by how few tables are common to the current version, and in which case, I can try an upgrade if you <a href='installer.php?stage=5&type=upgrade'>click here</a>.`n",true);
if (count($conflict)>0){
output("`n`n`\$There are table conflicts.`2");
output("If you continue with an install, the following tables will be overwritten with the game's tables. If the listed tables belong to LoGD, they will be upgraded, otherwise all existing data in those tables will be destroyed. Once this is done, this cannot be undone unless you have a backup!`n");
output("`nThese tables conflict: `^".join(", ",$conflict)."`2`n");
if (httpget("op")=="confirm_overwrite") $session['sure i want to overwrite the tables']=true;
if (!$session['sure i want to overwrite the tables']){
$session['stagecompleted']=4;
output("`nIf you are sure that you wish to overwrite these tables, <a href='installer.php?stage=5&op=confirm_overwrite'>click here</a>.`n",true);
}
}
output("`nYou can avoid table conflicts with other applications in the same database by providing a table name prefix.");
output("This prefix will get put on the name of every table in the database.");
}
rawoutput("<form action='installer.php?stage=5' method='POST'>");
output("`nTo provide a table prefix, enter it here.");
output("If you don't know what this means, you should either leave it blank, or enter an intuitive value such as \"logd\".`n");
rawoutput("<input name='DB_PREFIX' value=\"".htmlentities($session['dbinfo']['DB_PREFIX'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\"><br>");
$submit = translate_inline("Submit your prefix.");
rawoutput("<input type='submit' value='$submit' class='button'>");
rawoutput("</form>");
if (count($conflict)==0){
output("`^It looks like you can probably safely skip this step if you don't know what it means.");
}
output("`n`n`@Once you have submitted your prefix, you will be returned to this page to select the next step.");
output("If you don't need a prefix, just select the next step now.");
?>

View File

@ -0,0 +1,109 @@
<?php
if (file_exists("dbconnect.php")){
$success=true;
$initial=false;
}else{
$initial = true;
output("`@`c`bWriting your dbconnect.php file`b`c");
output("`2I'm attempting to write a file named 'dbconnect.php' to your site root.");
output("This file tells LoGD how to connect to the database, and is necessary to continue installation.`n");
$dbconnect =
"<?php\n"
."//This file automatically created by installer.php on ".date("M d, Y h:i a")."\n"
."\$DB_HOST = '{$session['dbinfo']['DB_HOST']}';\n"
."\$DB_USER = '{$session['dbinfo']['DB_USER']}';\n"
."\$DB_PASS = '{$session['dbinfo']['DB_PASS']}';\n"
."\$DB_NAME = '{$session['dbinfo']['DB_NAME']}';\n"
."\$DB_PREFIX = '{$session['dbinfo']['DB_PREFIX']}';\n"
."\$DB_USEDATACACHE = ". ((int)$session['dbinfo']['DB_USEDATACACHE']) .";\n"
."\$DB_DATACACHEPATH = '{$session['dbinfo']['DB_DATACACHEPATH']}';\n"
."?>\n";
$fp = @fopen("dbconnect.php","w+");
if ($fp){
if (fwrite($fp, $dbconnect)!==false){
output("`n`@Success!`2 I was able to write your dbconnect.php file, you can continue on to the next step.");
}else{
$failure=true;
}
fclose($fp);
}else{
$failure=true;
}
if ($failure){
output("`n`\$Unfortunately, I was not able to write your dbconnect.php file.");
output("`2You will have to create this file yourself, and upload it to your web server.");
output("The contents of this file should be as follows:`3");
rawoutput("<blockquote><pre>".htmlentities($dbconnect, ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."</pre></blockquote>");
output("`2Create a new file, past the entire contents from above into it (everything from and including `3<?php`2 up to and including `3?>`2 ).");
output("When you have that done, save the file as 'dbconnect.php' and upload this to the location you have LoGD at.");
output("You can refresh this page to see if you were successful.");
}else{
$success=true;
}
}
if ($success && !$initial){
$version = getsetting("installer_version","-1");
$sub = substr($version, 0, 5);
$sub = (int)str_replace(".", "", $sub);
if ($sub < 110) {
$sql = "SELECT setting, value FROM ".db_prefix("settings")." WHERE setting IN ('usedatacache', 'datacachepath')";
$result = db_query($sql);
$fp = @fopen("dbconnect.php","r+");
if ($fp){
while(!feof($fp)) {
$buffer = fgets($fp, 4096);
if (strpos($buffer, "\$DB") !== false) {
@eval($buffer);
}
}
fclose($fp);
}
while ($row = db_fetch_assoc($result)) {
if ($row['setting'] == 'datacachepath') {
$DB_DATACACHEPATH = $row['value'];
}
if ($row['setting'] == 'usedatacache') {
$DB_USEDATACACHE = $row['value'];
}
}
$dbconnect =
"<?php\n"
."//This file automatically created by installer.php on ".date("M d, Y h:i a")."\n"
."\$DB_HOST = '{$DB_HOST}';\n"
."\$DB_USER = '{$DB_USER}';\n"
."\$DB_PASS = '{$DB_PASS}';\n"
."\$DB_NAME = '{$DB_NAME}';\n"
."\$DB_PREFIX = '{$DB_PREFIX}';\n"
."\$DB_USEDATACACHE = ". ((int)$DB_USEDATACACHE).";\n"
."\$DB_DATACACHEPATH = '".addslashes($DB_DATACACHEPATH)."'';\n"
."?>\n";
// Check if the file is writeable for us. If yes, we will change the file and notice the admin
// if not, they have to change the file themselves...
$fp = @fopen("dbconnect.php","w+");
if ($fp){
if (fwrite($fp, $dbconnect)!==false){
output("`n`@Success!`2 I was able to write your dbconnect.php file.");
}else{
$failure=true;
}
fclose($fp);
}else{
$failure=true;
}
if ($failure) {
output("`2With this new version the settings for datacaching had to be moved to `idbconnect.php`i.");
output("Due to your system settings and privleges for this file, I was not able to perform the changes by myself.");
output("This part involves you: We have to ask you to replace the content of your existing `idbconnect.php`i with the following code:`n`n`&");
rawoutput("<blockquote><pre>".htmlentities($dbconnect, ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."</pre></blockquote>");
output("`2This will let you use your existing datacaching settings.`n`n");
output("If you have done this, you are ready for the next step.");
} else {
output("`n`^You are ready for the next step.");
}
} else {
output("`n`^You are ready for the next step.");
}
}else if(!$success) {
$session['stagecompleted']=5;
}
?>

View File

@ -0,0 +1,45 @@
<?php
require("lib/installer/installer_sqlstatements.php");
if (httppost("type")>""){
if (httppost("type")=="install") {
$session['fromversion']="-1";
$session['dbinfo']['upgrade']=false;
}else{
$session['fromversion']=httppost("version");
$session['dbinfo']['upgrade']=true;
}
}
if (!isset($session['fromversion']) || $session['fromversion']==""){
output("`@`c`bConfirmation`b`c");
output("`2Please confirm the following:`0`n");
rawoutput("<form action='installer.php?stage=7' method='POST'>");
rawoutput("<table border='0' cellpadding='0' cellspacing='0'><tr><td valign='top'>");
output("`2I should:`0");
rawoutput("</td><td>");
$version = getsetting("installer_version","-1");
if ($version != "-1") $session['dbinfo']['upgrade']=true;
rawoutput("<input type='radio' value='upgrade' name='type'".($session['dbinfo']['upgrade']?" checked":"").">");
output(" `2Perform an upgrade from ");
if ($version=="-1") $version="0.9.7";
reset($sql_upgrade_statements);
rawoutput("<select name='version'>");
while(list($key,$val)=each($sql_upgrade_statements)){
if ($key!="-1"){
rawoutput("<option value='$key'".($version==$key?" selected":"").">$key</option>");
}
}
rawoutput("</select>");
rawoutput("<br><input type='radio' value='install' name='type'".($session['dbinfo']['upgrade']?"":" checked").">");
output(" `2Perform a clean install.");
rawoutput("</td></tr></table>");
$submit=translate_inline("Submit");
rawoutput("<input type='submit' value='$submit' class='button'>");
rawoutput("</form>");
$session['stagecompleted']=$stage - 1;
}else{
$session['stagecompleted']=$stage;
header("Location: installer.php?stage=".($stage+1));
exit();
}
?>

View File

@ -0,0 +1,221 @@
<?php
require_once("lib/installer/installer_functions.php");
if (array_key_exists('modules',$_POST)){
$session['moduleoperations'] = $_POST['modules'];
$session['stagecompleted'] = $stage;
header("Location: installer.php?stage=".($stage+1));
exit();
}elseif (array_key_exists('moduleoperations',$session) && is_array($session['moduleoperations'])){
$session['stagecompleted'] = $stage;
}else{
$session['stagecompleted'] = $stage - 1;
}
output("`@`c`bManage Modules`b`c");
output("Legend of the Green Dragon supports an extensive module system.");
output("Modules are small self-contained files that perform a specific function or event within the game.");
output("For the most part, modules are independant of each other, meaning that one module can be installed, uninstalled, activated, and deactivated without negative impact on the rest of the game.");
output("Not all modules are ideal for all sites, for example, there's a module called 'Multiple Cities,' which is intended only for large sites with many users online at the same time.");
output("`n`n`^If you are not familiar with Legend of the Green Dragon, and how the game is played, it is probably wisest to choose the default set of modules to be installed.");
output("`n`n`@There is an extensive community of users who write modules for LoGD at <a href='http://dragonprime.net/'>http://dragonprime.net/</a>.",true);
$phpram = ini_get("memory_limit");
if (return_bytes($phpram) < 12582912 && $phpram!=-1 && !$session['overridememorylimit'] && !$session['dbinfo']['upgrade']) {// 12 MBytes
// enter this ONLY if it's not an upgrade and if the limit is really too low
output("`n`n`\$Warning: Your PHP memory limit is set to a very low level.");
output("Smaller servers should not be affected by this during normal gameplay but for this installation step you should assign at least 12 Megabytes of RAM for your PHP process.");
output("For now we will skip this step, but before installing any module, make sure to increase you memory limit.");
output("`nYou can proceed at your own risk. Be aware that a blank screen indicates you *must* increase the memory limit.");
output("`n`nTo override click again on \"Set Up Modules\".");
$session['stagecompleted'] = "8";
$session['overridememorylimit'] = true;
$session['skipmodules'] = true;
} else {
if (isset($session['overridememorylimit']) && $session['overridememorylimit']) {
output("`4`n`nYou have been warned... you are now working on your own risk.`n`n");
$session['skipmodules'] = false;
}
$submit = translate_inline("Save Module Settings");
$install = translate_inline("Select Recommended Modules");
$reset = translate_inline("Reset Values");
$all_modules = array();
$sql = "SELECT * FROM ".db_prefix("modules")." ORDER BY category,active DESC,formalname";
$result = @db_query($sql);
if ($result!==false){
while ($row = db_fetch_assoc($result)){
if (!array_key_exists($row['category'],$all_modules)){
$all_modules[$row['category']] = array();
}
$row['installed']=true;
$all_modules[$row['category']][$row['modulename']] = $row;
}
}
$install_status = get_module_install_status();
$uninstalled = $install_status['uninstalledmodules'];
reset($uninstalled);
$invalidmodule = array(
"version"=>"",
"author"=>"",
"category"=>"Invalid Modules",
"download"=>"",
"description"=>"",
"invalid"=>true,
);
while (list($key,$modulename) = each($uninstalled)){
$row = array();
//test if the file is a valid module or a lib file/whatever that got in, maybe even malcode that does not have module form
$modulenamelower = strtolower($modulename);
$file = strtolower(file_get_contents("modules/$modulename.php"));
if (strpos($file,$modulenamelower."_getmoduleinfo")===false ||
//strpos($file,$shortname."_dohook")===false ||
//do_hook is not a necessity
strpos($file,$modulenamelower."_install")===false ||
strpos($file,$modulenamelower."_uninstall")===false) {
//here the files has neither do_hook nor getinfo, which means it won't execute as a module here --> block it + notify the admin who is the manage modules section
$moduleinfo=array_merge($invalidmodule,array("name"=>$modulename.".php ".appoencode(translate_inline("(`\$Invalid Module! Contact Author or check file!`0)"))));
} else {
$moduleinfo= get_module_info($modulename);
}
//end of testing
$row['installed'] = false;
$row['active'] = false;
$row['category'] = $moduleinfo['category'];
$row['modulename'] = $modulename;
$row['formalname'] = $moduleinfo['name'];
$row['description'] = $moduleinfo['description'];
$row['moduleauthor'] = $moduleinfo['author'];
$row['invalid'] = (isset($moduleinfo['invalid']))?$moduleinfo['invalid']:false;
if (!array_key_exists($row['category'],$all_modules)){
$all_modules[$row['category']] = array();
}
$all_modules[$row['category']][$row['modulename']] = $row;
}
if (count($all_modules) == 0) {
$session['skipmodules'] = true;
$session['stagecompleted'] = $stage;
header("Location: installer.php?stage=".($stage+1));
exit();
}
output_notl("`0");
rawoutput("<form action='installer.php?stage=".$stage."' method='POST'>");
rawoutput("<input type='submit' value='$submit' class='button'>");
rawoutput("<input type='button' onClick='chooseRecommendedModules();' class='button' value='$install' class='button'>");
rawoutput("<input type='reset' value='$reset' class='button'><br>");
rawoutput("<table cellpadding='1' cellspacing='1'>");
ksort($all_modules);
reset($all_modules);
$x=0;
while (list($categoryName,$categoryItems)=each($all_modules)){
rawoutput("<tr class='trhead'><td colspan='6'>".tl($categoryName)."</td></tr>");
rawoutput("<tr class='trhead'><td>".tl("Uninstalled")."</td><td>".tl("Installed")."</td><td>".tl("Activated")."</td><td>".tl("Recommended")."</td><td>".tl("Module Name")."</td><td>".tl("Author")."</td></tr>");
reset($categoryItems);
while (list($modulename,$moduleinfo)=each($categoryItems)){
$x++;
//if we specified things in a previous hit on this page, let's update the modules array here as we go along.
$moduleinfo['realactive'] = $moduleinfo['active'];
$moduleinfo['realinstalled'] = $moduleinfo['installed'];
if (array_key_exists('moduleoperations',$session) && is_array($session['moduleoperations']) && array_key_exists($modulename,$session['moduleoperations'])){
$ops = explode(",",$session['moduleoperations'][$modulename]);
reset($ops);
while (list($trash,$op) = each($ops)){
switch($op){
case "uninstall":
$moduleinfo['installed'] = false;
$moduleinfo['active'] = false;
break;
case "install":
$moduleinfo['installed'] = true;
$moduleinfo['active'] = false;
break;
case "activate":
$moduleinfo['installed'] = true;
$moduleinfo['active'] = true;
break;
case "deactivate":
$moduleinfo['installed'] = true;
$moduleinfo['active'] = false;
break;
case "donothing":
break;
}
}
}
rawoutput("<tr class='".($x%2?"trlight":"trdark")."'>");
if ($moduleinfo['realactive']){
$uninstallop = "uninstall";
$installop = "deactivate";
$activateop = "donothing";
}elseif ($moduleinfo['realinstalled']){
$uninstallop = "uninstall";
$installop = "donothing";
$activateop = "activate";
}else{
$uninstallop = "donothing";
$installop = "install";
$activateop = "install,activate";
}
$uninstallcheck = false;
$installcheck = false;
$activatecheck = false;
if ($moduleinfo['active']){
$activatecheck = true;
}elseif ($moduleinfo['installed']){
//echo "<font color='red'>$modulename is installed but not active.</font><br>";
$installcheck = true;
}else{
//echo "$modulename is uninstalled.<br>";
$uninstallcheck = true;
}
if (isset($moduleinfo['invalid']) && $moduleinfo['invalid'] == true) {
rawoutput("<td><input type='radio' name='modules[$modulename]' id='uninstall-$modulename' value='$uninstallop' checked disabled></td>");
rawoutput("<td><input type='radio' name='modules[$modulename]' id='install-$modulename' value='$installop' disabled></td>");
rawoutput("<td><input type='radio' name='modules[$modulename]' id='activate-$modulename' value='$activateop' disabled></td>");
} else {
rawoutput("<td><input type='radio' name='modules[$modulename]' id='uninstall-$modulename' value='$uninstallop'".($uninstallcheck?" checked":"")."></td>");
rawoutput("<td><input type='radio' name='modules[$modulename]' id='install-$modulename' value='$installop'".($installcheck?" checked":"")."></td>");
rawoutput("<td><input type='radio' name='modules[$modulename]' id='activate-$modulename' value='$activateop'".($activatecheck?" checked":"")."></td>");
}
output_notl("<td>".(in_array($modulename,$recommended_modules)?tl("`^Yes`0"):tl("`\$No`0"))."</td>",true);
require_once("lib/sanitize.php");
rawoutput("<td><span title=\"" .
(isset($moduleinfo['description']) &&
$moduleinfo['description'] ?
$moduleinfo['description'] :
sanitize($moduleinfo['formalname'])). "\">");
output_notl("`@");
if (isset($moduleinfo['invalid']) && $moduleinfo['invalid'] == true) {
rawoutput($moduleinfo['formalname']);
} else {
output($moduleinfo['formalname']);
}
output_notl(" [`%$modulename`@]`0");
rawoutput("</span></td><td>");
output_notl("`#{$moduleinfo['moduleauthor']}`0", true);
rawoutput("</td>");
rawoutput("</tr>");
}
}
rawoutput("</table>");
rawoutput("<br><input type='submit' value='$submit' class='button'>");
rawoutput("<input type='button' onClick='chooseRecommendedModules();' class='button' value='$install' class='button'>");
rawoutput("<input type='reset' value='$reset' class='button'>");
rawoutput("</form>");
rawoutput("<script language='JavaScript'>
function chooseRecommendedModules(){
var thisItem;
var selectedCount = 0;
");
reset($recommended_modules);
while (list($key,$val)=each($recommended_modules)){
rawoutput("thisItem = document.getElementById('activate-$val'); ");
rawoutput("if (!thisItem.checked) { selectedCount++; thisItem.checked=true; }\n");
}
rawoutput("
alert('I selected '+selectedCount+' modules that I recommend, but which were not already selected.');
}");
if (!$session['dbinfo']['upgrade']){
rawoutput("
chooseRecommendedModules();");
}
rawoutput("
</script>");
}
?>

View File

@ -0,0 +1,143 @@
<?php
require_once("lib/installer/installer_sqlstatements.php");
require_once("lib/installer/installer_functions.php");
require_once("lib/installer/installer_default_settings.php");
output("`@`c`bBuilding the Tables`b`c");
output("`2I'm now going to build the tables.");
output("If this is an upgrade, your current tables will be brought in line with the current version.");
output("If it's an install, the necessary tables will be placed in your database.`n");
output("`n`@Table Synchronization Logs:`n");
rawoutput("<div style='width: 100%; height: 150px; max-height: 150px; overflow: auto;'>");
$descriptors = descriptors($DB_PREFIX);
require_once("lib/tabledescriptor.php");
reset($descriptors);
while (list($tablename,$descriptor)=each($descriptors)){
output("`3Synchronizing table `#$tablename`3..`n");
synctable($tablename,$descriptor,true);
if ($session['dbinfo']['upgrade']==false){
//on a clean install, destroy all old data.
db_query("TRUNCATE TABLE $tablename");
}
}
rawoutput("</div>");
output("`n`2The tables now have new fields and columns added, I'm going to begin importing data now.`n");
rawoutput("<div style='width: 100%; height: 150px; max-height: 150px; overflow: auto;'>");
$dosql = false;
reset($sql_upgrade_statements);
while (list($key,$val)=each($sql_upgrade_statements)){
if ($dosql){
output("`3Version `#%s`3: %s SQL statements...`n",$key,count($val));
if (count($val)>0){
output("`^Doing: `6");
reset($val);
$count=0;
while (list($id,$sql)=each($val)){
$onlyupgrade = 0;
if (substr($sql, 0, 2) == "1|") {
$sql = substr($sql, 2);
$onlyupgrade = 1;
}
// Skip any statements that should only be run during
// upgrades from previous versions.
if (!$session['dbinfo']['upgrade'] && $onlyupgrade) {
continue;
}
$count++;
if ($count%10==0 && $count!=count($val))
output_notl("`6$count...");
if (!db_query($sql)) {
output("`n`\$Error: `^'%s'`7 executing `#'%s'`7.`n",
db_error(), $sql);
}
}
output("$count.`n");
}
}
if ($key == $session['fromversion'] ||
$session['dbinfo']['upgrade'] == false) $dosql=true;
}
rawoutput("</div>");
output("Now I'm going to insert default settings that you don't have.");
rawoutput("<div style='width: 100%; height: 150px; max-height: 150px; overflow: auto;'>");
foreach ($default_settings as $setting_name=>$setting_value) {
if(!isset($settings[$setting_name]) && getsetting($setting_name, $setting_value) == $setting_value) {
if ($setting_value === true) {
$setting_value = "true";
}elseif ($setting_value === false) {
$setting_value = "false";
}
output_notl("Setting $setting_name to default value of $setting_value`n");
}
}
rawoutput("</div>");
/*
output("`n`2Now I'll install the recommended modules.");
output("Please note that these modules will be installed, but not activated.");
output("Once installation is complete, you should use the Module Manager found in the superuser grotto to activate those modules you wish to use.");
reset($recommended_modules);
rawoutput("<div style='width: 100%; height: 150px; max-height: 150px; overflow: auto;'>");
while (list($key,$modulename)=each($recommended_modules)){
output("`3Installing `#$modulename`\$`n");
install_module($modulename, false);
}
rawoutput("</div>");
*/
if (!$session['skipmodules']) {
output("`n`2Now I'll install and configure your modules.");
rawoutput("<div style='width: 100%; height: 150px; max-height: 150px; overflow: auto;'>");
foreach($session['moduleoperations'] as $modulename=>$val){
$ops = explode(",",$val);
reset($ops);
while (list($trash,$op) = each($ops)){
switch($op){
case "uninstall":
output("`3Uninstalling `#$modulename`3: ");
if (uninstall_module($modulename)){
output("`@OK!`0`n");
}else{
output("`\$Failed!`0`n");
}
break;
case "install":
output("`3Installing `#$modulename`3: ");
if (install_module($modulename)){
output("`@OK!`0`n");
}else{
output("`\$Failed!`0`n");
}
install_module($modulename);
break;
case "activate":
output("`3Activating `#$modulename`3: ");
if (activate_module($modulename)){
output("`@OK!`0`n");
}else{
output("`\$Failed!`0`n");
}
break;
case "deactivate":
output("`3Deactivating `#$modulename`3: ");
if (deactivate_module($modulename)){
output("`@OK!`0`n");
}else{
output("`\$Failed!`0`n");
}
break;
case "donothing":
break;
}
}
$session['moduleoperations'][$modulename] = "donothing";
}
rawoutput("</div>");
}
output("`n`2Finally, I'll clean up old data.`n");
rawoutput("<div style='width: 100%; height: 150px; max-height: 150px; overflow: auto;'>");
reset($descriptors);
while (list($tablename,$descriptor)=each($descriptors)){
output("`3Cleaning up `#$tablename`3...`n");
synctable($tablename,$descriptor);
}
rawoutput("</div>");
output("`n`n`^You're ready for the next step.");
?>

View File

@ -0,0 +1,13 @@
<?php
output("`@`c`bAll Done!`b`c");
output("Your install of Legend of the Green Dragon has been completed!`n");
output("`nRemember us when you have hundreds of users on your server, enjoying the game.");
output("Eric, JT, and a lot of others put a lot of work into this world, so please don't disrespect that by violating the license.");
if ($session['user']['loggedin']){
addnav("Continue",$session['user']['restorepage']);
}else{
addnav("Login Screen","./");
}
savesetting("installer_version",$logd_version);
$noinstallnavs=true;
?>

View File

@ -0,0 +1,8 @@
<?php
// translator ready
// addnews ready
// mail ready
function is_email($email){
return preg_match("/[[:alnum:]_.-]+[@][[:alnum:]_.-]{2,}\\.[[:alnum:]_.-]{2,}/",$email);
}
?>

View File

@ -0,0 +1,14 @@
<?php
// Make PHP know about the memory limit.
// Please note, this will not work if you are running in safe mode.
// If you are, then you will need to find some other way of increasing
// your memory limit. This increase is needed because when going to
// install all modules, it is very possible to blow out this memory as
// it tries to load and compile every selected module file.
// Of course, people shouldn't be doing that, but people seem to think
// that more is better always, even when it's not. Just blame it on the
// 'supersize society' we live in.
ini_set("memory_limit","64M");
ini_set("max_execution_time", "90");
?>

View File

@ -0,0 +1,43 @@
<?php
function lookup_user($query=false, $order=false, $fields=false, $where=false){
$err = "";
$searchresult = false;
if ($order !== false) $order = "ORDER BY $order";
if ($fields === false) $fields = "acctid,login,name,level,laston,loggedin,gentimecount,gentime,lastip,uniqueid,emailaddress";
$sql = "SELECT $fields FROM " . db_prefix("accounts");
if ($query != "") {
// First try for an exact match on username or login
if ($where === false)
$sql_where = "WHERE login LIKE '$query' OR name LIKE '$query' OR acctid = 'query' OR emailaddress LIKE '$query' OR lastip LIKE '$query' OR uniqueid LIKE '$query'";
else
$sql_where = "WHERE $where";
$searchresult = db_query($sql . " $sql_where $order LIMIT 2");
}
if ($query !== false || $searchresult) {
if (db_num_rows($searchresult) != 1) {
// we didn't find an exact match
$name_query = "%";
for ($x=0;$x<strlen($query);$x++){
$name_query .= substr($query,$x,1)."%";
}
if ($where === false)
$sql_where="WHERE login LIKE '%$query%' OR acctid LIKE '%$query%' OR name LIKE '%$name_query%' OR emailaddress LIKE '%$query%' OR lastip LIKE '%$query%' OR uniqueid LIKE '%$query%' OR gentimecount LIKE '%$query%' OR level LIKE '%$query%'";
else
$sql_where = "WHERE $where";
$searchresult = db_query($sql . " $sql_where $order LIMIT 101");
}
if (db_num_rows($searchresult)<=0){
$err = "`\$No results found`0";
}elseif (db_num_rows($searchresult)>100){
$err = "`\$Too many results found, narrow your search please.`0";
}else{
// Everything is good
}
}
return array($searchresult, $err);
}
?>

415
lotgd-web/lotgd/lib/mail.php Executable file
View File

@ -0,0 +1,415 @@
<?php
// translator ready
// addnews ready
// mail ready
define("OVERRIDE_FORCED_NAV",true);
require_once("common.php");
require_once("lib/systemmail.php");
require_once("lib/sanitize.php");
require_once("lib/http.php");
tlschema("mail");
$superusermessage = getsetting("superuseryommessage","Asking an admin for gems, gold, weapons, armor, or anything else which you have not earned will not be honored. If you are experiencing problems with the game, please use the 'Petition for Help' link instead of contacting an admin directly.");
$sql = "DELETE FROM " . db_prefix("mail") . " WHERE sent<'".date("Y-m-d H:i:s",strtotime("-".getsetting("oldmail",14)."days"))."'";
db_query($sql);
// really needs to relocated. Performancekiller.
// Ndro with global mail-* invalidation
//
$op = httpget('op');
$id = httpget('id');
if($op=="del"){
$sql = "DELETE FROM " . db_prefix("mail") . " WHERE msgto='".$session['user']['acctid']."' AND messageid='$id'";
db_query($sql);
//<Edo>
invalidatedatacache("mail-{$session['user']['acctid']}");
//</Edo>
header("Location: mail.php");
exit();
}elseif($op=="process"){
$msg = httppost('msg');
if (!is_array($msg) || count($msg)<1){
$session['message'] = "`\$`bYou cannot delete zero messages! What does this mean? You pressed \"Delete Checked\" but there are no messages checked! What sort of world is this that people press buttons that have no meaning?!?`b`0";
header("Location: mail.php");
}else{
$sql = "DELETE FROM " . db_prefix("mail") . " WHERE msgto='".$session['user']['acctid']."' AND messageid IN ('".join("','",$msg)."')";
db_query($sql);
invalidatedatacache("mail-{$session['user']['acctid']}");
header("Location: mail.php");
exit();
}
}elseif ($op=="unread"){
$sql = "UPDATE " . db_prefix("mail") . " SET seen=0 WHERE msgto='".$session['user']['acctid']."' AND messageid='$id'";
db_query($sql);
invalidatedatacache("mail-{$session['user']['acctid']}");
header("Location: mail.php");
exit();
}
popup_header("Ye Olde Poste Office");
$inbox = translate_inline("Inbox");
$write = translate_inline("Write");
// Build the initial args array
$args = array();
array_push($args, array("mail.php", $inbox));
array_push($args, array("mail.php?op=address",$write));
// to use this hook,
// just call array_push($args, array("pagename", "functionname"));,
// where "pagename" is the name of the page to forward the user to,
// and "functionname" is the name of the mail function to add
$mailfunctions = modulehook("mailfunctions", $args);
//output_notl("<table width='25%' border='0' cellpadding='0' cellspacing='2'><tr><td><a href='mail.php' class='motd'>$inbox</a></td><td><a href='mail.php?op=address' class='motd'>$write</a></td>", true);
rawoutput("<table width='50%' border='0' cellpadding='0' cellspacing='2'>");
rawoutput("<tr>");
for($i=0;$i<count($mailfunctions);$i++) {
if (is_array($mailfunctions[$i])) {
if (count($mailfunctions[$i])==2) {
$page = $mailfunctions[$i][0];
$name = $mailfunctions[$i][1]; // already translated
rawoutput("<td><a href='$page' class='motd'>$name</a></td>");
// addnav("", $page);
// No need for addnav since mail function pages are (or should
// be) outside the page nav system.
}
}
}
rawoutput("</tr></table>");
output_notl("`n`n");
if($op=="send"){
$to = httppost('to');
$sql = "SELECT acctid FROM " . db_prefix("accounts") . " WHERE login='$to'";
$result = db_query($sql);
if (db_num_rows($result)>0){
$row1 = db_fetch_assoc($result);
$sql = "SELECT count(messageid) AS count FROM " . db_prefix("mail") . " WHERE msgto='".$row1['acctid']."' AND seen=0";
$result = db_query($sql);
$row = db_fetch_assoc($result);
if ($row['count']>=getsetting("inboxlimit",50)) {
output("`\$You cannot send that person mail, their mailbox is full!`0`n`n");
}else{
$subject = str_replace("`n","",httppost('subject'));
$body = str_replace("`n","\n",httppost('body'));
$body = str_replace("\r\n","\n",$body);
$body = str_replace("\r","\n",$body);
$body = addslashes(substr(stripslashes($body),0,(int)getsetting("mailsizelimit",1024)));
systemmail($row1['acctid'],$subject,$body,$session['user']['acctid']);
output("Your message was sent!`n");
}
}else{
output("Could not find the recipient, please try again.`n");
}
if (httppost("returnto")>""){
$op="read";
httpset('op','read');
$id = httppost('returnto');
httpset('id',$id);
}else{
$op="";
httpset('op', "");
}
}
if ($op==""){
output("`b`iMail Box`i`b");
if (isset($session['message'])) {
output($session['message']);
}
$session['message']="";
$sql = "SELECT subject,messageid," . db_prefix("accounts") . ".name,msgfrom,seen,sent FROM " . db_prefix("mail") . " LEFT JOIN " . db_prefix("accounts") . " ON " . db_prefix("accounts") . ".acctid=" . db_prefix("mail") . ".msgfrom WHERE msgto=\"".$session['user']['acctid']."\" ORDER BY sent DESC";
$result = db_query($sql);
if (db_num_rows($result)>0){
output_notl("<form action='mail.php?op=process' method='POST'><table>",true);
for ($i=0;$i<db_num_rows($result);$i++){
$row = db_fetch_assoc($result);
if ((int)$row['msgfrom']==0){
$row['name']=translate_inline("`i`^System`0`i");
// Only translate the subject if it's an array, ie, it came
// from the game.
if (is_array(@unserialize($row['subject']))) {
$row['subject'] = unserialize($row['subject']);
$row['subject'] =
call_user_func_array("sprintf_translate",
$row['subject']);
}
}
output_notl("<tr>",true);
output_notl("<td nowrap><input id='checkbox$i' type='checkbox' name='msg[]' value='{$row['messageid']}'><img src='images/".($row['seen']?"old":"new")."scroll.GIF' width='16' height='16' alt='".($row['seen']?"Old":"New")."'></td>",true);
output_notl("<td><a href='mail.php?op=read&id={$row['messageid']}'>",true);
if (trim($row['subject'])=="")
output("`i(No Subject)`i");
else
output_notl($row['subject']);
output_notl("</a></td><td><a href='mail.php?op=read&id={$row['messageid']}'>",true);
output_notl($row['name']);
output_notl("</a></td><td><a href='mail.php?op=read&id={$row['messageid']}'>".date("M d, h:i a",strtotime($row['sent']))."</a></td>",true);
output_notl("</tr>",true);
}
output_notl("</table>",true);
$checkall = htmlentities(translate_inline("Check All"));
$out="<input type='button' value=\"$checkall\" class='button' onClick='";
for ($i=$i-1;$i>=0;$i--){
$out.="document.getElementById(\"checkbox$i\").checked=true;";
}
$out.="'>";
output_notl($out,true);
$delchecked = htmlentities(translate_inline("Delete Checked"));
output_notl("<input type='submit' class='button' value=\"$delchecked\">",true);
output_notl("</form>",true);
}else{
output("`iAww, you have no mail, how sad.`i");
}
output("`n`n`iYou currently have %s messages in your inbox.`nYou will no longer be able to receive messages from players if you have more than %s unread messages in your inbox. `nMessages are automatically deleted (read or unread) after %s days.",db_num_rows($result),getsetting('inboxlimit',50),getsetting("oldmail",14));
}elseif ($op=="read"){
$sql = "SELECT " . db_prefix("mail") . ".*,". db_prefix("accounts"). ".name FROM " . db_prefix("mail") ." LEFT JOIN " . db_prefix("accounts") . " ON ". db_prefix("accounts") . ".acctid=" . db_prefix("mail"). ".msgfrom WHERE msgto=\"".$session['user']['acctid']."\" AND messageid=\"".$id."\"";
$result = db_query($sql);
if (db_num_rows($result)>0){
$row = db_fetch_assoc($result);
if ((int)$row['msgfrom']==0){
$row['name']=translate_inline("`i`^System`0`i");
// No translation for subject if it's not an array
if (is_array(@unserialize($row['subject']))) {
$row['subject'] = unserialize($row['subject']);
$row['subject'] =
call_user_func_array("sprintf_translate", $row['subject']);
}
// No translation for body if it's not an array
if (is_array(@unserialize($row['body']))) {
$row['body'] = unserialize($row['body']);
$row['body'] =
call_user_func_array("sprintf_translate", $row['body']);
}
}
if (!$row['seen']) output("`b`#NEW`b`n");
else output("`n");
output("`b`2From:`b `^%s`n",$row['name']);
output("`b`2Subject:`b `^%s`n",$row['subject']);
output("`b`2Sent:`b `^%s`n",$row['sent']);
output_notl("<img src='images/uscroll.GIF' width='182' height='11' alt='' align='center'>`n",true);
output_notl(str_replace("\n","`n",$row['body']));
output_notl("`n<img src='images/lscroll.GIF' width='182' height='11' alt='' align='center'>`n",true);
$sql = "UPDATE " . db_prefix("mail") . " SET seen=1 WHERE msgto=\"".$session['user']['acctid']."\" AND messageid=\"".$id."\"";
db_query($sql);
$reply = translate_inline("Reply");
$del = translate_inline("Delete");
$unread = translate_inline("Mark Unread");
$report = translate_inline("Report to Admin");
$problem = "Abusive Email Report:\nFrom: {$row['name']}\nSubject: {$row['subject']}\nSent: {$row['sent']}\nID: {$row['messageid']}\nBody:\n{$row['body']}";
rawoutput("<table width='50%' border='0' cellpadding='0' cellspacing='5'><tr>
<td><a href='mail.php?op=write&replyto={$row['messageid']}' class='motd'>$reply</a></td>
<td><a href='mail.php?op=del&id={$row['messageid']}' class='motd'>$del</a></td>
</tr><tr>
<td><a href='mail.php?op=unread&id={$row['messageid']}' class='motd'>$unread</a></td>");
// Don't allow reporting of system messages as abuse.
if ((int)$row['msgfrom']!=0) {
rawoutput("<td><a href=\"petition.php?problem=".rawurlencode($problem)."&abuse=yes\" class='motd'>$report</a></td>");
} else {
rawoutput("<td align='right'>&nbsp;</td>");
}
rawoutput("</tr><tr>");
$sql = "SELECT messageid FROM ".db_prefix("mail")." WHERE msgto='{$session['user']['acctid']}' AND messageid < '$id' ORDER BY messageid DESC LIMIT 1";
$result = db_query($sql);
if (db_num_rows($result)>0){
$row = db_fetch_assoc($result);
$pid = $row['messageid'];
}else{
$pid = 0;
}
$sql = "SELECT messageid FROM ".db_prefix("mail")." WHERE msgto='{$session['user']['acctid']}' AND messageid > '$id' ORDER BY messageid LIMIT 1";
$result = db_query($sql);
if (db_num_rows($result)>0){
$row = db_fetch_assoc($result);
$nid = $row['messageid'];
}else{
$nid = 0;
}
$prev = translate_inline("< Previous");
$next = translate_inline("Next >");
rawoutput("<td nowrap='true'>");
if ($pid > 0) rawoutput("<a href='mail.php?op=read&id=$pid' class='motd'>".htmlentities($prev)."</a>");
else rawoutput(htmlentities($prev));
rawoutput("</td><td nowrap='true'>");
if ($nid > 0) rawoutput("<a href='mail.php?op=read&id=$nid' class='motd'>".htmlentities($next)."</a>");
else rawoutput(htmlentities($next));
rawoutput("</td>");
rawoutput("</tr></table>");
}else{
output("Eek, no such message was found!");
}
}elseif($op=="address"){
output_notl("<form action='mail.php?op=write' method='POST'>",true);
output("`b`2Address:`b`n");
$to = translate_inline("To: ");
$search = htmlentities(translate_inline("Search"));
output_notl("`2$to <input name='to' value=\"".htmlentities(stripslashes(httpget('prepop')))."\"> <input type='submit' class='button' value=\"$search\"></form>",true);
}elseif($op=="write"){
$subject=httppost('subject');
$body="";
$row = "";
output_notl("<form action='mail.php?op=send' method='POST'>",true);
$replyto = httpget('replyto');
if ($replyto!=""){
$sql = "SELECT ". db_prefix("mail") . ".body," . db_prefix("mail") . ".msgfrom, " . db_prefix("mail") . ".subject,". db_prefix("accounts") . ".login, superuser, " . db_prefix("accounts"). ".name FROM " . db_prefix("mail") . " LEFT JOIN " . db_prefix("accounts") . " ON " . db_prefix("accounts") . ".acctid=" . db_prefix("mail") . ".msgfrom WHERE msgto=\"".$session['user']['acctid']."\" AND messageid=\"".$replyto."\"";
$result = db_query($sql);
if (db_num_rows($result)>0){
$row = db_fetch_assoc($result);
if ($row['login']=="") {
output("You cannot reply to a system message.`n");
$row=array();
}
}else{
output("Eek, no such message was found!`n");
}
}
$to = httpget('to');
if ($to!=""){
$sql = "SELECT login,name, superuser FROM " . db_prefix("accounts") . " WHERE login=\"$to\"";
$result = db_query($sql);
if (db_num_rows($result)>0){
$row = db_fetch_assoc($result);
}else{
output("Could not find that person.`n");
}
}
if (is_array($row)){
if (isset($row['subject']) && $row['subject']!=""){
if ((int)$row['msgfrom']==0){
$row['name']=translate_inline("`i`^System`0`i");
// No translation for subject if it's not an array
if (is_array(@unserialize($row['subject']))) {
$row['subject'] = unserialize($row['subject']);
$row['subject'] =
call_user_func_array("sprintf_translate",
$row['subject']);
}
// No translation for body if it's not an array
if (is_array(@unserialize($row['body']))) {
$row['body'] = unserialize($row['body']);
$row['body'] =
call_user_func_array("sprintf_translate",
$row['body']);
}
}
$subject=$row['subject'];
if (substr($subject,0,4)!="RE: ") $subject="RE: $subject";
}
if (isset($row['body']) && $row['body']!=""){
$body="\n\n---".translate_inline("Original Message")."---\n".$row['body'];
}
}
rawoutput("<input type='hidden' name='returnto' value=\"".htmlentities(stripslashes(httpget("replyto")))."\">");
$superusers = array();
if (isset($row['login']) && $row['login']!=""){
output_notl("<input type='hidden' name='to' id='to' value=\"".htmlentities($row['login'])."\">",true);
output("`2To: `^%s`n",$row['name']);
if (($row['superuser'] & SU_GIVES_YOM_WARNING) &&
!($row['superuser'] & SU_OVERRIDE_YOM_WARNING)) {
array_push($superusers,$row['login']);
}
}else{
output("`2To: ");
$to = httppost('to');
$string="%";
for ($x=0;$x<strlen($to);$x++){
$string .= substr($to,$x,1)."%";
}
$sql = "SELECT login,name, superuser FROM " . db_prefix("accounts") . " WHERE name LIKE '".addslashes($string)."' AND locked=0 ORDER by login='$to' DESC, name='$to' DESC, login";
$result = db_query($sql);
if (db_num_rows($result)==1){
$row = db_fetch_assoc($result);
output_notl("<input type='hidden' id='to' name='to' value=\"".htmlentities($row['login'])."\">",true);
output_notl("`^{$row['name']}`n");
if (($row['superuser'] & SU_GIVES_YOM_WARNING) &&
!($row['superuser'] & SU_OVERRIDE_YOM_WARNING)) {
array_push($superusers,$row['login']);
}
}elseif (db_num_rows($result)==0){
output("`@No one was found who matches \"%s\". ",stripslashes($to));
$try = translate_inline("Please try again");
output_notl("<a href=\"mail.php?op=address&prepop=".rawurlencode(stripslashes(htmlentities($to)))."\">$try</a>.",true);
popup_footer();
exit();
}else{
output_notl("<select name='to' id='to' onChange='check_su_warning();'>",true);
$superusers = array();
for ($i=0;$i<db_num_rows($result);$i++){
$row = db_fetch_assoc($result);
output_notl("<option value=\"".HTMLEntities($row['login'])."\">",true);
output_notl("%s", full_sanitize($row['name']));
if (($row['superuser'] & SU_GIVES_YOM_WARNING) &&
!($row['superuser'] & SU_OVERRIDE_YOM_WARNING)) {
array_push($superusers,$row['login']);
}
}
output_notl("</select>`n",true);
}
}
rawoutput("<script language='JavaScript'>
var superusers = new Array();");
while (list($key,$val)=each($superusers)){
rawoutput(" superusers['".addslashes($val)."'] = true;");
}
rawoutput("</script>");
output("`2Subject:");
rawoutput("<input name='subject' value=\"".HTMLEntities($subject).HTMLEntities(stripslashes(httpget('subject')))."\"><br>");
rawoutput("<div id='warning' style='visibility: hidden; display: none;'>");
output("`2Notice: `^$superusermessage`n");
rawoutput("</div>");
output("`2Body:`n");
rawoutput("<textarea name='body' id='textarea' class='input' cols='60' rows='9' onKeyUp='sizeCount(this);'>".HTMLEntities($body).HTMLEntities(stripslashes(httpget('body')))."</textarea><br>");
$send = translate_inline("Send");
rawoutput("<table border='0' cellpadding='0' cellspacing='0' width='100%'><tr><td><input type='submit' class='button' value='$send'></td><td align='right'><div id='sizemsg'></div></td></tr></table>");
output_notl("</form>",true);
$sizemsg = "`#Max message size is `@%s`#, you have `^XX`# characters left.";
$sizemsg = translate_inline($sizemsg);
$sizemsg = sprintf($sizemsg,getsetting("mailsizelimit",1024));
$sizemsgover = "`\$Max message size is `@%s`\$, you are over by `^XX`\$ characters!";
$sizemsgover = translate_inline($sizemsgover);
$sizemsgover = sprintf($sizemsgover,getsetting("mailsizelimit",1024));
$sizemsg = explode("XX",$sizemsg);
$sizemsgover = explode("XX",$sizemsgover);
$usize1 = addslashes("<span>".appoencode($sizemsg[0])."</span>");
$usize2 = addslashes("<span>".appoencode($sizemsg[1])."</span>");
$osize1 = addslashes("<span>".appoencode($sizemsgover[0])."</span>");
$osize2 = addslashes("<span>".appoencode($sizemsgover[1])."</span>");
rawoutput("
<script language='JavaScript'>
var maxlen = ".getsetting("mailsizelimit",1024).";
function sizeCount(box){
var len = box.value.length;
var msg = '';
if (len <= maxlen){
msg = '$usize1'+(maxlen-len)+'$usize2';
}else{
msg = '$osize1'+(len-maxlen)+'$osize2';
}
document.getElementById('sizemsg').innerHTML = msg;
}
sizeCount(document.getElementById('textarea'));
function check_su_warning(){
var to = document.getElementById('to');
var warning = document.getElementById('warning');
if (superusers[to.value]){
warning.style.visibility = 'visible';
warning.style.display = 'inline';
}else{
warning.style.visibility = 'hidden';
warning.style.display = 'none';
}
}
check_su_warning();
</script>");
}
popup_footer();
?>

View File

@ -0,0 +1,15 @@
<?php
output_notl("<form action='mail.php?op=write' method='post'>",true);
output("`b`2Address:`b`n");
$to = translate_inline("To: ");
$search = htmlentities(translate_inline("Search"), ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
output_notl("`2$to <input name='to' id='to' value=\"".htmlentities(stripslashes(httpget('prepop')), ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\">",true);
output_notl("<input type='submit' class='button' value=\"$search\">", true);
if ($session['user']['superuser'] & SU_IS_GAMEMASTER) {
$from = translate_inline("From: ");
output_notl("`n`2$from <input name='from' id='from'>`n", true);
output("`7`iLeave empty to send from your account!`i");
}
rawoutput("</form>");
rawoutput("<script type='text/javascript'>document.getElementById(\"to\").focus();</script>");
?>

View File

@ -0,0 +1,60 @@
<?php
output("`b`iMail Box`i`b");
if (isset($session['message'])) {
output($session['message']);
}
$session['message']="";
$mail = db_prefix("mail");
$accounts = db_prefix("accounts");
$sql = "SELECT subject,messageid,$accounts.name,msgfrom,seen,sent FROM $mail LEFT JOIN $accounts ON $accounts.acctid=$mail.msgfrom WHERE msgto=\"".$session['user']['acctid']."\" ORDER BY seen ASC, sent DESC";
$result = db_query($sql);
$db_num_rows = db_num_rows($result);
if ($db_num_rows>0){
$no_subject = translate_inline("`i(No Subject)`i");
rawoutput("<form action='mail.php?op=process' method='post'><table>");
while($row = db_fetch_assoc($result)){
rawoutput("<tr>");
rawoutput("<td nowrap><input type='checkbox' name='msg[]' value='{$row['messageid']}'>");
rawoutput("<img src='images/".($row['seen']?"old":"new")."scroll.GIF' width='16px' height='16px' alt='".($row['seen']?"Old":"New")."'></td>");
rawoutput("<td>");
if ($row['msgfrom']==0 || !is_numeric($row['msgfrom'])){
if ($row['msgfrom'] == 0 && is_numeric($row['msgfrom'])) {
$row['name']=translate_inline("`i`^System`0`i");
} else {
$row['name']=$row['msgfrom'];
}
// Only translate the subject if it's an array, ie, it came from the game.
$row_subject = @unserialize($row['subject']);
if ($row_subject !== false) {
$row['subject'] = call_user_func_array("sprintf_translate", $row_subject);
} else {
$row['subject'] = translate_inline($row['subject']);
}
}
// In one line so the Translator doesn't screw the Html up
output_notl("<a href='mail.php?op=read&id={$row['messageid']}'>".((trim($row['subject']))?$row['subject']:$no_subject)."</a>", true);
rawoutput("</td><td><a href='mail.php?op=read&id={$row['messageid']}'>");
output_notl($row['name']);
rawoutput("</a></td><td><a href='mail.php?op=read&id={$row['messageid']}'>".date("M d, h:i a",strtotime($row['sent']))."</a></td>");
rawoutput("</tr>");
}
rawoutput("</table>");
$checkall = htmlentities(translate_inline("Check All"), ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
rawoutput("<input type='button' value=\"$checkall\" class='button' onClick='
var elements = document.getElementsByName(\"msg[]\");
for(i = 0; i < elements.length; i++) {
elements[i].checked = true;
}
'>");
$delchecked = htmlentities(translate_inline("Delete Checked"), ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
rawoutput("<input type='submit' class='button' value=\"$delchecked\">");
rawoutput("</form>");
}else{
output("`iAww, you have no mail, how sad.`i");
}
if (db_num_rows($result) == 1) {
output("`n`n`iYou currently have 1 message in your inbox.`nYou will no longer be able to receive messages from players if you have more than %s unread messages in your inbox. `nMessages are automatically deleted (read or unread) after %s days.",getsetting('inboxlimit',50),getsetting("oldmail",14));
} else {
output("`n`n`iYou currently have %s messages in your inbox.`nYou will no longer be able to receive messages from players if you have more than %s unread messages in your inbox. `nMessages are automatically deleted (read or unread) after %s days.",db_num_rows($result),getsetting('inboxlimit',50),getsetting("oldmail",14));
}
?>

View File

@ -0,0 +1,95 @@
<?php
$mail = db_prefix('mail');
$accounts = db_prefix('accounts');
$sql = "SELECT $mail.*, $accounts.name FROM $mail LEFT JOIN $accounts ON $accounts.acctid=$mail.msgfrom WHERE msgto=\"".$session['user']['acctid']."\" AND messageid=\"".$id."\"";
$result = db_query($sql);
if (db_num_rows($result)>0){
$row = db_fetch_assoc($result);
if ($row['msgfrom']==0 || !is_numeric($row['msgfrom'])){
if ($row['msgfrom'] == 0 && is_numeric($row['msgfrom'])) {
$row['name']=translate_inline("`i`^System`0`i");
} else {
$row['name']=$row['msgfrom'];
}
// No translation for subject if it's not an array
$row_subject = @unserialize($row['subject']);
if ($row_subject !== false) {
$row['subject'] = call_user_func_array("sprintf_translate", $row_subject);
}
// No translation for body if it's not an array
$row_body = @unserialize($row['body']);
if ($row_body !== false) {
$row['body'] = call_user_func_array("sprintf_translate", $row_body);
}
}
if (!$row['seen']) {
output("`b`#NEW`b`n");
}else{
output("`n");
}
output("`b`2From:`b `^%s`n",$row['name']);
output("`b`2Subject:`b `^%s`n",$row['subject']);
output("`b`2Sent:`b `^%s`n",$row['sent']);
output_notl("<img src='images/uscroll.GIF' width='182px' height='11px' alt='' align='center'>`n",true);
output_notl(str_replace("\n","`n",$row['body']));
output_notl("`n<img src='images/lscroll.GIF' width='182px' height='11px' alt='' align='center'>`n",true);
$sql = "UPDATE " . db_prefix("mail") . " SET seen=1 WHERE msgto=\"".$session['user']['acctid']."\" AND messageid=\"".$id."\"";
db_query($sql);
invalidatedatacache("mail-{$session['user']['acctid']}");
$reply = translate_inline("Reply");
$del = translate_inline("Delete");
$unread = translate_inline("Mark Unread");
$report = translate_inline("Report to Admin");
$problem = "Abusive Email Report:\nFrom: {$row['name']}\nSubject: {$row['subject']}\nSent: {$row['sent']}\nID: {$row['messageid']}\nBody:\n{$row['body']}";
rawoutput("<table width='50%' border='0' cellpadding='0' cellspacing='5'><tr>");
if ($row['msgfrom'] > 0 && is_numeric($row['msgfrom'])) {
rawoutput("<td><a href='mail.php?op=write&replyto={$row['messageid']}' class='motd'>$reply</a></td>");
} else {
rawoutput("<td>&nbsp;</td>");
}
rawoutput("<td><a href='mail.php?op=del&id={$row['messageid']}' class='motd'>$del</a></td>
</tr><tr>
<td><a href='mail.php?op=unread&id={$row['messageid']}' class='motd'>$unread</a></td>");
// Don't allow reporting of system messages as abuse.
if ((int)$row['msgfrom']!=0) {
rawoutput("<td><a href=\"petition.php?problem=".rawurlencode($problem)."&abuse=yes\" class='motd'>$report</a></td>");
} else {
rawoutput("<td>&nbsp;</td>");
}
rawoutput("</tr><tr>");
$sql = "SELECT messageid FROM $mail WHERE msgto='{$session['user']['acctid']}' AND messageid < '$id' ORDER BY messageid DESC LIMIT 1";
$result = db_query($sql);
if (db_num_rows($result)>0){
$row = db_fetch_assoc($result);
$pid = $row['messageid'];
}else{
$pid = 0;
}
$sql = "SELECT messageid FROM $mail WHERE msgto='{$session['user']['acctid']}' AND messageid > '$id' ORDER BY messageid LIMIT 1";
$result = db_query($sql);
if (db_num_rows($result)>0){
$row = db_fetch_assoc($result);
$nid = $row['messageid'];
}else{
$nid = 0;
}
$prev = translate_inline("< Previous");
$next = translate_inline("Next >");
rawoutput("<td nowrap='true'>");
if ($pid > 0) {
rawoutput("<a href='mail.php?op=read&id=$pid' class='motd'>".htmlentities($prev, ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."</a>");
}else{
rawoutput(htmlentities($prev), ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
}
rawoutput("</td><td nowrap='true'>");
if ($nid > 0){
rawoutput("<a href='mail.php?op=read&id=$nid' class='motd'>".htmlentities($next, ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."</a>");
}else{
rawoutput(htmlentities($next), ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
}
rawoutput("</td>");
rawoutput("</tr></table>");
}else{
output("Eek, no such message was found!");
}
?>

View File

@ -0,0 +1,49 @@
<?php
$to = httppost('to');
if ($session['user']['superuser'] & SU_IS_GAMEMASTER) {
$from = httppost('from');
if ($from == "" || is_numeric(trim($from)) || $from == "0") {
$from = $session['user']['acctid'];
}
} else {
$from = $session['user']['acctid'];
}
$sql = "SELECT acctid FROM " . db_prefix("accounts") . " WHERE login='$to'";
$result = db_query($sql);
if(db_num_rows($result)>0){
$row1 = db_fetch_assoc($result);
if (getsetting("onlyunreadmails",true)) {
$maillimitsql = "AND seen=0";
} else {
$maillimitsql = "";
}
$sql = "SELECT count(messageid) AS count FROM " . db_prefix("mail") . " WHERE msgto='".$row1['acctid']."' $maillimitsql";
$result = db_query($sql);
$row = db_fetch_assoc($result);
if ($row['count']>=getsetting("inboxlimit",50)) {
output("`\$You cannot send that person mail, their mailbox is full!`0`n`n");
}else{
$subject = str_replace("`n","",httppost('subject'));
$body = str_replace("`n","\n",httppost('body'));
$body = str_replace("\r\n","\n",$body);
$body = str_replace("\r","\n",$body);
$body = addslashes(substr(stripslashes($body),0,(int)getsetting("mailsizelimit",1024)));
require_once("lib/systemmail.php");
systemmail($row1['acctid'],$subject,$body,$from);
invalidatedatacache("mail-{$row1['acctid']}");
output("Your message was sent!`n");
}
}else{
output("Could not find the recipient, please try again.`n");
}
if(httppost("returnto")){
$op="read";
httpset('op','read');
$id = httppost('returnto');
httpset('id',$id);
}else{
$op="";
httpset('op', "");
}
?>

View File

@ -0,0 +1,171 @@
<?php
$subject=httppost('subject');
$body="";
$row="";
$replyto = (int)httpget('replyto');
if ($session['user']['superuser'] & SU_IS_GAMEMASTER) {
$from = httppost('from');
}
if ($replyto!=""){
$mail = db_prefix("mail");
$accounts = db_prefix("accounts");
$sql = "SELECT ".$mail.".sent,".$mail.".body,".$mail.".msgfrom, ".$mail.".subject,".$accounts.".login, ".$accounts.".superuser, ".$accounts.".name FROM ".$mail." LEFT JOIN ".$accounts." ON ".$accounts.".acctid=".$mail.".msgfrom WHERE msgto=\"".$session['user']['acctid']."\" AND messageid=\"".$replyto."\"";
$result = db_query($sql);
if ($row = db_fetch_assoc($result)){
if ($row['login']=="") {
output("You cannot reply to a system message.`n");
$row=array();
}
}else{
output("Eek, no such message was found!`n");
}
}
$to = httpget('to');
if ($to){
$sql = "SELECT login,name, superuser FROM " . db_prefix("accounts") . " WHERE login=\"$to\"";
$result = db_query($sql);
if (!($row = db_fetch_assoc($result))){
output("Could not find that person.`n");
}
}
if (is_array($row)){
if (isset($row['subject']) && $row['subject']){
if ((int)$row['msgfrom']==0){
$row['name']=translate_inline("`i`^System`0`i");
// No translation for subject if it's not an array
$row_subject = @unserialize($row['subject']);
if ($row_subject !== false) {
$row['subject'] = call_user_func_array("sprintf_translate", $row_subject);
}
// No translation for body if it's not an array
$row_body = @unserialize($row['body']);
if ($row_body !== false) {
$row['body'] = call_user_func_array("sprintf_translate", $row_body);
}
}
$subject=$row['subject'];
if (strncmp($subject,"RE: ",4) !== 0 ) {
$subject="RE: $subject";
}
}
if (isset($row['body']) && $row['body']){
$body="\n\n---".sprintf_translate(array("Original Message from %s (%s)",sanitize($row['name']),date("Y-m-d H:i:s",strtotime($row['sent']))))."---\n".$row['body'];
}
}
rawoutput("<form action='mail.php?op=send' method='post'>");
if ($session['user']['superuser'] & SU_IS_GAMEMASTER) {
rawoutput("<input type='hidden' name='from' value='".htmlentities(stripslashes($from), ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."'>");
}
rawoutput("<input type='hidden' name='returnto' value=\"".htmlentities(stripslashes(httpget("replyto")), ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\">");
$superusers = array();
if (($session['user']['superuser'] & SU_IS_GAMEMASTER) && $from > "") {
output("`2From: `^%s`n", $from);
}
if (isset($row['login']) && $row['login']!=""){
output_notl("<input type='hidden' name='to' id='to' value=\"".htmlentities($row['login'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\">",true);
output("`2To: `^%s`n",$row['name']);
if (($row['superuser'] & SU_GIVES_YOM_WARNING) && !($row['superuser'] & SU_OVERRIDE_YOM_WARNING)) {
array_push($superusers,$row['login']);
}
}else{
output("`2To: ");
$to = httppost('to');
$sql = "SELECT login,name,superuser FROM accounts WHERE login = '".addslashes($to)."' AND locked = 0";
$result = db_query($sql);
$db_num_rows = db_num_rows($result);
if($db_num_rows != 1) {
$string="%";
$to_len = strlen($to);
for($x=0; $x < $to_len; ++$x) {
$string .= $to{$x}."%";
}
$sql = "SELECT login,name,superuser FROM " . db_prefix("accounts") . " WHERE name LIKE '".addslashes($string)."' AND locked=0 ORDER by login='$to' DESC, name='$to' DESC, login";
$result = db_query($sql);
$db_num_rows = db_num_rows($result);
}
if ($db_num_rows==1){
$row = db_fetch_assoc($result);
output_notl("<input type='hidden' id='to' name='to' value=\"".htmlentities($row['login'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\">",true);
output_notl("`^{$row['name']}`n");
if (($row['superuser'] & SU_GIVES_YOM_WARNING) && !($row['superuser'] & SU_OVERRIDE_YOM_WARNING)) {
array_push($superusers,$row['login']);
}
}elseif ($db_num_rows==0){
output("`\$No one was found who matches \"%s\".`n",stripslashes($to));
output("`@Please try again.`n");
httpset('prepop', $to, true);
rawoutput("</form>");
require("lib/mail/case_address.php");
popup_footer();
}else{
output_notl("<select name='to' id='to' onchange='check_su_warning();'>",true);
$superusers = array();
while($row = db_fetch_assoc($result)) {
output_notl("<option value=\"".htmlentities($row['login'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\">",true);
require_once("lib/sanitize.php");
output_notl("%s", full_sanitize($row['name']));
if (($row['superuser'] & SU_GIVES_YOM_WARNING) && !($row['superuser'] & SU_OVERRIDE_YOM_WARNING)) {
array_push($superusers,$row['login']);
}
}
output_notl("</select>`n",true);
}
}
rawoutput("<script type='text/javascript'>var superusers = new Array();");
foreach($superusers as $val) {
rawoutput(" superusers['".addslashes($val)."'] = true;");
}
rawoutput("</script>");
output("`2Subject:");
rawoutput("<input name='subject' value=\"".htmlentities($subject).htmlentities(stripslashes(httpget('subject')), ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\"><br>");
rawoutput("<div id='warning' style='visibility: hidden; display: none;'>");
output("`2Notice: `^$superusermessage`n");
rawoutput("</div>");
output("`2Body:`n");
require_once("lib/forms.php");
previewfield("body", "`^", false, false, array("type"=>"textarea", "class"=>"input", "cols"=>"60", "rows"=>"9", "onKeyDown"=>"sizeCount(this);"), htmlentities($body, ENT_COMPAT, getsetting("charset", "ISO-8859-1")).htmlentities(stripslashes(httpget('body')), ENT_COMPAT, getsetting("charset", "ISO-8859-1")));
//rawoutput("<textarea name='body' id='textarea' class='input' cols='60' rows='9' onKeyUp='sizeCount(this);'>".htmlentities($body, ENT_COMPAT, getsetting("charset", "ISO-8859-1")).htmlentities(stripslashes(httpget('body')), ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."</textarea><br>");
$send = translate_inline("Send");
rawoutput("<table border='0' cellpadding='0' cellspacing='0' width='100%'><tr><td><input type='submit' class='button' value='$send'></td><td align='right'><div id='sizemsg'></div></td></tr></table>");
rawoutput("</form>");
$sizemsg = "`#Max message size is `@%s`#, you have `^XX`# characters left.";
$sizemsg = translate_inline($sizemsg);
$sizemsg = sprintf($sizemsg,getsetting("mailsizelimit",1024));
$sizemsgover = "`\$Max message size is `@%s`\$, you are over by `^XX`\$ characters!";
$sizemsgover = translate_inline($sizemsgover);
$sizemsgover = sprintf($sizemsgover,getsetting("mailsizelimit",1024));
$sizemsg = explode("XX",$sizemsg);
$sizemsgover = explode("XX",$sizemsgover);
$usize1 = addslashes("<span>".appoencode($sizemsg[0])."</span>");
$usize2 = addslashes("<span>".appoencode($sizemsg[1])."</span>");
$osize1 = addslashes("<span>".appoencode($sizemsgover[0])."</span>");
$osize2 = addslashes("<span>".appoencode($sizemsgover[1])."</span>");
rawoutput("
<script type='text/javascript'>
var maxlen = ".getsetting("mailsizelimit",1024).";
function sizeCount(box){
if (box==null) return;
var len = box.value.length;
var msg = '';
if (len <= maxlen){
msg = '$usize1'+(maxlen-len)+'$usize2';
}else{
msg = '$osize1'+(len-maxlen)+'$osize2';
}
document.getElementById('sizemsg').innerHTML = msg;
}
sizeCount(document.getElementById('inputbody'));
function check_su_warning(){
var to = document.getElementById('to');
var warning = document.getElementById('warning');
if (superusers[to.value]){
warning.style.visibility = 'visible';
warning.style.display = 'inline';
}else{
warning.style.visibility = 'hidden';
warning.style.display = 'none';
}
}
check_su_warning();
</script>");
?>

261
lotgd-web/lotgd/lib/md5.js Executable file
View File

@ -0,0 +1,261 @@
/*
* translator ready
* addnews ready
* mail ready
*/
/*
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
* Digest Algorithm, as defined in RFC 1321.
* Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for more info.
*/
/*
* Configurable variables. You may need to tweak these to be compatible with
* the server-side, but the defaults work in most cases.
*/
var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */
var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */
var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */
/*
* These are the functions you'll usually want to call
* They take string arguments and return either hex or base-64 encoded strings
*/
function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}
function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));}
function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));}
function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }
function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }
function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); }
/*
* Perform a simple self-test to see if the VM is working
*/
function md5_vm_test()
{
return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
}
/*
* Calculate the MD5 of an array of little-endian words, and a bit length
*/
function core_md5(x, len)
{
/* append padding */
x[len >> 5] |= 0x80 << ((len) % 32);
x[(((len + 64) >>> 9) << 4) + 14] = len;
var a = 1732584193;
var b = -271733879;
var c = -1732584194;
var d = 271733878;
for(var i = 0; i < x.length; i += 16)
{
var olda = a;
var oldb = b;
var oldc = c;
var oldd = d;
a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819);
b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426);
c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416);
d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682);
d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329);
a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
c = md5_gg(c, d, a, b, x[i+11], 14, 643717713);
b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083);
c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438);
d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501);
a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473);
b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562);
b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353);
c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174);
d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189);
a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
c = md5_hh(c, d, a, b, x[i+15], 16, 530742520);
b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415);
c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571);
d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359);
d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649);
a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259);
b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
a = safe_add(a, olda);
b = safe_add(b, oldb);
c = safe_add(c, oldc);
d = safe_add(d, oldd);
}
return Array(a, b, c, d);
}
/*
* These functions implement the four basic operations the algorithm uses.
*/
function md5_cmn(q, a, b, x, s, t)
{
return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
}
function md5_ff(a, b, c, d, x, s, t)
{
return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
}
function md5_gg(a, b, c, d, x, s, t)
{
return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
}
function md5_hh(a, b, c, d, x, s, t)
{
return md5_cmn(b ^ c ^ d, a, b, x, s, t);
}
function md5_ii(a, b, c, d, x, s, t)
{
return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
}
/*
* Calculate the HMAC-MD5, of a key and some data
*/
function core_hmac_md5(key, data)
{
var bkey = str2binl(key);
if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz);
var ipad = Array(16), opad = Array(16);
for(var i = 0; i < 16; i++)
{
ipad[i] = bkey[i] ^ 0x36363636;
opad[i] = bkey[i] ^ 0x5C5C5C5C;
}
var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz);
return core_md5(opad.concat(hash), 512 + 128);
}
/*
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
* to work around bugs in some JS interpreters.
*/
function safe_add(x, y)
{
var lsw = (x & 0xFFFF) + (y & 0xFFFF);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
}
/*
* Bitwise rotate a 32-bit number to the left.
*/
function bit_rol(num, cnt)
{
return (num << cnt) | (num >>> (32 - cnt));
}
/*
* Convert a string to an array of little-endian words
* If chrsz is ASCII, characters >255 have their hi-byte silently ignored.
*/
function str2binl(str)
{
var bin = Array();
var mask = (1 << chrsz) - 1;
for(var i = 0; i < str.length * chrsz; i += chrsz)
bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32);
return bin;
}
/*
* Convert an array of little-endian words to a string
*/
function binl2str(bin)
{
var str = "";
var mask = (1 << chrsz) - 1;
for(var i = 0; i < bin.length * 32; i += chrsz)
str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask);
return str;
}
/*
* Convert an array of little-endian words to a hex string.
*/
function binl2hex(binarray)
{
var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
var str = "";
for(var i = 0; i < binarray.length * 4; i++)
{
str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +
hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF);
}
return str;
}
/*
* Convert an array of little-endian words to a base-64 string
*/
function binl2b64(binarray)
{
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var str = "";
for(var i = 0; i < binarray.length * 4; i += 3)
{
var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16)
| (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 )
| ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);
for(var j = 0; j < 4; j++)
{
if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
}
}
return str;
}

1459
lotgd-web/lotgd/lib/modules.php Executable file

File diff suppressed because it is too large Load Diff

240
lotgd-web/lotgd/lib/motd.php Executable file
View File

@ -0,0 +1,240 @@
<?php
// addnews ready
// translator ready
// mail ready
function motd_admin($id, $poll=false) {
global $session;
if ($session['user']['superuser'] & SU_POST_MOTD) {
$ed = translate_inline("Edit");
$del = translate_inline("Del");
$confirm = translate_inline("Are you sure you want to delete this item?");
output_notl("[ ");
if (!$poll) {
rawoutput("<a href='motd.php?op=add".($poll?"poll":"")."&id=$id'>$ed</a> | ");
}
rawoutput("<a href='motd.php?op=del&id=$id' onClick=\"return confirm('$confirm');\">$del</a> ]");
}
}
function motditem($subject,$body,$author,$date,$id){
if ($date)
rawoutput("<a name='motd".date("YmdHis",strtotime($date))."'>");
output_notl("`b`^%s`0`b", $subject);
if ($id > "") {
motd_admin($id);
}
if ($date || $author) output_notl("`n");
if ($author > "") {
output_notl("`3%s`0", $author);
}
if ($date>"")
output_notl("`0 &#150; `#%s`0", $date, true);
if ($date || $author) output_notl("`n");
output_notl("`2%s`0", nltoappon($body), true);
if ($date) rawoutput("</a>");
rawoutput("<hr>");
}
function pollitem($id,$subject,$body,$author,$date,$showpoll=true){
global $session;
$sql = "SELECT count(resultid) AS c, MAX(choice) AS choice FROM " . db_prefix("pollresults") . " WHERE motditem='$id' AND account='{$session['user']['acctid']}'";
$result = db_query($sql);
$row = db_fetch_assoc($result);
$choice = $row['choice'];
$body = unserialize($body);
$poll = translate_inline("Poll:");
if ($session['user']['loggedin'] && $showpoll) {
rawoutput("<form action='motd.php?op=vote' method='POST'>");
rawoutput("<input type='hidden' name='motditem' value='$id'>",true);
}
output_notl("`b`&%s `^%s`0`b", $poll, $subject);
if ($showpoll) motd_admin($id, true);
output_notl("`n`3%s`0 &#150; `#%s`0`n", $author, $date, true);
output_notl("`2%s`0`n", stripslashes($body['body']));
$sql = "SELECT count(resultid) AS c, choice FROM " . db_prefix("pollresults") . " WHERE motditem='$id' GROUP BY choice ORDER BY choice";
$result = db_query_cached($sql,"poll-$id");
$choices=array();
$totalanswers=0;
$maxitem = 0;
while ($row = db_fetch_assoc($result)) {
$choices[$row['choice']]=$row['c'];
$totalanswers+=$row['c'];
if ($row['c']>$maxitem) $maxitem = $row['c'];
}
while (list($key,$val)=each($body['opt'])){
if (trim($val)!=""){
if ($totalanswers<=0) $totalanswers=1;
$percent = 0;
if(isset($choices[$key])) {
$percent = round($choices[$key] / $totalanswers * 100,1);
}
if ($session['user']['loggedin'] && $showpoll) {
rawoutput("<input type='radio' name='choice' value='$key'".($choice==$key?" checked":"").">");
}
output_notl("%s (%s - %s%%)`n", stripslashes($val),
(isset($choices[$key])?(int)$choices[$key]:0), $percent);
if ($maxitem==0 || !isset($choices[$key])){
$width=1;
} else {
$width = round(($choices[$key]/$maxitem) * 400,0);
}
$width = max($width,1);
rawoutput("<img src='images/rule.gif' width='$width' height='2' alt='$percent'><br>");
}
}
if ($session['user']['loggedin'] && $showpoll) {
$vote = translate_inline("Vote");
rawoutput("<input type='submit' class='button' value='$vote'></form>");
}
rawoutput("<hr>",true);
}
function motd_form($id) {
global $session;
$subject = httppost('subject');
$body = httppost('body');
$preview = httppost('preview');
if ($subject=="" || $body=="" || $preview>""){
$edit = translate_inline("Edit a MoTD");
$add = translate_inline("Add a MoTD");
$ret = translate_inline("Return");
$row = array(
"motditem"=>0,
"motdauthorname"=>"",
"motdtitle"=>"",
"motdbody"=>"",
);
if ($id>""){
$sql = "SELECT " . db_prefix("motd") . ".*,name AS motdauthorname FROM " . db_prefix("motd") . " LEFT JOIN " . db_prefix("accounts") . " ON " . db_prefix("accounts") . ".acctid = " . db_prefix("motd") . ".motdauthor WHERE motditem='$id'";
$result = db_query($sql);
if (db_num_rows($result)>0){
$row = db_fetch_assoc($result);
$msg = $edit;
}else{
$msg = $add;
}
}else{
$msg = $add;
}
output_notl("`b%s`b", $msg);
rawoutput("[ <a href='motd.php'>$ret</a> ]<br>");
rawoutput("<form action='motd.php?op=add&id={$row['motditem']}' method='POST'>");
addnav("","motd.php?op=add&id={$row['motditem']}");
if ($row['motdauthorname']>"")
output("Originally by `@%s`0 on %s`n", $row['motdauthorname'],
$row['motddate']);
if ($subject>"") $row['motdtitle'] = stripslashes($subject);
if ($body>"") $row['motdbody'] = stripslashes($body);
if ($preview>""){
if (httppost('changeauthor') || $row['motdauthorname']=="")
$row['motdauthorname']=$session['user']['name'];
if (httppost('changedate') || !isset($row['motddate']) || $row['motddate']=="")
$row['motddate']=date("Y-m-d H:i:s");
motditem($row['motdtitle'], $row['motdbody'],
$row['motdauthorname'],$row['motddate'], "");
}
output("Subject: ");
rawoutput("<input type='text' size='50' name='subject' value=\"".HTMLEntities(stripslashes($row['motdtitle']), ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\"><br/>");
output("Body:`n");
rawoutput("<textarea align='right' class='input' name='body' cols='37' rows='5'>".HTMLEntities(stripslashes($row['motdbody']), ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."</textarea><br/>");
if ($row['motditem']>0){
output("Options:`n");
rawoutput("<input type='checkbox' value='1' name='changeauthor'".(httppost('changeauthor')?" checked":"").">");
output("Change Author`n");
rawoutput("<input type='checkbox' value='1' name='changedate'".(httppost('changedate')?" checked":"").">");
output("Change Date (force popup again)`n");
}
$prev = translate_inline("Preview");
$sub = translate_inline("Submit");
rawoutput("<input type='submit' class='button' name='preview' value='$prev'> <input type='submit' class='button' value='$sub'></form>");
}else{
if ($id>""){
$sql = " SET motdtitle='$subject', motdbody='$body'";
if (httppost('changeauthor'))
$sql.=", motdauthor={$session['user']['acctid']}";
if (httppost('changedate'))
$sql.=", motddate='".date("Y-m-d H:i:s")."'";
$sql = "UPDATE " . db_prefix("motd") . $sql . " WHERE motditem='$id'";
db_query($sql);
invalidatedatacache("motd");
invalidatedatacache("lastmotd");
invalidatedatacache("motddate");
}
if ($id=="" || db_affected_rows()==0){
if ($id>""){
$sql = "SELECT * FROM " . db_prefix("motd") . " WHERE motditem='$id'";
$result = db_query($sql);
if (db_num_rows($result)>0) $doinsert = false;
else $doinsert=true;
}else{
$doinsert=true;
}
if ($doinsert){
$sql = "INSERT INTO " . db_prefix("motd") . " (motdtitle,motdbody,motddate,motdauthor) VALUES (\"$subject\",\"$body\",'".date("Y-m-d H:i:s")."','{$session['user']['acctid']}')";
db_query($sql);
invalidatedatacache("motd");
invalidatedatacache("lastmotd");
invalidatedatacache("motddate");
}
}
header("Location: motd.php");
exit();
}
}
function motd_poll_form() {
global $session;
$subject = httppost('subject');
$body = httppost('body');
if ($subject=="" || $body==""){
output("`\$NOTE:`^ Polls cannot be edited after they are begun in order to ensure fairness and accuracy of results.`0`n`n");
rawoutput("<form action='motd.php?op=addpoll' method='POST'>");
addnav("","motd.php?op=add");
output("Subject: ");
rawoutput("<input type='text' size='50' name='subject' value=\"".HTMLEntities(stripslashes($subject), ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\"><br/>");
output("Body:`n");
rawoutput("<textarea class='input' name='body' cols='37' rows='5'>".HTMLEntities(stripslashes($body), ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."</textarea><br/>");
$option = translate_inline("Option");
output("Choices:`n");
$pollitem = "$option <input name='opt[]'><br/>";
rawoutput($pollitem);
rawoutput($pollitem);
rawoutput($pollitem);
rawoutput($pollitem);
rawoutput($pollitem);
rawoutput("<div id='hidepolls'>");
rawoutput("</div>");
rawoutput("<script language='JavaScript'>document.getElementById('hidepolls').innerHTML = '';</script>",true);
$addi = translate_inline("Add Poll Item");
$add = translate_inline("Add");
rawoutput("<a href=\"#\" onClick=\"javascript:document.getElementById('hidepolls').innerHTML += '".addslashes($pollitem)."'; return false;\">$addi</a><br>");
rawoutput("<input type='submit' class='button' value='$add'></form>");
}else{
$opt = httppost("opt");
$body = array("body"=>$body,"opt"=>$opt);
$sql = "INSERT INTO " . db_prefix("motd") . " (motdtitle,motdbody,motddate,motdtype,motdauthor) VALUES (\"$subject\",\"".addslashes(serialize($body))."\",'".date("Y-m-d H:i:s")."',1,'{$session['user']['acctid']}')";
db_query($sql);
invalidatedatacache("motd");
invalidatedatacache("lastmotd");
invalidatedatacache("motddate");
header("Location: motd.php");
exit();
}
}
function motd_del($id) {
$sql = "DELETE FROM " . db_prefix("motd") . " WHERE motditem=\"$id\"";
db_query($sql);
invalidatedatacache("motd");
invalidatedatacache("lastmotd");
invalidatedatacache("motddate");
header("Location: motd.php");
exit();
}
?>

View File

@ -0,0 +1,22 @@
<?php
// translator ready
// addnews ready
// mail ready
function getmountname()
{
global $playermount;
tlschema("mountname");
$name = '';
$lcname = '';
if (isset($playermount['mountname'])) {
$name = sprintf_translate("Your %s", $playermount['mountname']);
$lcname = sprintf_translate("your %s", $playermount['mountname']);
}
tlschema();
if (isset($playermount['newname']) && $playermount['newname'] != "") {
$name = $playermount['newname'];
$lcname = $playermount['newname'];
}
return array($name, $lcname);
}
?>

14
lotgd-web/lotgd/lib/mounts.php Executable file
View File

@ -0,0 +1,14 @@
<?php
// translator ready
// addnews ready
// mail ready
function getmount($horse=0) {
$sql = "SELECT * FROM " . db_prefix("mounts") . " WHERE mountid='$horse'";
$result = db_query_cached($sql, "mountdata-$horse", 3600);
if (db_num_rows($result)>0){
return db_fetch_assoc($result);
}else{
return array();
}
}
?>

89
lotgd-web/lotgd/lib/names.php Executable file
View File

@ -0,0 +1,89 @@
<?php
// translator ready
// addnews ready
// mail ready
require_once("lib/dbwrapper.php");
function get_player_title($old=false) {
global $session;
$title = "";
if ($old === false) {
$title = $session['user']['title'];
if ($session['user']['ctitle']) $title = $session['user']['ctitle'];
} else {
$title = $old['title'];
if ($old['ctitle']) $title = $old['ctitle'];
}
return $title;
}
function get_player_basename($old=false) {
global $session;
$name = "";
$title = get_player_title($old);
if ($old===false) {
$name = $session['user']['name'];
} else {
$name = $old['name'];
}
if ($title) {
$x = strpos($name, $title);
if ($x !== false)
$name = trim(substr($name,$x+strlen($title)));
}
return str_replace("`0", "", $name);
}
function change_player_name($newname, $old=false) {
if ($newname == "")
$newname = get_player_basename($old);
$newname = str_replace("`0", "", $newname);
$title = get_player_title($old);
if ($title) {
$x = strpos($newname, $title);
if ($x === 0)
$newname = trim(substr($newname, $x+strlen($title)));
$newname = $title . " " . $newname . "`0";
}
return $newname;
}
function change_player_ctitle($nctitle,$old=false) {
global $session;
if ($nctitle == "") {
if ($old == false) {
$nctitle = $session['user']['title'];
} else {
$nctitle = $old['title'];
}
}
$newname = get_player_basename($old) . "`0";
if ($nctitle) {
$newname = $nctitle." ".$newname;
}
return $newname;
}
function change_player_title($ntitle, $old=false) {
global $session;
if ($old===false) {
$ctitle = $session['user']['ctitle'];
} else {
$ctitle = $old['ctitle'];
}
$newname = get_player_basename($old) . "`0";
if ($ctitle == "") {
if ($ntitle != "") {
$newname = $ntitle." ".$newname;
}
} else {
$newname = $ctitle." ".$newname;
}
return $newname;
}
?>

Some files were not shown because too many files have changed in this diff Show More