function textme_dohook($hook, $args) { if (httpget('op') == 'send') { require_once 'lib/names.php'; textme_sendmail(httpallpost(), get_player_basename()); } return $args; }
function hunterslodge_customtitle_run() { require_once "lib/sanitize.php"; require_once "lib/names.php"; global $session; $op = httpget("op"); $free = httpget("free"); page_header("Choose your Custom Title"); switch ($op) { case "change": output("Ready to change your Title? No problem. Enter your desired Title in the box below. You've got 25 characters to play with, including colour codes.`n`n"); titlechange_form(); addnav("Cancel"); addnav("Don't change colours, just go back to the Lodge", "runmodule.php?module=iitems_hunterslodge&op=start"); break; case "confirm": $ntitle = rawurldecode(httppost('newname')); $ntitle = newline_sanitize($ntitle); if ($ntitle == "") { $ntitle = "`0"; } $ntitle = preg_replace("/[`][cHw]/", "", $ntitle); $ntitle = sanitize_html($ntitle); $nname = get_player_basename(); output("`0Your new title will look like this: %s`0`n", $ntitle); output("`0Your entire name will look like: %s %s`0`n`n", $ntitle, $nname); output("Do you want to set the new title now?`n`n"); output("`0Try a different title below, if you like.`n`n"); titlechange_form(); addnav("Confirm"); addnav("Set the new Title", "runmodule.php?module=hunterslodge_customtitle&op=set&free={$free}&newname=" . rawurlencode($ntitle)); addnav("Cancel"); addnav("Don't change your Title, just go back to the Lodge", "runmodule.php?module=iitems_hunterslodge&op=start"); break; case "set": $ntitle = rawurldecode(httpget('newname')); $fromname = $session['user']['name']; $newname = change_player_ctitle($ntitle); $session['user']['ctitle'] = $ntitle; $session['user']['name'] = $newname; output("You are now known as %s!`0`n`n", $session['user']['name']); if (!$free) { $id = has_item("hunterslodge_customtitle"); delete_item($id); } addnav("Return"); addnav("Return to the Lodge", "runmodule.php?module=iitems_hunterslodge&op=start"); break; } page_footer(); }
function change_player_title($ntitle, $old = false) { global $session; if ($old === false) { $ctitle = $session['user']['ctitle']; } else { $ctitle = $old['ctitle']; } $newname = get_player_basename($old) . "`0"; if ($ctitle == "") { if ($ntitle != "") { $newname = $ntitle . " " . $newname; } } else { $newname = $ctitle . " " . $newname; } return $newname; }
function namecolour_form() { $context = httpget("context"); $regname = get_player_basename(); rawoutput("Your current name is: " . $regname); output("`0`nWhich renders as: %s`0`n`n", $regname); if (httppost("newname")) { $val = httppost("newname"); } else { $val = htmlentities($regname, ENT_COMPAT, getsetting("charset", "ISO-8859-1")); } rawoutput("<form action='runmodule.php?module=hunterslodge_customcolours&op=confirm&context={$context}&free={$free}' method='POST'>"); rawoutput("<input id='input' name='newname' width='30' maxlength='30' value='" . $val . "'>"); rawoutput("<input type='submit' class='button' value='Preview'>"); rawoutput("</form>"); addnav("", "runmodule.php?module=hunterslodge_customcolours&op=confirm&context={$context}&free={$free}"); }
rawoutput("</form>"); //Show a user's usertable rawoutput("<form action='user.php?op=save&userid={$userid}{$returnpetition}' method='POST'>"); addnav("", "user.php?op=save&userid={$userid}{$returnpetition}"); $save = translate_inline("Save"); rawoutput("<input type='submit' class='button' value='{$save}'>"); if ($row['loggedin'] == 1 && $row['laston'] > date("Y-m-d H:i:s", strtotime("-" . getsetting("LOGINTIMEOUT", 900) . " seconds"))) { output_notl("`\$"); rawoutput("<span style='font-size: 20px'>"); output("`\$Warning:`0"); rawoutput("</span>"); output("`\$This user is probably logged in at the moment!`0"); } // Okay, munge the display name down to just the players name sans // title $row['name'] = get_player_basename($row); /*careful using this hook! add only things with 'viewonly' in there, nothing will be saved if do otherwise! Example: do_hook of your module: array_push($args['userinfo'], "Some Stuff to have a look at,title"); $args['userinfo']['test'] = "The truth!!!,viewonly"; $args['user']['test'] = "Is out there???"; */ $showformargs = modulehook("modifyuserview", array("userinfo" => $userinfo, "user" => $row)); $info = showform($showformargs['userinfo'], $showformargs['user']); rawoutput("<input type='hidden' value=\"" . htmlentities(serialize($info), ENT_COMPAT, getsetting("charset", "ISO-8859-1")) . "\" name='oldvalues'>"); rawoutput("</form>"); output("`n`nLast Page Viewed:`n"); rawoutput("<iframe src='user.php?op=lasthit&userid={$userid}' width='100%' height='400'>"); output("You need iframes to view the user's last hit here."); output("Use the link in the nav instead."); rawoutput("</iframe>");
if ($val == "at") { $session['user']['attack']++; } if ($val == "de") { $session['user']['defense']++; } } $session['user']['laston'] = date("Y-m-d H:i:s", strtotime("-1 day")); $session['user']['slaydragon'] = 1; $companions = array(); $session['user']['companions'] = array(); output("`n`nYou wake up in the midst of some trees. Nearby you hear the sounds of a village."); output("Dimly you remember that you are a new warrior, and something of a dangerous Green Dragon that is plaguing the area. You decide you would like to earn a name for yourself by perhaps some day confronting this vile creature."); // allow explanative text as well. modulehook("dragonkilltext"); $regname = get_player_basename(); output("`n`n`^You are now known as `&%s`^!!", $session['user']['name']); if ($session['user']['dragonkills'] == 1) { addnews(sprintf_translate("`#%s`# has earned the title `&%s`# for having slain the `@Green Dragon`& `^%s`# time!", $regname, $session['user']['title'], $session['user']['dragonkills'])); output("`n`n`&Because you have slain the dragon %s time, you start with some extras. You also keep additional permanent hitpoints you've earned.`n", $session['user']['dragonkills']); } else { addnews(sprintf_translate("`#%s`# has earned the title `&%s`# for having slain the `@Green Dragon`& `^%s`# times!", $regname, $session['user']['title'], $session['user']['dragonkills'])); output("`n`n`&Because you have slain the dragon %s times, you start with some extras. You also keep additional permanent hitpoints you've earned.`n", $session['user']['dragonkills']); } $session['user']['charm'] += 5; output("`^You gain FIVE charm points for having defeated the dragon!`n"); debuglog("slew the dragon and starts with {$session['user']['gold']} gold and {$session['user']['gems']} gems"); // Moved this hear to make some things easier. modulehook("dragonkill", array()); invalidatedatacache("list.php-warsonline"); }
function titlechange_run() { require_once "lib/sanitize.php"; require_once "lib/names.php"; global $session; $op = httpget("op"); page_header("Hunter's Lodge"); $pointsavailable = $session['user']['donation'] - $session['user']['donationspent']; $permcost = get_module_setting("permanent"); if ($op == "permanent") { page_header("Unlimited Title Changes"); output("For %s Donator Points, you can change your Title as often as you like without paying again.`n`n", $permcost); addnav("Unlimited Changes"); if ($pointsavailable >= $permcost) { addnav(array("Get permanent free Title changes (%s Points)", $permcost), "runmodule.php?module=titlechange&op=permanentconfirm"); } else { addnav(array("Sorry, but you need %s more Donator Points for this option.", $permcost - $pointsavailable), ""); } addnav("Cancel", "lodge.php"); page_footer(); } if ($op == "permanentconfirm") { page_header("Unlimited Title Changes"); output("You've got unlimited Title Changes!"); addnav("Back to the Lodge", "lodge.php"); set_module_pref("permanent", 1); $session['user']['donationspent'] += $permcost; page_footer(); } if ($op == "titlechange") { if (get_module_pref("timespurchased")) { $cost = get_module_setting("extrapoints"); } else { $cost = get_module_setting("initialpoints"); } if (get_module_pref("permanent")) { $cost = 0; } if ($cost <= $session['user']['donation'] - $session['user']['donationspent']) { output("`3`bCustomize Title`b`0`n`n"); output("`7Because you have earned sufficient points, you have been granted the ability to set a custom title of your choosing."); output("The title must be appropriate, and the admin of the game can reset if it isn't (as well as penalize you for abusing the game)."); output("The title may not be more than 25 characters long including any characters used for colorization!.`n`n"); $otitle = get_player_title(); if ($otitle == "`0") { $otitle = ""; } output("`7Your title is currently`^ "); rawoutput($otitle); output_notl("`0`n"); output("`7which looks like %s`n`n", $otitle); if (httpget("err") == 1) { output("`\$Please enter a title.`n"); } output("`7How would you like your title to look?`n"); rawoutput("<form action='runmodule.php?module=titlechange&op=titlepreview' method='POST'>"); rawoutput("<input id='input' name='newname' width='25' maxlength='25' value='" . htmlentities($otitle, ENT_COMPAT, getsetting("charset", "ISO-8859-1")) . "'>"); rawoutput("<input type='submit' class='button' value='Preview'>"); rawoutput("</form>"); addnav("", "runmodule.php?module=titlechange&op=titlepreview"); } else { output("Sorry, but you don't have enough points to do that!`n`n"); } } elseif ($op == "titlepreview") { $ntitle = rawurldecode(httppost('newname')); $ntitle = newline_sanitize($ntitle); if ($ntitle == "") { if (get_module_setting("blank")) { $ntitle = "`0"; } else { redirect("runmodule.php?module=titlechange&op=titlechange&err=1"); } } if (!get_module_setting("bold")) { $ntitle = str_replace("`b", "", $ntitle); } if (!get_module_setting("italics")) { $ntitle = str_replace("`i", "", $ntitle); } $ntitle = sanitize_colorname(get_module_setting("spaceinname"), $ntitle); $ntitle = preg_replace("/[`][cHw]/", "", $ntitle); $ntitle = sanitize_html($ntitle); $nname = get_player_basename(); output("`7Your new title will look like this: %s`0`n", $ntitle); output("`7Your entire name will look like: %s %s`0`n`n", $ntitle, $nname); output("`7Is this how you wish it to look?"); addnav("`bConfirm Custom Title`b"); addnav("Yes", "runmodule.php?module=titlechange&op=changetitle&newname=" . rawurlencode($ntitle)); addnav("No", "runmodule.php?module=titlechange&op=titlechange"); } elseif ($op == "changetitle") { $ntitle = rawurldecode(httpget('newname')); $fromname = $session['user']['name']; $newname = change_player_ctitle($ntitle); $session['user']['ctitle'] = $ntitle; $session['user']['name'] = $newname; addnews("%s`^ has become known as %s.", $fromname, $session['user']['name']); // modifications by sixf00t4 if (!get_module_pref("permanent")) { if (get_module_setting("take")) { $cost = 0; if (get_module_pref("timespurchased")) { $cost = get_module_setting("extrapoints"); debuglog("bought another custom title for {$cost} points"); } else { $cost = get_module_setting("initialpoints"); debuglog("bought first custom title for {$cost} points"); } $session['user']['donationspent'] += $cost; } } set_module_pref("timespurchased", get_module_pref("timespurchased") + 1); output("Your custom title has been set."); modulehook("namechange", array()); } addnav("L?Return to the Lodge", "lodge.php"); page_footer(); }
function namecolor_run() { require_once "lib/sanitize.php"; require_once "lib/names.php"; global $session; $rebuy = get_module_pref("boughtbefore"); $cost = get_module_setting($rebuy ? "extrapoints" : "initialpoints"); $hasperm = get_module_pref("permanent"); if ($hasperm) { $cost = 0; } $op = httpget("op"); page_header("Hunter's Lodge"); $pointsavailable = $session['user']['donation'] - $session['user']['donationspent']; $permcost = get_module_setting("permanent"); if ($op == "permanent") { page_header("Unlimited Name Colour Changes"); output("For %s Donator Points, you can change your colours as often as you like without paying again.`n`n", $permcost); addnav("Unlimited Changes"); if ($pointsavailable >= $permcost) { addnav(array("Get permanent free Name Colour changes (%s Points)", $permcost), "runmodule.php?module=namecolor&op=permanentconfirm"); } else { addnav(array("Sorry, but you need %s more Donator Points for this option.", $permcost - $pointsavailable), ""); } addnav("Cancel", "lodge.php"); page_footer(); } if ($op == "permanentconfirm") { page_header("Unlimited Name Colour Changes"); output("You've got unlimited Name Colour Changes!"); addnav("Back to the Lodge", "lodge.php"); set_module_pref("permanent", 1); $session['user']['donationspent'] += $permcost; page_footer(); } if ($op == "namechange") { output("`3`bName Color Change`b`0`n`n"); output("`7J. C. Petersen smiles at you,"); if ($hasperm) { output("\"`&I see you have unlimited changes. Well, go right ahead.`7\""); } else { if ($rebuy) { output("\"`&Because you have previously spent points on a name color change, subsequent color changes only cost you %s points.`7\"", $cost); } else { output("\"`&Because this will be your first name color change, it will cost you %s points. Future name changes will only cost %s points.`7\"", $cost, get_module_setting('extrapoints')); } } $pointsavailable = $session['user']['donation'] - $session['user']['donationspent']; if ($pointsavailable < $cost) { output("`n`nHe consults his book silently for a moment and then turns to you. \"`&I'm terribly sorry, but you only have %s points available and a name color change would cost you %s.`7\"", $pointsavailable, $cost); } else { output("`n`nHe looks you up and down slowly, \"`&Your colorized name *must* contain the same characters as your current name in the same order. This means that it has to be the same display name, though you may add in or remove colors, or change the capitalization of letters.`7\"`n`n"); namecolor_form(); } addnav("L?Return to the Lodge", "lodge.php"); } elseif ($op == "namepreview") { $regname = get_player_basename(); $newname = str_replace("`0", "", httppost("newname")); if (!get_module_setting("bold")) { $newname = str_replace("`b", "", $newname); } if (!get_module_setting("italics")) { $newname = str_replace("`i", "", $newname); } $newname = preg_replace("/[`][cHw]/", "", $newname); $comp1 = strtolower(sanitize($regname)); $comp2 = strtolower(sanitize($newname)); $err = 0; if ($comp1 != $comp2) { if (!$err) { output("`3`bInvalid name`b`0`n"); } $err = 1; output("Your new name must contain only the same characters as your current name; you can add or remove colors, and you can change the capitalization, but you may not add or remove anything else. You chose %s.`n", $newname); } if (strlen($newname) > 30) { if (!$err) { output("`3`bInvalid name`b`0`n"); } $err = 1; output("Your new name is too long. Including the color markups, you are not allowed to exceed 30 characters in length.`n"); } $colorcount = 0; for ($x = 0; $x < strlen($newname); $x++) { if (substr($newname, $x, 1) == "`") { $x++; $colorcount++; } } $max = get_module_setting("maxcolors"); if ($colorcount > $max) { if (!$err) { output("`3`bInvalid name`b`0`n"); } $err = 1; output("You have used too many colors in your name. You may not exceed %s colors total.`n", $max); } if (!$err) { output("`7Your name will look this this: %s`n`n`7Is this what you wish?`n`n`0", $newname); addnav("Confirm Name Change"); addnav("Yes", "runmodule.php?module=namecolor&op=changename&name=" . rawurlencode($newname)); addnav("No", "runmodule.php?module=namecolor&op=namechange"); } else { output("`n"); namecolor_form(); addnav("L?Return to the Lodge", "lodge.php"); } } elseif ($op == "changename") { $session['user']['donationspent'] += $cost; set_module_pref("boughtbefore", 1); $fromname = $session['user']['name']; $newname = change_player_name(rawurldecode(httpget('name'))); $session['user']['name'] = $newname; addnews("%s`^ has become known as %s.", $fromname, $session['user']['name']); output("`7Congratulations, your name is now {$session['user']['name']}`7!`n`n"); modulehook("namechange", array()); addnav("L?Return to the Lodge", "lodge.php"); } page_footer(); }