function items_world_map_gathering_showgather($loc = false) { if (!$loc) { $loc = get_module_pref("worldXYZ", "worldmapen"); } list($worldmapX, $worldmapY, $worldmapZ) = explode(",", $loc); require_once "modules/worldmapen/lib.php"; $terrain = worldmapen_getTerrain($worldmapX, $worldmapY, $worldmapZ); if ($terrain['type'] == "Forest") { $equipment = get_items_with_prefs("treechopping"); if (is_array($equipment)) { require_once "modules/staminasystem/lib/lib.php"; if (mass_suspend_stamina_buffs("wlimit")) { $restorebuffs = true; } addnav("Material Gathering"); foreach ($equipment as $key => $vals) { //debug($vals); $displaycost = stamina_getdisplaycost("Logging"); addnav(array("Cut wood using %s (`Q%s%%`0)", $vals['verbosename'], $displaycost), "runmodule.php?module=items_world_map_gathering&mat=wood&item=" . $vals['item']); } } } else { if ($terrain['type'] == "Mount") { $equipment = get_items_with_prefs("rockbreaking"); if (is_array($equipment)) { require_once "modules/staminasystem/lib/lib.php"; if (mass_suspend_stamina_buffs("wlimit")) { $restorebuffs = true; } addnav("Material Gathering"); foreach ($equipment as $key => $vals) { // debug($vals); $displaycost = stamina_getdisplaycost("Stonecutting"); addnav(array("Break stone using %s (`Q%s%%`0)", $vals['verbosename'], $displaycost), "runmodule.php?module=items_world_map_gathering&mat=stone&item=" . $vals['item']); } } } } if ($restorebuffs) { restore_all_stamina_buffs(); } }
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"; if (mass_suspend_stamina_buffs("wlimit")) { $restorebuffs = true; } $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"); } if ($restorebuffs) { restore_all_stamina_buffs(); } }
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?"); 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; } if ($restorebuffs) { restore_all_stamina_buffs(); } improbablehousing_bottomnavs($house); page_footer();