function scrapbots_scavenge($reps = 1) { global $session; //todo: hook in Stamina system, factor in remaining Stamina and experience //Get the player's Scrap $playerscrap = scrapbots_get_player_scrap(); for ($i = 0; $i < $reps; $i++) { //Actually, let's just put in a random chance that the player will trip and impale themselves on a rusty bit of pointy scrap require_once "modules/staminasystem/lib/lib.php"; $return = process_action("Scavenging for Scrap"); if ($return['lvlinfo']['levelledup'] == true) { output("`n`c`b`0You gained a level in Scavenging for Scrap! You are now level %s! This action will cost fewer Stamina points now, so you can Scavenge more each day!`b`c`n", $return['lvlinfo']['newlvl']); } $stamina = get_stamina(); $failchance = e_rand(1, 100); if ($stamina < 100) { output("`4You're getting tired.`0 Clambering around on a big pile of pointy, rusted scrap metal while you're half-asleep carries certain risks.`n"); } if ($failchance > $stamina) { output("`\$This fact is driven home to you as you slip on an oily bit of sheet metal and fall head-first into the pile!`nYou `blose`b some hitpoints!`n`0"); $hploss = e_rand(0, floor($session['user']['maxhitpoints'] / 2)); $session['user']['hitpoints'] -= $hploss; if ($session['user']['hitpoints'] <= 0) { output("`\$You begin to feel a bit dizzy from the lack of blood. Before you know it, you've collapsed, and the friendly local Robots have helped themselves to your cash and summoned the Retraining Personnel!`n"); $session['user']['alive'] = false; $session['user']['gold'] = 0; addnav("Whoops."); addnav("Daily News", "news.php"); blocknav("runmodule.php?module=scrapbots&scavenge=1"); blocknav("runmodule.php?module=scrapbots&scavenge=10"); blocknav("village.php"); break; } } //dummy vals for now $normalchance = 100; $rarechance = 66; $veryrarechance = 99; $scrapnames = scrapbots_scrapnames(); $scavengerarity = e_rand(1, 99); if ($scavengerarity <= $normalchance) { //award normal object $award = e_rand(0, 15); $playerscrap['data']['normalitems'][$award] += 1; output("`0You rummage through the scrap pile and come up with a `5%s`0.`n", $scrapnames['normalitems'][$award]); } elseif ($scavengerarity > $normalchance && $scavengerarity <= $rarechance) { $award = e_rand(0, 12); $playerscrap['data']['rareitems'][$award] += 1; output("`0You find a rare item! A pretty nice `5%s`0.`n", $scrapnames['rareitems'][$award]); } elseif ($scavengerarity > $rarechance) { //award very rare item $award = e_rand(0, 3); $playerscrap['data']['veryrareitems'][$award] += 1; output("`0You find a very rare item! This `5%s`0 looks like it's in good nick!`n", $scrapnames['veryrareitems'][$award]); } } set_module_pref("scrap", serialize($playerscrap), "scrapbots"); return; }
function improbablehousing_show_build_jobs($house) { //run through the build jobs and show percentage to completion, along with navs to use the relevant item and its associated Stamina cost. //For easyness, don't allow the player to build if they're in Amber stamina $jobs = $house['data']['buildjobs']; require_once "modules/staminasystem/lib/lib.php"; $storestock = $house['data']['store']; $displayjobs = array(); if (count($jobs)) { foreach ($jobs as $key => $vals) { if (!isset($displayjobs[$vals['name']])) { addnav(array("%s", $vals['name'])); foreach ($vals['jobs'] as $skey => $svals) { $cando = 1; $displayjobs[$vals['name']][$svals['name']]['req'] = $svals['req']; $displayjobs[$vals['name']][$svals['name']]['done'] = $svals['done']; //check completion if ($svals['completed']) { $cando = 0; } //Check Stamina if (get_stamina() < 100) { $cando = 0; $nostam = 1; $displayjobs[$vals['name']][$svals['name']]['nostamina'] = true; } $store = array(); $player = array(); foreach ($svals['iitems'] as $ikey => $iitem) { $store[$ikey] = $house['data']['store'][$ikey]; if (has_item($ikey)) { $player[$ikey] = 1; } } //check that each item required is present in either the store or the player's inventory... this could be neater... $svals['useplayer'] = true; foreach ($svals['iitems'] as $ikey => $iitem) { if (!$store[$ikey] && !$player[$ikey]) { $cando = 0; $displayjobs[$vals['name']][$svals['name']]['noitem'] = true; } if ($store[$ikey] > 0) { $svals['usestore'] = true; } if (!$player[$ikey]) { $svals['useplayer'] = false; } } // debug($store); // debug($player); if ($cando) { $scost = 0; foreach ($svals['actions'] as $akey => $action) { $scost += stamina_getdisplaycost($akey); } if ($svals['useplayer']) { addnav(array("%s (`Q%s%%`0)", $svals['name'], $scost), "runmodule.php?module=improbablehousing&op=build&hid=" . $house['id'] . "&job=" . $key . "&subjob=" . $skey); } if ($svals['usestore']) { addnav(array("%s (using store) (`Q%s%%`0)", $svals['name'], $scost), "runmodule.php?module=improbablehousing&op=build&hid=" . $house['id'] . "&job=" . $key . "&subjob=" . $skey . "&store=true"); } } } } } } if (count($displayjobs)) { output("`b`0Current Construction Jobs`b`n"); foreach ($displayjobs as $job => $sub) { output_notl("`0->%s`n", $job); foreach ($sub as $sjob => $vals) { $jobout = "<table><tr><td>"; require_once "lib/bars.php"; $bar = fadebar($vals['done'], $vals['req']); if ($vals['completed']) { $jobout .= "-->" . $sjob . " </td><td>" . $bar . "</td> "; } else { $jobout .= "-->" . $sjob . " </td><td>" . $bar . "</td><td> " . $vals['done'] . "/" . $vals['req'] . " "; if ($vals['nostamina']) { $jobout .= "(you don't have enough Stamina to do this job) "; } if ($vals['noitem']) { $jobout .= "(you don't have all the items you need to do this job) "; } } $jobout .= "</td></tr></table>"; rawoutput($jobout); } output_notl("`n"); } output_notl("`n"); } if ($nostam) { output("You have the brains to know that doing construction work when you're anything but wide awake is an idea so bad you're not even willing to entertain it.`n`n"); } }
<?php popup_header("Your Stamina statistics"); $stamina = get_module_pref("stamina"); $daystamina = 1000000; $redpoint = get_module_pref("red"); $amberpoint = get_module_pref("amber"); $redpct = get_stamina(0); $amberpct = get_stamina(1); $greenpct = get_stamina(2); $greentotal = round(($daystamina - $redpoint - $amberpoint) / $daystamina * 100); $ambertotal = round(($daystamina - $redpoint) / $daystamina * 100 - $greentotal); $redtotal = 100 - $greentotal - $ambertotal; $greenwidth = $greentotal / 100 * $greenpct; $amberwidth = $ambertotal / 100 * $amberpct; $redwidth = $redtotal / 100 * $redpct; $colorgreen = "#00FF00"; $coloramber = "#FFA200"; $colorred = "#FF0000"; $colordarkgreen = "#003300"; $colordarkamber = "#2F1E00"; $colordarkred = "#330000"; $colorbackground = $colordarkgreen; if ($greenpct == 0) { $colorgreen = $colordarkamber; $colorbackground = $colordarkamber; } if ($amberpct == 0) { $colorgreen = $colordarkred; $coloramber = $colordarkred; $colorbackground = $colordarkred;
$actinfo = process_action("Decorating"); if ($actinfo['lvlinfo']['levelledup']) { output("`n`c`b`0You gained a level in Decorating! You are now level %s! This action will cost fewer Stamina points now.`b`c`n", $actinfo['lvlinfo']['newlvl']); } $house['data']['rooms'][$rid]['dec']['done'] += 1; //check if the job's done if ($house['data']['rooms'][$rid]['dec']['done'] == $house['data']['rooms'][$rid]['dec']['req']) { output("The decorating job is completed! You step back and admire your work. Pretty nice!`n`n"); $house['data']['rooms'][$rid]['desc'] = $house['data']['rooms'][$rid]['dec']['desc']; unset($house['data']['rooms'][$rid]['dec']); $eraseroomdec = "DELETE FROM " . db_prefix("room_prefs") . " WHERE pref = 'dec' AND hid = '{$hid}' AND rid = '{$rid}'"; db_query($eraseroomdec); } else { output("You set about painting and decorating. Before too long, the room is one step closer to being fully decorated.`n`n"); require_once "lib/bars.php"; $bar = fadebar($house['data']['rooms'][$rid]['dec']['done'], $house['data']['rooms'][$rid]['dec']['req'], 150, 5); rawoutput("Decoration completion status: " . $bar); addnav("Decorate some more?"); require_once "modules/staminasystem/lib/lib.php"; if (get_stamina() == 100) { $cost = stamina_getdisplaycost("Decorating"); addnav(array("Decorate some more (`Q%s%%`0)", $cost), "runmodule.php?module=improbablehousing&op=decorate&subop=decorate&hid={$hid}&rid={$rid}"); } else { addnav("You're too tired to do any more sprucing up right now.", ""); } } improbablehousing_sethousedata($house); break; } improbablehousing_bottomnavs($house); page_footer();
function meatsystem_run() { global $session; require_once "modules/staminasystem/lib/lib.php"; page_header("Meat!"); addnav("Meat Skills"); $from = httpget('from'); switch (httpget('op')) { case "devour": //special ability for Zombies only - Zombies can eat raw meat, so we're giving them the ability to simply devour the carcass where it lies. $carcasses = unserialize(get_module_pref("carcasses")); if (!is_array($carcasses)) { $carcasses = array(); } debug($carcasses); foreach ($carcasses as $carcassnum => $creatureid) { $sql = "SELECT creaturename FROM " . db_prefix("creatures") . " WHERE creatureid = " . $creatureid . " "; $result = db_query_cached($sql, "creaturename-" . $creatureid, 86400); $creature = db_fetch_assoc($result); output("Giving in to your primal urges, you lean down and begin ripping meat from the still-twitching %s with your teeth.`n`n", $creature['creaturename']); $meat1 = get_module_objpref("creatures", $creatureid, "meat1"); $meat2 = get_module_objpref("creatures", $creatureid, "meat2"); $meat3 = get_module_objpref("creatures", $creatureid, "meat3"); for ($i = 0; $i < $meat1; $i++) { increment_module_pref("nutrition", 1, "staminafood"); increment_module_pref("fat", 3, "staminafood"); increment_module_pref("fullness", 1, "staminafood"); addstamina(1000); } for ($i = 0; $i < $meat2; $i++) { increment_module_pref("nutrition", 2, "staminafood"); increment_module_pref("fat", 2, "staminafood"); increment_module_pref("fullness", 1, "staminafood"); addstamina(2000); } for ($i = 0; $i < $meat3; $i++) { increment_module_pref("nutrition", 3, "staminafood"); increment_module_pref("fat", 1, "staminafood"); increment_module_pref("fullness", 1, "staminafood"); addstamina(5000); } output("For the record, and since it's nice to know these things even if you're too busy tearing cartilage and muscle from the bone to really pay attention to them, in this meal you have eaten %s bite's-worth of Crap Meat, %s bite's-worth of Half-Decent Meat, and %s bite's-worth of Tasty Meat.`n", $meat1, $meat2, $meat3); $full = get_module_pref("fullness", "staminafood"); if ($full < 0) { output("You still feel as though you haven't eaten in days.`n`n"); } if ($full >= 0 && $full < 50) { output("You feel a little less hungry.`n`n"); } if ($full >= 50 && $full < 100) { output("You still feel as though you've got room for more!`n`n"); } if ($full >= 100) { output("You're stuffed! You feel as though you can't possibly eat anything more today.`n`n"); } unset($carcasses[$carcassnum]); set_module_pref("carcasses", serialize($carcasses)); } break; case "clean": $creatureid = httpget('creatureid'); $carcass = httpget('carcass'); $meat1 = get_module_objpref("creatures", $creatureid, "meat1"); $meat2 = get_module_objpref("creatures", $creatureid, "meat2"); $meat3 = get_module_objpref("creatures", $creatureid, "meat3"); $amber = get_stamina(); $return = process_action("Cleaning the Carcass"); if ($return['lvlinfo']['levelledup'] == true) { output("`n`c`b`0You gained a level in Cleaning Carcasses! You are now level %s! This action will cost fewer Stamina points now, so you can butcher more creatures each day!`b`c`n", $return['lvlinfo']['newlvl']); } $failchance = e_rand(0, 100); if ($failchance > $amber) { //failure - the nice meat gets turned into Crap Meat $meat1 += $meat2; $meat1 += $meat3; output("`4You sit down to clean the carcass. Your exhausted, clumsy incisions make a mockery of the choicest cuts - what is left over can only be described as Crap Meat. %s bite's-worth, to be precise. It looks like it was hacked into chunks by a blind woodsman.", $meat1); //todo for ($i = 0; $i < $meat1; $i++) { give_item("meat_low", false, false, true); } load_inventory(); $carcasses = unserialize(get_module_pref("carcasses")); unset($carcasses[$carcass]); $carcasses = array_values($carcasses); set_module_pref("carcasses", serialize($carcasses)); } else { //success - all meat is sorted output("You spend a few minutes up to your elbows in gore, and getting rather hungry.`n"); if ($meat1 > 0) { output("You tear off enough to make %s rough bite's-worth of what the locals affectionately call Crap Meat. It's mostly wobbling chunks of stinking yellow fat, intermingled with the occasional squirmy tendon.`n", $meat1); } if ($meat2 > 0) { output("You make swift work of the fattier muscle, and before too long you have %s rough bite's-worth of Half-Decent Meat.`n", $meat2); } if ($meat3 > 0) { output("The red, tender slivers of muscle slide easily from the bone, and you wind up with %s rough bite's-worth of Tasty Meat.`n", $meat3); } //todo for ($i = 0; $i < $meat1; $i++) { give_item("meat_low", false, false, true); } for ($i = 0; $i < $meat2; $i++) { give_item("meat_medium", false, false, true); } for ($i = 0; $i < $meat3; $i++) { give_item("meat_high", false, false, true); } load_inventory(); $carcasses = unserialize(get_module_pref("carcasses")); unset($carcasses[$carcass]); $carcasses = array_values($carcasses); set_module_pref("carcasses", serialize($carcasses)); $pmeat1 = has_item("meat_low"); $pmeat2 = has_item("meat_medium"); $pmeat3 = has_item("meat_high"); if (($pmeat1 || $pmeat2 || $pmeat3) && $session['user']['race'] != "Robot") { if (get_module_pref("fullness", "staminafood") < 100) { $cookcost = stamina_getdisplaycost("Cooking"); addnav(array("Cook up some meat (`Q%s%%`0)", $cookcost), "runmodule.php?module=meatsystem&op=cook&from=" . $from); } else { addnav("You're too full to cook, let alone eat", ""); } } } break; case "cook": $pmeat1qty = has_item_quantity("meat_low"); $pmeat2qty = has_item_quantity("meat_medium"); $pmeat3qty = has_item_quantity("meat_high"); output("You whip out your camping stove. It's time to cook!`n`nWhat will you put in the pan? You can fit up to 20 bite's-worth of meat in there. Right now you have %s bite's-worth of Crap Meat, %s bite's-worth of Half-Decent Meat, and %s bite's-worth of Tasty Meat.`n`n", $pmeat1qty, $pmeat2qty, $pmeat3qty); rawoutput("<form action='runmodule.php?module=meatsystem&op=cookfinal&from=" . $from . "' method='POST'>"); rawoutput("Put in <input name='meat1' width='2' value='0'> bite's-worth of Crap Meat.<br />"); rawoutput("Put in <input name='meat2' width='2' value='0'> bite's-worth of Half-Decent Meat.<br />"); rawoutput("Put in <input name='meat3' width='2' value='0'> bite's-worth of Tasty Meat.<br />"); rawoutput("<input type='submit' class='button' value='" . translate_inline("Cook!") . "'>"); rawoutput("</form>"); addnav("", "runmodule.php?module=meatsystem&op=cookfinal&from=" . $from); break; case "cookfinal": $pmeat1qty = has_item_quantity("meat_low"); $pmeat2qty = has_item_quantity("meat_medium"); $pmeat3qty = has_item_quantity("meat_high"); $meat1 = httppost("meat1"); $meat2 = httppost("meat2"); $meat3 = httppost("meat3"); //check for the dumbass player cooking meat that they don't have if ($meat1 > $pmeat1qty || $meat2 > $pmeat2qty || $meat3 > $pmeat3qty) { output("You don't `ihave`i that much meat!`n`n"); addnav("Whoops"); addnav("Sorry, I forgot how to count for a second there. Let's try this again.", "runmodule.php?module=meatsystem&op=cook&from=" . $from); break; } //check for the dumbass player inputting a negative number if ($meat1 < 0 || $meat2 < 0 || $meat3 < 0) { page_header("Either taking vegetarianism to whole new levels, or trying to grow meat from an empty pan"); output("You want to cook `inegative`i meat? How very Zen of you.`n`n"); addnav("You sneaky bugger"); addnav("Abandon your efforts to produce the opposite of meat and try again, pretending that you weren't just trying to cheat.", "runmodule.php?module=meatsystem&op=cook&from=" . $from); break; } //check for the dumbass player trying to put too much meat in the pan $totalmeat = $meat1 + $meat2 + $meat3; if ($totalmeat > 20) { output("Your pan can't hold that much meat, pal.`n`n"); addnav("Whoops"); addnav("Try again, without filling the pan up so much", "runmodule.php?module=meatsystem&op=cook&from=" . $from); break; } //check for the dumbass player trying to cook no meat at all $totalmeat = $meat1 + $meat2 + $meat3; if ($totalmeat == 0) { output("You start the process of cooking up your tasty meat. After a few minutes of poking around in your pan, growing hungrier by the second, you realise that you've forgotten something.`n`n"); addnav("Whoops"); addnav("Try again, with meat this time", "runmodule.php?module=meatsystem&op=cook&from=" . $from); break; } //Stamina interaction, including consequences and level-up details. $amber = get_stamina(); $return = process_action("Cooking"); if ($return['lvlinfo']['levelledup'] == true) { output("`n`c`b`0You gained a level in Cooking! You are now level %s! This action will cost fewer Stamina points now, so you can cook more tasty meals each day!`b`c`n", $return['lvlinfo']['newlvl']); } $failchance = e_rand(0, 100); if ($failchance > $amber) { output("`4You put your meat into the pan, and sit down to stir-fry it. The hypnotic motion and white-noise sizzling, combined with your tiredness, sends you staring into space. While your concentration is impaired, the meat bursts into flames. You jerk back into awareness, and look down sadly at the flaming chunks. Bummer."); for ($i = 0; $i < $meat1; $i++) { delete_item(has_item("meat_low")); } for ($i = 0; $i < $meat2; $i++) { delete_item(has_item("meat_medium")); } for ($i = 0; $i < $meat3; $i++) { delete_item(has_item("meat_high")); } break; } //we can now assume that the player is not some sort of cheating reprobate, or trying to cook while dog-tired, and do some cooking! for ($i = 0; $i < $meat1; $i++) { increment_module_pref("nutrition", 1, "staminafood"); increment_module_pref("fat", 3, "staminafood"); increment_module_pref("fullness", 1, "staminafood"); delete_item(has_item("meat_low")); addstamina(1000); } for ($i = 0; $i < $meat2; $i++) { increment_module_pref("nutrition", 2, "staminafood"); increment_module_pref("fat", 2, "staminafood"); increment_module_pref("fullness", 1, "staminafood"); delete_item(has_item("meat_medium")); addstamina(2000); } for ($i = 0; $i < $meat3; $i++) { increment_module_pref("nutrition", 3, "staminafood"); increment_module_pref("fat", 1, "staminafood"); increment_module_pref("fullness", 1, "staminafood"); delete_item(has_item("meat_high")); addstamina(5000); } output("You fry up your lovely meaty loveliness, and sit down to eat. You gain some Stamina!`n`n"); $full = get_module_pref("fullness", "staminafood"); if ($full < 0) { output("You still feel as though you haven't eaten in days.`n`n"); } if ($full >= 0 && $full < 50) { output("You feel a little less hungry.`n`n"); } if ($full >= 50 && $full < 100) { output("You still feel as though you've got room for more!`n`n"); } if ($full >= 100) { output("You're stuffed! You feel as though you can't possibly eat anything more today.`n`n"); } break; } $carcasses = unserialize(get_module_pref("carcasses")); if (!is_array($carcasses)) { $carcasses = array(); } if (count($carcasses) > 0) { output("You look at the spoils of your most recent battle. They lie bloodied and broken on the ground. What will you do with them?"); foreach ($carcasses as $carcassnum => $creatureid) { $sql = "SELECT creaturename FROM " . db_prefix("creatures") . " WHERE creatureid = " . $creatureid . " "; $result = db_query_cached($sql, "creaturename-" . $creatureid, 86400); $creature = db_fetch_assoc($result); $cleancost = stamina_getdisplaycost("Cleaning the Carcass"); addnav(array("Clean the carcass of %s (`Q%s%%`0)", $creature['creaturename'], $cleancost), "runmodule.php?module=meatsystem&op=clean&creatureid=" . $creatureid . "&carcass=" . $carcassnum . "&from=" . $from); } } else { if (httpget('op') != "cook" && httpget('op') != "cookfinal") { output("Now only bloody bones lie strewn around the area.`n`n"); } } addnav("Ah, screw it."); if ($from == "forest") { addnav("Return to the Jungle", "forest.php"); } else { if ($from == "world") { addnav("Return to the World Map", "runmodule.php?module=worldmapen&op=continue"); } } page_footer(); return true; }
function staminafood_dohook($hookname, $args) { global $session; switch ($hookname) { case "village": tlschema($args['schemas']['marketnav']); addnav($args['marketnav']); tlschema(); switch ($session['user']['location']) { case "NewHome": addnav("Joe's Diner", "runmodule.php?module=staminafood&op=start&location=nh"); break; case "Kittania": addnav("Cool Springs Cafe", "runmodule.php?module=staminafood&op=start&location=ki"); break; case "New Pittsburgh": addnav("BRAAAAAINS", "runmodule.php?module=staminafood&op=start&location=np"); break; case "Squat Hole": addnav("Kebabs 'n' S***e", "runmodule.php?module=staminafood&op=start&location=sq"); break; case "Pleasantville": addnav("Mutated Munchies", "runmodule.php?module=staminafood&op=start&location=pl"); break; } break; case "stamina-newday-intercept": if ($session['user']['age'] > 1) { //Remove the value of used Stamina from the player's Nutrition and Fat counters //Jokers do not have to eat, can do so if they want, but get no long-term benefit from doing so //Robots cannot eat, but don't suffer any effects from not doing so if ($session['user']['race'] != "Robot" && $session['user']['race'] != "Joker") { debug("Nutrition:"); debug(get_module_pref("nutrition")); debug("Fat:"); debug(get_module_pref("fat")); debug("Fullness:"); debug(get_module_pref("fullness")); require_once "modules/staminasystem/lib/lib.php"; $pctused = round(100 - get_stamina(3)); if ($pctused > 0) { $newnu = get_module_pref("nutrition") - $pctused; $newfa = get_module_pref("fat") - $pctused; set_module_pref("nutrition", $newnu); set_module_pref("fat", $newfa); } if (get_module_pref("fat") < -200) { set_module_pref("fat", -200); } if (get_module_pref("nutrition") < -200) { set_module_pref("nutrition", -200); } if (get_module_pref("fat") > 200) { set_module_pref("fat", 200); } if (get_module_pref("nutrition") > 200) { set_module_pref("nutrition", 200); } } increment_module_pref("fullness", -100); if (get_module_pref("fullness") < -100) { set_module_pref("fullness", -100); } } break; case "stamina-newday": if ($session['user']['race'] != "Robot" && $session['user']['race'] != "Gobot" && $session['user']['race'] != "Foebot" && $session['user']['race'] != "Joker" && $session['user']['race'] != "Stranger") { require_once "modules/staminasystem/lib/lib.php"; //Output messages pertaining to the user's weight and fitness, apply buffs output("`nYou take a few moments to take stock of how you're looking and feeling.`n"); $fat = get_module_pref("fat"); $nut = get_module_pref("nutrition"); debug($nut); debug($fat); if ($nut < 0 && $nut >= -20) { output("`0You are feeling `4kinda weak and malnourished`0. You lose some Stamina.`n"); removestamina(25000); } if ($nut < -20 && $nut >= -50) { output("`0You are feeling `4more than a little weak and malnourished`0. You lose some Stamina.`n"); removestamina(50000); } if ($nut < -50 && $nut >= -100) { output("`0You are feeling `4very weak and ridiculously hungry`0. You lose some Stamina.`n"); removestamina(100000); } if ($nut < -100) { output("`0You are `4slowly dying of malnutrition`0. You lose some Stamina.`n"); removestamina(200000); } if ($nut >= 0 && $nut < 50) { output("`0You are feeling quite healthy!`n"); } if ($nut >= 50 && $nut < 100) { output("`0You are feeling `2well-nourished and content`0! You gain some Stamina!`n"); addstamina(50000); } if ($nut >= 100) { output("`0You are feeling `2strong and energetic`0! You gain some Stamina!`n"); addstamina(100000); } if ($fat < 0) { output("`0You are looking `2trim and slender`0! You gain some Stamina!`n"); addstamina(50000); } if ($fat >= 0 && $fat < 20) { output("`0You are looking pleasantly well-fed!`n"); } if ($fat >= 20 && $fat < 50) { output("`0You are looking `4a little bit round!`0 You lose a little Stamina.`n"); removestamina(25000); } if ($fat >= 50 && $fat < 100) { output("`0You are looking `4pretty chunky!`0 You lose some Stamina.`n"); removestamina(50000); } if ($fat >= 100) { output("`0You are looking... well, let's not mince words. `4You're fat. VERY fat. You look like you just ate a schoolbus full of well-fed orphans`0. You lose some Stamina.`n"); removestamina(100000); } } break; case "dragonkill": set_module_pref("nutrition", 0); set_module_pref("fat", 0); set_module_pref("fullness", 0); break; } return $args; }
function meatschool_run() { global $session; page_header("Maiko's Cookery Academy"); switch (httpget('op')) { case "start": if (get_module_pref("meatsmith", "meatsystem") == 0) { //this is the player's first trip to the Meat School output("\"`%Don't worry, it won't feel a thing!`0\"`n`nThe voice comes through confidently - one that's clearly used to carrying across a room full of students. A teacher's voice. You step into the hall.`n`nTwenty or so students sit on slightly rickety-looking chairs inside, facing a raised platform. You barely have time to register the petite, smiling KittyMorph woman before a loud `iBOOM-ch-KA`i draws your attention to the captive bolt pistol in her hand, and the cow-sized, green-furred beast that is at this very moment falling to the floor with a bass-heavy `ithump`i. Several students squirm in their seats.`n`nThe teacher looks in your direction, and gives you a smile as she puts down the bolt pistol and picks up a pair of razor-sharp knives. \"`%A new recruit! I'll bring you up to speed real quick - I'm Maiko, and today we're learning how to cook Bewilderbeest steaks. From scratch! Come in, sit down, the first lesson's free!`0\"`n`nYou nervously make your way to a chair and take a seat. \"`%James, tell me why it's important to begin the bleeding process right away.`0\"`n`nA sick-looking youth stutters a reply. \"S-s-so it doesn't wake up?\"`n`n\"`%No. No, if you've kept your gun looked after and done the stunning properly, it won't wake up from that. The stunning pretty well destroys the forebrain - the animal's alive only in a very clinical sense of the term. In every sense that matters, to you or to it, it's dead. No, we start the bleeding process straight away because the blood pressure increases the longer we leave it, and that can rupture blood vessels, and cause muscular haemorrhages - which just makes the meat spoil faster. Also, when you're out killing monsters in the jungle, if you don't get the meat from them straight away, something's apt to take the carcass the moment you turn your back, be it Midgets or other monsters. So we butcher the monsters the moment they're unconscious, right? Now, watch as I make the cuts. First one, down here - and now we pull that out, and if you want to, you can tie a knot in it. Second one, this way, and then again, and now we reach in and... One more... Aah! There we go. Hold these for me, James. And now - see? Just like that. Can you see, there, at the back? Good. Look here - the meat can sometimes jump around a little bit. Don't be freaked out, it's not still alive. That's just the muscle reacting to the air - it's not used to this much oxygen. See? This bit in my hand is still twitching around, even though it's not attached to anything. I'd like to point out as I'm doing this that it won't always be possible to do it so neatly while you're cleaning the animals that tried to kill you - but just do the best you can. We're only interested in the best cuts, these ones here - the Zombies and Humans will take the other meat, and the Midgets will only take the... well, James, you could probably sell `ithose`i to them. Now, we'll do a couple more over here, and... Um... you there, the new recruit, are you okay? You look a bit, um...`0\"`n`nVarious students turn around to look at you. \"Fine,\" you squeak.`n`n\"`%Jolly good then - come on, up you come, let's see if you can do this bit. You'll soon learn to swim if we chuck you in the deep end, eh?`0\" You gulp, and head up to the platform. Right into the deep end.`n`nAn hour later, Maiko shakes your hand. \"`%That was a very successful first lesson! If you want to gain some experience in field-dressing, cleaning and cooking, I can offer private tuition at ten Requisition per lesson. But to be honest - you're a natural!`0\"`n`nYou're not entirely sure how to take that.`n`n`c`bYou have gained two new skills!`b`nYou are now at level one in Carcass Cleaning and Cooking!`c"); require_once "modules/staminasystem/lib/lib.php"; get_player_action("Cleaning the Carcass"); get_player_action("Cooking"); set_module_pref("meatsmith", 1, "meatsystem"); } else { //lessons require_once "modules/staminasystem/lib/lib.php"; $amber = get_stamina(); if ($amber == 100) { output("Maiko greets you at the door with a wide grin. \"`%Back for some more training, eh? Ten Req per lesson, and I keep the meat. How's that sound?`0\"`n`n`JMaiko, like other teachers in Improbable Island, can help you level up some of your skills. When you pay to train with Maiko, you'll use as much Stamina in performing your chosen actions as normal, but you'll receive two and a half times the experience. Higher levels in Cooking and Carcass Cleaning will make these actions cost fewer Stamina points.`n`n`0Will you train with Maiko?`n`n"); addnav("Train with Maiko"); if ($session['user']['gold'] >= 10) { $cleancost = stamina_getdisplaycost("Cleaning the Carcass"); addnav(array("Pay 10 Req for a Carcass Cleaning lesson (`Q%s%%`0)", $cleancost), "runmodule.php?module=meatschool&op=train&train=clean"); $cookcost = stamina_getdisplaycost("Cooking"); addnav(array("Pay 10 Req for a Cookery lesson (`Q%s%%`0)", $cookcost), "runmodule.php?module=meatschool&op=train&train=cook"); } else { addnav("You don't have enough money. No lessons for you.", ""); } } else { output("Maiko greets you at the door with a wide grin. \"`%Back for some more training, eh? Well, you look half-asleep to me. Training won't do you any good at all if you're too tired to take it in. Go and get some rest, or a coffee or something, then we'll talk.`0\" She shoos you out of the door."); } } addnav("Leave this place"); addnav("Return to Kittania", "village.php"); break; case "train": if (is_module_active("medals")) { require_once "modules/medals.php"; medals_award_medal("maiko_train", "Maiko's Meat School", "This player took lessons at Maiko's Meat School!", "medal_maiko.png"); } $session['user']['gold'] -= 10; require_once "modules/staminasystem/lib/lib.php"; switch (httpget('train')) { case "clean": apply_stamina_buff('maikoclean', array("name" => "Maiko\\'s Training", "action" => "Cleaning the Carcass", "costmod" => 1, "expmod" => 2.5, "rounds" => 1, "roundmsg" => "", "wearoffmsg" => "")); output("Maiko shows you a big smile. \"`%Another butchery lesson! Great stuff. Let's get started!`0\"`n`nMaiko grabs her knives and captive bolt pistol, you don your gloves, and the two of you spend the next little while up to your elbows in warm, still-twitching muscle. Under Maiko's careful watch, her gentle hands occasionally guiding yours to make a difficult cut, you learn one or two things that you didn't know before."); $return = process_action("Cleaning the Carcass"); output("You receive %s experience in Cleaning the Carcass.`n`n", $return['exp_earned']); if ($return['lvlinfo']['levelledup'] == true) { output("`c`b`0You gained a level in Cleaning Carcasses! You are now level %s! This action will cost fewer Stamina points now, so you can butcher more creatures each day!`b`c`n", $return['lvlinfo']['newlvl']); } break; case "cook": apply_stamina_buff('maikocook', array("name" => "Maiko\\'s Training", "action" => "Cooking", "costmod" => 1, "expmod" => 2.5, "rounds" => 1, "roundmsg" => "", "wearoffmsg" => "")); output("Maiko shows you a big smile. \"`%Another cookery lesson! Great stuff. Let's get started!`0\"`n`nMaiko grabs her pans and some ingredients, and you don the 'hilarious' apron Maiko has so thoughtfully provided. Under Maiko's helpful guidance, you learn one or two things that you didn't know before."); $return = process_action("Cooking"); output("You receive %s experience in Cooking.`n`n", $return['exp_earned']); if ($return['lvlinfo']['levelledup'] == true) { output("`n`c`b`0You gained a level in Cooking! You are now level %s! This action will cost fewer Stamina points now, so you can cook more tasty meals each day!`b`c`n", $return['lvlinfo']['newlvl']); } break; } $amber = get_stamina(); if ($amber == 100) { addnav("More Training"); if ($session['user']['gold'] >= 10) { $cleancost = stamina_getdisplaycost("Cleaning the Carcass"); addnav(array("Pay 10 Req for a Carcass Cleaning lesson (`Q%s%%`0)", $cleancost), "runmodule.php?module=meatschool&op=train&train=clean"); $cookcost = stamina_getdisplaycost("Cooking"); addnav(array("Pay 10 Req for a Cookery lesson (`Q%s%%`0)", $cookcost), "runmodule.php?module=meatschool&op=train&train=cook"); } else { addnav("You don't have enough money. No more lessons for you.", ""); } } else { output("Maiko shows you a grin. \"`%Well, that was a lot of fun. But I can see you're getting tired - no point in training any more today, I'm afraid.`0\" She shoos you out of the door."); } addnav("Leave this place"); addnav("Return to Kittania", "village.php"); break; } page_footer(); return true; }
function staminacorecombat_applystaminabuff() { //increments and applies the Exhaustion Penalty global $session; $amber = get_stamina(); if ($amber < 100) { //Gives a proportionate debuff from 1 to 0.2, at 2 decimal places each time $buffvalue = round(($amber / 100 * 80 + 20) / 100, 2); if ($buffvalue < 1) { $buffmsg = "`0You're getting tired..."; } if ($buffvalue < 0.8) { $buffmsg = "`4You're getting `ivery`i tired...`0"; } if ($buffvalue < 0.6) { $buffmsg = "`\$You're getting `bexhausted!`b`0"; } if ($buffvalue < 0.3) { $buffmsg = "`\$You're getting `bdangerously exhausted!`b`0"; } apply_buff('stamina-corecombat-exhaustion', array("name" => "Exhaustion", "atkmod" => $buffvalue, "defmod" => $buffvalue, "rounds" => -1, "roundmsg" => $buffmsg, "schema" => "module-staminacorecombat")); } else { strip_buff('stamina-corecombat-exhaustion'); } $red = get_stamina(0); if ($red < 100) { $death = e_rand(0, 100); if ($death > $red) { output("`\$Vision blurring, you succumb to the effects of exhaustion. You take a step forward to strike your enemy, but instead trip over your own feet.`nAs the carpet of leaves and twigs drifts lazily up to meet your face, you close your eyes and halfheartedly reach out your hands to cushion the blow - but they sail through the ground as if it were made out of clouds.`nYou fall.`nUnconsciousness. How you'd missed it.`0"); $session['user']['hitpoints'] = 0; } } return true; }
function items_world_map_gathering_run() { global $session; page_header("Gathering Materials"); $type = httpget('mat'); $item = httpget('item'); require_once "modules/staminasystem/lib/lib.php"; if ($type == "wood") { $lv = process_action("Logging"); $stam = get_stamina(); $rstam = get_stamina(0); $failchance = e_rand(0, 99); if ($failchance < $stam) { give_item("wood"); use_item($item, "logging"); output("`0You hack away until you have what can only be described as a bloody enormous log, suitable as a part of a quaint little cabin. It couldn't possibly fit into your backpack, but you stuff it in anyway.`n"); if ($lv['lvlinfo']['levelledup'] == true) { output("`n`c`b`0You gained a level in Logging! You are now level %s! This action will cost fewer Stamina points now, so you can lumberjack more lumber each day!`b`c`n", $lv['lvlinfo']['newlvl']); } } else { if ($failchance < $rstam) { output("You hack away until you have what can only be described as a whole shitload of matchsticks. The wood just splintered into barely more than pulp under your clumsy, half-asleep paws.`n`nMaybe it'd be a good idea to rest a bit before you try this again.`n`n"); } else { $fail = 1; output("You hack away at the tree, your half-asleep mind blissfully ignorant of its wild swaying. Ignorant, that is, until it falls on you.`n`nYou wake up, naturally, on the FailBoat.`n`n"); } } } else { if ($type == "stone") { $lv = process_action("Stonecutting"); $stam = get_stamina(); $rstam = get_stamina(0); $failchance = e_rand(0, 99); if ($failchance < $stam) { $success = 1; give_item("stone"); use_item($item, "stonecutting"); output("`0You hack away until you have what can only be described as a huge-ass lump of stone, very heavy and cumbersome. For some reason your backpack seems like a really good place to put it.`n"); if ($lv['lvlinfo']['levelledup'] == true) { output("`n`c`b`0You gained a level in Stonecutting! You are now level %s! This action will cost fewer Stamina points now, so you can break more rocks each day!`b`c`n", $lv['lvlinfo']['newlvl']); } } else { if ($failchance < $rstam) { output("You hack away until you have what can only be described as a whole shitload of gravel. The rock just smashed into splinters under your clumsy, half-asleep paws.`n`nMaybe it'd be a good idea to rest a bit before you try this again.`n`n"); } else { $fail = 1; output("You hack away at the rock, blissfully unaware that another, larger rock is being gently dislodged by your half-asleep ministrations. Another, larger rock that happens to be balanced precariously on an outcrop just above your head.`n`nYou wake up, naturally, on the FailBoat.`n`n"); } } } } if (!$fail) { items_world_map_gathering_showgather(); addnav("Other"); addnav("Show Inventory", "inventory.php?items_context=worldmap"); addnav("Return to the World Map", "runmodule.php?module=worldmapen&op=continue"); } else { $session['user']['hitpoints'] = 0; $session['user']['gold'] = 0; $session['user']['alive'] = 0; //set the user's location to the last place on the map they touched $session['user']['location'] = get_module_pref("lastCity", "worldmapen"); addnav("Guess what happens now?"); addnav("That's right.", "shades.php"); } page_footer(); }
function worldmapen_encounter($x, $y, $z = 1) { global $session; $terrain = worldmapen_getTerrain($x, $y, $z); $id = $session['user']['hashorse']; // debug("Worldmap lib.php is debugging base terrain encounter rate"); // debug($terrain['encounter']); if ($id != 0) { switch ($terrain['type']) { case "Plains": $terrain['encounter'] = $terrain['encounter'] * get_module_objpref("mounts", $id, "encounterPlains"); break; case "Forest": $terrain['encounter'] = $terrain['encounter'] * get_module_objpref("mounts", $id, "encounterForest"); break; case "River": $terrain['encounter'] = $terrain['encounter'] * get_module_objpref("mounts", $id, "encounterRiver"); break; case "Ocean": $terrain['encounter'] = $terrain['encounter'] * get_module_objpref("mounts", $id, "encounterOcean"); break; case "Desert": $terrain['encounter'] = $terrain['encounter'] * get_module_objpref("mounts", $id, "encounterDesert"); break; case "Swamp": $terrain['encounter'] = $terrain['encounter'] * get_module_objpref("mounts", $id, "encounterSwamp"); break; case "Mount": $terrain['encounter'] = $terrain['encounter'] * get_module_objpref("mounts", $id, "encounterMount"); break; case "Snow": $terrain['encounter'] = $terrain['encounter'] * get_module_objpref("mounts", $id, "encounterSnow"); break; case "Earth": $terrain['encounter'] = $terrain['encounter'] * get_module_objpref("mounts", $id, "encounterEarth"); break; case "Air": $terrain['encounter'] = $terrain['encounter'] * get_module_objpref("mounts", $id, "encounterAir"); break; } } //Interaction with Stamina system - increases encounter rate by 1% for every percentage point of player's Amber stamina used if (get_module_setting("usestamina") == 1) { require_once 'modules/staminasystem/lib/lib.php'; $amber = get_stamina(); if ($amber < 100) { output("`4You are getting tired`0. Monsters have a tendency to swarm towards contestants who look like they're half-asleep. You might want to consider setting up camp, or doing something to raise your Stamina.`n"); } $add = 100 - $amber; $terrain['encounter'] += $add; } return $terrain['encounter']; }
function get_gladiators($id, $mode) { global $type, $k, $site_path, $serialized, $lang, $sort; if ($mode == 2) { return true; } $file = fopen($site_path . "files/rst/{$id}.rst", "r"); $str = fread($file, filesize($site_path . "files/rst/{$id}.rst")); $str = substr($str, 39); fclose($file); $r = unserialize($str); $rst = $r; $serialized = $r[Gladiators]; foreach ($r[Gladiators] as $k => $v) { $serialized[$k][GladiatorID] = $k; $status = $r[Gladiators][$k][StatusID]; if (!$status) { $status = 1; } if ($status == 1) { $serialized[$k][Status] = "–аб"; } elseif ($status == 2) { $serialized[$k][Status] = "Ќаемник"; } elseif ($status == 3) { $serialized[$k][Status] = "–удиарий"; } //физа от времени последнего бо¤ и настройки $serialized[$k][Stamina] = get_stamina($serialized[$k][Stamina], $serialized[$k][PercentTrain], $r[Date]); $serialized[$k][Morale] = get_morale($serialized[$k][Morale], $r[Date]); $serialized[$k][Injury] = get_injury($serialized[$k][Stamina], $r[Date]); $serialized[$k][Gladiator] = "<a href=/gladiators/{$k}>" . $r[Gladiators][$k][Name] . " [" . $serialized[$k][Level] . "]" . "</a>"; if ($type == "gladiators/roster") { $serialized[$k][Gladiator] .= " <img src=/images/status/" . $status . ".gif title=\"" . $serialized[$k][Status] . "\" align=absmiddle width=15px height=15px>"; } if ($serialized[$k][Injury] > 0 && $type == "gladiators/roster") { $serialized[$k][Gladiator] = $serialized[$k][Gladiator] . " <img src=/images/icons/inj.gif width=11px height=11px title=“равма> <b>" . $serialized[$k][Injury] . "</b>"; } $serialized[$k][Gladiator] = "<nobr>" . $serialized[$k][Gladiator] . "</nobr>"; $serialized[$k][Salary] = round($serialized[$k][Price] / 10); if ($serialized[$k][Stamina] < 0) { $serialized[$k][Hits] = 0; } else { $serialized[$k][Hits] = round($serialized[$k][Stamina] * $serialized[$k][Vit] / 10); } $serialized[$k][FullHits] = round(100 * $serialized[$k][Vit] / 10); $serialized[$k][Health] = "<b>" . $serialized[$k][Hits] . "</b> (" . $serialized[$k][FullHits] . ")"; $p = 100 * $serialized[$k][Hits] / $serialized[$k][FullHits]; if ($p <= 0) { $b = 6; } elseif ($p <= 40) { $b = 5; } elseif ($p > 40 && $p <= 60) { $b = 4; } elseif ($p > 60 && $p <= 80) { $b = 3; } elseif ($p > 80 && $p <= 90) { $b = 2; } elseif ($p > 90 && $p <= 100) { $b = 1; } $serialized[$k][bar] = $b; $c = $serialized[$k][CountryID]; $q = select("select Name_{$lang} from ut_countries where CountryID='{$c}'"); $serialized[$k][Country] = $q[0]; $c = $serialized[$k][TypeID]; $q = select("select Name_{$lang} from ut_gladiator_types where TypeID='{$c}'"); $serialized[$k][TypeName] = $q[0]; if ($mode == 1) { $serialized[$k][NewPercentTrain] = $serialized[$k][PercentTrain]; if (!strlen($serialized[$k][NewPercentTrain])) { $serialized[$k][NewPercentTrain] = 0; $serialized[$k][PercentTrain] = 0; } $trained = expgained($r); if ($trained) { $serialized[$k][Exp] += floor($trained); } if (!$serialized[$k][Trainer]) { $serialized[$k][ExpRaise] = '</b>'; if ($serialized[$k][TypeID] == 8) { $num = 3; } elseif ($serialized[$k][TypeID] > 8) { $num = 5; } elseif ($serialized[$k][TypeID] < 8) { $num = 1; } $serialized[$k][ExpRaise] .= "<a href=/xml/residence/staff.php?id={$num}>"; $serialized[$k][ExpRaise] .= 'нан¤ть тренера</a>'; } $exp = $serialized[$k][Exp]; $q = select("select Points from ut_exp where Points>'{$exp}' order by Level asc limit 0,1"); $nextlevel = "{$q['0']}"; //print "$exp - $nextlevel<br>"; } $serialized[$k][ShowExp] = $serialized[$k][Exp]; $q = select("select Level from ut_exp where Points<='{$exp}' order by Level desc limit 0,1"); if ($q[Level] > $serialized[$k][Level]) { $serialized[$k][ShowExp] = "<a href=/xml/gladiators/level.php?id={$k}><u><b>" . floor($serialized[$k][ShowExp]) . "</b></u></a>"; } else { $serialized[$k][ShowExp] = "<b>" . floor($serialized[$k][ShowExp]) . "</b>"; } $serialized[$k][ShowExp] .= " (" . $nextlevel . ")"; } if ($sort) { if (strstr($sort, " ")) { $srt = substr($sort, 0, strpos($sort, " ")); } else { $srt = $sort; } if (strstr($sort, " desc")) { usort($serialized, array(new CompareByDesc(), $srt)); } else { usort($serialized, array(new CompareBy(), $srt)); } } return $serialized; }
function insultschool_run() { global $session; page_header("Cuthbert's Academy of Lingual Defence"); switch (httpget('op')) { case "start": if (!get_module_pref("able", "insults")) { //this is the player's first trip to the Insults Academy //ronsengi output("\"`qAh. Not seen you here before.`0\"`n`nA three-eyed, broad-mouthed Mutant sits behind a desk, wearing a loose-fitting black garment reminiscent of a kimono. \"`qMy name's Cuthbert, and this is my Academy of Lingual Defence.`0\"`n`n\"`#Lingual Defence?`0\" you ask.`n`n\"`qLingual Defence,`0\" replies Cuthbert proudly. \"`qA perfect supplement to your preferred martial art, perfected over twenty years by my good self.`0\"`n`n\"`#I see.`0\" You look around the room. \"`#I don't see any weaponry?`0\"`n`n\"`qNot `iphysical`i weaponry, no. The art of Lingual Defence, or Ronsen-Kiai, doesn't require any equipment except for every now and then in training.`0\" He grins. \"`qThat's not a `iprecise`i translation, by the way, but I find throwing a bit of Japanese in there helps with the marketing.`0\"`n`nYou nod, looking around at the empty room and the rather sparse student list hanging on one wall. You decide to indulge the guy - it seems he could use the business. \"`#Can you show me a bit of this Ronsen-Kiai?`0\"`n`nCuthbert shows you an excited grin. \"`qAbsolutely! Here, take this.`0\" He reaches below his desk and hands you a heavy wooden axe handle, before moving to the center of the room. \"`qNow come and attack me with that.`0\" He grins. \"`qDon't be shy, now. I'll tell you when to stop.`0\"`n`nYou shrug, heft the axe handle, and rush towards him, bringing your weapon down in a crushing arc onto his head, which isn't there. The Mutant has stepped to the inside, and now stands close enough for you to feel his breath.`n`n\"`qFUCKWIT!`0\" roars the Mutant as you swing the axe handle towards his sides. \"`qI've seen `iMOLD`i-`0\" the tip of the axe handle sails harmlessly past his stomach - \"`q...swing an axe handle better than that! Holy shit you're slow!`0\" The Mutant takes a step back and another breath, and you flick the axe handle around so that you can charge him with the tip. \"`qAnd FAT! Jesus Christ, your arse looks like two Volkswagens parked side-by-side!`0\" the Mutant steps back and away from your axe handle, then takes a very rapid step first towards and then past you, your axe handle chasing but not quite catching his thighs. You switch into opposite stance, to see the Mutant giving you the finger. \"`qAnd stupid! Damn, you're denser than that axe handle!`0\" Man, that's distracting. You piston your leading leg upwards, hoping to catch the Mutant in the chest. The Mutant catches your foot and sniffs. \"`qAnd the stench of your feet could kill a concrete elephant at twenty paces!`0\" Enraged, you slam your leading leg downwards while pouncing from your back leg, using the Mutant's arms like a set of stairs so that you can kick his stupid mean face like a football.`n`nYou land poorly.`n`nThe Mutant stands over you. \"`qYou imbecilic, mewling, malodorous pervert. You feeble-minded, cloth-eared, illigitimate buffoon. You twisted, disgusting, Thatcher-licking dullard. Your father f***s sheep and your mother says \"Baaa.\" You're a disgrace. An obscenity. An embarrassment.\"`n`n\"`#Stop!`0\" you cry. \"`#Why're you saying these things?`0\"`n`nThe Mutant leans down and helps you to your feet. \"`qBecause they distract you,`0\" he says kindly. \"`qThey get you so riled up that you try silly maneouvers like the one that just ended with you winded on the floor. And even though I can tell that you're a better fighter than me, and would have stoved my head in under different circumstances, I was still able to get away with not being hit because a part of you was paying attention to what I was saying.`0\"`n`nYou blink. \"`#`iThat's`i Ronsen-Kai? Spouting a load of insults while fighting?`0\"`n`nThe Mutant nods, smiling. \"`qTwenty cigarettes for your first lesson. You'll learn the two starter techniques, Coarse and Confusing. Then when you can prove to me that you're ready, I'll teach you the third technique - Classy, or as some call it, \"Shakespearean.\" So. Are you interested in learning how to fight with your tongue as well as your fists and feet?`0\"`n`nWell? `iAre`i you?"); addnav("Learn a new combat technique for 20 cigarettes?"); if ($session['user']['gems'] >= 20) { addnav("Hell yes!", "runmodule.php?module=insultschool&op=learnbasic"); } else { addnav("No, because you don't have 20 cigarettes.", "village.php"); } } else { //lessons require_once "modules/staminasystem/lib/lib.php"; $amber = get_stamina(); if ($amber == 100) { output("Cuthbert greets you with a firm handshake. \"`qHello again! Back for some more training, eh? Well, you've completed the basic course, so I can give you refresher lessons at 25 Requisition each.`0\"`n`n"); $coarse = get_player_action("Insults - Coarse"); $confusing = get_player_action("Insults - Confusing"); $level = $coarse['lvl'] + $confusing['lvl']; if ($level > 20) { if (!get_module_pref("ableclassy", "insults")) { output("Cuthbert pauses for a moment and looks you up and down. \"`qYou know,`0\" he says, \"`qI think you might be ready to learn some Classy insults. It'll be another 20 cigarettes for the basic Classy course, if you're interested.`0\"`n`n"); addnav("Train with Cuthbert"); if ($session['user']['gems'] >= 20) { addnav("Pay 20 Cigarettes to learn the Classy Insults action", "runmodule.php?module=insultschool&op=learnclassy"); } } } output("`JCuthbert, like other teachers in Improbable Island, can help you level up some of your skills. When you pay to train with Cuthbert, you'll use as much Stamina in performing your chosen actions as normal, but you'll receive two and a half times the experience. Higher levels in any given Stamina action will make that action cost fewer Stamina points. Higher levels in Insults skills will also improve your chances of casting successful Insults, and reduce the chances of fumbling.`n`n`0Will you train with Cuthbert?`n`n"); addnav("Train with Cuthbert"); if ($session['user']['gold'] >= 25) { $coarsecost = stamina_getdisplaycost("Insults - Coarse"); addnav(array("Pay 25 Req for a lesson in Coarse Insults (`Q%s%%`0)", $coarsecost), "runmodule.php?module=insultschool&op=train&train=coarse"); $confusingcost = stamina_getdisplaycost("Insults - Confusing"); addnav(array("Pay 25 Req for a lesson in Confusing Insults (`Q%s%%`0)", $confusingcost), "runmodule.php?module=insultschool&op=train&train=confusing"); if (get_module_pref("ableclassy", "insults")) { $classycost = stamina_getdisplaycost("Insults - Classy"); addnav(array("Pay 25 Req for a lesson in Classy Insults (`Q%s%%`0)", $classycost), "runmodule.php?module=insultschool&op=train&train=classy"); } } else { addnav("You don't have enough Requisition to improve your existing Insults skills.", ""); } } else { output("Cuthbert greets you with a firm handshake. He grins. \"`qI know what you're thinking - you want more lessons, huh? Well, you look half-asleep to me. This isn't something you should try without a good night's rest. Come see me tomorrow.`0\""); } } addnav("Leave this place"); addnav("Return to Pleasantville", "village.php"); break; case "train": $session['user']['gold'] -= 25; if (is_module_active("medals")) { require_once "modules/medals.php"; medals_award_medal("cuthbert_train", "Cuthbert's Academy of Lingual Defence", "This player took lessons at Cuthbert's Academy of Lingual Defence!", "medal_cuthbert.png"); } require_once "modules/staminasystem/lib/lib.php"; switch (httpget('train')) { case "coarse": apply_stamina_buff('traincoarse', array("name" => "Cuthbert's Training", "action" => "Insults - Coarse", "costmod" => 1, "expmod" => 2.5, "rounds" => 1, "roundmsg" => "", "wearoffmsg" => "")); require_once "modules/insults.php"; $i1 = insults_coarse(); $i2 = insults_coarse(); $i3 = insults_coarse(); $i4 = insults_coarse(); $i5 = insults_coarse(); output("Cuthbert shows you a big smile. \"`qIt's good to train with you again. Coarse insults it is. Let's get started!`0\"`n`nOutside the hut, for the next half an hour or so, people stop to listen to the bizzarre and filthy profanities spouted from within.`n`n"); output("`i\"`#%s!`0\"`n`n\"`q%s!`0\"`n`n\"`#%s!`0\"`n`n\"`q%s!`0\"`n`n\"`#%s!`0\"`n`n\"`qVery good!`0\"", $i1, $i2, $i3, $i4, $i5); $return = process_action("Insults - Coarse"); output("You receive %s experience in Coarse Insults.`n`n", $return['exp_earned']); if ($return['lvlinfo']['levelledup'] == true) { output("`c`b`0You gained a level in Coarse Insults! You are now level %s! This action will cost fewer Stamina points now, and you have a higher chance of casting a successful Insult!`b`c`n", $return['lvlinfo']['newlvl']); } break; case "confusing": apply_stamina_buff('trainconfusing', array("name" => "Cuthbert's Training", "action" => "Insults - Confusing", "costmod" => 1, "expmod" => 2.5, "rounds" => 1, "roundmsg" => "", "wearoffmsg" => "")); require_once "modules/insults.php"; $i1 = insults_confusing(); $i2 = insults_confusing(); $i3 = insults_confusing(); $i4 = insults_confusing(); $i5 = insults_confusing(); output("Cuthbert shows you a big smile. \"`qIt's good to train with you again. Confusing insults it is. Let's get started!`0\"`n`nOutside the hut, for the next half an hour or so, people stop to listen to the bizzarre and surreal propositions spouted from within.`n`n"); output("`i\"`#%s!`0\"`n`n\"`q%s!`0\"`n`n\"`#%s!`0\"`n`n\"`q%s!`0\"`n`n\"`#%s!`0\"`n`n\"`qVery good!`0\"", $i1, $i2, $i3, $i4, $i5); $return = process_action("Insults - Confusing"); output("You receive %s experience in Confusing Insults.`n`n", $return['exp_earned']); if ($return['lvlinfo']['levelledup'] == true) { output("`c`b`0You gained a level in Confusing Insults! You are now level %s! This action will cost fewer Stamina points now, and you have a higher chance of casting a successful Insult!`b`c`n", $return['lvlinfo']['newlvl']); } break; case "classy": apply_stamina_buff('trainclassy', array("name" => "Cuthbert's Training", "action" => "Insults - Classy", "costmod" => 1, "expmod" => 2.5, "rounds" => 1, "roundmsg" => "", "wearoffmsg" => "")); require_once "modules/insults.php"; $i1 = insults_classy(); $i2 = insults_classy(); $i3 = insults_classy(); $i4 = insults_classy(); $i5 = insults_classy(); output("Cuthbert shows you a big smile. \"`qIt's good to train with you again. Classy insults it is. Let's get started!`0\"`n`nOutside the hut, for the next half an hour or so, people stop to listen to the witty and scathing insults spouted from within.`n`n"); output("`i\"`#You %s!`0\"`n`n\"`qI retort that you are a %s!`0\"`n`n\"`#I've never seen such a %s!`0\"`n`n\"`qIt is a matter of public record that you are a %s!`0\"`n`n\"`#And proud of it! You sir, on the other hand, are a %s!`0\"`n`n\"`qVery good!`0\"`n`n`i", $i1, $i2, $i3, $i4, $i5); $return = process_action("Insults - Classy"); output("You receive %s experience in Classy Insults.`n`n", $return['exp_earned']); if ($return['lvlinfo']['levelledup'] == true) { output("`c`b`0You gained a level in Classy Insults! You are now level %s! This action will cost fewer Stamina points now, and you have a higher chance of casting a successful Insult!`b`c`n", $return['lvlinfo']['newlvl']); } break; } $amber = get_stamina(); if ($amber == 100) { addnav("More Training"); if ($session['user']['gold'] >= 25) { $coarsecost = stamina_getdisplaycost("Insults - Coarse"); addnav(array("Pay 25 Req for a lesson in Coarse Insults (`Q%s%%`0)", $coarsecost), "runmodule.php?module=insultschool&op=train&train=coarse"); $confusingcost = stamina_getdisplaycost("Insults - Confusing"); addnav(array("Pay 25 Req for a lesson in Confusing Insults (`Q%s%%`0)", $confusingcost), "runmodule.php?module=insultschool&op=train&train=confusing"); if (get_module_pref("ableclassy", "insults")) { $classycost = stamina_getdisplaycost("Insults - Classy"); addnav(array("Pay 25 Req for a lesson in Classy Insults (`Q%s%%`0)", $classycost), "runmodule.php?module=insultschool&op=train&train=classy"); } } else { addnav("You don't have enough Requisition to improve your existing Insults skills.", ""); } } else { output("Cuthbert shows you a grin. \"`qWell, that was a lot of fun. But I can see you're getting tired - no point in training any more today, I'm afraid.`0\""); } addnav("Leave this place"); addnav("Return to Pleasantville", "village.php"); break; case "learnbasic": $session['user']['gems'] -= 20; output("\"`qExcellent! Let's get started. There are three classes of Insults - Coarse, Confusing, and Classy. Coarse insults are the most vulgar sort, Confusing tend to be surreal and off-putting, and Classy insults are more formal and refined. Each type has different effects upon the foe, and different difficulties. Obviously, you'll get better at each one with time - I'm only going to teach you the Coarse and Confusing types today, and you can come back to learn the Classy insults when I think you're ready.`0\"`n`n\"`qCoarse insults are quite predictable. They usually have only minor effects upon the enemy, but if they backfire the damage won't be too great either. Obviously, once in a while you'll either land a critical insult or suffer a catastrophic fumble, but for the most part you'll find this happens more rarely with Coarse insults.`0\"`n`n\"`qConfusing insults are a little more erratic - your chances of fumbling or scoring a critical emotional hit are increased when compared with Coarse insults. Similarly, the effects are slightly more potent.`0\"`n`n\"`qClassy insults go even further than Confusing insults, with potentially devastating effects - but, of course, those effects can backfire and just as easily throw `iyou`i off-kilter.`0\"`n`n\"`qRemember, a poorly-cast insult can backfire against you, so use these techniques carefully.`0\"`n`n\"`qWhen you first start using Ronsen-Kiai, you'll probably end up doing yourself about as much harm as good. But don't be discouraged - as you gain more experience in each Insult type, you'll get the hang of it. Now let's get started.`0\"`n`nFor the next few hours, passers-by are shocked by the profanities, obscene suggestions, bizarre propositions and scathing retorts emanating from the Academy. By the time Cuthbert shakes your hand and sends you out into the world, you're sweating, red-faced and sore-throated - but you feel a sense of true accomplishment.`n`n`c`bYou have gained two new skills!`b`nYou are now qualified to cast Coarse and Confusing Insults against your foes!`c"); set_module_pref("able", 1, "insults"); addnav("Leave this place"); addnav("Return to Pleasantville", "village.php"); break; case "learnclassy": $session['user']['gems'] -= 20; output("\"`qExcellent! Let's get started. Remember, Classy insults are more unpredictable than others, but their effects are greater, so use them carefully.`0\"For the next few hours, passers-by are shocked by the bizarre, Shakespearean language emanating from the Academy. By the time Cuthbert shakes your hand and sends you out into the world, you're sweating, red-faced and sore-throated - but you feel a sense of true accomplishment.`n`n`c`bYou have gained a new skill!`b`nYou are now qualified to cast Classy Insults against your foes!`c"); set_module_pref("ableclassy", 1, "insults"); addnav("Leave this place"); addnav("Return to Pleasantville", "village.php"); break; } page_footer(); return true; }
<?php $make = httpget('make'); $playerscrap = scrapbots_get_player_scrap(); require_once "modules/staminasystem/lib/lib.php"; $stamina = get_stamina(); $failchance = e_rand(1, 100); if ($failchance <= $stamina) { output("`4You're getting tired.`0 Tired people tend to be accident-prone. Just sayin'.`n"); } if ($failchance > $stamina) { output("`4`c`bDisaster!`b`c`0`n"); switch ($make) { case "axle": output("`\$You grind and buff away at the Rusted Shaft until you accidentally slice it into two useless halves. You swear, and toss them into the Scrap pile."); $playerscrap['data']['normalitems'][0] -= 1; $metalwork = process_action("Metalworking"); break; case "steelplate": output("`\$You grind and buff away at the Rusted Steel Plate until the surface is devoid of rust - but completely ruined by your clumsy, exhausted ministrations. You toss it back into the scrap pile, cursing at yourself."); $playerscrap['data']['normalitems'][1] -= 1; $metalwork = process_action("Metalworking"); break; case "largegirderfromrusted": output("`\$You grind and buff away at the Rusted Large Girder until all the rust is gone, leaving only nice polished steel. You turn away for a moment to put away your grinder, and when you turn back, it's gone. Perhaps it was stolen by Midgets, or perhaps you're so tired you imagined the whole thing."); $playerscrap['data']['normalitems'][2] -= 1; $metalwork = process_action("Metalworking"); break; case "motherboard": output("`\$You hook up the Broken Motherboard to the testing console, and after a little bit of tinkering with your soldering iron and multimeter, it's even more broken than it was before you started. You toss it back into the Scrap pile."); $playerscrap['data']['normalitems'][3] -= 1;
function onslaught_run() { global $session, $battle, $enemies; global $companions, $companion, $newcompanions; debug($session['user']['location']); switch (httpget('op')) { case "lookaround": page_header("What's the situation?"); $rawnum = onslaught_nummonsters(); require_once "lib/dialogue.php"; $vague = vagueify($rawnum); output("Taking a moment during a lull in the fighting to look around, you'd say as a rough estimate that there are between %s and %s monsters rampaging through the Outpost.`n`n", $vague['low'], $vague['high']); $playercount = 0; output("Looking around you, you can see the following players engaged in battle alongside you:`n"); $sql = "SELECT name,acctid,level FROM " . db_prefix("accounts") . " WHERE locked=0 AND loggedin=1 AND alive=1 AND location='" . $session['user']['location'] . "' AND laston>'" . date("Y-m-d H:i:s", strtotime("-" . getsetting("LOGINTIMEOUT", 900) . " seconds")) . "' ORDER BY level DESC"; $result = db_query($sql); while ($row = db_fetch_assoc($result)) { $playercount++; output("`0%s`0`n", $row['name']); } if (!$playercount) { output("`bNobody!`b You're fighting all on your lonesome!`n`n"); } else { output_notl("`n"); } $def = onslaught_checkwalls(); output("You take a quick glance at the walls, and see they've got %s hitpoints, whatever the hell a \"hitpoint\" is.`n`n", $def); $breakchance = e_rand(0, 100); if ($breakchance > 50) { addnav("What will you do?"); addnav("Reinforce the defences", "runmodule.php?module=onslaught&op=reinforce"); addnav("Get back into the fight", "runmodule.php?module=onslaught&op=start&nodesc=1"); addnav("Run outside and let the Outpost fend for itself", "runmodule.php?module=onslaught&op=runmap"); } else { addnav("And here comes another monster!"); addnav("Fight!", "runmodule.php?module=onslaught&op=continue&nodesc=1"); } break; case "reinforce": page_header("Outpost Walls"); $lv = onslaught_checkmonsters(); $num = onslaught_nummonsters(); $def = onslaught_checkwalls(); output("`0You take a look at the Outpost walls. Fortunately there are some lengths of timber, a hammer, and some nails sat conveniently next to a portion that's looking a little worse for wear.`n`nThis Outpost's hitpoints: `b%s`b`n`n", number_format($def)); $stopchance = e_rand(0, 100); if ($lv > 100 && $def < $num && $stopchance > 80) { output("Before you have a chance to pick up the hammer, you hear the sound of approaching thunderous footsteps from behind you! You whirl around, dropping the hammer and drawing your weapon, to see a slavering beast bearing down upon you!`n`n"); addnav("Oh dear..."); addnav("Fight!", "runmodule.php?module=onslaught&op=start&nodesc=1"); } else { addnav("What will you do?"); require_once "modules/staminasystem/lib/lib.php"; $cost = stamina_getdisplaycost("Reinforcement"); addnav(array("Reinforce the defences (`Q%s%%`0)", $cost), "runmodule.php?module=onslaught&op=reinforceconfirm"); addnav("Return to the Outpost", "village.php"); } break; case "reinforceconfirm": $iterations = httpget('iterations'); if (!$iterations) { $iterations = 1; } page_header("Outpost Walls"); $lv = onslaught_checkmonsters(); $num = onslaught_nummonsters(); output("`0You pick up the hammer and nails, and set about reinforcing the walls with new wood.`n`n"); require_once "modules/staminasystem/lib/lib.php"; for ($i = 0; $i < $iterations; $i++) { $def = onslaught_checkwalls(); $stopchance = e_rand(0, 100); if ($lv > 100 && $def < $num && $stopchance > 80) { output("Before you have a chance to pound a single nail, you hear the sound of approaching thunderous footsteps from behind you! You whirl around, dropping the hammer and drawing your weapon, to see a slavering beast bearing down upon you!`n`n"); addnav("Oh dear..."); addnav("Fight!", "runmodule.php?module=onslaught&op=start&nodesc=1"); $nomore = 1; break; } else { $act = process_action("Reinforcement"); $actinfo = get_player_action("Reinforcement"); $actlvl = $actinfo['lvl']; if ($act['lvlinfo']['levelledup'] == true) { output("`n`c`b`0You gained a level in Reinforcement! You are now level %s! This action will cost fewer Stamina points now, so reinforcing Outposts will tire you out a little less.`b`c`n", $act['lvlinfo']['newlvl']); } $stamina = get_stamina(); $failchance = e_rand(1, 100); if ($failchance > $stamina) { output("`4`c`bDisaster!`b`c`0`n"); $red = get_stamina(0); $death = e_rand(0, 100); if ($death > $red) { output("`\$Your exhaustion makes itself known - the hammer rebounds rather spectacularly and hits you square in the forehead, knocking you out cold. The head injury causes you to lose 10% of your experience, and all your Requisition is stolen by opportunistic Midgets.`n`n`0"); $session['user']['hitpoints'] = 0; $session['user']['experience'] = round($session['user']['experience'] * 0.9); $session['user']['gold'] = 0; addnav("It's FailBoat time!"); addnav("Well, damn.", "shades.php"); $nomore = 1; break; } else { output("You're so exhausted that you make a right pig's ear of the job!`n`nThe fresh plank hangs for a second on one lonely nail before falling off. What a waste of time!`n`n"); } } else { $definc = e_rand($actlvl * 0.8, $actlvl * 1.2); if ($definc < 2) { $definc = 2; } $newdef = $def + $definc; output("You hammer the board to the walls, reinforcing them quite nicely and adding %s hitpoints to this Outpost's defences.`n`nThis Outpost's hitpoints: `b%s`b`n`n", $definc, number_format($newdef)); require_once "modules/cityprefs/lib.php"; $cid = get_cityprefs_cityid("location", $session['user']['location']); if ($cid) { set_module_objpref("city", $cid, "defences", $newdef); } } } } if (!$nomore) { $cost = stamina_getdisplaycost("Reinforcement"); addnav(array("Wall reinforcement: (`Q%s%%`0)", $cost)); addnav("Reinforce once", "runmodule.php?module=onslaught&op=reinforceconfirm"); addnav("5?Reinforce x 5", "runmodule.php?module=onslaught&op=reinforceconfirm&iterations=5"); addnav("1?Reinforce x 10", "runmodule.php?module=onslaught&op=reinforceconfirm&iterations=10"); addnav("O?Return to the Outpost", "village.php"); } break; case "runsuccess": page_header("Run Like Hell!"); output("You manage to flee your opponent. You stand close to the Outpost gates, watching the carnage inside. For the moment, everybody and everything is leaving you alone. That will not last for long.`n`nNearby, someone has abandoned their timber, hammer and nails. Abandoned or been dragged from, anyway.`n`n"); addnav("What will you do?"); addnav("Reinforce the defences", "runmodule.php?module=onslaught&op=reinforce"); addnav("Get back into the fight", "runmodule.php?module=onslaught&op=start&nodesc=1"); addnav("Run outside and let the Outpost fend for itself", "runmodule.php?module=onslaught&op=runmap"); addnav("Take stock of the situation", "runmodule.php?module=onslaught&op=lookaround"); break; case "runmap": redirect("runmodule.php?module=worldmapen&op=beginjourney", "Onslaught - Running Away"); break; case "start": page_header("Breach!"); output("`b`i`4THE WALLS OF %s ARE BREACHED!`0`i`b`nMonsters are pouring into the Outpost through jagged, splintered holes in the Outpost defences! You picked one `ihell`i of a time to go about your business here!`n`n", strtoupper($session['user']['location'])); onslaught_getenemy(); break; case "run": page_header("Breach!"); if (e_rand(1, 5) < 3) { // They managed to get away. $battle = false; redirect("runmodule.php?module=onslaught&op=runsuccess", "Onslaught: successful running"); } else { output("You try to run, but your enemy gives chase!`n"); $op = "fight"; httpset('op', $op); $battle = true; } break; case "fight": page_header("Breach!"); $battle = true; break; case "continue": page_header("Breach!"); $out1 = onslaught_getcompanion(); $out2 = onslaught_companion_escape(); if ($out1) { output("`0%s`n", $out1); } else { if ($out2) { output("`0%s`n", $out2); } } onslaught_getenemy(); if (!$battle) { $left = onslaught_checkmonsters(); if ($left > 100) { $breakchance = e_rand(0, 100); if ($breakchance > 70) { addnav("Phew!"); addnav("Looks like everything else is busy...", ""); addnav("Reinforce the defences", "runmodule.php?module=onslaught&op=reinforce"); addnav("Get back into the fight", "runmodule.php?module=onslaught&op=start&nodesc=1"); addnav("Run outside and let the Outpost fend for itself", "runmodule.php?module=onslaught&op=runmap"); addnav("Take stock of the situation", "runmodule.php?module=onslaught&op=lookaround"); } else { addnav("They just keep coming!"); addnav("Here comes another one!", "runmodule.php?module=onslaught&op=continue&nodesc=1"); } } else { output("There are no more monsters to fight...`n`n"); //Display cleanup text, tart this up a bit addnav("Village", "village.php"); } } break; } if ($battle) { include_once "battle.php"; // if( isset( $enemies ) && !$pvp ) // $badguy = &$enemies; if ($victory) { $experience = e_rand($badguy['creatureexp'] * 1.25, $badguy['creatureexp'] * 2); $experience = round($experience); output("`#You receive `6%s `#experience!`n", $experience); $session['user']['experience'] += $experience; $left = onslaught_checkmonsters(); if ($left > 100) { $breakchance = e_rand(0, 100); if ($breakchance > 70) { addnav("Phew!"); addnav("Looks like everything else is busy...", ""); addnav("Reinforce the defences", "runmodule.php?module=onslaught&op=reinforce"); addnav("Get back into the fight", "runmodule.php?module=onslaught&op=start&nodesc=1"); addnav("Run outside and let the Outpost fend for itself", "runmodule.php?module=onslaught&op=runmap"); addnav("Take stock of the situation", "runmodule.php?module=onslaught&op=lookaround"); } else { addnav("They just keep coming!"); addnav("Here comes another one!", "runmodule.php?module=onslaught&op=continue&nodesc=1"); } } else { output("You lower your weapon, blood splattered over your clothing. It looks like you're winning - there are no more monsters to fight just now.`n`n"); //Display cleanup text, tart this up a bit addnav("Village", "village.php"); } } elseif ($defeat) { require_once "lib/forestoutcomes.php"; forestdefeat(array($badguy), "in an Outpost"); } else { require_once "lib/fightnav.php"; fightnav(true, true, "runmodule.php?module=onslaught&nodesc=1"); } } page_footer(); }