function mapchat_run()
{
    global $session;
    $xyz = httpget('xyz');
    page_header("Tent!");
    output("There's a tent here!");
    require_once "lib/commentary.php";
    addcommentary();
    viewcommentary("worldmap" . $xyz, "Map Chat!", 25);
    addnav("Go Back", "runmodule.php?module=worldmapen&op=continue");
    page_footer();
}
function fourthwall_run()
{
    global $session;
    page_header("The Place Behind the Fourth Wall");
    output("Much like the pleasant gardens of Common Ground, The Place Behind the Fourth Wall has an entry point from every Outpost on the Island.  Contestants may enter The Place Behind the Fourth Wall, or Location Four as it is officially known, from any Outpost - but may only return to the Outpost from which they came in.`n`nIt is a bright, blurry place, where it's rather difficult to focus on anything other than the other contestants - and even then, some find it easier to shut their eyes and simply talk and listen.`n`nIn contrast to Common Ground, The Place Behind the Fourth Wall is an area for out-of-character conversations, real-life chat, giving and receiving help with the game, and so on.  As always, official bug reports may be posted in the Enquirer - this isn't the place for them, as conversations can go too quickly for staff to find bug reports.`n`nPlease, no roleplaying in Location Four - the whole rest of the Island is a better place for that.`n`nHave fun!");
    require_once "lib/commentary.php";
    addcommentary();
    viewcommentary("fourthwall", "Chatty Chat Chat");
    addnav("Return");
    addnav("Back to the Outpost", "village.php");
    page_footer();
}
function forestchat_run()
{
    global $session;
    page_header("Who is here?");
    output("You look around yourself to see if there are any warriors nearby who you can chinwag with.`n`n");
    require_once "lib/commentary.php";
    addcommentary();
    $loc = substr($session['user']['location'], 0, 10);
    viewcommentary("forest-" . $loc, "Chat with others who walk this path...", 25);
    addnav("Continue");
    addnav("Back to the Jungle", "forest.php");
    page_footer();
}
function worldmapchat_run()
{
    global $session;
    page_header("Who is here?");
    output("Because the more out-of-the-way areas of Improbable Island can provide a shred more privacy than the town squares, you can sometimes find people hanging around and just chatting.  If, that is, they've not hidden themselves too well.`n`nYou look around yourself to see if there are any travellers nearby who you can chinwag with.`n`n");
    require_once "lib/commentary.php";
    addcommentary();
    $loc = get_module_pref("worldXYZ", "worldmapen");
    viewcommentary("worldmap-" . $loc, "Chat with others who walk this path...", 25);
    addnav("Continue your Journey");
    addnav("Back to the World Map", "runmodule.php?module=worldmapen&op=continue");
    page_footer();
}
function biochat_dohook($hookname, $args)
{
    global $session;
    switch ($hookname) {
        case "bioend":
            require_once "lib/commentary.php";
            output("`n`n`0%s`0's Natter feed:`n", $args['name']);
            addcommentary();
            $section = "bio-" . $args['acctid'];
            viewcommentary($section, "Natter!", 25);
            if (!strpos(httpget('ret'), "bio.php")) {
                set_module_pref("lastplace", httpget('ret'));
            }
            $sql = "SELECT COUNT(commentid) AS totalcomments FROM " . db_prefix("commentary") . " WHERE section='{$section}'";
            $result = db_query($sql);
            $row = db_fetch_assoc($result);
            $all = $row['totalcomments'];
            set_module_pref("total", $all, "biochat", $args['acctid']);
            if ($args['acctid'] == $session['user']['acctid']) {
                //this is the player looking at his or her own bio
                set_module_pref("seen", $all);
            }
            $return = get_module_pref("lastplace");
            if ($return) {
                $return = substr($return, strrpos($return, "/") + 1);
                addnav("Been clicking around Bios and Nattering for a while?");
                addnav("Go `iright`i back to where you came from", $return);
            }
            debug($return);
            break;
        case "commentaryoptions":
            if (!strpos($_SERVER['REQUEST_URI'], "char=" . $session['user']['acctid'] . "&")) {
                $link = "bio.php?char=" . $session['user']['acctid'] . "&ret=" . URLEncode($_SERVER['REQUEST_URI']);
                $total = get_module_pref("total");
                $seen = get_module_pref("seen");
                output("<a href=\"{$link}\">View my Bio</a> ", true);
                if ($seen != $total) {
                    $new = $total - $seen;
                    if ($new == 1) {
                        output("(1 unread Natter) ");
                    } else {
                        output("(%s unread Natters) ", $new);
                    }
                }
                addnav("", $link);
            }
            break;
    }
    return $args;
}
        }
        //remove this before going live!
        //addnav("Cheat","runmodule.php?module=improbablehousing&op=cheat&hid=$hid&rid=$rid");
    } else {
        output("This dwelling is not yet completed, and doesn't have any rooms to speak of.`n`n");
    }
    improbablehousing_show_build_jobs($house, $rid);
    addnav("Building Materials");
    addnav("Examine materials stock", "runmodule.php?module=improbablehousing&op=store&sub=start&hid={$hid}&rid={$rid}");
    improbablehousing_list_occupants($house, $rid);
    //Handle interior nav links in a function (kitchens etc)
    $hook = array("hid" => $hid, "rid" => $rid, "house" => $house);
    $hook = modulehook("improbablehousing_interior", $hook);
    $house = $hook['house'];
    if (!$house['data']['rooms'][$rid]['blockchat']) {
        require_once "lib/commentary.php";
        addcommentary();
        if (improbablehousing_getkeytype($house, $rid) >= 100) {
            viewcommentary("dwelling-" . $hid . "-" . $rid, "Chat with others in this room", 25, "says", false, false, false, false, true);
        } else {
            viewcommentary("dwelling-" . $hid . "-" . $rid, "Chat with others in this room");
        }
    }
}
if ($rid != 0) {
    improbablehousing_bottomnavs($house);
} else {
    addnav("Leave");
    addnav("M?Back to the Island Map", "runmodule.php?module=improbablehousing&op=exit&hid={$hid}");
}
page_footer();
Ejemplo n.º 7
0
addcommentary();
$cost = $session['user']['level'] * 20;
if (!isset($_GET['op'])) {
    $_GET['op'] = '';
}
if ($_GET['op'] == "pay") {
    if ($session['user']['gold'] >= $cost) {
        $session['user']['gold'] -= $cost;
        debuglog("spent {$cost} gold to speak to the dead");
        redirect("gypsy.php?op=talk");
    } else {
        page_header("Gypsy Seer's tent");
        addnav("Return to the village", "village.php");
        output("`5You offer the old gypsy woman your `^{$session['user']['gold']}`5 gold for your gen-u-wine say-ance, however she informs you that the dead \n\t\tmay be dead, but they ain't cheap.");
    }
} elseif ($_GET['op'] == "talk") {
    page_header("In a deep trance, you talk with the shades");
    output("`5While in a deep trance, you are able to talk with the dead:`n");
    viewcommentary("shade", "Project", 25, "projects");
    addnav("Snap out of your trance", "village.php");
} else {
    checkday();
    page_header("Gypsy Seer's tent");
    output("`5You duck in to a gypsy tent behind `%Pegasus'`5 wagon which promises to let you talk with the deceased.  In typical gypsy style, the old woman sitting behind\n\ta somewhat smudgy crystal ball informs you that the dead only speak with the paying.  Your price is `^{$cost}`5 gold.");
    addnav("Pay to talk to the dead", "gypsy.php?op=pay");
    addnav("Forget it", "village.php");
    if ($session['user']['superuser'] > 1) {
        addnav("Superuser Entry", "gypsy.php?op=talk");
    }
}
page_footer();
        if ($ft == 0) {
            output("You haven't flirted with anyone today, but you can flirt a total of");
        } else {
            output("You've flirted `%%s`@ time%s today out of a possible", $ft, translate_inline($ft > 1 ? "s" : ""));
        }
        output("`%%s`@ time%s.`n`n", $max, translate_inline($max > 1 ? "s" : ""));
        require_once "./modules/marriage/flirtlist.php";
        marriage_flist($items);
        break;
    case "bar":
        addnav("Drinks");
        modulehook("ale", array());
        require_once "lib/commentary.php";
        addcommentary();
        output("`@As you sit down at the bar, %s`@ inquires as to if you would like a drink.`nLooking around, you nod and talk to other patrons.`n", $bartender);
        viewcommentary("loveshack", "`#Discourse?`@", 25, "discourses");
        break;
}
addnav("Navigation");
if (get_module_setting("location") == 1) {
    addnav("Return to the Gardens", "gardens.php");
} else {
    villagenav();
}
addnav("Actions");
if (get_module_pref("user_option") == 0 && get_module_pref("supernoflirt") == 0) {
    addnav("`\$No Flirting", $link . "&op2=noflirt");
    addnav("Rules of Flirting", $link . "&op2=rules");
    addnav("Point Values", $link . "&op2=pointvalue");
    addnav(array("`^Talk to %s `@`i(Your Flirt Status)`i", $bartender), $link . "&op2=talk");
    addnav("The Bar", $link . "&op2=bar");
Ejemplo n.º 9
0
        output("`b`c`2The Gardens`0`c`b");
        output("`n`n`@You walk through a gate and on to one of the many winding paths that makes its way through the well-tended gardens.  From the flowerbeds that bloom even in darkest winter, to the hedges whose shadows promise forbidden secrets, these gardens provide a refuge for those seeking out the Green Dragon; a place where they can forget their troubles for a while and just relax.`n`n");
        output("`^A large pond is here that looks to hold many types of fish. Perhaps you would like to try your luck at some fishing?");
        output("`n`n`^You have `&" . $session['user']['fishturns'] . " `^fishing turns left for today.`n");
        addnav("Things to do");
        addnav("Fish in the pond", "gardens.php?op=fishcheck");
        addnav("Return to the Village", "village.php");
        viewcommentary("gardens", "Chat Here:", 30, "whispers");
    } else {
        output("`b`c`2The Gardens`0`c`b");
        output("`n`n`@You walk through a gate and on to one of the many winding paths that makes its way through the well-tended gardens.  From the flowerbeds that bloom even in darkest winter, to the hedges whose shadows promise forbidden secrets, these gardens provide a refuge for those seeking out the Green Dragon; a place where they can forget their troubles for a while and just relax.`n`n");
        output("`^A large pond is here that looks to hold many types of fish.");
        output("`n`n`%You are too tired to fish anymore today`&...`n");
        addnav("Things to do");
        addnav("Return to the Village", "village.php");
        viewcommentary("gardens", "Chat Here:", 30, "whispers");
    }
} elseif ($_GET['op'] == "fishcheck") {
    output("`b`c`2The Gardens`0`c`b");
    if ($session['user']['fishingpole'] != 1) {
        output("`nYou need a fishing pole to go fishing in the pond. Buy one at the general store.`n");
    }
    if ($session['user']['worms'] < 1 && $session['user']['minnows'] < 1 && $session['user']['lures'] < 1) {
        output("`nYou need some kind of bait or lure to fish with. Buy some at the general store.`n");
        addnav("Continue", "gardens.php");
        addnav("Return to the Village", "village.php");
    } else {
        redirect("gardens.php?op=gofishing");
    }
} elseif ($_GET[op] == "gofishing") {
    output("`b`c`2The Gardens`0`c`b");
             addnav("Actions");
             addnav("Buy a Ring", "runmodule.php?module=marriage&op=" . $op . "&op2=ringbuy&stage=1");
         } elseif ($session['user']['gold'] < $ringcost) {
             output("`n`nYou show `^%s `3your gold pouch and says, \"`&You haven't got enough for this ring.`3\"", $vicar);
         } else {
             output("`n`nAfter taking a look at your gold pouch, `^%s `3 says \"`&You've got enough for this ring.`3\"", $vicar);
             addnav("Actions");
             addnav("Buy a Ring", "runmodule.php?module=marriage&op=" . $op . "&op2=ringbuy&stage=1");
         }
     }
     break;
 case "talk":
     require_once "lib/commentary.php";
     addcommentary();
     output("`@You hear people whispering...`n`0");
     viewcommentary("marriage", "Whisper?", 25);
     break;
 case "marry":
     $allprefs = unserialize(get_module_pref('allprefs'));
     $allprefs['flirtsfaith'] = 0;
     set_module_pref('allprefs', serialize($allprefs));
     $stuff = explode(',', get_module_pref('proposals'));
     $i = "";
     foreach ($stuff as $val) {
         if ($val != "" && $val != $target && $val != $session['user']['acctid']) {
             $i .= "," . $val;
         }
     }
     set_module_pref('proposals', $i);
     $stuff = explode(',', get_module_pref('proposals', 'marriage', $target));
     $i = "";
        output_notl("%s%s%s", $pre, $row1['name'], $suf);
        $i++;
    }
}
/* 
Removed for aesthetic purposes.
$city_link = urlencode(get_module_pref("location_saver","dwellings"));
if (is_module_active("cities")) 
	$link = "runmodule.php?module=cities&op=travel&city=$city_link&su=1";
}else {
	$link = "village.php";
}
addnav("Leave");
addnav(array("Return to %s",get_module_pref("location_saver","dwellings")),$link); 
*/
$session['user']['location'] = get_module_setting("logoutlocation");
addnav("Dwellings Extras");
modulehook("dwellings-inside", array("type" => $type, "dwid" => $dwid, "owner" => $row['ownerid']));
if (get_module_setting("enablecof") && get_module_setting("enablecof", $type) == 1) {
    addnav("The Coffers", "runmodule.php?module=dwellings&op=coffers&dwid={$dwid}");
}
if ($session['user']['acctid'] != $row['ownerid']) {
    addnav("Turn in Key", "runmodule.php?module=dwellings&op=keys&subop=giveback&dwid={$dwid}");
} else {
    addnav("Dwelling Management", "runmodule.php?module=dwellings&op=manage&dwid={$dwid}");
}
require_once "lib/commentary.php";
addcommentary();
$tl = get_module_objpref("dwellings", $dwid, "dwidtalkline");
viewcommentary("dwellings-" . $dwid, "The walls echo past comments", 20, $tl);
function wcgpoints_run()
{
    global $session;
    page_header("Cobblestone Cottage");
    $submit = translate_inline("Carry On");
    switch (httpget('op')) {
        case "enter":
            $uid_ok = get_module_pref("uidok");
            output("`4`bWARNING: Cobblestone Cottage is currently in BETA, and a little shaky.`b  Please don't send Petitions about this feature - use the chat area below, or the Enquirer.`0`n`n");
            if (get_module_pref("wcgid") && $uid_ok) {
                if (!get_module_pref("fail")) {
                    $points = wcgpoints_getpoints();
                    output("`0Jake greets you with a broad smile.  \"`@Welcome back, man.  You've got %s cobblestones waiting to spend.  Have fun!`0\"`n`n", number_format($points));
                    modulehook("wcg-features");
                } else {
                    //WCG ID present but not verified
                    debug("WCG ID not verified");
                    output("Jake greets you with a concerned look.  \"`@Man, I've been wondering where you've been.  I asked the Cosmos how many Cobblestones to give you, and it wouldn't answer.  Something about a messed-up Verification Code, whatever that means.`0\"`n`nIt looks like your Verification Code needs to be re-checked - you can find it via your Profile page on the World Community Grid website, and change our record of it via your Preferences in any Outpost.`n`n");
                    addnav("Let's do that, then", "runmodule.php?module=wcgpoints&op=verify");
                }
            } else {
                debug("No WCG ID entered");
                output("`0You head into a beautiful stone cottage.  A long-haired young man sits behind a desk at the entrance, idly smoking a cigarette.  As you catch his eye, he grins and rests his cigarette in an ashtray.  It smells kinda funny.`n`n\"`@Hey, man.  Welcome to Cobblestone Cottage!`0\"  He shakes your hand.  \"`@The name's Jake.  It doesn't look like you're hooked up yet.  Here, let me fix that for you, and you'll be rolling in cobblestones in no time.`0\"`n`n\"`#Cobblestones?`0\" you ask.`n`n\"`@Cobblestones, man, cobblestones!`0\" exclaims the hippy.  \"`@Whole new local currency - you saw the mess the banks made of the last one!  This stuff is as indie as it `igets`i, man.  You can only spend them in this very cottage.  Let's get you hooked up.`0\"`n`nHe sits down and pulls out a worn leather notebook and a purple-feathered quill pen.  \"`@What's your ID, my friend?`0\"`n`n");
                output("`J`bPinned to the slightly run-down fourth wall of the cottage is this message:`b`n`n`0The ID that the dirty hippy is asking for is your World Community Grid username.`n`n`bWhat's the story, daddy-o?`b`n`nYour computer can cure AIDS and cancer.`n`nNo, seriously.  It can also help provide us with cheap, environmentally-friendly electricity, sort out world hunger, and kick Dengue Fever in the nuts.  It can do a lot, really.  Most people hardly ever use the full capacity of their computer's CPU's.  You'll certainly have unused CPU cycles lying around while you're surfing the Internet or playing this game.  It'd be a terrible shame to waste those cycles.  Why not donate them to a worthy cause?`n`nScientists and humanitarian researchers need all the computing power they can get their hands on in order to analyse protein structures, chemical properties and other computationally-intensive stuff.  You can download a program that'll perform this life-saving research on your very own computer - and it'll run at a very low priority, so that when you do want to use your PC for something computationally intensive like playing a 3D game, your computer will be just as responsive.`n`nThe more CPU cycles you donate to humanitarian research, the more cobblestones Jake will give you.  These cobblestones can be used to play games or obtain other resources inside the Cottage.  See the list at the end of this page to see what you can do with your cobblestones, and check back as we come up with new features.`n`n`bThe nitty-gritty`b`n`nIn a nutshell, World Community Grid is a distributed computing network that performs humanitarian research using your computer's unused CPU cycles.  The project uses the BOINC networked computing client, which runs on Windows, Mac, Linux, FreeBSD and many other platforms, and doesn't affect the normal day-to-day performance of your computer.  When your computer's screensaver is active, the World Community Grid client will request instructions, process them, and send them back.  When your computer is in use, the client goes into Snooze mode and doesn't use any CPU cycles, so you'll likely not notice that the client is running.`n`nHumanitarian work performed by your computer for World Community Grid includes, but is not limited to:`nDeveloping drugs to combat cancer in children and adults;`nDeveloping antiviral medication for new influenza strains;`nCalculating the electronic properties of materials in order to find an organic compound that we can use to make dirt-cheap solar panels;`nDetermining the best options to create a new strain of rice that will provide maximum nutrition and thrive in a harsh environment;`nUncovering new drugs to combat dengue hemorrhagic fever, hepatitis C, West Nile encephalitis, and Yellow fever;`nIdentifying candidate drugs that have the right shape and chemical characteristics to block HIV protease;`nHuman proteome folding.`n`nFor more information or to join, search for World Community Grid in Wikipedia or your favourite search engine.`n`n`bHow World Community Grid interacts with Improbable Island`b`n`nAt each new game day, Jake will reward you with his entirely-made-up currency based on how many World Community Grid points you've accumulated since the previous game day.  More information on how WCG Points are calculated and rewarded can be found via a web search, or on the World Community Grid website.  You may install and run the BOINC client on more than one machine if you wish, under the same WCG username - this will result in more points and thus more cobblestones.`n`nWCG only updates their stats every 24 hours, and the work done by your computer must be verified first - so the XML file that Improbable Island reads to determine your cobblestone awards may be several days behind the actual work done by your computer.  To save undue stress on World Community Grid's servers, cobblestones are only awarded at each new Game Day.  If you joined World Community Grid today, it may be a day or two (or three!) before Jake gives you `iany`i cobblestones at all - however, if you allow your computer to run the BOINC client reasonably often, you should get more cobblestones every day after the first batch arrive.`n`nIf you've been a member of World Community Grid for some time, Jake will give you an initial bag of cobblestones corresponding to the total work done by your computer over the course of your entire WCG membership.  You'll be stinking rich!`n`n`bDISCLAIMER`b`nImprobable Island is not affiliated with or endorsed by IBM or World Community Grid.  In fact, I'd be surprised if they even knew about this.`n`n`bGETTING STARTED`b`nThere are three steps to the process - signing up at World Community Grid, installing the BOINC client, and associating your World Community Grid account with your Improbable Island username.`n`n`bSteps One and Two`b`nIf you're already signed up with World Community Grid, you can skip this bit.`n");
                rawoutput("Head over to <a href=\"http://www.worldcommunitygrid.org/reg/viewRegister.do?teamID=" . get_module_setting("teamid") . "\" target='new'>World Community Grid</a>, and follow the onscreen instructions to sign up, download and install the WCG BOINC client.");
                output("`n`n`bStep Three`b`nEnter your World Community Grid username and Verification Code into the boxes below.`n");
                rawoutput("<form action='runmodule.php?module=wcgpoints&op=verify' method='POST'>World Community Grid username: <input name='wcgid' value=\"\"><br />World Community Grid Verification Code: <input name='vcode' value=\"\"><br />Your verification code can be found on <a href=\"https://secure.worldcommunitygrid.org/ms/viewMyProfile.do\">this page</a>.  Copy-paste it into the box above, making sure you don't leave any tabs or spaces in there.<br /><input type='submit' class='button' value='{$submit}'></form>");
                addnav("", "runmodule.php?module=wcgpoints&op=verify");
                output("`bFeatures available in Cobblestone Cottage:`b`n`n");
                modulehook("wcg-features-desc");
            }
            require_once "lib/commentary.php";
            addcommentary();
            viewcommentary("wcgpoints", "Interject your own opinions about trying to get the damned thing working!", 25);
            addnav("Exit to Common Ground", "gardens.php");
            break;
        case "verify":
            //Player has entered a WCG ID
            //Check that it exists
            $id = httppost('wcgid');
            $vcode = httppost('vcode');
            $id = str_replace(" ", "+", $id);
            $source = "http://www.worldcommunitygrid.org/verifyMember.do?name=" . $id . "&code=" . $vcode;
            if ($xmlObj = simplexml_load_file($source)) {
                if (!$xmlObj->MemberStat && !$xmlObj->MemberStats->MemberStat) {
                    debug($xmlObj);
                    output("Jake scans his notebook and frowns.  \"`@You sure that's right, man?`0\"`n`n");
                    output("Something went wrong.  Please double-check the information you provided - remember that both usernames and verification codes are case-sensitive.`n`nHere's the error that World Community Grid passed back - it may or may not be useful:`n`4`b%s`b`0`nIf there is no error message above, then it's likely that World Community Grid is running its nightly stats update - in which case, try again in an hour or so.`n`n", $xmlObj);
                    rawoutput("<form action='runmodule.php?module=wcgpoints&op=verify' method='POST'>World Community Grid username: <input name='wcgid' value=\"\"><br />World Community Grid Verification Code: <input name='vcode' value=\"\"><br />Your verification code can be found on <a href=\"https://secure.worldcommunitygrid.org/ms/viewMyProfile.do\">this page</a>.  Copy-paste it into the box above, making sure you don't leave any tabs or spaces in there.<br /><input type='submit' class='button' value='{$submit}'></form>");
                    addnav("", "runmodule.php?module=wcgpoints&op=verify");
                } else {
                    //Check that the username isn't already taken
                    $sql = "SELECT acctid FROM " . db_prefix("accounts") . "";
                    $result = db_query($sql);
                    $idlo = strtolower($id);
                    for ($i = 0; $i < db_num_rows($result); $i++) {
                        $row = db_fetch_assoc($result);
                        $check = strtolower(get_module_pref("wcgid", "wcgpoints", $row['acctid']));
                        if ($check == $idlo) {
                            debug("Match found");
                            if (get_module_pref("wcgid-verified", "wcgpoints", $row['acctid'])) {
                                output("`bThat World Community Grid username has already been taken!`b`n`n");
                                $alreadyexists = 1;
                                rawoutput("<form action='runmodule.php?module=wcgpoints&op=verify1' method='POST'>World Community Grid username: <input name='wcgid' value=\"\"><br />World Community Grid Verification Code: <input name='vcode' value=\"\"><br />Your verification code can be found on <a href=\"https://secure.worldcommunitygrid.org/ms/viewMyProfile.do\">this page</a>.  Copy-paste it into the box above, making sure you don't leave any tabs or spaces in there.<br /><input type='submit' class='button' value='{$submit}'></form>");
                                addnav("", "runmodule.php?module=wcgpoints&op=verify");
                                break;
                            }
                        }
                    }
                    if (!$alreadyexists) {
                        set_module_pref("uidok", true);
                        set_module_pref("wcgid", $id);
                        set_module_pref("user_vcode", $vcode);
                        $points = $xmlObj->MemberStat->StatisticsTotals->Points;
                        if (!$points) {
                            $points = $xmlObj->MemberStats->MemberStat->StatisticsTotals->Points;
                        }
                        if (!$points) {
                            $points = $xmlObj->MemberStatsWithTeamHistory->MemberStats->MemberStat->StatisticsTotals->Points;
                        }
                        if (!$points) {
                            output("The hippy smiles.  \"`@Okay, you're all set.  Come back tomorrow and we'll sort you out with some cobblestones.`0\"`n`nYour account was verified successfully, but no points have been processed yet.  Points sometimes process a day or two late - check back and you'll get some cobblestones soon.`n`n");
                        } else {
                            set_module_pref("points", $points);
                            output("The hippy smiles.  \"`@Okay, you're all set.  Let's sort you out with some cobblestones...`0\"  He reaches underneath his desk and brings out a large bag.  \"`@Here you go, man.  %s cobblestones.  Have fun!`0\"`n`nThose should last you a while...`n`n", number_format($points));
                        }
                    }
                }
            } else {
                output("Whoops!  The XML file from World Community Grid couldn't be loaded.  This could be because World Community Grid is updating its point totals, in which case try again in an hour.  If it's still not working in a couple of hours, please Petition the admins to find out what went wrong.  Thanks!`n`n");
            }
            addnav("Exit to Common Ground", "gardens.php");
            break;
    }
    page_footer();
    return true;
}
                output("`bBy Section Name`b`n`n");
                $sql = "SELECT DISTINCT section FROM " . db_prefix("commentary") . " WHERE section NOT LIKE 'dwelling%' AND section NOT LIKE 'bio%' AND section NOT LIKE 'clan%' AND section NOT LIKE 'pet-%'";
                $result = db_query($sql);
                $locations = array();
                while ($row = db_fetch_assoc($result)) {
                    $locations[] = $row['section'];
                }
                foreach ($locations as $key => $loc) {
                    output("`b%s`b`n", $loc);
                    viewcommentary($loc, "Intervene:", 25);
                    rawoutput("<hr style=\"border-bottom: 1px dotted #333333; border-top: 0; border-left: 0; border-right: 0;\" />");
                }
                break;
            case "all":
                output("`bAll Comments`b`n");
                viewcommentary("all", "X", 200);
                break;
        }
        break;
}
function moderate_getlogin($acctid)
{
    $sql = "SELECT login FROM " . db_prefix("accounts") . " WHERE acctid = " . $acctid;
    $searchresult = db_query($sql);
    if (db_num_rows($searchresult) != 1) {
        $login = "******";
    } else {
        $i = 0;
        $row = db_fetch_assoc($searchresult);
        $login = $row['login'];
    }
Ejemplo n.º 14
0
<?php

// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2 of the License, or (at your
// option) any later version.
//
// File: rock.php
require_once "common.php";
// This idea is Imusade's from lotgd.net
if ($session['user']['dragonkills'] > 0 || $session['user']['superuser'] > 1) {
    addcommentary();
}
checkday();
if ($session['user']['dragonkills'] > 0 || $session['user']['superuser'] > 1) {
    page_header("The Veteran's Club");
    output("`b`c`2The Veteran's Club`0`c`b");
    output("`n`n`4Something in you compels you to examine the curious rock.  Some dark magic, locked up in age old horrors.");
    output("`n`nWhen you arrive at the rock, an old scar on your arm begins to throb in succession with a mysterious light that ");
    output("now seems to come from the rock.  As you stare at it, the rock shimmers, shaking off an illusion.  You realize that this is ");
    output("more than a rock.  It is, in fact, a doorway, and over the threshold, you see others, bearing an identical scar to yours.  It ");
    output("somehow reminds you of the head of one of the great serpents from legend.  You have discovered The Veteran's Club.");
    output("`n`n");
    viewcommentary("veterans", "Boast here", 30, "boasts");
} else {
    page_header("Curious looking rock");
    output("You approach the curious looking rock.  After staring, and looking at it for a little while, it continues to look just like a curious looking rock.`n`n");
    output("Bored, you decide to return to the village.");
}
addnav("Return to the village", "village.php");
page_footer();
function pub_kittania_run()
{
    global $session;
    $td = gametimedetails();
    $gt = $td['secssofartoday'];
    //8400 seconds in a day
    //3600 seconds in an hour
    //midnight: 0
    //1am: 3600
    //2am: 7200
    //3am: 10800
    //4am: 14400
    //5am: 18000
    //6am: 21600
    //7am: 25200
    //8am: 28800
    //9am: 32400
    //10am: 36000
    //11am: 39600
    //12pm midday: 43200
    //1pm: 46800
    //2pm: 50400
    //3pm: 54000
    //4pm: 57600
    //5pm: 61200
    //6pm: 64800
    //7pm: 68400
    //8pm: 72000
    //9pm: 75600
    //10pm: 79200
    //11pm: 82800
    //11:59:59: 86399
    //midnight: 0
    page_header("The Sunny Spot");
    $op = httpget("op");
    switch ($op) {
        case "start":
            rawoutput("<table cellpadding=0 cellspacing=0><tr><td><img src='images/pubsigns/kittania.png' align='left'>");
            $phrases = array(1 => "flirting cheerfully with one of her patrons as she draws a pint", 2 => "wearily giving directions to a confused Rookie", 3 => "gossiping idly about the latest chef in town");
            $chosenphrase = array_rand($phrases);
            output("You climb up a short ladder and emerge into the largest treehouse you've ever seen.  Large branches are visible through the transluscent net drape of the ceiling.  A few kittymorphs chat and consume drinks while lounging in some of the many inviting hammocks, while others share a meal on reclining couches.  Large soft pillows are scattered about the floor around trays full of drink and smokeables.   The landlady Miu-Miu is a tawny, middle-aged kittymorph.  Right now she's %s.`n`nThe soft murmur of conversation is punctuated by laughter, and the smell of strange incense hangs in the air, mingling with the fresh green scent of the tree itself.`n`n", $phrases[$chosenphrase]);
            rawoutput("</td></tr></table>");
            require_once "lib/commentary.php";
            addcommentary();
            viewcommentary("pub_kittania");
            addnav("Talk to people");
            addnav("Miu-Miu", "runmodule.php?module=pub_kittania&op=bartender");
            modulehook("pub_kittania");
            break;
        case "continue":
            rawoutput("<table cellpadding=0 cellspacing=0><tr><td><img src='images/pubsigns/kittania.png' align='left'>");
            output("You rejoin your fellows in the open space.`n`n");
            rawoutput("</td></tr></table>");
            require_once "lib/commentary.php";
            addcommentary();
            viewcommentary("pub_kittania");
            addnav("Talk to people");
            addnav("Miu-Miu", "runmodule.php?module=pub_kittania&op=bartender");
            modulehook("pub_kittania");
            break;
        case "bartender":
            //add a text parser here at some point, I think...
            //maybe make this opening text time-dependent?
            $text = array();
            $text['hello'] = "Miu-Miu shows you a slightly tired smile.  \"`2Yes love, what'll you have?`0\"`n`n";
            $drinks = array();
            $hook = array();
            $hook['drinks'] = $drinks;
            $hook['text'] = $text;
            $hook = modulehook("pub_kittania_bartender", $hook);
            $text = $hook['text'];
            //debug($hook);
            $drinks = $hook['drinks'];
            output_notl($text['hello']);
            foreach ($drinks as $key => $vals) {
                addnav("What'll it be?");
                if (!$vals['blockdrink']) {
                    if ($session['user']['gold'] >= $vals['price']) {
                        addnav(array("%s (%s Req)", $vals['verbosename'], $vals['price']), "runmodule.php?module=pub_kittania&op=drink&drink=" . $key);
                    } else {
                        addnav(array("%s (%s Req)", $vals['verbosename'], $vals['price']), "");
                    }
                }
            }
            if (!$hook['blockreturnnav']) {
                addnav("Never mind");
                addnav("Return to the lounge", "runmodule.php?module=pub_kittania&op=continue");
            }
            break;
        case "drink":
            $hook = array("drink" => httpget("drink"));
            $hook = modulehook("pub_kittania_drink", $hook);
            if (!$hook['blockbarnav']) {
                addnav("More!");
                addnav("Get Miu-Miu's attention again", "runmodule.php?module=pub_kittania&op=bartender");
            }
            if (!$hook['blockreturnnav']) {
                addnav("That's enough");
                addnav("Return to the lounge", "runmodule.php?module=pub_kittania&op=continue");
            }
            break;
    }
    addnav("Leave");
    addnav("Back to Kittania", "village.php");
    page_footer();
}
function pub_squathole_run()
{
    global $session;
    $td = gametimedetails();
    $gt = $td['secssofartoday'];
    //8400 seconds in a day
    //3600 seconds in an hour
    //midnight: 0
    //1am: 3600
    //2am: 7200
    //3am: 10800
    //4am: 14400
    //5am: 18000
    //6am: 21600
    //7am: 25200
    //8am: 28800
    //9am: 32400
    //10am: 36000
    //11am: 39600
    //12pm midday: 43200
    //1pm: 46800
    //2pm: 50400
    //3pm: 54000
    //4pm: 57600
    //5pm: 61200
    //6pm: 64800
    //7pm: 68400
    //8pm: 72000
    //9pm: 75600
    //10pm: 79200
    //11pm: 82800
    //11:59:59: 86399
    //midnight: 0
    page_header("Booz");
    $op = httpget("op");
    switch ($op) {
        case "start":
            rawoutput("<table cellpadding=0 cellspacing=0><tr><td><img src='images/pubsigns/squathole_1.png' align='left'>");
            $phrases = array(1 => "A number of Midgets stand around drinking pints of Wanker, and holding what sounds like a dirty limerick contest.  None of them are quite clever enough to know what a limerick is, but they're giving it their best shot.", 2 => "A small knot of Midgets are brawling on the top of a table, spilling beer and foul secretions everywhere. It looks like they've been at it for awhile, and the pub is starting to show the damage.  The ratty blue tarp above the grouping is letting in the elements, which doesn't deter any of the fighting throng.  Bottles, mugs and fists are brandished, and one particularly angry Midget has torn off bits of a table and looks disappointed that there's no chandelier for him to swing from.", 3 => "You think the sign once read 'Mourners of Life Poetry Club,' but that surely can't be right.");
            $chosenphrase = array_rand($phrases);
            output("`0Booz, the Squat Hole pub, is basically a series of drooping tarpaulins, unsteadily propped up with branches and a few stakes.  Its mostly knee-high patrons sit on empty beer kegs, resting their drinks or their feet on other kegs.  The stench of armpit and stale beer hangs in the air.  Someone has propped a few rotting boards on top of more kegs - this is the bar.  A tiny woman scampers back and forth across it, doling out alcohol to patrons who are temporarily still upright.  Her name is Chlamydia.  You know, like the flower.`n`n%s`n`n", $phrases[$chosenphrase]);
            rawoutput("</td></tr></table>");
            require_once "lib/commentary.php";
            addcommentary();
            viewcommentary("pub_squathole");
            addnav("Talk to people");
            addnav("Chlamydia", "runmodule.php?module=pub_squathole&op=bartender");
            modulehook("pub_squathole");
            break;
        case "continue":
            rawoutput("<table cellpadding=0 cellspacing=0><tr><td><img src='images/pubsigns/squathole_1.png' align='left'>");
            output("You head back into the main section of the pub, ducking under flappy bits of tarpaulin.`n`n");
            rawoutput("</td></tr></table>");
            require_once "lib/commentary.php";
            addcommentary();
            viewcommentary("pub_squathole");
            addnav("Talk to people");
            addnav("Chlamydia", "runmodule.php?module=pub_squathole&op=bartender");
            modulehook("pub_squathole");
            break;
        case "bartender":
            //add a text parser here at some point, I think...
            //maybe make this opening text time-dependent?
            $text = array();
            $text['hello'] = "Chlamydia shows you a smile and squeaks at you.  \"`2Yes luv, wha' c'n I gitcha?`0\"`n`n";
            $drinks = array();
            $hook = array();
            $hook['drinks'] = $drinks;
            $hook['text'] = $text;
            $hook = modulehook("pub_squathole_bartender", $hook);
            $text = $hook['text'];
            //debug($hook);
            $drinks = $hook['drinks'];
            output_notl($text['hello']);
            foreach ($drinks as $key => $vals) {
                addnav("Wha' indeed?");
                if (!$vals['blockdrink']) {
                    if ($session['user']['gold'] >= $vals['price']) {
                        addnav(array("%s (%s Req)", $vals['verbosename'], $vals['price']), "runmodule.php?module=pub_squathole&op=drink&drink=" . $key);
                    } else {
                        addnav(array("%s (%s Req)", $vals['verbosename'], $vals['price']), "");
                    }
                }
            }
            if (!$hook['blockreturnnav']) {
                addnav("Never mind");
                addnav("Return to the lounge", "runmodule.php?module=pub_squathole&op=continue");
            }
            break;
        case "drink":
            $hook = array("drink" => httpget("drink"));
            $hook = modulehook("pub_squathole_drink", $hook);
            if (!$hook['blockbarnav']) {
                addnav("More!");
                addnav("Get Chlamydia's attention again", "runmodule.php?module=pub_squathole&op=bartender");
            }
            if (!$hook['blockreturnnav']) {
                addnav("That's enough");
                addnav("Return to the lounge", "runmodule.php?module=pub_squathole&op=continue");
            }
            break;
    }
    addnav("Leave");
    addnav("Back to Squat Hole", "village.php");
    page_footer();
}
Ejemplo n.º 17
0
if ($session['user']['superuser']){
  addnav("New Day","newday.php");
}

if (getsetting("topwebid", 0) != 0) {
	addnav("Top Web Games");
	if (date("Y-W", strtotime($session['user']['lastwebvote'])) < date("Y-W"))
		$hilight="`&";
	else
		$hilight="";
	addnav("V?".$hilight."Cast your Vote", "http://www.topwebgames.com/in.asp?id=".getsetting("topwebid", 0)."&acctid={$session['user']['acctid']}", false, true);
}

page_header("Village Square");
//output("<img src='images/trans.png' width='1' height='700' alt='' align='right'>",true);
output("`@`c`bVillage Square`b`cThe village hustles and bustles.  No one really notices that you're standing there.");
output("  You see various shops and businesses along main street.  There is a curious looking rock to one side.  ");
output("On every side the village is surrounded by deep dark forest.`n`n");
output("The clock on the inn reads `^".getgametime()."`@.");

//	$t1 = strtotime("now")*getsetting("daysperday",4);
//	$t2 = strtotime($session[user][lasthit])*getsetting("daysperday",4);
//	$d1 = date("Y-m-d",$t1);
//	$d2 = date("Y-m-d",$t2);
//output("`n`nToday is $d1, your last new day was $d2");

output("`n`n`%`@Nearby some villagers talk:`n");
viewcommentary("village","Add",25);
page_footer();
?>
function jquerycommentary_run()
{
    global $_SERVER, $output, $session;
    require_once 'lib/commentary.php';
    $section = httpget('section');
    $commentary = db_prefix('commentary');
    $accounts = db_prefix('accounts');
    if (($commid = httpget('rmvcmmnt')) != "") {
        $prefix = db_prefix('commentary');
        check_su_access(SU_EDIT_COMMENTS);
        if ($session['user']['superuser'] & SU_EDIT_COMMENTS) {
            db_query("DELETE FROM {$prefix} WHERE commentid = '{$commid}'");
        }
        db_query("INSERT INTO {$commentary} (section, author, comment, postdate) VALUES ('blackhole', '{$session['user']['acctid']}', 'I f****d up', '" . date('Y-m-d H:i:s') . "')");
        invalidatedatacache("comments-{$section}");
        invalidatedatacache("comments-blackhole");
    }
    if (httpget('section') == get_module_pref('current_section') && httpget('section') != '') {
        //echo 'x';
        //var_dump(get_all_module_settings());
        $output = "";
        $_SERVER['REQUEST_URI'] = httpget('r');
        $session['counter'] = httpget('c');
        viewcommentary(get_module_pref('current_section'), get_module_setting('message'), get_module_setting('limit'), get_module_setting('talkline'));
        $output = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $output);
        $output = substr($output, 0, strpos($output, "<jquerycommentaryend>"));
        db_query("UPDATE accounts SET laston = '" . date('Y-m-d H:i:s') . "' WHERE acctid = '{$session['user']['acctid']}'");
        echo trim("{$output}");
        invalidatedatacache("comments-{$section}");
        /*$sql = db_query(
              "SELECT a.name, a.acctid
              FROM accounts AS a
              LEFT JOIN module_userprefs AS m
              ON m.userid = a.acctid
              LEFT JOIN module_userprefs AS u
              ON u.userid = m.userid
              WHERE m.modulename = 'jquerycommentary'
              AND m.setting = 'is_typing'
              AND m.value = '1'
              AND u.modulename = 'jquerycommentary'
              AND u.setting = 'current_section'
              and u.value = '" . get_module_pref('current_section') ."'"
          );
          $typing = [];
          while ($row = db_fetch_assoc($sql)) {
              array_push($typing, [$row['acctid'], $row['name']]);
          }
          $isTyping = appoencode('`@');
          $i = 0;
          echo appoencode('`@Who\'s typing: `n');
          if (count($typing) != 0) {
              foreach ($typing as $key => $val) {
                  $i++;
                  if ($i == 1) {
                      $isTyping .= appoencode($val[1]);
                  }
                  else if ($i > 1 && count($typing) > $i) {
                      $isTyping .= appoencode("`@, {$val[1]}");
                  }
                  else if ($i == count($typing)) {
                      $isTyping .= appoencode("`@ and {$val[1]}");
                  }
              }
              echo $isTyping;
          }
          else {
              echo appoencode('`@No one');
          }*/
    }
    switch (httpget('op')) {
        case 'get_json':
            $sql = db_query("SELECT commentid, author, comment FROM commentary WHERE section = '{$session['current_commentary_area']}' AND deleted = '0' ORDER BY commentid+0 DESC LIMIT 0, 25");
            $json = [];
            while ($row = db_fetch_assoc($sql)) {
                array_push($json, $row);
            }
            echo "<pre>";
            echo json_encode($json, JSON_PRETTY_PRINT);
            echo "</pre>";
            break;
        case 'post':
            $post = httpallpost();
            $post = modulehook('jquery-post-commentary', $post);
            $commentary = db_prefix('commentary');
            if ($post['method'] == 'insertcommentary') {
                require_once 'lib/commentary.php';
                injectcommentary(get_module_pref('current_section'), get_module_setting('talkline'), $post['comment']);
            } else {
                $commentid = explode('_', $post['method']);
                require_once 'lib/systemmail.php';
                require_once 'lib/sanitize.php';
                $post['comment'] = htmlent($post['comment']);
                db_query("UPDATE {$commentary} SET comment = '{$post['comment']}' WHERE commentid = '{$commentid[1]}'");
                db_query("INSERT INTO {$commentary} (section, author, comment, postdate) VALUES ('blackhole', '{$session['user']['acctid']}', 'I f****d up', '" . date('Y-m-d H:i:s') . "')");
                invalidatedatacache("comments-{$session['current_commentary_section']}");
                invalidatedatacache("comments-blackhole");
            }
            break;
        case 'last_comment':
            require_once 'lib/sanitize.php';
            db_query("UPDATE accounts SET laston = '" . date('Y-m-d H:i:s') . "' WHERE acctid = '{$session['user']['acctid']}'");
            //$sql = db_query("SELECT comment, commentid FROM ".db_prefix('commentary')." WHERE author = '{$session['user']['acctid']}' AND section = '{$session['current_commentary_area']}' ORDER BY commentid DESC LIMIT 0,1");
            $sql = db_query("SELECT comment, commentid FROM {$commentary}\n                WHERE author = '{$session['user']['acctid']}'\n                AND (section = 'globalooc'\n                    OR section = '{$session['current_commentary_area']}')\n                ORDER BY commentid DESC\n                LIMIT 0,1");
            $row = db_fetch_assoc($sql);
            $data = $row;
            $sql = db_query("SELECT commentid, section, comment FROM {$commentary}\n                WHERE (section = 'globalooc'\n                OR section = '{$session['current_commentary_area']}'\n                OR section = 'blackhole'\n                )\n                ORDER BY commentid+0 DESC\n                LIMIT 0,1");
            $row = db_fetch_assoc($sql);
            $data['last_section'] = $row['section'];
            $data['last_comment'] = $row['commentid'];
            $data['last_message'] = $row['comment'];
            echo json_encode($data);
            break;
        case 'is_typing':
            $post = httpallpost();
            if ($post['typing'] == 'yes') {
                set_module_pref('is_typing', 1);
            } else {
                set_module_pref('is_typing', 0);
            }
            $sql = db_query("SELECT a.name, a.acctid\n                FROM accounts AS a\n                LEFT JOIN module_userprefs AS m\n                ON m.userid = a.acctid\n                LEFT JOIN module_userprefs AS u\n                ON u.userid = m.userid\n                WHERE m.modulename = 'jquerycommentary'\n                AND m.setting = 'is_typing'\n                AND m.value = '1'\n                AND u.modulename = 'jquerycommentary'\n                AND u.setting = 'current_section'\n                and u.value = '" . get_module_pref('current_section') . "'");
            $typing = [];
            while ($row = db_fetch_assoc($sql)) {
                array_push($typing, [$row['acctid'], $row['name']]);
            }
            $isTyping = appoencode('`@');
            $i = 0;
            if (count($typing) != 0) {
                foreach ($typing as $key => $val) {
                    $i++;
                    if ($i == 1) {
                        $isTyping .= appoencode($val[1]);
                    } else {
                        if ($i > 1 && count($typing) > $i) {
                            $isTyping .= appoencode("`@, {$val[1]}");
                        } else {
                            if ($i == count($typing)) {
                                $isTyping .= appoencode("`@ and {$val[1]}");
                            }
                        }
                    }
                    if ($i == count($typing)) {
                        $isTyping .= appoencode("`@...");
                    }
                }
                echo "✏ {$isTyping}";
            } else {
                echo "<br />";
            }
            break;
        case 'api':
            header('Content-Type: application/json');
            /*$sql = db_query(
                  "SELECT c.*, a.name FROM $commentary AS c
                  LEFT JOIN $accounts AS a
                  ON a.acctid = c.author
                  WHERE (section = '{$session['current_commentary_area']}'
                  OR section = 'global-ooc')
                  AND deleted = 0
                  ORDER BY commentid+0 DESC
                  GROUP BY section
                  LIMIT 0, 25"
              );*/
            $sql = db_query("SELECT comm.*, acc.name FROM\n                (\n                    (SELECT * FROM\n                        (SELECT * FROM commentary\n                        WHERE section = 'globalooc'\n                        AND deleted = '0'\n                        ORDER BY commentid+0 DESC\n                        LIMIT 0, 10)\n                    AS c\n                    ORDER BY c.commentid+0 ASC\n                    LIMIT 0, 10)\n                    UNION (\n                        SELECT * FROM\n                        (SELECT * FROM commentary\n                        WHERE section = 'superuser'\n                        AND deleted = '0'\n                        ORDER BY commentid+0 DESC\n                        LIMIT 0, 25)\n                        AS c\n                        ORDER BY c.commentid+0 ASC\n                        LIMIT 0, 25\n                    )\n                ) AS comm\n                LEFT JOIN accounts AS acc\n                ON acc.acctid = comm.author");
            $json = [];
            while ($row = db_fetch_assoc($sql)) {
                $row['name'] = appoencode($row['name']);
                $row['comment'] = appoencode($row['comment']);
                array_push($json, $row);
            }
            echo json_encode($json, JSON_PRETTY_PRINT);
            break;
    }
}
             addnav("Actions");
             addnav("Buy a Ring", "runmodule.php?module=marriage&op=" . $op . "&op2=ringbuy&stage=1");
         } elseif ($session['user']['gold'] < $ringcost) {
             output("`n`nYou show `^%s `3your gold pouch and says, \"`&You haven't got enough for this ring.`3\"", $vicar);
         } else {
             output("`n`nAfter taking a look at your gold pouch, `^%s `3 says \"`&You've got enough for this ring.`3\"", $vicar);
             addnav("Actions");
             addnav("Buy a Ring", "runmodule.php?module=marriage&op=" . $op . "&op2=ringbuy&stage=1");
         }
     }
     break;
 case "talk":
     require_once "lib/commentary.php";
     addcommentary();
     output("`@You hear people whispering...`n", $vicar);
     viewcommentary("marriage", "`#Whisper?`@", 25, "whisper");
     break;
 case "marry":
     $allprefs = unserialize(get_module_pref('allprefs'));
     $allprefs['flirtsfaith'] = 0;
     set_module_pref('allprefs', serialize($allprefs));
     $stuff = explode(',', get_module_pref('proposals'));
     $i = "";
     foreach ($stuff as $val) {
         if ($val != "" && $val != $target && $val != $session['user']['acctid']) {
             $i .= "," . $val;
         }
     }
     set_module_pref('proposals', $i);
     $stuff = explode(',', get_module_pref('proposals', 'marriage', $target));
     $i = "";
