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_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_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>'; } }