function include_explore_text() { $objSrcUser =& $GLOBALS["objSrcUser"]; $objSrcRace = $objSrcUser->get_race(); $arrUnitNames = $objSrcRace->getUnitNames(); include_once 'inc/functions/explore.php'; $iMaxAcres = getMaxExplore($objSrcUser); $arrExploreCost = getExploreCosts($objSrcUser); //========================================================================== // Stop people from avoiding the tribe page so they dont get updated //========================================================================== include_once 'inc/functions/update_ranking.php'; doUpdateRankings($objSrcUser); echo $topLinks = '<div class="center">' . '<a href="main.php?cat=game&page=build">Construction</a> | ' . '<a href="main.php?cat=game&page=army">Military Training</a> | ' . "<strong>Exploration</strong>" . '</div>'; $advisorText = '<div id="textBig">' . '<p>' . '<img src="' . HOST_PICS . 'explorers.gif" style="float: left; margin-right: 10px;" alt="Explorers" />' . "<strong>The tribe architect</strong> greets you: <br />" . "Attacking other tribes is not the only way to settle new " . "acres and expand your tribe. Exploring is another, more friendly, " . "way to grow. However, exploring isn't free and will require crowns, " . strtolower($arrUnitNames[2]) . "s and " . strtolower($arrUnitNames[1]) . "s. " . "To lower the costs you may consider ordering additional markets to be constructed." . '</p>' . '<p>' . "Sending out a team to settle <strong>1 acre</strong> costs <strong>" . number_format($arrExploreCost['crowns']) . " crowns</strong>, <strong>" . $arrExploreCost['basics'] . " " . strtolower($arrUnitNames[2]) . "s</strong> and " . "<strong>" . $arrExploreCost['citizens'] . " " . strtolower($arrUnitNames[1]) . "s." . "</strong>" . '</p>'; if ($objSrcRace->getRaceName() == 'Nazgul') { $advisorText = '<div id="textMedium">' . '<p>' . 'Your proud Nazgul army will not lower itself to explore for acres.' . '</p>'; } $advisorText .= '</div>'; echo $advisorText; // Classic Exception $strTip = 'Tip: You may be able to afford more, but you can only explore a ' . 'total of no more than 25% of your current land.'; if ($_SERVER['SERVER_NAME'] == DINAH_SERVER_NAME && $objSrcUser->get_user_info(HOURS) < PROTECTION_HOURS) { $strTip = 'Tip: You may explore at most 1000 acres while in protection.'; } if ($objSrcRace->getRaceName() != 'Nazgul') { // Advisor Link echo $advisorLink = '<br /><div class="tableLinkMedium">' . '<a href="main.php?cat=game&page=advisors&show=build">Tribe Architect</a> ' . ':: <a href="main.php?cat=game&page=market">Market</a>' . '</div>'; echo $strAdvisorText = '<div id="textMedium" style="margin-top: 0;">' . '<h3>Prepare Expedition</h3>' . '<p>' . 'Currently you can explore <strong><span class="indicator">' . number_format($iMaxAcres) . '</span> acres</strong>.' . '</p>' . '<form id="center" action="main.php?cat=game&page=explore2" method="post" style="margin-top: 0pt";>' . '<label>Explore Acres: ' . '<input name="explored_acres" value="' . $iMaxAcres . '" size="5" maxlength="4" />' . '</label> ' . '<input type="submit" value="Send Expedition" />' . '</form>' . '<p>' . $strTip . '</p>' . '</div>'; } }
function include_motd_text() { global $page; $objSrcUser =& $GLOBALS["objSrcUser"]; //========================================================================== // Admin Message //========================================================================== $result = mysql_query("SELECT * FROM admin WHERE id = 1"); $local_admin = mysql_fetch_array($result); $motd = ''; if ($local_admin['status'] != "none") { $motd .= "<div id=\"textMedium\">" . '<h2 style="margin-bottom: 0;">Admin Message</h2>' . '<p style="margin-top: 0;">' . date("D d M, H:i:s") . ' ST' . '</p><p>' . nl2br($local_admin['status']) . "</p>" . "</div>"; } if ($page != 'tribe' && $objSrcUser->get_user_info(STATUS) == 2) { $motd .= '<div class="center">' . '<br /><a href="main.php?cat=game&page=tribe">Continue</a>' . "</div>"; } elseif ($page != 'tribe') { $motd .= '<div class="center">' . '<br /><a href="main.php?cat=game&page=tribe">Tribe Page</a>' . "</div>"; } echo $motd; //========================================================================== // Force update of tribe + rankings //========================================================================== include_once 'inc/functions/update_ranking.php'; doUpdateRankings($objSrcUser, 'yes'); //========================================================================== // make sure users go to this page each login. //========================================================================== $objSrcUser->set_user_info(STATUS, 1); //========================================================================== // Species5618: added a safety-mechanism for the doubleclickprotection on // magic, switch will be set to free whenever a tribe looks at the tribepage //========================================================================== $objSrcUser->set_spell(CASTING_NOW, "'free'"); }
function call_suspension_text() { global $tool; include_once 'inc/functions/resort_tools.php'; if (!user_has_access($tool)) { echo "Sorry, this page is restricted to ORKFiA Staff"; include_game_down(); exit; } echo $strHeader = '<h2>L&O: Player Suspension (aka Forced Vacation Mode)</h2>'; echo $strForm = '<form method="post" action="' . $_SERVER['REQUEST_URI'] . '">' . 'User-id: ' . '<input type="text" size="11" name="suspend_id">' . '<br />' . 'Updates: ' . '<select name="suspend_updates">' . '<option>12</option>' . '<option>24</option>' . '<option selected>48</option>' . '</select>' . '<br /><br />' . '<input type="submit" value="Suspend Tribe!">' . '</form>' . '<br /><br />'; if (isset($_POST['suspend_id']) && $_POST['suspend_id'] > 1) { include_once 'inc/classes/clsUser.php'; $objTmpUser = new clsUser($_POST['suspend_id']); // Pause Account Routines. Martel July 13, 2006 $arrSrcUser = $objTmpUser->get_user_infos(); if ($arrSrcUser[NEXT_ATTACK] <= 1) { $arrSrcUser[NEXT_ATTACK] = 1; } $arrNewSrcUser = array(NEXT_ATTACK => $arrSrcUser[NEXT_ATTACK], PAUSE_ACCOUNT => $_POST['suspend_updates']); $objTmpUser->set_user_infos($arrNewSrcUser); // Empty Magic and Thievery Points $objTmpUser->set_spell(POWER, 0); $objTmpUser->set_thievery(CREDITS, 0); // Forced Ranking Update include_once 'inc/functions/update_ranking.php'; doUpdateRankings($objTmpUser, 'yes'); echo stripslashes($objTmpUser->get_stat(TRIBE)) . " will be paused for " . $_POST['suspend_updates'] . " updates. Don't forget to send a notice."; echo '<div id="textSmall">' . '<p><b>' . 'Standard notice to copy+paste:' . '</b></p>' . '<p>' . 'Your account has been suspended by the Law & Order Resort (found in alliance #2), you will not recieve updates, or be able to interact with the game, this may be because of a Code of Conduct violation or for some other action. Usually a staff member will contact you, if they have not, it is highly advised that you contact them, especially if you are not guilty of what you have been suspended for.' . '</p>' . '</div>'; } }
function call_manual_updater_text() { global $upper, $lower, $submit1, $submit2, $tool; include_once 'inc/functions/resort_tools.php'; if (!user_has_access($tool)) { echo "Sorry, this page is restricted to ORKFiA Staff"; include_game_down(); exit; } // 30 minutes rather than 30 seconds until script times out set_time_limit(1800); if ($upper && $lower && $submit1) { $checker = 0; for ($i = $lower; $i < $upper; $i++) { // echo "<br>" . $i . " :: "; $check = mysql_query("Select * from user where id = {$i}"); $check = mysql_fetch_array($check); $check3 = mysql_query("Select * from stats where id = {$i}"); $check3 = mysql_fetch_array($check3); if ($check[USERNAME] && $check3[TRIBE]) { // echo $i; include_once 'inc/functions/update.php'; check_to_update($check[ID]); include_once 'inc/classes/clsUser.php'; $objTmpUser = new clsUser($check[ID]); include_once 'inc/functions/update_ranking.php'; doUpdateRankings($objTmpUser, 'yes'); $checker++; } } echo "<br><br>{$checker} successfully updated =)<br><br>"; } elseif ($upper && $lower && $submit2) { $checker = 0; for ($i = $lower; $i < $upper; $i++) { echo "<br>" . $i . " :: "; $check = mysql_query("Select * from user where id = {$i}"); $check = mysql_fetch_array($check); $check3 = mysql_query("Select * from stats where id = {$i}"); $check3 = mysql_fetch_array($check3); if ($check[USERNAME] && $check3[TRIBE]) { echo $i; include_once 'inc/classes/clsUser.php'; $objTmpUser = new clsUser($check[ID]); include_once 'inc/functions/update_ranking.php'; doUpdateRankings($objTmpUser, 'yes'); $checker++; } } echo "<br><br>{$checker} successfully updated =)<br><br>"; } if ($upper) { $bleh = $upper + 100; } else { $bleh = 100; $upper = 2; } echo $strForm = '<form method="post" action="' . $_SERVER['REQUEST_URI'] . '">' . 'Input lower: <input name="lower" size="5" value="' . $upper . '">' . '<br />' . 'Input upper: <input name="upper" size="5" value="' . $bleh . '">' . '<br /><br />' . '<input type="submit" value="Update" name="submit1"> ' . '<input type="submit" value="Rankings Only" name="submit2">' . '</form>'; }
function call_unsuspend_text() { $tool = $_GET['tool']; include_once 'inc/functions/resort_tools.php'; check_access($tool); echo "<form method='post' action='{$_SERVER['REQUEST_URI']}'>" . "User id to unsuspend: <input name='id' size='5' /><br /><br />" . "<input type='submit' value='Unsuspend' name='op' />" . "</form>"; if (isset($_POST['op']) && !empty($_POST['id'])) { $id = $_POST['id']; $objTrgUser = new clsUser($id); $arrTrgUser = array(PAUSE_ACCOUNT => 0); $objTrgUser->set_user_infos($arrTrgUser); // Forced Ranking Update include_once 'inc/functions/update_ranking.php'; doUpdateRankings($objTrgUser, 'yes'); echo "<br /><br />User " . $objTrgUser->get_userid() . " unsuspended =)"; } }
function call_update_text() { $tool = $_GET['tool']; include_once 'inc/functions/resort_tools.php'; check_access($tool); echo "'Updating' a tribe means updating the rankings and alliscreen, " . "not giving an actual update.<br /><br />" . "<form method='post' action='{$_SERVER['REQUEST_URI']}'>" . "User id to update: <input name='id' size='5' /><br /><br />" . "<input type='submit' value='Update' name='op' />" . "</form>"; if (isset($_POST['op']) && !empty($_POST['id'])) { $id = $_POST['id']; $op = $_POST['op']; include_once 'inc/functions/update.php'; include_once 'inc/functions/update_ranking.php'; $objTrgUser = new clsUser($id); doUpdateRankings($objTrgUser, 'yes'); check_to_update($objTrgUser->get_userid()); echo "<br /><br />User " . $objTrgUser->get_userid() . " updated =)"; } }
function call_tourers_text() { require_once 'inc/functions/resort_tools.php'; check_access($_GET['tool']); require_once 'inc/functions/mail.php'; // first the "actually do something if asked" thing if (isset($_POST['id']) && isset($_POST['submit']) && isset($_POST['sure']) && $_POST['sure'] == 'yes') { //get the old values $objTrgUser = new clsUser($_POST['id']); $arrBuilds = $objTrgUser->get_builds(); $arrArmys = $objTrgUser->get_armys(); $intFame = $objTrgUser->get_stat(FAME); //make the new values $keysBuilds = array_keys($arrBuilds); $valsBuilds = array_fill(0, count($arrBuilds), 0); $arrBuilds = array_combine($keysBuilds, $valsBuilds); $arrBuilds[ID] = $_POST['id']; //DO NOT FORGET $arrBuilds[LAND] = 1; //prevent div0s $keysArmys = array_keys($arrArmys); $valsArmys = array_fill(0, count($arrArmys), 0); $arrArmys = array_combine($keysArmys, $valsArmys); $arrArmys[ID] = $_POST['id']; //DO NOT FORGET $intFame = 0; $arrUserInfo = array(NEXT_ATTACK => 1, PAUSE_ACCOUNT => 48); //set the new values $objTrgUser->set_builds($arrBuilds); $objTrgUser->set_armys($arrArmys); $objTrgUser->set_stat(FAME, $intFame); //update the tribe too require_once 'inc/functions/update.php'; require_once 'inc/functions/update_ranking.php'; doUpdateRankings($objTrgUser, true); check_to_update($objTrgUser->get_userid()); //do this afterwards, otherwise the updaterankings doesn't work too well $objTrgUser->set_user_infos($arrUserInfo); //tell them about it send_mail($GLOBALS['objSrcUser']->get_userid(), $_POST['id'], "You have been tourified", "This is an automated message indicating that I have used the 'Tourify' tool to turn your tribe into a tourer tribe."); echo "User {$_POST['id']} has been tourified. ORKFiA mail has been sent to let him know.<br /><br /><br />"; } echo "'Tourifying' a tribe means setting it to 1 land, 0 fame, removing all military and suspending it. " . "Please make sure you're tourifying the right tribe, because the only way to undo this is resetting." . "<br /><br /><form method=\"post\" action=\"{$_SERVER['REQUEST_URI']}\">" . "<label for=\"id\">User id of tribe to tourify </label>" . "<input type=\"text\" id=\"id\" name=\"id\" size=\"5\" maxlength=\"5\" /><br />" . "<input type=\"checkbox\" id=\"sure\" name=\"sure\" value=\"yes\" />" . "<label for=\"sure\"> I'm sure I want to tourify this tribe</label><br />" . "<input type=\"submit\" name=\"submit\" value=\"tourify\" />" . "</form>"; }
function get_tribe_table(&$objUser) { global $arrStats; include_once 'inc/functions/military.php'; include_once 'inc/functions/races.php'; include_once 'inc/functions/magic.php'; include_once 'inc/functions/population.php'; $arrBuild = $objUser->get_builds(); $iAcres = $arrBuild[LAND]; $iBarren = $objUser->get_barren(); $arrStats = $objUser->get_stats(); $arrGoods = $objUser->get_goods(); $arrPopulation = getPopulation($objUser); $arrArmys = $objUser->get_armys(); $iMageLevel = get_mage_level($objUser); $userid = $objUser->get_userid(); $iStrength = $objUser->get_strength(); $iRulerAge = getRulerAge($objUser); // $iSpells = getActiveSpells($objUser); $arrUnitVars = getUnitVariables($arrStats[RACE]); $arrUnitNames = $arrUnitVars['output']; $total_defence = getArmyDefence($objUser); $total_defence = $total_defence['raw']; $suicidal_offence = getArmyOffence($objUser); $suicidal_offence = $suicidal_offence['raw']; $offencePerAcre = ceil($suicidal_offence / $iAcres); $defencePerAcre = ceil($total_defence / $iAcres); $iMilitaryUnits = $arrArmys[UNIT1] + $arrArmys[UNIT2] + $arrArmys[UNIT3] + $arrArmys[UNIT4]; //========================================================================== // Stop people from avoiding the tribe page so they dont get updated //========================================================================== include_once 'inc/functions/update_ranking.php'; doUpdateRankings($objUser, 'yes'); $strServerTime = date("H:i:s"); $res = "<table class=\"medium\" cellpadding=\"0\" cellspacing=\"0\">" . "<tr class=\"header\">" . "<th colspan=\"5\">" . stripslashes($arrStats['tribe']) . " (#" . $arrStats['kingdom'] . ")" . "</th>" . "</tr>" . "<tr class=\"subheader\">" . "<th width=\"120px\">" . "Type" . "</th>" . "<td width=\"165px\">" . "Info" . "</td>" . "<td width=\"30px\">" . " " . "</td>" . "<th width=\"120px\">" . "Type" . "</th>" . "<td width=\"165px\">" . "Info" . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Ruler Age:" . "</th>" . "<td>" . $iRulerAge . " Years" . "</td>" . "<td>" . " " . "</td>" . "<th>" . "Fame:" . "</th>" . "<td>" . number_format($arrStats['fame']) . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Race:" . "</th>" . "<td>" . $arrStats['race'] . "</td>" . "<td>" . " " . "</td>" . "<th>" . "Strength:" . "</th>" . "<td>" . number_format($iStrength) . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . $arrUnitNames[1] . "s:" . "</th>" . "<td>" . number_format($arrPopulation['citizens']) . "</td>" . "<td>" . " " . "</td>" . "<th>" . "Military Units:" . "</th>" . "<td>" . number_format($iMilitaryUnits) . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Mage Level:" . "</th>" . "<td>" . $iMageLevel . "</td>" . "<td>" . " " . "</td>"; if ($arrStats[RACE] == 'Templar') { $res .= "<th>" . "Mystics:" . "</th>"; } else { $res .= "<th>" . "Thieves:" . "</th>"; } $res .= "<td>" . number_format($arrArmys['unit5']) . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Raw Offence:" . "</th>" . "<td>" . $offencePerAcre . " OPA</td>" . "<td>" . " " . "</td>" . "<th>" . "Raw Defence:" . "</th>" . "<td>" . $defencePerAcre . " DPA</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Barren Land:" . "</th>" . "<td>" . number_format($iBarren) . "</td>" . "<td>" . " " . "</td>" . "<th>" . "Land:" . "</th>" . "<td>" . number_format($iAcres) . "</td>" . "</tr>" . "</table>" . '<div class="center" style="font-size: 0.8em">' . 'Server Time: ' . $strServerTime . '</div>'; return $res; }
function include_external_affairs_text() { $objSrcUser =& $GLOBALS['objSrcUser']; $objSrcAlliance = $objSrcUser->get_alliance(); //========================================================================== // Validate GET input //========================================================================== if (empty($_GET['tribe'])) { $tribe = $objSrcUser->get_userid(); } else { $tribe = intval($_GET['tribe']); } if (empty($_GET['aid'])) { $aid = $objSrcUser->get_stat(ALLIANCE); } else { $aid = intval($_GET['aid']); } //========================================================================== // Start Output //========================================================================== if ($aid > 10) { // Target user object include_once 'inc/classes/clsUser.php'; if ($tribe == $objSrcUser->get_userid()) { $objTrgUser = $objSrcUser; } elseif ($tribe > 0) { $objTrgUser = new clsUser($tribe); } // Target alliance object $objTrgAlliance = $objTrgUser->get_alliance(); $aid = $objTrgUser->get_stat(ALLIANCE); // Update user include_once 'inc/functions/update.php'; check_to_update($objTrgUser->get_userid()); // Update rankings include_once 'inc/functions/update_ranking.php'; doUpdateRankings($objTrgUser); // Div starts here ?> <div id="columns"> <!-- Start left column --> <div id="leftcolumn"> <br /> <?php // Show mini-vision table echo get_small_tribe_table($objTrgUser); $arrStats = $objSrcUser->get_stats(); $arrRankingsPersonal = $objTrgUser->get_rankings_personals(); // Show advisor message echo '<div id="textSmall">' . '<p><strong>The General</strong> tells you: <br />'; if ($tribe == $objSrcUser->get_userid()) { echo 'This is <em>our</em> tribe, leader =)'; } elseif ($objTrgUser->get_stat(KILLED) == 0 && $objTrgUser->get_stat(RESET_OPTION) == 'yes') { echo 'This tribe has <em>reset</em>.'; } elseif ($objTrgUser->get_user_info(HOURS) < PROTECTION_HOURS) { $iRemaining = PROTECTION_HOURS - $objTrgUser->get_user_info(HOURS); echo 'This tribe is performing the summoning ritual and their ' . 'borders will be protected for another <strong>' . $iRemaining . ' months.</strong>'; } elseif ($objTrgUser->get_stat(KILLED) > 0 && $objTrgUser->get_stat(KILLED) != 3) { echo 'This tribe is <em>dead</em>.'; } elseif ($objTrgUser->isPaused()) { echo 'This tribe is <em>paused</em>.'; } elseif ($objTrgUser->get_stat(ALLIANCE) == $objSrcUser->get_stat(ALLIANCE)) { echo 'This is a friendly <em>allied</em> tribe.'; } elseif ($objTrgUser->get_stat(ALLIANCE) == $objSrcAlliance->get_war(TARGET)) { echo 'We are in a declared <em class="negative">war</em> with this tribe!'; } elseif ($objTrgAlliance->get_war(TARGET) > 0) { echo 'This tribe is in <em class="negative">war</em> with another alliance.'; } elseif ($objTrgUser->get_stat(ALLIANCE) != $objSrcUser->get_stat(ALLIANCE)) { echo 'This <em>enemy</em> tribe may remain neutral towards us if we let them be. Be careful with your actions against them leader.'; } if ($objTrgUser->get_stat(ALLIANCE) == $objSrcUser->get_stat(ALLIANCE) || $objTrgUser->get_stat(KILLED) > 0 || $objTrgUser->isPaused()) { /* say nothing */ } elseif ($objTrgUser->get_build(LAND) < 0.8 * $objSrcUser->get_build(LAND)) { echo '</p><p>Also, due to their small size we will gain less land on attacks and do less damage with our operations and spells.'; } elseif ($objTrgUser->get_build(LAND) > 2.0 * $objSrcUser->get_build(LAND)) { echo '</p><p>Also, due to their large size our operations will have very high fail rates.'; } elseif ($objTrgUser->get_build(LAND) > 1.2 * $objSrcUser->get_build(LAND)) { echo '</p><p>Also, due to their large size our operations and spells will do less damage and we will gain less on attacks.'; } echo '</p>' . '</div>'; ?> </div> <!-- end left column --> <!-- start right column --> <div id="rightcolumn"> <?php echo '<div class="tableLinkSmall"><a href="main.php?cat=game&page=alliance&aid=' . $aid . '">Back to alliance #' . $aid . '</a>' . '</div>'; // Show action links echo '<div id="textSmall" style="margin-top: 0px;">' . '<h2>Tribe Actions</h2>'; echo '<ul>' . '<li>' . '<a href="main.php?cat=game&page=mystic&magekd=' . $aid . '&tribe=' . $tribe . '">Prepare Mystics</a>' . '</li>' . '<li>' . '<a href="main.php?cat=game&page=thievery&kd=' . $aid . '&tribe=' . $tribe . '">Prepare Thieves</a>' . '</li>' . '<li>' . '<a href="main.php?cat=game&page=invade&atkid=' . $aid . '&tribe=' . $tribe . '">Prepare Invasion</a>' . '</li>' . '<li>' . '<a href="main.php?cat=game&page=mail&set=compose&aid=' . $aid . '&tribe=' . $tribe . '">Orkfia Mail</a>' . '</li>' . '</ul>'; echo '</div>'; ?> </div> <!-- End of the right column--> </div> <!-- end of 2 column layout --> <?php } elseif ($aid < 11) { echo '<div class="tableLinkMedium">' . '<a href="main.php?cat=game&page=alliance&aid=' . $aid . '">Alliance #' . $aid . '</a>' . '</div>'; // Show action links echo '<div id="textMedium" style="margin-top: 0px;">'; echo '<p><strong>Tribe Actions</strong></p>'; echo '<ul>' . '<li>' . '<a href="main.php?cat=game&page=message&alliance=' . $aid . '&tribe=' . $tribe . '">Submit a Report</a>' . '</li>' . '<li>' . '<a href="main.php?cat=game&page=mail&set=compose&aid=' . $aid . '&tribe=' . $tribe . '">Orkfia Mail</a>' . '</li>' . '</ul>'; echo '</div>'; } }
function include_mystic_text() { global $Host; $objSrcUser =& $GLOBALS["objSrcUser"]; $iSrcId = $objSrcUser->get_userid(); $arrSrcStats = $objSrcUser->get_stats(); $arrSrcBuild = $objSrcUser->get_builds(); //========================================================================== // M: Verify Alliance & Tribe ID from GET or POST //========================================================================== $iTrgAid = $arrSrcStats[ALLIANCE]; if (isset($_GET['magekd'])) { $iTrgAid = intval($_GET['magekd']); } elseif (isset($_POST['magekd'])) { $iTrgAid = intval($_POST['magekd']); } if ($iTrgAid < 11) { $iTrgAid = rand(11, 100); } if (isset($_GET['tribe'])) { $_GET['tribe'] = intval($_GET['tribe']); } //========================================================================== // Stop people from avoiding the tribe page so they dont get updated //========================================================================== include_once 'inc/functions/update_ranking.php'; doUpdateRankings($objSrcUser); $iMageLevel = get_mage_level($objSrcUser); $growth = mage_power_growth($iSrcId); $arrSpells = set_spell_vars($objSrcUser); //========================================================================== // Remove 'casting now' from here, so just clicking try again should fix // their problem - AI 30/09/06 //========================================================================== $objSrcUser->set_spell(CASTING_NOW, "'free'"); //========================================================================== // Max Mana Points for Output //========================================================================== $max_mp = (1 + $arrSrcBuild[GUILDS] / (2 * $arrSrcBuild[LAND])) * $arrSrcBuild[GUILDS]; if ($arrSrcStats[RACE] == "Eagle") { $max_mp *= 1.3; } $max_mp = round($max_mp); //========================================================================== // M: Links at top of page //========================================================================== echo $topLinks = '<div class="center">' . '<strong>Mystics</strong> | ' . '<a href="main.php?cat=game&page=thievery">Thievery</a> | ' . '<a href="main.php?cat=game&page=invade">Invasion</a>' . '</div>'; //========================================================================== // M: Advisor Welcome Text //========================================================================== $advisorText = '<div id="textBig">' . '<p>' . '<img src="' . $Host . 'wizard.gif" style="float: left; margin-right: 10px;" alt="Fighter" />' . "<strong>Your mage</strong> greets you: <br />" . "Magic can be a useful and powerful tool to for both offensive " . "and defensive purposes. While a SELF-spell can be a blessing, an " . "attack from high level mystics can be devastating. Build more " . "academies as you grow and we will be able to channel more and " . "stronger spells." . "</p>" . "<p>" . "Our guilds can hold a maximum of <strong>{$max_mp} mana points</strong>, right now " . "they hold <strong class=\"indicator\">" . $objSrcUser->get_spell(POWER) . "</strong>. According to our estimation we will " . "regenerate <strong>" . $growth . "</strong> per month." . "</p>" . "<p>"; if ($arrSrcStats[RACE] == 'Templar') { $advisorText .= 'You have <strong class="indicator">' . round($arrSrcBuild[ACADEMIES] * 100 / $arrSrcBuild[LAND], 0) . '</strong> academies per 100 acres and <strong class="indicator">' . round($objSrcUser->get_army_home(UNIT5) / ($arrSrcBuild[LAND] * 1.5), 0) . '</strong> mystics per 0.66 acres.<br />'; } $advisorText .= 'Your mystics are capable of using <strong class="indicator">level ' . $iMageLevel . '</strong> spells.' . "</p>" . "</div>"; echo $advisorText; /* ?> <table class="mini" cellspacing="0" cellpadding="0"> <tr class="header"> <th colspan="2">Quick Stats</td> </tr> <? ECHO ' <tr class="data"> <th>Mage Level:</th> <td>' . $iMageLevel . '</td> </tr> <tr class="data"> <th>Mana Points:</th> <td>' . $objSrcUser->get_spell(POWER) . '</td> </tr> <tr class="data"> <th>Regrowth:</th> <td>+' . $growth . '</td> </tr> <tr class="data"> <th>Max MPs:</th> <td>' . $max_mp . '</td> </tr>'; ?> </table> <br /><br /> <? */ //========================================================================== // M: Mystics Table //========================================================================== echo $strColumnDivs = '<div id="columns">' . '<!-- Start left column -->' . '<div id="leftcolumn">'; // Advisor Link echo $advisorLink = '<br />' . '<div class="tableLinkSmall">' . '<a href="main.php?cat=game&page=advisors&show=actions">The Mage</a>' . '</div>'; $tableTarget = ' <table width="40%" cellpadding="0" cellspacing="0" class="small"> <form action="main.php?cat=game&page=mystic" method="post"> <tr class="header"> <th colspan="2">Mystics</th> </tr> <tr class="subheader"> <th colspan="2" class="center">Select Target</th> </tr> <tr class="data"> <th>Alliance:</th>'; $tableTarget .= ' <td> <input maxlength="4" size="3" name="magekd" value="' . $iTrgAid . '" /> <input type="submit" value="Change" />'; if ($iTrgAid < 11) { $iTrgAid = rand(11, 100); } $tableTarget .= ' </td> </tr> </form> <tr class="data"> <form action="main.php?cat=game&page=mystic2" method="post"> <th>Tribe:</th> <td><select size="1" name="selTarget"><option value="spacer"></option>'; //====================================================================== // New version of Damadm00's code Martel, July 10, 2006 //====================================================================== include_once 'inc/classes/clsAlliance.php'; $objTrgAlliance = new clsAlliance($iTrgAid); $arrTrgIUsers = $objTrgAlliance->get_userids(); if (!empty($arrTrgIUsers)) { foreach ($arrTrgIUsers as $iUserId) { $objTmpUser = new clsUser($iUserId); $strTribe = stripslashes($objTmpUser->get_rankings_personal(TRIBE_NAME)); if (isset($_GET['tribe']) && $_GET['tribe'] == $iUserId) { $tableTarget .= sprintf('<option value="%d" selected>%s</option>', $iUserId, $strTribe); } elseif (!isset($_GET['tribe']) || isset($_GET['tribe']) && $_GET['tribe'] != $iUserId) { $tableTarget .= sprintf('<option value="%d">%s</option>', $iUserId, $strTribe); } elseif (isset($_GET['tribe'])) { echo "Trying to exploit bugs/loopholes will get you suspended!"; } } } $tableTarget .= ' </select> </td> </tr> <tr class="data"> <td colspan="2" class="right"> <select size="1" name="selSpellname">'; echo $tableTarget; reset($arrSpells); while (list($strSpellName, $arrSpell) = each($arrSpells)) { ///// //display spells ////// if ($iMageLevel >= $arrSpells[$strSpellName]['level'] && in_array($arrSrcStats['race'], $arrSpells[$strSpellName]['race']) && $arrSrcBuild[LAND] >= $arrSpells[$strSpellName]['acres']) { //============================================== // 'tags' are dynamic from now on - AI 30/06/09 //============================================== $type = ""; switch ($arrSpells[$strSpellName]['type']) { case SPELL_SELF: $type = " (SELF)"; break; case SPELL_ALLIANCE: $type = " (ALLIES)"; break; case SPELL_WAR: $type = " (WAR)"; break; case SPELL_ENEMY: case SPELL_ALL: } printf("<option value=\"%s\">%s%s - %d</option>\r\n", $strSpellName, $arrSpells[$strSpellName]['display'], $type, $arrSpells[$strSpellName]['cost']); } } $tableTarget = ' </select> </td> </tr> </table>'; echo $tableTarget; echo $strColumnDivs = '</div>' . '<!-- Start right column -->' . '<div id="rightcolumn">' . '<br /><br />'; $tableTarget2 = ' <table class="small" width="60%" cellpadding="0" cellspacing="0"> <tr class="header"> <th colspan="2">Prepare Mystics</th> </tr> <tr class="subheader"> <th>Instruction</th> <td>Select</td> </tr> <tr class="data"> <th>Times to Cast Spell:</th> <td><select size="1" name="txtAmount">'; for ($i = 1; $i <= 20; $i++) { $tableTarget2 .= '<option value="' . $i . '"> ' . $i . ' </option>'; } $tableTarget2 .= ' </select> </td> </tr> <tr class="data"> <th>Stop when spell succeeds for at least <input type="text" name="minHours" value="1" size="1" /> hours:</th> <td><input type="checkbox" name="chkMin" value="yes" /></td> </tr> <tr class="data"> <th>Stop on Success:</th> <td><input type="checkbox" name="chkStop" value="yes" /></td> </tr> </table>'; echo $tableTarget2; ?> <input type="hidden" value="yes" name="SELF_CHECK" /> <br /> <div class="center"><input type="submit" value='Request mystics to cast spell' /></div> </form> <?php echo $strColumnDivs = '</div>' . '</div><div class="clear"><hr /></div>'; }
function include_reset_account_text() { global $Host; $objSrcUser =& $GLOBALS["objSrcUser"]; $arrStats = $objSrcUser->get_stats(); $iUserid = $objSrcUser->get_userid(); $arrRaces = getActiveRaces(); if ($arrStats[RESET_OPTION] == 'yes' || $arrStats[KILLED] > 0) { if (isset($_POST['submit'])) { $tribe = $_POST['tribe']; $tribe = addslashes(strip_tags(trim($tribe))); $race = $_POST['race']; // Leader should only be submitted 1 time, right after signing up if (isset($_POST['alias']) && !empty($_POST['alias'])) { $alias = $_POST['name']; $alias = addslashes(strip_tags(trim($alias))); } else { $alias = $arrStats[NAME]; } // Validate form input if (!empty($tribe) && !empty($race) && in_array($race, $arrRaces)) { // Check that the new tribe name isn't already taken $check = mysql_query("SELECT * FROM " . TBL_STAT . " WHERE tribe = '{$tribe}' AND id != {$iUserid}"); $check = mysql_fetch_array($check); $stat_search2 = mysql_query("SELECT * FROM " . TBL_STAT . " WHERE name = '{$alias}' AND id != {$iUserid}"); $stat_search2 = mysql_fetch_array($stat_search2); if (isset($check[TRIBE])) { $strDiv = '<div id="textSmall">' . '<p>' . 'Sorry, but that tribe name is already taken.' . '<br /><br />' . '<a href="main.php?cat=game&page=reset_account">' . 'Try Again?' . '</a>' . '</p>' . '</div>'; echo $strDiv; } elseif (isset($stat_search2[NAME])) { $strDiv = '<div id="textSmall">' . '<p>' . 'Sorry, but that leader name is already taken.' . '<br /><br />' . '<a href="main.php?cat=game&page=reset_account">' . 'Try Again?' . '</a>' . '</p>' . '</div>'; echo $strDiv; } else { //========================================================== // Recoded November 07, 2007 by Martel // Infinity: bonus on age death, Classic: bonus if killed // Cause of death, 2=killed, 1=age, 0=reset //========================================================== $bBonus = FALSE; if ($_SERVER['SERVER_NAME'] != DINAH_SERVER_NAME && $arrStats[KILLED] == 1) { $bBonus = TRUE; } elseif ($_SERVER['SERVER_NAME'] == DINAH_SERVER_NAME && $arrStats[KILLED] == 2) { $bBonus = TRUE; } // Race housing effeciency $arrBuildVariables = getBuildingVariables($race); $homes_hold = $arrBuildVariables['housing'][1]; $ratio = 1; // Death Bonus "Heritage" Martel, November 07, 2007 if ($bBonus && $objSrcUser->get_kill(LAND) > STARTING_LAND) { $arrKill = $objSrcUser->get_kills(); $ratio = $homes_hold / $arrKill[POP]; $iLand = $arrKill[LAND]; $arrCost = getUnitVariables($race); $arrCost = $arrCost['gold']; // New Heritage (Age9) AI+Martel, September 25, 2007 $iLand = round(pow(max(0, $iLand - STARTING_LAND), 0.80459611995) + STARTING_LAND); if ($iLand > 2000) { $iLand = 2000; } elseif ($iLand < STARTING_LAND) { $iLand = $iLand; } // Buildings $arrBonusValues[LAND] = $iLand; // Goods $arrBonusValues[RESEARCH] = 0; //round(($arrKill[RESEARCH] / $arrKill[LAND]) * $land); // Citizens $arrBonusValues[CITIZENS] = round($iLand * 15 * $ratio); // Fame $arrBonusValues[FAME] = round($arrKill[FAME] * 0.04); // Market Goods $arrBonusValues[MONEY] = round($arrKill[CASH] * $ratio); $arrBonusValues[UNIT1] = round($arrKill[BASICS] * $ratio); $arrBonusValues[CREDITS] = round(2 * $arrBonusValues[MONEY] + (2 * $arrCost[2] + 15) * $arrBonusValues[UNIT1]); } else { $arrBonusValues[LAND] = 0; $arrBonusValues[RESEARCH] = 0; $arrBonusValues[CITIZENS] = 0; $arrBonusValues[FAME] = 0; } //========================================================== // Reset Tables (excluded from this reset is TBL_USER, // TBL_STATS and TBL_PREFERENCES) //========================================================== $iNewLand = STARTING_LAND + $arrBonusValues[LAND]; include_once 'inc/functions/reset_account.php'; $arrStartValues = getStartValues($race, $iNewLand); // User table (save old but set updates to start now) $arrUsers = $objSrcUser->get_user_infos(); $arrNewUsers = array(HOURS => 0, LAST_LOGIN => date('Y-m-d H:i:s'), LAST_UPDATE_HOUR => date('H'), LAST_UPDATE_DAY => date('d')); $objSrcUser->set_user_infos($arrNewUsers); // Build Table mysql_query("DELETE FROM build WHERE id = {$iUserid}") or die("build1"); mysql_query("INSERT INTO build SET id = {$iUserid}") or die("build2"); // add land + buildings (overrides hardcoded DB defaults) $arrBuildsNew = array(LAND => $arrStartValues[LAND], HOMES => $arrStartValues[HOMES], FARMS => $arrStartValues[FARMS], MARKETS => $arrStartValues[MARKETS], YARDS => $arrStartValues[YARDS], GUILDS => $arrStartValues[GUILDS], HIDEOUTS => $arrStartValues[HIDEOUTS]); $objSrcUser->set_builds($arrBuildsNew); // Army Table mysql_query("DELETE FROM army WHERE id = {$iUserid}") or die("army"); mysql_query("INSERT INTO army SET id = {$iUserid}") or die("army2"); // add military units (overrides hardcoded DB defaults) $arrArmysNew = array(UNIT1 => $arrStartValues[UNIT1], UNIT2 => $arrStartValues[UNIT2], UNIT3 => $arrStartValues[UNIT3], UNIT4 => $arrStartValues[UNIT4], UNIT5 => $arrStartValues[UNIT5]); $objSrcUser->set_armys($arrArmysNew); // ArmyMercs Table mysql_query("DELETE FROM army_mercs WHERE id = {$iUserid}") or die("army"); if ($race == "Oleg Hai" || $race == "Mori Hai") { mysql_query("INSERT INTO army_mercs SET id = {$iUserid}") or die("army2"); if ($race == "Oleg Hai") { mysql_query("UPDATE army SET unit4 = 0 WHERE id = {$iUserid}"); } } // Milreturn Table mysql_query("DELETE FROM milreturn WHERE id = {$iUserid}") or die("milreturn"); mysql_query("INSERT INTO milreturn SET id = {$iUserid}") or die("milreturn2"); // Population Table $iNewCitz = $arrStartValues[CITIZENS] + $arrBonusValues[CITIZENS]; $objSrcUser->set_pop(CITIZENS, $iNewCitz); // Personal Rankings mysql_query("DELETE FROM rankings_personal WHERE id = {$iUserid}") or die("milreturn"); mysql_query("INSERT INTO rankings_personal SET id = {$iUserid}") or die("milreturn2"); // Goods Table mysql_query("DELETE FROM goods WHERE id = {$iUserid}") or die("goods"); mysql_query("INSERT INTO goods SET id = {$iUserid}") or die("goods2"); // Add modified starting values to Goods $arrGoodsNew = array(MONEY => $arrStartValues[MONEY], FOOD => $arrStartValues[FOOD], WOOD => $arrStartValues[WOOD], RESEARCH => $arrStartValues[RESEARCH] + $arrBonusValues[RESEARCH]); $objSrcUser->set_goods($arrGoodsNew); // Spells Table mysql_query("DELETE FROM spells WHERE id = {$iUserid}") or die("spells"); mysql_query("INSERT INTO spells SET id = {$iUserid}") or die("spells2"); // add basic self spells (overrides hardcoded DB defaults) $arrSpellsNew = array(POPULATION => $arrStartValues[POPULATION], GROWTH => $arrStartValues[GROWTH], FOOD => $arrStartValues['matawaska'], INCOME => $arrStartValues[INCOME]); $objSrcUser->set_spells($arrSpellsNew); // Thievery Table mysql_query("DELETE FROM thievery WHERE id = {$iUserid}") or die("thievery"); mysql_query("INSERT INTO thievery SET id = {$iUserid}") or die("thievery2"); // Kill Table mysql_query("DELETE FROM kills WHERE id = {$iUserid}"); mysql_query("INSERT INTO kills SET id = {$iUserid}"); // Stats table (save old but update new tribe name & race) $arrStats = $objSrcUser->get_stats(); $arrStatsNew = array(KILLED => 0, TRIBE => $tribe, RACE => $race, FAME => $arrStartValues[FAME] + $arrBonusValues[FAME], RESET_OPTION => "no", INVESTED => 0, KILLS => 0, TWG_VOTE => 0); $objSrcUser->set_stats($arrStatsNew); //========================================================== // Add bonus to build, tribe goods & alliance market //========================================================== if ($bBonus) { // add kill bonus to market credits $arrGoodsNew = array(MARKET_MONEY => $arrBonusValues[MONEY], MARKET_SOLDIERS => $arrBonusValues[UNIT1], CREDITS => $arrBonusValues[CREDITS]); $objSrcUser->set_goods($arrGoodsNew); // alliance object include_once 'inc/classes/clsAlliance.php'; $iAllianceId = $objSrcUser->get_stat(ALLIANCE); $objSrcAlliance = new clsAlliance($iAllianceId); // add bonus to alliance market $arrAllianceInfos = $objSrcAlliance->get_alliance_infos(); $arrNewAllianceInfos = array(MONEY => $arrAllianceInfos[MONEY] + $arrBonusValues[MONEY], SOLDIERS => $arrAllianceInfos[SOLDIERS] + $arrBonusValues[UNIT1]); $objSrcAlliance->set_alliance_infos($arrNewAllianceInfos); } // Update rankings (forced = yes) include_once 'inc/functions/update_ranking.php'; doUpdateRankings($objSrcUser, 'yes'); $strDiv = '<div id="textSmall">' . '<p>' . 'Account updated =)' . '<br /><br />' . '<a href="main.php?cat=game&page=tribe">' . 'Continue' . '</a>' . '</p>' . '</div>'; echo $strDiv; } } else { $strDiv = '<div id="textSmall">' . '<p>' . 'You forgot to enter a new tribe name and/or forgot to ' . 'choose a race.' . '<br /><br />' . '<a href="main.php?cat=game&page=reset_account">' . 'Try Again?' . '</a>' . '</p>' . '</div>'; echo $strDiv; } } else { $picture = 'defeat'; if ($arrStats[KILLED] == 2) { $strMessage = '<p>' . stripslashes($arrStats[NAME]) . ', it seems that <strong class="negative">your last ' . 'citizens have left your tribe</strong>. ' . 'With them the last of your power is gone and so is your physical presence in the lands of Orkfia. But, within ' . PROTECTION_HOURS . ' ' . 'months you could once again do battle with your allies. ' . '</p>'; $picture = 'defeat'; } elseif ($arrStats[KILLED] == 0) { $strMessage = '<p>' . stripslashes($arrStats[NAME]) . ', it seems that <strong class="negative">you have ' . 'decided to reset</strong>. ' . 'The last of your power is gone and so is your physical presence in the lands of Orkfia. But, within ' . PROTECTION_HOURS . ' ' . 'months you could once again do battle with your allies. ' . '</p>'; $picture = 'defeat'; } elseif ($arrStats[KILLED] == 1) { $strMessage = '<p>' . stripslashes($arrStats[NAME]) . ', it seems that <strong class="positive">the leader ' . 'of your tribe has died due to age</strong>. ' . 'The last of your power is gone and so is your physical presence in the lands of Orkfia. But, within ' . PROTECTION_HOURS . ' ' . 'months you could once again do battle with your allies. ' . '</p>'; $picture = 'victory'; } elseif ($arrStats[KILLED] == 3) { $strMessage = '<p>' . 'Welcome! It seems that <strong class="positive">you are ' . 'about to create your first tribe in Orkfia</strong>. ' . 'Currently you have no physical presence in these lands. But, within ' . PROTECTION_HOURS . ' ' . 'months you could do battle together with your allies. ' . '</p>' . '<p>' . '<label for="1">' . 'Leader Name: ' . '</label>' . '<input id="1" name="name" size="20" maxLength="20">' . '</p>'; $picture = 'victory'; } $strForm = '<form method="POST" ' . 'action="main.php?cat=game&page=reset_account">' . '<div id="textMedium">' . '<p style="text-align: center">' . '<img src="' . $Host . $picture . '_small.gif">' . '</p>' . $strMessage . '<p>' . 'Your account is now paused, time will start running once you submit the information below.' . '</p>' . '<p>' . '<label for="2">' . 'New Tribe Name: ' . '</label>' . '<input id="2" name="tribe" size="20" maxLength="20" value="' . stripslashes($arrStats[TRIBE]) . '">' . '</p>' . '<p>' . '<label for="3">' . 'Select Race: ' . '</label>' . '<select id="3" size="1" name="race">'; foreach ($arrRaces as $strCurRace) { $strAdd = ''; if ($arrStats[RACE] == $strCurRace) { $strAdd = ' selected'; } $strForm .= "<option value=\"{$strCurRace}\"{$strAdd}>" . $strCurRace . "</option>"; } $strForm .= '</select> ' . '<a href="http://guide.orkfia.org/races.php?chapter=4" class="newWindowLink" target="_blank" style="cursor: help">Races</a>' . '</p>' . '<p>' . '<input type="submit" name="submit" value="Return to Orkfia!">' . '</p>' . '</div>' . '</form>'; echo $strForm; } } else { // Kick someone in the butt for finding this page through address field include_once "inc/pages/logout.inc.php"; include_logout_text(); } }
function include_thievery_text() { global $Host, $opname, $action, $basecost; $objSrcUser =& $GLOBALS["objSrcUser"]; $iSrcId = $objSrcUser->get_userid(); $arrSrcStats = $objSrcUser->get_stats(); //========================================================================== // M: Verify Alliance & Tribe ID from GET or POST //========================================================================== $iTrgAid = $arrSrcStats[ALLIANCE]; if (isset($_GET['kd'])) { $iTrgAid = intval($_GET['kd']); } elseif (isset($_POST['kd'])) { $iTrgAid = intval($_POST['kd']); } if ($iTrgAid < 11) { $iTrgAid = rand(11, 100); } if (isset($_GET['tribe'])) { $_GET['tribe'] = intval($_GET['tribe']); } //========================================================================== // Stop people from avoiding the tribe page so they dont get updated //========================================================================== include_once 'inc/functions/update_ranking.php'; doUpdateRankings($objSrcUser); include_once "inc/functions/races.php"; $arrUnitNames = getUnitVariables($objSrcUser->get_stat(RACE)); $arrUnitNames = $arrUnitNames['output']; set_op_vars(); $land = $objSrcUser->get_build(LAND); $thieves = $objSrcUser->get_army(UNIT5); $tpa = floor($thieves / $land); $credits = floor($objSrcUser->get_thievery(CREDITS)); $op_growth = obj_thief_op_growth($objSrcUser); $hideouts = $objSrcUser->get_build(HIDEOUTS); // frost: age 18 mori hideout/home bonus, updated age 19 (Martel) if ($objSrcUser->get_stat(RACE) == "Mori Hai") { $homes = $objSrcUser->get_build(HOMES); $max_tp = floor((1 + ($hideouts + $homes / 2.5) * 2 / $land) * ($hideouts + $homes / 2.5)); } else { $max_tp = floor((1 + $hideouts * 2 / $land) * $hideouts); } if (!$iTrgAid) { $iTrgAid = $objSrcUser->get_stat(KINGDOM); } echo $topLinks = '<div class="center">' . '<a href="main.php?cat=game&page=mystic">Mystics</a> | ' . '<b>Thievery</b> | ' . '<a href="main.php?cat=game&page=invade">Invasion</a>' . '</div>'; //added templar check - AI if ($objSrcUser->get_stat(RACE) == "Templar") { echo '<div id="textMedium"><p>' . 'Your proud Templar people will not lower themselves to thievery practices.' . '</p></div>'; } else { ?> <div id='textBig'> <p> <img src="<?php echo $Host; ?> thief.gif" style="float: left; margin-right: 10px;" alt="" /> <b>The thief</b> greets you cooly:<br /> <?php if ($arrUnitNames[6] == 'Thief') { $arrUnitNames[6] = 'Thieve'; } ?> Normally <?php echo strtolower($arrUnitNames[6]); ?> s are considered scum and not wanted in a tribe, but in war-times you need every asset available. <?php echo $arrUnitNames[6]; ?> s can be useful in many ways, and the more of them you have on your lands, the safer you will be. </p> <?php echo "<p>" . "Our hideouts can provide a maximum of <b>{$max_tp} thievery points</b>, right now " . "there are <b class=\"indicator\">" . $credits . "</b> left unused. Assuming you find any use for your thieves they will " . "provide you with <b>" . $op_growth . "</b> new thievery points each month. " . "With all your thieves at home we are protected by <b class=\"indicator\">{$tpa} TPA</b> (thieves per acre). " . "</p></div>"; //========================================================================== // M: Thievery Table //========================================================================== echo $strColumnDivs = '<div id="columns">' . '<!-- Start left column -->' . '<div id="leftcolumn">'; // Advisor Link echo $advisorLink = '<br />' . '<div class="tableLinkSmall">' . '<a href="main.php?cat=game&page=advisors&show=actions">The Thief</a>' . '</div>'; ?> <table width="40%" cellpadding="0" cellspacing="0" class="small"> <form action="main.php?cat=game&page=thievery" method="post"> <tr class="header"> <th colspan="2"> Thievery </th> </tr> <tr class="subheader"> <th colspan="2" class="center"> Select Target </th> </tr> <tr class="data"> <th> Alliance: </th> <td> <input maxlength="4" size="3" name="kd" value="<?php echo $iTrgAid; ?> " /> <input type="submit" value="Change" /> </td> </tr> </form> <tr class="data"> <form action="main.php?cat=game&page=thievery2" method="post"> <th> Tribe: </th> <td> <select size="1" name="dplayer"> <option value="<?php echo $objSrcUser->get_userid(); ?> "></option> <?php //========================================================================== // New version of Damadm00's code Martel, July 10, 2006 //========================================================================== include_once 'inc/classes/clsAlliance.php'; $objTrgAlliance = new clsAlliance($iTrgAid); $arrTrgIUsers = $objTrgAlliance->get_userids(); $tableTarget = ''; if (!empty($arrTrgIUsers)) { foreach ($arrTrgIUsers as $iUserId) { $objTmpUser = new clsUser($iUserId); $strTribe = stripslashes($objTmpUser->get_rankings_personal(TRIBE_NAME)); if (isset($_GET['tribe']) && $_GET['tribe'] == $iUserId) { $tableTarget .= sprintf('<option value="%d" selected>%s</option>', $iUserId, $strTribe); } elseif (!isset($_GET['tribe']) || isset($_GET['tribe']) && $_GET['tribe'] != $iUserId) { $tableTarget .= sprintf('<option value="%d">%s</option>', $iUserId, $strTribe); } elseif (isset($_GET['tribe'])) { echo "Trying to exploit bugs/loopholes will get you suspended!"; } } } echo $tableTarget; ?> </select> </td> </tr> <tr class="data"> <td colspan="4" class="right"> <select size="1" name="op"> <?php $op_level = get_op_level($objSrcUser); for ($i = 1; $i <= $op_level; $i++) { if (!empty($opname[$i])) { $cost = get_op_cost($action[$i], $land); echo " <option value=\"{$i}\"> {$opname[$i]} - {$cost}</option>"; } } ?> </select> </td> </tr> </table> <?php echo $strColumnDivs = '</div>' . '<!-- Start right column -->' . '<div id="rightcolumn">' . '<br />' . '<div class="tableLinkSmall">' . '<a href="main.php?cat=game&page=advisors&show=military">The General</a>' . '</div>'; ?> <table class="small" width="60%" cellpadding="0" cellspacing="0"> <tr class="header"> <th colspan="2">Prepare Thieves</th> </tr> <tr class="subheader"> <th>Instruction</th> <td>Select</td> </tr> <tr class="data"> <th>Times to Run Operation:</th> <td> <select size="1" name="amount"> <?php for ($i = 1; $i <= MAX_THIEVE_OPS; $i++) { echo " <option value='{$i}'> {$i} </option>"; } ?> </select> </td> </tr> <tr class="data"> <th> <?php echo $arrUnitNames[6]; ?> s to Send: </th> <td> <input name="amount_sent" size="5" value="1" /> </td> </tr> <tr class="data"> <th>Available:</th> <td> <?php echo number_format($objSrcUser->get_army_home(UNIT5)); ?> </td> </tr> <tr class="data"> <th>Stop on Success:</th> <td> <input type="checkbox" name="stop" value="yes" /> </td> </tr> </table> <br /> <input type="hidden" value="yes" name="SELF_CHECK" /> <div class="center"><input type="submit" value="Send thieves on operation" /></div> </form> <?php echo $strColumnDivs = '</div>' . '</div>'; } }
function include_army_text() { $objUser =& $GLOBALS["objSrcUser"]; $arrStats = $objUser->get_stats(); $arrUsers = $objUser->get_user_infos(); $arrArmys = $objUser->get_armys(); $arrArmysHome = $objUser->get_armys_home(); $arrArmysDue = $objUser->get_armys_due(); echo $topLinks = '<div class="center">' . '<a href="main.php?cat=game&page=build">Construction</a> | ' . '<strong>Military Training</strong> | ' . '<a href="main.php?cat=game&page=explore">Exploration</a>' . '</div>'; $objRace = $objUser->get_race(); $arrUnitVariables = $objRace->getUnitVariables(); $arrUnitNames = $objRace->getUnitNames(); $arrUnitCost = $objRace->getUnitCosts(); $arrUnitOffence = $objRace->getUnitOffences(); $arrUnitDefence = $objRace->getUnitDefences(); $strOlegText = ''; if ($arrStats['race'] == "Oleg Hai") { $strOlegText = '<p>' . '<strong>' . ucfirst($arrUnitNames[5]) . 's</strong> are ' . 'mercenary soldiers living amongst your ' . strtolower($arrUnitNames[1]) . 's. Up to 40% can be hired and ' . 'sent out in attacks, but only during their first month with ' . 'you. After that they will disagree to join any combat ' . 'measures other than defending your lands.' . '</p>'; } // At the end of a lifespan you can't train or release military if ($arrUsers[HOURS] > $objRace->getLifespan()) { echo $strReport = '<div id="textMedium">' . '<p>' . "Your general is nowhere in sight! And your captains seem to " . "be doubting your capability to judge properly what to train " . "or not." . "</p>" . '</div>'; include_game_down(); exit; } $advisorText = '<div id="textMedium">' . '<p>' . "<strong>Your general</strong> greets you: <br />" . "To keep your tribe safe and strong you need an army. To upgrade " . "your army to units of higher " . "class you will first need to train " . "<strong>" . strtolower($arrUnitNames[2]) . "s</strong>." . "</p>" . $strOlegText . "</div>" . '<br />'; echo $advisorText; // Non-forced update rankings (Non-forced limited to once each 15 minutes) include_once 'inc/functions/update_ranking.php'; doUpdateRankings($objUser); // M: Error Messages ======================================================= // Keep these short if (isset($_GET['error']) && $_GET['error'] == "empty") { echo '<div class="center">' . "I'm sorry leader, you did not train anything." . "</div><br />"; } elseif (isset($_GET['error']) && $_GET['error'] == "basics") { echo '<div class="center">' . "I'm sorry leader, we don't have enough basic soldiers to " . "upgrade that many military units." . "</div><br />"; } elseif (isset($_GET['error']) && $_GET['error'] == "poplimit") { echo '<div class="center">' . "I'm sorry leader, if we train that many soldiers we will " . "have too few citizens." . "</div><br />"; } elseif (isset($_GET['error']) && $_GET['error'] == "money") { echo '<div class="center">' . "I'm sorry leader, we don't have enough crowns to " . "upgrade that many military units." . "</div><br />"; } //========================================================================== $advisorLinks = '<div class="tableLinkMedium">' . '<a href="main.php?cat=game&page=advisors&show=military">The General</a>' . ' :: ' . '<a href="main.php?cat=game&page=raze_army">Release Military</a>' . '</div>'; echo $advisorLinks; $j = 2; // for unit array, we start at location #2 (basics == unit1) $strCurrent = $arrUnitVariables[$j]; // UNIT1 = 'unit1' // Maximum military trainable $arrMax = getMaxTrain($objUser); // Show basic military already in training $strInTraining = ''; if ($arrArmysDue[$strCurrent] > 0) { $strInTraining = '<span style="font-size: 0.8em;">' . '(' . number_format($arrArmysDue[$strCurrent]) . ')' . '</span> '; } $strBasicsTable = '<form id="center" action="main.php?cat=game&page=army2" method="post">' . '<table cellpadding="0" cellspacing="0" class="medium">' . '<tr class="header">' . '<th colspan="6">Basic</th>' . '</tr>' . '<tr class="subheader">' . '<th width="35%">Class</th>' . '<td class="right" width="25%">Owned</td>' . '<td class="right">Cost</td>' . '<td class="right">Max</td>' . '<td class="right">Train</td>' . '</tr>' . '<tr class="data">' . '<th>' . $arrUnitNames[$j] . 's <span class="militstats">(' . $arrUnitOffence[$j] . '/' . $arrUnitDefence[$j] . ')</span>' . '</th>' . '<td class="right">' . $strInTraining . '<strong>' . number_format($arrArmys[$strCurrent]) . '</strong>' . '</td>' . '<td class="right">' . number_format($arrUnitCost[$j]) . '</td>' . '<td align="right">' . number_format($arrMax[$strCurrent]) . '</td>' . '<td class="right">' . '<input name="trained[' . $strCurrent . ']" size="8" maxlength="8" />' . '</td>' . '</tr>' . '</table>'; echo $strBasicsTable; echo '<br />'; echo $strAdvancedTable = '<table cellpadding="0" cellspacing="0" class="medium">' . '<tr class="header">' . '<th colspan="6">Advanced</th>' . '</tr>' . '<tr class="subheader">' . '<th width="35%">Class</th>' . '<td class="right" width="25%">Owned</td>' . '<td class="right">Cost</td>' . '<td class="right">Max</td>' . '<td class="right">Upgrade</td>' . '</tr>'; $j++; // for unit arrays, we start at location #3 (off spec) foreach ($arrUnitCost as $doesntmatter) { // We can only train units that cost money, so only show those if (isset($arrUnitCost[$j]) && $arrUnitCost[$j] > 0) { $strCurrent = $arrUnitVariables[$j]; // unit2, unit3.. etc // $sub_current1 = "$strCurrent"."_t1"; // $sub_current2 = "$strCurrent"."_t2"; // $sub_current3 = "$strCurrent"."_t3"; // $sub_current4 = "$strCurrent"."_t4"; $plural = 's'; if ($arrUnitNames[$j] == 'Swordmen') { $plural = ''; } if ($arrUnitNames[$j] == 'Pikemen') { $plural = ''; } if ($arrUnitNames[$j] == 'Crossbowmen') { $plural = ''; } if ($arrUnitNames[$j] == 'Longbowmen') { $plural = ''; } if ($arrUnitNames[$j] == 'Thief') { $arrUnitNames[$j] = 'Thieve'; } if ($arrUnitNames[$j] == 'Priestess') { $plural = 'es'; } if ($arrUnitNames[$j] == 'Mummy') { $arrUnitNames[$j] = 'Mummie'; } // Show military units already being trained $strInTraining = ''; if ($arrArmysDue[$strCurrent] > 0) { $strInTraining = '<span style="font-size: 0.8em;">' . '(' . number_format($arrArmysDue[$strCurrent]) . ')' . '</span> '; } echo '<tr class="data">' . '<th>' . $arrUnitNames[$j] . $plural . ' <span class="militstats">(' . $arrUnitOffence[$j] . '/' . $arrUnitDefence[$j] . ')</span>' . '</th>' . '<td class="right">' . $strInTraining . '<strong>' . number_format($arrArmys[$strCurrent]) . '</strong>' . '</td>' . '<td class="right">' . number_format($arrUnitCost[$j]) . '</td>' . '<td align="right">' . '<span class="indicator">' . number_format($arrMax[$strCurrent]) . '</span>' . '</td>' . '<td class="right">' . '<input name="trained[' . $strCurrent . ']" size="8" maxlength="8" />' . '</td>' . '</tr>'; } $j++; } echo '</table>' . '<br />' . '<input type="submit" value="Train Military" />' . '</form>'; // $bleh = mysql_query("Select username from user where id = {$arrStats[ID]}"); // $bleh = mysql_fetch_array($bleh); // $b = date("d"); // $tiripoda = $bleh['username']."alpha".$b; // $b_checker = md5($tiripoda); // <input type=\"hidden\" name=\"piss_off_bots\" value=\"$b_checker\" /> }
function include_preferences_text() { global $orkTime; include_once 'inc/classes/clsGame.php'; $objSrcUser =& $GLOBALS["objSrcUser"]; $arrSrcUserInfos = $objSrcUser->get_user_infos(); $arrSrcStats = $objSrcUser->get_stats(); $iUserId = $objSrcUser->get_userid(); $objGame = new clsGame(); // Navigational Links if ($arrSrcStats[TYPE] == 'elder' || $arrSrcStats[TYPE] == 'coelder') { echo $topLinks = '<div class="center">| <b>Options</b> ' . '| <a href="main.php?cat=game&page=elder">Elder Options</a> ' . '|' . '</div>'; } echo '<div id="textBig">'; echo '<h2>Account Settings</h2>' . '<p>' . '<a href="main.php?cat=game&page=preferences&task=layout">Interface Settings</a> :: ' . '<a href="main.php?cat=game&page=preferences&task=profile">Profile Settings</a> :: ' . '<a href="main.php?cat=game&page=preferences&task=request_name">Request Name Change</a>' . '</p>'; echo '<h2>Account Options</h2>' . '<p>' . '<a href="main.php?cat=game&page=preferences&task=request_merge">Request Merge</a> :: ' . '<a href="main.php?cat=game&page=preferences&task=pause_account">Pause Account</a> :: ' . '<a href="main.php?cat=game&page=preferences&task=reset_account">Reset Account</a> :: ' . '<a href="main.php?cat=game&page=preferences&task=delete_account">Delete Account</a>' . '</p>'; if ($arrSrcStats[LEVEL] > 1) { echo "<h2>Staff Options</h2>" . '<p>' . '<a href="main.php?cat=game&page=resort_tools">Resort Tools</a>' . '</p>'; } echo '</div>'; //========================================================================== // Below you will find the options for people to manage their accounts //========================================================================== echo '<div id="textBig">'; $task = ''; if (isset($_GET['task'])) { $task = $_GET['task']; } switch ($task) { case "layout": ?> <h2>Interface Settings</h2> <?php // XSS secure May 21, 2006 -Martel & Damadm00 $widths = array(1 => 750, 1060); $alignments = array(1 => 'left', 'center'); // $designs = array( 1 => 'blue', 'ice', 'red'); $designs = array(1 => 'forest_v1', 'black_v2', 'ork_v2'); // $output = array( 1 => 'Trade Winds', 'Castle Walls', 'Uruk Hatred'); $output = array(1 => 'Forest Greens', 'Cursed Nights', 'Old Orkfia'); // Handle POST Requests if (isset($_POST['width']) && isset($_POST['alignment']) && isset($_POST['design'])) { if (in_array($_POST['width'], $widths) && in_array($_POST['alignment'], $alignments) && in_array($_POST['design'], $designs)) { $arrSrcDesignSafe[WIDTH] = $_POST['width']; $arrSrcDesignSafe[ALIGNMENT] = $_POST['alignment']; $arrSrcDesignSafe[COLOR] = $_POST['design']; $objSrcUser->set_designs($arrSrcDesignSafe); // A gift to you Damadm00 ^^ -Martel header("Location: main.php?cat=game&page=preferences&task=layout"); } } elseif (isset($_POST['guide_links'])) { if (isset($_POST['check'])) { echo '<p><strong>Saved!</strong> Guide links will now show.</p>'; $objSrcUser->set_preference(GUIDE_LINKS, ON); } else { echo '<p><strong>Saved!</strong> Guide links will no longer show.</p>'; $objSrcUser->set_preference(GUIDE_LINKS, OFF); } } // GUIDE LINKS OPTION $strChecked = ''; if ($objSrcUser->get_preference(GUIDE_LINKS) == ON) { $strChecked = ' CHECKED'; } // INTERFACE OPTIONS $arrSrcDesign = $objSrcUser->get_designs(); ?> <h3>Interface Control</h3> <form method="post" action="main.php?cat=game&page=preferences&task=layout"> <label for="skin">Skin:</label><br /> <select name="design" id="skin"> <?php foreach ($designs as $key => $color) { if ($color == $arrSrcDesign['color']) { echo "<option value=\"" . $color . "\" selected=\"selected\">" . $output[$key] . "</option>"; } else { echo "<option value=\"" . $color . "\">" . $output[$key] . "</option>"; } } ?> </select><br /><br /> <label for="screen width">Width:</label><br /> <select name="width" id="screen width"> <?php foreach ($widths as $width) { if ($width == $arrSrcDesign['width']) { echo "<option value=\"" . $width . "\" selected=\"selected\">" . $width . "</option>"; } else { echo "<option value=\"" . $width . "\">" . $width . "</option>"; } } ?> </select><br /><br /> <label for="layout alignment">Alignment:</label><br /> <select name="alignment" id = "layout alignment"> <?php foreach ($alignments as $alignment) { if ($alignment == $arrSrcDesign['alignment']) { echo "<option value=\"" . $alignment . "\" selected=\"selected\">" . $alignment . "</option>"; } else { echo "<option value=\"" . $alignment . "\">" . $alignment . "</option>"; } } ?> </select> <input type="submit" value="Update interface" /> </form> <h3>Ingame Help System</h3> <form method="post" action="main.php?cat=game&page=preferences&task=layout"> <label for="1">Show Guide Links: </label> <input type="checkbox" id="1" name="check" <?php echo $strChecked; ?> > <input type="hidden" name="guide_links" /> <input type="submit" value="Update interface" /> </form> <?php break; case "profile": //================================================================== // Action handler part of Profile October 28, 2007 Martel //================================================================== if (isset($_POST['realname']) && !empty($_POST['realname'])) { // Enforce maxlength in form $strSafe = substr($_POST['realname'], 0, 24); // Same as in registration, important to keep the order right $strSafe = addslashes(strip_tags(trim($strSafe))); if (!empty($strSafe)) { $objSrcUser->set_user_info(REALNAME, $strSafe); echo '<p>Thank you, your name has been updated.</p>'; } } elseif (isset($_POST['name']) && !empty($_POST['name'])) { // Enforce maxlength in form $strSafe = substr($_POST['name'], 0, 16); // Same as in registration, important to keep the order right $strSafe = addslashes(strip_tags(trim($strSafe))); $resSQL = mysql_query("SELECT * FROM stats WHERE name = '{$strSafe}'"); $arrSQL = mysql_fetch_array($resSQL); if ($arrSQL) { echo "<p>Sorry, that leader name is taken.</p>"; $strSafe = ''; } if (!empty($strSafe)) { $objSrcUser->set_stat(NAME, $strSafe); echo '<p>Thank you, your name has been updated.</p>'; } } elseif (isset($_POST['password1']) && !empty($_POST['password1'])) { $password1 = $_POST['password1']; $password2 = $_POST['password2']; $password = $_POST['password']; $check = mysql_query("SELECT * FROM user WHERE password = sha1('{$password}') AND id = {$iUserId}") or die("Error Retrieving Password From DB."); if (mysql_num_rows($check) == 1 && $password1 == $password2) { $strPw1Safe = sha1($password1); $objSrcUser->set_user_info(PASSWORD, $strPw1Safe); echo "<p>Your password has been changed.</p>"; $email = stripslashes($objSrcUser->get_preference(EMAIL)); $username = stripslashes($arrSrcUserInfos[USERNAME]); mail("{$email}", "ORKFiA New Password", "Hello, \nYour password has been updated with the one you requested =) \n\nUsername: {$username} \nPassword: {$password1}" . SIGNED_ORKFIA, "From: ORKFiA <" . EMAIL_REGISTRATION . ">\r\nX-Mailer: PHP/" . phpversion() . "\r\nX-Priority: Normal"); } else { echo "<p>Either you entered the wrong current password, or your new password wasn't matching in both entries.</p>"; } } elseif (isset($_POST['email']) && !empty($_POST['email'])) { $strEmailSafe = $_POST['email']; // This check is used on the registration and verification pages if (!ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+' . '@' . '[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\\.' . '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $strEmailSafe)) { echo "<p>Sorry, invalid e-mail address.</p>"; } else { $pref_search = mysql_query("SELECT * FROM preferences WHERE email = " . quote_smart($strEmailSafe)); $pref_search = mysql_fetch_array($pref_search); if ($pref_search) { echo "<p>Sorry, that email is in use.</p>"; } else { $strCode = ''; for ($i = 0; $i < 12; $i++) { $strCode .= substr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", rand(0, 61), 1); } // Activation email sent to all new players mail($strEmailSafe, "ORKFiA Verification", "Thank you for updating your profile =) \n\nHere is your new verification code: {$strCode} \n\nWe hope you enjoy your stay in ORKFiA =)" . SIGNED_ORKFIA, "From: ORKFiA <" . EMAIL_REGISTRATION . ">\r\nX-Mailer: PHP/" . phpversion() . "\r\nX-Priority: Normal"); $arrNewPrefs = array(EMAIL_ACTIVATION => $strCode, EMAIL => $strEmailSafe); $objSrcUser->set_preferences($arrNewPrefs); echo '<p>Thank you, your e-mail has been updated and ' . 'a new verification code has been sent to it.</p>'; } } } $arrUsers = $objSrcUser->get_user_infos(); $arrStats = $objSrcUser->get_stats(); $arrUsers[REALNAME] = stripslashes($arrUsers[REALNAME]); $arrStats[NAME] = stripslashes($arrStats[NAME]); $strEmail = stripslashes($objSrcUser->get_preference(EMAIL)); //================================================================== // Output part of Profile October 28, 2007 Martel //================================================================== echo '<h2>Profile Settings</h2>'; $strRealName = '<h3>Real Name</h3>' . '<p>About your privacy: Only admins and Law & Order ' . 'can see your real name, and only when enforcing the Code ' . 'of Conduct (to help judge that you are a unique individual). ' . 'We believe it is your right to remain anonymous, and you may ' . 'rest assured this will never be shown to anybody else.</p>' . '<form method="post" action="main.php?cat=game&page=preferences&task=profile">' . '<label for="real_name">Your Real Name:</label>' . '<br />' . '<input type="text" name="realname" id="real_name" value="' . $arrUsers[REALNAME] . '" maxlength="24" size="24" /> ' . '<input type="submit" value="Update my profile" />' . "</form>" . '<blockquote>"You also agree that by creating your account, ' . 'all details you have supplied are correct, persons who ' . 'create accounts with false information may be removed from ' . 'ORKFiA."</blockquote>'; echo $strRealName; $strLeaderName = '<h3>Leader Name</h3>' . '<p>Your current nick name with us is <em>' . $arrStats[NAME] . '</em>. This is used in the forums, when sending mail using ' . 'the Orkfia Mail and in various alliance contexts. If someone ' . 'called out "<em>Hey ' . $arrStats[NAME] . '!</em>" in the ' . 'street, would you react to it and think it must be another ' . 'ORKFiAN?</p>' . '<form method="post" action="main.php?cat=game&page=preferences&task=profile">' . '<label for="new_leader_name">Your Leader Name:</label><br />' . '<input type="text" name="name" id="new_leader_name" value="' . $arrStats[NAME] . '" maxlength="16" size="16" /> ' . "<input type=\"submit\" value=\"Update my profile\" />" . "</form>"; echo $strLeaderName; $strPassword = '******' . '<p>For your own safety, make sure your password consists of ' . 'minimum 8 characters including numbers and capital letters.' . '</p>' . '<form method="post" action="main.php?cat=game&page=preferences&task=profile">' . '<label for="current_pw">Current Password:</label><br />' . '<input type="password" name="password" id="current_pw" />' . '<br /><br />' . '<label for="new_pw">New Password:</label><br />' . '<input type="password" name="password1" id="new_pw" ' . 'maxlength="30" />' . '<br /><br />' . '<label for="repeat_pw">Confirm Password:</label><br />' . '<input type="password" name="password2" id="repeat_pw" ' . 'maxlength="30" /> ' . '<input type="submit" value="Update my profile" />' . "</form>"; echo $strPassword; $strEmail = '<h3>E-mail</h3>' . '<p>It is important that you get this right, if you would ' . 'forget your password or if our ORKFiA Staff Team need to ' . 'contact you this e-mail will be used. We will never share ' . 'this with anyone else, privacy is a major concern to us.</p>' . '<form method="post" action="main.php?cat=game&page=preferences&task=profile">' . '<label for="new_email">' . "Your e-mail:" . '</label><br />' . '<input type="text" name="email" id="new_email" value="' . $strEmail . '" maxlength="30" size="30" />' . ' <input type="submit" value="Update my profile" />' . "</form>"; echo $strEmail; break; case "request_name": $strSwitch = $objGame->get_game_switch(NAME_CHANGE_PROGRAM); if ($strSwitch == 'on') { echo "<h2> Request Name Change </h2>"; echo "<p>Here you may request that the ORKFiA Staff Team " . "changes your tribe name. Normally you would only change " . "your tribe name if you reset your account, or if " . "your tribe dies.</p>"; if (isset($_POST['action']) && $_POST['action'] == "yes") { if (!empty($_POST['newtribename']) && !empty($_POST['reason'])) { $strTribe = $_POST['newtribename']; $strTribe = quote_smart(strip_tags(trim($strTribe))); $reason = quote_smart(str_replace("'", "", strip_tags(trim($_POST['reason'])))); $check = mysql_query("SELECT * FROM stats WHERE tribe = {$strTribe}"); if (mysql_num_rows($check) != 0) { echo "<p>Sorry, someone is already using that tribe name.</p>"; } else { echo "<p>Thank you, your request has been sent to staff. You will soon recieve a confirmation note.</p>"; mysql_query("INSERT INTO namechanges (id, tribe, requestedname, reason, mod_id, reason_declined, request_status, oldname) VALUES ( '', '{$arrSrcStats['id']}', {$strTribe}, {$reason}, '0', '0', 'ready', '{$arrSrcStats['tribe']}')"); } } else { echo '<p>' . "You need to fill in a new tribe name and a reason." . '</p><p>' . '<a href="main.php?cat=game&page=preferences&task=request_name">Return</a>' . '</p>'; } } elseif (isset($_POST['action']) && $_POST['action'] == "cancel") { echo "<p>Your request to change your tribe name has been deleted.</p>"; mysql_query("UPDATE namechanges SET request_status = 'cancelled' WHERE tribe = {$arrSrcStats['id']} AND request_status = 'ready' "); } else { $strSQL = "SELECT requestedname FROM namechanges WHERE tribe = {$arrSrcStats['id']} AND request_status = 'ready'"; $result2 = mysql_query($strSQL); if ($result = mysql_fetch_array($result2)) { echo "<p>You have a pending name request.<br /> Your requested name is: " . stripslashes($result['requestedname']) . ".</p><p>If you wish to cancel your name request you may use the button below.</p>" . "<form method=\"post\" action=\"main.php?cat=game&page=preferences&task=request_name\">" . "<input type=hidden value='cancel' name='action'>" . "<input type=submit value='Cancel Request'>" . "</form>"; } else { ?> <form method="post" action="main.php?cat=game&page=preferences&task=request_name"> <label for="new tribe name">New Tribe Name:</label><br /> <input type="text" size="30" name="newtribename" maxlength="30" id="new tribe name" value="<?php echo stripslashes($arrSrcStats[TRIBE]); ?> " /><br /><br /> <label for="reason">Reason For Changing:</label><br /> <input type="text" size="48" name="reason" maxlength="100" id="reason" /> <input type="hidden" name="action" value="yes" /> <input type="submit" value="Send request to Operations staff" /> </form> <?php } } } else { echo '<p class="positive">Currently name changes are closed. ' . 'It is not possible to request any more name changes.</p>'; } break; case "request_merge": echo '<h2>Request Merge</h2>'; $mergeswitch = $objGame->get_game_switch(MERGER_PROGRAM); if ($mergeswitch == "on") { if (isset($_POST['do']) && $_POST['do'] == "cancel") { $bleh = mysql_query("SELECT * FROM mergers WHERE tribe = {$arrSrcStats['id']} AND ( request_status = 'not ready' OR request_status = 'ready')"); $bleh = mysql_fetch_array($bleh); $bleh2 = mysql_query("SELECT * FROM stats WHERE type='elder' AND kingdom='{$bleh['target']}'"); $bleh2 = mysql_fetch_array($bleh2); $message = "The merge request done by " . $arrSrcStats[TRIBE] . " (#" . $arrSrcStats[ALLIANCE] . ") has been cancelled by the player."; mysql_query("INSERT INTO messages (id, for_user, from_user, date, subject, text, new, action) VALUES ('', {$bleh2['id']}, 0, {$orkTime}, 'Merge Request Cancelled', " . quote_smart($message) . ", 'new', 'received')"); mysql_query("DELETE FROM mergers WHERE tribe = {$arrSrcStats['id']} AND ( request_status = 'not ready' OR request_status = 'ready')"); echo "<p>Your merge request has been deleted.</p>"; echo '</div>'; return; } $result2 = mysql_query("SELECT * FROM mergers WHERE tribe = {$arrSrcStats['id']} AND ( request_status = 'not ready' OR request_status = 'ready')"); $result2 = mysql_fetch_array($result2); if (isset($result2['target'])) { echo "<p>You have a pending merge request to alliance (#" . $result2['target'] . ").<br />If you want to cancel this " . "merge request click on the button below.</p>"; echo $strCancelForm = '<form method="post" action="main.php?cat=game&page=preferences&task=request_merge">' . '<input type="hidden" name="do" value="cancel" />' . '<input type="submit" value="Cancel merge request" />' . '</form>'; echo '</div>'; return; } // Action on sent confirmation from target elder (by PM link) if (isset($_GET['checker']) && $_GET['checker'] > 0) { $checker = intval($_GET['checker']); $mergerid = intval($_GET['mergerid']); $result = mysql_query("SELECT * FROM mergers WHERE tribe = {$mergerid} ORDER BY id DESC LIMIT 1"); if (mysql_num_rows($result) > 0) { $result = mysql_fetch_array($result); if ($checker == 1 && $result['target'] == $arrSrcStats[ALLIANCE]) { mysql_query("UPDATE mergers SET auth = 1, request_status = 'ready' WHERE tribe = {$mergerid} AND request_status = 'not ready'") or die("<p>Error while accepting tribe.</p>"); $message = "Your request to merge to alliance {$result['target']} has been accepted by their elder.<br /><br />A member of the Operations Resort will merge you as soon as possible =)"; $sqlquery = "INSERT INTO messages (id, for_user, from_user, date, subject, text, new, action) VALUES ('', {$result['tribe']}, 0, {$orkTime}, 'Merge Request Accepted', " . quote_smart($message) . ", 'new', 'received')"; mysql_query($sqlquery); echo "<p>Thank you, we have now accepted a new member to the alliance.</p>"; } elseif ($checker == 2 && $result['target'] == $arrSrcStats[ALLIANCE]) { mysql_query("DELETE FROM mergers WHERE tribe = {$result['tribe']} AND ( request_status = 'not ready' OR request_status = 'ready') ") or die("<br />Error while rejecting tribe.<br />"); $message = "Your request to merge to alliance {$result['target']} has been rejected by their elder.<br /><br />"; $sqlquery = "INSERT INTO messages (id, for_user, from_user, date, subject, text, new, action) VALUES ('', {$result['tribe']}, 0, {$orkTime}, 'Merge Request Rejected', " . quote_smart($message) . ", 'new', 'received')"; mysql_query($sqlquery); echo "<p>Thank you for answering the request.</p>"; } else { echo "<p>This tribe is no longer applying for a merge into your alliance.</p>"; } } else { echo "<p>The merge request no longer exists.</p>"; } } elseif (isset($_POST['do']) && $_POST['do'] == "yes") { $iTargetAlli = intval($_POST['target']); if (empty($iTargetAlli)) { echo "<p>You have to fill in an alliance number that " . "you wish to merge into. Please try again. </p>"; unset($_POST['do']); echo '</div>'; return; } elseif ($iTargetAlli == $arrSrcStats[ALLIANCE]) { echo "<p>You can not merge into your own alliance. " . "Please fill in another alliance number.</p>"; echo '</div>'; return; } elseif ($iTargetAlli <= 10) { echo "<p>You can not request to merge into a staff " . "alliance. Please fill in another alliance " . "number.</p>"; echo '</div>'; return; } $strSQL = "SELECT * FROM " . TBL_ALLIANCE . " WHERE id = " . $iTargetAlli; if (mysql_num_rows(mysql_query($strSQL)) != 1) { echo "<p>We're sorry, this alliance does not exist.</p>"; echo '</div>'; return; } $objTrgAlliance = new clsAlliance($iTargetAlli); $arrUserids = $objTrgAlliance->get_userids(); if (count($arrUserids) >= MAX_ALLIANCE_SIZE) { echo "<p>We're sorry, this alliance is full.</p>"; echo '</div>'; return; } else { // Default: no name change requested along with merger $newtribename = $arrSrcStats[TRIBE]; $safetribename = quote_smart(stripslashes($newtribename)); if (isset($_POST['newtribename']) && !empty($_POST['newtribename'])) { $safetribename = quote_smart(strip_tags(trim($_POST['newtribename']))); $id = $objSrcUser->get_userid(); $check = mysql_query("SELECT * FROM stats WHERE tribe = {$safetribename} AND id != {$id}"); if (mysql_num_rows($check) != 0) { echo "<p>Someone is already using that tribename.</p>"; echo '</div>'; return; } $message = "You have an awaiting merge request.<br /><br />" . $arrSrcStats[TRIBE] . " (#" . $arrSrcStats[ALLIANCE] . ") wishes to join your alliance.<br />They did also request a new name.<br /><br />Do you <a href= \"main.php?cat=game&page=preferences&task=request_merge&checker=1&mergerid=" . $arrSrcStats['id'] . "\">accept their request</a> or <a href= \"main.php?cat=game&page=preferences&task=request_merge&checker=2&mergerid=" . $arrSrcStats['id'] . "\">deny their request</a>?<br />"; } else { $message = "You have an awaiting merge request.<br /><br />" . $arrSrcStats[TRIBE] . " (#" . $arrSrcStats[ALLIANCE] . ") wishes to join your alliance.<br /><br />Do you <a href=\"main.php?cat=game&page=preferences&task=request_merge&checker=1&mergerid=" . $arrSrcStats['id'] . "\">accept</a> or <a href=\"main.php?cat=game&page=preferences&task=request_merge&checker=2&mergerid=" . $arrSrcStats['id'] . "\">deny</a> their request?"; } $iElderId = mysql_query("SELECT id FROM stats WHERE type = 'elder' AND " . ALLIANCE . " = {$iTargetAlli}"); $iElderId = mysql_fetch_array($iElderId); $iElderId = $iElderId['id']; if (!empty($iElderId)) { mysql_query("INSERT INTO messages (id, for_user, from_user, date, subject, text, new, action) VALUES ('', {$iElderId}, 0, {$orkTime}, 'Merge Request', " . quote_smart($message) . ", 'new', 'received')"); } else { echo "<p>There's no elder in this alliance!</p>"; echo '</div>'; return; } // Insert into mergers mysql_query("INSERT INTO mergers (id, tribe, target, origin, auth, tribe_status, request_status, mtype, merge_time, newname, oldname, mod_id, declined_reason) VALUES ('', {$id}, {$iTargetAlli}, {$arrSrcStats[ALLIANCE]}, 0, " . quote_smart($arrSrcStats[TYPE]) . ", 'not ready', 1, {$orkTime}, {$safetribename}, " . quote_smart($arrSrcStats[TRIBE]) . ", '0', '0')") or die("Merger error"); echo "<p>The request was sent to the elder of (#" . $iTargetAlli . ")!</p>"; } } else { include_once "inc/functions/war.php"; $warTarget = war_target($arrSrcStats[ALLIANCE]); $strDate = $objSrcUser->get_gamestat(SIGNUP_TIME); $iHours = $objSrcUser->get_user_info(HOURS); $bAllow = TRUE; if ($warTarget != 0) { echo "<p>The option to merge is not available during war.</p>"; $bAllow = FALSE; } elseif (strtotime("-6 weeks") < strtotime($strDate)) { echo '<p>You may merge for another ' . ceil((strtotime($strDate) - strtotime("-6 weeks")) / 86400) . ' days.</p>'; $bAllow = TRUE; } elseif ($iHours < 72) { echo '<p>You may merge for another ' . ceil(abs(($iHours - 72) / 12)) . ' orkfian years'; $bAllow = TRUE; } if ($bAllow) { echo $strForm = '<h3>Merging into another alliance</h3>' . '<form method="post" action="main.php?cat=game&page=preferences&task=request_merge">' . 'Alliance # you wish to request a merge with: ' . '<input type="text" size="4" name="target" maxlength="4" />' . '<br />' . 'New tribe name you want: ' . '<input type="text" size="16" name="newtribename" maxlength="30" /> (optional)' . '<br /><br />' . '<input type="hidden" name="do" value="yes" />' . '<input type="submit" value="Send merge request" />' . '</form>'; } elseif (strtotime("-6 weeks") > strtotime($strDate)) { echo '<p>Currently your ruler is too old to merge.</p>'; } } echo $strRules = '<h3>Merger Rules</h3>' . '<ol>' . '<li>You may request a merge ' . 'anywhere, at any time, within 6 weeks after you ' . 'sign up</li>' . '<li>Veteran players may only merge before their ' . 'ruler age is 22 (within 3 days after restarting)' . '<li>Exception to rule #2: If you were <em>defected' . '</em> you may request a merges at any ruler age, but ' . 'only <em>after</em> 1 week</li>' . '<li>No one may merge during wars</li>' . '</ol>'; } else { echo "<p>Currently merging is closed. You can not request/accept any more mergers.</p>"; } break; case "delete_account": echo '<h2>Delete Account</h2>'; include_once "inc/functions/war.php"; $warTarget = war_target($arrSrcStats[ALLIANCE]); if ($warTarget > 0) { echo "<p>You are not allowed to delete during war.</p>"; echo '</div>'; return; } $arrSrcArmysOut = $objSrcUser->get_armys_out(); if (array_sum($arrSrcArmysOut) > 0) { echo "<p>Sorry, you can not delete with troops out.</p>"; echo '</div>'; return; } if (isset($_GET['do']) && $_GET['do'] == "yes" && isset($_POST['checker'])) { echo "<p>It's so sad to see you go.</p>"; //include_once("inc/functions/research.php"); //delete_my_rps($iUserId); // no more - AI 07/05/07 $objSrcUser->set_stat(NAME, 'deleted'); $objSrcUser->set_stat(ALLIANCE, 0); mysql_query("DELETE FROM rankings_personal WHERE id = {$iUserId}"); setcookie("userid", ""); echo "<p>...Thank you for playing ORKFiA...</p>"; // Alliance News $iAlliance = $objSrcUser->get_stat(ALLIANCE); $orkTime = date("YmdHis"); $strSQL = "INSERT INTO news (id, time, ip, type, duser, ouser, result, text, kingdom_text, kingdoma, kingdomb) VALUES ('','{$orkTime}', '', 'Selfdeletion', 0, 0, 1, 'tribe deleted', '" . $arrSrcStats[TRIBE] . " deleted their tribe.', " . $iAlliance . ", {$iAlliance})"; mysql_query($strSQL); echo '</div>'; return; } else { $strForm = '<form method="post" action="main.php?cat=game&page=preferences&task=delete_account&do=yes">' . 'Are you absolutely sure you want to <em>delete</em> your account? ' . '<input type="checkbox" name="checker" id="y1"> ' . '<label for="y1">(yes)</label>' . '<br /><br />' . 'This action is permanent and cannot be undone.' . '<br /><br />' . '<input type="submit" value="Delete my account">' . '</form>'; echo $strForm; } break; case "reset_account": echo '<h2>Reset Account</h2>'; include_once "inc/functions/war.php"; $warTarget = war_target($arrSrcStats[ALLIANCE]); if ($warTarget > 0) { echo '<p>Sorry, you are not allowed to reset during war.</p>'; echo '</div>'; return; } $arrSrcArmysOut = $objSrcUser->get_armys_out(); if (array_sum($arrSrcArmysOut) > 0) { echo '<p>Sorry, you cannot reset while you have troops out.</p>'; echo '</div>'; return; } if (isset($_GET['do']) && $_GET['do'] == "yes" && isset($_POST['checker'])) { // Mark tribe for resetting $objSrcUser->set_stat(RESET_OPTION, "'yes'"); // Force update of rankings include_once 'inc/functions/update_ranking.php'; doUpdateRankings($objSrcUser, 'yes'); $strP = '<p>' . 'Your account has been reset!' . '</p><p>' . '<a href="main.php?cat=game&page=tribe">' . 'Continue' . '</a>' . '</p>'; echo $strP; } else { $strForm = '<form method="post" action="main.php?cat=game&page=preferences&task=reset_account&do=yes">' . 'Are you absolutely sure you want to <em>reset</em> your account? ' . '<input type="checkbox" name="checker" id="1"> ' . '<label for="1">(yes)</label>' . '<br /><br />' . 'This action is permanent and cannot be undone.' . '<br /><br />' . '<input type="submit" value="Reset my account">' . '</form>'; echo $strForm; } break; case "pause_account": echo '<h2>Pause Account</h2>'; $PauseModeActive = $objGame->get_game_switch(PAUSE_MODE_ACTIVE); if ($PauseModeActive != 'on') { echo "<p><span class=positive>We're sorry, currently you may " . "not pause your account due to a global event.</span></p>"; echo '</div>'; return; } $arrSrcUserInfos = $objSrcUser->get_user_infos(); if ($arrSrcUserInfos[PAUSE_ACCOUNT] == 0 && ($arrSrcUserInfos[NEXT_ATTACK] > 0 && $arrSrcUserInfos[HOURS] > 0)) { echo "<p>" . $arrSrcUserInfos[NEXT_ATTACK] . " hour(s) left before your troops are home.</p>"; echo '</div>'; return; } $arrSrcBuilds = $objSrcUser->get_builds(); if ($arrSrcUserInfos[PAUSE_ACCOUNT] == 0 && ($arrSrcBuilds[LAND_T1] > 0 || $arrSrcBuilds[LAND_T2] > 0 || $arrSrcBuilds[LAND_T3] > 0 || $arrSrcBuilds[LAND_T4] > 0)) { echo "<p>You can't pause while land is incoming.</p>"; echo '</div>'; return; } if ($arrSrcUserInfos[PAUSE_ACCOUNT] > 49) { echo "<p>Your account will be paused in " . ($arrSrcUserInfos[PAUSE_ACCOUNT] - 49) . " updates, you will be able to unpause it in " . ($arrSrcUserInfos[PAUSE_ACCOUNT] - 1) . "</p>"; echo '</div>'; return; } if ($arrSrcUserInfos[PAUSE_ACCOUNT] > 1) { echo "<p>" . ($arrSrcUserInfos[PAUSE_ACCOUNT] - 1) . " updates left " . "until you may un-pause your account and play again.</p>"; echo '</div>'; return; } // if($arrSrcUserInfos[PAUSE_ACCOUNT] == 1 && war_target($arrSrcStats[ALLIANCE]) > 0 ) // { // echo "<p>You cannot unpause during war.</p>"; // echo '</div>'; // return; // } if (isset($_POST['do']) && $_POST['do'] == "yes") { // Pause Account Routines. Martel July 13, 2006 $arrSrcUser = $objSrcUser->get_user_infos(); if ($arrSrcUser[NEXT_ATTACK] <= 1) { $arrSrcUser[NEXT_ATTACK] = 1; } $arrNewSrcUser = array(NEXT_ATTACK => $arrSrcUser[NEXT_ATTACK], PAUSE_ACCOUNT => 55); $objSrcUser->set_user_infos($arrNewSrcUser); // Empty Magic and Thievery Points $objSrcUser->set_spell(POWER, 0); $objSrcUser->set_thievery(CREDITS, 0); // Forced Ranking Update include_once 'inc/functions/update_ranking.php'; doUpdateRankings($objSrcUser, 'yes'); // M: Alliance news (March 07, 2008) $objSrcAlliance = $objSrcUser->get_alliance(); $iWarTarget = $objSrcAlliance->get_war('target'); // 0=default $iAllianceid = $objSrcAlliance->get_allianceid(); mysql_query("INSERT INTO news (id, time, ip, type, duser, ouser, result, text, kingdom_text, kingdoma, kingdomb) VALUES ('', '{$orkTime}', '---', 'vacation', 0, 0, 1, '', '{$arrSrcStats['tribe']} (#{$iAllianceid}) is entering vacation mode', {$iAllianceid}, {$iWarTarget})"); echo "<p>Your account has been paused, see you back in 2 or more days =)</p>"; echo '</div>'; return; } elseif (isset($_POST['do']) && $_POST['do'] == "no") { // Un-Pause Account Routines. Martel July 13, 2006 $arrNewSrcUser = array(NEXT_ATTACK => 0, PAUSE_ACCOUNT => 0); $objSrcUser->set_user_infos($arrNewSrcUser); // M: Alliance news (March 07, 2008) $objSrcAlliance = $objSrcUser->get_alliance(); $iWarTarget = $objSrcAlliance->get_war('target'); // 0=default $iAllianceid = $objSrcAlliance->get_allianceid(); mysql_query("INSERT INTO news (id, time, ip, type, duser, ouser, result, text, kingdom_text, kingdoma, kingdomb) VALUES ('', '{$orkTime}', '---', 'vacation', 0, 0, 1, '', '{$arrSrcStats['tribe']} (#{$iAllianceid}) is now back from vacation mode', {$iAllianceid}, {$iWarTarget})"); echo "<p>Your account has been un-paused, we're glad to see you back =)</p>"; } else { if ($arrSrcUserInfos[PAUSE_ACCOUNT] > 0) { ?> <p>You are now allowed to un-pause your account.</p> <form method="post" action="main.php?cat=game&page=preferences&task=pause_account"> <input type="hidden" name="do" value="no"> <input type="submit" value="Leave Vacation Mode"> </form> <?php } else { ?> <h3>Vacation Mode Rules</h3> <ul> <li>Entering Vacation Mode will take 6 hours</li> <li>You <i>may</i> enter Vacation Mode during war</li> <li>You may not enter Vacation Mode if you currently have military out on an attack or if you have incoming acres</li> <li>Your ruler will still age, but your account will be protected during Vacation Mode</li> </ul> <form method="post" action="main.php?cat=game&page=preferences&task=pause_account"> <input type="hidden" name="do" value="yes"> <input type="submit" value="Enter vacation mode"> </form> <p>Vacation Mode runs for 48 hours minimum. If you cannot enter VM with your account due to circumstances beyond your control, you may message a staff member in Law & Order requesting your account being suspended and a valid reason why you can't pause it yourself.</p> <?php } } break; } echo '</div>'; }
function include_invade_text() { global $Host; $objSrcUser =& $GLOBALS["objSrcUser"]; $arrSrcStats = $objSrcUser->get_stats(); //========================================================================== // M: Verify Alliance & Tribe ID from GET or POST //========================================================================== $iTrgAid = $arrSrcStats[ALLIANCE]; if (isset($_GET['atkid'])) { $iTrgAid = intval($_GET['atkid']); } elseif (isset($_POST['iTrgAid'])) { $iTrgAid = intval($_POST['iTrgAid']); } if ($iTrgAid < 11) { $iTrgAid = rand(11, 100); } if (isset($_GET['tribe'])) { $_GET['tribe'] = intval($_GET['tribe']); } //========================================================================== // Stop people from avoiding the tribe page so they dont get updated //========================================================================== include_once 'inc/functions/update_ranking.php'; doUpdateRankings($objSrcUser); //========================================================================== // M: Links at top of page //========================================================================== echo $topLinks = '<div class="center">' . '<a href="main.php?cat=game&page=mystic">Mystics</a> | ' . '<a href="main.php?cat=game&page=thievery">Thievery</a> | ' . '<b>Invasion</b>' . '</div>'; //========================================================================== // M: Advisor Welcome Text //========================================================================== $advisorText = '<div id="textBig">' . '<p>' . '<img src="' . $Host . 'fighter.gif" style="float: left; margin-right: 10px;" alt="Fighter" />' . "<b>Your general</b> greets you: <br />" . "From this room we can order our military to attack other tribes. An " . "invasion is a way to expand your domains or take away someone " . "else's. Attacking someone is often considered an \"act of war\" as " . "no tribe appreciates losing their acres to the enemy, so be prepared " . "for retaliations!" . "</p>" . "<p>" . "The way your military fight depends on which strategy you're using. " . "There are several different ways to engage an enemy, either " . "to conquer acres of land or to inflict damage." . "</p>"; if ($arrSrcStats[RACE] == "Oleg Hai") { $advisorText .= "<p> And don't forget, only harpies that has been bought this month (update) will join any invasions.</p>"; } $advisorText .= "</div>"; echo $advisorText; //========================================================================== // M: Invasion Table //========================================================================== echo $strColumnDivs = '<div id="columns">' . '<!-- Start left column -->' . '<div id="leftcolumn">'; // Advisor Link echo $advisorLink = '<br />' . '<div class="tableLinkSmall">' . '<a href="main.php?cat=game&page=advisors&show=military">The General</a>' . '</div>'; $strInvasionTable = '<table width="40%" cellpadding="0" cellspacing="0" class="small">' . '<tr class="header">' . '<th colspan="2">' . "Invasion" . '</th>' . '</tr>' . '<tr class="subheader">' . '<th colspan="2" class="center">' . "Select Target" . '</th>' . '</tr>' . '<tr class="data">' . '<form action="main.php?cat=game&page=invade" method="post">' . '<input type="hidden" name="iTrgAid" value="' . $iTrgAid . '" />' . '<th>' . "Alliance:" . '</th>' . '<td>' . '<input maxlength="4" size="3" name="iTrgAid" value="' . $iTrgAid . '" />' . " " . '<input type="submit" value="Change" />' . '</td>' . '</form>' . '</tr>'; if ($iTrgAid != $arrSrcStats[ALLIANCE] && $iTrgAid > 10) { $strInvasionTable .= '<tr class="data">' . '<form action="main.php?cat=game&page=invade2" method="post">' . '<th>' . "Tribe:" . '</th>' . '<td>' . '<select size="1" name="TrgPlayer">' . '<option value="spacer">' . '</option>'; //====================================================================== // New version of Damadm00's code Martel, July 10, 2006 //====================================================================== include_once 'inc/classes/clsAlliance.php'; $objTrgAlliance = new clsAlliance($iTrgAid); $arrTrgIUsers = $objTrgAlliance->get_userids(); if (!empty($arrTrgIUsers)) { foreach ($arrTrgIUsers as $iUserId) { $objTmpUser = new clsUser($iUserId); $strTribe = stripslashes($objTmpUser->get_rankings_personal(TRIBE_NAME)); if (isset($_GET['tribe']) && $_GET['tribe'] == $iUserId) { $strInvasionTable .= sprintf('<option value="%d" selected>%s</option>', $iUserId, $strTribe); } elseif (!isset($_GET['tribe']) || isset($_GET['tribe']) && $_GET['tribe'] != $iUserId) { $strInvasionTable .= sprintf('<option value="%d">%s</option>', $iUserId, $strTribe); } elseif (isset($_GET['tribe'])) { echo "Trying to exploit bugs/loopholes will get you suspended!"; } } } $strInvasionTable .= '</select>' . '</td>' . '</tr>' . '<tr class="data">' . '<th>' . "Strategy:" . '</th>' . '<td>' . '<select size="1" name="invade_type">' . '<option value="' . ATTACK_STANDARD . '">' . "Standard Attack" . '</option>' . '<option value="' . ATTACK_RAID . '">' . "Raid" . '</option>' . '<option value="' . ATTACK_BARREN . '">' . "Barren Grab" . '</option>' . '<option value="' . ATTACK_HNR . '">' . "Hit 'n' Run" . '</option>' . '<option value="' . ATTACK_BC . '">' . "Blasphemy Crusade" . '</option>' . '</select>' . '</td>' . '</tr>'; } $strInvasionTable .= '</table>'; // M: Show Invasion Table echo $strInvasionTable; echo $strColumnDivs = '</div>' . '<!-- Start right column -->' . '<div id="rightcolumn">' . '<br /><br />'; if ($iTrgAid != $arrSrcStats[ALLIANCE] && $iTrgAid > 10) { $strPrepareTable = '<table cellpadding="0" cellspacing="0" class="small">' . '<tr class="header">' . '<th colspan="3">' . "Prepare Army" . '</th>' . '</tr>' . '<tr class="subheader">' . '<th>' . "Units" . '</th>' . '<th class="right">' . "Owned" . '</th>' . '<th class="right">' . "To Send" . '</th>' . '</tr>'; // M: Get All Units with an offence Value include_once 'inc/functions/races.php'; $arrUnitVars = getUnitVariables($arrSrcStats[RACE]); $arrUnitOffence = $arrUnitVars['offence']; $arrUnitDefence = $arrUnitVars['defence']; $arrUnitVar = $arrUnitVars['variables']; $arrUnitName = $arrUnitVars['output']; $arrArmyHome = $objSrcUser->get_armys_home(); foreach ($arrUnitOffence as $i => $iUnitOffence) { if ($iUnitOffence > 0) { // M: Military Unit Names Grammar $strPlural = 's'; if ($arrUnitName[$i] == 'Swordmen') { $strPlural = ''; } if ($arrUnitName[$i] == 'Pikemen') { $strPlural = ''; } if ($arrUnitName[$i] == 'Crossbowmen') { $strPlural = ''; } if ($arrUnitName[$i] == 'Longbowmen') { $strPlural = ''; } if ($arrUnitName[$i] == 'Thief') { $arrUnitName[$i] = 'Thieve'; } if ($arrUnitName[$i] == 'Priestess') { $strPlural = ''; } if ($arrUnitName[$i] == 'Mummy') { $arrUnitName[$i] = 'Mummie'; } // Oleg Hai Exception (Elites are Mercenaries) if ($arrSrcStats[RACE] == "Oleg Hai" && $i == 5) { $arrArmyHome[$i] = $objSrcUser->get_army_merc(MERC_T3); } $strPrepareTable .= '<tr class="data">' . '<th>' . sprintf('%s%s <span class="militstats">(%d/%d)</span>', $arrUnitName[$i], $strPlural, $arrUnitOffence[$i], $arrUnitDefence[$i]) . '</th>' . '<td>' . $arrArmyHome[$arrUnitVar[$i]] . '</td>' . '<td>' . '<input size="6" maxlength="7" name="arrArmySent[' . $arrUnitVar[$i] . ']" value="0" />' . '</td>' . "</tr>"; } } $strPrepareTable .= '</table>' . '<br />' . '<input type="hidden" name="iTrgAid" value="$iTrgAid" />' . '<div class="center"><input type="submit" value="Order army into battle" /></div>' . '</form>'; } // M: Show Prepare Table if (isset($strPrepareTable)) { echo $strPrepareTable; } echo $strColumnDivs = '</div>' . '</div><div class="clear"><hr /></div>'; }
function include_invade2_text() { global $ip; $objSrcUser =& $GLOBALS["objSrcUser"]; $arrSrcUser = $objSrcUser->get_user_infos(); $arrSrcStats = $objSrcUser->get_stats(); //========================================================================== // Secure user input from the invasion form //========================================================================== if (isset($_POST['TrgPlayer']) && !empty($_POST['TrgPlayer']) && $_POST['TrgPlayer'] != 'spacer') { // Selected Target $iTrgUserId = abs(intval($_POST['TrgPlayer'])); } else { echo $strDiv = '<div id="textMedium"><p>' . "Your army walk back to their homes, you should give them a " . "target next time!" . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . "Try Again ?" . "</a>" . '</p></div>'; include_game_down(); exit; } $arrWhite = array('1', '2', '3', '4', '5'); $arrWhite2 = array(1 => 'standard', 'raid', 'barren', 'hitnrun', 'bc'); // Selected Target if (isset($_POST['invade_type']) && in_array($_POST['invade_type'], $arrWhite)) { $iAttack = intval($_POST['invade_type']); } else { echo $strDiv = '<div id="textMedium"><p>' . "Your army walk back to their homes, you should give them a " . "target next time!" . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . "Try Again ?" . "</a>" . '</p></div>'; include_game_down(); exit; } // Army Sent $arrUnitVars = getUnitVariables($arrSrcStats[RACE]); $arrUnitOffence = $arrUnitVars['offence']; $arrUnitVar = $arrUnitVars['variables']; if (isset($_POST["arrArmySent"])) { $arrArmySent = $_POST["arrArmySent"]; foreach ($arrUnitOffence as $i => $iUnitOffence) { if ($iUnitOffence > 0) { $arrArmySent[$arrUnitVar[$i]] = max(0, intval($arrArmySent[$arrUnitVar[$i]])); } else { $arrArmySent[$arrUnitVar[$i]] = 0; } } } //========================================================================== // Verify attacker's status //========================================================================== obj_check_protection($objSrcUser, "invade"); $iTotalSentArmy = array_sum($arrArmySent); if ($iTotalSentArmy < 1) { echo $strDiv = '<div id="textMedium"><p>' . 'Sorry, but you did not send any units to battle.<br />' . 'This attack has been aborted.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . "Try Again ?" . "</a>" . '</p></div>'; include_game_down(); exit; } if (verifyArmyAvailable($objSrcUser, $arrArmySent) == 1) { echo $strDiv = '<div id="textMedium"><p>' . 'Sorry, you do not have that many units to send.<br />' . 'This attack has been aborted.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . "Try Again ?" . "</a>" . '</p></div>'; include_game_down(); exit; } if ($arrSrcStats[RACE] == "Oleg Hai" && verifyArmyAvailableOleg($objSrcUser, $arrArmySent) == 1) { $mercsTrainedThisHour = $objSrcUser->get_army_merc(MERC_T3); echo $strDiv = '<div id="textMedium"><p>' . "Sorry, but you did only train {$mercsTrainedThisHour} " . "mercs this update and that's the maximum you may use for an " . "attack.<br />" . "This attack has been aborted." . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . "Try Again ?" . "</a>" . '</p></div>'; include_game_down(); exit; } if ($arrSrcUser[NEXT_ATTACK] > 0) { echo $strDiv = '<div id="textMedium"><p>' . 'Sorry, but you cannot attack for at least ' . $arrSrcUser[NEXT_ATTACK] . ' more updates.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } if ($arrSrcUser[HOURS] < PROTECTION_HOURS) { echo $strDiv = '<div id="textMedium"><p>' . 'You are not allowed to attack while in protection!' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } //========================================================================== // Verify defender's status //========================================================================== include_once 'inc/functions/update.php'; check_to_update($iTrgUserId); $objTrgUser = new clsUser($iTrgUserId); $arrTrgStats = $objTrgUser->get_stats(); if ($arrTrgStats[ALLIANCE] == $objSrcUser->get_stat(ALLIANCE)) { echo $strDiv = '<div id="textMedium"><p>' . 'Sorry, honor before might. Do not attack into your own alliance.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } elseif ($objTrgUser->get_stat(ALLIANCE) < 11) { echo $strDiv = '<div id="textMedium"><p>' . 'I hope you did not think that you would get away with ' . 'attacking into a staff alliance, did you?' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } // Frost: Added a global protection mode include_once 'inc/classes/clsGame.php'; $objGame = new clsGame(); if ($objGame->get_game_switch(GLOBAL_PROTECTION) == 'on') { echo $strDiv = '<div id="textMedium"><p>' . 'Because of a global event all tribes in ORKFiA are under ' . 'protection. Please check the community forum for an announcement.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } $iTrgHours = $objTrgUser->get_user_info(HOURS); if ($iTrgHours < PROTECTION_HOURS) { $iTrgHoursRemaining = PROTECTION_HOURS - $iTrgHours; echo $strDiv = '<div id="textMedium"><p>' . 'It appears that the tribe you wish to target is still ' . 'materializing. Our general estimates that it will ' . 'take another ' . $iTrgHoursRemaining . ' updates for the area ' . 'to become a stable part of reality.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } if ($objTrgUser->get_stat(ALLIANCE) == 0) { echo $strDiv = '<div id="textMedium"><p>' . 'This player has either been deleted or suspended.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } // Frost: added jan -04 // Martel: updated July 08, 2006 if ($objTrgUser->get_stat(KILLED) == 1 || $objTrgUser->get_stat(RESET_OPTION) == 'yes') { echo $strDiv = '<div id="textMedium"><p>' . 'This tribe is dead.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } // Paused account Martel, July 13, 2006 if ($objTrgUser->isPaused()) { echo $strDiv = '<div id="textMedium"><p>' . 'This tribe is paused.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Return' . '</a>' . '</p></div>'; return; } // Blocking system - AI 11/02/2007 if (!clsBlock::isOpAllowed($objSrcUser, $objTrgUser)) { echo '<div id="textMedium"><p>' . 'Someone else from the same IP has already opped this tribe during the last 8 hours.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">Return</a>' . '</p></div>'; clsBlock::reportOp($objSrcUser, $objTrgUser, 'Attack: ' . $arrWhite2[$iAttack], false); return; } $iTrgLand = $objTrgUser->get_build(LAND); $iSrcLand = $objSrcUser->get_build(LAND); $breakoff = round($iSrcLand * 0.7); // Barren attack has 70% bottom feed limit if smaller than 2000 acres if ($iAttack == ATTACK_BARREN && $iTrgLand <= $breakoff && $iTrgLand < 2000) { echo $strDiv = '<div id="textMedium"><p>' . 'Sorry but you can not bash the small ones. Barren grabs are not ' . 'allowed against smaller tribes unless they are within 70% ' . 'of your own size.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } if ($iAttack == ATTACK_HNR && $iTrgLand < $iSrcLand) { echo $strDiv = '<div id="textMedium"><p>' . 'What kind of coward are you who try to make a Hit \'n\' Run ' . 'attack against a smaller tribe?' . '</p><p>' . 'Shame on you!' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Return' . '</a>' . '</p></div>'; include_game_down(); exit; } $quick_check = mysql_query("Select * from user where id = 1"); $quick_check = mysql_fetch_array($quick_check); if ($quick_check[STOPGAMETRIGGER] == 99) { echo $strDiv = '<div id="textMedium"><p>' . 'The game has been paused by staff, possibly due to technical ' . 'maintenance. Please look in the announcements ' . 'forum or the admin game message for more information.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Return' . '</a>' . '</p></div>'; include_game_down(); exit; } else { //====================================================================== // Do Battle //====================================================================== /* include the code for the attack about to be done */ include_once "inc/attacks/" . $arrWhite2[$iAttack] . ".php"; // Damadm00 19-03-2004, check here the result from the viking check // Martel: Notify thieves about attack only if not viking+25% luck if ($arrSrcStats[RACE] == 'Viking' && getVikingCheck() == 1) { $viking = 1; } else { $viking = 0; getMonitoringCheck($objSrcUser); } include_once 'inc/functions/military.php'; $defence = getArmyDefence($objTrgUser, $iAttack); $defence = $defence['total_home']; $offence = getSentOffence($objSrcUser, $arrArmySent); //Attacking Templars kills mystics, not thieves - AI $thieves = 'thieves'; if ($objTrgUser->get_stat(RACE) == 'Templar') { $thieves = 'mystics'; } // Eagle 30% auto force retreat feature if ($objTrgUser->get_stat(RACE) == "Eagle" && getEagleCheck() == 1) { doRetreat($objSrcUser, $objTrgUser, $arrArmySent, 1, 0); return; } elseif ($offence < $defence && $iAttack != ATTACK_HNR) { doRetreat($objSrcUser, $objTrgUser, $arrArmySent, 0, $viking); return; } elseif ($offence < $defence && $iAttack == ATTACK_HNR) { if ($offence > 0.5 * $defence) { if ($defence == 0) { $defence = 1; } $arrSrcArmyLost = getSrcLosses($objSrcUser, $arrArmySent, $offence / $defence, $arrWhite2[$iAttack]); $arrTrgArmyLost = getTrgLosses($objTrgUser, $objSrcUser, $offence / $defence, $arrWhite2[$iAttack]); $arrReport = doAttack($objSrcUser, $objTrgUser, $arrArmySent); } else { doRetreat($objSrcUser, $objTrgUser, $arrArmySent, 0, $viking); return; } } else { if ($defence == 0) { $defence = 1; } $arrSrcArmyLost = getSrcLosses($objSrcUser, $arrArmySent, $offence / $defence, $arrWhite2[$iAttack]); $arrTrgArmyLost = getTrgLosses($objTrgUser, $objSrcUser, $offence / $defence, $arrWhite2[$iAttack]); $arrReport = doAttack($objSrcUser, $objTrgUser, $arrArmySent); } // Spread Pestilence $arrSpreadPest = checkPestilence($objSrcUser, $objTrgUser); $pestSrc = $arrSpreadPest['attacker']; $pestTrg = $arrSpreadPest['defender']; //====================================================================== // Begin creating the invade report //====================================================================== $strTribe = stripslashes($objTrgUser->get_rankings_personal(TRIBE_NAME)); $iAlliance = $arrTrgStats[ALLIANCE]; $strReport = '<div id="textMedium">' . '<h2>' . "Invade Report" . '</h2>' . '<p>' . 'Your invasion of <strong>' . $strTribe . ' (#' . $iAlliance . ')</strong> was successful, ' . 'below follows a report from your general.' . '</p>'; //====================================================================== // Report: Gains //====================================================================== // Acres if (isset($arrReport['gained_acres']) && $arrReport['gained_acres'] != 0) { $strReport .= '<p>' . "Our army has gained control over " . "<strong>" . $arrReport['gained_acres'] . " acres</strong>. "; // Explored Acres if (isset($arrReport['explored_acres']) && $arrReport['explored_acres'] != 0) { $strReport .= "Also <strong>" . $arrReport['explored_acres'] . " acres</strong> was " . "explored and can be used to build on now."; } $strReport .= '</p>'; } // Citizens Killed (raid or hnr) if (isset($arrReport['killed_citizens']) && $arrReport['killed_citizens'] != 0) { $strReport .= '<p>' . "Our army storm into their lands, killing <strong>" . $arrReport['killed_citizens'] . "</strong> of their citizens." . '</p>'; } // Money (raid) if (isset($arrReport['gained_crowns']) && $arrReport['gained_crowns'] != 0) { $strReport .= '<p>' . "The army report having stolen <strong class=\"indicator\">" . number_format($arrReport['gained_crowns']) . " crowns</strong>." . '</p>'; } // Buildings Razed (blasphemy crusade) if (isset($arrReport['damaged_total']) && $arrReport['damaged_total'] != 0) { $strReport .= '<p>' . "Your loyal army charges into their lands, destroying <strong>" . $arrReport['damaged_total'] . " buildings</strong> of witchcraft " . "and deception. ("; // Academies if (isset($arrReport['damaged_academies']) && $arrReport['damaged_academies'] != 0) { $strReport .= " <strong>" . $arrReport['damaged_academies'] . " academies</strong>"; } // Guilds if (isset($arrReport['damaged_guilds']) && $arrReport['damaged_guilds'] != 0) { $strReport .= " <strong>" . $arrReport['damaged_guilds'] . " guilds</strong>"; } // Hideouts if (isset($arrReport['damaged_hideouts']) && $arrReport['damaged_hideouts'] != 0) { $strReport .= " <strong>" . $arrReport['damaged_hideouts'] . " hideouts</strong>"; } $strReport .= ').</p>'; } // Thieves Killed (blasphemy crusade) if (isset($arrReport['killed_thieves']) && $arrReport['killed_thieves'] != 0) { $strReport .= '<p>' . "Your general reports having killed <strong>" . $arrReport['killed_thieves'] . " {$thieves} of the enemy</strong>." . '</p>'; } // Fame Gained if (isset($arrReport['gained_fame']) && $arrReport['gained_fame'] != 0) { $strReport .= '<p>' . "This invasion gave our tribe <strong class=\"positive\">" . $arrReport['gained_fame'] . " fame</strong>." . '</p>'; } //====================================================================== // Begin enemy defence estimation (report) //====================================================================== if ($offence > $defence * 2) { $strReport .= '<p>' . "Our army is more than double the power of the " . "defending army, causing the enemy to run in fear. (Victory " . "by more than 100%)" . '</p>'; } elseif ($offence > $defence * 1.8) { $strReport .= '<p>' . "Our army is almost double the power of the defending " . "army. (Victory by more than 80%)" . '</p>'; } elseif ($offence > $defence * 1.6) { $strReport .= '<p>' . "Our army has easily broken the enemies defences, " . "overpowering them by more than 3 to 2. (Victory by more " . "than 60%)" . '</p>'; } elseif ($offence > $defence * 1.4) { $strReport .= '<p>' . "Our army has broken the enemies defences, overpowering " . "them by around 3 to 2. (Victory by more than 40%)" . '</p>'; } elseif ($offence > $defence * 1.2) { $strReport .= '<p>' . "Our army has broken through the line of defence, but it was " . "a hard battle. (Victory by more than 20%)" . '</p>'; } elseif ($offence > $defence * 1.1) { $strReport .= '<p>' . "Our army has broken through the line of defence, but it was " . "a very tough battle. (Victory by more than 10%)" . '</p>'; } elseif ($offence >= $defence) { $strReport .= '<p>' . "Our army fought hard, winning only after a lengthy and very " . "difficult battle. (Victory by less than 10%)" . '</p>'; } //====================================================================== // Report: Army Losses //====================================================================== $arrUnitVars = getUnitVariables($objSrcUser->get_stat(RACE)); $arrUnitNames = $arrUnitVars['output']; $strPlural = 's'; $strReport .= '<p>' . "The captains report that we have lost "; if ($arrSrcArmyLost[UNIT1] > 0) { $strReport .= $arrSrcArmyLost[UNIT1] . " " . $arrUnitNames[2] . $strPlural . ", "; } if ($arrSrcArmyLost[UNIT2] > 0) { if ($arrUnitNames[3] == 'Swordmen') { $strPlural = ''; } elseif ($arrUnitNames[3] == 'Pikemen') { $strPlural = ''; } $strReport .= $arrSrcArmyLost[UNIT2] . " " . $arrUnitNames[3] . $strPlural . ", "; } if ($arrSrcArmyLost[UNIT3] > 0) { if ($arrUnitNames[4] == 'Crossbowmen') { $strPlural = ''; } elseif ($arrUnitNames[4] == 'Longbowmen') { $strPlural = ''; } elseif ($arrUnitNames[4] == 'Mummy') { $arrUnitNames[4] = 'Mummie'; } $strReport .= $arrSrcArmyLost[UNIT3] . " " . $arrUnitNames[4] . $strPlural . ", "; } if ($arrSrcArmyLost[UNIT4] > 0) { if ($arrUnitNames[5] == 'Priestess') { $strPlural = ''; } $strReport .= $arrSrcArmyLost[UNIT4] . " " . $arrUnitNames[5] . $strPlural . ", "; } if ($arrSrcArmyLost[UNIT5] > 0) { if ($arrUnitNames[6] == 'Thief') { $arrUnitNames[6] = 'Thieve'; } $strReport .= $arrSrcArmyLost[UNIT5] . " " . $arrUnitNames[6] . $strPlural . ", "; } if (array_sum($arrSrcArmyLost) < 1) { $strReport .= " no military at all, "; } $totalkilled = round(array_sum($arrTrgArmyLost), -2); if ($totalkilled > 0) { $strReport .= " and they estimate the enemy's losses to be {$totalkilled} units"; if ($objSrcUser->get_stat(RACE) == "Undead") { $strReport .= ", who joined our cursed army as soldiers."; } } else { $strReport .= " and they estimate the enemy's losses to be near zero"; } $strReport .= '.</p>'; //====================================================================== // Report: Army available again //====================================================================== $wait = $objSrcUser->get_user_info(NEXT_ATTACK); $strReport .= '<p>' . "Our generals report our army will be able to attack again " . "in " . $wait . " updates. "; if ($wait > 4) { // Assuming that an attack with more than 4 hours is a BC or Hitnrun $wait -= 2; $strReport .= "However, our army will be home to defend our lands after " . $wait . " updates."; } $strReport .= '</p>'; //====================================================================== // Report: Pestilence //====================================================================== if ($pestSrc == "yes") { $strReport .= '<p>' . "<strong class=\"negative\">During your invasion your military " . "got infected with pestilence.</strong>" . '</p>'; } //====================================================================== // frost: added suicide detection | modified for age 18. only one update // loss of 25% citizens //====================================================================== $suicide = getSuicideCheck($objSrcUser, $arrArmySent); if ($arrSrcStats[RACE] != "Raven" && $suicide == 1) { $citz = $objSrcUser->get_pop(CITIZENS); $leavingCitz = floor($citz * 0.25); $strReport .= '<p>' . "<strong class=\"negative\">Your citizens are getting tired of " . "their tax money going to far-away military campaigns " . "instead of defending their homes. " . number_format($leavingCitz) . " citizens have left your lands.</strong>" . '</p>'; $objSrcUser->set_pop(CITIZENS, $citz - $leavingCitz); } //====================================================================== // Report: Viking Stealth Attack //====================================================================== if ($viking == 1) { $strReport .= '<p>' . "<strong class=\"positive\">You got lucky. Your location " . "doesn't end up in the news.</strong>" . '</p>'; } //====================================================================== // Report: War effects //====================================================================== require_once 'inc/functions/war.php'; $objSrcAlliance = $objSrcUser->get_alliance(); if (checkWarBetween($objSrcAlliance, $objTrgUser->get_stat(ALLIANCE))) { $objTrgAlliance = $objTrgUser->get_alliance(); if ($arrGains = testWarVictory($objSrcAlliance, $objTrgAlliance)) { // Append war-win message require_once 'inc/pages/war_room2.inc.php'; $strReport .= '<p><strong class="positive">Your alliance has won the war!</strong></p>' . getVictoryReport($arrGains); } } $strReport .= '<p>' . '<a href="main.php?cat=game&page=tribe">Continue</a>' . '</p>' . '</div>'; echo $strReport; //====================================================================== // Defender tribe news (damage report) //====================================================================== $srcDisplay = $arrSrcStats[TRIBE] . " (#" . $arrSrcStats[ALLIANCE] . ")"; $trgDisplay = $arrTrgStats[TRIBE] . " (#" . $arrTrgStats[ALLIANCE] . ")"; $strStrategy = $arrWhite2[$iAttack]; switch ($strStrategy) { case "standard": if ($viking == 0) { $strTrgTribe = "<span class=\"positive\">{$srcDisplay} has successfully marched into our lands and conquered " . $arrReport['gained_acres'] . " acres</span>"; $strTrgAlliance = "<span class=\"newsattack\">{$srcDisplay} has successfully marched into the lands of {$trgDisplay} and conquered " . $arrReport['gained_acres'] . " acres</span>"; } else { $strTrgTribe = "<span class=\"positive\">An unidentified tribe of vikings has successfully marched into our lands and conquered " . $arrReport['gained_acres'] . " acres</span>"; $strTrgAlliance = "<span class=\"newsattack\">An unidentified tribe of vikings has successfully marched into the lands of {$trgDisplay} and conquered " . $arrReport['gained_acres'] . " acres</span>"; } break; case "raid": if ($viking == 0) { $strTrgTribe = "<span class=\"positive\">{$srcDisplay} has successfully stormed into our lands and conquered " . $arrReport['gained_acres'] . " acres, stolen " . $arrReport['gained_crowns'] . " crowns and slaughtered " . $arrReport['killed_citizens'] . " citizens</span>"; $strTrgAlliance = "<span class=\"newsattack\">{$srcDisplay} has successfully stormed into the lands of {$trgDisplay} and conquered " . $arrReport['gained_acres'] . " acres, stolen " . $arrReport['gained_crowns'] . " crowns and slaughtered " . $arrReport['killed_citizens'] . " citizens</span>"; } else { $strTrgTribe = "<span class=\"positive\">An unidentified tribe of vikings has successfully stormed into our lands and conquered " . $arrReport['gained_acres'] . " acres, stolen " . $arrReport['gained_crowns'] . " crowns and slaughtered " . $arrReport['killed_citizens'] . " citizens</span>"; $strTrgAlliance = "<span class=\"newsattack\">An unidentified tribe of vikings has Successfully stormed into the lands of {$trgDisplay} and conquered " . $arrReport['gained_acres'] . " acres, stolen " . $arrReport['gained_crowns'] . " crowns and slaughtered " . $arrReport['killed_citizens'] . " citizens</span>"; } break; case "barren": if ($viking == 0) { $strTrgTribe = "<span class=\"newsattack\">{$srcDisplay} has successfully sneaked into our lands and claimed " . $arrReport['gained_acres'] . " acres</span>"; $strTrgAlliance = "<span class=\"newsattack\">{$srcDisplay} has successfully sneaked into the lands of {$trgDisplay} and claimed " . $arrReport['gained_acres'] . " acres</span>"; } else { $strTrgTribe = "<span class=\"newsattack\">An unidentified tribe of vikings has successfully sneaked into our lands and claimed " . $arrReport['gained_acres'] . " acres</span>"; $strTrgAlliance = "<span class=\"newsattack\">An unidentified tribe of vikings has successfully sneaked into the lands of {$trgDisplay} and claimed " . $arrReport['gained_acres'] . " acres</span>"; } break; case "bc": if ($viking == 0) { $strTrgTribe = "<span class=\"newsbc\">{$srcDisplay} has successfully charged into our lands and destroyed " . $arrReport['damaged_total'] . " buildings and killed " . $arrReport['killed_thieves'] . " {$thieves}. Our lands will be avaliable for building again after they have been cleared</span>"; $strTrgAlliance = "<span class=\"newsbc\">{$srcDisplay} has successfully charged into the lands of {$trgDisplay} and destroyed " . $arrReport['damaged_total'] . " buildings and slaughtered " . $arrReport['killed_thieves'] . " {$thieves}</span>"; } else { $strTrgTribe = "<span class=\"newsbc\">An unidentified tribe of vikings has successfully charged into our lands and destroyed " . $arrReport['damaged_total'] . " buildings and killed " . $arrReport['killed_thieves'] . " {$thieves}. Our lands will be avaliable for building again after they have been cleared</span>"; $strTrgAlliance = "<span class=\"newsbc\">An unidentified tribe of vikings has successfully charged into the lands of {$trgDisplay} and destroyed " . $arrReport['damaged_total'] . " buildings and killed " . $arrReport['killed_thieves'] . " {$thieves}</span>"; } break; case "hitnrun": $strAdd = ""; if ($offence >= $defence) { $strAdd = " and " . $arrReport['killed_citizens'] . " citizens"; } if ($viking == 0) { $strTrgTribe = "<span class=\"newsattack\">{$srcDisplay} has cowardly ambushed our lands, killing many troops" . $strAdd . "</span>"; $strTrgAlliance = "<span class=\"newsattack\">{$srcDisplay} has cowardly attacked and rained arrows over {$trgDisplay}, killing many troops" . $strAdd . "</span>"; } else { $strTrgTribe = "<span class=\"newsattack\">An unidentified tribe of vikings has cowardly ambushed our lands, killing many troops" . $strAdd . "</span></span>"; $strTrgAlliance = "<span class=\"newsattack\">An unidentified tribe of vikings has cowardly attacked and rained arrows over {$trgDisplay}, killing many troops" . $strAdd . "</span>"; } break; } $trgId = $objTrgUser->get_userid(); $srcId = $objSrcUser->get_userid(); $trgKd = $objTrgUser->get_stat(ALLIANCE); $srcKd = $objSrcUser->get_stat(ALLIANCE); if ($viking == 0) { $result = "INSERT INTO `news` VALUES ('', NOW(), '{$ip}', '{$strStrategy}', '{$trgId}', '{$srcId}', '1', " . quote_smart($strTrgTribe) . ", " . quote_smart($strTrgAlliance) . ",'{$trgKd}','{$srcKd}',1)"; } else { $result = "INSERT INTO `news` VALUES ('', NOW(), '{$ip}', '{$strStrategy}', '{$trgId}', '{$srcId}', '1', " . quote_smart($strTrgTribe) . ", " . quote_smart($strTrgAlliance) . ",'{$trgKd}',0,1)"; } mysql_query($result); $arrUnitVars = getUnitVariables($objTrgUser->get_stat(RACE)); $arrUnitNames = $arrUnitVars['output']; $strPlural = 's'; $strPlural2 = 's'; $strPlural3 = 's'; $strPlural4 = 's'; $strPlural5 = 's'; if ($arrUnitNames[3] == 'Swordmen') { $strPlural2 = ''; } elseif ($arrUnitNames[3] == 'Pikemen') { $strPlural2 = ''; } if ($arrUnitNames[4] == 'Crossbowmen') { $strPlural3 = ''; } elseif ($arrUnitNames[4] == 'Longbowmen') { $strPlural3 = ''; } elseif ($arrUnitNames[4] == 'Mummy') { $arrUnitNames[4] = 'Mummie'; } if ($arrUnitNames[5] == 'Priestess') { $strPlural4 = 'es'; } if ($arrUnitNames[6] == 'Thief') { $arrUnitNames[6] = 'Thieve'; } $strTrgNews = "A report has been collected, our losses are listed as follows: " . "<br />" . $arrUnitNames[2] . $strPlural . " killed: " . "<span class=\"negative\">" . $arrTrgArmyLost[UNIT1] . "</span>," . "<br />" . $arrUnitNames[3] . $strPlural2 . " killed: " . "<span class=\"negative\">" . $arrTrgArmyLost[UNIT2] . "</span>," . "<br />" . $arrUnitNames[4] . $strPlural3 . " killed: " . "<span class=\"negative\">" . $arrTrgArmyLost[UNIT3] . "</span>," . "<br />" . $arrUnitNames[5] . $strPlural4 . " killed: " . "<span class=\"negative\">" . $arrTrgArmyLost[UNIT4] . "</span>."; //Add mystic losses for templars - AI 24/04/2007 if ($arrTrgArmyLost[UNIT5] > 0) { $strTrgNews .= "<br />" . $arrUnitNames[6] . $strPlural5 . " killed: " . "<span class=\"negative\">" . $arrTrgArmyLost[UNIT5] . "</span>."; } if ($pestTrg == "yes") { $strTrgNews .= "<br />" . "<strong class=\"negative\">" . "During this invasion pestilence " . "was spread into our lands for 12 updates" . "</strong>."; } // create tribe news for attack mysql_query("INSERT INTO `news` (`id`, `time`, `ip`, `type`, `duser`, `ouser`, `result`, `text`, `kingdom_text`) VALUES ('', NOW(), '{$ip}', 'invade report', '{$arrTrgStats['id']}', '{$arrSrcStats['id']}', 1, '{$strTrgNews}', '')"); $orkTime = date(TIMESTAMP_FORMAT); $objTrgUser->set_user_info(LAST_NEWS, $orkTime); // Update target rankings include_once 'inc/functions/update_ranking.php'; doUpdateRankings($objTrgUser, 'yes'); // Log the op for blocking system - AI 11/02/2007 clsBlock::logOp($objSrcUser, $objTrgUser, 'Attack: ' . $arrWhite2[$iAttack]); } }
function include_build_text() { global $Host, $build_cost, $local_goods, $max_build, $local_build, $wood_cost, $output_building_percent, $building_percent, $buildings_due, $current, $sub_current1, $sub_current2, $sub_current3, $userid, $local_pop; $objSrcUser = &$GLOBALS["objSrcUser"]; include_once('inc/functions/build.php'); // mysql_grab($userid, 'local', 'goods', 'build', 'pop'); 1 1 down... $local_goods = $objSrcUser->get_goods(); $local_build = $objSrcUser->get_builds(); $local_pop = $objSrcUser->get_pops(); build_cost(); building_names(); general_build(); // New object oriented code $arrBuildingVariables = getBuildingVariables($objSrcUser->get_stat(RACE)); $arrBuildVar = $arrBuildingVariables['variables']; $arrBuildOutput = $arrBuildingVariables['output']; $arrBuildTooltip = $arrBuildingVariables['tooltips']; $iBuildings = count($arrBuildVar); $iBarren = $objSrcUser->get_barren(); //========================================================================== // Stop people from avoiding the tribe page so they dont get updated //========================================================================== include_once('inc/functions/update_ranking.php'); doUpdateRankings($objSrcUser); $arrSrcStats = $objSrcUser->get_stats(); $arrBuild = $objSrcUser->get_builds(); echo $topLinks = '<div class="center">' . '<b>Construction</b> | ' . '<a href="main.php?cat=game&page=army">Military Training</a> | ' . '<a href="main.php?cat=game&page=explore">Exploration</a>' . '</div>'; $advisorText = '<div id="textBig">' . '<p>' . "<b>Your tribe architect</b> greets you: <br />" . "To let your civilization grow and prosper, you must build your land. " . "How you build your land is completely up to you, " . "but some buildings are necessary for your people to survive." . "</p>" . "<p>" . "It will cost you <b>" . number_format($build_cost) . " crowns</b>" . " and <b>" . number_format($wood_cost) . " logs</b> to build on " . "<b>1 barren acre</b>." . '</p>' . '<p align="center">' . "You have <b><span class=\"indicator\">$iBarren</span> barren " . "acre(s)</b> and you can afford to " . "build on <b class=\"indicator\">$max_build</b>" . " of them." . "</p>" . "</div>"; echo $advisorText; $advisorLinks = '<br />' . '<div class="tableLinkBig">' . '<a href="main.php?cat=game&page=advisors&show=build">Tribe Architect</a>' . ' :: ' . '<a href="main.php?cat=game&page=raze_build">Demolish Buildings</a>' . '</div>'; echo $advisorLinks; $buildTable = '<form id="center" action="main.php?cat=game&page=build2" method="post" style="margin-top: 0pt;">' . '<table class="big" cellpadding="0" cellspacing="0">' . '<tr class="header">' . '<th colspan="9">' .'Order Construction' . '</th>' . '</tr>' . '<tr class="subheader">' . '<th>' . 'Type' . '</th>' . '<th class="right">' . 'Owned' . '</th>' . '<th class="right">' . '%' . '</th>' . '<th class="right">' . 'Build' . '</th>' . '<th class="right">' . ' ' . '</th>' . '<th>' . 'Type' . '</th>' . '<th class="right">' . 'Owned' . '</th>' . '<th class="right">' . '%' . '</th>' . '<th class="right">' . 'Build' . '</th>' . '</tr>'; for ($i = 1; $i <= $iBuildings; $i++) { $current = $arrBuildVar[$i]; $i2 = $i + 1; $current2 = $arrBuildVar[$i2]; $buildTable .= '<tr class="data">' . '<th width="20%"><label for="' . $i . '" title="' . $arrBuildTooltip[$i] . '">' . $arrBuildOutput[$i] . '</label></th>' . '<td width="12%">'; if ($buildings_due[$arrBuildVar[$i]] > 0) { $buildTable .= '<span style="font-size: 0.8em;">(' . $buildings_due[$arrBuildVar[$i]] . ')</span>'; } $buildTable .= ' <strong>' . $local_build[$current] . '</strong></td>' . '<td width="7%">' . getBuildInPercent($objSrcUser, $local_build[$current], 'yes') . "</td>" . "<td width=\"7%\"><input id=\"$i\" size=\"3\" maxlength=\"4\" name=\"built[$current]\" /></td>" . "<td> </td>" . '<th width=\"20%\"><label for="' . $i2 . '" title="' . $arrBuildTooltip[$i2] . '">' . $arrBuildOutput[$i2] . '</label></th>' . "<td width=\"12%\" class=\"right\">"; if ($buildings_due[$arrBuildVar[$i2]] > 0) { $buildTable .= '<span style="font-size: 0.8em;">(' . $buildings_due[$arrBuildVar[$i2]] . ")</span>"; } $buildTable .= "<strong> $local_build[$current2]</strong>" . "</td>" . "<td width=\"7%\" class=\"right\">" . getBuildInPercent($objSrcUser, $local_build[$current2], 'yes') . "</td>" . "<td width=\"7%\" class=\"right\">" . "<input id=\"$i2\" size=\"3\" maxlength=\"4\" name=\"built[$current2]\" />" . "</td>" . "</tr>"; $i++; } $buildTable .= "</table>"; echo $buildTable; ?> <span style="font-size: 0.8em;">Total <b><?=$local_build[LAND]; ?></b> acres.</span> <br /><br /> <input type="submit" value="Order Construction" /> </form> <? }