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}"); } addnav("Leave"); villagenav(); modulehook("training-defeat", $badguy); } else { fightnav(false, false, "train.php?master={$mid}"); } if ($victory || $defeat) { unsuspend_buffs('allowintrain', "`&You now feel free to make use of your buffs again!`0`n"); unsuspend_companions("allowintrain"); } } } else { checkday(); output("You stroll into the battle grounds."); output("Younger warriors huddle together and point as you pass by."); output("You know this place well."); output("Bluspring hails you, and you grasp her hand firmly."); output("There is nothing left for you here but memories."); output("You remain a moment longer, and look at the warriors in training before you turn to return to the village."); addnav("Leave"); villagenav(); } page_footer();
} $mff = abs($mff); if ($mff != 0) { output("`n`&Because of %s`&, you %s%s %s`& forest %s for today!`n`0", $lcname, $color, $state, $mff, translate_inline($mff == 1 ? 'fight' : 'fights')); } } else { output("`n`&You strap your `%%s`& to your back and head out for some adventure.`0", $session['user']['weapon']); } if ($session['user']['hauntedby'] > "") { output("`n`n`)You have been haunted by %s`); as a result, you lose a forest fight!", $session['user']['hauntedby']); $session['user']['turns']--; $session['user']['hauntedby'] = ""; $turnstoday .= ", Haunted: -1"; } require_once "lib/extended-battle.php"; unsuspend_companions("allowinshades"); if (!getsetting("newdaycron", 0)) { //check last time we did this vs now to see if it was a different game day. $lastnewdaysemaphore = convertgametime(strtotime(getsetting("newdaySemaphore", "0000-00-00 00:00:00") . " +0000")); $gametoday = gametime(); if (gmdate("Ymd", $gametoday) != gmdate("Ymd", $lastnewdaysemaphore)) { // it appears to be a different game day, acquire semaphore and // check again. $sql = "LOCK TABLES " . db_prefix("settings") . " WRITE"; db_query($sql); clearsettings(); $lastnewdaysemaphore = convertgametime(strtotime(getsetting("newdaySemaphore", "0000-00-00 00:00:00") . " +0000")); $gametoday = gametime(); if (gmdate("Ymd", $gametoday) != gmdate("Ymd", $lastnewdaysemaphore)) { //we need to run the hook, update the setting, and unlock. savesetting("newdaySemaphore", gmdate("Y-m-d H:i:s"));
$newenemies = $enemies; } $newenemies = autosettarget($newenemies); if ($session['user']['hitpoints'] > 0 && count($newenemies) > 0 && ($op == "fight" || $op == "run")) { output("`2`bEnd of Round:`b`n"); show_enemies($newenemies); } if ($session['user']['hitpoints'] < 0) { $session['user']['hitpoints'] = 0; } if ($victory || $defeat) { // expire any buffs which cannot persist across fights and // unsuspend any suspended buffs unsuspend_buffs($options['type'] == 'pvp' ? "allowinpvp" : false); if ($session['user']['alive']) { unsuspend_companions($options['type'] == 'pvp' ? "allowinpvp" : false); } foreach ($companions as $index => $companion) { if (isset($companion['expireafterfight']) && $companion['expireafterfight']) { unset($companions[$index]); } } if (is_array($newenemies)) { foreach ($newenemies as $index => $badguy) { global $output; $badguy['fightoutput'] = $output; // legacy support. Will be removed in one of the following versions! // Please update all modules, that use the following hook to use the // $options array instead of the $args array for their code. $badguy['type'] = $options['type']; if ($victory) {