v1.0.2
v1.0.2
This commit is contained in:
parent
6cc33515e7
commit
0f239ad0b3
|
@ -10,7 +10,7 @@ $dbsettings = Array(
|
||||||
|
|
||||||
// These are used for display purposes only. Technically you could change them, but it's not going to
|
// These are used for display purposes only. Technically you could change them, but it's not going to
|
||||||
// do anything special. And I'd prefer if you didn't, just to keep things all nice and standardized.
|
// do anything special. And I'd prefer if you didn't, just to keep things all nice and standardized.
|
||||||
$version = "1.0.1";
|
$version = "1.0.2";
|
||||||
$build = "";
|
$build = "";
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -73,10 +73,10 @@ function fight() { // One big long function that determines the outcome of the f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($userrow["currentmonstersleep"] == 0) { // Only do this if the monster is awake.
|
if ($userrow["currentmonstersleep"] == 0) { // Only do this if the monster is awake.
|
||||||
$tohit = ceil(rand($monsterrow["maxdam"],(($monsterrow["maxdam"]/6)*3)));
|
$tohit = ceil(rand((($monsterrow["maxdam"]/6)*3),$monsterrow["maxdam"]));
|
||||||
if ($userrow["difficulty"] == 2) { $tohit = ceil($tohit * $controlrow["diff2mod"]); }
|
if ($userrow["difficulty"] == 2) { $tohit = ceil($tohit * $controlrow["diff2mod"]); }
|
||||||
if ($userrow["difficulty"] == 3) { $tohit = ceil($tohit * $controlrow["diff3mod"]); }
|
if ($userrow["difficulty"] == 3) { $tohit = ceil($tohit * $controlrow["diff3mod"]); }
|
||||||
$toblock = ceil(rand($userrow["defensepower"],$userrow["defensepower"]*.75)/4);
|
$toblock = ceil(rand($userrow["defensepower"]*.75,$userrow["defensepower"])/4);
|
||||||
$tododge = rand(1,150);
|
$tododge = rand(1,150);
|
||||||
if ($tododge <= sqrt($userrow["dexterity"])) {
|
if ($tododge <= sqrt($userrow["dexterity"])) {
|
||||||
$tohit = 0; $pagearray["monsterturn"] .= "You dodge the monster's attack. No damage has been scored.<br />";
|
$tohit = 0; $pagearray["monsterturn"] .= "You dodge the monster's attack. No damage has been scored.<br />";
|
||||||
|
@ -235,10 +235,10 @@ function fight() { // One big long function that determines the outcome of the f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($userrow["currentmonstersleep"] == 0) { // Only do this if the monster is awake.
|
if ($userrow["currentmonstersleep"] == 0) { // Only do this if the monster is awake.
|
||||||
$tohit = ceil(rand($monsterrow["maxdam"],(($monsterrow["maxdam"]/6)*3)));
|
$tohit = ceil(rand((($monsterrow["maxdam"]/6)*3)),$monsterrow["maxdam"]);
|
||||||
if ($userrow["difficulty"] == 2) { $tohit = ceil($tohit * $controlrow["diff2mod"]); }
|
if ($userrow["difficulty"] == 2) { $tohit = ceil($tohit * $controlrow["diff2mod"]); }
|
||||||
if ($userrow["difficulty"] == 3) { $tohit = ceil($tohit * $controlrow["diff3mod"]); }
|
if ($userrow["difficulty"] == 3) { $tohit = ceil($tohit * $controlrow["diff3mod"]); }
|
||||||
$toblock = ceil(rand($userrow["defensepower"],$userrow["defensepower"]*.75)/4);
|
$toblock = ceil(rand($userrow["defensepower"]*.75,$userrow["defensepower"])/4);
|
||||||
$tododge = rand(1,150);
|
$tododge = rand(1,150);
|
||||||
if ($tododge <= sqrt($userrow["dexterity"])) {
|
if ($tododge <= sqrt($userrow["dexterity"])) {
|
||||||
$tohit = 0; $pagearray["monsterturn"] .= "You dodge the monster's attack. No damage has been scored.<br />";
|
$tohit = 0; $pagearray["monsterturn"] .= "You dodge the monster's attack. No damage has been scored.<br />";
|
||||||
|
|
|
@ -15,10 +15,7 @@ if (isset($_GET["page"])) {
|
||||||
} else { first(); }
|
} else { first(); }
|
||||||
|
|
||||||
// Thanks to Predrag Supurovic from php.net for this function!
|
// Thanks to Predrag Supurovic from php.net for this function!
|
||||||
function dobatch ($p_query, $p_transaction_safe = true) {
|
function dobatch ($p_query) {
|
||||||
if ($p_transaction_safe) {
|
|
||||||
$p_query = 'START TRANSACTION;' . $p_query . '; COMMIT;';
|
|
||||||
};
|
|
||||||
$query_split = preg_split ("/[;]+/", $p_query);
|
$query_split = preg_split ("/[;]+/", $p_query);
|
||||||
foreach ($query_split as $command_line) {
|
foreach ($query_split as $command_line) {
|
||||||
$command_line = trim($command_line);
|
$command_line = trim($command_line);
|
||||||
|
|
12
lib.php
12
lib.php
|
@ -1,11 +1,15 @@
|
||||||
<?php // lib.php :: Common functions used throughout the program.
|
<?php // lib.php :: Common functions used throughout the program.
|
||||||
|
|
||||||
|
$app_path = "/path/to/your/dkfolder/"; // <-- CHANGE THIS TO YOUR ACTUAL FOLDER PATH.
|
||||||
|
// Remember the trailing slash.
|
||||||
|
// And be sure to use double backslashes if you're on Windows ("c:\\folder\\blah\\").
|
||||||
$starttime = getmicrotime();
|
$starttime = getmicrotime();
|
||||||
$numqueries = 0;
|
$numqueries = 0;
|
||||||
|
|
||||||
function opendb() { // Open database connection.
|
function opendb() { // Open database connection.
|
||||||
|
|
||||||
include('config.php');
|
global $app_path;
|
||||||
|
include($app_path . 'config.php');
|
||||||
extract($dbsettings);
|
extract($dbsettings);
|
||||||
$link = mysql_connect($server, $user, $pass) or die(mysql_error());
|
$link = mysql_connect($server, $user, $pass) or die(mysql_error());
|
||||||
mysql_select_db($name) or die(mysql_error());
|
mysql_select_db($name) or die(mysql_error());
|
||||||
|
@ -15,7 +19,8 @@ function opendb() { // Open database connection.
|
||||||
|
|
||||||
function doquery($query, $table) { // Something of a tiny little database abstraction layer.
|
function doquery($query, $table) { // Something of a tiny little database abstraction layer.
|
||||||
|
|
||||||
include('config.php');
|
global $app_path;
|
||||||
|
include($app_path . 'config.php');
|
||||||
global $numqueries;
|
global $numqueries;
|
||||||
$sqlquery = mysql_query(str_replace("{{table}}", $dbsettings["prefix"] . "_" . $table, $query)) or die(mysql_error());
|
$sqlquery = mysql_query(str_replace("{{table}}", $dbsettings["prefix"] . "_" . $table, $query)) or die(mysql_error());
|
||||||
$numqueries++;
|
$numqueries++;
|
||||||
|
@ -91,7 +96,8 @@ function my_htmlspecialchars($text) { // Thanks to "etymxris at yahoo dot com" f
|
||||||
|
|
||||||
function display($content, $title, $topnav=true, $leftnav=true, $rightnav=true, $badstart=false) { // Finalize page and output to browser.
|
function display($content, $title, $topnav=true, $leftnav=true, $rightnav=true, $badstart=false) { // Finalize page and output to browser.
|
||||||
|
|
||||||
include('config.php');
|
global $app_path;
|
||||||
|
include($app_path . 'config.php');
|
||||||
global $numqueries, $userrow, $controlrow;
|
global $numqueries, $userrow, $controlrow;
|
||||||
if (!isset($controlrow)) {
|
if (!isset($controlrow)) {
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user