function drunkard_runevent($type) { global $session; require_once "lib/partner.php"; $partner = get_partner(); $chance = get_module_setting("spillchance"); $roll = e_rand(1, 100); $seen = get_module_pref("seen"); set_module_pref("seen", $seen + 1); output("`5A very drunk patron stumbles into you as you make your way across the crowded room.`n`n"); if ($roll < $chance) { // He spills on you output("`5He is carrying a nearly full glass of ale."); output("As he collides with you, it spills all over your nearly clean clothes!"); output("As you look up, you notice %s`5 watching you and become acutely embarrassed.", $partner); output("You notice %s`5 is trying to keep from laughing out loud at your mishap.", $partner); output("`n`n`&You `\$lose 1`& charm point."); if ($session['user']['charm'] > 0) { $session['user']['charm']--; } } else { // You're safe output("`5Fortunately his glass was already empty."); output("You escort him over to a chair where he can sit without running into everyone else."); output("As you stand up, you catch %s's`5 eye and receive a big smile for your kindness.", $partner); output("`n`n`&You gain `^1`& charm."); $session['user']['charm']++; } }
function drinks_run_private() { require_once "modules/drinks/misc_functions.php"; require_once "lib/partner.php"; global $session; $partner = get_partner(); $act = httpget('act'); if ($act == "editor") { drinks_editor(); } elseif ($act == "buy") { $texts = drinks_gettexts(); $drinktext = modulehook("drinks-text", $texts); tlschema($drinktext['schemas']['title']); page_header($drinktext['title']); rawoutput("<span style='color: #9900FF'>"); output_notl("`c`b"); output($drinktext['title']); output_notl("`b`c"); tlschema(); $drunk = get_module_pref("drunkeness"); $end = "."; if ($drunk > get_module_setting("maxdrunk")) { $end = ","; } tlschema($drinktext['schemas']['demand']); $remark = translate_inline($drinktext['demand']); $remark = str_replace("{lover}", $partner . "`0", $remark); $remark = str_replace("{barkeep}", $drinktext['barkeep'] . "`0", $remark); tlschema(); output_notl("%s{$end}", $remark); $drunk = get_module_pref("drunkeness"); if ($drunk > get_module_setting("maxdrunk")) { tlschema($drinktext['schemas']['toodrunk']); $remark = translate_inline($drinktext['toodrunk']); tlschema(); $remark = str_replace("{lover}", $partner . "`0", $remark); $remark = str_replace("{barkeep}", $drinktext['barkeep'] . "`0", $remark); output($remark); tlschema(); } else { $sql = "SELECT * FROM " . db_prefix("drinks") . " WHERE drinkid='" . httpget('id') . "'"; $result = db_query($sql); $row = db_fetch_assoc($result); $drinkcost = $session['user']['level'] * $row['costperlevel']; if ($session['user']['gold'] >= $drinkcost) { $drunk = get_module_pref("drunkeness"); $drunk += $row['drunkeness']; set_module_pref("drunkeness", $drunk); $session['user']['gold'] -= $drinkcost; debuglog("spent {$drinkcost} on {$row['name']}"); $remark = str_replace("{lover}", $partner . "`0", $row['remarks']); $remark = str_replace("{barkeep}", $drinktext['barkeep'] . "`0", $remark); if (count($drinktext['drinksubs']) > 0) { $keys = array_keys($drinktext['drinksubs']); $vals = array_values($drinktext['drinksubs']); $remark = preg_replace($keys, $vals, $remark); } output($remark); output_notl("`n`n"); if ($row['harddrink']) { $drinks = get_module_pref("harddrinks"); set_module_pref("harddrinks", $drinks + 1); } $givehp = 0; $giveturn = 0; if ($row['hpchance'] > 0 || $row['turnchance'] > 0) { $tot = $row['hpchance'] + $row['turnchance']; $c = e_rand(1, $tot); if ($c <= $row['hpchance'] && $row['hpchance'] > 0) { $givehp = 1; } else { $giveturn = 1; } } if ($row['alwayshp']) { $givehp = 1; } if ($row['alwaysturn']) { $giveturn = 1; } if ($giveturn) { $turns = e_rand($row['turnmin'], $row['turnmax']); $oldturns = $session['user']['turns']; $session['user']['turns'] += $turns; // sanity check if ($session['user']['turns'] < 0) { $session['user']['turns'] = 0; } if ($oldturns < $session['user']['turns']) { output("`&You feel vigorous!`n"); } else { if ($oldturns > $session['user']['turns']) { output("`&You feel lethargic!`n"); } } } if ($givehp) { $oldhp = $session['user']['hitpoints']; // Check for percent increase first if ($row['hppercent'] != 0.0) { $hp = round($session['user']['maxhitpoints'] * ($row['hppercent'] / 100), 0); } else { $hp = e_rand($row['hpmin'], $row['hpmax']); } $session['user']['hitpoints'] += $hp; // Sanity check if ($session['user']['hitpoints'] < 1) { $session['user']['hitpoints'] = 1; } if ($oldhp < $session['user']['hitpoints']) { output("`&You feel healthy!`n"); } else { if ($oldhp > $session['user']['hitpoints']) { output("`&You feel sick!`n"); } } } $buff = array(); $buff['name'] = $row['buffname']; $buff['rounds'] = $row['buffrounds']; if ($row['buffwearoff']) { $buff['wearoff'] = $row['buffwearoff']; } if ($row['buffatkmod']) { $buff['atkmod'] = $row['buffatkmod']; } if ($row['buffdefmod']) { $buff['defmod'] = $row['buffdefmod']; } if ($row['buffdmgmod']) { $buff['dmgmod'] = $row['buffdmgmod']; } if ($row['buffdmgshield']) { $buff['damageshield'] = $row['buffdmgshield']; } if ($row['buffroundmsg']) { $buff['roundmsg'] = $row['buffroundmsg']; } if ($row['buffeffectmsg']) { $buff['effectmsg'] = $row['buffeffectmsg']; } if ($row['buffeffectnodmgmsg']) { $buff['effectnodmgmsg'] = $row['buffeffectnodmgmsg']; } if ($row['buffeffectfailmsg']) { $buff['effectfailmsg'] = $row['buffeffectfailmsg']; } $buff['schema'] = "module-drinks"; apply_buff('buzz', $buff); } else { output("You don't have enough money. How can you buy %s if you don't have any money!?!", $row['name']); } } rawoutput("</span>"); if ($drinktext['return'] > "") { tlschema($drinktext['schemas']['return']); addnav($drinktext['return'], $drinktext['returnlink']); tlschema(); } else { addnav("I?Return to the Inn", "inn.php"); addnav(array("Go back to talking to %s`0", getsetting("barkeep", "`tCedrik")), "inn.php?op=bartender"); } require_once "lib/villagenav.php"; villagenav(); page_footer(); } }
function breakin_run() { global $session, $pvptimeout, $pvptime; $op = httpget("op"); $danger = get_module_setting("danger"); require_once "lib/partner.php"; $partner = get_partner(); // Need to include this in here so we pick up the pvptimeout/etc in // the right scope. require_once "lib/pvplist.php"; // this is a variable in case an admin changes the name of the inn $iname = getsetting("innname", LOCATION_INN); page_header($iname); output("`&`c`bThe Ivy-Covered Door`b`c"); if ($op == "") { addnav("D?Force the Door", "runmodule.php?module=breakin&op=force"); addnav("F?Forget it", "runmodule.php?module=breakin&op=leave"); output("`7As you approach the door, you hear the sounds of drunken revelry."); output("You realize that this door must be a back entrance to the Inn.`n`n"); output("`7As you pull some of the vines away, you discover that the door is flimsy and moves as you push at it."); output("The realization dawns that you could sneak upstairs for free and slay another player as they sleep!"); output("`7Merick tends to his animals and pays you no attention."); output("Will you break in?`n`n"); } elseif ($op == "leave") { addnav("Return from whence you came", "stables.php"); output("`7You really don't want to break the door down, so you quietly walk back over to the stables.`n`n"); } elseif ($op == "go") { addnav("Return from whence you came", "stables.php"); output("`7You really don't think it is worth the risk, so you quietly go back outside and walk over to the stables.`n`n"); } elseif ($op == "ledger-safe") { output("You begin to scan the names in the ledger, trying to decide who to attack.`n`n"); pvplist($iname, "pvp.php", "?act=attack&inn=1"); addnav("List Warriors", "runmodule.php?module=breakin&op=ledger-safe"); addnav("Forget it", "runmodule.php?module=breakin&op=go"); } elseif ($op == "ledger") { $danger = get_module_setting("danger"); $bchance = e_rand(0, 100); output("You begin to scan the names in the ledger, trying to decide who to attack.`n`n"); if ($bchance > $danger) { // I hate doing a redirect here, but if we don't, the ledger list // won't be 'safe' if you view a bio and then return. redirect("runmodule.php?module=breakin&op=ledger-safe"); } else { output("Before you can do anything, a powerful blow to the head knocks you to the ground."); output("Cedrik stands over you, a wine bottle in one hand, scowling angrily.`n`n"); if (get_module_setting("stocks")) { output("He yells for a guard, and before you can collect your senses, the two of them have hoisted you out the front door of the Inn, and into the stocks.`n"); set_module_setting("victim", $session['user']['acctid'], "stocks"); set_module_setting("thisID", $session['user']['acctid']); invalidatedatacache("stocks"); } else { output("He yells for a guard, and before you can collect your senses, the two of them have 'escorted' you out the front door of the Inn.`n"); } if (get_module_setting("robloss")) { output("As you struggle to retain conciousness, you feel the guard relieving you of some of your possessions.`n"); $losspercent = get_module_setting("robloss") / 100; $gems = round($session['user']['gems'] * $losspercent, 0); $gold = round($session['user']['gold'] * $losspercent, 0); if ($gems) { if ($gems == 1) { output("`&The guard `\$takes `%%s`& gem.`n", $gems); } else { output("`&The guard `\$takes `%%s`& gems.`n", $gems); } $session['user']['gems'] -= $gems; debuglog("lost {$gems} gems to the gaurd when caught breaking in to the Inn"); } if ($gold) { output("`&The guard `\$takes `^%s`& gold.`n", $gold); $session['user']['gold'] -= $gold; debuglog("lost {$gold} gold to the gaurd when caught breaking in to the Inn"); } } if (get_module_setting("losecharm")) { output("`7%s`7 watches the whole thing with a frown.`n`n", $partner); output("`^You `\$lose`^ some charm!`n"); if ($session['user']['charm'] >= 3) { $session['user']['charm'] -= 3; } else { $session['user']['charm'] = 0; } } if (get_module_setting("hploss")) { output("`^Your head throbs, and you feel weak.`n"); $hp = round($session['user']['hitpoints'] * get_module_setting("hploss") / 100, 0); $session['user']['hitpoints'] -= $hp; if ($session['user']['hitpoints'] < 1) { $session['user']['hitpoints'] = 1; } } output("Moments later, you pass out from the pain in your head.`n`n"); if (get_module_setting("wipepvp")) { $session['user']['playerfights'] = 0; output("`n`nYou don't feel like you can attack anyone today.`n`n"); debuglog("lost all their player fights after being caught breaking into the Inn"); } addnews("`&%s `7tried to break into the Inn, and was caught by Cedrik.", $session['user']['name']); addnav("Wake Up", "village.php"); if (get_module_setting("guilt")) { set_module_pref("guilt", 2); } } } else { set_module_pref("breaktoday", 1); if (get_module_setting("guilt")) { set_module_pref("guilt", 2); } output("`7You lean on the door heavily with one shoulder, and it gives way with a crack as the wood splinters around the lock.`n`n"); $ringchance = e_rand(1, 20); output("You find yourself in a small office."); if (get_module_pref("ring") == 0 && $ringchance == 1) { output("On the desk in front of you, there is a set of labeled keys, a diamond ring, and a small ledger listing the guests in each room. "); set_module_pref("ring", 1); output("You take the ring and slip it quickly into your pocket.`n`n"); // need to check if module exists on this server if (is_module_active("matthias")) { $astute = get_module_pref("astuteness", "matthias"); $astute++; set_module_pref("astuteness", $astute, "matthias"); } } else { output("On the desk in front of you, there is a set of labeled keys and a small ledger listing the guests in each room. "); } output("Beyond an open doorway to one side, you hear the inn patrons talking, and you realize how dangerous this idea is!`n`n"); addnav("Forget it", "runmodule.php?module=breakin&op=go"); // if (is_module_active("pvpimmunity") && !get_module_pref("check_willing","pvpimmunity")){ // output("You are repelled by the idea of sneaking into somebody else's room, so you find nothing else of interest here.`n`n"); // } else { addnav("Look at the Ledger", "runmodule.php?module=breakin&op=ledger"); // } // Help the superusers debug if ($session['user']['superuser'] & SU_EDIT_USERS) { addnav("Safe look", "runmodule.php?module=breakin&op=ledger-safe"); } } 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(); }
} else { output("`c`b`\$You failed to flee your opponent!`0`b`c"); } } if ($op == "dragon") { require_once "lib/partner.php"; addnav("Enter the cave", "dragon.php"); 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`\$.", get_partner()); output("What do you do?`0"); $session['user']['seendragon'] = 1; } if ($op == "search") { checkday(); if ($session['user']['turns'] <= 0) { output("`\$`bYou are too tired to search the forest any longer today. Perhaps tomorrow you will have more energy.`b`0"); $op = ""; httpset('op', ""); } else { modulehook("forestsearch", array()); $args = array('soberval' => 0.9, 'sobermsg' => "`&Faced with the prospect of death, you sober up a little.`n", 'schema' => 'forest'); modulehook("soberup", $args); if (module_events("forest", getsetting("forestchance", 15)) != 0) { if (!checknavs()) {
// $sql = "UPDATE " . db_prefix("accounts") . " SET marriedto=0 WHERE acctid='{$row['marriedto']}'"; // db_query($sql); // } // } // $list=get_module_pref('flirtssent'); // $list=unserialize($list); // require_once("./modules/marriage/marriage_func.php"); // if (!is_array($list)) break; // while (list($who,$amount)=each($list)) { // marriage_removeplayer($who,$session['user']['acctid']); // } break; case "charstats": if ($session['user']['marriedto'] != 0 && get_module_pref('user_stats')) { require_once "lib/partner.php"; $partner = get_partner(true); setcharstat("Personal Info", "Marriage", "`^" . translate_inline("Married to ") . $partner); } break; case "faq-toc": $t = translate_inline("`@Frequently Asked Questions on Marriage`0"); output_notl("•<a href='runmodule.php?module=marriage&op=faq'>{$t}</a><br/>", true); addnav("", "runmodule.php?module=marriage&op=faq"); break; case "biostat": $char = httpget('char'); $sql = "SELECT a.acctid as userid, a.marriedto as married, b.name as partnername,a.sex as gender FROM " . db_prefix('accounts') . " as a LEFT JOIN " . db_prefix('accounts') . " as b ON a.marriedto=b.acctid WHERE a.acctid='{$char}'"; $results = db_query($sql); $row = db_fetch_assoc($results); if ($row['married'] != 0 && $row['partnername'] != "") { if (!get_module_pref('user_bio', "marriage", $row['userid'])) {
function riddles_runevent($type) { require_once "lib/increment_specialty.php"; global $session; // We assume this event only shows up in the forest currently. $from = "forest.php?"; $session['user']['specialinc'] = "module:riddles"; require_once "lib/partner.php"; $partner = get_partner(); $op = httpget('op'); if ($op == "" || $op == "search") { output("You come across a tall man wearing an immaculate white Victorian suit, a top hat, and the sort of smile that you only ever see on tigers who want you to believe that they're kittens. He leans on a handsome walking stick as he eyes you up and down.`n`n\"Good afternoon,\" says the gentleman. \"Would you care to play a game with me?\"`n`nYou're pretty sure this guy is a Joker. They like stuff like this. And the glowing green eyes were a dead giveaway.`n`n\"What sort of game?\" you ask warily.`n`n\"Well,\" says the gentleman, smartly rapping his staff upon the floor and sauntering towards you, \"I've always been fond of riddles, you see. Cryptic questions, as it were. How about if I ask you a riddle, and if you get it right, I'll give you something rather nice?\"`n`nYou smirk. \"And I presume that if I get it wrong, you'll do something horrible to me.\"`n`n\"Oh,\" says the Joker, smiling even wider, \"`iquite`i horrible, I assure you. All a part of the service, you know!\"`n`nWhat will you do?"); addnav("Cryptic Joker"); addnav("Play his game", $from . "op=yes"); addnav("Run like hell", $from . "op=no"); $session['user']['specialmisc'] = ""; } elseif ($op == "yes") { $subop = httpget('subop'); if ($subop != "answer") { $rid = $session['user']['specialmisc']; if (!strpos($rid, "Riddle")) { $sq1 = "SELECT * FROM " . db_prefix("riddles") . " ORDER BY rand(" . e_rand() . ")"; } else { // 6 letters in "Riddle" $rid = substr($rid, -1 * (strlen($rid) - 6)); $sq1 = "SELECT * FROM " . db_prefix("riddles") . " WHERE id={$rid}"; } $result = db_query($sq1); $riddle = db_fetch_assoc($result); $session['user']['specialmisc'] = "Riddle" . $riddle['id']; output("The Joker smiles, leans in close, and whispers to you:`n`n"); output("`6\"`@%s`6\"`n`n", $riddle['riddle']); output("What is your guess?"); rawoutput("<form action='" . $from . "op=yes&subop=answer' method='POST'>"); rawoutput("<input name='guess'>"); $guess = translate_inline("Guess"); rawoutput("<input type='submit' class='button' value='{$guess}'>"); rawoutput("</form>"); addnav("", $from . "op=yes&subop=answer"); } else { $rid = substr($session['user']['specialmisc'], 6); $sq1 = "SELECT * FROM " . db_prefix("riddles") . " WHERE id={$rid}"; $result = db_query($sq1); $riddle = db_fetch_assoc($result); //*** Get and filter correct answer // there can be more than one answer in the database, // separated by semicolons (;) $answer = explode(";", $riddle['answer']); foreach ($answer as $key => $answer1) { // changed "" to " " below, I believe this is the correct // implementation. $answer[$key] = preg_replace("/[^[:alnum:]]/", " ", $answer1); $answer[$key] = riddles_filterwords($answer1); } //*** Get and filter players guess $guess = httppost('guess'); $guess = preg_replace("/[^[:alnum:]]/", " ", $guess); $guess = riddles_filterwords($guess); $correct = 0; //changed to 2 on the levenshtein just for compassion's // sake :-) --MightyE foreach ($answer as $answer1) { // Only allow spelling mistakes if te word is long enough if (strlen($answer1) > 2) { if (levenshtein($guess, $answer1) <= 2) { // Allow two letter to be off to compensate for silly // spelling mistakes $correct = 1; } } else { // Otherwise, they have to be exact if ($guess == $answer1) { $correct = 1; } } } // make sure an empty response from the player is never correct. if (!$guess) { $correct = 0; } if ($correct) { if (is_module_active("medals")) { require_once "modules/medals.php"; medals_award_medal("crypticjoker", "Cryptic Answers", "This player correctly answered a question from the Cryptic Questions Joker!", "medal_crypticjoker.png"); } output("`nThe Joker's face splits into a wide grin. \"I see you're no stranger to cryptic questions! Very well, here is your prize.\"`n`nHe produces a long, thin hypodermic needle from his sleeve and, moving with the speed of a cat, slides it into your arm...`n`n`6"); // It would be nice to have some more consequences $rand = e_rand(1, 7); switch ($rand) { case 1: case 2: output("You feel the chemical beginning to toughen your skin! Within moments, your defensive powers are dramatically increased!"); apply_buff("riddlejoker1", array("name" => "`7Cryptic Questions Joker Needle`0", "defmod" => "1.2", "rounds" => 20, "wearoff" => "`4The effects of the Riddling Joker's hypodermic have faded...`0", "schema" => "module-riddles")); break; case 3: case 4: output("You feel the chemical beginning to heighten your perception! Within moments, you feel a lot more dangerous!"); apply_buff("riddlejoker2", array("name" => "`7Cryptic Questions Joker Needle`0", "atkmod" => "1.2", "rounds" => 20, "wearoff" => "`4The effects of the Riddling Joker's hypodermic have faded...`0", "schema" => "module-riddles")); break; case 5: case 6: output("You feel the chemical beginning to quicken your heartbeat! Within moments, you feel you have the energy to take on a couple more jungle fights! You gain some Stamina!"); $session['user']['turns']++; $session['user']['turns']++; break; case 7: output("You feel a burning in your extremities as your muscles begin to knit back together..."); apply_buff("riddlejoker3", array("name" => "`7Cryptic Questions Joker Needle`0", "regen" => e_rand(1, 12), "rounds" => 20, "effectmsg" => "`4The chemical contained in the Riddle Joker's hypodermic surprise heals you for {damage} points.", "wearoff" => "`4The effects of the Riddling Joker's hypodermic have faded...`0", "schema" => "module-riddles")); break; } } else { output("`nThe Joker smiles. \"I see. Well, then, let's see what we have for you...\"`n`nHe produces a slender, wickedly sharp hypodermic needle from an inner pocket and jabs it into your neck before you even have time to react.`n`n`4"); // It would be nice to have some more consequences $rand = e_rand(1, 7); switch ($rand) { case 1: case 2: output("You feel the chemical beginning to slow you down! Within moments, your defensive powers are dramatically reduced!"); apply_buff("riddlejoker4", array("name" => "`7Cryptic Questions Joker Needle`0", "defmod" => "0.8", "rounds" => 10, "wearoff" => "`4The effects of the Riddling Joker's hypodermic have faded...`0", "schema" => "module-riddles")); break; case 3: case 4: output("You feel the chemical beginning to weaken your muscles! Within moments, you feel a lot less dangerous!"); apply_buff("riddlejoker5", array("name" => "`7Cryptic Questions Joker Needle`0", "atkmod" => "0.8", "rounds" => 10, "wearoff" => "`4The effects of the Riddling Joker's hypodermic have faded...`0", "schema" => "module-riddles")); break; case 5: case 6: output("You suddenly feel drowsy! You lose some Stamina!"); $session['user']['turns']--; $session['user']['turns']--; break; case 7: output("Your muscles begin to decay inside your skin as you live and breathe!"); apply_buff("riddlejoker6", array("name" => "`7Cryptic Questions Joker Needle`0", "regen" => e_rand(-1, -12), "rounds" => 10, "effectmsg" => "`4The chemical contained in the Riddle Joker's hypodermic surprise damages you for {damage} points.", "effectfailmsg" => "`4The chemical contained in the Riddle Joker's hypodermic surprise damages you for {damage} points.", "wearoff" => "`4The effects of the Riddling Joker's hypodermic have faded...`0", "schema" => "module-riddles")); break; } } $session['user']['specialinc'] = ""; $session['user']['specialmisc'] = ""; } } elseif ($op == "no") { output("`n`6Afraid to look the fool, you decline his challenge."); output("He was a little bit creepy anyway.`n"); output("`6The strange man waves goodbye as you stroll, a little quickly but hating to show it, into the depths of the jungle."); $session['user']['specialinc'] = ""; $session['user']['specialmisc'] = ""; } output("`0"); }
function oldman_runevent($type) { global $session; // We assume this event only shows up in the forest currently. $from = "forest.php?"; $session['user']['specialinc'] = "module:oldman"; require_once "lib/partner.php"; $partner = get_partner(); $op = httpget('op'); if ($op == "" || $op == "search") { output("`@You encounter a strange old man!`n`n"); output("He beckons you over to talk with you."); output("He looks harmless enough, but you have heard tales of the evil creatures which lurk in this forest disguised as normal people.`n`n"); addnav("Old Man"); addnav("Talk with him", $from . "op=talk"); addnav("Back away", $from . "op=chicken"); } elseif ($op == "chicken") { $session['user']['specialinc'] = ""; output("`@You back away slowly, and then when you are out of sight, turn and move quickly to another part of the forest.`n`n"); if (e_rand(1, 2) == 2) { output("`@You are quite sure that your paranoia saved your life today."); } else { output("`@You are quite sure that %s`@ would think you are a wuss for being scared of an old man.", $partner); if ($session['user']['sex'] == SEX_MALE) { output("Fortunately, she isn't here to see your cowardice."); } else { output("Fortunately, he isn't here to see your cowardice."); } } } elseif ($op == "talk") { // Okay.. now we get to have fun. Which old man do they get? switch (e_rand(1, 5)) { case 1: // This is the pretty stick. $session['user']['specialinc'] = ""; output("`@As you approach, he pulls out his Pretty Stick, whacks you on the temple, giggles, and runs away!`n`n"); output("`^You `%gain one`^ charm point!"); $session['user']['charm']++; break; case 2: // The ugly stick $session['user']['specialinc'] = ""; if ($session['user']['charm'] > 0) { output("`@As you approach, he pulls out his Ugly Stick, whacks you on the nose, giggles, and runs away!`n`n"); output("`^You `%lose one`^ charm point!"); $session['user']['charm']--; } else { output("`@As you approach, he pulls out his Ugly Stick, whacks you on the nose, then gasps as his stick `%loses one`@ charm point.`n`n"); output("`@He quickly recovers his composure and runs away!`n`n"); output("Dang! You're even uglier than his Ugly Stick!"); } break; case 3: // The lost man. output("`@\"`#I am lost,`@\" he says, \"`#can you lead me back to town?`@\"`n`n"); output("You know that if you do, you will lose time for a forest fight for today.`n`n"); output("Will you help out this poor old man?"); addnav("Old Man"); addnav("Walk him to town", $from . "op=walk"); addnav("Leave him here", $from . "op=leavehim"); break; case 4: // The betting game output("`@\"`#Would you like to play a little guessing game?`@\", he asks."); output("Knowing his sort, you know he will probably insist on a small wager if you do.`n`n"); output("`@Do you wish to play his game?`n`n"); addnav("Old Man"); addnav("Play game", $from . "op=game"); addnav("Leave", $from . "op=nogame"); break; case 5: // The necromancer output("`@As you approach the old man, his face twists into a maniacal, evil grin."); switch (e_rand(1, 15)) { case 1: $session['user']['specialinc'] = ""; output("`@When you reach him, he mutters, \"`#Didn't y' own mother teach you never t' talk t' strangers?`@\""); output("The old necromancer cackles and pulls out a black wand, waving it quickly over your head.`n`n"); output("`@You feel a searing pain as your soul is forcibly ripped from your body and cast into the underworld to fuel his evil spells!`n`n"); output("`^Your spirit has been ripped from your body!`n"); output("`^That treacherous old man searches your body and takes all of your gold.`n"); output("You lose 5% of your experience!`n"); output("You may continue playing again tomorrow."); $session['user']['alive'] = false; $session['user']['hitpoints'] = 0; $session['user']['experience'] *= 0.95; $session['user']['gold'] = 0; addnav("Daily News", "news.php"); addnews("The body of %s was found in the woods, stripped of all gold and with dark symbols drawn upon it.", $session['user']['name']); break; case 2: case 3: $session['user']['specialinc'] = ""; output("`@When you reach him, he mutters, \"`#Aye, me %s, come a wee bit closer. That's it, just a bit CLOSER!`@\"`n`n", translate_inline($session['user']['sex'] ? "lass" : "lad")); output("As the old necromancer screams that last word, he pulls out a black wand and your body twists in agony as if molten fire has replaced your blood.`n`n"); output("Your vision goes dark and you feel the hand of %s`@ closing around your heart.", getsetting("deathoverlord", '`$Ramius')); output("Just as you are sure you will die, the pain stops as quickly as it began.`n`n"); output("You climb to your feet, shaking and weak."); output("The old necromancer is nowhere to be seen.`n`n"); output("`@You feel you will never be quite the %s you were before.`n`n", translate_inline($session['user']['sex'] ? "woman" : "man")); if ($session['user']['maxhitpoints'] > $session['user']['level'] * 10) { $session['user']['maxhitpoints']--; set_module_pref("extrahps", get_module_pref("extrahps") - 1); $hptype = "permanently"; if (!get_module_setting("carrydk") || is_module_active("globalhp") && !get_module_setting("carrydk", "globalhp")) { $hptype = "temporarily"; } $hptype = translate_inline($hptype); output("`^You `b%s`b `\$lose`^ one hitpoint!`n", $hptype); } $loss = round($session['user']['maxhitpoints'] * 0.25, 0); if ($loss > $session['user']['hitpoints']) { $loss = $session['user']['hitpoints'] - 1; } output("`^You have taken `\$%s`^ damage from wounds.", $loss); $session['user']['hitpoints'] -= $loss; if ($session['user']['sex']) { $msg = "%s came home from the forest, a bit less the woman than she was before."; } else { $msg = "%s came home from the forest, a bit less the man than he was before."; } addnews($msg, $session['user']['name']); break; case 4: case 5: case 6: case 7: case 8: case 9: case 10: output("`@When you reach him, he mutters, \"`#A gem for me own self, yes?`@\"`n`n"); output("Do you give him a gem?"); addnav("Old Man"); addnav("Give him a gem", $from . "op=givegem"); addnav("Keep your gems", $from . "op=keepgem"); break; case 11: case 12: case 13: case 14: case 15: $session['user']['specialinc'] = ""; output("`@You are almost in front of him, when you hear a crashing sound coming from your right.`n`n"); output("You turn to look and see one of the bodyguards from the Inn walking through the woods heading your direction."); output("You turn back to the old man, but he seems to have vanished.`n`n"); output("Oh well, you'll never know what he wanted now."); break; } break; } } elseif ($op == "walk") { // Walking the oldman (#3) to town $session['user']['turns']--; output("`@You take the time to lead the old man back to town.`n`n"); if (e_rand(0, 1) == 0) { output("`@In exchange, he whacks you with his Pretty Stick and you `%gain one`@ charm point."); $session['user']['charm']++; } else { output("`@In exchange, he gives you `%a gem`@!"); $session['user']['gems']++; debuglog("gained 1 gem for walking old man to village"); } } elseif ($op == "leavehim") { $session['user']['specialinc'] = ""; // Being a cruel insensitive clod who hates old men. output("`@You tell the old man that you are far too busy to aid him.`n`n"); output("`@Not a big deal, he should be able to find his way back to town on his own, he made his way out here, didn't he?"); output("A wolf howls in the distance to your left, and a few seconds later one howls somewhere closer to your right."); output("Yep, he should be fine."); } elseif ($op == "nogame") { // Penny-pincher :) $session['user']['specialinc'] = ""; output("`@Afraid to part with your precious precious money, you decline the old man his game.`n`n"); output("There wasn't much point to it anyhow, as you certainly would have won.`n`n"); output("Yep, definitely not afraid of the old man, nope."); } elseif ($op == "game") { if ($session['user']['gold'] <= 0) { $session['user']['specialinc'] = ""; output("`@The old man reaches out with his stick and pokes your coin purse. \"`#Empty?!?! How can you bet with no money??`@\" he shouts."); output("With that, he turns with a HARUMPH, and disappears into the underbrush."); } else { oldman_bettinggame($from); } } elseif ($op == "givegem") { if ($session['user']['gems'] <= 0) { $session['user']['specialinc'] = ""; output("`@You reach into your pack to find that you have no gems."); output("The old man looks at you expectantly.`n`n"); output("When he sees you have no gems, he starts to frown."); output("Sensing trouble, you turn to flee toward the forest.`n`n"); output("From behind you, you hear an evil laugh and feel a sharp pain in your back!`n`n"); $loss = round($session['user']['maxhitpoints'] * 0.2, 0); if ($loss > $session['user']['hitpoints']) { $loss = $session['user']['hitpoints'] - 1; } output("`^You have taken `\$%s`^ damage from wounds.", $loss); $session['user']['hitpoints'] -= $loss; } else { $session['user']['specialinc'] = ""; output("`@Feeling sorry for the old man, you reach into your pack and extract a gem which he snatches eagerly from your hand.`n"); $session['user']['gems']--; switch (e_rand(1, 6)) { case 1: case 2: case 3: output("`@He cackles with glee."); output("He turns to you and says, \"`#Since y' made such a fine bargain w' me, me %s, I'll be puttin' in a good word for y' with m' ol' friend %s`#.`@\"`n`n", translate_inline($session['user']['sex'] ? "deary" : "lad"), getsetting("deathoverlord", '`$Ramius')); output("`@The necromancer pulls out a black wand, raps you thrice on the head, and runs off into the forest.`n`n"); $favor = e_rand(5, 20); output("`^You gain `&%s`^ favor with `\$Ramius`^.", $favor); $session['user']['deathpower'] += $favor; break; case 4: case 5: if (is_module_active("specialtydarkarts")) { output("`@He cackles with glee."); output("He turns to you and says, \"`#Since y' made such a fine bargain w' me, me %s, I'll be teachin' y' a bit of m' art!`@\"`n`n", translate_inline($session['user']['sex'] ? "deary" : "lad")); output("`@The necromancer pulls out a black wand, raps you thrice on the head, and runs off into the forest.`n`n"); output("`^You feel knowledge of the `\$Dark Arts`^ settle into your brain like a stain of blood into straw.`n"); require_once "lib/increment_specialty.php"; increment_specialty('`$', 'DA'); break; } // Fall through if we don't have dark arts enabled. // Fall through if we don't have dark arts enabled. case 6: output("`@He runs off into the forest.`n`n"); output("That greedy old man stole your gem!"); } } } elseif ($op == "keepgem") { $session['user']['specialinc'] = ""; output("`@Not wanting to part with one of your precious gems, you turn around and march back toward the forest.`n`n"); output("From behind you, you hear an evil laugh and feel a sharp pain in your back!`n`n"); $loss = round($session['user']['maxhitpoints'] * 0.1, 0); if ($loss > $session['user']['hitpoints']) { $loss = $session['user']['hitpoints'] - 1; } output("`^You have taken `\$%s`^ damage from wounds.", $loss); $session['user']['hitpoints'] -= $loss; } output("`0"); }
function lovers_seth() { global $session; $seenlover = get_module_pref("seenlover"); $partner = get_partner(); if ($seenlover == 0) { //haven't seen lover if ($session['user']['marriedto'] == INT_MAX) { //married $seenlover = 1; if (e_rand(1, 4) == 1) { switch (e_rand(1, 4)) { case 1: $msg = translate_inline("being too busy tuning his lute,"); break; case 2: $msg = translate_inline("\"that time of month,\""); break; case 3: $msg = translate_inline("\"a little cold... *cough cough* see?\""); break; case 4: $msg = translate_inline("wanting you to fetch him a beer,"); break; } output("You head over to snuggle up to %s`0 and kiss him about the face and neck, but he grumbles something about %s and with a comment like that, you storm away from him!", $partner, $msg); $session['user']['charm']--; output("`n`n`^You LOSE a charm point!"); } else { output("You and %s`0 take some time to yourselves, and you leave the inn, positively glowing!", $partner); apply_buff('lover', lovers_getbuff()); $session['user']['charm']++; output("`n`n`^You gain a charm point!"); } } else { //not married. if (httpget("flirt") == "") { //haven't flirted yet addnav("Flirt"); addnav("Wink", "runmodule.php?module=lovers&op=flirt&flirt=1"); addnav("Flutter Eyelashes", "runmodule.php?module=lovers&op=flirt&flirt=2"); addnav("Drop Hanky", "runmodule.php?module=lovers&op=flirt&flirt=3"); addnav("Ask him to buy you a drink", "runmodule.php?module=lovers&op=flirt&flirt=4"); addnav("Kiss him soundly", "runmodule.php?module=lovers&op=flirt&flirt=5"); addnav("Completely seduce him", "runmodule.php?module=lovers&op=flirt&flirt=6"); addnav("Marry him", "runmodule.php?module=lovers&op=flirt&flirt=7"); } else { //flirting now $c = $session['user']['charm']; $seenlover = 1; switch (httpget('flirt')) { case 1: if (e_rand($c, 2) >= 2) { output("%s`0 grins a big toothy grin.", $partner); output("My, isn't the dimple in his chin cute??"); if ($c < 4) { $c++; } } else { output("%s`0 raises an eyebrow at you, and asks if you have something in your eye.", $partner); } break; case 2: if (e_rand($c, 4) >= 4) { output("%s`0 smiles at you and says, \"`^My, what pretty eyes you have.`0\"", $partner); if ($c < 7) { $c++; } } else { output("%s`0 smiles, and waves... to the person standing behind you.", $partner); } break; case 3: if (e_rand($c, 7) >= 7) { output("%s`0 bends over and retrieves your hanky, while you admire his firm posterior.", $partner); if ($c < 11) { $c++; } } else { output("%s`0 bends over and retrieves your hanky, wipes his nose with it, and gives it back.", $partner); } break; case 4: if (e_rand($c, 11) >= 11) { output("%s`0 places his arm around your waist, and escorts you to the bar where he buys you one of the Inn's fine swills.", $partner); if ($c < 14) { $c++; } } else { output("%s`0 apologizes, \"`^I'm sorry m'lady, I have no money to spare,`0\" as he turns out his moth-riddled pocket.", $partner); if ($c > 0 && $c < 10) { $c--; } } break; case 5: if (e_rand($c, 14) >= 14) { output("You walk up to %s`0, grab him by the shirt, pull him to his feet, and plant a firm, long kiss right on his handsome lips.", $partner); output("He collapses after, hair a bit disheveled, and short on breath."); if ($c < 18) { $c++; } } else { output("You duck down to kiss %s`0 on the lips, but just as you do so, he bends over to tie his shoe.", $partner); if ($c > 0 && $c < 13) { $c--; } } break; case 6: if (e_rand($c, 18) >= 18) { output("Standing at the base of the stairs, you make a come-hither gesture at %s`0.", $partner); output("He follows you like a puppydog."); if ($session['user']['turns'] > 0) { output("You feel exhausted!"); $session['user']['turns'] -= 2; if ($session['user']['turns'] < 0) { $session['user']['turns'] = 0; } } addnews("`@%s`@ and %s`@ were seen heading up the stairs in the inn together.`0", $session['user']['name'], $partner); if ($c < 25) { $c++; } } else { output("\"`^I'm sorry m'lady, but I have a show in 5 minutes`0\""); if ($c > 0) { $c--; } } break; case 7: output("Walking up to %s`0, you simply demand that he marry you.`n`n", $partner); output("He looks at you for a few seconds.`n`n"); if ($c >= 22) { output("\"`^Of course my love!`0\" he says."); output("The next weeks are a blur as you plan the most wonderous wedding, paid for entirely by %s`0, and head on off to the deep forest for your honeymoon.", $partner); addnews("`&%s`& and %s`& are joined today in joyous matrimony!!!", $session['user']['name'], $partner); $session['user']['marriedto'] = INT_MAX; apply_buff('lover', lovers_getbuff()); } else { output("%s`0 says, \"`^I'm sorry, apparently I've given you the wrong impression, I think we should just be friends.`0\"", $partner); output("Depressed, you feel very disinclined to do much for the rest of today."); $session['user']['turns'] = 0; debuglog("lost all turns after being rejected for marriage."); } break; } //end switch if ($c > $session['user']['charm']) { output("`n`n`^You gain a charm point!"); } if ($c < $session['user']['charm']) { output("`n`n`\$You LOSE a charm point!"); } $session['user']['charm'] = $c; } //end if } //end if } else { //have seen lover output("You think you had better not push your luck with %s`0 today.", $partner); } set_module_pref("seenlover", $seenlover); }
$session['user']['location'] = $vname; } page_header(array("%s", sanitize($iname))); $skipinndesc = handle_event("inn"); if (!$skipinndesc) { checkday(); rawoutput("<span style='color: #9900FF'>"); output_notl("`c`b"); output($iname); output_notl("`b`c"); } $subop = httpget('subop'); $com = httpget('comscroll'); $comment = httppost('insertcommentary'); require_once "lib/partner.php"; $partner = get_partner(); addnav("Other"); villagenav(); addnav("I?Return to the Inn", "inn.php"); switch ($op) { case "": case "strolldown": case "fleedragon": require "lib/inn/inn_default.php"; blocknav("inn.php"); break; case "converse": commentdisplay("You stroll over to a table, place your foot up on the bench and listen in on the conversation:`n", "inn", "Add to the conversation?", 20); break; case "bartender": require "lib/inn/inn_bartender.php";
function get_effect($item = false, $noeffecttext = "", $giveoutput = true) { global $session; tlschema("inventory"); $out = array(); if ($item === false) { if ($noeffecttext == "") { $args = modulehook("item-noeffect", array("msg" => "`&Nothing happens.`n", "item" => $item)); $out[] = sprintf_translate($args['msg']); } else { $out[] = sprintf_translate($noeffecttext); } } else { eval($item['execvalue']); if (isset($hitpoints) && $hitpoints != 0) { if (!isset($override_maxhitpoints)) { $override_maxhitpoints = false; } if ($hitpoints > 0) { if ($session['user']['hitpoints'] >= $session['user']['maxhitpoints'] && $override_maxhitpoints == false) { } else { if ($session['user']['hitpoints'] + $hitpoints > $session['user']['maxhitpoints'] && $override_maxhitpoints == false) { $session['user']['hitpoints'] = $session['user']['maxhitpoints']; $out[] = sprintf_translate("`^Your hitpoints have been `@fully`^ restored.`n"); } else { if ($override_maxhitpoints == false) { $hitpoints = min($session['user']['maxhitpoints'] - $session['user']['hitpoints'], $hitpoints); } if ($hitpoints > 0) { $session['user']['hitpoints'] += $hitpoints; $out[] = sprintf_translate("`^You have been `@healed`^ for %s points.`n", $hitpoints); } } } } else { if ($hitpoints < 0) { if ($session['user']['hitpoints'] + $hitpoints > 0) { output("`^You `4loose`^ %s hitpoints.", abs($hitpoints)); $session['user']['hitpoints'] += $hitpoints; } else { if (!$killable) { $session['user']['hitpoints'] = 1; $out[] = sprintf_translate("`^You were `\$almost`^ killed.`n"); } else { $experience = -$killable / 100; $session['user']['hitpoints'] = 0; $session['user']['alive'] = 0; $out[] = sprintf_translate("`\$You die.`n"); } } } } } if (isset($turns) && $turns != 0) { $session['user']['turns'] += $turns; debuglog("'s turns were altered by {$turns} by item {$item['itemid']}."); if ($turns > 0) { if ($turns == 1) { $out[] = sprintf_translate("`^You `@gain`^ one turn.`n"); } else { $out[] = sprintf_translate("`^You `@gain`^ %s turns.`n", $turns); } } else { if ($session['user']['turns'] <= 0) { $out[] = sprintf_translate("`^You `\$lose`^ all your turns.`n"); $session['user']['turns'] = 0; } else { if ($turns == -1) { $out[] = sprintf_translate("`^You `\$lose`^ one turn.`n"); } else { $out[] = sprintf_translate("`^You `\$lose`^ %s turns.`n", abs($turns)); } } } } if (isset($attack) && $attack != 0) { $session['user']['attack'] += $attack; debuglog("'s attack was altered by {$attack} by item {$item['itemid']}."); if ($attack > 0) { $out[] = sprintf_translate("`^Your attack is `@increased`^ by %s.`n", $attack); } else { if ($session['user']['attack'] <= 1) { $out[] = sprintf_translate("`^You `\$lose`^ all your attack except the strength of your bare fists.`n"); $session['user']['attack'] = 1; } else { $out[] = sprintf_translate("`^Your attack is `\$decreased`^ by %s.`n", abs($attack)); } } } if (isset($defense) && $defense != 0) { $session['user']['defense'] += $defense; debuglog("'s defense was altered by {$defense} by item {$item['itemid']}."); if ($defense > 0) { $out[] = sprintf_translate("`^Your defense is `@increased`^ by %s.`n", $defense); } else { if ($session['user']['defense'] <= 1) { $out[] = sprintf_translate("`^You `\$lose`^ all your defense except the durability of your everpresent T-Shirt.`n"); $session['user']['defense'] = 1; } else { $out[] = sprintf_translate("`^Your defense is `\$decreased`^ by %s.`n", abs($defense)); } } } if (isset($charm) && $charm != 0) { $session['user']['charm'] += $turns; if ($charm > 0) { $out[] = sprintf_translate("`^Your charm is `@increased`^ by %s.`n", $charm); } else { if ($session['user']['charm'] <= 0) { $out[] = sprintf_translate("`^You `\$lose`^ all your charm.`n"); $session['user']['charm'] = 0; } else { $out[] = sprintf_translate("`^Your charm is `\$decreased`^ by %s.`n", abs($charm)); } } } if (isset($maxhitpoints) && $maxhitpoints != 0) { if ($maxhitpoints > 0) { $session['user']['maxhitpoints'] += $maxhitpoints; $out[] = sprintf_translate("`^Your maximum hitpoints are permanently `@increased`^ by %s.`n", $maxhitpoints); } else { reset($session['user']['dragonpoints']); $hp = 0; while (list($key, $val) = each($session['user']['dragonpoints'])) { if ($val == "hp") { $dkhp++; } } $minhp = $session['user']['level'] * 10 + $hp * 5; if ($session['user']['maxhitpoints'] + $maxhitpoints < $minhp) { $maxhitpoints = $session['user']['maxhitpoints'] - $minhp; } if ($maxhitpoints < 0) { $out[] = sprintf_translate("`^Your maximum hitpoints are permanently `\$decreased`^ by %s.`n", abs($maxhitpoints)); $session['user']['maxhitpoints'] += $maxhitpoints; } } } if (isset($uses)) { $modules = modulehook("specialtymodules"); $names = modulehook("specialtynames"); if (is_array($uses)) { while (list($key, $val) = each($uses)) { if ($val > 0) { if ($val == 1) { $out[] = sprintf_translate("`^You `@gain`^ one point in %s.`n", $val, $names[$key]); } else { $out[] = sprintf_translate("`^You `@gain`^ %s points in %s.`n", $val, $names[$key]); } } else { $val = min(abs($val), get_module_pref("uses", $modules[$key])); if ($val == 1) { $out[] = sprintf_translate("`^You `\$lose`^ one point in %s.`n", $val, $names[$key]); } else { $out[] = sprintf_translate("`^You `\$lose`^ %s points in %s.`n", $val, $names[$key]); } $val *= -1; } increment_module_pref("uses", $val, $modules[$key]); } } else { if ($uses == 'looseall') { while (list($key, $val) = each($modules)) { set_module_pref("uses", 0, $val); } $out[] = "`^You `\$lose all`^ uses in `\$all`^ specialties.`n"; } else { if (is_numeric($uses) && $uses > 0 && $session['user']['specialty'] != "") { increment_module_pref("uses", $uses, $modules[$session['user']['specialty']]); $out[] = sprintf_translate("`^You `@gain`^ %s points in %s.`n", $uses, $names[$session['user']['specialty']]); } else { if (is_numeric($uses) && $session['user']['specialty'] != "") { $out[] = sprintf_translate("`^You `\$lose`^ %s points in %s.`n", $uses, $names[$key]); } } } } } if (isset($increment_specialty) && $increment_specialty > 0) { require_once "lib/increment_specialty.php"; while ($increment_specialty) { increment_specialty("`^"); $increment_specialty--; } $giveoutput = false; } if (isset($gems) && $gems != 0) { $session['user']['gems'] += $gems; debuglog("'s gems were altered by {$gems} by item {$item['itemid']}."); if ($gems > 0) { if ($gems == 1) { $out[] = sprintf_translate("`^You `@gain`^ one gem.`n"); } else { $out[] = sprintf_translate("`^You `@gain`^ %s gems.`n", $gems); } } else { $gems = min(abs($gems), $session['user']['gems']); if ($gems == 1) { $out[] = sprintf_translate("`^You `\$lose`^ one gem.`n", $gems); } else { $out[] = sprintf_translate("`^You `\$lose`^ %s gems.`n", $gems); } } } if (isset($gold) && $gold != 0) { $session['user']['gold'] += $gold; debuglog("'s gold were altered by {$gold} by item {$item['itemid']}."); if ($gold > 0) { $out[] = sprintf_translate("`^You `@gain`^ %s gold.`n", $gold); } else { $gold = min(abs($gold), $session['user']['gold']); $out[] = sprintf_translate("`^You `\$lose`^ %s gold.`n", $gold); } } if (isset($experience) && $experience != 0) { if (is_float($experience)) { $bonus = round($session['user']['experience'] * $experience, 0); } else { $bonus = $experience; } $session['user']['experience'] += $experience; debuglog("'s experience was altered by {$bonus} by item {$item['itemid']}."); if ($bonus > 0) { $out[] = sprintf_translate("`^You `@gain`^ %s experience.`n", $bonus); } else { $bonus = min(abs($bonus), $session['user']['experience']); $out[] = sprintf_translate("`^You `\$lose`^ %s experience.`n", $bonus); } } if (isset($deathpower) && $deathpower != 0) { $session['user']['deathpower'] += $deathpower; if ($deathpower > 0) { $out[] = sprintf_translate("`^You `@gain`^ %s favor with `\$Ramius`0.`n", $deathpower); } else { $deathpower = min(abs($deathpower), $session['user']['deathpower']); $out[] = sprintf_translate("`^You `\$lose`^ %s favor with `\$Ramius`0.`n", $deathpower); } } if (isset($gravefights) && $gravefights != 0) { $session['user']['gravefights'] += $gravefights; if ($gravefights > 0) { $out[] = sprintf_translate("`^You `@gain`^ %s gravefights.`n", $gravefights); } else { $deathpower = min(abs($gravefights), $session['user']['gravefights']); $out[] = sprintf_translate("`^You `\$lose`^ %s gravefights.`n", $gravefights); } } if (isset($extraflirt) && is_module_active("lovers") && $extraflirt == true && get_module_pref("seenlover", "lovers")) { set_module_pref("seenlover", false, "lovers"); $him = sprintf_translate("him"); $her = sprintf_translate("her"); require_once "lib/partner.php"; $out[] = sprintf_translate("`^You miss %s`^ and want to see %s again.`n", get_partner(), $session['user']['sex'] ? $him : $her); } if (isset($extratravel) && is_module_active("cities") && $extratravel != 0) { increment_module_pref("traveltoday", -$extratravel, "cities"); if ($extratravel > 0) { $out[] = sprintf_translate("`^You feel `@refreshed`^."); $out[] = sprintf_translate("`^You may travel %s times `@more`^ today.`n", $extratravel); } else { $out[] = sprintf_translate("`^You feel `\$tired`^."); $out[] = sprintf_translate("`^You may travel %s times `\$less`^ today.`n", $extratravel); } } if (isset($buff) && is_array($buff)) { require_once "lib/buffs.php"; apply_buff("item-{$item['itemid']}", $buff); $out[] = sprintf_translate("`^Something feels strange within your body.`n"); } if (isset($extrabuff) && is_array($extrabuff)) { require_once "lib/buffs.php"; while (list($key, $val) = each($extrabuff)) { if (has_buff($key)) { while (list($vkey, $vval) = each($val)) { $session['bufflist'][$key][$vkey] += $vval; $things = true; } } } if ($things) { $out[] = sprintf_translate("`^You feel something strange happening.`n"); } } if (isset($strip)) { require_once "lib/buffs.php"; if (has_buff($strip)) { strip_buff($strip); $out[] = sprintf_translate("`^You have a weird feeling.`n"); } } } foreach ($out as $index => $text) { if (is_array($text)) { foreach ($text as $sec => $text2) { $newout[] = $text2; } } else { $newout[] = $text; } } $args = modulehook("itemeffect", array("out" => $newout, "item" => $item)); $out = $args['out']; if (count($out) == 0) { if ($noeffecttext == "") { $args = modulehook("item-noeffect", array("msg" => "`&Nothing happens.`n", "item" => $item)); $out[] = sprintf_translate($args['msg']); } else { if ($giveoutput) { $out[] = sprintf_translate($noeffecttext); } } } $effect_text = join($out, ""); tlschema(); return $effect_text; }
function oldhouse_scare() { global $session; require_once "lib/partner.php"; $partner = get_partner(); $person = ""; if (is_module_active("stafflist")) { $sql = "SELECT a.name FROM " . db_prefix("accounts") . " AS a, " . db_prefix("module_userprefs") . " AS m WHERE m.modulename = 'stafflist' AND m.setting = 'rank' AND m.value > 0 AND m.userid = a.acctid ORDER by rand(" . e_rand() . ") LIMIT 1"; $result = db_query($sql); $row = db_fetch_assoc($result); $person = $row['name']; } // Talk will be empty if we don't have a stafflist or if noone is set // as staff if ($person == "") { // These don't get translated since they are proper names. $people = array(getsetting("barkeep", "`tCedrik"), "MightyE"); $person = $people[e_rand(0, count($people) - 1)]; } $suits = array("`)ghost`7", "`4ghoul`7", "huge blow-up `Qpumpkin`7", "`\$pirate`7", "`&skeleton`7", "`%cheerleader`7", "`#clown`7"); $suits = translate_inline($suits); $suit = $suits[e_rand(0, count($suits) - 1)]; $result = e_rand(1, 10); switch ($result) { case 1: output("You look carefully, but see nothing of interest.`n`n"); output("As you turn to leave, something glistens in the corner of your eye.`n`n"); output("You find a `5gem!"); $session['user']['gems']++; break; case 2: case 3: case 4: output("You look carefully, but see nothing of interest.`n`n"); output("As you gaze about, you are amazed to find `^100 gold!"); $session['user']['gold'] += 100; break; case 5: output("A hollow laugh echoes out from somewhere close by.`n`n"); output("The sound is oddly familiar, and you decide to investigate.`n`n"); output("Behind a nearby door, you discover `&%s`7, in a rather awful `&%s `7suit.`n`n", $person, $suit); output("You laugh in good humor and make your way back outside.`n`n"); output("You are `@amused!"); $session['user']['hitpoints'] *= 1.05; break; case 6: output("You have found a pile of heart-shaped chocolates!`n`n"); output("You help yourself to one for yourself, and a second one for %s`7.", $partner); output("You feel `5charming!"); $session['user']['charm']++; break; case 7: output("Before you can even blink, you are confronted by a bizarrely-dressed dancing queen who runs towards you, yelling, \"`&KISS ME!!!`7\"`n`n"); output("You high-tail it out of there and away from the disturbing creature.`n`n"); output("You `4lose `7some charm!"); $session['user']['charm']--; set_module_pref("scaretoday", 1); break; case 8: output("Just as you begin to relax, `&%s`7 jumps out from another doorway and laughs at you, and you nearly wet your pants in fright.`n`n", $person); output("`7You run out of there in a hurry.`n`n"); output("You `4lose `7some of your hitpoints!"); $session['user']['hitpoints'] *= 0.9; if ($session['user']['hitpoints'] < 1) { $session['user']['hitpoints'] = 1; } set_module_pref("scaretoday", 1); break; case 9: output("You look to one side, only to discover a wizened, decaying head that laughs at you as you run away in terror."); output("You `4lose `7some of your hitpoints!"); $session['user']['hitpoints'] *= 0.95; if ($session['user']['hitpoints'] < 1) { $session['user']['hitpoints'] = 1; } set_module_pref("scaretoday", 1); break; case 10: output("An icy hand appears from nowhere, then clutches at your throat and tries to drag you towards it.`n`n"); output("Sobbing in terror, you flee blindly out onto the street.`n`n"); output("You `4lose `7some of your hitpoints!"); $session['user']['hitpoints'] *= 0.9; if ($session['user']['hitpoints'] < 1) { $session['user']['hitpoints'] = 1; } set_module_pref("scaretoday", 1, "oldhouse"); break; } return $args; }
function abigail_runevent($type, $link) { require_once 'lib/partner.php'; global $session; $session['user']['specialinc'] = "module:abigail"; $partner = get_partner(true); $cost = get_module_setting('cost'); $trinket = get_module_pref('trinket'); $op = httpget('op'); switch ($op) { case 'leave': $session['user']['specialinc'] = ''; output("`5Not having any gems to buy a gift for `^%s`5, you wander sadly away.`n`n`0", $partner); addnav('Return to whence you came', $link); break; case 'nope': $session['user']['specialinc'] = ''; output("`7You decide not to buy the %s from Abigail. You are sure that `^%s `7would not like something like that anyways...`n`0", $trinket, $partner); addnav('Return to whence you came', $link); break; case 'shout': $session['user']['specialinc'] = ''; output("Abigail just shakes her head and walks away, leaving you with a feeling of great relief."); set_module_pref('angry', rand(1, 10)); set_module_pref('bought', 1); break; case 'shop': set_module_pref('bought', 1); $session['user']['gems'] -= $cost; debuglog("spent {$cost} gems on a gift for their lover"); output("`7Agreeing to buy the %s, you hand Abigail her payment. ", $trinket); output("`7She beems with glee and darts off, `5\"Do not worry, `^%s`5, I will make sure that `^%s`5 receives your gift!\"`n`n`0", $session['user']['name'], $partner); if ($session['user']['marriedto'] != INT_MAX && $session['user']['marriedto'] != 0) { require_once 'lib/systemmail.php'; $subject = '`%Abigail has delivered a gift to you!'; $body = ["`^%s`2 has delivered a %s as a gift.", $session['user']['name'], $trinket]; systemmail($session['user']['marriedto'], $subject, $body); if (e_rand(1, 100) <= get_module_setting('charm_chance')) { increment_module_pref('liked'); } else { set_module_pref('liked', -1); } } addnav('Return to whence you came', $link); break; default: $session['user']['specialinc'] = ''; $gifts[SEX_FEMALE] = ['pair of cufflinks', 'leather belt', 'hat', 'pair of boots']; $gifts[SEX_MALE] = ['pair of earrings', 'pair of satin slippers', 'jeweled necklace', 'pretty bracelet']; $gifts = modulehook('abigail-gifts', ['gifts' => $gifts]); $gifts[SEX_FEMALE] = translate_inline($gifts['gifts'][SEX_FEMALE]); $gifts[SEX_MALE] = translate_inline($gifts['gifts'][SEX_MALE]); $randomGift = e_rand(0, count($gifts[$session['user']['sex']]) - 1); $trinket = $gifts[$session['user']['sex']][$randomGift]; set_module_pref('trinket', $trinket); output("`7While you are wandering idly, minding your own business, you are approached by a diminutive elf in a green cloak. `n`n`0"); $greeting = translate_inline($session['user']['sex'] ? 'Madam' : 'Sir'); output("\"`&Happy day to ye, %s!", $greeting); output("Can I interest you in a lovely %s for somebody special?", $trinket); output("It's a fine gift, crafted with care and skill!"); if ($cost == 1) { output("And, for you, only `%%s`& gem!`7\"`n`n`0", $cost); } else { output("And, for you, only `%%s`& gems!`7\"`n`n`0", $cost); } output("`7You survey the %s, admiring the fine craftsmanship, and try to imagine `^%s`7 wearing such a gift.", $trinket, $partner); if ($session['user']['gems'] > $cost) { addnav('Purchase this gift', $link . 'op=shop'); addnav('Do not buy anything', $link . 'op=nope'); } else { addnav('Walk away', $link . 'op=leave'); } addnav('Shout at Abigail', $link . 'op=shout'); break; } }
function lovers_getbuff() { global $session; $partner = get_partner(); $buff = array("name" => "`!Lover's Protection", "rounds" => 60, "wearoff" => array("`!You miss %s`!.`0", $partner), "defmod" => 1.2, "roundmsg" => "Your lover inspires you to keep safe!", "schema" => "module-lovers"); return $buff; }
function crying_runevent($type) { global $session; $innname = getsetting("innname", LOCATION_INN); $op = httpget('op'); $session['user']['specialinc'] = "module:crying"; $from = "inn.php?"; require_once "lib/partner.php"; $partner = get_partner(); if ($op == "") { output("`7As you are standing in %s, minding your own business, a woman begins to sob loudly.", $innname); output("You watch as she walks away from %s`7 and over to where her husband is sitting, crying, \"I lost it, and now HE has lost it too! We shall never afford another ring as beautiful as that one!\"`n`n", getsetting("barkeep", "`tCedrik")); output("You watch her as she wrings her hands and cries inconsolably.`n`n"); output("Your hand strays to the piece of jewelry in your pocket, and you wonder whether you should return the ring to her."); output("After all, it might be very valuable, and perhaps you could sell it for gems."); output("You struggle with your conscience, wondering what to do."); set_module_pref("seentoday", 1); addnav("Return the Ring", $from . "op=give"); addnav("Ignore the Lady", $from . "op=ignore"); page_footer(); } elseif ($op == "give") { set_module_pref("ring", 0, "breakin"); $whathappens = e_rand(1, 5); output("You approach the lady and gently touch her shoulder."); output("As she turns around and faces you with teary eyes, you extend your hand and offer the ring.`n`n"); output("Her eyes become saucers, and she grabs the ring in gratitude, before throwing her arms about you in ecstatic gratitude.`n`n"); output("`&\"You are indeed a warrior of true noble heart! Please, accept this gift of my gratitude, and wear it with pride!\""); output("`7She grabs your wrist, and around it ties a leather band that carries a tiger's tooth."); output("You're a little hesitant to accept such a strange gift, but you don't want to offend her, so you thank her and walk away from her table."); set_module_pref("hasbracelet", 1); $upmatt = get_module_pref("upmatt"); // need to check if matthias module exists on this server, and only award astute once if (is_module_active("matthias") && $upmatt == 0) { $astute = get_module_pref("astuteness", "matthias"); $astute += 2; set_module_pref("astuteness", $astute, "matthias"); set_module_pref("upmatt", 1); } if ($whathappens <= 2) { // Seth/Violet sees and approves output("`n`nFrom the other side of the room, %s`7 is watching.`n`n", $partner); if ($session['user']['sex'] == SEX_MALE) { output("She beams at you for your kindheartedness.`n`n"); } else { output("He beams at you for your kindheartedness.`n`n"); } output("`&You gain a charm point!"); $session['user']['charm']++; } elseif ($whathappens == 3) { // Seth/Violet sees and disapproves output("`n`nFrom the other side of the room, %s`7 is watching.`n`n", $partner); if ($session['user']['sex'] == SEX_MALE) { output("She glares at you in jealous anger.`n`n"); } else { output("He glares at you in jealous anger.`n`n"); } output("You `4lose`7 a charm point!"); if ($session['user']['charm'] > 0) { $session['user']['charm']--; } } elseif ($whathappens >= 4) { output("You are so tremendously happy at her reaction, that you feel fantastic!"); // gain feelgood vibes (buff) apply_buff('feelgood', array("name" => "`%Feelgood Vibes", "rounds" => 15, "wearoff" => "You feel normal again.", "atkmod" => 1.05, "roundmsg" => "Your positivity helps you hit harder!", "schema" => "module-crying")); } $session['user']['specialinc'] = ""; } elseif ($op == "ignore") { output("`n`7The lady is still sobbing, but hey, you're a heartless warrior, and you don't care. Right?`n"); $session['user']['specialinc'] = ""; } }
function tatmonster_runevent($type, $link) { global $session; // Handle the case where Petra gets deactivated. if (!is_module_active("petra")) { output("You hear a rustling in the underbrush, which dies away after a few moments.`n`n"); output("When nothing at all happens after a couple of minutes, you continue on your way."); return; } $op = httpget('op'); require_once "lib/partner.php"; $partner = get_partner(); $session['user']['specialinc'] = "module:tatmonster"; $battle = false; switch ($op) { case "": case "search": output("`3Walking down a deserted trail, you hear a rustling sound coming from the bushes."); output("You can smell something burning, and hear something churning."); output("You have no idea if you should check it out, but your curiosity is getting the upper hand."); output("`3As you step closer and closer to the bush, the burning scent gets more pronounced and the churning grows louder and louder.`n`n"); if (get_module_pref("tatnumber", "petra") > 0) { output("You feel a brief burning sensation from the tattoos on your arm, as if they are reacting to something!`n`n"); } output("`3There is a feeling of dread, deep in your bones."); output("Do you want to wait and see what is making the noise, or flee?"); addnav("W?Wait", $link . "op=wait"); addnav("R?Run", $link . "op=flee"); break; case "flee": $charmloss = e_rand(get_module_setting("mincharmloss") * 2, get_module_setting("maxcharmloss") * 2); output("`3Turning around, you hasten back the way you came."); output("With a glance backwards, you see a stray cat come out of the trees.`n`n"); output("Face red with shame, you don't know if you'll ever be able to let %s`3 know that you got scared by a cat!`n`n", $partner); output("You lose %s charm from the shame of your cowardice.", $charmloss); debuglog("lost {$charmloss} charm from cowardice to the tatmonster"); $session['user']['charm'] -= $charmloss; if ($session['user']['charm'] < 0) { $session['user']['charm'] = 0; } $session['user']['specialinc'] = ""; break; case "wait": output("`3You wait for a moment to see what transpires.`n`n"); output("`3Out from the bushes springs the Mighty `#%s`3.", get_module_setting("name")); output("It lashes out with its three slobbering maws, each of them snarling and growling."); output("As you rear back in fear, one of the powerful heads narrowly misses you with its teeth.`n"); output("Circling around you, the beast blocks your escape!`n"); addnav("Fight", $link . "op=pre"); break; case "pre": $op = "fight"; httpset("op", $op); // accommodate for data left from older versions of petra require_once "modules/petra.php"; petra_calculate(); // Lets build the Tat Monster NOW! $numtats = get_module_pref("tatpower", "petra"); if ($session['user']['dragonkills'] <= get_module_setting("dk")) { $numtats += get_module_setting("grace"); } $hpl = get_module_setting("hploss") * $numtats; // the test needs to be changed so that it no longer // either assumes that one can only obtain ten tattoos, // or that $numtats is an integer // JT: changed to 8.4 so existing behaviour was preserved. if (floor($numtats) == $session['user']['dragonkills'] || $numtats >= 8.4) { $monhp = round($session['user']['maxhitpoints'] * 1.1) - $hpl; $monatk = round($session['user']['attack'] * 1.05); $mondef = round($session['user']['defense'] * 1.05); } else { $monhp = round($session['user']['maxhitpoints'] * 1.5) - $hpl; $monatk = round($session['user']['attack'] * 1.15); $mondef = round($session['user']['defense'] * 1.15); } // If we have too small hp, then just set the monster = to // the players hitpoints + 20 %. if ($monhp <= 10) { $monhp = round($session['user']['maxhitpoints'] * 1.2); } // even out his strength a bit $badguylevel = $session['user']['level'] + 1; if ($session['user']['level'] > 9) { $monhp *= 1.05; } if ($session['user']['level'] > 3) { $badguylevel--; } $badguy = array("creaturename" => translate_inline(get_module_setting("name")), "creatureweapon" => translate_inline("Slobbering Maws"), "creaturelevel" => $session['user']['level'] + 1, "creaturehealth" => round($monhp), "creatureattack" => $monatk, "creaturedefense" => $mondef, "noadjust" => 1, "diddamage" => 0); $attackstack = array("enemies" => array($badguy), "options" => array("type" => "tattoomonster")); $session['user']['badguy'] = createstring($attackstack); break; } if ($op == "fight") { $battle = true; } if ($battle) { include "battle.php"; if ($victory) { output("`n`n`3You have overcome the beast!"); output("The sensation in your arms slowly fades, and you return to normal.`n`n"); output("You approach this three-headed monstrosity, to ensure that it truly is dead."); output("As you near it, one of its heads slowly opens an eye!"); if (get_module_pref("tatnumber", "petra") > 0) { output("It catches sight of the tattoos on your arms and recoils in horror!"); } output("It twitches some more, and you realize that you have done well even to subdue it, and you had best not remain to give it another chance when it recovers.`n`n"); if ($session['user']['hitpoints'] <= 0) { output("`^With the last of your energy, you press a piece of cloth to your wounds, stopping your bloodloss before you are completely dead.`n"); $session['user']['hitpoints'] = 1; } $exp = round($session['user']['experience'] * get_module_setting("expgain")); // even out the gain a bit... it was too huge at the top and pathetic at the bottom if ($session['user']['level'] > 9) { $exp *= 0.8; } if ($session['user']['level'] < 6) { $exp *= 1.2; } if ($session['user']['level'] == 1) { $exp += 20; } // to stop people sometimes gaining 2 xp $exp = round($exp); output("`3Achieving this grand feat, you receive `^%s `3experience.`0", $exp); $session['user']['experience'] += round($exp); $badguy = array(); $session['user']['badguy'] = ""; $session['user']['specialinc'] = ""; } elseif ($defeat) { $badguy = array(); $session['user']['badguy'] = ""; $session['user']['specialinc'] = ""; output("`n`n`3With one final crushing blow, the beast levels you."); if ($session['user']['gold'] > 10) { output("As the blood escapes your body, your purse splits and yields some of your gold."); $lost = round($session['user']['gold'] * 0.2, 0); $session['user']['gold'] -= $lost; debuglog("lost {$lost} gold to the tatmonster"); } $exp = round($session['user']['experience'] * get_module_setting("expgain")); output("Feeling the pain of loss, you lose `^%s `3experience.`0", $exp); $session['user']['experience'] -= $exp; if (e_rand(0, 2) == 2) { $charmloss = e_rand(get_module_setting("mincharmloss"), get_module_setting("maxcharmloss")); output("The beast leaves a long, jagged scar on your skin, causing you to lose `5%s `3charm.`0", $charmloss); $session['user']['charm'] -= $charmloss; debuglog("lost {$charmloss} charm to the tatmonster"); if ($session['user']['charm'] < 0) { $session['user']['charm'] = 0; } } output("You are able to cling to life... but just barely.`0"); $session['user']['hitpoints'] = 1; } else { require_once "lib/fightnav.php"; if ($type == "forest") { fightnav(true, false); } else { fightnav(true, false, $link); } } } }
function ella_run() { global $session; $op = httpget("op"); require_once "lib/partner.php"; $partner = get_partner(); $candance = get_module_pref("candance"); $dkhp = 0; while (list($key, $val) = each($session['user']['dragonpoints'])) { if ($val == "hp") { $dkhp++; } } $maxhitpoints = 10 * $session['user']['level'] + $dkhp * 5; suspend_temp_stats(); if ($session['user']['maxhitpoints'] < $maxhitpoints + get_module_setting("hitpointcost")) { $notenough = true; } else { $notenough = false; } restore_temp_stats(); page_header("Dance Studio"); output("`&`c`bLady Ella's Dance Studio`b`c"); if (!$candance) { output("`7Your muscles are still too stiff and sore from your last lesson.`n"); output("`7Perhaps in a day or so, you'll feel up to another lesson."); } elseif ($notenough) { output("`7You don't feel like you could take a lesson with Ella today.`n"); output("`7Perhaps if your constitution has risen a bit."); } elseif ($op == "") { output("`7A statuesque teacher in intricately-beaded garb stands at one end of a small studio, intently watching the movements of the dancers in the room."); output("Partnered and solo dancers sway and spin in fast rhythms, matching their movements to the piano that sings from one side of the room, where a delicate Felyne moves her paws to create the sound.`n`n"); output("Noting your interest, Lady Ella smiles at you as she walks towards you.`n`n"); output("\"`&Lovely movement, everyone, keep going, I'll have you all as polished performers yet!`7\"`n`n"); output("`7She approaches you and beckons you into her office."); $cost = get_module_setting("turncost"); if ($session['user']['turns'] >= $cost) { output("Once there, she explains what she can offer."); output("\"`&You'll like our lessons very much."); output("We pride ourselves in making sure it's fun AND helpful."); output("Who knows, you might land the %s of your dreams!`n`n", translate_inline($session['user']['sex'] ? "man" : "girl")); output("Now, it takes a lot of time and effort to learn to dance, so you can't expect to have nearly as much time for galivanting around the forest."); if ($session['user']['sex']) { output("So, are you sure you want to make that commitment and learn to make the men chase you?`7\""); } else { output("So, are you sure you want to make that commitment and learn to sweep the ladies off their feet?`7\""); } output("`qYou realize she's asking for a sacrifice of time you would normally spend hunting in the forest."); output("`qYou ponder for a moment on whether you want to make that large a commitment."); addnav(array("Take Lesson (%s %s)", $cost, translate_inline($cost == 1 ? "turn" : "turns")), "runmodule.php?module=ella&op=dance"); } else { output("Once there, she regards you gravely."); output("\"`&Darling, there's nothing I love more than teaching someone the love of the dance."); output("I'd be more than happy to let you watch, but by the looks of how tired out you are, you'd fall over from the exertion of actually dancing with us today.`7\"`n`n"); output("You nod your understanding, that you perhaps need more free time to get the most out of the strenuous training she has to offer."); } } else { output("`7You agree to take a dancing lesson today, and eagerly move forward to join the other dancers.`n`n"); output("The music begins slowly, giving you the chance to start gradually, but it quickly becomes difficult and tiring."); output("You're not sure how impressed %s`7 would be with your efforts, but you're determined not to give up too easily.`n`n", $partner); output("After the lesson concludes, you feel weary, and wonder whether you have the strength to keep this up for many weeks to come."); output("You sure hope %s`7 appreciates your efforts today.`n`n", $partner); output("You feel `5charming!`n"); $turncost = (int) get_module_setting("turncost"); $hitpointcost = (int) get_module_setting("hitpointcost"); if ($turncost > 0 && $hitpointcost > 0) { output("Your efforts had their price."); output("You feel a little tired and not that enduring anymore."); } else { if ($turncost > 0) { output("Your efforts had their price."); output("You feel a little tired."); } else { if ($hitpointcost > 0) { output("Your efforts had their price."); output("You feel not that enduring anymore."); } } } debuglog("lost {$turncost} turns and {$hitpointcost} maxhitpoints for taking a dancing lesson."); $session['user']['turns'] -= $turncost; $session['user']['maxhitpoints'] -= $hitpointcost; if ($session['user']['maxhitpoints'] < $session['user']['level'] * 10) { $session['user']['maxhitpoints'] = $session['user']['level'] * 10; } $session['user']['charm'] += get_module_setting("charmgain"); set_module_pref("candance", 0); $danceday = get_module_setting("danceday"); set_module_pref("dayswait", $danceday); } villagenav(); page_footer(); }
function lovers_violet() { global $session; $seenlover = get_module_pref("seenlover"); $partner = get_partner(); if ($seenlover == 0) { if ($session['user']['marriedto'] == INT_MAX) { if (e_rand(1, 4) == 1) { switch (e_rand(1, 4)) { case 1: $msg = translate_inline("being too busy serving these pigs,"); break; case 2: $msg = translate_inline("\"that time of month,\""); break; case 3: $msg = translate_inline("\"a little cold... *cough cough* see?\""); break; case 4: $msg = translate_inline("men all being pigs,"); break; } output("You head over to cuddle %s`0 and kiss her about the face and neck, but she grumbles something about %s and with a comment like that, you storm away from her!`n`n", $partner, $msg); $session['user']['charm']--; output("`^You LOSE a charm point!"); } else { output("You and %s`0 take some time to yourselves, and you leave the inn, positively glowing!", $partner); apply_buff('lover', lovers_getbuff()); $session['user']['charm']++; output("`n`n`^You gain a charm point!"); } $seenlover = 1; } elseif (httpget('flirt') == "") { output("You stare dreamily across the room at %s`0, who leans across a table to serve a patron a drink.", $partner); output("In doing so, she shows perhaps a bit more skin than is necessary, but you don't feel the need to object."); addnav("Flirt"); addnav("Wink", "runmodule.php?module=lovers&op=flirt&flirt=1"); addnav("Kiss her hand", "runmodule.php?module=lovers&op=flirt&flirt=2"); addnav("Peck her on the lips", "runmodule.php?module=lovers&op=flirt&flirt=3"); addnav("Sit her on your lap", "runmodule.php?module=lovers&op=flirt&flirt=4"); addnav("Grab her backside", "runmodule.php?module=lovers&op=flirt&flirt=5"); addnav("Carry her upstairs", "runmodule.php?module=lovers&op=flirt&flirt=6"); addnav("Marry her", "runmodule.php?module=lovers&op=flirt&flirt=7"); } else { $c = $session['user']['charm']; $seenlover = 1; switch (httpget('flirt')) { case 1: if (e_rand($c, 2) >= 2) { output("You wink at %s`0, and she gives you a warm smile in return.", $partner); if ($c < 4) { $c++; } } else { output("You wink at %s`0, but she pretends not to notice.", $partner); } break; case 2: output("You stroll confidently across the room toward %s`0.", $partner); if (e_rand($c, 4) >= 4) { output("Taking hold of her hand, you kiss it gently, your lips remaining for only a few seconds."); output("%s`0 blushes and tucks a strand of hair behind her ear as you walk away, then presses the back side of her hand longingly against her cheek while watching your retreat.", $partner); if ($c < 7) { $c++; } } else { output("You reach out to grab her hand, but %s`0 takes her hand back and asks if perhaps you'd like a drink.", $partner); } break; case 3: output("Standing with your back against a wooden column, you wait for %s`0 to wander your way when you call her name.", $partner); if (e_rand($c, 7) >= 7) { output("She approaches, a hint of a smile on her face."); output("You grab her chin, lift it slightly, and place a firm but quick kiss on her plump lips."); if ($c < 11) { $c++; } } else { output("She smiles and apologizes, insisting that she is simply too busy to take a moment from her work."); } break; case 4: output("Sitting at a table, you wait for %s`0 to come your way.", $partner); if (e_rand($c, 11) >= 11) { output("When she does so, you reach up and grab her firmly by the waist, pulling her down on to your lap."); output("She laughs and throws her arms around your neck in a warm hug before thumping you on the chest, standing up, and insisting that she really must get back to work."); if ($c < 14) { $c++; } } else { output("When she does so, you reach up to grab her by the waist, but she deftly dodges, careful not to spill the drink that she's carrying."); if ($c > 0 && $c < 10) { $c--; } } break; case 5: output("Waiting for %s`0 to brush by you, you firmly palm her backside.", $partner); if (e_rand($c, 14) >= 14) { output("She turns and gives you a warm, knowing smile."); if ($c < 18) { $c++; } } else { output("She turns and slaps you across the face. Hard."); output("Perhaps you should go a little slower."); if ($c > 0 && $c < 13) { $c--; } } break; case 6: if (e_rand($c, 18) >= 18) { output("Like a whirlwind, you sweep through the inn, grabbing %s`0, who throws her arms around your neck, and whisk her upstairs to her room there.", $partner); output("Not more than 10 minutes later you stroll down the stairs, smoking a pipe, and grinning from ear to ear."); if ($session['user']['turns'] > 0) { output("You feel exhausted! "); $session['user']['turns'] -= 2; if ($session['user']['turns'] < 0) { $session['user']['turns'] = 0; } } addnews("`@%s`@ and %s`@ were seen heading up the stairs in the inn together.`0", $session['user']['name'], $partner); if ($c < 25) { $c++; } } else { output("Like a whirlwind, you sweep through the inn, and grab for %s`0.", $partner); output("She turns and slaps your face!"); output("\"`%What sort of girl do you think I am, anyhow?`0\" she demands! "); if ($c > 0) { $c--; } } break; case 7: output("%s`0 is working feverishly to serve patrons of the inn.", $partner); output("You stroll up to her and take the mugs out of her hand, placing them on a nearby table."); output("Amidst her protests you kneel down on one knee, taking her hand in yours."); output("She quiets as you stare up at her and utter the question that you never thought you'd utter."); output("She stares at you and you immediately know the answer by the look on her face.`n`n"); if ($c >= 22) { output("It is a look of exceeding happiness."); output("\"`%Yes!`0\" she says, \"`%Yes, yes yes!!!`0\""); output("Her final confirmations are buried in a flurry of kisses about your face and neck.`n`n"); output("The next days are a blur; you and %s`0 are married in the abbey down the street, in a gorgeous ceremony with many frilly girly things.", $partner); addnews("`&%s`& and %s`& are joined today in joyous matrimony!!!", $session['user']['name'], $partner); $session['user']['marriedto'] = INT_MAX; apply_buff('lover', lovers_getbuff()); } else { output("It is a look of sadness."); output("\"`%No`0,\" she says, \"`%I'm not yet ready to settle down`0.\"`n`n"); output("Disheartened, you no longer possess the will to do much of anything today."); $session['user']['turns'] = 0; debuglog("lost all turns after being rejected for marriage."); } } if ($c > $session['user']['charm']) { output("`n`n`^You gain a charm point!"); } if ($c < $session['user']['charm']) { output("`n`n`\$You LOSE a charm point!"); } $session['user']['charm'] = $c; } } else { output("You think you had better not push your luck with %s`0 today.", $partner); } set_module_pref("seenlover", $seenlover); }
function marriage_divorce() { global $session; $who = $session['user']['marriedto']; if ($who == 0) { return; } else { if ($who == INT_MAX) { require_once "lib/partner.php"; $getpartner = get_partner(false); $session['user']['marriedto'] = 0; addnews("`&%s`% and `&%s`% were divorced today...", $session['user']['name'], $getpartner); debuglog("got divorced from {$getpartner} today."); return; } } $session['user']['marriedto'] = 0; $sql = "SELECT name,sex FROM " . db_prefix("accounts") . " WHERE acctid='{$who}' AND locked=0"; $res = db_query($sql); if (db_num_rows($res) < 1) { return; } $row = db_fetch_assoc($res); $sql = "UPDATE " . db_prefix("accounts") . " SET marriedto='0' WHERE acctid='{$who}'"; db_query($sql); if (get_module_setting("dmoney") > 0) { $gold = round($session['user']['gold'] * get_module_setting("dmoney") / 100); } $mailmessage = array("`^%s`@ has divorced you.", $session['user']['name']); $mailmessagg = array("`^%s`@ has divorced you.`n`nYou get `^%s gold`@.", $session['user']['name'], $gold); $t = array("`@Divorce!"); addnews("`&%s`0`% and `&%s`% were divorced today...", $session['user']['name'], $row['name']); debuglog($session['user']['login'] . " got a divorce from {$row['name']}", $who, $session['user']['acctid']); debuglog($session['user']['login'] . " got a divorce from {$row['name']}", $session['user']['acctid'], $who); require_once "lib/systemmail.php"; if (get_module_setting('dmoney') > 0 && $gold > 0) { $sql = "UPDATE " . db_prefix("accounts") . " SET gold=gold + " . $gold . " WHERE acctid='{$who}'"; $session['user']['gold'] = 0; db_query($sql); systemmail($who, $t, $mailmessagg); output_notl("`n`n"); output("`@You notice also that all your gold at hand is gone... \"`&I need this to make myself a new home, thanks...`@\"`n"); } else { systemmail($who, $t, $mailmessage); } output("`n`@You feel guilty about the divorce."); invalidatedatacache("marriage-marriedonline"); invalidatedatacache("marriage-marriedrealm"); set_module_objpref("marriage", $who, "marriagedate", "0000-00-00 00:00:00"); set_module_objpref("marriage", $session['user']['acctid'], "marriagedate", "0000-00-00 00:00:00"); //Check to make sure the divorced gets a negative buff the next day; otherwise no more marriage buff anymore $allprefsr = unserialize(get_module_pref('allprefs', 'marriage', $who)); if (get_module_setting("acceptbuff") == 1) { $allprefsr['received'] = 2; } else { $allprefsr['received'] = 0; } set_module_pref('allprefs', serialize($allprefsr), 'marriage', $who); //prevent from getting the marriage buff anymore $allprefs = unserialize(get_module_pref('allprefs')); $allprefs['received'] = 0; set_module_pref('allprefs', serialize($allprefs)); apply_buff('marriage-divorce', array("name" => "`4Divorce Guilt", "rounds" => 100, "wearoff" => "`\$You feel no longer guilty about your divorce.", "defmod" => 0.83, "survivenewday" => 1, "roundmsg" => "`\$Guilt haunts you.")); }