function doit() { include_once 'inc/classes/clsGame.php'; $objGame = new clsGame(); $iCurrentYear = $objGame->get_year_history(); $iAgeNumber = $objGame->get_game_time(AGE_NUMBER); include_once 'inc/classes/clsAge.php'; $objNewAge = new clsAge(); $objNewAge->loadAge($iAgeNumber); $iFirstYear = $objNewAge->getFirstYear(); $iLastYear = $objNewAge->getLastYear(); // Alla genom history $resSQL2 = mysql_query("SELECT year, alli_id, alli_name, alli_desc FROM rankings_history WHERE alli_id > 10 AND year >= {$iFirstYear} AND year <= {$iLastYear} GROUP BY year ASC"); // Lista Alla För att summera i PHP $old_id = 0; $count = 0; while ($arrRow = mysql_fetch_assoc($resSQL2)) { $new_id = $arrRow['alli_id']; if ($new_id != $old_id) { // prepare for new alliance $count++; // Copy SQL result row $arrAlliance[$count] = $arrRow; // add a starting year column to display period, eg 100 - 106 OE $arrAlliance[$count]['starting_year'] = $arrRow['year']; // add an ending year column to display period, eg 100 - 106 OE $arrAlliance[$count]['ending_year'] = $arrRow['year']; // add a year counter column, starting value = 1 $arrAlliance[$count]['years'] = 1; // Save alliance id for next loop $old_id = $new_id; } elseif ($new_id == $old_id) { // add another year to our counter column $arrAlliance[$count]['years']++; // update ending year column $arrAlliance[$count]['ending_year'] = $arrRow['year']; } } //====================================================================== // Sort the array //====================================================================== // Obtain the column to sorty by foreach ($arrAlliance as $key => $row) { $years[$key] = $row['starting_year']; } // Sort the data with years descending // Add $arrAlliance as the last parameter, to sort by the common key array_multisort($years, SORT_ASC, $arrAlliance); //====================================================================== // Done sorting ;) //====================================================================== echo "<h2>Timeline</h2>"; echo "<table class=\"big\" cellpadding=\"0\" cellspacing=\"0\">"; $count = 1; foreach ($arrAlliance as $arrAlliance) { echo "<tr class=\"data\">"; echo "<td class=\"left\">(" . $arrAlliance['starting_year'] . ' - ' . $arrAlliance['ending_year'] . " OE) </td>"; echo "<th>" . stripslashes($arrAlliance['alli_name']) . "</th>"; echo "<td class=\"left\">" . "(#<A HREF=\"main.php?cat=game&page=alliance&aid=" . $arrAlliance['alli_id'] . "\">" . $arrAlliance['alli_id'] . "</A>)" . "</td>"; echo "<td>" . $arrAlliance['years'] . " years on top </td>"; $count++; echo "</tr>"; } echo "</table>"; }
function doUpdateMarket(&$objAlliance) { include_once 'inc/classes/clsGame.php'; $objGame = new clsGame(); $iHours = $objGame->get_game_time(HOUR_COUNTER); $arrAlliance = $objAlliance->get_alliance_infos(); $iUpdates = $iHours - $arrAlliance[MARKET_HOUR]; // calculate # of updates and update the market accordingly $intUpdatesOwed = $iUpdates; if ($intUpdatesOwed > 0) { $new_food = $arrAlliance[FOOD]; $new_wood = $arrAlliance[WOOD]; // decay of food and wood stacked on market, added loop - AI 03/05/07 while ($intUpdatesOwed-- > 0) { $new_food = $new_food * (1 - 1 / 1500); $new_wood = $new_wood * 0.9995000000000001; } $arrAllianceNew = array(FOOD => round($new_food), WOOD => round($new_wood), MARKET_HOUR => $arrAlliance[MARKET_HOUR] + $iUpdates); $objAlliance->set_alliance_infos($arrAllianceNew); } }
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 doit() { include_once 'inc/classes/clsGame.php'; $objGame = new clsGame(); $iCurrentYear = $objGame->get_year_history(); $iAgeNumber = $objGame->get_game_time(AGE_NUMBER); include_once 'inc/classes/clsAge.php'; $objNewAge = new clsAge(); $objNewAge->loadAge($iAgeNumber); $iFirstYear = $objNewAge->getFirstYear(); $iLastYear = $objNewAge->getLastYear(); // Alla genom history $resSQL2 = mysql_query("SELECT year, alli_id, alli_name, alli_desc FROM rankings_history WHERE alli_id > 10 AND year >= {$iFirstYear} AND year <= {$iLastYear} GROUP BY year ASC"); // Lista Alla För att summera i PHP $old_id = 0; $iCount = 0; while ($arrRow = mysql_fetch_assoc($resSQL2)) { $new_id = $arrRow['alli_id']; if ($new_id != $old_id) { // prepare for new alliance $iCount++; // Copy SQL result row $arrAlliance[$iCount] = $arrRow; // add a starting year column to display period, eg 100 - 106 OE $arrAlliance[$iCount]['starting_year'] = $arrRow['year']; // add an ending year column to display period, eg 100 - 106 OE $arrAlliance[$iCount]['ending_year'] = $arrRow['year']; // add a year counter column, starting value = 1 $arrAlliance[$iCount]['years'] = 1; // Save alliance id for next loop $old_id = $new_id; } elseif ($new_id == $old_id) { // add another year to our counter column $arrAlliance[$iCount]['years']++; // update ending year column $arrAlliance[$iCount]['ending_year'] = $arrRow['year']; } } //====================================================================== // Sort the array //====================================================================== // Obtain the column to sorty by foreach ($arrAlliance as $key => $row) { $years[$key] = $row['starting_year']; } // Sort the data with years descending // Add $arrAlliance as the last parameter, to sort by the common key array_multisort($years, SORT_ASC, $arrAlliance); //====================================================================== // Done sorting ;) //====================================================================== // echo '<div class="center"><h2>Timeline</h2></div>'; echo '<br />'; $strTimelineCurrentTable = '<table class="big" cellpadding="0" cellspacing="0">' . '<tr class="header">' . '<th colspan="5">Timeline</th>' . '</tr>' . '<tr class="subheader">' . '<th>Period</th>' . '<th>Alliance Name</th>' . '<th>Alliance Description</th>' . '<th>#</th>' . '<th class="right">Years</th>' . '</tr>'; $iCount = 1; foreach ($arrAlliance as $arrAlliance) { $strTimelineCurrentTable .= '<tr class="data">' . '<td class="left">(' . $arrAlliance['starting_year'] . ' - ' . $arrAlliance['ending_year'] . ' OE) </td>' . '<th>' . stripslashes($arrAlliance['alli_name']) . '</th>' . '<td class="left">' . stripslashes($arrAlliance['alli_desc']) . '</td>' . '<td class="left">' . '(#<a href="main.php?cat=game&page=alliance&aid=' . $arrAlliance['alli_id'] . '">' . $arrAlliance['alli_id'] . '</a>)</td>' . '<td>' . $arrAlliance['years'] . ' years on top </td>' . '</tr>'; $iCount++; } $strTimelineCurrentTable .= '</table>'; echo $strTimelineCurrentTable; }
function include_game_up() { global $page, $strTitle; $objSrcUser =& $GLOBALS['objSrcUser']; // clsGame for gametime include_once 'inc/classes/clsGame.php'; $objGame = new clsGame(); $iGameHours = $objGame->get_game_time(HOUR_COUNTER); $iAgeNumber = $objGame->get_game_time(AGE_NUMBER); $strPaused = $objGame->get_game_switch(GLOBAL_PAUSE); // clsAge for age counters include_once 'inc/classes/clsAge.php'; $objAge = new clsAge(); $blnCheck = $objAge->loadAge($iAgeNumber); // either FALSE or TRUE // orkTime for some time functions include_once 'inc/functions/orktime.php'; $arrOrkDate = hoursToYears($iGameHours); // Months $strMonths = ""; if ($arrOrkDate['months'] > 0) { $strMonths = "Month " . $arrOrkDate['months'] . ", "; } $arrAgeDisplays = get_age_displays($objGame, $objAge, $blnCheck); if ($strPaused == ON) { $arrAgeDisplays['str_age_extra'] .= ' <span class="positive">PAUSED</span>'; } // Alliance $arrGameHistorys = $objGame->get_historys($arrOrkDate['years']); if ($arrGameHistorys[ALLI_NAME] == NULL) { // Martel: Prevent year-change lag $arrGameHistorys = $objGame->get_historys($arrOrkDate['years'] - 1); } $strTopAlliance = 'Top Alliance: ' . $arrGameHistorys[ALLI_NAME] . ' (#<a href="main.php?cat=game&page=alliance&aid=' . $arrGameHistorys[ALLI_ID] . '">' . $arrGameHistorys[ALLI_ID] . '</a>)'; // Design stuff if (isset($objSrcUser)) { $arrDesign = $objSrcUser->get_designs(); } if (!isset($arrDesign[COLOR])) { $arrDesign[COLOR] = 'forest_v1'; } if (!isset($arrDesign[WIDTH]) || $arrDesign[WIDTH] == "") { $arrDesign[WIDTH] = '750'; } if (!isset($arrDesign[ALIGNMENT])) { $arrDesign[ALIGNMENT] = 'center'; } ?> <script language="JavaScript" type="text/javascript"> <!--- var serverDate=new Date('<?php echo date("F d, Y H:i:s", time()); ?> ') //--> </script> <script language="JavaScript" type="text/javascript" src="orkfiaJS.php"></script> <link rel="stylesheet" type="text/css" media="all" href="css/<?php echo $arrDesign[COLOR]; ?> .css?version=1" /> <link rel="stylesheet" type="text/css" media="all" href="css/style.css?version=1" /> <!--[if lte IE 6]><link rel="stylesheet" type="text/css" media="screen" href="css/ie.css" /><![endif]--> <?php //If my new menu works I will put it here. I will also remove the ID part when a first good part is done. if ($objSrcUser->get_userid() == 7160 && $_SERVER['SERVER_NAME'] == DEV_SERVER_NAME) { ?> <link rel="stylesheet" type="text/css" media="all" href="css/harrytesting.css" /> <!--[if lte IE 6]><link rel="stylesheet" type="text/css" media="screen" href="css/harryie.css" /><![endif]--> <?php } ?> </head> <body onload="clockStart();"> <div id="<?php echo 'container' . $arrDesign[WIDTH] . $arrDesign[ALIGNMENT]; ?> "> <div id="header"> <h1 style="margin: 0; padding: 0;"><img src="<?php echo HOST_PICS . 'head' . $arrDesign[WIDTH] . '.jpg'; ?> " alt="ORKFiA" /></h1> <ul id="gameStats"> <li style="color: #000;">Time: <span style="color: #000;" id="ClockTime"><?php echo date('H:i:s', time()); ?> </span></li> <li><br /></li> <li><a href="main.php?cat=game&page=rankings&show=annual&type=currentage"><?php echo $arrAgeDisplays['str_age']; ?> </a> <em><?php echo $arrAgeDisplays['str_age_extra']; ?> </em></li> <li><strong><?php echo $strMonths; ?> Year <?php echo $arrOrkDate['years']; ?> OE</strong> <em><?php echo $strTopAlliance; ?> </em></li> </ul> </div> <div id="menu"> <?php include_game_menu(); ?> </div> <div id="upper_shadow"></div> <div id="portal"> <div class="center"> <h2 style="margin: 0;"><img src="<?php echo HOST_PICS; ?> gryph_l.gif" alt=""/><img src="<?php echo HOST_PICS . $page; ?> .gif" alt="<?php echo $strTitle; ?> " /><img src="<?php echo HOST_PICS; ?> gryph_r.gif" alt="" /></h2> </div> <?php }
function include_main_text() { global $Host; include_once 'inc/classes/clsGame.php'; $objGame = new clsGame(); $strLoginSwitch = $objGame->get_game_switch(LOGIN_STOPPER); include_once 'inc/functions/races.php'; //$arrRaces = getRaces(); //$strRace = $arrRaces[$iRand = rand(1,15)]; //$arrRandRace = getUnitVariables($strRace); //changed to use clsRace - AI require_once 'inc/races/clsRace.php'; $arrRaces = clsRace::getActiveRaces(); $strRace = $arrRaces[$iRand = rand(1, count($arrRaces) - 1)]; $arrRandRace = getUnitVariables($strRace); ?> <div id="text" style="height: 85px;"> <div id="login"> <h2><img src="<?echo $Host;?>first_login.gif" alt="Login" height="26" /></h2> <p> <?php if ($strLoginSwitch == 'on' && !isset($_GET['stagepass'])) { ?> <em style="color: lightgreen;">Logins are temporarily disabled.</em> </h2> <p>(We're probably just updating the game so be back soon!)</p> <?php } else { ?> <form action="main.php?cat=main&page=login2" method="post"> <label for="1" class="hidden">Username</label> <input maxlength="20" name="login[username]" size="9" class="login" id="1"/> <label for="2" class="hidden">Password</label> <input maxlength="20" name="login[password]" size="9" type="password" class="password" id="2"/> <input type="submit" name="LoginButton" value="Login" align="middle" class="submit" /> or <a href="main.php?cat=main&page=register1">Sign Up!</a> </form> </p> <?php } /* $age1 = mktime(0,0,0,9,3,2006); //hours,mins,secs,month,day,year $timediff = $age1 - time(); $days = intval($timediff / 86400); $remain = $timediff % 86400; $hours = intval($remain / 3600); $remain = $remain % 3600; $mins = intval($remain / 60); if ($timediff > 0) echo ' <i style="color: lightgreen;">New Age Start: <br/>'; if ($days > 1) echo $days . ' days left'; elseif ($days == 1) echo $days . ' day left'; elseif ($hours > 1) echo $hours . ' hours left'; elseif ($hours == 1) echo $hours . ' hour left'; elseif ($hours == 0 && $mins > 0) echo $mins . ' minutes left!'; if ($timediff > 0) echo "</i>"; */ // Martel: Safety caution - Do not help kiddies find usernames or guess pws if (isset($_GET['error'])) { switch ($_GET['error']) { case 'error': echo '<p>' . 'Wrong name or password, please try again.' . '</p>'; break; case 'empty': echo '<p>' . 'Empty form, please fill in and try again.' . '</p>'; break; } } ?> </div> <div id="teaser"> <p>ORKFiA is an excellent <strong>online strategy game</strong> in a fantasy setting. Play in alliances together with your friends, at work, in school or at home, and become the greatest leader of all.</p> </div> </div> <div id="columns"> <div id="intro"> <div class="center"> <h2>Global Game News</h2> </div> <?php include_once 'inc/pages/global_news.inc.php'; // Show Global News echo showGlobalNews('tiny'); ?> <div id="text"> <h2><img src="<?echo $Host;?>first_join.gif" alt="Join" height="26" /></h2 <p>Create and lead your very own tribe inside Orkfia, for absolutely no cost. Go here to <a href="main.php?cat=main&page=sponsors">Sign Up!</a></p> <h2><img src="<?echo $Host;?>first_chat.gif" alt="Chat" height="26" /></h2> <p>Talk to staff and active players in our IRC-channel: <a href="irc://irc.netgamers.org/orkfia" target="_blank" class="newWindowLink">#orkfia</a></p> </div <div class="center" style="text-align: left;"> <h2 style="margin: 0px auto; margin-top: 10px; text-align: center;">Game Stats</h2> <?php //========================================================================== // Martel, December 07, 2006 // Age display, identical except for "month" to what is in layout.php //========================================================================== include_once 'inc/classes/clsGame.php'; $objGame = new clsGame(); $iGameHours = $objGame->get_game_time(HOUR_COUNTER); $iAgeNumber = $objGame->get_game_time(AGE_NUMBER); // age stuff include_once 'inc/classes/clsAge.php'; $objAge = new clsAge(); $blnCheck = $objAge->loadAge($iAgeNumber); // either FALSE or TRUE // display stuff include_once 'inc/functions/orktime.php'; $arrAgeDisplays = get_age_displays($objGame, $objAge, $blnCheck); $arrOrkDate = hoursToYears($iGameHours); // Months $strMonths = ""; if ($arrOrkDate['months'] > 0) { $strMonths = "Month " . $arrOrkDate['months'] . ", "; } $arrAgeDisplays = get_age_displays($objGame, $objAge, $blnCheck); // Alliance $arrGameHistorys = $objGame->get_historys($arrOrkDate['years']); $strTopAlliance = 'Top Alliance: ' . $arrGameHistorys[ALLI_NAME] . ' (#' . $arrGameHistorys[ALLI_ID] . ')'; // queries for stats $strSQL1 = 'SELECT (COUNT(id) / 2) as wars FROM war WHERE target > 0 LIMIT 1'; $strSQL2 = 'SELECT COUNT(id) as alliances FROM ' . ALLIANCE . ' WHERE id > 10 LIMIT 1'; $strSQL3 = 'SELECT COUNT(id) as players FROM user LIMIT 1'; $strSQL4 = 'SELECT COUNT(id) as oldies FROM user WHERE hours > 948 LIMIT 1'; $strSQL5 = 'SELECT AVG(land) as avg_land FROM build,user WHERE user.hours > 948 LIMIT 1'; $iWars = intval(mysql_result(mysql_query($strSQL1), 0)); $iAlliances = mysql_result(mysql_query($strSQL2), 0); $iPlayers = mysql_result(mysql_query($strSQL3), 0); $iOldies = mysql_result(mysql_query($strSQL4), 0); $iAvgLand = mysql_result(mysql_query($strSQL5), 0); echo '<p>' . "Currently in ORKFiA there are <strong style=\"font-size: 1.5em;\">{$iWars}</strong> ongoing wars, <strong style=\"font-size: 1.5em;\">{$iAlliances}</strong> alliances and <strong style=\"font-size: 1.5em;\">{$iPlayers}</strong> tribes." . '</p>'; // '<h2>Game Configuration</h2>' . // '<p>' . // "Max alliances: " . MAX_ALLIANCES . " <br />" . // "Tribes per alliance: " . MAX_ALLIANCE_SIZE . " <br />" . // "Average tribes per alliance: " . round($iPlayers / $iAlliances) . " <br />" . // "Average size of tribes with 5 years to live: " . number_format($iAvgLand) . " acres <br />" . // '</p>'; //========================================================================== // end nonsense ;) //========================================================================== ?> </div> </div> <div id="donate"> <div id="text" style="text-align: left;"> <h2><img src="<?echo $Host;?>first_intro.gif" alt="Strategy Game Introduction" height="26" /></h2> <p><span class="highlight">Grow your tribe in a real time environment</span>, teamed together with friends in an effort to become the largest, strongest and most famous of all alliances!</p> <p>You have to execute the right strategy to grow large, strong and famous. There are <span class="highlight">many strategies to choose</span>. Your tribe can grow by the valuables your citizens find in the mines, or they can do research in many fields to improve your efficiency, defense, power and production.</p> <p>The other possibility is to <span class="highlight">kill those who oppose you</span>. Once all your enemies have perished, you will <span class="highlight">be the greatest leader the world has ever seen</span>.</p> </div> </div> </div> <?php }
function call_age_handler_text() { global $tool; include_once 'inc/functions/resort_tools.php'; if (!user_has_access($tool)) { echo "Sorry, this page is restricted to ORKFiA Staff"; include_game_down(); exit; } $objGame = new clsGame(); //========================================================================== // Take care of sent form data //========================================================================== if (isset($_POST['i_age_start']) && isset($_POST['i_age_end'])) { // Get post variables $iAgeStart = $_POST['i_age_start']; $iAgeEnd = $_POST['i_age_end']; // Get last age's id or 0 $iLastAge = 0; $iLastAge = mysql_result(mysql_query("SELECT age_number FROM ages ORDER BY age_number DESC LIMIT 0, 1"), 0); $iLastAge++; // Instantiate object and save to db $objNewAge = new clsAge($iLastAge, $iAgeStart, $iAgeEnd); $objNewAge->saveAge(); } elseif (isset($_POST['i_age_to_make_now'])) { $iAgeToMakeNow = $_POST['i_age_to_make_now']; $objGame->set_game_time(AGE_NUMBER, $iAgeToMakeNow); } elseif (isset($_POST['i_age_to_delete'])) { $iAgeToDelete = $_POST['i_age_to_delete']; $objNewAge = new clsAge($iAgeToDelete); $objNewAge->deleteAge(); } //========================================================================== // Show Task Links //========================================================================== echo 'Select Task:' . '<br /><br />' . ' | ' . '<a href="main.php?cat=game&page=resort_tools' . '&tool=' . $tool . '&show=create">Create Age</a>' . ' | ' . '<a href="main.php?cat=game&page=resort_tools' . '&tool=' . $tool . '&show=remove">Remove Age</a>' . ' | ' . '<a href="main.php?cat=game&page=resort_tools' . '&tool=' . $tool . '&show=current">Current Age</a>' . ' | ' . '<br /><br />'; //========================================================================== // Show table with existing ages //========================================================================== echo $strAgesTable = '<table class="small" cellspacing="0" cellpadding="0">' . '<tr class="header">' . '<th colspan="3">' . 'Ages' . '</th>' . '</tr>' . '<tr class="subheader">' . '<th>' . "Age #" . '</th>' . '<th class="right">' . "Start" . '</th>' . '<th class="right">' . "End" . '</th>' . '</tr>'; $resSQL = mysql_query("SELECT * FROM ages ORDER BY age_number ASC"); while ($arrRES = mysql_fetch_array($resSQL)) { echo $strAgesTable = '<tr class="data">' . '<th>' . $arrRES['age_number'] . '</th>' . '<td>' . $arrRES['year_start'] . ' OE</td>' . '<td>' . $arrRES['year_end'] . ' OE</td>' . '</tr>'; } echo $strAgesTable = '</table>' . '<br />'; //========================================================================== // Which option page to show //========================================================================== $strShow = ''; if (isset($_GET['show'])) { $strShow = strval($_GET['show']); } switch ($strShow) { case "create": echo $strForm = '<form method="post" action="main.php?cat=game&page=resort_tools&tool=' . $tool . '&show=create">' . '<label>First Year of new age: ' . '<input type="text" size="6" maxlength="4" name="i_age_start" />' . '</label>' . '<br /><br />' . '<label>Last Year of new age: ' . '<input type="text" size="6" maxlength="4" name="i_age_end" />' . '</label>' . '<br /><br />' . '<input type="submit" value="Create" />' . '<br /><br />' . '</form>'; break; case "remove": $iLastAge = @mysql_result(mysql_query("SELECT age_number FROM ages ORDER BY age_number DESC LIMIT 0, 1"), 0); echo $strForm = '<form method="post" action="main.php?cat=game&page=resort_tools&tool=' . $tool . '&show=remove">' . '<label>Age to Remove: ' . '<input type="text" size="6" maxlength="4" name="i_age_to_delete" value="' . $iLastAge . '" />' . '</label>' . '<br /><br />' . '<input type="submit" value="Remove" />' . '<br /><br />' . '</form>'; break; case "current": $iAgeNumber = $objGame->get_game_time(AGE_NUMBER); echo $strForm = '<form method="post" action="main.php?cat=game&page=resort_tools&tool=' . $tool . '&show=current">' . '<label>Current Age: ' . '<input type="text" size="6" maxlength="4" name="i_age_to_make_now" value="' . $iAgeNumber . '" />' . '</label>' . '<br /><br />' . '<input type="submit" value="Save New" />' . '<br /><br />' . '</form>'; break; } }