function get_rank_data($alliance_id) { $arrRanking[LAND] = get_alli_ranking(LAND, $alliance_id); $arrRanking[STRENGTH] = get_alli_ranking(STRENGTH, $alliance_id); $arrRanking[FAME] = get_alli_ranking(FAME, $alliance_id); //========================================================================== // Martel, July 25, 2006 // If this alliance is #1 we check if we should update the annual ranks //========================================================================== if ($arrRanking[LAND] == 1) { include_once 'inc/classes/clsGame.php'; $objGame = new clsGame(); // Get Game Year & Most Recent Year Saved $iOrkYears = $objGame->get_year_oe(); $iLastYear = $objGame->get_year_history(); if ($iOrkYears != $iLastYear) { include_once 'inc/classes/clsAlliance.php'; $objTmpAlliance = new clsAlliance($alliance_id); $arrTmpRankings = $objTmpAlliance->get_rankings_alliances(); $strAlliName = $arrTmpRankings[ALLI_NAME]; $strAlliDesc = $arrTmpRankings[ALLI_DESC]; $arrNewHistory = array(YEAR => $iOrkYears, LAND => $arrTmpRankings[LAND], RANK_FAME => $arrRanking[FAME], RANK_STRENGTH => $arrRanking[STRENGTH], ALLI_ID => $arrTmpRankings[ID], ALLI_NAME => "'{$strAlliName}'", ALLI_DESC => "'{$strAlliDesc}'", LAST_UPDATE => date(TIMESTAMP_FORMAT, time())); $objGame->set_historys($arrNewHistory); } } //========================================================================== return $arrRanking; }
function showAllianceNews($iAlliance) { require_once 'inc/classes/clsAlliance.php'; $objAlli = new clsAlliance($iAlliance); $arrAlli = $objAlli->get_alliance_infos(); $timestamp2 = date('D d M, H:i:s'); $show_time = date(TIMESTAMP_FORMAT, strtotime('-3 days')); $strTableRow = ''; $query = "SELECT time, kingdoma, kingdomb, kingdom_text, type " . "FROM news WHERE " . "(kingdoma = '{$iAlliance}' " . "OR kingdomb = '{$iAlliance}') " . "AND time > '{$show_time}' " . "ORDER BY time DESC"; $result = mysql_query($query) or die("Error retrieving alliances news"); $number = mysql_num_rows($result); if ($number == 0) { $strTableRow .= "<tr class=\"message\">" . "<th>" . " " . "</th>" . "<td>" . "There are no new items of interest, which is a good thing =)" . "</td>" . "</tr>"; } else { $arrTypes = array('raid', 'barren', 'standard', 'hitnrun', 'bc', 'retreat', 'invade'); while ($newsloop = mysql_fetch_array($result)) { if ($newsloop['kingdoma'] == $iAlliance && in_array($newsloop['type'], $arrTypes)) { $newsloop['kingdom_text'] = '<span class="negative">»« </span>' . $newsloop['kingdom_text']; } elseif ($newsloop['kingdomb'] == $iAlliance && in_array($newsloop['type'], $arrTypes)) { $newsloop['kingdom_text'] = '<span class="positive">«» </span>' . $newsloop['kingdom_text']; } $strTableRow .= "<tr class=\"data\">" . "<td class=\"left\">" . $newsloop['time'] . "</td>" . "<td class=\"left\">" . stripslashes($newsloop['kingdom_text']) . "</td>" . "</tr>"; } } $strTable = "<table cellspacing=\"0\" cellpadding=\"0\" class=\"big\">" . "<tr class=\"header\">" . "<th colspan=\"3\">Alliance News - " . stripslashes($arrAlli['name']) . " (#" . $arrAlli['id'] . ")</th>" . "</tr>" . "<tr class=\"subheader\">" . "<th width=\"12%\">" . "Time" . "</th>" . "<th>" . "News Item" . "</th>" . "</tr>" . $strTableRow . "</table>" . '<div class="center" style="font-size: 0.8em;">' . "Server Time: " . $timestamp2 . '</div>'; return $strTable; }
function getSciences($iAllianceId) { require_once 'inc/classes/clsAlliance.php'; $objAlli = new clsAlliance($iAllianceId); return $objAlli->get_alliance_sciences(); }
function unset_external_votes($iAlliance) { include_once('inc/classes/clsAlliance.php'); $objAlliance = new clsAlliance($iAlliance); $arrUserids = $objAlliance->get_userids(); // Unset votes for tribes that are no longer in the alliance foreach ($arrUserids as $iUserid) { $objTempUser = new clsUser($iUserid); if (! in_array($objTempUser->get_stat(VOTE), $arrUserids)) $objTempUser->set_stat(VOTE, 0); } }
function include_tribe_text() { include_once 'inc/functions/tribe.php'; require_once 'inc/classes/clsGame.php'; $objGame = new clsGame(); $strSwitch = $objGame->get_game_switch('update_button'); $objSrcUser =& $GLOBALS['objSrcUser']; $arrSrcStats = $objSrcUser->get_stats(); $arrSrcUsers = $objSrcUser->get_user_infos(); $objSrcAlli = $objSrcUser->get_alliance(); //========================================================================== // Elder Message //========================================================================== if (isset($objSrcAlli) && !empty($objSrcAlli)) { echo get_eldermessage_text($objSrcAlli); } //========================================================================== // Free update button // 1st case, change for classic oop testing ## 2nd case: devork 1008 updates //========================================================================== if ($strSwitch == ON && $_SERVER['SERVER_NAME'] == DINAH_SERVER_NAME) { $iHours = $arrSrcUsers[HOURS]; if (isset($_POST['update']) && $iHours >= 0 && $iHours < PROTECTION_HOURS) { require_once 'inc/functions/update_script.php'; generate_updates($objSrcUser, 1); $iHours++; } if ($iHours >= 0 && $iHours < PROTECTION_HOURS) { echo '<form id="center" action="main.php?cat=game&page=tribe" method="post">' . '<input type="submit" name="update" value="Update Me" />' . '</form>'; } } elseif ($strSwitch == ON && $_SERVER['SERVER_NAME'] == DEV_SERVER_NAME) { $iHours = $arrSrcUsers[HOURS]; if (isset($_POST['update']) && $iHours >= 0 && $iHours < 1008) { require_once 'inc/functions/update_script.php'; generate_updates($objSrcUser, 1); $iHours++; } if ($iHours >= 0 && $iHours < 1008) { echo '<form id="center" action="main.php?cat=game&page=tribe" method="post">' . '<input type="submit" name="update" value="Update Me" />' . '</form>'; } } //========================================================================== // Show Self Vision //========================================================================== // Link to Tribe News $dtLastNews = $arrSrcUsers[LAST_NEWS]; $strNewsLink = '<br /><a href="main.php?cat=game&page=news"'; if ($dtLastNews == 0) { $strNewsLink .= '>Tribe News</a>'; } else { $strNewsLink .= ' class = "check_new">Our Tribe Has News!</a>'; } echo '<div class="tableLinkMedium">' . $strNewsLink . ' | ' . '<a href="main.php?cat=game&page=advisors">Internal Affairs</a>' . '</div>'; echo get_tribe_table($objSrcUser); //========================================================================== // Area with text below tribe table //========================================================================== $strText = '<div id="textMedium" style="clear: both;">' . '<h2>' . 'Your head advisor greets you:' . '</h2>'; // Check First 3 Logins prior to verification $strVerificationCode = $objSrcUser->get_preference(EMAIL_ACTIVATION); if ($arrSrcUsers[LOGINS] < 3 && $strVerificationCode != 'verified') { if ($arrSrcUsers[LOGINS] == 1) { $strText .= '<p>Welcome to ORKFiA! You may login once more before you need to <a href="main.php?cat=game&page=verify">verify your email address</a>.</p>'; } elseif ($arrSrcUsers[LOGINS] == 2) { $strText .= '<p>Welcome to ORKFiA! Next time you login you will need to <a href="main.php?cat=game&page=verify">verify your email address</a>.</p>'; } } // Check Protection Hours Remaining $strText .= '<p>' . obj_check_protection($objSrcUser, 'status') . '</p>'; // Manual Session handler (warns 20 minutes prior to being logged out) $fourHoursAgo = date('Y-m-d H:i:s', strtotime('-4 hours 20 minutes')); if ($arrSrcUsers[LAST_LOGIN] < $fourHoursAgo) { $strText .= '<p>' . "... Less than 20 minutes before you are required to login again" . " ..." . '</p>'; } // frost: added "accept truce" for elder // Martel: recoded to use objects $arrSrcWar = $objSrcAlli->get_wars(); if ($arrSrcWar[TARGET] != 0) { $objTrgAlli = new clsAlliance($arrSrcWar[TARGET]); $arrTrgWar = $objTrgAlli->get_wars(); if ($arrTrgWar[TRUCE_OFFER] == 1) { $strText .= '<p>' . 'The enemy alliance (#' . $objTrgAlli->get_allianceid() . ') has offered us a ' . '<a href="main.php?cat=game&page=war_alliance">truce</a>.' . '</p>'; } elseif ($arrSrcWar[TRUCE_OFFER] == 1) { $strText .= '<p>' . 'News from our war with alliance (#' . $objTrgAlli->get_allianceid() . '): Our alliance diplomats have been sent to negotiate a truce with the enemy.' . '</p>'; } } // If account is paused if ($arrSrcUsers[PAUSE_ACCOUNT] > 1 && $arrSrcUsers[PAUSE_ACCOUNT] <= 48) { $strText .= '<p>' . 'Your account is currently paused, it will be ' . 'accessible for play in ' . ($arrSrcUsers[PAUSE_ACCOUNT] - 1) . ' updates.' . '<br />' . '(You may remain paused for longer if you so wish.)' . '</p>'; } elseif ($arrSrcUsers[PAUSE_ACCOUNT] > 1 && $arrSrcUsers[PAUSE_ACCOUNT] > 48) { $strText .= '<p>' . 'Your tribe is currently entering vacation mode, it will be ' . 'fully protected in ' . ($arrSrcUsers[PAUSE_ACCOUNT] - 49) . ' updates.' . '<br />' . '(Until then you can be attacked by other players.)' . '</p>'; } elseif ($arrSrcUsers[PAUSE_ACCOUNT] == 1) { $strText .= '<p>' . 'Your account is currently paused but is accessible for ' . 'play now. If you wish to leave protection go to Options -> ' . '<a href="main.php?cat=game&page=preferences&task=pause_account">' . 'Pause Account</a>.' . '</p>'; } $strText .= '<div style="float: left; margin: 0 0 10px 10px; text-align: center; overflow: hidden; border: 3px double #444; background: #FFF; height: 42px; width: 154px; ">' . '<a style="border: 0; display: block; color: #444; font: 15px Georgia, Times, serif; line-height: 17px; padding: 4px 0;" href="http://www.orkfiantimes.co.uk/" target="_blank">The Orkfian Times<br /><span style="font-size: 10px; border-top: #444 3px double; letter-spacing: 0.1pt;">A New Issue Every Week!</span></a>' . '</div>' . '<div style="float: left; margin: 0 0 10px 10px; text-align: center; overflow: hidden; border: 3px double #444; background: #FFF; height: 42px; width: 154px; ">' . '<a style="border: 0; display: block; color: #444; font: italic 16px \'Times new roman\'; line-height: 42px;" href="http://www.orkfiantimes.co.uk/faces.html" target="_blank">The Faces of ORKFiA</a>' . '</div>' . '<hr class="clear" style="visibility: hidden;">'; echo $strText; // Voting Portal Links for ORKFiA $voteStatus = ''; $check = md5($arrSrcStats['id'] . $arrSrcStats[RACE] . date('d')); if ($_SERVER['SERVER_NAME'] == 'orkfia.phpsupport.se') { $week = date('W', strtotime('-12 hours')); if ($arrSrcUsers[HOURS] >= PROTECTION_HOURS) { $iBonus = $objSrcUser->get_build(LAND) * 1000; } else { $iBonus = 100000; } if ($arrSrcStats[RACE] == "Dragon") { $iBonus = floor($iBonus / 2); } $strBonus = number_format($iBonus); if ($arrSrcStats[TWG_VOTE] == $week) { $voteStatus = ' (already voted)'; } else { $voteStatus = ' (<strong>' . $strBonus . ' cr</strong>).'; } } $strVoteLinks = '<p>Vote for us @ ' . '<a href="http://apexwebgaming.com/in/518" target="_blank">' . 'Apex Web Gaming</a>' . ' and ' . '<a href="http://www.topwebgames.com/in.asp?id=744&vuser='******'&check=' . $check . '" target="_blank">' . 'TWG' . '</a>' . $voteStatus . '</p>'; echo $strVoteLinks; include_once 'inc/functions/forums.php'; if ($_SERVER['SERVER_NAME'] == DINAH_SERVER_NAME && get_sponsor_badge($arrSrcStats[ID]) == '') { ?> <hr /> <h2>Become a Dragon - ORKFiA Classic</h2> <hr /> <form action="https://www.paypal.com/cgi-bin/webscr" method="post" style="margin-left: auto; margin-right: auto; text-align: center;"> <input type="hidden" name="cmd" value="_xclick" /> <input type="hidden" name="business" value="*****@*****.**" /> <input type="hidden" name="undefined_quantity" value="1" /> <input type="hidden" name="item_name" value="One Week Sponsorship" /> <input type="hidden" name="item_number" value="Classic Dragon" /> <input type="hidden" name="amount" value="2.00" /> <input type="hidden" name="shipping" value="0.00" /> <input type="hidden" name="no_shipping" value="1" /> <input type="hidden" name="return" value="<?php echo HOST; ?> main.php?cat=main&page=sponsors&thankyou" /> <input type="hidden" name="cn" value="Message to admin" /> <input type="hidden" name="currency_code" value="USD" /> <input type="hidden" name="tax" value="0.00" /> <input type="hidden" name="lc" value="SE" /> <input type="hidden" name="bn" value="PP-BuyNowBF" /> <table class="small" cellspacing="0" cellpadding="0"> <tr class="header"> <th colspan="3">Become a Classic Dragon</th> </tr> <tr class="data"> <th>Rank 4:</th> <td><span class="elder">Classic Dragon</span></td> <td rowspan="3"><img src="<?php echo HOST_PICS; ?> dragon_classic.gif" alt="Dragon" /></td> </tr> <tr class="data"> <th>Donation:</th> <td>$2 / week</td> </tr> <tr class="data"> <th><input type="hidden" name="on0" value="Login nick" /><label for="i4">Login nick:</label></th> <td><input type="text" name="os0" id="i4" maxlength="60" value="<?php echo $arrSrcUsers[USERNAME]; ?> " /></td> </tr> </table> <input type="submit" name="submit" value="Sponsor ORKFiA for 1 week" /> </form> <p>Help us advertise and reduce the server costs. <a href="main.php?cat=game&page=sponsors">Become a Dragon</a> to support ORKFiA Classic.</p> <?php } elseif ($_SERVER['SERVER_NAME'] != DINAH_SERVER_NAME && get_sponsor_badge($arrSrcStats[ID]) == '') { include_once 'inc/pages/sponsors.inc.php'; echo show_sponsor_options($arrSrcUsers[USERNAME]); } elseif (($strBadge = get_sponsor_badge($arrSrcStats[ID])) != '') { echo '<hr />' . '<h2>Thank you for supporting ORKFiA!</h2>' . '</hr />' . '<div class="center">' . $strBadge . '</div>'; } echo '</div>'; //========================================================================== // Admin Message (message of the day) //========================================================================== $iStatus = $arrSrcUsers[STATUS]; if ($iStatus == 2) { echo '<br /><br />'; include_once 'inc/pages/motd.inc.php'; include_motd_text(); } else { echo '<br />' . '<div class="center">' . '<a href="main.php?cat=game&page=motd">' . 'View Admin Message' . '</a></div>'; } //========================================================================== // 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'"); //========================================================================== // Empty Database from Deleted Tribes (These are "moved" to alliance #0) //========================================================================== include_once 'inc/classes/clsAlliance.php'; $objTmpAlliance = new clsAlliance(0); $objTmpAlliance->delete_users(); }
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_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_alliance_text() { // This bugs pretty badly if the alliance tables are missing // Same thing further down too, but for target alliance obj. $objSrcUser =& $GLOBALS["objSrcUser"]; $objSrcAlli = $objSrcUser->get_alliance(); //========================================================================== // Martel: Validate the alliance number so we get an absolutely safe one //========================================================================== $iAid = intval($objSrcUser->get_stat(ALLIANCE)); if (isset($_POST['aid'])) { $iAid = intval($_POST['aid']); if (strlen($_POST['aid']) > 4) { require_once 'inc/pages/logout.inc.php'; include_logout_text(); } } elseif (isset($_GET['aid'])) { $iAid = intval($_GET['aid']); if (strlen($_GET['aid']) > 4) { require_once 'inc/pages/logout.inc.php'; include_logout_text(); } } if ($iAid < 1) { $iAid = 1; } //========================================================================== $result = mysql_query("SELECT alli_id FROM rankings_personal WHERE alli_id < {$iAid} ORDER BY alli_id DESC LIMIT 1"); if (mysql_num_rows($result) == '0') { $prevAlli['0'] = $iAid; } else { $prevAlli = mysql_fetch_row($result); } $result = mysql_query("SELECT alli_id FROM rankings_personal WHERE alli_id > {$iAid} ORDER BY alli_id ASC LIMIT 1"); if (mysql_num_rows($result) == '0') { $nextAlli['0'] = $iAid; } else { $nextAlli = mysql_fetch_row($result); } echo $chooseAlliance = "<div class=\"tableLinkMini\">" . "<a href=\"main.php?cat=game&page=alliance\">Home</a>" . "</div>" . "<form method=\"post\" action=\"main.php?cat=game&page=alliance\" style=\"margin-top: 0pt;\">" . "<table cellpadding=\"0\" cellspacing=\"0\" class=\"mini\">" . "<tr class=\"header\">" . "<th colspan=\"4\">" . "Alliance" . "</th>" . "</tr>" . "<tr class=\"data\">" . "<td>" . "<a id=\"arrowl\" href=\"main.php?cat=game&page=alliance&aid=" . $prevAlli[0] . "\">" . "<span class=\"alt\">" . "<" . "</span>" . "</a>" . "</td>" . "<td>" . "<input type=\"text\" name=\"aid\" size=\"4\" maxlength=\"4\" value=\"" . $iAid . "\" />" . "</td>" . "<td>" . "<input type=\"submit\" name=\"submit\" value=\"View\" />" . "</td>" . "<td>" . "<a id=\"arrowr\" href=\"main.php?cat=game&page=alliance&aid=" . $nextAlli[0] . "\">" . "<span class=\"alt\">" . ">" . "</span>" . "</a>" . "</td>" . "</tr>" . "</table>" . "</form>"; $res = mysql_query("SELECT COUNT(id) AS cnt FROM rankings_personal WHERE alli_id = {$iAid}"); $line = mysql_fetch_assoc($res); if ($line["cnt"] == '0') { $res = mysql_query("SELECT id FROM rankings_alliance ORDER BY id DESC LIMIT 1"); $max = mysql_fetch_assoc($res); $res = mysql_query("SELECT id FROM rankings_alliance ORDER BY id ASC LIMIT 1"); $min = mysql_fetch_assoc($res); echo "Selections range from " . $min["id"] . "-" . $max["id"]; include_game_down(); exit; } ?> <div class="center"> <?php //========================================================================== // Alliance Banner //========================================================================== $objTrgAlli = new clsAlliance($iAid); $arrAlliance = $objTrgAlli->get_alliance_infos(); $arrRankingsAlliance = $objTrgAlli->get_rankings_alliances(); if (trim($arrAlliance[IMAGE]) != '') { $arrAlliance[IMAGE] = stripslashes($arrAlliance[IMAGE]); $arrAlliance[IMAGE] = htmlspecialchars($arrAlliance[IMAGE]); $arrAlliance[IMAGE] = escapeshellcmd($arrAlliance[IMAGE]); echo "<img src =\"" . $arrAlliance[IMAGE] . "\" width =\"" . $arrAlliance[IMAGEWIDTH] . "\" height =\"" . $arrAlliance[IMAGEHEIGHT] . "\" alt=\"\" /><br />"; } //========================================================================== // War status display //========================================================================== $arrSrcWar = $objTrgAlli->get_wars(); if ($arrSrcWar[TARGET] != 0) { $targetLink = " (<a href=\"main.php?cat=game&page=alliance&aid=" . $arrSrcWar[TARGET] . "\">#" . $arrSrcWar[TARGET] . "</a>)"; $objWarTrg = new clsAlliance($arrSrcWar[TARGET]); $strAlliName = stripslashes($objWarTrg->get_rankings_alliance('alli_name')); echo '<br /><strong class="negative">At war with ' . $strAlliName . $targetLink . '</strong>'; } //========================================================================== if ($iAid < 10) { $iSpan = 3; ?> <span style="font-size: 0.8em"><a href="main.php?cat=game&page=message&alliance=<?php echo $iAid; ?> ">Submit a report here</a>.</span> <br /> <?php } else { $iSpan = 6; if ($iAid == $objSrcUser->get_stat(ALLIANCE)) { $iSpan = 7; } // bootcamp indication if ($arrAlliance[BOOTCAMP] == 'yes') { ?> <br /><strong class='positive'>[ Boot Camp ]</strong><br /> <?php } // M: Graveyard indication if ($iAid == 10) { echo '<h2>The Graveyard in #10 - Beware of the DEAD.</h2>'; } ?> <?php } ?> </div> <br /> <table cellpadding="0" cellspacing="0" class="big"> <tr class="header"> <th colspan="<?php echo $iSpan; ?> "> <?php $strAllianceName = stripslashes($arrRankingsAlliance[ALLI_NAME]); echo "{$strAllianceName} (#{$iAid})"; if (trim($arrRankingsAlliance[ALLI_DESC]) != '') { $allianceDesc = stripslashes(trim($arrRankingsAlliance[ALLI_DESC])); ?> <br /><span style="font-size: 0.8em;"><?php echo $allianceDesc; ?> </span> <?php } if ($iAid < 10) { ?> </th> </tr> <tr class="subheader"> <th width="17"></th> <td align="left" class="left" width="34%">Staff Tribe</td> <td align="left" class="left">Online < 48 hours ago</td> </tr> <?php // Martel: Sort 1-10 on staff ranks and name instead of acres $res = mysql_query("SELECT rankings_personal.id, alli_id, tribe_name, hours, rankings_personal.race, land, nw, rankings_personal.fame, player_type, stats.level FROM rankings_personal, stats WHERE alli_id = {$iAid} AND stats.id = rankings_personal.id ORDER BY level DESC, tribe_name ASC"); } else { // Output alliance Rankings include_once 'inc/functions/alli_ranking.php'; if ($iAid != 10) { $arrRanking = get_rank_data($iAid); echo "<br />Land: " . $arrRanking[LAND] . " Strength: " . $arrRanking[STRENGTH] . " Fame: " . $arrRanking[FAME]; } ?> </th> </tr> <tr class="subheader"> <th width="17"></th> <th>Tribe Name</th> <?php if ($iAid == $objSrcUser->get_stat(ALLIANCE)) { echo ' <td><em>Ruler Age</em></td> '; } ?> <td>Race</td> <td>Size</td> <td>Strength</td> <td>Fame</td> </tr> <?php // Sort tribes by acreage, strength, fame $res = mysql_query("SELECT id FROM rankings_personal WHERE alli_id = {$iAid} ORDER BY land DESC, nw DESC, fame DESC"); } $inactivitycheck = $objSrcUser->get_rankings_personals(); $iCount = 0; $inactiveCounter = 0; $objTmpUser = new clsUser(0); while ($line = mysql_fetch_assoc($res)) { // Clear the temporary object to assign a new user $iUserid = $line[ID]; $objTmpUser->set_userid($iUserid); $arrTmpRanking = $objTmpUser->get_rankings_personals(); $arrTmpRanking[TRIBE_NAME] = stripslashes($arrTmpRanking[TRIBE_NAME]); $strFame = (string) number_format($arrTmpRanking[FAME]); if ($arrTmpRanking[FAME] < 5000) { $strFame = '<span class="negative">' . $strFame . '</span>'; } elseif ($arrTmpRanking[FAME] > 5000) { $strFame = '<span class="positive">' . $strFame . '</span>'; } ?> <tr class="data"> <th> <?php $online = $objTmpUser->get_onlines(); $old = date(TIMESTAMP_FORMAT, strtotime('-5 minutes')); // Martel: New inactivity check. // Works with both month changes and leap years ;) $inactive = date(TIMESTAMP_FORMAT, strtotime('-2 days')); if ($online['time'] < $inactive && $inactivitycheck[PLAYER_TYPE] == "elder" && $inactivitycheck[ALLI_ID] == $iAid) { ?> <img src="<?php echo HOST_PICS; ?> tribe_inactive.gif" alt="*" height="13" width="13" /> <?php } elseif ($online['time'] < $old) { ?> <img src="<?php echo HOST_PICS; ?> tribe_offline.gif" alt="" height="13" width="13" /> <?php } else { $inactiveCounter++; ?> <img src="<?php echo HOST_PICS; ?> tribe_online.gif" alt="»" height="13" width="13" /> <?php } ?> </th> <th> <?php // Begin output of <tr> for each tribe if ($iAid >= 10) { $strClass = $arrTmpRanking[PLAYER_TYPE] . ""; if ($objTmpUser->isPaused() || $arrTmpRanking[HOURS] < PROTECTION_HOURS) { $strClass = "protected"; } echo '<a href="main.php?cat=game&page=external_affairs&tribe=' . $arrTmpRanking[ID] . "&aid=" . $arrTmpRanking[ALLI_ID] . '" class="' . $strClass . '">' . $arrTmpRanking[TRIBE_NAME] . '</a></th>'; if ($iAid == $objSrcUser->get_stat(ALLIANCE)) { echo "<td><em>" . $objTmpUser->get_ruler_age() . "</em></td>"; } echo "<td>" . $arrTmpRanking[RACE] . "</td>" . "<td>" . number_format($arrTmpRanking[LAND]) . "</td>" . "<td>" . number_format($arrTmpRanking[NW]) . "</td>" . "<td>" . $strFame . "</td>" . "</tr>"; } else { $strClass = "staff"; if ($objTmpUser->get_stat(LEVEL) > 5) { $strClass = "admin"; } elseif ($objTmpUser->get_stat(LEVEL) == 5) { $strClass = "head"; } echo '<a href="main.php?cat=game&page=message&tribe=' . $arrTmpRanking[ID] . "&alliance=" . $arrTmpRanking[ALLI_ID] . '" class="' . $strClass . '">' . $arrTmpRanking[TRIBE_NAME] . '</a></th>'; if ($online['time'] < $inactive) { echo '<td class="left"><em>No</em></td>'; } else { echo '<td class="left"><em class="positive">Yes</em></td>'; } echo '</tr>'; } $iCount++; } ?> </table> <div class="center" style="font-size: 0.8em"> There are <?php echo $iCount; ?> tribes in this alliance. </div> <br /> <table cellpadding="0" cellspacing="0" class="small"> <tr class="header"> <th colspan="2">Legend</th> </tr> <tr class="subheader"> <th>Mark</th> <td>Meaning</td> </tr> <?php if ($iAid >= 10) { ?> <tr class="data"> <th class="elder">Gold:</th> <td>Elder</td> </tr> <tr class="data"> <th class="coelder">Copper:</th> <td>Co-elder</td> </tr> <tr class="data"> <th class="protected">Light Green:</th> <td>In Protection</td> </tr> <?php } else { ?> <tr class="data"> <th class="admin">White:</th> <td>Orkfian God</td> </tr> <tr class="data"> <th class="head">Pink:</th> <td>Orkfian Lord</td> </tr> <tr class="data"> <th class="staff">Blue:</th> <td>ORKFiA Staff</td> </tr> <?php } ?> <tr class="data"> <th><img src="<?php echo HOST_PICS; ?> tribe_online.gif" alt="»" height="13" width="13" /></th> <td>Online</td> </tr> <?php if ($inactivitycheck[PLAYER_TYPE] == "elder" && $inactivitycheck['alli_id'] == $iAid && $inactiveCounter > 0) { ?> <tr class="data"> <th><img src="<?php echo HOST_PICS; ?> tribe_inactive.gif" alt="*" height="13" width="13" /></th> <td>Inactive</td> </tr> <?php } ?> </table> <?php }
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_war_room_text() { // User object $objSrcUser = $GLOBALS['objSrcUser']; $arrSrcStats = $objSrcUser->get_stats(); // Alliance object $objSrcAlli = $objSrcUser->get_alliance(); $arrSrcWar = $objSrcAlli->get_wars(); // Include war functions // Show declare war page is default unless the alliance is at war $strShow = "declare_war"; if ($arrSrcWar['target'] != 0) { $strShow = "current_war"; } // Show page switch ($strShow) { case "declare_war": // M: Show statistics (if we have been in war) $strStatistics = ''; if ($arrSrcWar['last_target'] != 0) { // M: Show statistics, with correct grammar $arrS = array('ies', 's', 's', 's'); if ($arrSrcWar['victory'] == 1) { $arrS[0] = 'y'; } if ($arrSrcWar['defeat'] == 1) { $arrS[1] = ''; } if ($arrSrcWar['surrender'] == 1) { $arrS[2] = ''; } if ($arrSrcWar['truce'] == 1) { $arrS[3] = ''; } $strStatistics .= '<p>' . '<strong class="positive">' . $arrSrcWar['victory'] . " war victor{$arrS['0']}</strong>—defeated " . $arrSrcWar['defeat'] . " time{$arrS['1']}.<br />" . "We have surrendered " . $arrSrcWar['surrender'] . " time{$arrS['2']} and truced " . $arrSrcWar['truce'] . " time{$arrS['3']}.</strong>" . '</p><p>'; // Info about who the last wartarget was - AI $objTrgAlli = new clsAlliance($arrSrcWar['last_target']); $arrTrgAlli = $objTrgAlli->get_alliance_infos(); // M: Show continued statistics, with correct grammar if ($arrSrcWar['last_outgoing'] == 'surrender') { $strF = 'Our last war ended as a %s to %s (#%d).'; } elseif ($arrSrcWar['last_outgoing'] == 'victory') { $strF = 'Our last war ended as a %s over %s (#%d).'; } elseif ($arrSrcWar['last_outgoing'] == 'defeat') { $strF = 'Our last war ended as a %s against %s (#%d).'; } elseif ($arrSrcWar['last_outgoing'] == 'truce') { $strF = 'Our last war ended in a %s with %s (#%d).'; } // M: Echo continued statistics $strStatistics .= sprintf($strF, $arrSrcWar['last_outgoing'], stripslashes($arrTrgAlli['name']), $arrSrcWar['last_target']); $strStatistics .= '</p>'; } else { $strStatistics .= '<p>We have not been in a war yet.</p>'; } // M: Find alliances in range $iAlliSize = $objSrcAlli->get_alliance_size('land'); $iUpwardRange = floor($iAlliSize * WAR_UPWARD_MOD); $iBottomRange = ceil($iAlliSize * WAR_BOTTOM_MOD); $strSQL = "SELECT id FROM rankings_alliance "; $strSQL .= "WHERE land BETWEEN {$iBottomRange} and {$iUpwardRange} "; $strSQL .= "ORDER BY land DESC"; $resSQL = mysql_query($strSQL); $count = 1; $objTmpAlli = new clsAlliance(1); $strTableRow = ''; $strInputList = '<option selected="selected"></option>'; while ($row = mysql_fetch_assoc($resSQL)) { // M: Get temporary alliance object $objTmpAlli->set_allianceid($row['id']); // M: Check if war is possible $arrWarPossible = testWarPossible($objSrcAlli, $objTmpAlli); $bWarPossible = $arrWarPossible[0]; if ($bWarPossible) { // M: Fetch alliance rankings $arrTmpRanks = $objTmpAlli->get_rankings_alliances(); $strAllianceLink = "<a href=\"main.php?cat=game&page=" . "alliance&aid={$row['id']}\">{$row['id']}</a>"; // M: Create drop-down list with targets in range (for form) $strInputList .= '<option value="' . $row['id'] . '">' . stripslashes($arrTmpRanks['alli_name']) . '</option>'; // M: Create "Alliances in range" table data $strTableRow .= "<tr class=data>" . '<th width="22">' . $count . '.</th>' . "<th>" . stripslashes($arrTmpRanks['alli_name']) . " (#{$strAllianceLink})" . "</th>" . "<td>" . number_format($arrTmpRanks['land']) . "</td>" . "<td>" . number_format($arrTmpRanks[STRENGTH]) . "</td>" . "<td>" . number_format($arrTmpRanks['fame']) . "</td>" . "</tr>"; $count++; } } if ($count == 1) { $strTableRow .= '<tr class="data">' . '<th class="center" colspan="5">' . "There are no alliances that we can declare against." . '</th>' . "</tr>"; $strForm = "<p>There are no alliances that we can declare against.</p>"; } elseif ($_SERVER['SERVER_NAME'] == DEV_SERVER_NAME || $arrSrcStats['type'] == "elder" || $arrSrcStats['type'] == "coelder") { $strForm = '<form method="post" action="main.php?cat=game&page=war_room2" id="center">' . '<label>Alliance: ' . '<select name="target">' . $strInputList . '</select>' . '</label> ' . '<input type="submit" name="declare" value="Declare War!" />' . '</form><br />'; } else { $strForm = '<p>Only alliance elders can declare war.</p>'; } // M: Show page contents echo $strPage = '<div id="textMedium" style="margin-top: 0;">' . '<h2>Declare War</h2>' . '<p>' . "In a war, knowing the enemy is very important. " . "Decipher the enemies' weaknesses and avoid " . "confronting their strengths. Gather information about " . "their tribes and research, and then choose targets for " . "your attackers, thieves and mages." . '</p>' . '<h3>Statistics</h3>' . $strStatistics . '<h3>New war target</h3>' . $strForm . '</div><br />' . '<table class="medium" cellpadding="0" cellspacing="0">' . '<tr class="header">' . '<th colspan="5">Alliances in Range</th>' . '</tr>' . '<tr class="subheader"><th colspan="2">Alliance</th>' . '<th>Acres</th>' . '<th class="right">Strength</th>' . '<th class="right">Fame</th>' . '</tr>' . $strTableRow . '</table>'; break; case "current_war": // We are in war $objTrgAlli = new clsAlliance($arrSrcWar['target']); $arrTrgAlli = $objTrgAlli->get_alliance_infos(); $arrTrgWar = $objTrgAlli->get_wars(); // Time of war start // Get game hours require_once 'inc/classes/clsGame.php'; require_once 'inc/functions/orktime.php'; $objGame = new clsGame(); $iGameHours = $objGame->get_game_time('hour_counter'); $arrOE = hoursToYears(WAR_LENGTH - ($iGameHours - $arrSrcWar['war_started'])); $strOrkDate = "{$arrOE['years']} years and {$arrOE['months']} months"; // Option: Claim Victory (tho should be automatic like "final blow") $strDiplomacy = ''; if ($arrSrcWar['land_needed'] <= 0) { $strDiplomacy .= '<p>We have reached our war goal. Do you wish to claim this victory?</p>' . '<form method="post" action="main.php?cat=game&page=war_room2" id="center">' . '<input type="submit" name="victory" value="Claim Victory!">' . "</form><br />"; } elseif (($_SERVER['SERVER_NAME'] == DEV_SERVER_NAME || $arrSrcStats['type'] == "elder" || $arrSrcStats['type'] == "coelder") && $arrSrcWar['truce_offer'] == 1 && $arrTrgWar['truce_offer'] == 0) { $strDiplomacy .= '<p>' . "Alliance #" . $objTrgAlli->get_allianceid() . " has " . "not accepted our generous offer to truce yet. " . '</p>' . '<p>' . "As a last resort and at a greater cost we may " . "surrender. (+40% war losses). The only valid reason " . "to do this is to save our alliance from further damage." . '</p>' . '<p>Do you wish to surrender?</p>' . '<form method="post" action="main.php?cat=game&page=war_room2" id="center">' . '<input type="submit" name="ctruce" value="Withdraw Truce" /> ' . '<input type="submit" name="surrender" value="Surrender War" />' . '</form><br />'; } elseif (($_SERVER['SERVER_NAME'] == DEV_SERVER_NAME || $arrSrcStats['type'] == "elder" || $arrSrcStats['type'] == "coelder") && $arrSrcWar['truce_offer'] == 0 && $arrTrgWar['truce_offer'] == 0) { $strDiplomacy .= '<p>We have the option to offer a truce to the enemy.</p>' . '<form method="post" action="main.php?cat=game&page=war_room2" id="center">' . '<input type="submit" name="otruce" value="Offer truce">' . "</form><br />"; } elseif (($_SERVER['SERVER_NAME'] == DEV_SERVER_NAME || $arrSrcStats['type'] == "elder" || $arrSrcStats['type'] == "coelder") && $arrSrcWar['truce_offer'] == 0 && $arrTrgWar['truce_offer'] == 1) { $strDiplomacy .= '<p>' . "Leader, #<strong>{$arrTrgWar['id']}</strong> has " . "offered us a truce." . '</p>' . '<form method="post" action="main.php?cat=game&page=war_room2" id="center">' . '<input type="submit" name="atruce" value="Accept Truce">' . '</form><br />'; } echo $strPage = '<div class="tableLinkMedium">' . '<a href="main.php?cat=game&page=global_news">Global News</a>' . ' | <a href="main.php?cat=game&page=alliance&aid=' . $arrTrgAlli['id'] . '">Alliance #' . $arrTrgAlli['id'] . '</a>' . '</div>' . '<div id=textMedium style="margin-top: 0;">' . '<h2>Victory conditions</h2>' . '<p>' . '<strong class="positive">Take ' . number_format($arrSrcWar['land_needed']) . ' acres to win</strong>—lose ' . number_format($arrTrgWar['land_needed']) . " acres for defeat." . '</p>' . "<p><em>{$strOrkDate} left until automatic draw.</em></p>" . '<h3>Diplomacy</h3>' . $strDiplomacy . '</div>'; break; } // M: Show guide link + advice include_once 'inc/pages/advisors.inc.php'; echo get_guide_link($objSrcUser, 'war_room', 'textMedium'); }
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 notify_forum_users(&$objSrcUser, $posttype) { switch ($posttype) { case 0: // Alliance // One way to highlight a whole alliance -Martel, September 13, 2007 include_once 'inc/classes/clsUser.php'; $objTmpUser = new clsUser(1); //M:small performance increaser, reuse $objSrcAlliance = $objSrcUser->get_alliance(); $arrIds = $objSrcAlliance->get_userids(); foreach ($arrIds as $iUserId) { $objTmpUser->set_userid($iUserId); $objTmpUser->set_preference(NEW_A, 1); } break; case 1: // Staff // A way to highlight several alliances... There must be something // better, but now it works. Maybe add a method in alliance class // to affect all members. Martel, September 13, 2007 include_once 'inc/classes/clsUser.php'; $objTmpUser = new clsUser(1); //M:small performance increaser, reuse $strSQL = "SELECT id FROM " . TBL_STAT . " WHERE level > 1"; $resSQL = mysql_query($strSQL) or die(mysql_error()); while ($arrPrefs = mysql_fetch_array($resSQL)) { $objTmpUser->set_userid($arrPrefs[ID]); $objTmpUser->set_preference(NEW_S, 1); } break; case 2: // adding world entry - AI 31/10/06 // Note: This is bad, because we ignore user objects for performance mysql_query("UPDATE " . TBL_PREFERENCES . " SET " . NEW_W . " = 1 WHERE " . NEW_W . " = 0") or die(mysql_error()); break; case 3: // Announcements // Note: This is bad, because we ignore user objects for performance mysql_query("UPDATE " . TBL_PREFERENCES . " SET " . NEW_N . " = 1 WHERE " . NEW_N . " = 0") or die(mysql_error()); break; case 4: // Law & Order // One way to highlight a whole alliance -Martel, September 13, 2007 include_once 'inc/classes/clsUser.php'; $objTmpUser = new clsUser(1); //M:small performance increaser, reuse include_once 'inc/classes/clsAlliance.php'; $objSrcAlliance = new clsAlliance(2); // Hardcoded alliance id $arrIds = (array) $objSrcAlliance->get_userids(); foreach ($arrIds as $iUserId) { $objTmpUser->set_userid($iUserId); $objTmpUser->set_preference(NEW_L, 1); } break; case 5: // Operations // One way to highlight a whole alliance -Martel, September 13, 2007 include_once 'inc/classes/clsUser.php'; $objTmpUser = new clsUser(1); //M:small performance increaser, reuse include_once 'inc/classes/clsAlliance.php'; $objSrcAlliance = new clsAlliance(3); // Hardcoded alliance id $arrIds = (array) $objSrcAlliance->get_userids(); foreach ($arrIds as $iUserId) { $objTmpUser->set_userid($iUserId); $objTmpUser->set_preference(NEW_O, 1); } break; case 6: // Development // One way to highlight a whole alliance -Martel, September 13, 2007 include_once 'inc/classes/clsUser.php'; $objTmpUser = new clsUser(1); //M:small performance increaser, reuse include_once 'inc/classes/clsAlliance.php'; $objSrcAlliance = new clsAlliance(1); // Hardcoded alliance id $arrIds = (array) $objSrcAlliance->get_userids(); foreach ($arrIds as $iUserId) { $objTmpUser->set_userid($iUserId); $objTmpUser->set_preference(NEW_D, 1); } break; case 7: // Game Talk // Note: This is bad, because we ignore user objects for performance mysql_query("UPDATE " . TBL_PREFERENCES . " SET " . NEW_G . " = 1 WHERE " . NEW_G . " = 0") or die(mysql_error()); break; case 8: // Dragon Lair (game sponsors) $strLogins = "'martel'"; // hardcoded for sponsor notify SQL string $strSQL3 = "SELECT option_selection1 FROM phpsuppo_3.paypal WHERE option_selection1 != 'NULL' GROUP BY option_selection1"; $resSQL3 = mysql_query($strSQL3); while ($arrSQL3 = mysql_fetch_row($resSQL3)) { $strLogins .= ", " . quote_smart($arrSQL3[0]); } // A way to highlight several alliances... There must be something // better, but now it works. Maybe add a method in alliance class // to affect all members. Martel, September 13, 2007 include_once 'inc/classes/clsUser.php'; $objTmpUser = new clsUser(1); //M:small performance increaser, reuse $strSQL = "SELECT id FROM " . TBL_USER . " WHERE username IN ({$strLogins})"; $resSQL = mysql_query($strSQL) or die(mysql_error()); while ($arrPrefs = mysql_fetch_array($resSQL)) { $objTmpUser->set_userid($arrPrefs[ID]); $objTmpUser->set_preference(NEW_DR, 1); } break; } }
function war_target($IAllianceid) { require_once 'inc/classes/clsAlliance.php'; $objAlli = new clsAlliance($IAllianceid); return $objAlli->get_war('target'); }