output("`b`&You have been slain by `%$badguy[creaturename]`&!!!`n"); output("`4All gold on hand has been lost!`n"); output("`410% of experience has been lost!`n"); output("You may begin fighting again tomorrow."); page_footer(); }else{ fightnav(); } } } if ($HTTP_GET_VARS[op]==""){ // Need to pass the variable here so that we show the forest message // sometimes, but not others. forest($dontdisplayforestmessage); } page_footer(); function addhistory($value){ /* global $session,$balance; $history = unserialize($session['user']['history']); $historycount=50; for ($x=0;$x<$historycount;$x++){ if (!isset($history[$x])) $history[$x]=$balance; } array_shift($history); array_push($history,$value); $history = array_values($history);
} addnav("`bHeal Companions`b"); $compheal = false; foreach ($companions as $name => $companion) { if (isset($companion['cannotbehealed']) && $companion['cannotbehealed'] == true) { } else { $points = $companion['maxhitpoints'] - $companion['hitpoints']; if ($points > 0) { $compcost = round(log($session['user']['level'] + 1) * ($points + 10) * 1.33); addnav(array("%s`0 (`^%s Gold`0)", $companion['name'], $compcost), "healer.php?op=companion&name=" . rawurlencode($name) . "&compcost={$compcost}{$returnline}"); $compheal = true; } } } tlschema("nav"); addnav("`bReturn`b"); if ($return == "") { if ($playerheal || $compheal) { addnav("F?Back to the Forest", "forest.php"); villagenav(); } else { forest(true); } } elseif ($return == "village.php") { villagenav(); } else { addnav("R?Return whence you came", $return); } tlschema(); output_notl("`0"); page_footer();
function dragonplace_run() { global $session; require_once "lib/partner.php"; $partner = get_partner(); $op = httpget('op'); page_header('The Forest'); switch ($op) { case "scry": $cost = get_module_setting("scrygems"); if ($session['user']['gems'] < $cost) { page_header("Gypsy Seer's tent"); villagenav(); addnav("Continue looking around", "gypsy.php"); if ($session['user']['gems'] == 0) { output("`5You turn out your pockets looking for gems, but don't find any.`n"); } else { output("`5You turn out your pockets looking for gems, but only find %s, which is not enough.`n", $session['user']['gems']); } output("Disenheartened, you step away from the dragon's eye."); page_footer(); } else { $session['user']['gems'] -= $cost; page_header("Gypsy Seer's tent"); villagenav(); addnav("Continue looking around", "gypsy.php"); $vloc = modulehook("validforestloc", array()); while (1) { // Don't look at the same place twice in a row. $vil = array_rand($vloc); if ($vil != get_module_pref("lastscry")) { break; } } set_module_pref("lastscry", $vil); output("`5Bending forward, you peer intently into the eye of the dragon.`n"); output("As you stare, the tent around you seems to fade away and is replaced by a vision of %s.`n`n", $vil); if ($vil == get_module_pref("dragonloc") || $vil == get_module_pref("dragonloc2")) { output("%sFrom high above, you see the villagers of %s walking to and fro, and even some adventurers entering and leaving the gates to go into the forest.`n", "`\$", $vil); output("As you continue to watch, the villagers get closer and closer and then one of them is right in front of you as you swoop down into a forest clearing outside a cave."); output("You see the villager turn and scream just before being engulfed in flames!!`5`n`n"); output("Stunned at the death you have just witnessed, you lift your eyes from the orb and the tent regains focus."); } else { output("%sFrom high above, you see the villagers of %s walking to and fro, and even some adventurers entering and leaving the gates to go into the forest.`n", "`^", $vil); output("As you continue to watch, the village disappears in the distance behind you.`5`n"); output("Obviously the dragon isn't hunting in %s today.`n`n", $vil); output("You lift your eyes from the orb, and the tent regains focus."); } page_footer(); } case "dragon": addnav("Enter the cave", "runmodule.php?module=dragonplace&op=cave"); addnav("Run away like a baby", "inn.php?op=fleedragon"); output("`\$You approach the blackened entrance of a cave deep in the forest, though the trees are scorched to stumps for a hundred yards all around."); output("A thin tendril of smoke escapes the roof of the cave's entrance, and is whisked away by a suddenly cold and brisk wind."); output("The mouth of the cave lies up a dozen feet from the forest floor, set in the side of a cliff, with debris making a conical ramp to the opening."); output("Stalactites and stalagmites near the entrance trigger your imagination to inspire thoughts that the opening is really the mouth of a great leech.`n`n"); output("You cautiously approach the entrance of the cave, and as you do, you hear, or perhaps feel a deep rumble that lasts thirty seconds or so, before silencing to a breeze of sulfur-air which wafts out of the cave."); output("The sound starts again, and stops again in a regular rhythm.`n`n"); output("You clamber up the debris pile leading to the mouth of the cave, your feet crunching on the apparent remains of previous heroes, or perhaps hors d'oeuvres.`n`n"); output("Every instinct in your body wants to run, and run quickly, back to the warm inn, and the even warmer %s`\$.", $partner); output("What do you do?`0"); if (get_module_setting('sdrag')) { $session['user']['seendragon'] = 1; set_module_pref("search", get_module_pref("search") + 1); } break; case "cave": // Okay, if this is the REAL dragon cave, redirect them to dragon.php if ($session['user']['location'] == get_module_pref('dragonloc') || $session['user']['location'] == get_module_pref('dragonloc2')) { redirect('dragon.php', 'Redirecting to dragon.php from dragonplace.php'); } // We could get here from a module (peerpressure) so let's make sure // that since they have gone into the cave, we are nice to them and // don't force them back in again and again. $session['user']['specialinc'] = ""; // Otherwise, empty cave. output("`@You enter the cave.... `%and it's empty!`n"); output("It may have been a dragon's cave once, but now... there are only a few bones, and a flaming pile of logs.`n"); output("A giant Stag runs out of the cave.... so much for heavy breathing!"); output("`n`@`iMaybe in another village?`i"); debuglog("found an empty dragon cave in " . $session['user']['location']); $num = e_rand(1, 4); $found = false; $max = get_module_setting("maxsearch"); switch ($num) { case 1: if (get_module_setting('gold') > 0 && (get_module_pref('gold') == 0 || $max)) { $gold = get_module_setting('gold'); output("`n`n`c`^You find %s gold!`c", $gold); $session['user']['gold'] += $gold; set_module_pref('gold', 1); $found = true; debuglog("found {$gold} gold in an empty dragon cave"); } break; case 2: if (get_module_setting('gems') > 0 && (get_module_pref('gems') == 0 || $max)) { $gems = get_module_setting('gems'); if ($gems == 1) { output("`n`n`c`^You find a `%gem`^!`c"); } else { output("`n`n`c`^You find `%%s gems`^!`c", $gems); } $session['user']['gems'] += $gems; set_module_pref('gems', 1); debuglog("found {$gems} gems in an empty dragon cave"); $found = true; } break; case 3: if (get_module_setting('hp') > 0 && (get_module_pref('hp') == 0 || $max)) { output("`n`n`c`^You trip over a bone, and lose some hitpoints!`c"); $session['user']['hitpoints'] -= get_module_setting('hp'); if ($session['user']['hitpoints'] <= 1) { $session['user']['hitpoints'] = 1; } set_module_pref('hp', 1); $found = true; } break; } if (!$found) { output("`n`n`c`\$Nothing happens...`c"); } $isforest = 0; $vloc = modulehook('validforestloc', array()); foreach ($vloc as $i => $l) { if ($l == $session['user']['location']) { $isforest = 1; break; } } if ($isforest) { forest(true); } else { require_once "lib/villagenav.php"; villagenav(); } break; } page_footer(); }