diff --git a/admin/cookies.php b/admin/cookies.php index ca508c1..585775e 100644 --- a/admin/cookies.php +++ b/admin/cookies.php @@ -3,14 +3,15 @@ function checkcookies() { include("../config.php"); + global $controlrow; $row = false; - if (isset($_COOKIE["scourge"])) { + if (isset($_COOKIE[$controlrow["cookiename"]])) { // COOKIE FORMAT: // {ID} {USERNAME} {PASSWORDHASH} {REMEMBERME} - $theuser = explode(" ",$_COOKIE["scourge"]); + $theuser = explode(" ",$_COOKIE[$controlrow["cookiename"]]); if (!is_numeric($theuser[0])) { err("Invalid cookie data (Error 0). Please clear cookies and log in again."); } $row = dorow(doquery("SELECT * FROM {{table}} WHERE username='$theuser[1]' LIMIT 1", "accounts")); if ($row == false) { err("Invalid cookie data (Error 1). Please clear cookies and log in again."); } @@ -20,7 +21,7 @@ function checkcookies() { // If we've gotten this far, cookie should be valid, so write a new one. $newcookie = implode(" ",$theuser); if ($theuser[3] == 1) { $expiretime = time()+31536000; } else { $expiretime = 0; } - setcookie ("scourge", $newcookie, $expiretime, "/", "", 0); + setcookie ($controlrow["cookiename"], $newcookie, $expiretime, "/", $controlrow["cookiedomain"], 0); } diff --git a/admin/lib.php b/admin/lib.php index 083e45f..063ed40 100644 --- a/admin/lib.php +++ b/admin/lib.php @@ -5,9 +5,9 @@ $starttime = getmicrotime(); $numqueries = 0; $link = opendb(); $version = "Beta 4"; -$bnumber = "17"; -$bname = "Haiku"; -$bdate = "8.09.2006"; +$bnumber = "18"; +$bname = "Joe Camel"; +$bdate = "9.03.2006"; // Handling for servers with magic_quotes turned on. if (get_magic_quotes_gpc()) { diff --git a/changelog.txt b/changelog.txt index 6b70a4e..82b6bde 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,21 @@ Changelog ***** BETA FOUR ***** +09.03.2006 - Build 18 (Joe Camel): +- Fixed function redeclaration with Blessed Strike & Stone Skin spells. +- When you're all alone, you no longer have a little blue "undefined" orb to keep you company. +- Changing worlds after a quest now gives you the world's starting town to avoid panel errors. +- Minor optimization fix for item building. +- Unique items no longer drop with prefixes/suffixes, and you can no longer buy unique items. +- Removed alphanumeric requirement for passwords. +- hpleech(monster) now properly accounts for difficulty multiplier when checking against the monster's maxhp. +- Added Deposit/Withdraw All links to the Bank. +- Fixed PVP and Post office bugs related to the new doquery syntax. +- Fixed single-quote bugs in mymail(). +- Removed verbiage from the levelup template that was no longer necessary. +- Fixed some more verbiage in the registration message that was also no longer necessary. +- Added admin-definable cookie name and cookie domain to controlrow. + 8.09.2006 - Build 17 (Haiku): - Moved stylesheets into .css files. - Added javascript tooltips for the class info when creating a new character. diff --git a/cookies.php b/cookies.php index d356503..b66a52b 100644 --- a/cookies.php +++ b/cookies.php @@ -3,14 +3,15 @@ function checkcookies() { include('config.php'); + global $controlrow; $row = false; - if (isset($_COOKIE["scourge"])) { + if (isset($_COOKIE[$controlrow["cookiename"]])) { // COOKIE FORMAT: // {ID} {USERNAME} {PASSWORDHASH} {REMEMBERME} - $theuser = explode(" ",$_COOKIE["scourge"]); + $theuser = explode(" ",$_COOKIE[$controlrow["cookiename"]]); if (!is_numeric($theuser[0])) { err("Invalid cookie data (Error 0). Please clear cookies and log in again."); } $row = dorow(doquery("SELECT * FROM <> WHERE username='$theuser[1]' LIMIT 1")); if ($row == false) { err("Invalid cookie data (Error 1). Please clear cookies and log in again."); } @@ -20,7 +21,7 @@ function checkcookies() { // If we've gotten this far, cookie should be valid, so write a new one. $newcookie = implode(" ",$theuser); if ($theuser[3] == 1) { $expiretime = time()+31536000; } else { $expiretime = 0; } - setcookie ("scourge", $newcookie, $expiretime, "/", "", 0); + setcookie ($controlrow["cookiename"], $newcookie, $expiretime, "/", $controlrow["cookiedomain"], 0); } diff --git a/css/primary.css b/css/primary.css index a79f81b..a95f4e4 100644 --- a/css/primary.css +++ b/css/primary.css @@ -14,6 +14,9 @@ td { input { font: 10px Verdana; } +select { + font: 10px Verdana; + } img { border-style: none; diff --git a/extras/map.fla b/extras/map.fla index 95c45cc..4808b91 100644 Binary files a/extras/map.fla and b/extras/map.fla differ diff --git a/extras/mapmini.fla b/extras/mapmini.fla index 6568e16..fdc5076 100644 Binary files a/extras/mapmini.fla and b/extras/mapmini.fla differ diff --git a/extras/update_build18.sql b/extras/update_build18.sql new file mode 100644 index 0000000..b0ff56e --- /dev/null +++ b/extras/update_build18.sql @@ -0,0 +1,3 @@ +ALTER TABLE `sx_control` ADD `cookiename` VARCHAR( 255 ) NOT NULL default 'scourge' AFTER `avatarmaxsize` , +ADD `cookiedomain` VARCHAR( 255 ) NOT NULL AFTER `cookiename` ; +ALTER TABLE `sx_itembase` CHANGE `unique` `isunique` TINYINT( 3 ) UNSIGNED NOT NULL DEFAULT '0' \ No newline at end of file diff --git a/fight.php b/fight.php index 7be71dc..df885b8 100644 --- a/fight.php +++ b/fight.php @@ -21,7 +21,7 @@ dofight(); function rollmonster() { - global $userrow, $monsterrow; + global $userrow, $monsterrow, $fightrow; if($userrow["latitude"] < 0) { $latitude = $userrow["latitude"] * -1; } else { $latitude = $userrow["latitude"]; } if($userrow["longitude"] < 0) { $longitude = $userrow["longitude"] * -1; } else { $longitude = $userrow["longitude"]; } $maxlevel = ceil(max($latitude, $longitude) / 5); @@ -32,6 +32,9 @@ function rollmonster() { $userrow["currentmonsterhp"] = (ceil(rand($monsterrow["maxhp"] * .75, $monsterrow["maxhp"]) * $userrow["difficulty"])); $userrow["currentmonsterid"] = $monsterrow["id"]; $userrow["currentaction"] = "Fighting"; + + $fightrow["track"] .= "init fight / roll monster\nmid: ".$monsterrow["id"]."\nmhp:".$userrow["currentmonsterhp"]."\n\n"; + updateuserrow(); dofight(); @@ -43,6 +46,8 @@ function dofight() { if (isset($_POST["fight"])) { + $fightrow["track"] .= "init turn\nmid:".$userrow["currentmonsterid"]."\nmhp:".$userrow["currentmonsterhp"]."\n\n"; + playerturn(); if ($userrow["currentmonsterhp"] <= 0) { youwin(); } monsterturn(); @@ -60,7 +65,8 @@ function dofight() { "monsterphysdamage"=>$fightrow["monsterphysdamage"], "monstermagicdamage"=>$fightrow["monstermagicdamage"], "monsterfiredamage"=>$fightrow["monsterfiredamage"], - "monsterlightdamage"=>$fightrow["monsterlightdamage"]); + "monsterlightdamage"=>$fightrow["monsterlightdamage"], + "track"=>$fightrow["track"]); $pagerow["spells"] = dospellslist(); display("Fighting",parsetemplate(gettemplate("fight_turn"),$pagerow)); @@ -92,7 +98,8 @@ function dofight() { "monsterphysdamage"=>$fightrow["monsterphysdamage"], "monstermagicdamage"=>$fightrow["monstermagicdamage"], "monsterfiredamage"=>$fightrow["monsterfiredamage"], - "monsterlightdamage"=>$fightrow["monsterlightdamage"]); + "monsterlightdamage"=>$fightrow["monsterlightdamage"], + "track"=>$fightrow["track"]); $pagerow["spells"] = dospellslist(); display("Fighting",parsetemplate(gettemplate("fight_turn"),$pagerow)); @@ -101,7 +108,7 @@ function dofight() { if (rand(4,10) + ceil(sqrt($userrow["dexterity"])) < (rand(1,5) + ceil(sqrt((0.75 * $monsterrow["physattack"]))))) { monsterturn(); - $fightrow["message"] = "You tried to run away, but the monster blocked you!
"; + $fightrow["message"] .= "You tried to run away, but the monster blocked you!
"; if ($userrow["currenthp"] <= 0) { youlose(); } updateuserrow(); @@ -112,7 +119,8 @@ function dofight() { "monsterphysdamage"=>$fightrow["monsterphysdamage"], "monstermagicdamage"=>$fightrow["monstermagicdamage"], "monsterfiredamage"=>$fightrow["monsterfiredamage"], - "monsterlightdamage"=>$fightrow["monsterlightdamage"]); + "monsterlightdamage"=>$fightrow["monsterlightdamage"], + "track"=>$fightrow["track"]); $pagerow["spells"] = dospellslist(); display("Fighting",parsetemplate(gettemplate("fight_monsteronly"),$pagerow)); @@ -129,7 +137,7 @@ function dofight() { if (rand(1,10) + ceil(sqrt($userrow["dexterity"])) < (rand(1,7) + ceil(sqrt((0.75 * $monsterrow["physattack"]))))) { monsterturn(); - $fightrow["message"] = "The monster attacked before you were ready!
"; + $fightrow["message"] .= "The monster attacked before you were ready!
"; if ($userrow["currenthp"] <= 0) { youlose(); } updateuserrow(); @@ -140,7 +148,8 @@ function dofight() { "monsterphysdamage"=>$fightrow["monsterphysdamage"], "monstermagicdamage"=>$fightrow["monstermagicdamage"], "monsterfiredamage"=>$fightrow["monsterfiredamage"], - "monsterlightdamage"=>$fightrow["monsterlightdamage"]); + "monsterlightdamage"=>$fightrow["monsterlightdamage"], + "track"=>$fightrow["track"]); $pagerow["spells"] = dospellslist(); display("Fighting",parsetemplate(gettemplate("fight_monsteronly"),$pagerow)); @@ -148,7 +157,8 @@ function dofight() { $pagerow = array( "monstername"=>$monsterrow["name"], - "monsterhp"=>$userrow["currentmonsterhp"]); + "monsterhp"=>$userrow["currentmonsterhp"], + "track"=>$fightrow["track"]); $pagerow["spells"] = dospellslist(); display("Fighting",parsetemplate(gettemplate("fight_new"),$pagerow)); @@ -165,24 +175,28 @@ function playerturn() { $physhit = ceil(rand($userrow["physattack"]*.75, $userrow["physattack"]) / 3); $physblock = ceil(rand($monsterrow["physdefense"]*.75, $monsterrow["physdefense"]) / 3); $fightrow["playerphysdamage"] = max($physhit - $physblock, 1); + $fightrow["track"] .= "physdam init: " . $fightrow["playerphysdamage"] . "\n"; } if ($userrow["magicattack"] != 0) { $magichit = ceil(rand($userrow["magicattack"]*.75, $userrow["magicattack"]) / 3); $magicblock = ceil(rand($monsterrow["magicdefense"]*.75, $monsterrow["magicdefense"]) / 3); $fightrow["playermagicdamage"] = max($magichit - $magicblock, 0); + $fightrow["track"] .= "magicdam init: " . $fightrow["playermagicdamage"] . "\n"; } if ($userrow["fireattack"] != 0) { $firehit = ceil(rand($userrow["fireattack"]*.75, $userrow["fireattack"]) / 3); $fireblock = ceil(rand($monsterrow["firedefense"]*.75, $monsterrow["firedefense"]) / 3); $fightrow["playerfiredamage"] = max($firehit - $fireblock, 0); + $fightrow["track"] .= "firedam init: " . $fightrow["playerfiredamage"] . "\n"; } if ($userrow["lightattack"] != 0) { $lighthit = ceil(rand($userrow["lightattack"]*.75, $userrow["lightattack"]) / 3); $lightblock = ceil(rand($monsterrow["lightdefense"]*.75, $monsterrow["lightdefense"]) / 3); $fightrow["playerlightdamage"] = max($lighthit - $lightblock, 0); + $fightrow["track"] .= "lightdam init: " . $fightrow["playerlightdamage"] . "\n"; } // Chance to make an excellent hit. @@ -192,7 +206,8 @@ function playerturn() { $fightrow["playermagicdamage"] *= 2; $fightrow["playerfiredamage"] *= 2; $fightrow["playerlightdamage"] *= 2; - $fightrow["message"] = "Excellent hit!
"; + $fightrow["message"] .= "Excellent hit!
"; + $fightrow["track"] .= "excellent\nphys:".$fightrow["playerphysdamage"]."\nmagic:".$fightrow["playermagicdamage"]."\nfire:".$fightrow["playerfiredamage"]."\nlight:".$fightrow["playerlightdamage"]."\n"; } // Chance for monster to dodge. @@ -202,7 +217,8 @@ function playerturn() { $fightrow["playermagicdamage"] = 0; $fightrow["playerfiredamage"] = 0; $fightrow["playerlightdamage"] = 0; - $fightrow["message"] = "The monster dodged your hit!
"; + $fightrow["message"] .= "The monster dodged your hit!
"; + $fightrow["track"] .= "monster dodge: all damage to zero\n"; } // Now we add Per Turn mods. @@ -212,6 +228,7 @@ function playerturn() { // Subtract all damage from monster's hp. $userrow["currentmonsterhp"] -= ($fightrow["playerphysdamage"] + $fightrow["playermagicdamage"] + $fightrow["playerfiredamage"] + $fightrow["playerlightdamage"]); + $fightrow["track"] .= "end turn - mhp:".$userrow["currentmonsterhp"]; } @@ -245,12 +262,12 @@ function monsterturn() { // Chance to make an excellent hit. $toexcellent = rand(0,150); - if ($toexcellent <= sqrt($monsterrow["dexterity"])) { + if ($toexcellent <= sqrt($monsterrow["physdefense"])) { $fightrow["monsterphysdamage"] *= 2; $fightrow["monstermagicdamage"] *= 2; $fightrow["monsterfiredamage"] *= 2; $fightrow["monsterlightdamage"] *= 2; - $fightrow["message"] = "Excellent hit!
"; + $fightrow["message"] .= "The monster made an excellent hit!
"; } // Chance for player to dodge. @@ -260,7 +277,7 @@ function monsterturn() { $fightrow["monstermagicdamage"] = 0; $fightrow["monsterfiredamage"] = 0; $fightrow["monsterlightdamage"] = 0; - $fightrow["message"] = "You dodged the monster's hit!
"; + $fightrow["message"] .= "You dodged the monster's hit!
"; } // Now we add Per Turn mods. @@ -316,10 +333,14 @@ function youwin() { $preprefixrow = dorow(doquery("SELECT * FROM <> WHERE reqlevel<='".$userrow["level"]."' ORDER BY RAND() LIMIT 1", "itemprefixes")); $presuffixrow = dorow(doquery("SELECT * FROM <> WHERE reqlevel<='".$userrow["level"]."' ORDER BY RAND() LIMIT 1", "itemsuffixes")); - $idstring = ""; - if (rand(0,4)==1) { $idstring .= $preprefixrow["id"] . ","; } else { $idstring .= "0,"; } - $idstring .= $preitemsrow["id"] . ","; - if (rand(0,4)==1) { $idstring .= $presuffixrow["id"]; } else { $idstring .= "0"; } + if ($preitemsrow["isunique"] == 1) { + $idstring = "0," . $preitemsrow["id"] . ",0"; + } else { + $idstring = ""; + if (rand(0,4)==1) { $idstring .= $preprefixrow["id"] . ","; } else { $idstring .= "0,"; } + $idstring .= $preitemsrow["id"] . ","; + if (rand(0,4)==1) { $idstring .= $presuffixrow["id"]; } else { $idstring .= "0"; } + } $userrow["dropidstring"] = $idstring; $fightrow["message"] .= "The monster has dropped an item! Click here for more information.
"; diff --git a/fightmods.php b/fightmods.php index db837d7..c312d43 100644 --- a/fightmods.php +++ b/fightmods.php @@ -14,7 +14,7 @@ function hpleech($player) { if ($userrow["currenthp"] > $userrow["maxhp"]) { $userrow["currenthp"] = $userrow["maxhp"]; } } else { $userrow["currentmonsterhp"] += floor(($fightrow["monsterphysdamage"]+$fightrow["monstermagicdamage"]+$fightrow["monsterfiredamage"]+$fightrow["monsterlightdamage"]) * ($monsterrow["hpleech"]/100)); - if ($userrow["currentmonsterhp"] > $monsterrow["maxhp"]) { $userrow["currentmonsterhp"] = $monsterrow["maxhp"]; } + if ($userrow["currentmonsterhp"] > ($monsterrow["maxhp"] * $userrow["difficulty"])) { $userrow["currentmonsterhp"] = ($monsterrow["maxhp"] * $userrow["difficulty"]); } } } @@ -71,19 +71,24 @@ function bonusattack() { ***********/ global $userrow, $fightrow; + + if ($userrow["bonusattack"] > 0) { - $first = $userrow["bonusattack"] * 0.25; - $sec = $userrow["bonusattack"] * 0.5; - $third = $userrow["bonusattack"] * 0.75; - $rand = rand(0,100); - - if ($rand <= $first) { $multiplier = 2; } - elseif ($rand <= $sec) { $multiplier = 1.75; } - elseif ($rand <= $third) { $multiplier = 1.5; } - elseif ($rand <= $userrow["bonusattack"] && $rand > $third) { $multiplier = 1.25; } - else { $multiplier = 1; } - - $fightrow["playerphysdamage"] = floor($fightrow["playerphysdamage"] * $multiplier); + $first = $userrow["bonusattack"] * 0.25; + $sec = $userrow["bonusattack"] * 0.5; + $third = $userrow["bonusattack"] * 0.75; + $rand = rand(0,100); + + if ($rand <= $first) { $multiplier = 2; } + elseif ($rand <= $sec) { $multiplier = 1.75; } + elseif ($rand <= $third) { $multiplier = 1.5; } + elseif ($rand <= $userrow["bonusattack"] && $rand > $third) { $multiplier = 1.25; } + else { $multiplier = 1; } + + $fightrow["playerphysdamage"] = floor($fightrow["playerphysdamage"] * $multiplier); + $fightrow["track"] .= "bonusattack - physdamage:".$fightrow["playerphysdamage"]."\n"; + + } } @@ -97,22 +102,26 @@ function bonusdefense() { ***********/ global $userrow, $fightrow; + + if ($userrow["bonusdefense"] > 0) { - $first = $userrow["bonusdefense"] * 0.25; - $sec = $userrow["bonusdefense"] * 0.5; - $third = $userrow["bonusdefense"] * 0.75; - $rand = rand(0,100); - - if ($rand <= $first) { $multiplier = 0; } - elseif ($rand <= $sec) { $multiplier = 0.25; } - elseif ($rand <= $third) { $multiplier = 0.5; } - elseif ($rand <= $userrow["bonusdefense"] && $rand > $third) { $multiplier = 0.75; } - else { $multiplier = 1; } - - $fightrow["monsterphysdamage"] = floor($fightrow["monsterphysdamage"] * $multiplier); - $fightrow["monstermagicdamage"] = floor($fightrow["monstermagicdamage"] * $multiplier); - $fightrow["monsterfiredamage"] = floor($fightrow["monsterfiredamage"] * $multiplier); - $fightrow["monsterlightdamage"] = floor($fightrow["monsterlightdamage"] * $multiplier); + $first = $userrow["bonusdefense"] * 0.25; + $sec = $userrow["bonusdefense"] * 0.5; + $third = $userrow["bonusdefense"] * 0.75; + $rand = rand(0,100); + + if ($rand <= $first) { $multiplier = 0; } + elseif ($rand <= $sec) { $multiplier = 0.25; } + elseif ($rand <= $third) { $multiplier = 0.5; } + elseif ($rand <= $userrow["bonusdefense"] && $rand > $third) { $multiplier = 0.75; } + else { $multiplier = 1; } + + $fightrow["monsterphysdamage"] = floor($fightrow["monsterphysdamage"] * $multiplier); + $fightrow["monstermagicdamage"] = floor($fightrow["monstermagicdamage"] * $multiplier); + $fightrow["monsterfiredamage"] = floor($fightrow["monsterfiredamage"] * $multiplier); + $fightrow["monsterlightdamage"] = floor($fightrow["monsterlightdamage"] * $multiplier); + + } } @@ -126,22 +135,26 @@ function bonusdefense_pvp() { ***********/ global $userrow, $monsterrow, $fightrow; + + if ($userrow["bonusdefense"] > 0) { - $first = $monsterrow["bonusdefense"] * 0.25; - $sec = $monsterrow["bonusdefense"] * 0.5; - $third = $monsterrow["bonusdefense"] * 0.75; - $rand = rand(0,100); - - if ($rand <= $first) { $multiplier = 0; } - elseif ($rand <= $sec) { $multiplier = 0.25; } - elseif ($rand <= $third) { $multiplier = 0.5; } - elseif ($rand <= $monsterrow["bonusdefense"] && $rand > $third) { $multiplier = 0.75; } - else { $multiplier = 1; } - - $fightrow["playerphysdamage"] = floor($fightrow["playerphysdamage"] * $multiplier); - $fightrow["playermagicdamage"] = floor($fightrow["playermagicdamage"] * $multiplier); - $fightrow["playerfiredamage"] = floor($fightrow["playerfiredamage"] * $multiplier); - $fightrow["playerlightdamage"] = floor($fightrow["playerlightdamage"] * $multiplier); + $first = $monsterrow["bonusdefense"] * 0.25; + $sec = $monsterrow["bonusdefense"] * 0.5; + $third = $monsterrow["bonusdefense"] * 0.75; + $rand = rand(0,100); + + if ($rand <= $first) { $multiplier = 0; } + elseif ($rand <= $sec) { $multiplier = 0.25; } + elseif ($rand <= $third) { $multiplier = 0.5; } + elseif ($rand <= $monsterrow["bonusdefense"] && $rand > $third) { $multiplier = 0.75; } + else { $multiplier = 1; } + + $fightrow["playerphysdamage"] = floor($fightrow["playerphysdamage"] * $multiplier); + $fightrow["playermagicdamage"] = floor($fightrow["playermagicdamage"] * $multiplier); + $fightrow["playerfiredamage"] = floor($fightrow["playerfiredamage"] * $multiplier); + $fightrow["playerlightdamage"] = floor($fightrow["playerlightdamage"] * $multiplier); + + } } diff --git a/globals.php b/globals.php index dcfea00..65b3810 100644 --- a/globals.php +++ b/globals.php @@ -45,6 +45,7 @@ $fightrow = array( "monstermagicdamage"=>0, "monsterfiredamage"=>0, "monsterlightdamage"=>0, + "track"=>"", "message"=>""); ?> \ No newline at end of file diff --git a/index.php b/index.php index 75c2fa5..b68d54a 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,7 @@ '; + $from = "<$adminemail>"; } $rp = $adminemail; - $org = '$gameurl'; - $mailer = 'PHP'; + $org = "$gameurl"; + $mailer = "PHP"; - $head = ''; + $head = ""; $head .= "Content-Type: text/plain \r\n"; $head .= "Date: ". date('r'). " \r\n"; $head .= "Return-Path: $rp \r\n"; diff --git a/lib2.php b/lib2.php index 95275da..034d6cc 100644 --- a/lib2.php +++ b/lib2.php @@ -3,7 +3,7 @@ function updateuserrow() { global $userrow; - $userrow = array_map("addslashes", $userrow); + $userrow = array_map("uber_mres", $userrow); $querystring = ""; foreach($userrow as $a=>$b) { diff --git a/login.php b/login.php index b4cc47f..b9ea8a3 100644 --- a/login.php +++ b/login.php @@ -13,6 +13,8 @@ switch($do) { function login() { + $controlrow = dorow(doquery("SELECT * FROM <> WHERE id='1' LIMIT 1")); + if (isset($_POST["submit"])) { // Setup. @@ -29,7 +31,7 @@ function login() { // Finish. $newcookie = $row["id"] . " " . $username . " " . md5($row["password"] . "--" . $dbsettings["secretword"]); if (isset($remember)) { $expiretime = time()+31536000; $newcookie .= " 1"; } else { $expiretime = 0; $newcookie .= " 0"; } - setcookie("scourge", $newcookie, $expiretime, "/", "", 0); + setcookie($controlrow["cookiename"], $newcookie, $expiretime, "/", "", 0); die(header("Location: index.php")); } else { @@ -43,7 +45,7 @@ function login() { function logout() { include("globals.php"); - setcookie("scourge", "", (time()-3600), "/", "", 0); + setcookie($controlrow["cookiename"], "", (time()-3600), "/", $controlrow["cookiedomain"], 0); die(header("Location: login.php?do=login")); } diff --git a/mailbox.php b/mailbox.php index f45795b..44c372c 100644 --- a/mailbox.php +++ b/mailbox.php @@ -201,7 +201,7 @@ function maildelete() { if ($message == false) { err("Invalid action. Please go back and try again."); } if ($message["recipientid"] != $userrow["id"]) { err("Invalid action. Please go back and try again."); } - $delete = doquery("DELETE FROM {{table}} WHERE id='".$_GET["id"]."'", "messages"); + $delete = doquery("DELETE FROM <> WHERE id='".$_GET["id"]."'"); die(header("Location: index.php?do=mailbox")); } diff --git a/map.php b/map.php index 0627024..684ee41 100644 --- a/map.php +++ b/map.php @@ -32,7 +32,7 @@ $text .= "player_name=".$userrow["charname"]."&"; // Then do everyone else. $users = dorow(doquery("SELECT * FROM <> WHERE world='".$worldrow["id"]."' AND UNIX_TIMESTAMP(onlinetime) >= '".(time()-600)."' AND id != '".$userrow["id"]."'"), "id"); -$text .= "users=".count($users)."&"; +if ($users) { $text .= "users=".count($users)."&"; } else { $text .= "users=0&"; } $count = 0; if ($users != false) { foreach ($users as $a => $b) { diff --git a/map.swf b/map.swf index 26ad828..e4b2a15 100644 Binary files a/map.swf and b/map.swf differ diff --git a/mapmini.php b/mapmini.php index 1ae8a6d..f0ab5ce 100644 --- a/mapmini.php +++ b/mapmini.php @@ -30,7 +30,7 @@ $text .= "player_y=".$y."&"; // Then do everyone else. $users = dorow(doquery("SELECT * FROM <> WHERE world='".$worldrow["id"]."' AND UNIX_TIMESTAMP(onlinetime) >= '".(time()-600)."' AND id != '".$userrow["id"]."'"), "id"); -$text .= "users=".count($users)."&"; +if ($users) { $text .= "users=".count($users)."&"; } else { $text .= "users=0&"; } $count = 0; if ($users != false) { foreach ($users as $a => $b) { diff --git a/mapmini.swf b/mapmini.swf index 67acb00..4a47010 100644 Binary files a/mapmini.swf and b/mapmini.swf differ diff --git a/pvp.php b/pvp.php index b286ce2..46ed539 100644 --- a/pvp.php +++ b/pvp.php @@ -340,7 +340,7 @@ function youwin() { function youlose() { global $userrow, $monsterrow, $fightrow; - $pvp = dorow(doquery("SELECT * FROM <> WHERE id='".$userrow["currentpvp"]."' LIMIT 1"")); + $pvp = dorow(doquery("SELECT * FROM <> WHERE id='".$userrow["currentpvp"]."' LIMIT 1")); if ($pvp["player1id"] == $userrow["id"]) { $monsterrow = dorow(doquery("SELECT * FROM <> WHERE id='".$pvp["player2id"]."' LIMIT 1")); diff --git a/story.php b/story.php index 3dcde28..62f1721 100644 --- a/story.php +++ b/story.php @@ -26,6 +26,12 @@ function storyteleport() { // Sends to a new location, or just displays a chunk $userrow["world"] = $story["targetworld"]; $userrow["latitude"] = $story["targetlat"]; $userrow["longitude"] = $story["targetlon"]; + // Get first town from new world. + $newtown = dorow(doquery("SELECT * FROM <> WHERE world='".$userrow["world"]."' ORDER BY id LIMIT 1")); + $towns = explode(",",$userrow["townslist"]); + $towns[] = $newtown["id"]; + $userrow["townslist"] = implode(",",$towns); + } if ($story["targetaction"] != "") { $userrow["currentaction"] = $story["targetaction"]; @@ -78,11 +84,7 @@ function storyitem() { global $userrow, $story; - $premodrow = dorow(doquery("SELECT * FROM <> ORDER BY id")); - foreach($premodrow as $a=>$b) { - $modrow[$b["fieldname"]] = $b; - } - + $modrow = dorow(doquery("SELECT * FROM <> ORDER BY id"), "fieldname"); $thenewitem = explode(",",$story["targetitem"]); $newitem = dorow(doquery("SELECT * FROM <> WHERE id='".$thenewitem[1]."' LIMIT 1")); $newprefix = dorow(doquery("SELECT * FROM <> WHERE id='".$thenewitem[0]."' LIMIT 1")); @@ -151,6 +153,11 @@ function storyitem() { $userrow["world"] = $story["targetworld"]; $userrow["latitude"] = $story["targetlat"]; $userrow["longitude"] = $story["targetlon"]; + // Get first town from new world. + $newtown = dorow(doquery("SELECT * FROM <> WHERE world='".$userrow["world"]."' ORDER BY id LIMIT 1")); + $towns = explode(",",$userrow["townslist"]); + $towns[] = $newtown["id"]; + $userrow["townslist"] = implode(",",$towns); } if ($story["targetaction"] != "") { $userrow["currentaction"] = $story["targetaction"]; @@ -176,6 +183,11 @@ function storyitem() { $userrow["world"] = $story["targetworld"]; $userrow["latitude"] = $story["targetlat"]; $userrow["longitude"] = $story["targetlon"]; + // Get first town from new world. + $newtown = dorow(doquery("SELECT * FROM <> WHERE world='".$userrow["world"]."' ORDER BY id LIMIT 1")); + $towns = explode(",",$userrow["townslist"]); + $towns[] = $newtown["id"]; + $userrow["townslist"] = implode(",",$towns); } if ($story["targetaction"] != "") { $userrow["currentaction"] = $story["targetaction"]; diff --git a/templates/town_bank1.php b/templates/town_bank1.php index 04b2f88..0f55850 100644 --- a/templates/town_bank1.php +++ b/templates/town_bank1.php @@ -1,11 +1,17 @@ +function autopop(theValue) { + document.bank.amount.value = theValue; +} + Storing money in the bank prevents you from losing it if you die in combat. However, your money in the bank cannot be used when purchasing of items or maps.

You are currently storing {{formatbank}} gold in the bank, and you are carrying {{formatgold}} gold in your pocket.

-
+ Enter an amount and then click the Deposit or Withdraw button:
- +
+Deposit All | Withdraw All

If you've changed your mind, you may also return to town. END; diff --git a/templates/users_levelup1.php b/templates/users_levelup1.php index 7517188..dd98cb0 100644 --- a/templates/users_levelup1.php +++ b/templates/users_levelup1.php @@ -1,7 +1,7 @@
+You have Level Points to spend. Different character classes get extra bonuses to certain stats from level points. Your stat bonuses are listed below.

Class: {{classname}}
Damage Per Strength: {{damageperstrength}}
Defense Per Dexterity: {{defenseperdex}}
diff --git a/templates/users_register1.php b/templates/users_register1.php index 82908e8..cec44ce 100644 --- a/templates/users_register1.php +++ b/templates/users_register1.php @@ -3,9 +3,9 @@ $template = << - + - + diff --git a/templates/users_settings.php b/templates/users_settings.php index 744e173..0cfd31d 100644 --- a/templates/users_settings.php +++ b/templates/users_settings.php @@ -7,7 +7,7 @@ $template = <<
Old Password:

New Password:

-Verify New Password:

Passwords must be 30 alphanumeric characters or less.


+Verify New Password:



diff --git a/town.php b/town.php index c1d5774..805f297 100644 --- a/town.php +++ b/town.php @@ -119,12 +119,7 @@ function buy() { // Buy items from merchants. $newbaseitem = dorow(doquery("SELECT * FROM <> WHERE id='$idstring[1]' LIMIT 1")); $newprefix = dorow(doquery("SELECT * FROM <> WHERE id='$idstring[0]' LIMIT 1")); $newsuffix = dorow(doquery("SELECT * FROM <> WHERE id='$idstring[2]' LIMIT 1")); - $premodrow = dorow(doquery("SELECT * FROM <> ORDER BY id")); - - // Format the mod name row. - foreach($premodrow as $a=>$b) { - $modrow[$b["fieldname"]] = $b; - } + $modrow = dorow(doquery("SELECT * FROM <> ORDER BY id"), "fieldname"); $newfullitem = builditem($newprefix, $newbaseitem, $newsuffix, $modrow); @@ -232,7 +227,7 @@ function buy() { // Buy items from merchants. } else { // Grab lots of stuff from the DB. - $preitemsrow = dorow(doquery("SELECT * FROM <> WHERE reqlevel>='".$townrow["itemminlvl"]."' AND reqlevel<='".$townrow["itemmaxlvl"]."' ORDER BY RAND() LIMIT 10")); + $preitemsrow = dorow(doquery("SELECT * FROM <> WHERE reqlevel>='".$townrow["itemminlvl"]."' AND reqlevel<='".$townrow["itemmaxlvl"]."' AND isunique='0' ORDER BY RAND() LIMIT 10")); $preprefixrow = dorow(doquery("SELECT * FROM <> WHERE reqlevel<='".$userrow["level"]."'")); $presuffixrow = dorow(doquery("SELECT * FROM <> WHERE reqlevel<='".$userrow["level"]."'")); $allitemsrow = dorow(doquery("SELECT * FROM <>")); @@ -416,6 +411,8 @@ function bank() { $row["formatbank"] = number_format($userrow["bank"]); $row["formatgold"] = number_format($userrow["gold"]); + $row["maxpocket"] = $userrow["gold"]; + $row["maxbank"] = $userrow["bank"]; display("Deposit/Withdraw Gold at the Bank", parsetemplate(gettemplate("town_bank1"),$row)); diff --git a/users.php b/users.php index 0e1a42a..048bb43 100644 --- a/users.php +++ b/users.php @@ -44,7 +44,6 @@ function register() { // Process password. if (trim($password1) == "") { $errors++; $errorlist .= "Password fields is required.
"; } - if (preg_match("/[^A-z0-9_\-]/", $password1)==1) { $errors++; $errorlist .= "Password must be alphanumeric.
"; } // Thanks to "Carlos Pires" from php.net! if ($password1 != $password2) { $errors++; $errorlist .= "Passwords don't match.
"; } $password = md5($password1); @@ -77,7 +76,7 @@ function register() { // Send confirmation email if necessary. if ($controlrow["verifyemail"] == 1) { if (sendregmail($email1, $verifycode) == true) { - $page = "Your account was created successfully.

You should receive an Account Verification email shortly. You will need the verification code contained in that email before you are allowed to log in. Once you have received the email, please visit the Verification Page to enter your code and start playing."; + $page = "Your account was created successfully.

You should receive an Account Verification email shortly. You will need the verification code contained in that email before you are allowed to log in. Once you have received the email, click the verification link it contains to activate your account, and start playing."; } else { $page = "Your account was created successfully.

However, there was a problem sending your verification email. Please check with the game administrator to help resolve this problem."; } @@ -207,7 +206,6 @@ function settings() { // Process password. if (trim($password1) != "") { if (md5($oldpassword) != $acctrow["password"]) { $errors++; $errorlist .= "Incorrect old password.
"; } - if (preg_match("/[^A-z0-9_\-]/", $password1)==1) { $errors++; $errorlist .= "Password must be alphanumeric.
"; } // Thanks to "Carlos Pires" from php.net! if ($password1 != $password2) { $errors++; $errorlist .= "New passwords don't match.
"; } $password = "password='".md5($password1)."',"; $newpass = true;
Username:
Usernames must be 30 alphanumeric characters or less.


Username:
Usernames can contain letters, numbers, dashes and underscores.


Password:
Verify Password:
Passwords must be 30 alphanumeric characters or less.


Verify Password:


Email Address:
Verify Email Address:


Image Format:
(Older versions of Internet Explorer may not be compatible with transparent PNG images. If you notice problems with item and monster images, please select GIF.)
Email Address:
Image Format:
(Older versions of Internet Explorer may not be compatible with transparent PNG images. If you notice problems with item and monster images, please select GIF.)