function get_age_displays(&$objGame, &$objAge, $blnCheck) { $iGameHours = $objGame->get_game_time(HOUR_COUNTER); $strAge = ''; $strAgeExtra = ''; if ($blnCheck == TRUE) { // Output for "Age X" $strAge = 'Age ' . $objAge->getAgeNumber(); $iOrkDate = hoursToYears($iGameHours); if ($objAge->getFirstYear() <= $iOrkDate['years'] + 14 && $objAge->getLastYear() > $iOrkDate['years']) { $more_than = ''; // Calculate difference between "current hour" and "hour of age start" $iStartHours = yearsToHours($objAge->getFirstYear()); $arrODUntilStart = yearsBetweenHours($iStartHours, $iGameHours); // and "hour of age end" $iEndHours = yearsToHours($objAge->getLastYear()); $arrODUntilEnd = yearsBetweenHours($iEndHours, $iGameHours); // if time left is more than 2 years we hide months and add "more than" if ($arrODUntilStart['years'] >= 2) { $more_than = "more than "; } elseif ($iStartHours == 0 && $arrODUntilEnd['years'] >= 2) { $more_than = "more than "; } // It will start counting down from 14 years if ($arrODUntilStart['years'] < 14 && ($arrODUntilStart['years'] > 0 || $arrODUntilStart['months'] > 0)) { $strAgeExtra .= get_correct_language($arrODUntilStart, 'This age will start in ' . $more_than); } elseif ($arrODUntilEnd['years'] < 14 && ($arrODUntilEnd['years'] > 0 || $arrODUntilEnd['months'] > 0)) { $strAgeExtra = get_correct_language($arrODUntilEnd, 'This age will end in ' . $more_than); } } else { $strAge = '"Between Ages Time"'; } } else { $strAge = '"Between Ages Time"'; } $arrReturn['str_age'] = $strAge; $arrReturn['str_age_extra'] = $strAgeExtra; return $arrReturn; }
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_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_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 }