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
|
||||
// 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 = "";
|
||||
|
||||
?>
|
|
@ -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.
|
||||
$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"] == 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);
|
||||
if ($tododge <= sqrt($userrow["dexterity"])) {
|
||||
$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.
|
||||
$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"] == 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);
|
||||
if ($tododge <= sqrt($userrow["dexterity"])) {
|
||||
$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(); }
|
||||
|
||||
// Thanks to Predrag Supurovic from php.net for this function!
|
||||
function dobatch ($p_query, $p_transaction_safe = true) {
|
||||
if ($p_transaction_safe) {
|
||||
$p_query = 'START TRANSACTION;' . $p_query . '; COMMIT;';
|
||||
};
|
||||
function dobatch ($p_query) {
|
||||
$query_split = preg_split ("/[;]+/", $p_query);
|
||||
foreach ($query_split as $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.
|
||||
|
||||
$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();
|
||||
$numqueries = 0;
|
||||
|
||||
function opendb() { // Open database connection.
|
||||
|
||||
include('config.php');
|
||||
global $app_path;
|
||||
include($app_path . 'config.php');
|
||||
extract($dbsettings);
|
||||
$link = mysql_connect($server, $user, $pass) 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.
|
||||
|
||||
include('config.php');
|
||||
global $app_path;
|
||||
include($app_path . 'config.php');
|
||||
global $numqueries;
|
||||
$sqlquery = mysql_query(str_replace("{{table}}", $dbsettings["prefix"] . "_" . $table, $query)) or die(mysql_error());
|
||||
$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.
|
||||
|
||||
include('config.php');
|
||||
global $app_path;
|
||||
include($app_path . 'config.php');
|
||||
global $numqueries, $userrow, $controlrow;
|
||||
if (!isset($controlrow)) {
|
||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
||||
|
|
Loading…
Reference in New Issue
Block a user