035a48fbfe
2.26.2006 - Build 14 (Pete Rose): - The poor sods who are stuck on dial-up can now select to not show the minimap in their account settings. - Fixed a problem with guild names in paneltop. - Fixed minor bug in account settings that caused a server error when not changing your password. - Manually logging out of the game now resets your onlinetime so you no longer appear in Who's Online. - Letting a duel time out after it's been accepted now counts against your duelling wins/losses. - Overhauled dorow() to allow forcing array indexes by a specific column. Modified several functions accordingly. - Guild Honor is now shown correctly on the main Guild Hall page immediately after an update. - Guild shoutboxes now add the guild ID from userrow instead of in the GET request. More secure. - Guild minimim join/start levels are now admin-editable in controlrow. - updateuserrow() now array_maps addslashes to allow apostrophes in item names.
63 lines
2.8 KiB
PHP
63 lines
2.8 KiB
PHP
<?php // pvpmini.php :: update tester for pvp.
|
|
|
|
include("lib.php");
|
|
include("globals.php");
|
|
|
|
global $userrow, $controlrow;
|
|
$row = dorow(doquery("SELECT *,UNIX_TIMESTAMP(turntime) as fturntime FROM {{table}} WHERE id='".$userrow["currentpvp"]."' LIMIT 1", "pvp"));
|
|
|
|
// Check for timeout.
|
|
if ($row["fturntime"] < (time() - $controlrow["pvptimeout"])) {
|
|
|
|
// If the PVP was accepted, whoever timed out loses.
|
|
if ($row["accepted"] == 1) {
|
|
$monsterrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$row["player2id"]."' LIMIT 1", "users"));
|
|
if ($monsterrow["level"] > $userrow["pvphighest"]) { $highest = ", pvphighest='".$monsterrow["level"]."'"; } else { $highest = ""; }
|
|
doquery("UPDATE {{table}} SET currentpvp='0', currentaction='In Town', pvpwins = pvpwins + 1 $highest WHERE id='".$row["player1id"]."' LIMIT 1", "users");
|
|
doquery("UPDATE {{table}} SET currentpvp='0', currentaction='In Town', pvplosses = pvplosses + 1 WHERE id='".$row["player2id"]."' LIMIT 1", "users");
|
|
} else {
|
|
doquery("UPDATE {{table}} SET currentpvp='0', currentaction='In Town' WHERE id='".$row["player1id"]."' OR id='".$row["player2id"]."' LIMIT 2", "users");
|
|
}
|
|
|
|
$query2 = doquery("DELETE FROM {{table}} WHERE id='".$row["id"]."'", "pvp");
|
|
$pagerow["content"] = "The other player did not respond and this Duel has timed out. Thanks for playing.<br /><br />This window will refresh to the main screen in ".$controlrow["pvprefresh"]." seconds.";
|
|
$pagerow["target"] = "_top";
|
|
$pagerow["parentreload"] = "onload=\"setTimeout('top.location.href=\'index.php\'',".($controlrow["pvprefresh"] * 1000).")\"";
|
|
$pagerow["metareload"] = "";
|
|
|
|
$page = parsetemplate(gettemplate("pvp_mini"),$pagerow);
|
|
if ($controlrow["compression"] == 1) { ob_start("ob_gzhandler"); }
|
|
echo $page;
|
|
die();
|
|
|
|
}
|
|
|
|
// No timeout so check for whose turn it is.
|
|
if ($row["playerturn"] == $userrow["id"]) {
|
|
|
|
$pagerow["content"] = "Please hold while this window refreshes to the game screen...";
|
|
$pagerow["target"] = "_top";
|
|
$pagerow["metareload"] = "";
|
|
$pagerow["parentreload"] = "onload=\"setTimeout('top.location.href=\'pvp.php\'',".($controlrow["pvprefresh"] * 100).")\"";
|
|
$pagerow["metareload"] = "";
|
|
|
|
$page = parsetemplate(gettemplate("pvp_mini"),$pagerow);
|
|
if ($controlrow["compression"] == 1) { ob_start("ob_gzhandler"); }
|
|
echo $page;
|
|
die();
|
|
|
|
} else {
|
|
|
|
$pagerow["content"] = "Waiting for player to respond...";
|
|
$pagerow["target"] = "_self";
|
|
$pagerow["parentreload"] = "";
|
|
$pagerow["metareload"] = "<meta http-equiv=\"refresh\" content=\"".$controlrow["pvprefresh"].";url=pvpmini.php\">";
|
|
|
|
$page = parsetemplate(gettemplate("pvp_mini"),$pagerow);
|
|
if ($controlrow["compression"] == 1) { ob_start("ob_gzhandler"); }
|
|
echo $page;
|
|
die();
|
|
|
|
}
|
|
|
|
?>
|