public function addStatus($status_in_caps) { addStatus($status_in_caps); }
if ($critical_failure > 7) { // *** If the critical failure rate wasn't hit. if ($target_turns >= 5) { $turns_decrease = rand(2, 5); subtractTurns($target, $turns_decrease); addTurns($username, $turns_decrease); $msg = "You have had Cold Steal cast on you for {$turns_decrease} by {$attacker_id} at {$today}"; sendMessage($attacker_id, $target, $msg); $result = "You cast Cold Steal on {$target} and take {$turns_decrease} of his turns.<br>\n"; } else { $turn_cost = 0; $result = "The victim did not have enough turns to give you.<br>\n"; } } else { // *** CRITICAL FAILURE !! addStatus($username, FROZEN); $unfreeze_time = date("F j, Y, g:i a", mktime(date("G") + 1, 0, 0, date("m"), date("d"), date("Y"))); $failure_msg = "You have experienced a critical failure while using Cold Steal on {$today}. You will be unfrozen on {$unfreeze_time}"; sendMessage("SysMsg", $username, $failure_msg); $result = "Cold Steal has backfired! You have lost 3 turns and are now frozen until {$unfreeze_time}!<br>\n"; } } else { $turn_cost = 0; echo "You do not have enough turns to cast {$command}.\n"; } } } } } } }
$row = $sql->data; if ($item_count < 1) { echo "You do not have" . ($item ? " {$article} " . $item->getName() : ' that item') . ".\n"; } else { /**** MAIN SUCCESSFUL USE ****/ echo "Preparing to use item - <br>\n"; if ($give == "on" || $give == "Give") { echo render_give_item($username, $target, $item->getName()); } else { // *** HP Altering *** if ($item->getTargetDamage() > 0) { $result = "lose " . $item->getTargetDamage() . " HP"; $victim_alive = subtractHealth($target, $item->getTargetDamage()); } else { if ($item === $stealthScroll) { addStatus($target, STEALTH); echo "<br>{$target} is now Stealthed.<br>\n"; $result = false; $victim_alive = true; } else { if ($item === $dimMak) { setHealth($target, 0); $victim_alive = false; $result = "be drained of your life-force and die!"; $gold_mod = 0.25; //The Dim Mak takes away 25% of a targets' gold. } else { if ($item->getTurnChange() <= 0) { $turns_change = $item->getTurnChange(); if ($turns_change == 0) { echo 'You fail to take any turns from ' . $target . '.';
} } function infoFields() { $s = new Status(); return $s->getFields(); } /* </functions> */ $action = Functions::get('action'); Functions::checkRights(__FILE__, $action, Functions::get('token')); switch ($action) { case 'fields_info': $data = infoFields(); break; case 'new': $data = addStatus(); break; case 'update': $data = updateStatus(Functions::get('id')); break; case 'info': $data = infoStatus(Functions::get('id')); break; case 'delete': $data = deleteStatus(Functions::get('id')); break; case 'list': $data = listStatuses(); break; default: Functions::setResponse(400);
if ($restore == 1) { // *** RESURRECTION SECTION *** if ($startingHealth > 0) { echo "You are not dead.<br><br>\n"; } else { if ($startingKills > 1 || $freeResurrection) { // If you're dead, and a newbie, or dead and have kills. // *** FREE RESURRECTION DETERMINATION *** if (!$freeResurrection) { subtractKills($username, 1); } setHealth($username, 100); subtractStatus($username, STEALTH + POISON + FROZEN + CLASS_STATE); // *** FREE STEALTHING FOR BLACK CLASS UPON NON-FREE RESURRECTION if ($players_class == "Black" && !$freeResurrection) { addStatus($username, STEALTH); } echo "What once was dead shall rise again.<br>\n"; echo "Current Kills: " . $startingKills . "<br>\n"; echo "Adjusted Kills after returning to life: " . getKills($username) . "<br>\n"; } elseif ($startingTurns > 0) { echo "What once was dead shall rise again.<br>\n"; if ($startingTurns < $lostTurns && $startingTurns > 0) { $lostTurns = $startingTurns; } subtractTurns($username, $lostTurns); // *** Takes away necessary turns. setHealth($username, 100); subtractStatus($username, STEALTH + POISON + FROZEN + CLASS_STATE); echo "Since you have no kills, your resurrection will cost you part of your life time."; echo "Current Turns: " . $startingTurns . "<br>\n";
$url = $_SERVER['REQUEST_URI']; $url = str_replace('/kerneljs/ajax.php/', '', $url); switch ($url) { case 'feed': switch ($method) { case 'GET': default: getStatusFeed(); exit; } break; case 'status': switch ($method) { case 'POST': default: addStatus(); exit; } break; default: exit; } function getStatusFeed() { echo json_encode(array_reverse($_SESSION['status'])); } function addStatus() { $arr = array(); $arr['success'] = true; $_SESSION['status'][] = $_REQUEST['newstatus'];
function invitePlayer($who, $clan) { global $sql, $status_array; $current_clan = $sql->QueryItem("SELECT clan FROM players WHERE uname = '{$who}'"); $player_is_confirmed = $sql->QueryItem("SELECT confirmed FROM players WHERE uname = '{$who}'"); if ($current_clan == "" && $player_is_confirmed == 1 && !$status_array['Invited']) { $invite_msg = "{$clan} has invited you into their clan. To accept, choose their clan " . getClanLongName($clan) . " on the [href:clan.php?command=join|clan joining page.]"; sendMessage($clan, $who, $invite_msg); addStatus($who, INVITED); $failure_reason = "None."; return $failure_reason; } else { if ($player_is_confirmed != 1) { $failure_reason = "That player name does not exist."; return $failure_reason; } else { if ($current_clan != "") { $failure_reason = "That player is already in a clan."; return $failure_reason; } else { if ($status_array['Invited']) { $failure_reason = "That player has already been Invited into a Clan."; return $failure_reason; } else { $failure_reason = "Report invitePlayer Code Error: That Player cannot be invited."; return $failure_reason; } } } } }
}); $app->get('/status', function () use($app) { $id_sensor = $app->request->get("id_sensor"); $status = $app->request->get("status"); switch ($status) { case 1: $status = "normal"; break; case 2: $status = "waspada"; break; case 3: $status = "bahaya"; break; } echo addStatus($id_sensor, $status); }); $app->get('/status/:id_sensor', function ($id_sensor) use($app) { echo getStatus($id_sensor); }); $app->get('/', function () use($app) { require_once "home.php"; }); // helper PDO. function getConnection() { $dbhost = "localhost"; $dbuser = "******"; $dbpass = "******"; $dbname = "laproid_gas"; $dbh = new PDO("mysql:host={$dbhost};dbname={$dbname}", $dbuser, $dbpass);