Ejemplo n.º 20
0
<?
require_once "common.php";

page_header("Land of the Shades");
addcommentary();
checkday();

if ($session['user']['alive']) redirect("village.php");
output("`\$You walk among the dead now, you are a shade.  Everywhere around you are the souls of those who have fallen in battle, in old age, 
and in grievous accidents.  Each bears telltale signs of the means by which they met their end.
`n`n
Their souls whisper their torments, haunting your mind with their despair:`n");
viewcommentary("shade","Despair",25,"despairs");
addnav("The Graveyard","graveyard.php");
addnav("Return to the news","news.php");
if ($session[user][superuser]>=2){
  addnav("Superuser Grotto","superuser.php");
}

page_footer();
?>
function drpap_run()
{
    global $session;
    $c = get_module_pref("count");
    // if ($c){
    // if (is_module_active("medals")){
    // require_once "modules/medals.php";
    // medals_award_medal("sexchange","Gender Reassignment","This player switched their gender at Doc Paprika's office!","medal_museumquest.png");
    // }
    // }
    $t = get_module_setting("times");
    $gold = get_module_setting("gold");
    $gems = get_module_setting("gems");
    $op = httpget('op');
    $dec = httpget('dec');
    $gen = translate_inline($session['user']['sex'] == 0 ? "sir" : "madam");
    $ngen = translate_inline($session['user']['sex'] == 1 ? "sir" : "madam");
    $g = translate_inline($gems == 1 ? "Gem" : "Gems");
    page_header("Dr Paprika's Office");
    switch ($op) {
        case "enter":
            if ($c < $t) {
                output("`3Subtle tunes play in the background; classic rock.");
                output("In the Center of the waiting room, is a large table - covered with out-of-date magazines.");
                output("A beautiful receptionist looks at you, across a pane of glass.");
                output("She glances at you, and waves, \"`%Hello there %s.", $gen);
                output("Are you here to see `QDr Paprika`%?");
                output("He is the only doctor in %s, excelling in the field of `\$Gender Changes`%.`3\"", get_module_setting("paploc"));
                addnav("Where to?");
                addnav("Dr Paprika's Room", "runmodule.php?module=drpap&op=office");
                addnav("Waiting Room", "runmodule.php?module=drpap&op=waitroom");
            } else {
                output("`3\"`%I am sorry %s, but you have already had %s `\$Gender Changes`%.", $gen, $c);
                output("Since the limit is %s, we are able to deny you service now.", $t);
                output("Please take care.`3\"");
                if (get_module_setting("reset") == 1) {
                    output("`3The receptionist adds, \"`%If you come back with some `@dragon's blood`%, we might be able to work something out.`3\"");
                }
            }
            break;
        case "office":
            if ($dec != "yes") {
                if ($session['user']['gold'] >= $gold && $session['user']['gems'] >= $gems) {
                    output("`3You walk in a white room, very white.");
                    output("A long operating table, is accompanied by a small swivel chair.");
                    output("Strutting out from the shadows, `QDr Paprika `3appears, and shakes your hand.");
                    output("\"`\$So, you wish to have a `%Gender Change `\$operation?`3\"");
                    addnav("Choices");
                    addnav("Yes", "runmodule.php?module=drpap&op=office&dec=yes");
                    addnav("Return to the Waiting Room", "runmodule.php?module=drpap&op=waitroom");
                } else {
                    output("`QDr Paprika `3stares at your blankly.");
                    output("\"`\$I am sorry %s, but you do not have the proper funds for this operation.`3\"", $gen);
                    output("`QDr Paprika `3points to a sign, stating \"`%Gender Operations cost `^%s `%Gold and `5%s `%%s.`3\"", $gold, $gems, $g);
                }
            } else {
                output("`QDr Paprika `3nods and begins to prep himself.");
                output("\"`\$Please lay down on the operating table... I will be with your shortly...`3\"");
                output("`QDr Paprika `3hovers over you and then pulls out a tiny bottle of ether.");
                output("He presses it to your nose and instructs, \"`\$Please count to One Hundred...`3\"");
                output("You begin to count...`n`n");
                for ($i = 1; $i <= $session['user']['level']; $i++) {
                    output("%s...`n", $i);
                }
                if ($session['user']['sex'] == 0) {
                    $session['user']['sex'] = 1;
                } else {
                    $session['user']['sex'] = 0;
                }
                $c++;
                set_module_pref("count", $c);
                $session['user']['gold'] -= $gold;
                $session['user']['gems'] -= $gems;
                require_once "lib/titles.php";
                $newtitle = get_dk_title($session['user']['dragonkills'], $session['user']['sex']);
                require_once "lib/names.php";
                $newname = change_player_title($newtitle);
                $session['user']['title'] = $newtitle;
                $session['user']['name'] = $newname;
                output("`nYou awaken hours later, your muscles shuddering.");
                output("You grasp the mirror to your side, and then look at yourself.");
                output("Surprisingly, you are now a healthy looking %s.", $ngen);
                output("You stand quickly, and shake `QDr Paprika's `3hand, thanking him profusely.");
                output("Taking up your clothes, you strut out from the office, smiling happily.");
            }
            break;
        case "waitroom":
            output("`3All around you, people are sitting.");
            output("Some are thumbing through magazines, whilst others are tapping their feet in anticipation.`n`n");
            require_once "lib/commentary.php";
            addcommentary();
            viewcommentary("drpap", "Nervous People are Around", 15, "says");
            addnav("Return to Lobby", "runmodule.php?module=drpap&op=enter");
            break;
    }
    addnav("Leave");
    villagenav();
    page_footer();
}
Ejemplo n.º 22
0
                 }
                 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 `^Seth`0 today.");
         }
     } else {
         //sorry, no lezbo action here.
     }
     break;
 case "converse":
     output("You stroll over to a table, place your foot up on the bench and listen in on the conversation:`n");
     viewcommentary("inn", "Add to the conversation?", 20);
     break;
 case "bartender":
     $alecost = $session['user']['level'] * 10;
     if ($_GET['act'] == "") {
         output("Cedrik looks at you sort-of sideways like.  He never was the sort who would trust a man any ");
         output("farther than he could throw them, which gave dwarves a decided advantage, except in provinces ");
         output("where dwarf tossing was made illegal.  Cedrik polishes a glass, holds it up to the light of the door as ");
         output("another patron opens it to stagger out in to the street.  He then makes a face, spits on the glass ");
         output("and goes back to polishing it.  \"`%What d'ya want?`0\" he asks gruffly.");
         addnav("Bribe", "inn.php?op=bartender&act=bribe");
         addnav("Gems", "inn.php?op=bartender&act=gems");
         addnav("Ale (`^{$alecost}`0 gold)", "inn.php?op=bartender&act=ale");
         $drunkenness = array(-1 => "stone cold sober", 0 => "quite sober", 1 => "barely buzzed", 2 => "pleasantly buzzed", 3 => "almost drunk", 4 => "barely drunk", 5 => "solidly drunk", 6 => "sloshed", 7 => "hammered", 8 => "really hammered", 9 => "almost unconscious");
         $drunk = round($session['user']['drunkenness'] / 10 - 0.5, 0);
         output("`n`n`7You now feel " . $drunkenness[$drunk] . "`n`n");
function commentdisplay($intro, $section, $message = "Interject your own commentary?", $limit = 10, $talkline = "says", $schema = false)
{
    // Let's add a hook for modules to block commentary sections
    $args = modulehook("blockcommentarea", array("section" => $section));
    if (isset($args['block']) && $args['block'] == "yes") {
        return;
    }
    if ($intro) {
        output($intro);
    }
    viewcommentary($section, $message, $limit, $talkline, $schema);
}
function commentaryinfo_run()
{
    global $session;
    switch (httpget("op")) {
        case "closetalk":
            page_header("Close Talk");
            $player = httpget("player");
            $ret = httpget("ret");
            if ($session['user']['acctid'] > $player) {
                $join = "closetalk-" . $player . "-" . $session['user']['acctid'];
            } else {
                $join = "closetalk-" . $session['user']['acctid'] . "-" . $player;
            }
            $sql = "SELECT name FROM " . db_prefix("accounts") . " WHERE acctid={$player}";
            $result = db_query($sql);
            $row = db_fetch_assoc($result);
            $playername = $row['name'];
            output("`0You gently call out to chat with %s`0.`n`n", $playername);
            require_once "lib/commentary.php";
            addcommentary();
            viewcommentary($join, "Whisper", 25);
            addnav("Leave");
            if (strpos($ret, "&refresh=1")) {
                $retparts = explode("&refresh=1", $ret);
            } else {
                if (strpos($ret, "?refresh=1")) {
                    $retparts = explode("?refresh=1", $ret);
                } else {
                    if (strpos($ret, "&c=")) {
                        $retparts = explode("&c=", $ret);
                    } else {
                        if (strpos($ret, "?c=")) {
                            $retparts = explode("?c=", $ret);
                        } else {
                            if (strpos($ret, "?&")) {
                                $retparts = explode("?&", $ret);
                            }
                        }
                    }
                }
            }
            debug($retparts);
            $back = rtrim($retparts[0], "?");
            $back = ltrim($back, "/");
            debug($back);
            if ($back == "" || !$back) {
                $back = "village.php";
            }
            addnav("Back to where you came from", $back);
            //addnav("Village","village.php");
            debug(unserialize($session['user']['allowednavs']));
            break;
    }
    page_footer();
}
    if ($row['acctid'] > 0) {
        addnav("Edit User Record", "user.php?op=edit&userid={$row['acctid']}&returnpetition={$_GET['id']}");
    }
    output("`@From: ");
    $row[body] = stripslashes($row[body]);
    if ($row['login'] > "") {
        output("<a href=\"mail.php?op=write&to=" . rawurlencode($row[login]) . "&body=" . URLEncode("\n\n----- Your Petition -----\n" . $row[body]) . "&subject=RE:+Petition\" target=\"_blank\" onClick=\"" . popup("mail.php?op=write&to=" . rawurlencode($row[login]) . "&body=" . URLEncode("\n\n----- Your Petition -----\n" . $row[body]) . "&subject=RE:+Petition") . ";return false;\"><img src='images/newscroll.png' width='16' height='16' alt='Write Mail' border='0'></a>", true);
    }
    output("`^`b{$row['name']}`b`n");
    output("`@Date: `^`b{$row['date']}`b`n");
    output("`@Body:`^`n");
    $body = HTMLEntities($row[body]);
    $body = preg_replace("'([[:alnum:]_.-]+[@][[:alnum:]_.-]{2,}([.][[:alnum:]_.-]{2,})+)'i", "<a href='mailto:\\1?subject=RE: Petition&body=" . str_replace("+", " ", URLEncode("\n\n----- Your Petition -----\n" . $row[body])) . "'>\\1</a>", $body);
    $body = preg_replace("'([\\[][[:alnum:]_.-]+[\\]])'i", "<span class='colLtRed'>\\1</span>", $body);
    $output .= "<span style='font-family: fixed-width'>" . nl2br($body) . "</span>";
    output("`n`@Commentary:`n");
    viewcommentary("pet-{$_GET['id']}", "Add", 200);
    if ($_GET['viewpageinfo']) {
        output("`n`n`@Page Info:`&`n");
        $row[pageinfo] = stripslashes($row[pageinfo]);
        $body = HTMLEntities($row[pageinfo]);
        $body = preg_replace("'([[:alnum:]_.-]+[@][[:alnum:]_.-]{2,}([.][[:alnum:]_.-]{2,})+)'i", "<a href='mailto:\\1?subject=RE: Petition&body=" . str_replace("+", " ", URLEncode("\n\n----- Your Petition -----\n" . $row[body])) . "'>\\1</a>", $body);
        $body = preg_replace("'([\\[][[:alnum:]_.-]+[\\]])'i", "<span class='colLtRed'>\\1</span>", $body);
        $output .= "<span style='font-family: fixed-width'>" . nl2br($body) . "</span>";
    }
    if ($row[status] == 0) {
        $sql = "UPDATE petitions SET status=1 WHERE petitionid='{$_GET['id']}'";
        $result = db_query($sql);
    }
}
page_footer();
function pub_newpittsburgh_run()
{
    global $session;
    $td = gametimedetails();
    $gt = $td['secssofartoday'];
    //8400 seconds in a day
    //3600 seconds in an hour
    //midnight: 0
    //1am: 3600
    //2am: 7200
    //3am: 10800
    //4am: 14400
    //5am: 18000
    //6am: 21600
    //7am: 25200
    //8am: 28800
    //9am: 32400
    //10am: 36000
    //11am: 39600
    //12pm midday: 43200
    //1pm: 46800
    //2pm: 50400
    //3pm: 54000
    //4pm: 57600
    //5pm: 61200
    //6pm: 64800
    //7pm: 68400
    //8pm: 72000
    //9pm: 75600
    //10pm: 79200
    //11pm: 82800
    //11:59:59: 86399
    //midnight: 0
    page_header("Vigour Mortis");
    $op = httpget("op");
    switch ($op) {
        case "start":
            rawoutput("<table cellpadding=0 cellspacing=0><tr><td><img src='images/pubsigns/newpittsburgh.png' align='left'>");
            $phrases = array(1 => "From the corner, the pub quiz appears to have recently finished, and the quizmaster is reading out the answers - Question 1: Brains. Question 2: BRAINS!, Question 3: BRAAAAINS.", 2 => "George stares at the television, static reflected in his cold, dead eyes.", 3 => "George turns to the bar and takes stock of his inventory of pickled brainstuffs.");
            $chosenphrase = array_rand($phrases);
            output("You walk through a broken door and pick your way over shattered glass to a battered sideboard.  Around you, a number of congenial zombies shuffle in various directions, groaning and mumbling to one another.  The air is thick with the smell of rotting flesh and dust, and congealing blood stains many a tabletop.  A number of zombies cluster around a ridiculously small CRT television, which is displaying static.  The bartender, George, seems to be discussing the relative merits of brains with a local.`n`n");
            output_notl("%s`n`n", $phrases[$chosenphrase]);
            rawoutput("</td></tr></table>");
            require_once "lib/commentary.php";
            addcommentary();
            viewcommentary("pub_newpittsburgh");
            addnav("Talk to people");
            addnav("George", "runmodule.php?module=pub_newpittsburgh&op=bartender");
            modulehook("pub_newpittsburgh");
            break;
        case "continue":
            rawoutput("<table cellpadding=0 cellspacing=0><tr><td><img src='images/pubsigns/newpittsburgh.png' align='left'>");
            output("You rejoin your fellows at the cluttered tables.`n`n");
            rawoutput("</td></tr></table>");
            require_once "lib/commentary.php";
            addcommentary();
            viewcommentary("pub_newpittsburgh");
            addnav("Talk to people");
            addnav("George", "runmodule.php?module=pub_newpittsburgh&op=bartender");
            modulehook("pub_newpittsburgh");
            break;
        case "bartender":
            //add a text parser here at some point, I think...
            //maybe make this opening text time-dependent?
            $text = array();
            $text['hello'] = "George shambles over with a grimace.  \"`2Yes, mate.  What'll it be?`0\"`n`n";
            $drinks = array();
            $hook = array();
            $hook['drinks'] = $drinks;
            $hook['text'] = $text;
            $hook = modulehook("pub_newpittsburgh_bartender", $hook);
            $text = $hook['text'];
            //debug($hook);
            $drinks = $hook['drinks'];
            output_notl($text['hello']);
            foreach ($drinks as $key => $vals) {
                addnav("What'll it be?");
                if (!$vals['blockdrink']) {
                    if ($session['user']['gold'] >= $vals['price']) {
                        addnav(array("%s (%s Req)", $vals['verbosename'], $vals['price']), "runmodule.php?module=pub_newpittsburgh&op=drink&drink=" . $key);
                    } else {
                        addnav(array("%s (%s Req)", $vals['verbosename'], $vals['price']), "");
                    }
                }
            }
            if (!$hook['blockreturnnav']) {
                addnav("Never mind");
                addnav("Return to the lounge", "runmodule.php?module=pub_newpittsburgh&op=continue");
            }
            break;
        case "drink":
            $hook = array("drink" => httpget("drink"));
            $hook = modulehook("pub_newpittsburgh_drink", $hook);
            if (!$hook['blockbarnav']) {
                addnav("More!");
                addnav("Get George's attention again", "runmodule.php?module=pub_newpittsburgh&op=bartender");
            }
            if (!$hook['blockreturnnav']) {
                addnav("That's enough");
                addnav("Return to the lounge", "runmodule.php?module=pub_newpittsburgh&op=continue");
            }
            break;
    }
    addnav("Leave");
    addnav("Back to New Pittsburgh", "village.php");
    page_footer();
}
function worldmapen_run_real()
{
    global $session, $badguy, $pvptimeout, $options, $outdoors, $shady;
    $outdoors = true;
    $op = httpget("op");
    $battle = false;
    if ($op == 'move' && rawurldecode(httpget('oloc')) != get_module_pref('worldXYZ')) {
        debug(get_module_pref('worldXYZ'));
        $op = 'continue';
        httpset('op', $op);
    }
    //	debug("Worldmap running op={$op} ...");
    // handle the admin editor first
    if ($op == "edit") {
        if (!get_module_pref("canedit")) {
            check_su_access(SU_EDIT_USERS);
        }
        if (get_module_setting("worldmapenInstalled") != 1) {
            set_module_setting('worldmapenInstalled', "1");
            worldmapen_defaultcityloc();
        }
        worldmapen_editor();
    }
    if ($op == "destination") {
        $cname = httpget("cname");
        $session['user']['location'] = $cname;
        addnav(array("Enter %s", $cname), "village.php");
        output("`c`4`bYou've Arrived in %s.`b`0`c`n", $cname);
        output("`cYou have reached the outer gates of the city.`c");
    }
    if (!get_module_setting("worldmapenInstalled")) {
        page_header("A rip in the fabric of space and time");
        require_once "lib/villagenav.php";
        villagenav();
        output("`^The admins of this game haven't yet finished installing the worldmapen module.");
        output("You should send them a petition and tell them that they forgot to generate the initial locations of the cities.");
        output("Until then, you are kind of stuck here, so I hope you like where you are.`n`n");
        output("After all, remember:`nWherever you go, there you are.`0");
        page_footer();
    }
    $subop = httpget("subop");
    $act = httpget("act");
    $type = httpget("type");
    $name = httpget("name");
    $direction = httpget("dir");
    $su = httpget("su");
    $buymap = httpget("buymap");
    $worldmapCostGold = get_module_setting("worldmapCostGold");
    $pvp = httpget('pvp');
    require_once "lib/events.php";
    if ($session['user']['specialinc'] != "" || httpget("eventhandler")) {
        $in_event = handle_event(get_module_setting("randevent"), "runmodule.php?module=worldmapen&op=continue&", "Travel");
        if ($in_event) {
            addnav("Continue", "runmodule.php?module=worldmapen&op=continue");
            module_display_events(get_module_setting("randevent"), "runmodule.php?module=worldmapen&op=continue");
            page_footer();
        }
    }
    page_header("Journey");
    //is the player looking at chat?
    if (httpget('comscroll') || httpget('comscroll') === 0 || httpget('comment') || httpget('refresh')) {
        $chatoverride = 1;
        require_once "lib/commentary.php";
        addcommentary();
        $loc = get_module_pref("worldXYZ", "worldmapen");
        viewcommentary("mapchat-" . $loc, "Chat with others who walk this path...", 25);
    }
    if ($op == "beginjourney") {
        $loc = $session['user']['location'];
        $x = get_module_setting($loc . "X");
        $y = get_module_setting($loc . "Y");
        $z = get_module_setting($loc . "Z");
        $xyz = $x . "," . $y . "," . $z;
        set_module_pref("worldXYZ", $xyz);
        output("`b`&The gates of %s`& stand closed behind you.`0`b`n`n", $session['user']['location']);
        $num = e_rand(1, 5);
        $msg = get_module_setting("leaveGates{$num}");
        output("`c`n`^%s`0`n`c`n", $msg);
        worldmapen_determinenav();
        if (get_module_setting("smallmap")) {
            worldmapen_viewsmallmap();
        }
        if (!$chatoverride) {
            require_once "lib/commentary.php";
            addcommentary();
            $loc = get_module_pref("worldXYZ", "worldmapen");
            viewcommentary("mapchat-" . $loc, "Chat with others who walk this path...", 25);
        }
        worldmapen_viewmapkey(true, false);
        module_display_events(get_module_setting("randevent"), "runmodule.php?module=worldmapen&op=continue");
        $loc = get_module_pref('worldXYZ');
        list($x, $y, $z) = explode(",", $loc);
        $t = worldmapen_getTerrain($x, $y, $z);
        //debug($t);
        if ($t['type'] == "Forest") {
            $shady = true;
        }
    } elseif ($op == "continue") {
        checkday();
        worldmapen_determinenav();
        if (get_module_setting("smallmap")) {
            worldmapen_viewsmallmap();
        }
        if (!$chatoverride) {
            require_once "lib/commentary.php";
            addcommentary();
            $loc = get_module_pref("worldXYZ", "worldmapen");
            viewcommentary("mapchat-" . $loc, "Chat with others who walk this path...", 25);
        }
        worldmapen_viewmapkey(true, false);
        $loc = get_module_pref('worldXYZ');
        list($x, $y, $z) = explode(",", $loc);
        $t = worldmapen_getTerrain($x, $y, $z);
        //debug($t);
        if ($t['type'] == "Forest") {
            $shady = true;
        }
        //Turns Trading bit, added by CavemanJoe
    } elseif ($op == "tradeturn") {
        checkday();
        $pointstrade = get_module_setting("turntravel");
        output("You can trade one Turn for %s Travel Points.  Do you want to do this now?", $pointstrade);
        addnav("Yes, use a turn", "runmodule.php?module=worldmapen&op=tradeturnconfirm");
        addnav("No, cancel and return to the map", "runmodule.php?module=worldmapen&op=continue");
    } elseif ($op == "tradeturnconfirm") {
        $pointstrade = get_module_setting("turntravel");
        output("By conserving energy that you would have otherwise used for fighting creatures, you have gained %s Travel Points.", $pointstrade);
        $session['user']['turns']--;
        $ttoday = get_module_pref("traveltoday", "cities");
        set_module_pref("traveltoday", $ttoday - $pointstrade, "cities");
        addnav("Continue", "runmodule.php?module=worldmapen&op=continue");
    } elseif ($op == "move" && !$chatoverride) {
        checkday();
        if ($session['user']['location'] != 'World') {
            set_module_pref("lastCity", $session['user']['location']);
            $session['user']['location'] = "World";
        }
        $session['user']['restorepage'] = "runmodule.php?module=worldmapen&op=continue";
        $loc = get_module_pref('worldXYZ');
        list($x, $y, $z) = explode(",", $loc);
        if ($direction == "north") {
            $y += 1;
        }
        if (get_module_setting("compasspoints") == "1" and $direction == "northeast") {
            $y += 1;
            $x += 1;
        }
        if (get_module_setting("compasspoints") == "1" and $direction == "northwest") {
            $y += 1;
            $x -= 1;
        }
        if ($direction == "east") {
            $x += 1;
        }
        if ($direction == "south") {
            $y -= 1;
        }
        if (get_module_setting("compasspoints") == "1" and $direction == "southeast") {
            $y -= 1;
            $x += 1;
        }
        if (get_module_setting("compasspoints") == "1" and $direction == "southwest") {
            $y -= 1;
            $x -= 1;
        }
        if ($direction == "west") {
            $x -= 1;
        }
        $terraincost = worldmapen_terrain_cost($x, $y, $z);
        $encounterbase = worldmapen_encounter($x, $y, $z);
        $encounterchance = get_module_pref("encounterchance");
        $encounter = $encounterbase * $encounterchance / 100;
        debug($encounterbase . " * " . $encounterchance . " / 100 = " . $encounter);
        $ttoday = get_module_pref("traveltoday", "cities");
        set_module_pref("traveltoday", $ttoday + $terraincost, "cities");
        worldmapen_terrain_takestamina($x, $y, $z);
        $xyz = $x . "," . $y . "," . $z;
        set_module_pref("worldXYZ", $xyz);
        // $randchance = get_module_setting("randchance");
        // if (e_rand(0,100) < $randchance){
        // $eventravel = "travel";
        // set_module_setting("randevent", $eventravel);
        // }else{
        // $eventravel = "forest";
        // set_module_setting("randevent", $eventravel);
        // }
        //Extra Gubbins pertaining to trading Turns for Travel, added by Caveman Joe
        $useturns = get_module_setting("useturns");
        $allowzeroturns = get_module_setting("allowzeroturns");
        $playerturns = $session['user']['turns'];
        $proceed = 1;
        //the Proceed value is used when the player has hit a monster, to make sure it's okay to actually run the event/monster.
        if ($playerturns == 0 && $allowzeroturns == 0) {
            $proceed = 0;
        }
        if (e_rand(0, 100) < $encounter && $su != '1' && $proceed == 1 && !$chatoverride) {
            // They've hit a monster!
            if (module_events(get_module_setting("randevent"), get_module_setting("wmspecialchance"), "runmodule.php?module=worldmapen&op=continue&") != 0) {
                page_header("Something Special!");
                if (checknavs()) {
                    page_footer();
                } else {
                    // Reset the special for good.
                    $session['user']['specialinc'] = "";
                    $session['user']['specialmisc'] = "";
                    $skipvillagedesc = true;
                    $op = "";
                    httpset("op", "");
                    addnav("Continue", "runmodule.php?module=worldmapen&op=continue&");
                    module_display_events(get_module_setting("randevent"), "runmodule.php?module=worldmapen&op=continue");
                    page_footer();
                }
            }
            //Check if we're removing a turn when the player encounters a monster, and if so, do it
            if ($useturns == 1) {
                $session['user']['turns']--;
            }
            //Fix to only search for Forest type creatures, added by CavemanJoe
            $sql = "SELECT * FROM " . db_prefix("creatures") . " WHERE creaturelevel = '{$session['user']['level']}' AND forest = 1 ORDER BY rand(" . e_rand() . ") LIMIT 1";
            $result = db_query($sql);
            restore_buff_fields();
            if (db_num_rows($result) == 0) {
                // There is nothing in the database to challenge you,
                // let's give you a doppleganger.
                $badguy = array();
                $badguy['creaturename'] = "An evil doppleganger of " . $session['user']['name'];
                $badguy['creatureweapon'] = $session['user']['weapon'];
                $badguy['creaturelevel'] = $session['user']['level'];
                $badguy['creaturegold'] = rand($session['user']['level'] * 15, $session['user']['level'] * 30);
                $badguy['creatureexp'] = round($session['user']['experience'] / 10, 0);
                $badguy['creaturehealth'] = $session['user']['maxhitpoints'];
                $badguy['creatureattack'] = $session['user']['attack'];
                $badguy['creaturedefense'] = $session['user']['defense'];
            } else {
                $badguy = db_fetch_assoc($result);
                require_once "lib/forestoutcomes.php";
                $badguy = buffbadguy($badguy);
            }
            calculate_buff_fields();
            $badguy['playerstarthp'] = $session['user']['hitpoints'];
            $badguy['diddamage'] = 0;
            $badguy['type'] = 'world';
            //debug("Worldmap run.php is debugging badguy");
            //debug($badguy);
            $session['user']['badguy'] = createstring($badguy);
            $battle = true;
        } else {
            // $args = modulehook("count-travels", array('available'=>0, 'used'=>0));
            // $free = max(0, $args['available'] - $args['used']);
            // if (get_module_setting("usestamina")==1){
            // output("`c`nYou think to yourself what a nice day it is.`c`n");
            // } else {
            // output("`c`nYou think to yourself what a nice day it is.`nYou have %s Travel Points remaining.%s`c`n",$free);
            // }
            $free = 100;
            worldmapen_determinenav();
            if (get_module_setting("smallmap")) {
                worldmapen_viewsmallmap();
            }
            if (!$chatoverride) {
                require_once "lib/commentary.php";
                addcommentary();
                $loc = get_module_pref("worldXYZ", "worldmapen");
                viewcommentary("mapchat-" . $loc, "Chat with others who walk this path...", 25);
            }
            worldmapen_viewmapkey(true, false);
            module_display_events(get_module_setting("randevent"), "runmodule.php?module=worldmapen&op=continue");
        }
        $loc = get_module_pref('worldXYZ');
        list($x, $y, $z) = explode(",", $loc);
        $t = worldmapen_getTerrain($x, $y, $z);
        //debug($t);
        if ($t['type'] == "Forest") {
            $shady = true;
        }
    } elseif ($op == "gypsy") {
        $outdoors = false;
        if ($buymap == '') {
            output("`5\"`!Ah, yes.  An adventurer.  I could tell by looking into your eyes,`5\" the gypsy says.`n");
            output("\"`!Many people have lost their way while journeying without a guide such as this.");
            output("It will let you see all the world.`5\"`n");
            output("\"`!Yes, yes.  Let's see...  What sort of price should we put on this?");
            output("Hmm.  How about `^%s`! gold?`5\"", $worldmapCostGold);
            addnav(array("Buy World Map `0(`^%s gold`0)", $worldmapCostGold), "runmodule.php?module=worldmapen&op=gypsy&buymap=yes");
            addnav("Forget it", "village.php");
        } elseif ($buymap == 'yes') {
            if ($session['user']['gold'] < $worldmapCostGold) {
                output("`5\"`!What do you take me for?  A blind hag?  Come back when you have the money`5\"");
                addnav("Leave quickly", "village.php");
            } else {
                output("`5\"`!Enjoy your newfound sight,`5\"  the gypsy says as she walks away to greet some patrons that have just strolled in.");
                $session['user']['gold'] -= $worldmapCostGold;
                set_module_pref("worldmapbuy", 1);
                require_once "lib/villagenav.php";
                villagenav();
            }
        }
    } elseif ($op == "viewmap") {
        worldmapen_determinenav();
        worldmapen_viewmap(true);
        if (is_module_active("medals")) {
            require_once "modules/medals.php";
            medals_award_medal("boughtmap", "Bearer of the Map", "This player purchased the World Map from the Comms Tent!", "medal_islandmap.png");
        }
    } elseif ($op == "camp") {
        if ($session['user']['loggedin']) {
            $session['user']['loggedin'] = 0;
            $session['user']['restorepage'] = "runmodule.php?module=worldmapen&op=wake";
            saveuser();
            invalidatedatacache("charlisthomepage");
            invalidatedatacache("list.php-warsonline");
        }
        $session = array();
        redirect("index.php", "Redirected to Index from World Map");
    } elseif ($op == "wake") {
        if ($session['user']['hitpoints'] > 0) {
            // runmodule.php calls do_forced_nav,
            $session['user']['alive'] = true;
            // and that resets ['alive'], so
        } else {
            // this is from common.php to make sure
            $session['user']['alive'] = false;
            // the player is not half-dead after log-in.
        }
        output("You yawn and stretch and look around your campsite.`n`n");
        output("Ah, how wonderful it is to sleep in the open air!`n");
        output("The world seems full of possibilities today.`n`n");
        checkday();
        worldmapen_determinenav();
        if (get_module_setting("smallmap")) {
            worldmapen_viewsmallmap();
        }
        if (!$chatoverride) {
            require_once "lib/commentary.php";
            addcommentary();
            $loc = get_module_pref("worldXYZ", "worldmapen");
            viewcommentary("mapchat-" . $loc, "Chat with others who walk this path...", 25);
        }
        worldmapen_viewmapkey(true, false);
        $loc = get_module_pref('worldXYZ');
        list($x, $y, $z) = explode(",", $loc);
        $t = worldmapen_getTerrain($x, $y, $z);
        //debug($t);
        if ($t['type'] == "Forest") {
            $shady = true;
        }
    } elseif ($op == "combat") {
        // Okay, we've picked a person to fight.
        require_once "lib/pvpsupport.php";
        $name = httpget("name");
        $badguy = setup_target($name);
        $failedattack = false;
        if ($badguy === false) {
            output("`0`n`nYou survey the area again.`n");
            worldmapen_determinenav();
        } else {
            $battle = true;
            $badguy['type'] = 'pvp';
            //$options['type'] = 'pvp';
            $session['user']['badguy'] = createstring($badguy);
            $session['user']['playerfights']--;
        }
    } elseif ($op == "fight" || $op == "run") {
        if (!$chatoverride && !httpget("frombio")) {
            $battle = true;
        } else {
            worldmapen_determinenav();
            if (get_module_setting("smallmap")) {
                worldmapen_viewsmallmap();
            }
            worldmapen_viewmapkey(true, false);
        }
        // $args = modulehook("count-travels", array('available'=>0,'used'=>0));
        // $free = max(0, $args['available'] - $args['used']);
        // if (get_module_setting("usestamina")==1){
        $free = 100;
        // }
        if ($op == "run" && !$pvp) {
            if (!$chatoverride) {
                if (e_rand(1, 5) < 3 && $free) {
                    // They managed to get away.
                    output("You set off running at a breakneck pace!`n`n");
                    output("A short time later, you have managed to avoid your opponent, so you stop to catch your breath.");
                    $ttoday = get_module_pref("traveltoday", "cities");
                    set_module_pref("traveltoday", $ttoday + 1, "cities");
                    output("As you look around, you realize that all you really managed was to run in circles.");
                    $battle = false;
                    worldmapen_determinenav();
                    if (get_module_setting("smallmap")) {
                        worldmapen_viewsmallmap();
                    }
                    require_once "lib/commentary.php";
                    addcommentary();
                    $loc = get_module_pref("worldXYZ", "worldmapen");
                    viewcommentary("mapchat-" . $loc, "Chat with others who walk this path...", 25);
                    worldmapen_viewmapkey(true, false);
                } else {
                    output("You try to run, but you don't manage to get away!`n");
                    $op = "fight";
                    httpset('op', $op);
                }
            } else {
                if (get_module_setting("smallmap")) {
                    worldmapen_viewsmallmap();
                }
                require_once "lib/commentary.php";
                addcommentary();
                $loc = get_module_pref("worldXYZ", "worldmapen");
                viewcommentary("mapchat-" . $loc, "Chat with others who walk this path...", 25);
                worldmapen_determinenav();
                worldmapen_viewmapkey(true, false);
            }
        } elseif ($op == "run" && $pvp) {
            output("Your pride prevents you from running");
            $op = "fight";
            httpset('op', $op);
        }
        $loc = get_module_pref('worldXYZ');
        list($x, $y, $z) = explode(",", $loc);
        $t = worldmapen_getTerrain($x, $y, $z);
        //debug($t);
        if ($t['type'] == "Forest") {
            $shady = true;
        }
    }
    if ($battle) {
        include_once "battle.php";
        if (isset($enemies) && !$pvp) {
            $badguy =& $enemies;
        }
        if ($victory) {
            if ($pvp) {
                require_once "lib/pvpsupport.php";
                $aliveloc = $badguy['location'];
                pvpvictory($badguy, $aliveloc, $options);
                addnews("`4%s`3 defeated `4%s`3 while they were camped in the wilderness.`0", $session['user']['name'], $badguy['creaturename']);
                $badguy = array();
            } else {
                if (!$chatoverride && !httpget('frombio')) {
                    //is talking
                    require_once "lib/forestoutcomes.php";
                    forestvictory($badguy, false);
                }
            }
            //has just beaten a badguy
            worldmapen_determinenav();
            if (get_module_setting("smallmap")) {
                worldmapen_viewsmallmap();
            }
            if (!$chatoverride) {
                require_once "lib/commentary.php";
                addcommentary();
                $loc = get_module_pref("worldXYZ", "worldmapen");
                viewcommentary("mapchat-" . $loc, "Chat with others who walk this path...", 25);
            }
            worldmapen_viewmapkey(true, false);
        } elseif ($defeat) {
            // Reset the players body to the last city they were in
            $session['user']['location'] = get_module_pref('lastCity');
            if ($pvp) {
                require_once "lib/pvpsupport.php";
                require_once "lib/taunt.php";
                $killedloc = $badguy['location'];
                $taunt = select_taunt();
                pvpdefeat($badguy, $killedloc, $taunt, $options);
                addnews("`4%s`3 was defeated while attacking `4%s`3 as they were camped in the wilderness.`0`n%s", $session['user']['name'], $badguy['creaturename'], $taunt);
            } else {
                require_once "lib/forestoutcomes.php";
                forestdefeat($badguy, "in the wild");
            }
            output("`n`n`&You are sure that someone, sooner or later, will stumble over your corpse and return it to %s`& for you.`0", $session['user']['location']);
        } else {
            require_once "lib/fightnav.php";
            $allow = true;
            $extra = "";
            if ($pvp) {
                $allow = false;
                $extra = "pvp=1&";
            }
            fightnav($allow, $allow, "runmodule.php?module=worldmapen&{$extra}");
        }
    }
    page_footer();
}
Ejemplo n.º 28
0
<?
require_once "common.php";

