function rail_peddler_run()
{
global $session, $inventory;
$op = httpget("op");
$loc = rail_peddler_getloc();
$hid = $loc["peddlerhid"];
$rid = $loc["peddlerrid"];
$price = get_module_setting("peddlerprice");
if ($op == "buy") {
$headertext = "Why sure, I'll take one of those!";
} else {
$headertext = "Go away, I'm busy.";
}
page_header($headertext);
switch ($op) {
case "buy":
output("The scruffy vendor's eyes gleam. Was that a fla`gs`0h of green, or no? \"`2Verra wise, %s. Ye willna be sorry!`0\"`n`n", translate_inline($session['user']['sex'] ? 'lass' : 'lad'));
give_item("cardcase");
// if (!$success){
// output("Then -- a frown. \"`2Wait, no, I canna sell t'ye. Ye'd better petition the Big Boss, tell 'im t'see what's gaen wrong wiv all dis.`0\"`n`n");
// } else {
output("You have a fine leather card case. Pleased, you admire its soft texture. What an excellent purchase you have made!`n`n");
// }
$session['user']['gems'] -= $price;
break;
case "pass":
output("\"`2Bleedin' smart-arse.`0\" The scruffy vendor shrugs and goes off to pester someone else.`n`n");
break;
}
addnav("Back to the Concourse", "runmodule.php?module=improbablehousing&op=interior&hid={$hid}&rid={$rid}");
page_footer();
}
function nooblube_dohook($hookname, $args)
{
global $session, $badguy;
switch ($hookname) {
case "battle-defeat":
//check to see if they're alive first, 'cause otherwise it'll add favour when they get wiped out on the FailBoat
if ($session['user']['alive'] == false) {
break;
}
//check to see if they've got any hitpoints, for stuff like the Tattoo Monster and defeating their masters
if ($session['user']['hitpoints'] > 0) {
break;
}
$maxlevel = get_module_setting("level");
$currentlevel = $session['user']['level'];
if ($currentlevel < $maxlevel) {
if ($session['user']['dragonkills'] == 0) {
if ($session['user']['deathpower'] < 100) {
$session['user']['deathpower'] = get_module_setting("lube");
}
$tutormsg = translate_inline("`#What did I tell you about being careful? Bloody newbies. Okay, those nice gentlemen coming towards you will pick you up and drag you to my FailBoat, but don't worry about it too much. Just come and see me below decks and I'll get you put on the next boat back to the Island. Don't get used to it though, matey - once you hit level ten, you'll have to fight for your freedom like everyone else.");
if ($tutormsg) {
tutor_talk("%s", $tutormsg);
}
}
}
break;
}
return $args;
}
function checkban(string $login, bool $connect = false) : bool
{
global $session;
$accounts = db_prefix('accounts');
$bans = db_prefix('accounts');
$today = date('Y-m-d');
$sql = db_query("SELECT lastip, uniquid, banoverride, superuser FROM {$accounts}\n WHERE login = '{$login}'");
$row = db_fetch_assoc($sql);
if ($row['banoverride'] || $row['superuser'] & ~SU_DOESNT_GIVE_GROTTO) {
return false;
}
db_free_result($sql);
$sql = db_query("SELECT * FROM {$bans}\n WHERE (\n (ipfilter = '{$row['lastip']}' OR ipfilter = '{$_SERVER['REMOTE_ADDR']}')\n OR (uniqueid = '{$row['uniqueid']}' OR uniqueid = '{$_COOKIE['lgi']}')\n )\n AND (banexpire = '000-00-00' OR banexpire >= '{$today}')");
if (db_num_rows($sql) > 0) {
if ($connect) {
$session = [];
tlschema('ban');
$session['message'] .= translate_inline('`n`4You fall under a ban currently in place on this website:');
while ($row = db_fetch_assoc($sql)) {
$session['message'] .= "`n{$row['banreason']}`n";
if ($row['banexpire'] == '0000-00-00') {
$session['message'] .= translate_inline("`\$This ban is permanent!`0");
} else {
$session['message'] .= sprintf_translate("`^This ban will be removed `\$after`^ %s.`0", date("M d, Y", strtotime($row['banexpire'])));
}
db_query("UPDATE {$bans}\n SET lasthit = '{$today} 00:00:00'\n WHERE ipfilter = '{$row['ipfilter']}'\n AND uniqueid = '{$row['uniqueid']}'\n ");
}
$session['message'] .= translate_inline("`n`4If you wish, you may appeal your ban with the petition link.");
tlschema();
header('Location: home.php');
}
return true;
}
return false;
}
function dwshacks_dohook($hookname, $args)
{
global $session;
switch ($hookname) {
case "dwellings-list-type":
addnav("Show Only Types");
addnav(array("%s", translate_inline(ucfirst(get_module_setting("dwnameplural", "dwshacks")))), "runmodule.php?module=dwellings&op=list&showonly=dwshacks&ref={$args['ref']}&sortby={$args['sortby']}&order={$args['order']}");
break;
case "dwellings-list-interact":
if ($args['type'] == "dwshacks" && $args['status'] == 1 && get_module_setting("maxkeys") == 123456789) {
addnav("", "runmodule.php?module=dwellings&op=enter&dwid={$args['dwid']}");
$tress = translate_inline("Tresspass");
rawoutput("<a href='runmodule.php?module=dwellings&op=enter&dwid={$args['dwid']}'>{$tress}</a>");
}
break;
case "dwellings-manage":
$dwid = $args['dwid'];
if (get_module_setting("maxkeys") == 123456789 && $args['type'] == "dwshacks") {
blocknav("runmodule.php?module=dwellings&op=keys&dwid={$dwid}");
}
break;
case "dwellings":
if (get_module_objpref("city", $args['cityid'], "showdwshacks")) {
output(" Along the narrow pathway, precariously placed wood planks are nailed and leaning on each other in a fashion that only leaves you to assume they are supposed to be %s.`0", translate_inline(get_module_setting("dwnameplural")));
if ($args['allowbuy'] == 1 && $session['user']['dragonkills'] >= get_module_setting("dkreq")) {
$cityid = $args['cityid'];
addnav("Options");
addnav(array("Establish a %s", translate_inline(ucfirst(get_module_setting("dwname", "dwshacks")))), "runmodule.php?module=dwellings&op=buy&type=dwshacks&subop=presetup&cityid={$cityid}");
}
}
break;
}
return $args;
}
function faqmute_dohook($hookname, $args)
{
global $session;
$seen = get_module_pref("seenfaq");
switch ($hookname) {
case "insertcomment":
if (!$seen && !$session['user']['dragonkills']) {
$args['mute'] = 1;
$mutemsg = "`n`\$You have to read the FAQ before you can post comments. You can find it in any town.`0`n`n";
$mutemsg = translate_inline($mutemsg);
$args['mutemsg'] = $mutemsg;
}
break;
case "faq-posttoc":
if (!$seen) {
set_module_pref("seenfaq", true);
}
break;
case "bioinfo":
$id = $args['acctid'];
$seen = get_module_pref("seenfaq", false, $id);
if (httpget("op") == "faqmute") {
set_module_pref("seenfaq", false, false, $id);
output("`nPlayer's FAQ seen status reset.`n");
} elseif ($session['user']['superuser'] & SU_EDIT_COMMENTS && $seen && !$args['dragonkills']) {
addnav("Mute Player Options");
addnav("FAQmute player", "bio.php?char=" . $id . "&ret=" . rawurlencode(httpget("ret")) . "&op=faqmute");
}
break;
}
return $args;
}
function lovers_chat_seth()
{
global $session;
if (httpget("act") == "") {
output("You make your way over to where %s`0 is sitting, ale in hand.", getsetting("bard", "`^Seth"));
output("Sitting down, and waiting for %s`0 to finish a song, you light your pipe.", getsetting("bard", "`^Seth"));
addnav("Ask about your manliness", "runmodule.php?module=lovers&op=chat&act=armor");
addnav("Discuss Sports", "runmodule.php?module=lovers&op=chat&act=sports");
} elseif (httpget("act") == "sports") {
output("You and %s`0 spend some time talking about the recent dwarf tossing competition.", getsetting("bard", "`^Seth"));
output("Not wanting to linger around another man for too long, so no one \"wonders\", you decide you should find something else to do.");
} else {
$charm = $session['user']['charm'] + e_rand(-1, 1);
output("%s`0 looks you up and down very seriously.", getsetting("bard", "`^Seth"));
output("Only a friend can be truly honest, and that is why you asked him.");
switch ($charm) {
case -3:
case -2:
case -1:
case 0:
$msg = translate_inline("You make me glad I'm not gay!");
break;
case 1:
case 2:
case 3:
$msg = translate_inline("I've seen some handsome men in my day, but I'm afraid you aren't one of them.");
break;
case 4:
case 5:
case 6:
$msg = translate_inline("I've seen worse my friend, but only trailing a horse.");
break;
case 7:
case 8:
case 9:
$msg = translate_inline("You're of fairly average appearance my friend.");
break;
case 10:
case 11:
case 12:
$msg = translate_inline("You certainly are something to look at, just don't get too big of a head about it, eh?");
break;
case 13:
case 14:
case 15:
$msg = translate_inline("You're quite a bit better than average!");
break;
case 16:
case 17:
case 18:
$msg = translate_inline("Few women would be able to resist you!");
break;
default:
$msg = translate_inline("I hate you, why, you are simply the most handsome man ever!");
}
output("Finally he reaches a conclusion and states, \"%s`0\"", $msg);
}
}
function do_forced_nav($anonymous, $overrideforced)
{
global $baseaccount, $session, $REQUEST_URI;
rawoutput("<!--\nAllowAnonymous: " . ($anonymous ? "True" : "False") . "\nOverride Forced Nav: " . ($overrideforced ? "True" : "False") . "\n-->");
if (isset($session['loggedin']) && $session['loggedin']) {
$sql = "SELECT * FROM " . db_prefix("accounts") . " WHERE acctid = '" . $session['user']['acctid'] . "'";
$result = db_query($sql);
if (db_num_rows($result) == 1) {
$session['user'] = db_fetch_assoc($result);
$baseaccount = $session['user'];
$session['bufflist'] = unserialize($session['user']['bufflist']);
if (!is_array($session['bufflist'])) {
$session['bufflist'] = array();
}
$session['user']['dragonpoints'] = unserialize($session['user']['dragonpoints']);
$session['user']['prefs'] = unserialize($session['user']['prefs']);
if (!is_array($session['user']['dragonpoints'])) {
$session['user']['dragonpoints'] = array();
}
if (is_array(unserialize($session['user']['allowednavs']))) {
$session['allowednavs'] = unserialize($session['user']['allowednavs']);
} else {
$session['allowednavs'] = array($session['user']['allowednavs']);
}
if (!$session['user']['loggedin'] || date("U") - strtotime($session['user']['laston']) > getsetting("LOGINTIMEOUT", 900)) {
$session = array();
redirect("index.php?op=timeout", "Account not logged in but session thinks they are.");
}
} else {
$session = array();
$session['message'] = translate_inline("`4Error, your login was incorrect`0", "login");
redirect("index.php", "Account Disappeared!");
}
db_free_result($result);
//check the nav exists in the session's allowednavs array
if (isset($session['allowednavs'][$REQUEST_URI]) && $session['allowednavs'][$REQUEST_URI] && $overrideforced !== true) {
//The nav is fine
//clear the navs - more navs will be added as the script the player is currently viewing loads and executes
$session['allowednavs'] = array();
} else {
if ($overrideforced !== true) {
//This nav is not fine at all. Redirect the player to badnav.php.
$session['badnav'] = 1;
redirect("badnav.php", "Navigation not allowed to {$REQUEST_URI}");
}
}
} else {
if (!$anonymous) {
$session['message'] = translate_inline("You are not logged in, this may be because your session timed out.", "login");
redirect("index.php?op=timeout&nli=true", "Not logged in: {$REQUEST_URI}");
}
}
}
function forest($noshowmessage = false)
{
global $session, $playermount;
tlschema("forest");
// mass_module_prepare(array("forest", "validforestloc"));
addnav("Heal");
addnav("H?Hospital Tent", "healer.php");
addnav("Fight");
addnav("L?Look for Something to Kill", "forest.php?op=search");
if ($session['user']['level'] > 1) {
addnav("S?Go Slumming", "forest.php?op=search&type=slum");
}
addnav("T?Go Thrillseeking", "forest.php?op=search&type=thrill");
if (getsetting("suicide", 0)) {
if (getsetting("suicidedk", 10) <= $session['user']['dragonkills']) {
addnav("*?Search `\$Suicidally`0", "forest.php?op=search&type=suicide");
}
}
if ($session['user']['level'] >= 15 && $session['user']['seendragon'] == 0) {
// Only put the green dragon link if we are a location which
// should have a forest. Don't even ask how we got into a forest()
// call if we shouldn't have one. There is at least one way via
// a superuser link, but it shouldn't happen otherwise.. We just
// want to make sure however.
$isforest = 0;
$vloc = modulehook('validforestloc', array());
foreach ($vloc as $i => $l) {
if ($session['user']['location'] == $i) {
$isforest = 1;
break;
}
}
if ($isforest || count($vloc) == 0) {
addnav("G?`@Seek Out the Green Dragon", "forest.php?op=dragon");
}
}
addnav("Other");
villagenav();
if ($noshowmessage != true) {
$foresttext = array();
tlschema();
$foresttext[] = translate_inline("The Jungle, home to the vicious creatures of Doktor Improbable's obscene laboratories - and to various evildoers of all descriptions.`n`nThe thick foliage of the jungle restricts your view to only a few yards in most places. The paths would be imperceptible except for your trained eye. You move as silently as a soft breeze across the thick moss covering the ground, wary to avoid stepping on a twig or any of the numerous pieces of bleached bone that populate the jungle floor, lest you betray your presence to one of the vile beasts that wander this place.`n`nThen you think \"`#Sod it,`0\" and tear off looking for something to kill.`n`n");
$foresttext = modulehook("forest-desc", $foresttext);
output($foresttext);
}
modulehook("forest", array());
module_display_events("forest", "forest.php");
addnav("Inventory");
addnav("View your Inventory", "inventory.php?items_context=forest");
tlschema();
}
function clanform()
{
rawoutput("<form action='clan.php?op=new&apply=1' method='POST'>");
addnav("", "clan.php?op=new&apply=1");
output("`b`cNew Clan Application Form`c`b");
output("Clan Name: ");
rawoutput("<input name='clanname' maxlength='50' value=\"" . htmlentities(stripslashes(httppost('clanname')), ENT_COMPAT, getsetting("charset", "ISO-8859-1")) . "\">");
output("`nShort Name: ");
rawoutput("<input name='clanshort' maxlength='5' size='5' value=\"" . htmlentities(stripslashes(httppost('clanshort')), ENT_COMPAT, getsetting("charset", "ISO-8859-1")) . "\">");
output("`nNote, color codes are permitted in neither clan names nor short names.");
output("The clan name is shown on player bios and on clan overview pages while the short name is displayed next to players' names in comment areas and such.`n");
$apply = translate_inline("Apply");
rawoutput("<input type='submit' class='button' value='{$apply}'></form>");
}
请发表评论