Beta 4 Build 18
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.
This commit is contained in:
parent
d529178672
commit
0f3f0dc8ed
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 <<accounts>> 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);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,9 @@ td {
|
|||
input {
|
||||
font: 10px Verdana;
|
||||
}
|
||||
select {
|
||||
font: 10px Verdana;
|
||||
}
|
||||
|
||||
img {
|
||||
border-style: none;
|
||||
|
|
BIN
extras/map.fla
BIN
extras/map.fla
Binary file not shown.
Binary file not shown.
3
extras/update_build18.sql
Normal file
3
extras/update_build18.sql
Normal file
|
@ -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'
|
55
fight.php
55
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!<br />";
|
||||
$fightrow["message"] .= "You tried to run away, but the monster blocked you!<br />";
|
||||
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!<br />";
|
||||
$fightrow["message"] .= "The monster attacked before you were ready!<br />";
|
||||
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"] = "<b>Excellent hit!</b><br />";
|
||||
$fightrow["message"] .= "<b>Excellent hit!</b><br />";
|
||||
$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"] = "<b>The monster dodged your hit!</b><br />";
|
||||
$fightrow["message"] .= "<b>The monster dodged your hit!</b><br />";
|
||||
$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"] = "<b>Excellent hit!</b><br />";
|
||||
$fightrow["message"] .= "<b>The monster made an excellent hit!</b><br />";
|
||||
}
|
||||
|
||||
// Chance for player to dodge.
|
||||
|
@ -260,7 +277,7 @@ function monsterturn() {
|
|||
$fightrow["monstermagicdamage"] = 0;
|
||||
$fightrow["monsterfiredamage"] = 0;
|
||||
$fightrow["monsterlightdamage"] = 0;
|
||||
$fightrow["message"] = "<b>You dodged the monster's hit!</b><br />";
|
||||
$fightrow["message"] .= "<b>You dodged the monster's hit!</b><br />";
|
||||
}
|
||||
|
||||
// Now we add Per Turn mods.
|
||||
|
@ -316,10 +333,14 @@ function youwin() {
|
|||
$preprefixrow = dorow(doquery("SELECT * FROM <<itemprefixes>> WHERE reqlevel<='".$userrow["level"]."' ORDER BY RAND() LIMIT 1", "itemprefixes"));
|
||||
$presuffixrow = dorow(doquery("SELECT * FROM <<itemsuffixes>> WHERE reqlevel<='".$userrow["level"]."' ORDER BY RAND() LIMIT 1", "itemsuffixes"));
|
||||
|
||||
$idstring = "";
|
||||
if (rand(0,4)==1) { $idstring .= $preprefixrow["id"] . ","; } else { $idstring .= "0,"; }
|
||||
$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"] .= "<a href=\"index.php?do=itemdrop\" class=\"red\"><b>The monster has dropped an item! Click here for more information.</b></a><br />";
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ $fightrow = array(
|
|||
"monstermagicdamage"=>0,
|
||||
"monsterfiredamage"=>0,
|
||||
"monsterlightdamage"=>0,
|
||||
"track"=>"",
|
||||
"message"=>"");
|
||||
|
||||
?>
|
|
@ -1,5 +1,7 @@
|
|||
<?php // index.php :: Case switching to decide what function we need to be running.
|
||||
|
||||
error_reporting(E_STRICT);
|
||||
|
||||
include("lib.php");
|
||||
include("globals.php");
|
||||
|
||||
|
|
14
lib.php
14
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";
|
||||
include("lib2.php");
|
||||
|
||||
// Handling for servers with magic_quotes turned on.
|
||||
|
@ -149,14 +149,14 @@ function mymail($to, $title, $body, $from = '') { // thanks to arto dot PLEASE d
|
|||
$from = trim($from);
|
||||
|
||||
if (!$from) {
|
||||
$from = '<$adminemail>';
|
||||
$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";
|
||||
|
|
2
lib2.php
2
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) {
|
||||
|
|
|
@ -13,6 +13,8 @@ switch($do) {
|
|||
|
||||
function login() {
|
||||
|
||||
$controlrow = dorow(doquery("SELECT * FROM <<control>> 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"));
|
||||
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ function maildelete() {
|
|||
if ($message == false) { err("Invalid action. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
if ($message["recipientid"] != $userrow["id"]) { err("Invalid action. Please <a href=\"index.php\">go back</a> and try again."); }
|
||||
|
||||
$delete = doquery("DELETE FROM {{table}} WHERE id='".$_GET["id"]."'", "messages");
|
||||
$delete = doquery("DELETE FROM <<messages>> WHERE id='".$_GET["id"]."'");
|
||||
die(header("Location: index.php?do=mailbox"));
|
||||
|
||||
}
|
||||
|
|
2
map.php
2
map.php
|
@ -32,7 +32,7 @@ $text .= "player_name=".$userrow["charname"]."&";
|
|||
|
||||
// Then do everyone else.
|
||||
$users = dorow(doquery("SELECT * FROM <<users>> WHERE world='".$worldrow["id"]."' AND UNIX_TIMESTAMP(onlinetime) >= '".(time()-600)."' AND id != '".$userrow["id"]."'"), "id");
|
||||
$text .= "users=".count($users)."&";
|
||||
if ($users) { $text .= "users=".count($users)."&"; } else { $text .= "users=0&"; }
|
||||
$count = 0;
|
||||
if ($users != false) {
|
||||
foreach ($users as $a => $b) {
|
||||
|
|
|
@ -30,7 +30,7 @@ $text .= "player_y=".$y."&";
|
|||
|
||||
// Then do everyone else.
|
||||
$users = dorow(doquery("SELECT * FROM <<users>> WHERE world='".$worldrow["id"]."' AND UNIX_TIMESTAMP(onlinetime) >= '".(time()-600)."' AND id != '".$userrow["id"]."'"), "id");
|
||||
$text .= "users=".count($users)."&";
|
||||
if ($users) { $text .= "users=".count($users)."&"; } else { $text .= "users=0&"; }
|
||||
$count = 0;
|
||||
if ($users != false) {
|
||||
foreach ($users as $a => $b) {
|
||||
|
|
BIN
mapmini.swf
BIN
mapmini.swf
Binary file not shown.
2
pvp.php
2
pvp.php
|
@ -340,7 +340,7 @@ function youwin() {
|
|||
function youlose() {
|
||||
|
||||
global $userrow, $monsterrow, $fightrow;
|
||||
$pvp = dorow(doquery("SELECT * FROM <<pvp>> WHERE id='".$userrow["currentpvp"]."' LIMIT 1""));
|
||||
$pvp = dorow(doquery("SELECT * FROM <<pvp>> WHERE id='".$userrow["currentpvp"]."' LIMIT 1"));
|
||||
|
||||
if ($pvp["player1id"] == $userrow["id"]) {
|
||||
$monsterrow = dorow(doquery("SELECT * FROM <<users>> WHERE id='".$pvp["player2id"]."' LIMIT 1"));
|
||||
|
|
22
story.php
22
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 <<towns>> 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 <<itemmodnames>> ORDER BY id"));
|
||||
foreach($premodrow as $a=>$b) {
|
||||
$modrow[$b["fieldname"]] = $b;
|
||||
}
|
||||
|
||||
$modrow = dorow(doquery("SELECT * FROM <<itemmodnames>> ORDER BY id"), "fieldname");
|
||||
$thenewitem = explode(",",$story["targetitem"]);
|
||||
$newitem = dorow(doquery("SELECT * FROM <<itembase>> WHERE id='".$thenewitem[1]."' LIMIT 1"));
|
||||
$newprefix = dorow(doquery("SELECT * FROM <<itemprefixes>> 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 <<towns>> 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 <<towns>> 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"];
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
<?php
|
||||
|
||||
$template = <<<END
|
||||
<script type="text/javascript">
|
||||
function autopop(theValue) {
|
||||
document.bank.amount.value = theValue;
|
||||
}
|
||||
</script>
|
||||
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.<br /><br />
|
||||
You are currently storing {{formatbank}} gold in the bank, and you are carrying {{formatgold}} gold in your pocket.<br /><br />
|
||||
<form action="index.php?do=bank" method="post">
|
||||
<form action="index.php?do=bank" method="post" name="bank">
|
||||
Enter an amount and then click the Deposit or Withdraw button:<br />
|
||||
<input type="text" name="amount" size="10" maxlength="20" /> <input type="submit" name="deposit" value="Deposit" /> <input type="submit" name="withdraw" value="Withdraw" />
|
||||
<input type="text" name="amount" size="10" maxlength="20" id="amount" /> <input type="submit" name="deposit" value="Deposit" /> <input type="submit" name="withdraw" value="Withdraw" /><br />
|
||||
<a href="#" onClick="javascript:autopop('{{maxpocket}}');">Deposit All</a> | <a href="#" onClick="javascript:autopop('{{maxbank}}');">Withdraw All</a><br /><br />
|
||||
</form>
|
||||
If you've changed your mind, you may also return to <a href="index.php">town</a>.
|
||||
END;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
$template = <<<END
|
||||
You have Level Points to spend. Different character classes get extra bonuses to certain stats from level points. Your stat bonuses are listed below. Note that any fractions are rounded down, so it's in your best interest to make sure you're getting the most out of your level points.<br /><br />
|
||||
You have Level Points to spend. Different character classes get extra bonuses to certain stats from level points. Your stat bonuses are listed below.<br /><br />
|
||||
Class: {{classname}}<br />
|
||||
Damage Per Strength: {{damageperstrength}}<br />
|
||||
Defense Per Dexterity: {{defenseperdex}}<br />
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
$template = <<<END
|
||||
<form action="users.php?do=register" method="post">
|
||||
<table>
|
||||
<tr><td width="30%">Username:</td><td><input type="text" name="username" size="30" maxlength="30" /><br />Usernames must be 30 alphanumeric characters or less.<br /><br /><br /></td></tr>
|
||||
<tr><td width="30%">Username:</td><td><input type="text" name="username" size="30" maxlength="30" /><br />Usernames can contain letters, numbers, dashes and underscores.<br /><br /><br /></td></tr>
|
||||
<tr><td width="30%">Password:</td><td><input type="password" name="password1" size="30" maxlength="30" /></td></tr>
|
||||
<tr><td width="30%">Verify Password:</td><td><input type="password" name="password2" size="30" maxlength="30" /><br />Passwords must be 30 alphanumeric characters or less.<br /><br /><br /></td></tr>
|
||||
<tr><td width="30%">Verify Password:</td><td><input type="password" name="password2" size="30" maxlength="30" /><br /><br /><br /></td></tr>
|
||||
<tr><td width="30%">Email Address:</td><td><input type="text" name="email1" size="30" maxlength="200" /></td></tr>
|
||||
<tr><td width="30%">Verify Email Address:</td><td><input type="text" name="email2" size="30" maxlength="200" /><br /><br /><br /></td></tr>
|
||||
<tr><td width="30%">Image Format:</td><td><select name="imageformat">{{imageformat}}</select><br />(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.)</td></tr>
|
||||
|
|
|
@ -7,7 +7,7 @@ $template = <<<END
|
|||
Leave these fields blank if you wish to keep your old password.<br /><br />
|
||||
Old Password:<br /><input type="password" name="oldpassword" size="30" maxlength="30" /><br />
|
||||
New Password:<br /><input type="password" name="password1" size="30" maxlength="30" /><br />
|
||||
Verify New Password:<br /><input type="password" name="password2" size="30" maxlength="30" /><br />Passwords must be 30 alphanumeric characters or less.<br /><br /><br />
|
||||
Verify New Password:<br /><input type="password" name="password2" size="30" maxlength="30" /><br /><br /><br />
|
||||
</td></tr>
|
||||
<tr><td width="30%">Email Address:</td><td><input type="text" name="email" size="30" maxlength="200" value="{{emailaddress}}"/></td></tr>
|
||||
<tr><td width="30%">Image Format:</td><td><select name="imageformat">{{imageformat}}</select><br />(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.)</td></tr>
|
||||
|
|
11
town.php
11
town.php
|
@ -119,12 +119,7 @@ function buy() { // Buy items from merchants.
|
|||
$newbaseitem = dorow(doquery("SELECT * FROM <<itembase>> WHERE id='$idstring[1]' LIMIT 1"));
|
||||
$newprefix = dorow(doquery("SELECT * FROM <<itemprefixes>> WHERE id='$idstring[0]' LIMIT 1"));
|
||||
$newsuffix = dorow(doquery("SELECT * FROM <<itemsuffixes>> WHERE id='$idstring[2]' LIMIT 1"));
|
||||
$premodrow = dorow(doquery("SELECT * FROM <<itemmodnames>> ORDER BY id"));
|
||||
|
||||
// Format the mod name row.
|
||||
foreach($premodrow as $a=>$b) {
|
||||
$modrow[$b["fieldname"]] = $b;
|
||||
}
|
||||
$modrow = dorow(doquery("SELECT * FROM <<itemmodnames>> 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 <<itembase>> WHERE reqlevel>='".$townrow["itemminlvl"]."' AND reqlevel<='".$townrow["itemmaxlvl"]."' ORDER BY RAND() LIMIT 10"));
|
||||
$preitemsrow = dorow(doquery("SELECT * FROM <<itembase>> WHERE reqlevel>='".$townrow["itemminlvl"]."' AND reqlevel<='".$townrow["itemmaxlvl"]."' AND isunique='0' ORDER BY RAND() LIMIT 10"));
|
||||
$preprefixrow = dorow(doquery("SELECT * FROM <<itemprefixes>> WHERE reqlevel<='".$userrow["level"]."'"));
|
||||
$presuffixrow = dorow(doquery("SELECT * FROM <<itemsuffixes>> WHERE reqlevel<='".$userrow["level"]."'"));
|
||||
$allitemsrow = dorow(doquery("SELECT * FROM <<itembase>>"));
|
||||
|
@ -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));
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ function register() {
|
|||
|
||||
// Process password.
|
||||
if (trim($password1) == "") { $errors++; $errorlist .= "Password fields is required.<br />"; }
|
||||
if (preg_match("/[^A-z0-9_\-]/", $password1)==1) { $errors++; $errorlist .= "Password must be alphanumeric.<br />"; } // Thanks to "Carlos Pires" from php.net!
|
||||
if ($password1 != $password2) { $errors++; $errorlist .= "Passwords don't match.<br />"; }
|
||||
$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.<br /><br />You should receive an Account Verification email shortly. You will need the verification code contained in that email before you are allowed to log in. Once you have received the email, please visit the <a href=\"users.php?do=verify\">Verification Page</a> to enter your code and start playing.";
|
||||
$page = "Your account was created successfully.<br /><br />You should receive an Account Verification email shortly. You will need the verification code contained in that email before you are allowed to log in. Once you have received the email, click the verification link it contains to activate your account, and start playing.";
|
||||
} else {
|
||||
$page = "Your account was created successfully.<br /><br />However, there was a problem sending your verification email. Please check with the game administrator to help resolve this problem.";
|
||||
}
|
||||
|
@ -207,7 +206,6 @@ function settings() {
|
|||
// Process password.
|
||||
if (trim($password1) != "") {
|
||||
if (md5($oldpassword) != $acctrow["password"]) { $errors++; $errorlist .= "Incorrect old password.<br />"; }
|
||||
if (preg_match("/[^A-z0-9_\-]/", $password1)==1) { $errors++; $errorlist .= "Password must be alphanumeric.<br />"; } // Thanks to "Carlos Pires" from php.net!
|
||||
if ($password1 != $password2) { $errors++; $errorlist .= "New passwords don't match.<br />"; }
|
||||
$password = "password='".md5($password1)."',";
|
||||
$newpass = true;
|
||||
|
|
Loading…
Reference in New Issue
Block a user