function include_explore2_text() { global $Host; $objSrcUser =& $GLOBALS["objSrcUser"]; $explored_acres = intval($_POST['explored_acres']); include_once 'inc/functions/explore.php'; $iMaxAcres = getMaxExplore($objSrcUser); $arrExploreCost = getExploreCosts($objSrcUser); $money_used = $explored_acres * $arrExploreCost['crowns']; $used_citizens = $explored_acres * $arrExploreCost['citizens']; $used_basics = $explored_acres * $arrExploreCost['basics']; include_once 'inc/functions/races.php'; $arrUnitVars = getUnitVariables($objSrcUser->get_stat(RACE)); $arrUnitNames = $arrUnitVars['output']; $strRace = $objSrcUser->get_stat(RACE); if ($strRace == 'Nazgul') { echo $strDiv = '<div id="textMedium"><p>' . "Your proud nazgul military will not lower itself to exploring for land." . '</p></div>'; include_game_down(); exit; } if ($explored_acres < 1) { echo $strDiv = '<div id="textMedium"><p>' . "You tried to explore 0 acres." . '<br /><br />' . '<a href="main.php?cat=game&page=explore">' . "Try Again ?" . "</a>" . '</p></div>'; include_game_down(); exit; } $iCitz = $objSrcUser->get_pop(CITIZENS); $iNewCitz = $iCitz - $used_citizens; if ($iNewCitz < 800) { echo $strDiv = '<div id="textMedium"><p>' . "Exploring this many acres would result in less than 800 citizens " . "remaining on your lands. Your citizens refuse to venture forth." . '<br /><br />' . '<a href="main.php?cat=game&page=explore">' . "Try Again ?" . "</a>" . '</p></div>'; include_game_down(); exit; } $arrSpells = $objSrcUser->get_spells(); if ($arrSpells[STUNTED_GROWTH] > 0) { echo $strDiv = '<div id="textMedium"><p>' . "Bewitched by your enemies, your exploration team do not dare " . "prospecting new lands for yet another " . $arrSpells[STUNTED_GROWTH] . " months." . '<br /><br />' . '<a href="main.php?cat=game&page=explore">' . "Try Again ?" . "</a>" . '</p></div>'; include_game_down(); exit; } $iMaxExplore = getMaxExplore($objSrcUser); if ($explored_acres > $iMaxExplore) { echo $strDiv = '<div id="textMedium"><p>' . "You tried to explore {$explored_acres} acres, however you can " . "only explore {$iMaxExplore} acres. " . "<br /><br />" . "You can send expeditions out to explore a maximum of 25% of " . "your current acres plus incoming." . '<br /><br />' . '<a href="main.php?cat=game&page=explore">' . "Try Again ?" . "</a>" . '</p></div>'; include_game_down(); exit; } else { if (doExplore($objSrcUser, $explored_acres)) { // Return HTML Output $plural = 's'; if ($explored_acres == 1) { $plural = ''; } echo $strDiv = '<div id="textMedium">' . '<h2>' . 'Explore Report' . '</h2>' . '<p>' . "Congratulations, you have explored " . "<b>" . number_format($explored_acres) . " acre{$plural}</b>." . '</p><p>' . "This expedition cost you <b>" . number_format($money_used) . " crowns</b> and required <b>" . number_format($used_citizens) . " " . strtolower($arrUnitNames[1]) . "s</b> and <b>" . number_format($used_basics) . " " . strtolower($arrUnitNames[2]) . "s</b> to send off." . '</p><p align="center">' . '<img src="' . $Host . 'explorers_medium.gif" width="375" />' . '</p><p>' . "Your new land will be ready for construction in <b>4 months</b>." . '</p><p>' . '<a href="main.php?cat=game&page=explore">Continue</a>' . "</p></div>"; } else { echo '<div class="center">' . "Your explore seem to have failed, please check your tribe " . "for any eventual errors caused by this, and report these " . "together with your tribe name and alliance # to an admin." . "<br />Thank you, and sorry for any inconvenience caused by " . "this."; echo "<br><br><a href=main.php?cat=game&page=explore>Return to Exploration</a></div"; } } }
function getPriceArray(&$objUser) { include_once 'inc/functions/races.php'; $arrUnitVariables = getUnitVariables($objUser->get_stat(RACE)); $arrUnitCost = $arrUnitVariables['gold']; $arrMarketCost[UNIT1] = $arrUnitCost[2] * 2 + 15; $arrMarketCost[MONEY] = 2; $arrMarketCost[WOOD] = 34; $arrMarketCost[FOOD] = 3; return $arrMarketCost; }
function get_tribe_table(&$objUser) { global $arrStats; include_once 'inc/functions/military.php'; include_once 'inc/functions/races.php'; include_once 'inc/functions/magic.php'; include_once 'inc/functions/population.php'; $arrBuild = $objUser->get_builds(); $iAcres = $arrBuild[LAND]; $iBarren = $objUser->get_barren(); $arrStats = $objUser->get_stats(); $arrGoods = $objUser->get_goods(); $arrPopulation = getPopulation($objUser); $arrArmys = $objUser->get_armys(); $iMageLevel = get_mage_level($objUser); $userid = $objUser->get_userid(); $iStrength = $objUser->get_strength(); $iRulerAge = getRulerAge($objUser); // $iSpells = getActiveSpells($objUser); $arrUnitVars = getUnitVariables($arrStats[RACE]); $arrUnitNames = $arrUnitVars['output']; $total_defence = getArmyDefence($objUser); $total_defence = $total_defence['raw']; $suicidal_offence = getArmyOffence($objUser); $suicidal_offence = $suicidal_offence['raw']; $offencePerAcre = ceil($suicidal_offence / $iAcres); $defencePerAcre = ceil($total_defence / $iAcres); $iMilitaryUnits = $arrArmys[UNIT1] + $arrArmys[UNIT2] + $arrArmys[UNIT3] + $arrArmys[UNIT4]; //========================================================================== // Stop people from avoiding the tribe page so they dont get updated //========================================================================== include_once 'inc/functions/update_ranking.php'; doUpdateRankings($objUser, 'yes'); $strServerTime = date("H:i:s"); $res = "<table class=\"medium\" cellpadding=\"0\" cellspacing=\"0\">" . "<tr class=\"header\">" . "<th colspan=\"5\">" . stripslashes($arrStats['tribe']) . " (#" . $arrStats['kingdom'] . ")" . "</th>" . "</tr>" . "<tr class=\"subheader\">" . "<th width=\"120px\">" . "Type" . "</th>" . "<td width=\"165px\">" . "Info" . "</td>" . "<td width=\"30px\">" . " " . "</td>" . "<th width=\"120px\">" . "Type" . "</th>" . "<td width=\"165px\">" . "Info" . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Ruler Age:" . "</th>" . "<td>" . $iRulerAge . " Years" . "</td>" . "<td>" . " " . "</td>" . "<th>" . "Fame:" . "</th>" . "<td>" . number_format($arrStats['fame']) . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Race:" . "</th>" . "<td>" . $arrStats['race'] . "</td>" . "<td>" . " " . "</td>" . "<th>" . "Strength:" . "</th>" . "<td>" . number_format($iStrength) . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . $arrUnitNames[1] . "s:" . "</th>" . "<td>" . number_format($arrPopulation['citizens']) . "</td>" . "<td>" . " " . "</td>" . "<th>" . "Military Units:" . "</th>" . "<td>" . number_format($iMilitaryUnits) . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Mage Level:" . "</th>" . "<td>" . $iMageLevel . "</td>" . "<td>" . " " . "</td>"; if ($arrStats[RACE] == 'Templar') { $res .= "<th>" . "Mystics:" . "</th>"; } else { $res .= "<th>" . "Thieves:" . "</th>"; } $res .= "<td>" . number_format($arrArmys['unit5']) . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Raw Offence:" . "</th>" . "<td>" . $offencePerAcre . " OPA</td>" . "<td>" . " " . "</td>" . "<th>" . "Raw Defence:" . "</th>" . "<td>" . $defencePerAcre . " DPA</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Barren Land:" . "</th>" . "<td>" . number_format($iBarren) . "</td>" . "<td>" . " " . "</td>" . "<th>" . "Land:" . "</th>" . "<td>" . number_format($iAcres) . "</td>" . "</tr>" . "</table>" . '<div class="center" style="font-size: 0.8em">' . 'Server Time: ' . $strServerTime . '</div>'; return $res; }
function getArmyDefence(&$objUser, $attack_type = '') { $arrUnitInfo = getUnitVariables($objUser->get_stat(RACE)); $arrUnitDefence = $arrUnitInfo['defence']; // Raw deffence $arrArmy = $objUser->get_armys(); $raw_defence = $arrArmy[UNIT1] * $arrUnitDefence[2] + $arrArmy[UNIT2] * $arrUnitDefence[3] + $arrArmy[UNIT3] * $arrUnitDefence[4] + $arrArmy[UNIT4] * $arrUnitDefence[5] + $arrArmy[UNIT5] * $arrUnitDefence[6]; // Bonus From Walls $arrBuildBonus = getBuildBonuses($objUser); $wall_bonus = floor($raw_defence * $arrBuildBonus['defence']); // Bonus From Science $arrSci = getSciences($objUser->get_stat(ALLIANCE)); $research_bonus = floor($raw_defence * $arrSci['def']); // Bonus From Spells $arrSpellBonus = getSpellBonuses($objUser); $spell_bonus = floor($raw_defence * $arrSpellBonus['defence']); // Total $total = $raw_defence + $wall_bonus + $research_bonus + $spell_bonus; // Total Home $arrArmyHome = $objUser->get_armys_home(); $raw_defence_home = $arrArmyHome[UNIT1] * $arrUnitDefence[2] + $arrArmyHome[UNIT2] * $arrUnitDefence[3] + $arrArmyHome[UNIT3] * $arrUnitDefence[4] + $arrArmyHome[UNIT4] * $arrUnitDefence[5] + $arrArmyHome[UNIT5] * $arrUnitDefence[6]; // this'll add 15% to raw, fixed now - AI 16/11/06 //if ($attack_type == ATTACK_RAID) // $raw_defence_home *= 1.15; $home_raid = 0; if ($attack_type == ATTACK_RAID) { $home_raid = floor($raw_defence_home * 0.15); } $home_spell = floor($raw_defence_home * $arrSpellBonus['defence']); $home_research = floor($raw_defence_home * $arrSci['def']); $home_walls = floor($raw_defence_home * $arrBuildBonus['defence']); $total_home = $raw_defence_home + $home_spell + $home_research + $home_walls + $home_raid; $defence['raw'] = $raw_defence; $defence['building_bonus'] = $wall_bonus; $defence['research_bonus'] = $research_bonus; $defence['spell_bonus'] = $spell_bonus; $defence['total'] = $total; $defence['total_home'] = $total_home; return $defence; }
function get_military_returning_table(&$objUser) { $arrArmy = $objUser->get_armys(); $arrMilReturns = $objUser->get_milreturns(); include_once 'inc/functions/races.php'; $arrUnitInfo = getUnitVariables($objUser->get_stat(RACE)); $arrUnitVars = $arrUnitInfo['variables']; $arrUnitNames = $arrUnitInfo['output']; // Start military returning advisor $returning = "<table class=\"medium\" cellpadding=\"0\" cellspacing=\"0\">" . "<tr class=\"header\">" . "<th colspan=\"6\">" . "Military Returning" . "</th>" . "</tr>" . "<tr class=\"subheader\">" . "<th>" . "Class" . "</th>" . "<td>" . "Home" . "</td>" . "<td>" . "In 1" . "</td>" . "<td>" . "In 2" . "</td>" . "<td>" . "In 3" . "</td>" . "<td>" . "In 4" . "</td>" . "</tr>"; reset($arrUnitVars); foreach ($arrUnitVars as $key => $value) { if ($value != "citizen") { $plural = 's'; if ($arrUnitNames[$key] == 'Swordmen') { $plural = ''; } if ($arrUnitNames[$key] == 'Pikemen') { $plural = ''; } if ($arrUnitNames[$key] == 'Crossbowmen') { $plural = ''; } if ($arrUnitNames[$key] == 'Longbowmen') { $plural = ''; } if ($arrUnitNames[$key] == 'Thief') { $arrUnitNames[$key] = 'Thieve'; } if ($arrUnitNames[$key] == 'Priestess') { $plural = ''; } if ($arrUnitNames[$key] == 'Mummy') { $arrUnitNames[$key] = 'Mummie'; } $intArmyHome = $arrArmy[$value] - ($arrMilReturns[$value . "_t1"] + $arrMilReturns[$value . "_t2"] + $arrMilReturns[$value . "_t3"] + $arrMilReturns[$value . "_t4"]); $returning .= "<tr class=\"data\">" . "<th>" . $arrUnitNames[$key] . $plural . "</th>" . "<td>" . number_format($intArmyHome) . "</td>"; for ($intUnitTimeLoop = '1'; $intUnitTimeLoop <= '4'; $intUnitTimeLoop++) { $strKey = $value . "_t" . $intUnitTimeLoop; $val = number_format($arrMilReturns[$strKey]); if ($val == '0') { $returning .= "<td>" . $val . "</td>"; } else { $returning .= "<td class=\"incoming\">" . $val . "</td>"; } } $returning .= "</tr>"; } } $returning .= "</table>"; return $returning; }
function include_main_text() { global $Host; // Show / hide content from registered users vs non-registered ones (Martel) $strNotForRegistered = ' style=""'; $strNotForGuests = ' style=""'; if (isset($_COOKIE['check'])) { $strNotForRegistered = ' style="visibility: hidden; display: none;"'; } else { $strNotForGuests = ' style="visibility: hidden; display: none;"'; } include_once 'inc/classes/clsGame.php'; $objGame = new clsGame(); $strLoginSwitch = $objGame->get_game_switch(LOGIN_STOPPER); include_once 'inc/functions/races.php'; //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="textBig" style="height: 110px;"> <div id="login"> <h2><img src="<?echo $Host;?>first_login.gif" alt="Login" height="26" /></h2> <?php if ($strLoginSwitch == 'on' && !isset($_GET['stagepass'])) { ?> <p> <em class="positive">Logins are temporarily disabled.</em> </p> <p><em>(The gods are updating Orkfia, so be back soon.)</em></p> <?php } else { ?> <form action="main.php?cat=main&page=login2" method="post"> <label for="i1" class="hidden">Username</label> <input maxlength="20" name="login[username]" size="9" class="login" id="i1"/> <label for="i2" class="hidden">Password</label> <input maxlength="20" name="login[password]" size="9" type="password" class="password" id="i2"/> <input type="submit" name="LoginButton" value="Login" class="submit" /> or <a href="main.php?cat=main&page=register1">Sign Up!</a> </form> <?php } // 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; } } // <p>ORKFiA is an <strong>excellent strategy <abbr title="Persistent Browser Based Game"><a href="http://www.pbbg.org/" title="Persistent Browser Based Game" class="gloss">PBBG</a></abbr></strong> ?> </div> <div id="teaser"> <br /> <h3><?php echo SERVER_TAGLINE; ?> </h3> <p>ORKFiA is an <strong>excellent strategy <abbr title="Persistent Browser Based Game">PBBG</abbr></strong> in a fantasy setting.</p> </div> </div> <div id="columns"> <div id="leftcolumn"> <div class="text"<?echo $strNotForRegistered;?>> <h2><img src="<?echo $Host;?>first_intro.gif" alt="Introduction" height="26" /></h2> <?php if ($_SERVER['SERVER_NAME'] == DINAH_SERVER_NAME) { ?> <p>Before ORKFiA Infinity there was a time of furious battles and desperate struggles, but also a time of innocence. The inhabitants of the world Orkfia, who we know as Orkfians, were ruled over by the Empyreons. The Empyreons, who are an unknown species summoned to lead and organize tribes of all known races, were battling against time and against each others, in a futile war that would always end with the Comet's impact. Their rescue, and also their curse, was the time spell which would restore the lands of Orkfia to its untouched state a hundred years back in time. This Era has since been called the Eternal Occurrence, and was ended when the spell's effect wore off and the Comet finally hit Orkfia. Year 93 OE Orkfia was freed from the effects of the time spell, or was it?</p> <h3>Classic ORKFiA: Return of the Comet</h3> <p>The classic version of ORKFiA will take you, as a player, back to where it all started, as one of the Empyreons during the age of the Eternal Recurrence (<strong>10 - 93 OE</strong>). Beginning in a world that have just learnt the tactics of war, the deceitfulness of thieves, the devastation of magic and the fine arts of politics. Once more the world will continually be recreated by the time spell, and the Orkfians will battle against time, and each other, to take control over the world before it disintegrates. </p> <p>We welcome you as a member, and perhaps even as a sponsoring dragon to fund the ongoing of this game, to sign up for the next age in this classic renewal of ORKFiA.</p> <ul> <li><a href="main.php?cat=main&page=register1">Sign Up!</a> </li> </div> <?php } else { ?> <div class="center"><img src="<?php echo HOST_PICS; ?> fighter.gif" title="Invade other tribes to conquer land and resources" alt="" /><img src="<?php echo HOST_PICS; ?> wizard.gif" title="The mystics can cause devastating damage to your enemies" alt="" /><img src="<?php echo HOST_PICS; ?> thief.gif" title="The thieves are usually considered scum, but in war times you need every asset available" alt="" /></div> <p>Grow your tribe in a <span class="highlight" title="Each hour the game is updated 1 time" style="border-bottom: 1px dotted;">real time</span> environment, teamed together <span class="highlight">with friends</span> 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 many strategies to choose. Your tribe can <span class="highlight">grow</span> by the valuables your citizens find in the mines, or they can <span class="highlight"> do research</span> to improve your efficiency, defense, power and production.</p> <p>The other possibility is to <span class="highlight">kill those who oppose you</span>.</p> <p>Once all your enemies have perished, you will be the greatest leader the world has ever seen.</p> <ul> <li><a href="main.php?cat=main&page=register1">Sign Up!</a> </li> </div> <?php } include_once 'inc/pages/global_news.inc.php'; // Show Global News echo "<br />"; echo showGlobalNews('tiny'); ?> </div> <div id="rightcolumn"> <div class="text"<?echo $strNotForRegistered;?>> <h2><img src="<?echo $Host;?>first_faq.gif" alt="FAQ" height="26" /></h2> <p>Is this your first visit to ORKFiA? If you are a novice—or just curious—<a href="main.php?cat=main&page=faq">we recommend our FAQ</a> with answers to some of the most common questions about this game.</p> </div> <div class="text"<?echo $strNotForRegistered;?>> <h2><img src="<?echo $Host;?>first_join.gif" alt="Join" height="26" /></h2> <p>ORKFiA comes in two versions, both with hundreds of players and both for free. So it's really up to you, do you want to <span class="highlight">play with or without resets</span> between rounds?</p> <ul> <li><a href="http://orkfia.phpsupport.se/main.php?cat=main&page=register1">Infinity Sign Up!</a> (Play until you die)</li> <li><a href="http://dinah.phpsupport.se/main.php?cat=main&page=register1">Classic Sign Up!</a> (Resets between each round)</li> </ul> </div> <div class="text"<?echo $strNotForGuests;?>> <h2><img src="<?echo $Host;?>first_sponsors.gif" alt="Sponsor" height="26" /></h2> <p>ORKFiA owes its success to a dedicated player base. It is very easy to help:</p> <ul> <li>Donate and <a href="main.php?cat=main&page=sponsors">Become a <em>Dragon</em></a></li> <li>Link to <a href="<?php echo HOST; ?> ">ORKFiA <?php echo SERVER_TAGLINE; ?> </a></li> </ul> <div class="center"> <a href="http://orkfia.phpsupport.se/"> <img src="<?php echo HOST_PICS; ?> promotional/ork-button.png" alt="" border="0" /></a> <a href="http://dinah.phpsupport.se/"> <img src="<?php echo HOST_PICS; ?> promotional/ork-button-classic.png" alt="" border="0" /></a><br /><br /> </div> </div> <div class="text"<?echo $strNotForRegistered;?>> <h2><img src="<?echo $Host;?>first_forum.gif" alt="Forum" height="26" /></h2> <p>If you are curious about what happens inside Orkfia, you are most welcome to have a sneak peek. No need to sign up, just go ahead and lurk!</p> <ul> <li><a href="main.php?cat=main&page=forums&set=news&mode=threads">Announcements</a></li> <li><a href="main.php?cat=main&page=forums&set=world&mode=threads">World Forum</a></li> <li><a href="main.php?cat=main&page=forums&set=game&mode=threads">Game Talk</a></li> </ul> </div> <div class="text"<?echo $strNotForGuests;?>> <h2><img src="<?echo $Host;?>first_chat.gif" alt="Chat" height="26" /></h2> <p>Talk to staff and active players in our IRC-channels:</p> <ul> <li><a href="irc://irc.netgamers.org/orkfia" target="_blank" class="newWindowLink">#orkfia</a> (official)</li> <li><a href="irc://irc.netgamers.org/orkfia-classic" target="_blank" class="newWindowLink">#orkfia-classic</a> (official)</li> <li><a href="irc://irc.netgamers.org/orkfiafunroom" target="_blank" class="newWindowLink">#orkfiafunroom</a></li> </ul> </div> <div class="text" <?echo substr($strNotForRegistered, 0, -1) . ' text-align: center;"';?>> <h2><img src="<?echo $Host;?>first_guide.gif" alt="Player's Strategy Guide" height="26" /></h2> <table class="small" cellpadding="0" cellspacing="0" style="margin: 0 auto;"> <tr class="header"> <th colspan="5">Featured: Race <?php echo $iRand . ' of ' . (count($arrRaces) - 1) . ' - <i>' . $strRace; ?> </i></th> </tr> <tr class="subheader"> <th>Class</th> <th>Unit Name</th> <th><span class="militstats" style="color: #000;">Offence</span></th> <th><span class="militstats" style="color: #000;">Defence</span></th> <th class="right">Gold</th> </tr> <?php $arrClass = array(2 => 'Basic', 'Specialist', 'Specialist', 'Elite', 'Thief'); foreach ($arrClass as $i => $strClass) { ?> <tr class="data"> <th><?php echo $strClass; ?> </th> <td class="left"><?php echo $arrRandRace['output'][$i]; ?> </td> <td class="center"><span class="militstats"><?php echo $arrRandRace['offence'][$i]; ?> </span></td> <td class="center"><span class="militstats"><?php echo $arrRandRace['defence'][$i]; ?> </span></td> <td><?php echo number_format($arrRandRace['gold'][$i]); ?> </td> </tr> <?php } ?> </table> <p>Let your journey start at <a href="<?php echo HOST_GUIDE; ?> " target="_blank" class="newWindowLink">the Player Guide</a></p> </div> </div> <?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 '<div class="clear"><hr /></div>' . '<div class="text">' . '<h3>Game Overview</h3>' . '<p>' . "<strong>{$iWars}</strong> ongoing wars, <strong>{$iAlliances}</strong> alliances and <strong>{$iPlayers}</strong> tribes. <strong>{$iOldies}</strong> are dying, <strong>more</strong> will be killed." . '</p>' . '<p>' . 'ORKFiA is hosted by <a href="http://phpsupport.se/" target="_blank" title="Swedish PHP & MySQL Support" class="newWindowLink">PHP Support .SE</a>' . '</p>' . '</div>'; //========================================================================== // end nonsense ;) //========================================================================== echo '</div>'; }
function include_invade_text() { global $Host; $objSrcUser =& $GLOBALS["objSrcUser"]; $arrSrcStats = $objSrcUser->get_stats(); //========================================================================== // M: Verify Alliance & Tribe ID from GET or POST //========================================================================== $iTrgAid = $arrSrcStats[ALLIANCE]; if (isset($_GET['atkid'])) { $iTrgAid = intval($_GET['atkid']); } elseif (isset($_POST['iTrgAid'])) { $iTrgAid = intval($_POST['iTrgAid']); } if ($iTrgAid < 11) { $iTrgAid = rand(11, 100); } if (isset($_GET['tribe'])) { $_GET['tribe'] = intval($_GET['tribe']); } //========================================================================== // Stop people from avoiding the tribe page so they dont get updated //========================================================================== include_once 'inc/functions/update_ranking.php'; doUpdateRankings($objSrcUser); //========================================================================== // M: Links at top of page //========================================================================== echo $topLinks = '<div class="center">' . '<a href="main.php?cat=game&page=mystic">Mystics</a> | ' . '<a href="main.php?cat=game&page=thievery">Thievery</a> | ' . '<b>Invasion</b>' . '</div>'; //========================================================================== // M: Advisor Welcome Text //========================================================================== $advisorText = '<div id="textBig">' . '<p>' . '<img src="' . $Host . 'fighter.gif" style="float: left; margin-right: 10px;" alt="Fighter" />' . "<b>Your general</b> greets you: <br />" . "From this room we can order our military to attack other tribes. An " . "invasion is a way to expand your domains or take away someone " . "else's. Attacking someone is often considered an \"act of war\" as " . "no tribe appreciates losing their acres to the enemy, so be prepared " . "for retaliations!" . "</p>" . "<p>" . "The way your military fight depends on which strategy you're using. " . "There are several different ways to engage an enemy, either " . "to conquer acres of land or to inflict damage." . "</p>"; if ($arrSrcStats[RACE] == "Oleg Hai") { $advisorText .= "<p> And don't forget, only harpies that has been bought this month (update) will join any invasions.</p>"; } $advisorText .= "</div>"; echo $advisorText; //========================================================================== // M: Invasion Table //========================================================================== echo $strColumnDivs = '<div id="columns">' . '<!-- Start left column -->' . '<div id="leftcolumn">'; // Advisor Link echo $advisorLink = '<br />' . '<div class="tableLinkSmall">' . '<a href="main.php?cat=game&page=advisors&show=military">The General</a>' . '</div>'; $strInvasionTable = '<table width="40%" cellpadding="0" cellspacing="0" class="small">' . '<tr class="header">' . '<th colspan="2">' . "Invasion" . '</th>' . '</tr>' . '<tr class="subheader">' . '<th colspan="2" class="center">' . "Select Target" . '</th>' . '</tr>' . '<tr class="data">' . '<form action="main.php?cat=game&page=invade" method="post">' . '<input type="hidden" name="iTrgAid" value="' . $iTrgAid . '" />' . '<th>' . "Alliance:" . '</th>' . '<td>' . '<input maxlength="4" size="3" name="iTrgAid" value="' . $iTrgAid . '" />' . " " . '<input type="submit" value="Change" />' . '</td>' . '</form>' . '</tr>'; if ($iTrgAid != $arrSrcStats[ALLIANCE] && $iTrgAid > 10) { $strInvasionTable .= '<tr class="data">' . '<form action="main.php?cat=game&page=invade2" method="post">' . '<th>' . "Tribe:" . '</th>' . '<td>' . '<select size="1" name="TrgPlayer">' . '<option value="spacer">' . '</option>'; //====================================================================== // New version of Damadm00's code Martel, July 10, 2006 //====================================================================== include_once 'inc/classes/clsAlliance.php'; $objTrgAlliance = new clsAlliance($iTrgAid); $arrTrgIUsers = $objTrgAlliance->get_userids(); if (!empty($arrTrgIUsers)) { foreach ($arrTrgIUsers as $iUserId) { $objTmpUser = new clsUser($iUserId); $strTribe = stripslashes($objTmpUser->get_rankings_personal(TRIBE_NAME)); if (isset($_GET['tribe']) && $_GET['tribe'] == $iUserId) { $strInvasionTable .= sprintf('<option value="%d" selected>%s</option>', $iUserId, $strTribe); } elseif (!isset($_GET['tribe']) || isset($_GET['tribe']) && $_GET['tribe'] != $iUserId) { $strInvasionTable .= sprintf('<option value="%d">%s</option>', $iUserId, $strTribe); } elseif (isset($_GET['tribe'])) { echo "Trying to exploit bugs/loopholes will get you suspended!"; } } } $strInvasionTable .= '</select>' . '</td>' . '</tr>' . '<tr class="data">' . '<th>' . "Strategy:" . '</th>' . '<td>' . '<select size="1" name="invade_type">' . '<option value="' . ATTACK_STANDARD . '">' . "Standard Attack" . '</option>' . '<option value="' . ATTACK_RAID . '">' . "Raid" . '</option>' . '<option value="' . ATTACK_BARREN . '">' . "Barren Grab" . '</option>' . '<option value="' . ATTACK_HNR . '">' . "Hit 'n' Run" . '</option>' . '<option value="' . ATTACK_BC . '">' . "Blasphemy Crusade" . '</option>' . '</select>' . '</td>' . '</tr>'; } $strInvasionTable .= '</table>'; // M: Show Invasion Table echo $strInvasionTable; echo $strColumnDivs = '</div>' . '<!-- Start right column -->' . '<div id="rightcolumn">' . '<br /><br />'; if ($iTrgAid != $arrSrcStats[ALLIANCE] && $iTrgAid > 10) { $strPrepareTable = '<table cellpadding="0" cellspacing="0" class="small">' . '<tr class="header">' . '<th colspan="3">' . "Prepare Army" . '</th>' . '</tr>' . '<tr class="subheader">' . '<th>' . "Units" . '</th>' . '<th class="right">' . "Owned" . '</th>' . '<th class="right">' . "To Send" . '</th>' . '</tr>'; // M: Get All Units with an offence Value include_once 'inc/functions/races.php'; $arrUnitVars = getUnitVariables($arrSrcStats[RACE]); $arrUnitOffence = $arrUnitVars['offence']; $arrUnitDefence = $arrUnitVars['defence']; $arrUnitVar = $arrUnitVars['variables']; $arrUnitName = $arrUnitVars['output']; $arrArmyHome = $objSrcUser->get_armys_home(); foreach ($arrUnitOffence as $i => $iUnitOffence) { if ($iUnitOffence > 0) { // M: Military Unit Names Grammar $strPlural = 's'; if ($arrUnitName[$i] == 'Swordmen') { $strPlural = ''; } if ($arrUnitName[$i] == 'Pikemen') { $strPlural = ''; } if ($arrUnitName[$i] == 'Crossbowmen') { $strPlural = ''; } if ($arrUnitName[$i] == 'Longbowmen') { $strPlural = ''; } if ($arrUnitName[$i] == 'Thief') { $arrUnitName[$i] = 'Thieve'; } if ($arrUnitName[$i] == 'Priestess') { $strPlural = ''; } if ($arrUnitName[$i] == 'Mummy') { $arrUnitName[$i] = 'Mummie'; } // Oleg Hai Exception (Elites are Mercenaries) if ($arrSrcStats[RACE] == "Oleg Hai" && $i == 5) { $arrArmyHome[$i] = $objSrcUser->get_army_merc(MERC_T3); } $strPrepareTable .= '<tr class="data">' . '<th>' . sprintf('%s%s <span class="militstats">(%d/%d)</span>', $arrUnitName[$i], $strPlural, $arrUnitOffence[$i], $arrUnitDefence[$i]) . '</th>' . '<td>' . $arrArmyHome[$arrUnitVar[$i]] . '</td>' . '<td>' . '<input size="6" maxlength="7" name="arrArmySent[' . $arrUnitVar[$i] . ']" value="0" />' . '</td>' . "</tr>"; } } $strPrepareTable .= '</table>' . '<br />' . '<input type="hidden" name="iTrgAid" value="$iTrgAid" />' . '<div class="center"><input type="submit" value="Order army into battle" /></div>' . '</form>'; } // M: Show Prepare Table if (isset($strPrepareTable)) { echo $strPrepareTable; } echo $strColumnDivs = '</div>' . '</div><div class="clear"><hr /></div>'; }
function include_reset_account_text() { global $Host; $objSrcUser =& $GLOBALS["objSrcUser"]; $arrStats = $objSrcUser->get_stats(); $iUserid = $objSrcUser->get_userid(); $arrRaces = getActiveRaces(); if ($arrStats[RESET_OPTION] == 'yes' || $arrStats[KILLED] > 0) { if (isset($_POST['submit'])) { $tribe = $_POST['tribe']; $tribe = addslashes(strip_tags(trim($tribe))); $race = $_POST['race']; // Leader should only be submitted 1 time, right after signing up if (isset($_POST['alias']) && !empty($_POST['alias'])) { $alias = $_POST['name']; $alias = addslashes(strip_tags(trim($alias))); } else { $alias = $arrStats[NAME]; } // Validate form input if (!empty($tribe) && !empty($race) && in_array($race, $arrRaces)) { // Check that the new tribe name isn't already taken $check = mysql_query("SELECT * FROM " . TBL_STAT . " WHERE tribe = '{$tribe}' AND id != {$iUserid}"); $check = mysql_fetch_array($check); $stat_search2 = mysql_query("SELECT * FROM " . TBL_STAT . " WHERE name = '{$alias}' AND id != {$iUserid}"); $stat_search2 = mysql_fetch_array($stat_search2); if (isset($check[TRIBE])) { $strDiv = '<div id="textSmall">' . '<p>' . 'Sorry, but that tribe name is already taken.' . '<br /><br />' . '<a href="main.php?cat=game&page=reset_account">' . 'Try Again?' . '</a>' . '</p>' . '</div>'; echo $strDiv; } elseif (isset($stat_search2[NAME])) { $strDiv = '<div id="textSmall">' . '<p>' . 'Sorry, but that leader name is already taken.' . '<br /><br />' . '<a href="main.php?cat=game&page=reset_account">' . 'Try Again?' . '</a>' . '</p>' . '</div>'; echo $strDiv; } else { //========================================================== // Recoded November 07, 2007 by Martel // Infinity: bonus on age death, Classic: bonus if killed // Cause of death, 2=killed, 1=age, 0=reset //========================================================== $bBonus = FALSE; if ($_SERVER['SERVER_NAME'] != DINAH_SERVER_NAME && $arrStats[KILLED] == 1) { $bBonus = TRUE; } elseif ($_SERVER['SERVER_NAME'] == DINAH_SERVER_NAME && $arrStats[KILLED] == 2) { $bBonus = TRUE; } // Race housing effeciency $arrBuildVariables = getBuildingVariables($race); $homes_hold = $arrBuildVariables['housing'][1]; $ratio = 1; // Death Bonus "Heritage" Martel, November 07, 2007 if ($bBonus && $objSrcUser->get_kill(LAND) > STARTING_LAND) { $arrKill = $objSrcUser->get_kills(); $ratio = $homes_hold / $arrKill[POP]; $iLand = $arrKill[LAND]; $arrCost = getUnitVariables($race); $arrCost = $arrCost['gold']; // New Heritage (Age9) AI+Martel, September 25, 2007 $iLand = round(pow(max(0, $iLand - STARTING_LAND), 0.80459611995) + STARTING_LAND); if ($iLand > 2000) { $iLand = 2000; } elseif ($iLand < STARTING_LAND) { $iLand = $iLand; } // Buildings $arrBonusValues[LAND] = $iLand; // Goods $arrBonusValues[RESEARCH] = 0; //round(($arrKill[RESEARCH] / $arrKill[LAND]) * $land); // Citizens $arrBonusValues[CITIZENS] = round($iLand * 15 * $ratio); // Fame $arrBonusValues[FAME] = round($arrKill[FAME] * 0.04); // Market Goods $arrBonusValues[MONEY] = round($arrKill[CASH] * $ratio); $arrBonusValues[UNIT1] = round($arrKill[BASICS] * $ratio); $arrBonusValues[CREDITS] = round(2 * $arrBonusValues[MONEY] + (2 * $arrCost[2] + 15) * $arrBonusValues[UNIT1]); } else { $arrBonusValues[LAND] = 0; $arrBonusValues[RESEARCH] = 0; $arrBonusValues[CITIZENS] = 0; $arrBonusValues[FAME] = 0; } //========================================================== // Reset Tables (excluded from this reset is TBL_USER, // TBL_STATS and TBL_PREFERENCES) //========================================================== $iNewLand = STARTING_LAND + $arrBonusValues[LAND]; include_once 'inc/functions/reset_account.php'; $arrStartValues = getStartValues($race, $iNewLand); // User table (save old but set updates to start now) $arrUsers = $objSrcUser->get_user_infos(); $arrNewUsers = array(HOURS => 0, LAST_LOGIN => date('Y-m-d H:i:s'), LAST_UPDATE_HOUR => date('H'), LAST_UPDATE_DAY => date('d')); $objSrcUser->set_user_infos($arrNewUsers); // Build Table mysql_query("DELETE FROM build WHERE id = {$iUserid}") or die("build1"); mysql_query("INSERT INTO build SET id = {$iUserid}") or die("build2"); // add land + buildings (overrides hardcoded DB defaults) $arrBuildsNew = array(LAND => $arrStartValues[LAND], HOMES => $arrStartValues[HOMES], FARMS => $arrStartValues[FARMS], MARKETS => $arrStartValues[MARKETS], YARDS => $arrStartValues[YARDS], GUILDS => $arrStartValues[GUILDS], HIDEOUTS => $arrStartValues[HIDEOUTS]); $objSrcUser->set_builds($arrBuildsNew); // Army Table mysql_query("DELETE FROM army WHERE id = {$iUserid}") or die("army"); mysql_query("INSERT INTO army SET id = {$iUserid}") or die("army2"); // add military units (overrides hardcoded DB defaults) $arrArmysNew = array(UNIT1 => $arrStartValues[UNIT1], UNIT2 => $arrStartValues[UNIT2], UNIT3 => $arrStartValues[UNIT3], UNIT4 => $arrStartValues[UNIT4], UNIT5 => $arrStartValues[UNIT5]); $objSrcUser->set_armys($arrArmysNew); // ArmyMercs Table mysql_query("DELETE FROM army_mercs WHERE id = {$iUserid}") or die("army"); if ($race == "Oleg Hai" || $race == "Mori Hai") { mysql_query("INSERT INTO army_mercs SET id = {$iUserid}") or die("army2"); if ($race == "Oleg Hai") { mysql_query("UPDATE army SET unit4 = 0 WHERE id = {$iUserid}"); } } // Milreturn Table mysql_query("DELETE FROM milreturn WHERE id = {$iUserid}") or die("milreturn"); mysql_query("INSERT INTO milreturn SET id = {$iUserid}") or die("milreturn2"); // Population Table $iNewCitz = $arrStartValues[CITIZENS] + $arrBonusValues[CITIZENS]; $objSrcUser->set_pop(CITIZENS, $iNewCitz); // Personal Rankings mysql_query("DELETE FROM rankings_personal WHERE id = {$iUserid}") or die("milreturn"); mysql_query("INSERT INTO rankings_personal SET id = {$iUserid}") or die("milreturn2"); // Goods Table mysql_query("DELETE FROM goods WHERE id = {$iUserid}") or die("goods"); mysql_query("INSERT INTO goods SET id = {$iUserid}") or die("goods2"); // Add modified starting values to Goods $arrGoodsNew = array(MONEY => $arrStartValues[MONEY], FOOD => $arrStartValues[FOOD], WOOD => $arrStartValues[WOOD], RESEARCH => $arrStartValues[RESEARCH] + $arrBonusValues[RESEARCH]); $objSrcUser->set_goods($arrGoodsNew); // Spells Table mysql_query("DELETE FROM spells WHERE id = {$iUserid}") or die("spells"); mysql_query("INSERT INTO spells SET id = {$iUserid}") or die("spells2"); // add basic self spells (overrides hardcoded DB defaults) $arrSpellsNew = array(POPULATION => $arrStartValues[POPULATION], GROWTH => $arrStartValues[GROWTH], FOOD => $arrStartValues['matawaska'], INCOME => $arrStartValues[INCOME]); $objSrcUser->set_spells($arrSpellsNew); // Thievery Table mysql_query("DELETE FROM thievery WHERE id = {$iUserid}") or die("thievery"); mysql_query("INSERT INTO thievery SET id = {$iUserid}") or die("thievery2"); // Kill Table mysql_query("DELETE FROM kills WHERE id = {$iUserid}"); mysql_query("INSERT INTO kills SET id = {$iUserid}"); // Stats table (save old but update new tribe name & race) $arrStats = $objSrcUser->get_stats(); $arrStatsNew = array(KILLED => 0, TRIBE => $tribe, RACE => $race, FAME => $arrStartValues[FAME] + $arrBonusValues[FAME], RESET_OPTION => "no", INVESTED => 0, KILLS => 0, TWG_VOTE => 0); $objSrcUser->set_stats($arrStatsNew); //========================================================== // Add bonus to build, tribe goods & alliance market //========================================================== if ($bBonus) { // add kill bonus to market credits $arrGoodsNew = array(MARKET_MONEY => $arrBonusValues[MONEY], MARKET_SOLDIERS => $arrBonusValues[UNIT1], CREDITS => $arrBonusValues[CREDITS]); $objSrcUser->set_goods($arrGoodsNew); // alliance object include_once 'inc/classes/clsAlliance.php'; $iAllianceId = $objSrcUser->get_stat(ALLIANCE); $objSrcAlliance = new clsAlliance($iAllianceId); // add bonus to alliance market $arrAllianceInfos = $objSrcAlliance->get_alliance_infos(); $arrNewAllianceInfos = array(MONEY => $arrAllianceInfos[MONEY] + $arrBonusValues[MONEY], SOLDIERS => $arrAllianceInfos[SOLDIERS] + $arrBonusValues[UNIT1]); $objSrcAlliance->set_alliance_infos($arrNewAllianceInfos); } // Update rankings (forced = yes) include_once 'inc/functions/update_ranking.php'; doUpdateRankings($objSrcUser, 'yes'); $strDiv = '<div id="textSmall">' . '<p>' . 'Account updated =)' . '<br /><br />' . '<a href="main.php?cat=game&page=tribe">' . 'Continue' . '</a>' . '</p>' . '</div>'; echo $strDiv; } } else { $strDiv = '<div id="textSmall">' . '<p>' . 'You forgot to enter a new tribe name and/or forgot to ' . 'choose a race.' . '<br /><br />' . '<a href="main.php?cat=game&page=reset_account">' . 'Try Again?' . '</a>' . '</p>' . '</div>'; echo $strDiv; } } else { $picture = 'defeat'; if ($arrStats[KILLED] == 2) { $strMessage = '<p>' . stripslashes($arrStats[NAME]) . ', it seems that <strong class="negative">your last ' . 'citizens have left your tribe</strong>. ' . 'With them the last of your power is gone and so is your physical presence in the lands of Orkfia. But, within ' . PROTECTION_HOURS . ' ' . 'months you could once again do battle with your allies. ' . '</p>'; $picture = 'defeat'; } elseif ($arrStats[KILLED] == 0) { $strMessage = '<p>' . stripslashes($arrStats[NAME]) . ', it seems that <strong class="negative">you have ' . 'decided to reset</strong>. ' . 'The last of your power is gone and so is your physical presence in the lands of Orkfia. But, within ' . PROTECTION_HOURS . ' ' . 'months you could once again do battle with your allies. ' . '</p>'; $picture = 'defeat'; } elseif ($arrStats[KILLED] == 1) { $strMessage = '<p>' . stripslashes($arrStats[NAME]) . ', it seems that <strong class="positive">the leader ' . 'of your tribe has died due to age</strong>. ' . 'The last of your power is gone and so is your physical presence in the lands of Orkfia. But, within ' . PROTECTION_HOURS . ' ' . 'months you could once again do battle with your allies. ' . '</p>'; $picture = 'victory'; } elseif ($arrStats[KILLED] == 3) { $strMessage = '<p>' . 'Welcome! It seems that <strong class="positive">you are ' . 'about to create your first tribe in Orkfia</strong>. ' . 'Currently you have no physical presence in these lands. But, within ' . PROTECTION_HOURS . ' ' . 'months you could do battle together with your allies. ' . '</p>' . '<p>' . '<label for="1">' . 'Leader Name: ' . '</label>' . '<input id="1" name="name" size="20" maxLength="20">' . '</p>'; $picture = 'victory'; } $strForm = '<form method="POST" ' . 'action="main.php?cat=game&page=reset_account">' . '<div id="textMedium">' . '<p style="text-align: center">' . '<img src="' . $Host . $picture . '_small.gif">' . '</p>' . $strMessage . '<p>' . 'Your account is now paused, time will start running once you submit the information below.' . '</p>' . '<p>' . '<label for="2">' . 'New Tribe Name: ' . '</label>' . '<input id="2" name="tribe" size="20" maxLength="20" value="' . stripslashes($arrStats[TRIBE]) . '">' . '</p>' . '<p>' . '<label for="3">' . 'Select Race: ' . '</label>' . '<select id="3" size="1" name="race">'; foreach ($arrRaces as $strCurRace) { $strAdd = ''; if ($arrStats[RACE] == $strCurRace) { $strAdd = ' selected'; } $strForm .= "<option value=\"{$strCurRace}\"{$strAdd}>" . $strCurRace . "</option>"; } $strForm .= '</select> ' . '<a href="http://guide.orkfia.org/races.php?chapter=4" class="newWindowLink" target="_blank" style="cursor: help">Races</a>' . '</p>' . '<p>' . '<input type="submit" name="submit" value="Return to Orkfia!">' . '</p>' . '</div>' . '</form>'; echo $strForm; } } else { // Kick someone in the butt for finding this page through address field include_once "inc/pages/logout.inc.php"; include_logout_text(); } }
function include_thievery_text() { global $Host, $opname, $action, $basecost; $objSrcUser =& $GLOBALS["objSrcUser"]; $iSrcId = $objSrcUser->get_userid(); $arrSrcStats = $objSrcUser->get_stats(); //========================================================================== // M: Verify Alliance & Tribe ID from GET or POST //========================================================================== $iTrgAid = $arrSrcStats[ALLIANCE]; if (isset($_GET['kd'])) { $iTrgAid = intval($_GET['kd']); } elseif (isset($_POST['kd'])) { $iTrgAid = intval($_POST['kd']); } if ($iTrgAid < 11) { $iTrgAid = rand(11, 100); } if (isset($_GET['tribe'])) { $_GET['tribe'] = intval($_GET['tribe']); } //========================================================================== // Stop people from avoiding the tribe page so they dont get updated //========================================================================== include_once 'inc/functions/update_ranking.php'; doUpdateRankings($objSrcUser); include_once "inc/functions/races.php"; $arrUnitNames = getUnitVariables($objSrcUser->get_stat(RACE)); $arrUnitNames = $arrUnitNames['output']; set_op_vars(); $land = $objSrcUser->get_build(LAND); $thieves = $objSrcUser->get_army(UNIT5); $tpa = floor($thieves / $land); $credits = floor($objSrcUser->get_thievery(CREDITS)); $op_growth = obj_thief_op_growth($objSrcUser); $hideouts = $objSrcUser->get_build(HIDEOUTS); // frost: age 18 mori hideout/home bonus, updated age 19 (Martel) if ($objSrcUser->get_stat(RACE) == "Mori Hai") { $homes = $objSrcUser->get_build(HOMES); $max_tp = floor((1 + ($hideouts + $homes / 2.5) * 2 / $land) * ($hideouts + $homes / 2.5)); } else { $max_tp = floor((1 + $hideouts * 2 / $land) * $hideouts); } if (!$iTrgAid) { $iTrgAid = $objSrcUser->get_stat(KINGDOM); } echo $topLinks = '<div class="center">' . '<a href="main.php?cat=game&page=mystic">Mystics</a> | ' . '<b>Thievery</b> | ' . '<a href="main.php?cat=game&page=invade">Invasion</a>' . '</div>'; //added templar check - AI if ($objSrcUser->get_stat(RACE) == "Templar") { echo '<div id="textMedium"><p>' . 'Your proud Templar people will not lower themselves to thievery practices.' . '</p></div>'; } else { ?> <div id='textBig'> <p> <img src="<?php echo $Host; ?> thief.gif" style="float: left; margin-right: 10px;" alt="" /> <b>The thief</b> greets you cooly:<br /> <?php if ($arrUnitNames[6] == 'Thief') { $arrUnitNames[6] = 'Thieve'; } ?> Normally <?php echo strtolower($arrUnitNames[6]); ?> s are considered scum and not wanted in a tribe, but in war-times you need every asset available. <?php echo $arrUnitNames[6]; ?> s can be useful in many ways, and the more of them you have on your lands, the safer you will be. </p> <?php echo "<p>" . "Our hideouts can provide a maximum of <b>{$max_tp} thievery points</b>, right now " . "there are <b class=\"indicator\">" . $credits . "</b> left unused. Assuming you find any use for your thieves they will " . "provide you with <b>" . $op_growth . "</b> new thievery points each month. " . "With all your thieves at home we are protected by <b class=\"indicator\">{$tpa} TPA</b> (thieves per acre). " . "</p></div>"; //========================================================================== // M: Thievery Table //========================================================================== echo $strColumnDivs = '<div id="columns">' . '<!-- Start left column -->' . '<div id="leftcolumn">'; // Advisor Link echo $advisorLink = '<br />' . '<div class="tableLinkSmall">' . '<a href="main.php?cat=game&page=advisors&show=actions">The Thief</a>' . '</div>'; ?> <table width="40%" cellpadding="0" cellspacing="0" class="small"> <form action="main.php?cat=game&page=thievery" method="post"> <tr class="header"> <th colspan="2"> Thievery </th> </tr> <tr class="subheader"> <th colspan="2" class="center"> Select Target </th> </tr> <tr class="data"> <th> Alliance: </th> <td> <input maxlength="4" size="3" name="kd" value="<?php echo $iTrgAid; ?> " /> <input type="submit" value="Change" /> </td> </tr> </form> <tr class="data"> <form action="main.php?cat=game&page=thievery2" method="post"> <th> Tribe: </th> <td> <select size="1" name="dplayer"> <option value="<?php echo $objSrcUser->get_userid(); ?> "></option> <?php //========================================================================== // New version of Damadm00's code Martel, July 10, 2006 //========================================================================== include_once 'inc/classes/clsAlliance.php'; $objTrgAlliance = new clsAlliance($iTrgAid); $arrTrgIUsers = $objTrgAlliance->get_userids(); $tableTarget = ''; if (!empty($arrTrgIUsers)) { foreach ($arrTrgIUsers as $iUserId) { $objTmpUser = new clsUser($iUserId); $strTribe = stripslashes($objTmpUser->get_rankings_personal(TRIBE_NAME)); if (isset($_GET['tribe']) && $_GET['tribe'] == $iUserId) { $tableTarget .= sprintf('<option value="%d" selected>%s</option>', $iUserId, $strTribe); } elseif (!isset($_GET['tribe']) || isset($_GET['tribe']) && $_GET['tribe'] != $iUserId) { $tableTarget .= sprintf('<option value="%d">%s</option>', $iUserId, $strTribe); } elseif (isset($_GET['tribe'])) { echo "Trying to exploit bugs/loopholes will get you suspended!"; } } } echo $tableTarget; ?> </select> </td> </tr> <tr class="data"> <td colspan="4" class="right"> <select size="1" name="op"> <?php $op_level = get_op_level($objSrcUser); for ($i = 1; $i <= $op_level; $i++) { if (!empty($opname[$i])) { $cost = get_op_cost($action[$i], $land); echo " <option value=\"{$i}\"> {$opname[$i]} - {$cost}</option>"; } } ?> </select> </td> </tr> </table> <?php echo $strColumnDivs = '</div>' . '<!-- Start right column -->' . '<div id="rightcolumn">' . '<br />' . '<div class="tableLinkSmall">' . '<a href="main.php?cat=game&page=advisors&show=military">The General</a>' . '</div>'; ?> <table class="small" width="60%" cellpadding="0" cellspacing="0"> <tr class="header"> <th colspan="2">Prepare Thieves</th> </tr> <tr class="subheader"> <th>Instruction</th> <td>Select</td> </tr> <tr class="data"> <th>Times to Run Operation:</th> <td> <select size="1" name="amount"> <?php for ($i = 1; $i <= MAX_THIEVE_OPS; $i++) { echo " <option value='{$i}'> {$i} </option>"; } ?> </select> </td> </tr> <tr class="data"> <th> <?php echo $arrUnitNames[6]; ?> s to Send: </th> <td> <input name="amount_sent" size="5" value="1" /> </td> </tr> <tr class="data"> <th>Available:</th> <td> <?php echo number_format($objSrcUser->get_army_home(UNIT5)); ?> </td> </tr> <tr class="data"> <th>Stop on Success:</th> <td> <input type="checkbox" name="stop" value="yes" /> </td> </tr> </table> <br /> <input type="hidden" value="yes" name="SELF_CHECK" /> <div class="center"><input type="submit" value="Send thieves on operation" /></div> </form> <?php echo $strColumnDivs = '</div>' . '</div>'; } }
function include_invade2_text() { global $ip; $objSrcUser =& $GLOBALS["objSrcUser"]; $arrSrcUser = $objSrcUser->get_user_infos(); $arrSrcStats = $objSrcUser->get_stats(); //========================================================================== // Secure user input from the invasion form //========================================================================== if (isset($_POST['TrgPlayer']) && !empty($_POST['TrgPlayer']) && $_POST['TrgPlayer'] != 'spacer') { // Selected Target $iTrgUserId = abs(intval($_POST['TrgPlayer'])); } else { echo $strDiv = '<div id="textMedium"><p>' . "Your army walk back to their homes, you should give them a " . "target next time!" . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . "Try Again ?" . "</a>" . '</p></div>'; include_game_down(); exit; } $arrWhite = array('1', '2', '3', '4', '5'); $arrWhite2 = array(1 => 'standard', 'raid', 'barren', 'hitnrun', 'bc'); // Selected Target if (isset($_POST['invade_type']) && in_array($_POST['invade_type'], $arrWhite)) { $iAttack = intval($_POST['invade_type']); } else { echo $strDiv = '<div id="textMedium"><p>' . "Your army walk back to their homes, you should give them a " . "target next time!" . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . "Try Again ?" . "</a>" . '</p></div>'; include_game_down(); exit; } // Army Sent $arrUnitVars = getUnitVariables($arrSrcStats[RACE]); $arrUnitOffence = $arrUnitVars['offence']; $arrUnitVar = $arrUnitVars['variables']; if (isset($_POST["arrArmySent"])) { $arrArmySent = $_POST["arrArmySent"]; foreach ($arrUnitOffence as $i => $iUnitOffence) { if ($iUnitOffence > 0) { $arrArmySent[$arrUnitVar[$i]] = max(0, intval($arrArmySent[$arrUnitVar[$i]])); } else { $arrArmySent[$arrUnitVar[$i]] = 0; } } } //========================================================================== // Verify attacker's status //========================================================================== obj_check_protection($objSrcUser, "invade"); $iTotalSentArmy = array_sum($arrArmySent); if ($iTotalSentArmy < 1) { echo $strDiv = '<div id="textMedium"><p>' . 'Sorry, but you did not send any units to battle.<br />' . 'This attack has been aborted.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . "Try Again ?" . "</a>" . '</p></div>'; include_game_down(); exit; } if (verifyArmyAvailable($objSrcUser, $arrArmySent) == 1) { echo $strDiv = '<div id="textMedium"><p>' . 'Sorry, you do not have that many units to send.<br />' . 'This attack has been aborted.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . "Try Again ?" . "</a>" . '</p></div>'; include_game_down(); exit; } if ($arrSrcStats[RACE] == "Oleg Hai" && verifyArmyAvailableOleg($objSrcUser, $arrArmySent) == 1) { $mercsTrainedThisHour = $objSrcUser->get_army_merc(MERC_T3); echo $strDiv = '<div id="textMedium"><p>' . "Sorry, but you did only train {$mercsTrainedThisHour} " . "mercs this update and that's the maximum you may use for an " . "attack.<br />" . "This attack has been aborted." . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . "Try Again ?" . "</a>" . '</p></div>'; include_game_down(); exit; } if ($arrSrcUser[NEXT_ATTACK] > 0) { echo $strDiv = '<div id="textMedium"><p>' . 'Sorry, but you cannot attack for at least ' . $arrSrcUser[NEXT_ATTACK] . ' more updates.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } if ($arrSrcUser[HOURS] < PROTECTION_HOURS) { echo $strDiv = '<div id="textMedium"><p>' . 'You are not allowed to attack while in protection!' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } //========================================================================== // Verify defender's status //========================================================================== include_once 'inc/functions/update.php'; check_to_update($iTrgUserId); $objTrgUser = new clsUser($iTrgUserId); $arrTrgStats = $objTrgUser->get_stats(); if ($arrTrgStats[ALLIANCE] == $objSrcUser->get_stat(ALLIANCE)) { echo $strDiv = '<div id="textMedium"><p>' . 'Sorry, honor before might. Do not attack into your own alliance.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } elseif ($objTrgUser->get_stat(ALLIANCE) < 11) { echo $strDiv = '<div id="textMedium"><p>' . 'I hope you did not think that you would get away with ' . 'attacking into a staff alliance, did you?' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } // Frost: Added a global protection mode include_once 'inc/classes/clsGame.php'; $objGame = new clsGame(); if ($objGame->get_game_switch(GLOBAL_PROTECTION) == 'on') { echo $strDiv = '<div id="textMedium"><p>' . 'Because of a global event all tribes in ORKFiA are under ' . 'protection. Please check the community forum for an announcement.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } $iTrgHours = $objTrgUser->get_user_info(HOURS); if ($iTrgHours < PROTECTION_HOURS) { $iTrgHoursRemaining = PROTECTION_HOURS - $iTrgHours; echo $strDiv = '<div id="textMedium"><p>' . 'It appears that the tribe you wish to target is still ' . 'materializing. Our general estimates that it will ' . 'take another ' . $iTrgHoursRemaining . ' updates for the area ' . 'to become a stable part of reality.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } if ($objTrgUser->get_stat(ALLIANCE) == 0) { echo $strDiv = '<div id="textMedium"><p>' . 'This player has either been deleted or suspended.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } // Frost: added jan -04 // Martel: updated July 08, 2006 if ($objTrgUser->get_stat(KILLED) == 1 || $objTrgUser->get_stat(RESET_OPTION) == 'yes') { echo $strDiv = '<div id="textMedium"><p>' . 'This tribe is dead.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } // Paused account Martel, July 13, 2006 if ($objTrgUser->isPaused()) { echo $strDiv = '<div id="textMedium"><p>' . 'This tribe is paused.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Return' . '</a>' . '</p></div>'; return; } // Blocking system - AI 11/02/2007 if (!clsBlock::isOpAllowed($objSrcUser, $objTrgUser)) { echo '<div id="textMedium"><p>' . 'Someone else from the same IP has already opped this tribe during the last 8 hours.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">Return</a>' . '</p></div>'; clsBlock::reportOp($objSrcUser, $objTrgUser, 'Attack: ' . $arrWhite2[$iAttack], false); return; } $iTrgLand = $objTrgUser->get_build(LAND); $iSrcLand = $objSrcUser->get_build(LAND); $breakoff = round($iSrcLand * 0.7); // Barren attack has 70% bottom feed limit if smaller than 2000 acres if ($iAttack == ATTACK_BARREN && $iTrgLand <= $breakoff && $iTrgLand < 2000) { echo $strDiv = '<div id="textMedium"><p>' . 'Sorry but you can not bash the small ones. Barren grabs are not ' . 'allowed against smaller tribes unless they are within 70% ' . 'of your own size.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } if ($iAttack == ATTACK_HNR && $iTrgLand < $iSrcLand) { echo $strDiv = '<div id="textMedium"><p>' . 'What kind of coward are you who try to make a Hit \'n\' Run ' . 'attack against a smaller tribe?' . '</p><p>' . 'Shame on you!' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Return' . '</a>' . '</p></div>'; include_game_down(); exit; } $quick_check = mysql_query("Select * from user where id = 1"); $quick_check = mysql_fetch_array($quick_check); if ($quick_check[STOPGAMETRIGGER] == 99) { echo $strDiv = '<div id="textMedium"><p>' . 'The game has been paused by staff, possibly due to technical ' . 'maintenance. Please look in the announcements ' . 'forum or the admin game message for more information.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Return' . '</a>' . '</p></div>'; include_game_down(); exit; } else { //====================================================================== // Do Battle //====================================================================== /* include the code for the attack about to be done */ include_once "inc/attacks/" . $arrWhite2[$iAttack] . ".php"; // Damadm00 19-03-2004, check here the result from the viking check // Martel: Notify thieves about attack only if not viking+25% luck if ($arrSrcStats[RACE] == 'Viking' && getVikingCheck() == 1) { $viking = 1; } else { $viking = 0; getMonitoringCheck($objSrcUser); } include_once 'inc/functions/military.php'; $defence = getArmyDefence($objTrgUser, $iAttack); $defence = $defence['total_home']; $offence = getSentOffence($objSrcUser, $arrArmySent); //Attacking Templars kills mystics, not thieves - AI $thieves = 'thieves'; if ($objTrgUser->get_stat(RACE) == 'Templar') { $thieves = 'mystics'; } // Eagle 30% auto force retreat feature if ($objTrgUser->get_stat(RACE) == "Eagle" && getEagleCheck() == 1) { doRetreat($objSrcUser, $objTrgUser, $arrArmySent, 1, 0); return; } elseif ($offence < $defence && $iAttack != ATTACK_HNR) { doRetreat($objSrcUser, $objTrgUser, $arrArmySent, 0, $viking); return; } elseif ($offence < $defence && $iAttack == ATTACK_HNR) { if ($offence > 0.5 * $defence) { if ($defence == 0) { $defence = 1; } $arrSrcArmyLost = getSrcLosses($objSrcUser, $arrArmySent, $offence / $defence, $arrWhite2[$iAttack]); $arrTrgArmyLost = getTrgLosses($objTrgUser, $objSrcUser, $offence / $defence, $arrWhite2[$iAttack]); $arrReport = doAttack($objSrcUser, $objTrgUser, $arrArmySent); } else { doRetreat($objSrcUser, $objTrgUser, $arrArmySent, 0, $viking); return; } } else { if ($defence == 0) { $defence = 1; } $arrSrcArmyLost = getSrcLosses($objSrcUser, $arrArmySent, $offence / $defence, $arrWhite2[$iAttack]); $arrTrgArmyLost = getTrgLosses($objTrgUser, $objSrcUser, $offence / $defence, $arrWhite2[$iAttack]); $arrReport = doAttack($objSrcUser, $objTrgUser, $arrArmySent); } // Spread Pestilence $arrSpreadPest = checkPestilence($objSrcUser, $objTrgUser); $pestSrc = $arrSpreadPest['attacker']; $pestTrg = $arrSpreadPest['defender']; //====================================================================== // Begin creating the invade report //====================================================================== $strTribe = stripslashes($objTrgUser->get_rankings_personal(TRIBE_NAME)); $iAlliance = $arrTrgStats[ALLIANCE]; $strReport = '<div id="textMedium">' . '<h2>' . "Invade Report" . '</h2>' . '<p>' . 'Your invasion of <strong>' . $strTribe . ' (#' . $iAlliance . ')</strong> was successful, ' . 'below follows a report from your general.' . '</p>'; //====================================================================== // Report: Gains //====================================================================== // Acres if (isset($arrReport['gained_acres']) && $arrReport['gained_acres'] != 0) { $strReport .= '<p>' . "Our army has gained control over " . "<strong>" . $arrReport['gained_acres'] . " acres</strong>. "; // Explored Acres if (isset($arrReport['explored_acres']) && $arrReport['explored_acres'] != 0) { $strReport .= "Also <strong>" . $arrReport['explored_acres'] . " acres</strong> was " . "explored and can be used to build on now."; } $strReport .= '</p>'; } // Citizens Killed (raid or hnr) if (isset($arrReport['killed_citizens']) && $arrReport['killed_citizens'] != 0) { $strReport .= '<p>' . "Our army storm into their lands, killing <strong>" . $arrReport['killed_citizens'] . "</strong> of their citizens." . '</p>'; } // Money (raid) if (isset($arrReport['gained_crowns']) && $arrReport['gained_crowns'] != 0) { $strReport .= '<p>' . "The army report having stolen <strong class=\"indicator\">" . number_format($arrReport['gained_crowns']) . " crowns</strong>." . '</p>'; } // Buildings Razed (blasphemy crusade) if (isset($arrReport['damaged_total']) && $arrReport['damaged_total'] != 0) { $strReport .= '<p>' . "Your loyal army charges into their lands, destroying <strong>" . $arrReport['damaged_total'] . " buildings</strong> of witchcraft " . "and deception. ("; // Academies if (isset($arrReport['damaged_academies']) && $arrReport['damaged_academies'] != 0) { $strReport .= " <strong>" . $arrReport['damaged_academies'] . " academies</strong>"; } // Guilds if (isset($arrReport['damaged_guilds']) && $arrReport['damaged_guilds'] != 0) { $strReport .= " <strong>" . $arrReport['damaged_guilds'] . " guilds</strong>"; } // Hideouts if (isset($arrReport['damaged_hideouts']) && $arrReport['damaged_hideouts'] != 0) { $strReport .= " <strong>" . $arrReport['damaged_hideouts'] . " hideouts</strong>"; } $strReport .= ').</p>'; } // Thieves Killed (blasphemy crusade) if (isset($arrReport['killed_thieves']) && $arrReport['killed_thieves'] != 0) { $strReport .= '<p>' . "Your general reports having killed <strong>" . $arrReport['killed_thieves'] . " {$thieves} of the enemy</strong>." . '</p>'; } // Fame Gained if (isset($arrReport['gained_fame']) && $arrReport['gained_fame'] != 0) { $strReport .= '<p>' . "This invasion gave our tribe <strong class=\"positive\">" . $arrReport['gained_fame'] . " fame</strong>." . '</p>'; } //====================================================================== // Begin enemy defence estimation (report) //====================================================================== if ($offence > $defence * 2) { $strReport .= '<p>' . "Our army is more than double the power of the " . "defending army, causing the enemy to run in fear. (Victory " . "by more than 100%)" . '</p>'; } elseif ($offence > $defence * 1.8) { $strReport .= '<p>' . "Our army is almost double the power of the defending " . "army. (Victory by more than 80%)" . '</p>'; } elseif ($offence > $defence * 1.6) { $strReport .= '<p>' . "Our army has easily broken the enemies defences, " . "overpowering them by more than 3 to 2. (Victory by more " . "than 60%)" . '</p>'; } elseif ($offence > $defence * 1.4) { $strReport .= '<p>' . "Our army has broken the enemies defences, overpowering " . "them by around 3 to 2. (Victory by more than 40%)" . '</p>'; } elseif ($offence > $defence * 1.2) { $strReport .= '<p>' . "Our army has broken through the line of defence, but it was " . "a hard battle. (Victory by more than 20%)" . '</p>'; } elseif ($offence > $defence * 1.1) { $strReport .= '<p>' . "Our army has broken through the line of defence, but it was " . "a very tough battle. (Victory by more than 10%)" . '</p>'; } elseif ($offence >= $defence) { $strReport .= '<p>' . "Our army fought hard, winning only after a lengthy and very " . "difficult battle. (Victory by less than 10%)" . '</p>'; } //====================================================================== // Report: Army Losses //====================================================================== $arrUnitVars = getUnitVariables($objSrcUser->get_stat(RACE)); $arrUnitNames = $arrUnitVars['output']; $strPlural = 's'; $strReport .= '<p>' . "The captains report that we have lost "; if ($arrSrcArmyLost[UNIT1] > 0) { $strReport .= $arrSrcArmyLost[UNIT1] . " " . $arrUnitNames[2] . $strPlural . ", "; } if ($arrSrcArmyLost[UNIT2] > 0) { if ($arrUnitNames[3] == 'Swordmen') { $strPlural = ''; } elseif ($arrUnitNames[3] == 'Pikemen') { $strPlural = ''; } $strReport .= $arrSrcArmyLost[UNIT2] . " " . $arrUnitNames[3] . $strPlural . ", "; } if ($arrSrcArmyLost[UNIT3] > 0) { if ($arrUnitNames[4] == 'Crossbowmen') { $strPlural = ''; } elseif ($arrUnitNames[4] == 'Longbowmen') { $strPlural = ''; } elseif ($arrUnitNames[4] == 'Mummy') { $arrUnitNames[4] = 'Mummie'; } $strReport .= $arrSrcArmyLost[UNIT3] . " " . $arrUnitNames[4] . $strPlural . ", "; } if ($arrSrcArmyLost[UNIT4] > 0) { if ($arrUnitNames[5] == 'Priestess') { $strPlural = ''; } $strReport .= $arrSrcArmyLost[UNIT4] . " " . $arrUnitNames[5] . $strPlural . ", "; } if ($arrSrcArmyLost[UNIT5] > 0) { if ($arrUnitNames[6] == 'Thief') { $arrUnitNames[6] = 'Thieve'; } $strReport .= $arrSrcArmyLost[UNIT5] . " " . $arrUnitNames[6] . $strPlural . ", "; } if (array_sum($arrSrcArmyLost) < 1) { $strReport .= " no military at all, "; } $totalkilled = round(array_sum($arrTrgArmyLost), -2); if ($totalkilled > 0) { $strReport .= " and they estimate the enemy's losses to be {$totalkilled} units"; if ($objSrcUser->get_stat(RACE) == "Undead") { $strReport .= ", who joined our cursed army as soldiers."; } } else { $strReport .= " and they estimate the enemy's losses to be near zero"; } $strReport .= '.</p>'; //====================================================================== // Report: Army available again //====================================================================== $wait = $objSrcUser->get_user_info(NEXT_ATTACK); $strReport .= '<p>' . "Our generals report our army will be able to attack again " . "in " . $wait . " updates. "; if ($wait > 4) { // Assuming that an attack with more than 4 hours is a BC or Hitnrun $wait -= 2; $strReport .= "However, our army will be home to defend our lands after " . $wait . " updates."; } $strReport .= '</p>'; //====================================================================== // Report: Pestilence //====================================================================== if ($pestSrc == "yes") { $strReport .= '<p>' . "<strong class=\"negative\">During your invasion your military " . "got infected with pestilence.</strong>" . '</p>'; } //====================================================================== // frost: added suicide detection | modified for age 18. only one update // loss of 25% citizens //====================================================================== $suicide = getSuicideCheck($objSrcUser, $arrArmySent); if ($arrSrcStats[RACE] != "Raven" && $suicide == 1) { $citz = $objSrcUser->get_pop(CITIZENS); $leavingCitz = floor($citz * 0.25); $strReport .= '<p>' . "<strong class=\"negative\">Your citizens are getting tired of " . "their tax money going to far-away military campaigns " . "instead of defending their homes. " . number_format($leavingCitz) . " citizens have left your lands.</strong>" . '</p>'; $objSrcUser->set_pop(CITIZENS, $citz - $leavingCitz); } //====================================================================== // Report: Viking Stealth Attack //====================================================================== if ($viking == 1) { $strReport .= '<p>' . "<strong class=\"positive\">You got lucky. Your location " . "doesn't end up in the news.</strong>" . '</p>'; } //====================================================================== // Report: War effects //====================================================================== require_once 'inc/functions/war.php'; $objSrcAlliance = $objSrcUser->get_alliance(); if (checkWarBetween($objSrcAlliance, $objTrgUser->get_stat(ALLIANCE))) { $objTrgAlliance = $objTrgUser->get_alliance(); if ($arrGains = testWarVictory($objSrcAlliance, $objTrgAlliance)) { // Append war-win message require_once 'inc/pages/war_room2.inc.php'; $strReport .= '<p><strong class="positive">Your alliance has won the war!</strong></p>' . getVictoryReport($arrGains); } } $strReport .= '<p>' . '<a href="main.php?cat=game&page=tribe">Continue</a>' . '</p>' . '</div>'; echo $strReport; //====================================================================== // Defender tribe news (damage report) //====================================================================== $srcDisplay = $arrSrcStats[TRIBE] . " (#" . $arrSrcStats[ALLIANCE] . ")"; $trgDisplay = $arrTrgStats[TRIBE] . " (#" . $arrTrgStats[ALLIANCE] . ")"; $strStrategy = $arrWhite2[$iAttack]; switch ($strStrategy) { case "standard": if ($viking == 0) { $strTrgTribe = "<span class=\"positive\">{$srcDisplay} has successfully marched into our lands and conquered " . $arrReport['gained_acres'] . " acres</span>"; $strTrgAlliance = "<span class=\"newsattack\">{$srcDisplay} has successfully marched into the lands of {$trgDisplay} and conquered " . $arrReport['gained_acres'] . " acres</span>"; } else { $strTrgTribe = "<span class=\"positive\">An unidentified tribe of vikings has successfully marched into our lands and conquered " . $arrReport['gained_acres'] . " acres</span>"; $strTrgAlliance = "<span class=\"newsattack\">An unidentified tribe of vikings has successfully marched into the lands of {$trgDisplay} and conquered " . $arrReport['gained_acres'] . " acres</span>"; } break; case "raid": if ($viking == 0) { $strTrgTribe = "<span class=\"positive\">{$srcDisplay} has successfully stormed into our lands and conquered " . $arrReport['gained_acres'] . " acres, stolen " . $arrReport['gained_crowns'] . " crowns and slaughtered " . $arrReport['killed_citizens'] . " citizens</span>"; $strTrgAlliance = "<span class=\"newsattack\">{$srcDisplay} has successfully stormed into the lands of {$trgDisplay} and conquered " . $arrReport['gained_acres'] . " acres, stolen " . $arrReport['gained_crowns'] . " crowns and slaughtered " . $arrReport['killed_citizens'] . " citizens</span>"; } else { $strTrgTribe = "<span class=\"positive\">An unidentified tribe of vikings has successfully stormed into our lands and conquered " . $arrReport['gained_acres'] . " acres, stolen " . $arrReport['gained_crowns'] . " crowns and slaughtered " . $arrReport['killed_citizens'] . " citizens</span>"; $strTrgAlliance = "<span class=\"newsattack\">An unidentified tribe of vikings has Successfully stormed into the lands of {$trgDisplay} and conquered " . $arrReport['gained_acres'] . " acres, stolen " . $arrReport['gained_crowns'] . " crowns and slaughtered " . $arrReport['killed_citizens'] . " citizens</span>"; } break; case "barren": if ($viking == 0) { $strTrgTribe = "<span class=\"newsattack\">{$srcDisplay} has successfully sneaked into our lands and claimed " . $arrReport['gained_acres'] . " acres</span>"; $strTrgAlliance = "<span class=\"newsattack\">{$srcDisplay} has successfully sneaked into the lands of {$trgDisplay} and claimed " . $arrReport['gained_acres'] . " acres</span>"; } else { $strTrgTribe = "<span class=\"newsattack\">An unidentified tribe of vikings has successfully sneaked into our lands and claimed " . $arrReport['gained_acres'] . " acres</span>"; $strTrgAlliance = "<span class=\"newsattack\">An unidentified tribe of vikings has successfully sneaked into the lands of {$trgDisplay} and claimed " . $arrReport['gained_acres'] . " acres</span>"; } break; case "bc": if ($viking == 0) { $strTrgTribe = "<span class=\"newsbc\">{$srcDisplay} has successfully charged into our lands and destroyed " . $arrReport['damaged_total'] . " buildings and killed " . $arrReport['killed_thieves'] . " {$thieves}. Our lands will be avaliable for building again after they have been cleared</span>"; $strTrgAlliance = "<span class=\"newsbc\">{$srcDisplay} has successfully charged into the lands of {$trgDisplay} and destroyed " . $arrReport['damaged_total'] . " buildings and slaughtered " . $arrReport['killed_thieves'] . " {$thieves}</span>"; } else { $strTrgTribe = "<span class=\"newsbc\">An unidentified tribe of vikings has successfully charged into our lands and destroyed " . $arrReport['damaged_total'] . " buildings and killed " . $arrReport['killed_thieves'] . " {$thieves}. Our lands will be avaliable for building again after they have been cleared</span>"; $strTrgAlliance = "<span class=\"newsbc\">An unidentified tribe of vikings has successfully charged into the lands of {$trgDisplay} and destroyed " . $arrReport['damaged_total'] . " buildings and killed " . $arrReport['killed_thieves'] . " {$thieves}</span>"; } break; case "hitnrun": $strAdd = ""; if ($offence >= $defence) { $strAdd = " and " . $arrReport['killed_citizens'] . " citizens"; } if ($viking == 0) { $strTrgTribe = "<span class=\"newsattack\">{$srcDisplay} has cowardly ambushed our lands, killing many troops" . $strAdd . "</span>"; $strTrgAlliance = "<span class=\"newsattack\">{$srcDisplay} has cowardly attacked and rained arrows over {$trgDisplay}, killing many troops" . $strAdd . "</span>"; } else { $strTrgTribe = "<span class=\"newsattack\">An unidentified tribe of vikings has cowardly ambushed our lands, killing many troops" . $strAdd . "</span></span>"; $strTrgAlliance = "<span class=\"newsattack\">An unidentified tribe of vikings has cowardly attacked and rained arrows over {$trgDisplay}, killing many troops" . $strAdd . "</span>"; } break; } $trgId = $objTrgUser->get_userid(); $srcId = $objSrcUser->get_userid(); $trgKd = $objTrgUser->get_stat(ALLIANCE); $srcKd = $objSrcUser->get_stat(ALLIANCE); if ($viking == 0) { $result = "INSERT INTO `news` VALUES ('', NOW(), '{$ip}', '{$strStrategy}', '{$trgId}', '{$srcId}', '1', " . quote_smart($strTrgTribe) . ", " . quote_smart($strTrgAlliance) . ",'{$trgKd}','{$srcKd}',1)"; } else { $result = "INSERT INTO `news` VALUES ('', NOW(), '{$ip}', '{$strStrategy}', '{$trgId}', '{$srcId}', '1', " . quote_smart($strTrgTribe) . ", " . quote_smart($strTrgAlliance) . ",'{$trgKd}',0,1)"; } mysql_query($result); $arrUnitVars = getUnitVariables($objTrgUser->get_stat(RACE)); $arrUnitNames = $arrUnitVars['output']; $strPlural = 's'; $strPlural2 = 's'; $strPlural3 = 's'; $strPlural4 = 's'; $strPlural5 = 's'; if ($arrUnitNames[3] == 'Swordmen') { $strPlural2 = ''; } elseif ($arrUnitNames[3] == 'Pikemen') { $strPlural2 = ''; } if ($arrUnitNames[4] == 'Crossbowmen') { $strPlural3 = ''; } elseif ($arrUnitNames[4] == 'Longbowmen') { $strPlural3 = ''; } elseif ($arrUnitNames[4] == 'Mummy') { $arrUnitNames[4] = 'Mummie'; } if ($arrUnitNames[5] == 'Priestess') { $strPlural4 = 'es'; } if ($arrUnitNames[6] == 'Thief') { $arrUnitNames[6] = 'Thieve'; } $strTrgNews = "A report has been collected, our losses are listed as follows: " . "<br />" . $arrUnitNames[2] . $strPlural . " killed: " . "<span class=\"negative\">" . $arrTrgArmyLost[UNIT1] . "</span>," . "<br />" . $arrUnitNames[3] . $strPlural2 . " killed: " . "<span class=\"negative\">" . $arrTrgArmyLost[UNIT2] . "</span>," . "<br />" . $arrUnitNames[4] . $strPlural3 . " killed: " . "<span class=\"negative\">" . $arrTrgArmyLost[UNIT3] . "</span>," . "<br />" . $arrUnitNames[5] . $strPlural4 . " killed: " . "<span class=\"negative\">" . $arrTrgArmyLost[UNIT4] . "</span>."; //Add mystic losses for templars - AI 24/04/2007 if ($arrTrgArmyLost[UNIT5] > 0) { $strTrgNews .= "<br />" . $arrUnitNames[6] . $strPlural5 . " killed: " . "<span class=\"negative\">" . $arrTrgArmyLost[UNIT5] . "</span>."; } if ($pestTrg == "yes") { $strTrgNews .= "<br />" . "<strong class=\"negative\">" . "During this invasion pestilence " . "was spread into our lands for 12 updates" . "</strong>."; } // create tribe news for attack mysql_query("INSERT INTO `news` (`id`, `time`, `ip`, `type`, `duser`, `ouser`, `result`, `text`, `kingdom_text`) VALUES ('', NOW(), '{$ip}', 'invade report', '{$arrTrgStats['id']}', '{$arrSrcStats['id']}', 1, '{$strTrgNews}', '')"); $orkTime = date(TIMESTAMP_FORMAT); $objTrgUser->set_user_info(LAST_NEWS, $orkTime); // Update target rankings include_once 'inc/functions/update_ranking.php'; doUpdateRankings($objTrgUser, 'yes'); // Log the op for blocking system - AI 11/02/2007 clsBlock::logOp($objSrcUser, $objTrgUser, 'Attack: ' . $arrWhite2[$iAttack]); } }
function getTrgLosses(&$objTrgUser, &$objSrcUser, $killed, $strStrategy) { $strSrcRace = $objSrcUser->get_stat(RACE); $strTrgRace = $objTrgUser->get_stat(RACE); $arrTrgArmys = $objTrgUser->get_armys(); $arrArmyHome = $objTrgUser->get_armys_home(); $arrPctLost = getLossesPct($strStrategy, $strSrcRace, $strTrgRace); $intTrgLostPercent = $arrPctLost['defence']; if ($strStrategy == 'hitnrun') { $intTrgLostPercent += 0.03 * $killed; } // Fix that will prevent more losses than the target has military? // (Real correction must be to analyze the $killed variable. Ask Aldorin!) if ($intTrgLostPercent > 1) { $intTrgLostPercent = 1; } // All high elf units are immortal, so no damage unless Mortality is cast if ($strTrgRace == "High Elf" && $objSrcUser->get_spell(MORTALITY) < 1) { $intTrgLostPercent = 0; } // Fountain of Resurrection decreases defender losses by 40% if ($objTrgUser->get_spell(FOUNTAIN) > 0) { $intTrgLostPercent *= 0.6; } //========================================================================== // Basics lost //========================================================================== $arrUnitVars = getUnitVariables($objTrgUser->get_stat(RACE)); $arrUnitDefence = $arrUnitVars['defence']; if ($arrUnitDefence[2] != 0) { $arrTrgArmyLost[UNIT1] = round($arrArmyHome[UNIT1] * $intTrgLostPercent); $intTrgArmyAlive[UNIT1] = $arrTrgArmys[UNIT1] - $arrTrgArmyLost[UNIT1]; } else { $arrTrgArmyLost[UNIT1] = 0; $intTrgArmyAlive[UNIT1] = $arrTrgArmys[UNIT1]; } //========================================================================== // Offspecs lost //========================================================================== if ($arrUnitDefence[3] != 0) { $arrTrgArmyLost[UNIT2] = round($arrArmyHome[UNIT2] * $intTrgLostPercent); $intTrgArmyAlive[UNIT2] = $arrTrgArmys[UNIT2] - $arrTrgArmyLost[UNIT2]; } else { $arrTrgArmyLost[UNIT2] = 0; $intTrgArmyAlive[UNIT2] = $arrTrgArmys[UNIT2]; } //========================================================================== // Defspecs lost //========================================================================== if ($arrUnitDefence[4] != 0) { $arrTrgArmyLost[UNIT3] = round($arrArmyHome[UNIT3] * $intTrgLostPercent); $intTrgArmyAlive[UNIT3] = $arrTrgArmys[UNIT3] - $arrTrgArmyLost[UNIT3]; } else { $arrTrgArmyLost[UNIT3] = 0; $intTrgArmyAlive[UNIT3] = $arrTrgArmys[UNIT3]; } //========================================================================== // Elites lost //========================================================================== // Undead elites are immortal, but not to the Mortality spell if ($strTrgRace == "Undead" && $objSrcUser->get_spell(MORTALITY) < 1) { $intTrgLostPercent = 0; } elseif ($strTrgRace == "Uruk Hai") { $intTrgLostPercent = $intTrgLostPercent * 0.8; } if ($arrUnitDefence[5] != 0) { $arrTrgArmyLost[UNIT4] = round($arrArmyHome[UNIT4] * $intTrgLostPercent); $intTrgArmyAlive[UNIT4] = $arrTrgArmys[UNIT4] - $arrTrgArmyLost[UNIT4]; } else { $arrTrgArmyLost[UNIT4] = 0; $intTrgArmyAlive[UNIT4] = $arrTrgArmys[UNIT4]; } //========================================================================== // Thieves lost //========================================================================== if ($arrUnitDefence[6] != 0) { $arrTrgArmyLost[UNIT5] = round($arrArmyHome[UNIT5] * $intTrgLostPercent); $intTrgArmyAlive[UNIT5] = $arrTrgArmys[UNIT5] - $arrTrgArmyLost[UNIT5]; } else { $arrTrgArmyLost[UNIT5] = 0; $intTrgArmyAlive[UNIT5] = $arrTrgArmys[UNIT5]; } //========================================================================== // Update Defender's Army //========================================================================== $arrArmy = array(UNIT1 => $intTrgArmyAlive[UNIT1], UNIT2 => $intTrgArmyAlive[UNIT2], UNIT3 => $intTrgArmyAlive[UNIT3], UNIT4 => $intTrgArmyAlive[UNIT4], UNIT5 => $intTrgArmyAlive[UNIT5]); $objTrgUser->set_armys($arrArmy); //========================================================================== // oleg hai merc losses for army_mercs table //========================================================================== if ($strTrgRace == "Oleg Hai") { $razeMerc = $arrTrgArmyLost[UNIT4]; $currentMerc = $objTrgUser->get_army_mercs(); if ($razeMerc > $currentMerc[MERC_T1]) { $razeMerc = $razeMerc - $currentMerc[MERC_T1]; if ($razeMerc > $currentMerc[MERC_T2]) { $razeMerc = $razeMerc - $currentMerc[MERC_T2]; if ($razeMerc > $currentMerc[MERC_T3]) { $razeMerc = $razeMerc - $currentMerc[MERC_T3]; $merc_t3 = $objTrgUser->get_army_merc(MERC_T3); $objTrgUser->set_army_merc(MERC_T3, $merc_t3 - $razeMerc); } $merc_t2 = $objTrgUser->get_army_merc(MERC_T2); $objTrgUser->set_army_merc(MERC_T2, $merc_t2 - $razeMerc); } $merc_t1 = $objTrgUser->get_army_merc(MERC_T1); $objTrgUser->set_army_merc(MERC_T1, $merc_t1 - $razeMerc); } $merc_t0 = $objTrgUser->get_army_merc(MERC_T0); $objTrgUser->set_army_merc(MERC_T0, $merc_t0 - $razeMerc); } //========================================================================== // Undead bonus: killed units of defender are raised as zombies (basics) // Total Killed Martel, June 05, 2006 //========================================================================== if ($objSrcUser->get_stat(RACE) == "Undead") { $iSumKilled = array_sum($arrTrgArmyLost); $unit1 = $objSrcUser->get_army(UNIT1); $objSrcUser->set_army(UNIT1, $unit1 + $iSumKilled); } return $arrTrgArmyLost; }
function obj_kill_user(&$objUser) { // Tag tribe to be restarted $objUser->set_stat(RESET_OPTION, 'yes'); // Remove invested research //require_once("inc/functions/research.php"); //delete_my_rps($objUser->get_userid()); // no more - AI 07/05/07 // Mail user to tell them they have been killed $strMail = "Unfortunately your tribe in ORKFiA has died. It is now ready " . "to be restarted." . "\n\n" . HOST . SIGNED_ORKFIA; $strEmail = stripslashes($objUser->get_preference(EMAIL)); mail($strEmail, "Your tribe is no more =(", $strMail, "From: ORKFiA <" . EMAIL_REPORTER . ">\r\nX-Mailer: PHP/" . phpversion() . "\r\nX-Priority: Normal"); // Calculate Re-starting Bonus // Species5618 (7-6-04): Setting a flag that marks the tribe as dead, so // that they do receive their age-death-bonus ("heritage") when they login if ($objUser->get_stat(KILLED) == 1 || $_SERVER['SERVER_NAME'] == DINAH_SERVER_NAME) { require_once 'inc/functions/population.php'; $arrPopulation = getPopulation($objUser); require_once 'inc/functions/races.php'; $strRace = $objUser->get_stat(RACE); $arrUnitVars = getUnitVariables($strRace); $arrUnitCost = $arrUnitVars['gold']; // Calculate the killed army's worth $total_value = $arrPopulation['basics'] * $arrUnitCost[2]; $total_value += $arrPopulation['off_specs'] * $arrUnitCost[3]; $total_value += $arrPopulation['def_specs'] * $arrUnitCost[4]; $total_value += $arrPopulation['elites'] * $arrUnitCost[5]; $total_value += $arrPopulation['thieves'] * $arrUnitCost[6]; $total_value = round($total_value * 0.02); // Calculate the killed army in basics $total_troops = round($arrPopulation['total_army'] / 40); // Base Housing Capacities require_once 'inc/functions/build.php'; $arrBuildVariables = getBuildingVariables($strRace); $homes_hold = $arrBuildVariables['housing'][1]; // Add kill-bonus $iLand = $objUser->get_build(LAND); $fame = $objUser->get_stat(FAME); //Removed - AI 08/05/07 //$research = $objUser->get_stat(INVESTED); $arrKills = array(LAND => $iLand, CASH => $total_value, BASICS => $total_troops, POP => $homes_hold, FAME => $fame); $objUser->set_kills($arrKills); } // Reset Tribe Rankings $arrRankingsPersonal = array(STRENGTH => 3000, LAND => STARTING_LAND, FAME => 5000, HOURS => 0); $objUser->set_rankings_personals($arrRankingsPersonal); // Update Alliance Rankings $objAlliance = $objUser->get_alliance(); $objAlliance->do_update_ranking(); // Set total land to what would be inherited (fix a science bug), // we're using a hardcoded value here which just happens to be the same // as the one used in inc/pages/reset_account.inc.php, // this is a BAD THING - AI 11/01/2006 // Age changes coding - new heritage formula // Martel, September 16, 2007 (Plus also using constant and not '400') $iLand = $objUser->get_build(LAND); $iNewFormulaHeritage = round(pow(max(0, $iLand - STARTING_LAND), 0.80459611995) + STARTING_LAND); if (($objUser->get_stat(KILLED) == 1 || $_SERVER['SERVER_NAME'] == DINAH_SERVER_NAME) && $iNewFormulaHeritage > STARTING_LAND) { $iLand = $iNewFormulaHeritage; } if ($iLand > 2000) { $iLand = 2000; } elseif ($iLand < STARTING_LAND) { $iLand = STARTING_LAND; } // Save new land (to fix a science bug) $objUser->set_build(LAND, $iLand); // Reset other stuff too, so the tribe can be defected - AI 02/12/06 $objUser->set_user_info(PAUSE_ACCOUNT, 0); }
function get_strength() { if (empty($this->_iStrength)) { $arrArmys = $this->get_armys(); $strRace = $this->get_stat(RACE); // Strength from Military Units ==================================== include_once 'inc/functions/races.php'; $arrUnitVars = getUnitVariables($strRace); $arrUnitOff = $arrUnitVars['offence']; $arrUnitDef = $arrUnitVars['defence']; $arrVars = $arrUnitVars['variables']; $military_str = 0; $temp_str = 0; // iterates through all units with offence value specified (also if it is 0) foreach ($arrUnitOff as $key => $iUnitOff) { $temp_str = $arrArmys[$arrVars[$key]] * calcUnitStr($this, $arrUnitOff[$key], $arrUnitDef[$key]); // possibly add some (unit_str *= 1.025 ?) if the unit is immortal here // ravens get double strength from their elites if ($strRace == 'Raven' && $arrVars[$key] == UNIT4) { $temp_str *= 2; } $military_str += $temp_str; } // Strength from "War Buildings" =================================== $arrBuilds = $this->get_builds(); $build_str = 75 * ($arrBuilds[CHURCHES] + $arrBuilds[GUARDHOUSES] + $arrBuilds[HIDEOUTS] + $arrBuilds[GUILDS] + $arrBuilds[ACADEMIES]); // Strength from Thieves =========================================== $tm_str = $arrArmys[UNIT5] * 1.25; // Strength from .. other stuff? :P ================================ include_once 'inc/functions/population.php'; $max_citz = getMaxPopulation($this); $max_citz = $max_citz['total']; $all_units_in_training = getPopulation($this); $all_units_in_training = $all_units_in_training['total_army']; $all_units_in_training -= $arrArmys[UNIT1] + $arrArmys[UNIT2] + $arrArmys[UNIT3] + $arrArmys[UNIT4] + $arrArmys[UNIT5]; $other_str = pow(($max_citz + $arrArmys[UNIT1] + $all_units_in_training) / (1 + $arrArmys[UNIT2] + $arrArmys[UNIT3] + $arrArmys[UNIT4] + $arrArmys[UNIT5]), 0.25); // Calculate Total Strength ======================================== $total_str = $other_str * ($military_str + $build_str + $tm_str); // ================================================================= // $strength['units'] = $military_str; // $strength['buildings'] = $build_str; // $strength['thieves'] = $tm_str; // $strength['other'] = $other_str; $strength['total'] = $total_str; $this->_iStrength = $strength['total']; } return $this->_iStrength; }
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 }