page_header("The Gardens");

addcommentary();
checkday();

output("`b`c`2The Gardens`0`c`b");

output("`n`n You walk through a gate and on to one of the many winding paths that makes its way through the well-tended gardens.  From the flowerbeds that bloom even in darkest winter, to the hedges whose shadows promise forbidden secrets, these gardens provide a refuge for those seeking out the Green Dragon; a place where they can forget their troubles for a while and just relax.");
output("`n`nOne of the fairies buzzing about the garden flies up to remind you that the garden is a place for roleplaying, and to confine out-of-character comments to the other areas of the game.");
output("`n`n");
viewcommentary("gardens","Whisper here",30,"whispers");

addnav("Return to the village","village.php");

page_footer();
?>
Ejemplo n.º 29
0
         output("</td></tr>", true);
     }
     output("</table>", true);
 } else {
     if ($session['user']['sex']) {
         output("`^You duck in to a secret cave that few know about.  Inside you are greeted ");
         output("by the sight of numerous muscular bare-chested men who wave palm fronds at you ");
         output("and offer to feed you grapes as you lounge on Greko-Roman couches draped with ");
         output("silk.`n`n");
     } else {
         output("`^You duck in to a secret cave that few know about.  Inside you are greeted ");
         output("by the sight of numerous scantily clad buxom women who wave palm fronds at you ");
         output("and offer to feed you grapes as you lounge on Greko-Roman couches draped with ");
         output("silk.`n`n");
     }
     viewcommentary("superuser", "Engage in idle conversation with other gods:", 25);
     addnav("Actions");
     addnav("Petition Viewer", "viewpetition.php");
     if ($session['user']['superuser'] >= 3) {
         addnav("C?Recent Commentary", "superuser.php?op=checkcommentary");
     }
     addnav("B?Player Bios", "bios.php");
     if ($session['user']['superuser'] >= 3) {
         addnav("Donator Page", "donators.php");
     }
     if ($session['user']['superuser'] >= 3) {
         addnav("Retitler", "retitle.php");
     }
     addnav("Display Bounties", "superuser.php?op=bounties");
     addnav("Editors");
     if ($session['user']['superuser'] >= 3) {
Ejemplo n.º 30
0
    motditem("Testing!", "Please see the testing message below.");
    output("`%");
    $sql = "SELECT * FROM motd ORDER BY motddate DESC limit 20";
    $result = db_query($sql);
    for ($i = 0; $i < db_num_rows($result); $i++) {
        $row = db_fetch_assoc($result);
        if ($row['motddate'] > $session['user']['lastmotd'] || $i < 5) {
            if ($row['motdtype'] == 0) {
                motditem($row['motdtitle'] . ($session['user']['superuser'] >= 3 ? "[<a href='motd.php?op=del&id=" . $row['motditem'] . "' onClick=\"return confirm('Are you sure you want to delete this item?');\">Del</a>]" : ""), $row['motdbody']);
            } else {
                pollitem($row['motditem'], $row['motdtitle'] . ($session['user']['superuser'] >= 3 ? "[<a href='motd.php?op=del&id=" . $row['motditem'] . "' onClick=\"return confirm('Are you sure you want to delete this item?');\">Del</a>]" : ""), $row['motdbody']);
            }
        }
    }
    output("`&");
    motditem("Testing!", "For those who might be unaware, this game is in testing.  We are working on it when we have time.  Feel free to drop suggestions, I'm open to anything :-)");
    output("`@Commentary:`0`n");
    viewcommentary("motd");
}
/*
motditem("Spring Fashions","My lovely wife is in the process of updating the armor and weapons found in the local shoppes.  There will be a new set for each dragon kill, so you'll never wear the same armor or wield the same weapon twice!");
motditem("Dragon Points!","You probably already noticed by now, but there is a new system named Dragon Points.  These afford you another way to permanently increase  your character's abilities.  You gain one Dragon Point for each dragon slaying.");
motditem("Getting slain in the fields","There is a new drawback, and a new upside to getting attacked in the fields.  If you die in the fields when someone else attacked you, you lose 5% of your exp, along with your gold.  But if you are victorious when someone else attacks you, you get their gold, and 10% of THEIR exp.  When you attack others in the field has not changed, you can get 10% of your victim's exp and all their gold if you win, and you lose 15% of your exp, and all of your gold if you lose.  You cannot attack someone 2 levels below you any longer either, only 1 level below, and 2 levels above.");
motditem("New Days","New days should now occur automatically when the clock in the village reaches midnight.  Due to a bug on my part though, some accounts got goofed up.  Please email me at trash@mightye.org if you are not able to play the game, and I'll fix your account.");
*/
$session['needtoviewmotd'] = false;
$sql = "SELECT motddate FROM motd ORDER BY motditem DESC LIMIT 1";
$result = db_query($sql);
$row = db_fetch_assoc($result);
$session['user']['lastmotd'] = $row['motddate'];
popup_footer();