villagenav(); if ($session['user']['age'] == 1) { if (getsetting('displaymasternews', 1)) { addnews("`%%s`3 has defeated " . ($session['user']['sex'] ? "her" : "his") . " master, `%%s`3 to advance to level `^%s`3 after `^1`3 day!!", $session['user']['name'], $badguy['creaturename'], $session['user']['level']); } } else { if (getsetting('displaymasternews', 1)) { addnews("`%%s`3 has defeated " . ($session['user']['sex'] ? "her" : "his") . " master, `%%s`3 to advance to level `^%s`3 after `^%s`3 days!!", $session['user']['name'], $badguy['creaturename'], $session['user']['level'], $session['user']['age']); } } if ($session['user']['hitpoints'] < $session['user']['maxhitpoints']) { $session['user']['hitpoints'] = $session['user']['maxhitpoints']; } modulehook("training-victory", $badguy); } elseif ($defeat) { $taunt = select_taunt_array(); if (getsetting('displaymasternews', 1)) { addnews("`%%s`5 has challenged their master, %s and lost!`n%s", $session['user']['name'], $badguy['creaturename'], $taunt); } $session['user']['hitpoints'] = $session['user']['maxhitpoints']; output("`&`bYou have been defeated by `%%s`&!`b`n", $badguy['creaturename']); output("`%%s`\$ halts just before delivering the final blow, and instead extends a hand to help you to your feet, and hands you a complementary healing potion.`n", $badguy['creaturename']); $badguy['creaturewin'] = substitute_array($badguy['creaturewin']); output_notl("`^`b"); output($badguy['creaturewin']); output_notl("`b`0`n"); addnav("Master"); addnav("Question Master", "train.php?op=question&master={$mid}"); addnav("M?Challenge Master", "train.php?op=challenge&master={$mid}"); if ($session['user']['superuser'] & SU_DEVELOPER) { addnav("Superuser Gain level", "train.php?op=challenge&victory=1&master={$mid}");
function forestdefeat($enemies, $where = "in the forest") { global $session; $percent = getsetting('forestexploss', 10); addnav("Daily news", "news.php"); $names = array(); $killer = false; foreach ($enemies as $index => $badguy) { $names[] = $badguy['creaturename']; if (isset($badguy['killedplayer']) && $badguy['killedplayer'] == true) { $killer = $badguy; } if (isset($badguy['creaturewin']) && $badguy['creaturewin'] > "") { $msg = translate_inline($badguy['creaturewin'], "battle"); output_notl("`b`&%s`0`b`n", $msg); } } if ($killer) { $badguy = $killer; } elseif (!isset($badguy['creaturename'])) { $badguy = $enemies[0]; } if (count($names) > 1) { $lastname = array_pop($names); } $enemystring = join(", ", $names); $and = translate_inline("and"); if (isset($lastname) && $lastname > "") { $enemystring = "{$enemystring} {$and} {$lastname}"; } $taunt = select_taunt_array(); if (is_array($where)) { $where = sprintf_translate($where); } else { $where = translate_inline($where); } addnews(sprintf_translate("`%%s`5 has been slain %s by %s.`n%s", $session['user']['name'], $where, $badguy['creaturename'], $taunt)); $session['user']['alive'] = false; debuglog("lost gold when they were slain {$where}", false, false, "forestlose", -$session['user']['gold']); $session['user']['gold'] = 0; $session['user']['hitpoints'] = 0; $session['user']['experience'] = round($session['user']['experience'] * (1 - $percent / 100), 0); output("`4All gold on hand has been lost!`n"); output("`4%s %% of experience has been lost!`b`n", $percent); output("You may begin fighting again tomorrow."); page_footer(); }
function ferryman_fight() { $op = httpget("op"); global $session; $from = "forest.php?"; if ($op == "fightferryman") { $badguy = array("creaturename" => translate_inline("`7The Ferryman`0"), "creaturelevel" => $session['user']['level'] + 2, "creatureweapon" => translate_inline("Ferry Pole"), "creatureattack" => $session['user']['attack'], "creaturedefense" => $session['user']['defense'], "creaturehealth" => round($session['user']['maxhitpoints'], 0), "diddamage" => 0, "didsurprise" => 1, "type" => "ferryman"); $session['user']['badguy'] = createstring($badguy); $op = "fight"; httpset('op', "fight"); } if ($op == "run") { output("`2With nothing but murky water all around, you have nowhere to run!`n`n"); $op = "fight"; httpset('op', "fight"); } if ($op == "fight") { $battle = true; } if ($battle) { require_once "battle.php"; if ($victory) { output("`n`@You have managed to defeat the Ferryman!"); output("You cautiously approach the body, and suddenly, it shimmers and disappears before your eyes!`n`n"); if ($session['user']['hitpoints'] <= 0) { output("`n`n`^Using a bit of river weed, you are able to staunch your own wounds, stopping your bloodloss before you are completely dead.`n"); $session['user']['hitpoints'] = 1; } output("`2Without the ferryman, you are left to drift with the river currents."); output("It takes a long time, but you eventually get to the other shore.`n`n"); if ($session['user']['hitpoints'] <= 0) { output("`n`n`^Your staunch your own wounds with a bit of moss growing nearby, stopping your bloodloss before you are completely dead.`n"); $session['user']['hitpoints'] = 1; } $maxfflost = get_module_setting("maxfflost"); if ($session['user']['turns'] < $maxfflost) { $lostff = $session['user']['turns']; } else { $lostff = $maxfflost; } $session['user']['turns'] -= $lostff; output("`&You have lost some Stamina!"); $session['user']['specialinc'] = ""; $session['user']['specialmisc'] = ""; } elseif ($defeat) { require_once "lib/taunt.php"; $taunt = select_taunt_array(); $lostgold = $session['user']['gold']; output("`n`@You have been killed by the Ferryman!"); output("As your last breath escapes you, all you hear is haunting laughter."); addnav("Daily News", "news.php"); addnews("`%%s `7was last seen aboard a small boat.`0", $session['user']['name']); debuglog("killed by Ferryman, losing {$lostgold}"); $session['user']['gold'] = 0; $session['user']['specialinc'] = ""; $session['user']['specialmisc'] = ""; } else { fightnav(true, true); } } }
function dwellings_pvp_run() { global $session, $badguy, $pvptime, $pvptimeout, $options; $pvptime = getsetting("pvptimeout", 600); $pvptimeout = date("Y-m-d H:i:s", strtotime("-{$pvptime} seconds")); $last = date("Y-m-d H:i:s", strtotime("-" . getsetting("LOGINTIMEOUT", 900) . " sec")); $ac = db_prefix("accounts"); $mu = db_prefix("module_userprefs"); $dw = db_prefix("dwellings"); $cl = db_prefix("clans"); $op = httpget('op'); $dwid = httpget('dwid'); page_header("Dwellings PvP"); if ($op != "fight1" && $op != "fight") { require_once "modules/dwellings_pvp/run/case_{$op}.php"; } if ($op == "fight1") { $name = rawurldecode(httpget('name')); require_once "modules/dwellings/lib.php"; if (is_numeric($name)) { $name = getlogin($name); } require_once "lib/pvpsupport.php"; $badguy = setup_target($name); require_once "lib/battle-skills.php"; suspend_buffs("allowinpvp", "`&The gods prevent you from using any special abilities!`0"); $session['user']['badguy'] = createstring($badguy); $session['user']['playerfights']--; $op = "fight"; } if ($op == "fight") { $options['type'] = 'pvp'; $battle = true; } if ($battle) { include "battle.php"; if ($victory) { $killedin = sprintf("%s Dwellings", $session['user']['location']); require_once "lib/pvpsupport.php"; pvpvictory($badguy, $killedin, $options); addnews("`4%s`3 defeated `4%s`3 while they were sleeping in their Dwelling.", $session['user']['name'], $badguy['creaturename']); $badguy = array(); unsuspend_buffs("allowinpvp", "`&The gods have restored your special abilities!`0"); addnav("Leave"); addnav("Hamlet Registry", "runmodule.php?module=dwellings&op=list&ref=hamlet"); } elseif ($defeat) { $killedin = sprintf("%s Dwellings", $session['user']['location']); require_once "lib/taunt.php"; $taunt = select_taunt_array(); require_once "lib/pvpsupport.php"; pvpdefeat($badguy, $killedin, $taunt, $options); unsuspend_buffs("allowinpvp", "`&The gods have restored your special abilities!`0"); addnews("`4%s`3 was defeated while attacking `4%s`3 as they were sleeping in their Dwelling.`n%s", $session['user']['name'], $badguy['creaturename'], $taunt); output("`n`n`&You are sure that someone, sooner or later, will stumble over your corpse and return it to %s for you.", $session['user']['location']); addnav("Return to the Shades", "shades.php"); } else { $script = "runmodule.php?module=dwellings_pvp&op=fight"; require_once "lib/fightnav.php"; fightnav(false, false, $script); } } page_footer(); }