示例#1
0
function include_racestats_text()
{
    // Get Total Number of Tribes
    $strSQL = "SELECT COUNT(*) as total " . "FROM " . TBL_STAT . " " . "WHERE " . ALLIANCE . " > 10";
    $iTotal = mysql_result(mysql_query($strSQL), 0, 0);
    $iTotal2 = 0;
    // Get All Races
    include_once 'inc/classes/clsRace.php';
    $arrRaces = clsRace::getRaces();
    $arrActiveRaces = clsRace::getActiveRaces();
    // Begin Create Table
    $strRaceStatsTable = '<table cellspacing="0" cellpadding="0" class="small">' . '<tr class="header">' . '<th colspan="2">' . "Racial Stats" . "</th>" . "</tr>" . '<tr class="subheader">' . "<th>" . "Race" . "</th>" . '<th class="right">' . "%" . "</th>" . "</tr>";
    for ($i = 0; $i < count($arrRaces); $i++) {
        // Give each 3rd row a border down
        $strStyle = '';
        //if (($i % 3) == 0) { $strStyle = ' class = "bsdown" '; }
        if (!in_array($arrRaces[$i], $arrActiveRaces)) {
            $strStyle = ' style="font-style:italic;"';
        }
        // Get Number of Tribes of the Current Race
        $SQL = "SELECT id FROM " . TBL_STAT . " " . "WHERE " . RACE . " = '{$arrRaces[$i]}' AND " . ALLIANCE . " > 10";
        $count[$i] = mysql_num_rows(mysql_query($SQL));
        $iTotal2 += $count[$i];
        $strRaceStatsTable .= '<tr class="data">' . "<th{$strStyle}>" . $arrRaces[$i] . "</th>" . "<td{$strStyle}>" . round($count[$i] / $iTotal * 100, 2) . " %</td>" . "</tr>";
    }
    $strRaceStatsTable .= '<tr class="data">' . "<th>" . "Unknown" . "</th>" . "<td>" . round(($iTotal - $iTotal2) / $iTotal * 100, 2) . " %</td>" . "</tr>" . "</table>";
    echo $strRaceStatsTable;
}
示例#2
0
function get_unit_power($race)
{
    global $unit_offence, $unit_defence;
    // Reducing redundancy, as you can see, it is still awfully ugly,
    //         so just don't use this function - AI 10/02/2007
    require_once 'inc/races/clsRace.php';
    $objRace = clsRace::getRace($race);
    $unit_offence = array_merge(array(''), $objRace->getUnitOffences(), array(''));
    $unit_defence = array_merge(array(''), $objRace->getUnitDefences(), array(''));
    $unit_offence = implode("|", $unit_offence);
    $unit_defence = implode("|", $unit_defence);
    $total = array("offence" => $unit_offence, "defence" => $unit_defence);
    return $total;
}
示例#3
0
 function &getRace($race)
 {
     if (!isset($race)) {
         trigger_error("Someone did some sloppy coding, pick a race!", E_USER_ERROR);
         die("Are we still alive here? DIE ALREADY!");
     }
     $cleanedRace = clsRace::cleanRaceName($race);
     //check wether we need to load this race
     if (!isset($GLOBALS['obj' . $cleanedRace])) {
         $filepath = 'inc/races/' . $cleanedRace . '.php';
         $racefunction = 'create_' . $cleanedRace . '_object';
         if (!file_exists($filepath)) {
             trigger_error("Race not found: {$race}", E_USER_ERROR);
             die("Are we still alive here? DIE ALREADY!");
         }
         require_once $filepath;
         $GLOBALS['obj' . $cleanedRace] = $racefunction();
     }
     return $GLOBALS['obj' . $cleanedRace];
 }
示例#4
0
function include_test_text()
{
    require_once 'inc/races/clsRace.php';
    $objUruk = clsRace::getRace('Uruk Hai');
    test_race($objUruk);
    test_race(clsRace::getRace('Oleg Hai'));
    test_race(clsRace::getRace('Mori Hai'));
    test_race(clsRace::getRace('Dark Elf'));
    test_race(clsRace::getRace('Wood Elf'));
    test_race(clsRace::getRace('High Elf'));
    test_race(clsRace::getRace('Dwarf'));
    test_race(clsRace::getRace('Viking'));
    test_race(clsRace::getRace('Brittonian'));
    test_race(clsRace::getRace('Raven'));
    test_race(clsRace::getRace('Dragon'));
    test_race(clsRace::getRace('Eagle'));
    test_race(clsRace::getRace('Nazgul'));
    test_race(clsRace::getRace('Undead'));
    test_race(clsRace::getRace('Spirit'));
}
示例#5
0
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&amp;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&amp;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&amp;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&amp;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&#8212;or
                just curious&#8212;<a href="main.php?cat=main&amp;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&amp;page=register1">Infinity Sign Up!</a> (Play until you die)</li>
                    <li><a href="http://dinah.phpsupport.se/main.php?cat=main&amp;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&amp;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&amp;page=forums&amp;set=news&amp;mode=threads">Announcements</a></li>
                    <li><a href="main.php?cat=main&amp;page=forums&amp;set=world&amp;mode=threads">World Forum</a></li>
                    <li><a href="main.php?cat=main&amp;page=forums&amp;set=game&amp;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 &amp; MySQL Support" class="newWindowLink">PHP Support .SE</a>' . '</p>' . '</div>';
    //==========================================================================
    // end nonsense ;)
    //==========================================================================
    echo '</div>';
}
示例#6
0
function include_faq_text()
{
    include_once 'inc/classes/clsRace.php';
    $iAvailable = max(2, count(clsRace::getActiveRaces()) - 1);
    ?>
    <div id="textBig" style="margin: 15px auto; text-align: left;">

        <h2 style="margin: 15px auto; text-align: center;">
        <img src="<?php 
    echo HOST_PICS;
    ?>
first_faq.gif" alt="FAQ - Frequently Asked
        Questions" /></h2>

        <a name="top"></a>
        <ol>
            <li><a href="#1"> I came here by mistake but I like the graphics,
            what is this about?</a></li>
            <li><a href="#2"> Does it cost anything to join?</a></li>
            <li><a href="#3"> Where do I start?</a></li>
            <li><a href="#4"> What should be my first actions?</a></li>
            <li><a href="#5"> Is there anything I must know?</a></li>
            <li><a href="#6"> How do I win?</a></li>
            <li><a href="#7"> What do I get if I win?</a></li>
            <li><a href="#8"> Where do all players hang out?</a></li>
            <li><a href="#9"> Where can I find more information?</a></li>
        </ol>

        <ol>
        <li><a name="1"></a><h3>I came here by mistake but I like the
        graphics, what is this about?</h3>
        <p>ORKFiA is an exciting online strategy game, developed and maintained
        by its players. It is text based and situated in a fantasy world called
        &#8220;Orkfia&#8221;, a world inspired by Tolkien's Middle Earth.
        Together with other players in your alliance you will be warring others
        as they step in your way. The combination of strategy and war is the
        ultimate challenge in ORKFiA, besides basic stuff like training military,
        constructing buildings and trying to stay alive.</p></li>

        <li><a name="2"></a><h3>Does it cost anything to join?</h3>
        <p>It is completely free to play, but we encourage our dedicated players to
        sponsor the game, with a small donation. Players who do so become <a
        href="main.php?cat=main&amp;page=sponsors">Dragon
        Sponsors</a>, getting a dragon next to their names in the forum and the
        appreciation of all players.</p></li>

        <li><a name="3"></a><h3>Where do I start?</h3>
        <p>Pick one of <a href="<?php 
    echo HOST_GUIDE;
    ?>
races.php?chapter=4"
        target="_blank" class="newWindowLink">the <?php 
    echo $iAvailable;
    ?>
 races</a>,
        and then if you are ready to join, go here to <a
        href="main.php?cat=main&amp;page=register1">sign up!</a>
        </p></li>

        <li><a name="4"></a><h3>What should be my first actions?</h3>
        <p>Assuming you have already selected a race and created your account,
        your first actions should be to 1) build your barren land and 2) train
        about 17,000 basic military units, and then wait 4 hours for them to
        arrive. More can be found reading our guide&#8212;and especially its
        first article&#8212;<a href="<?php 
    echo HOST_GUIDE;
    ?>
crash_course.php?chapter=1"
        target="_blank" class="newWindowLink">&#8220;Crash Course to
        ORKFiA&#8221;</a>.</p></li>

        <li><a name="5"></a><h3>Is there anything I must know?</h3>
        <p>Yes, you should read our <a href="main.php?cat=main&amp;page=CoC">Code
        of Conduct</a>, which contains <em>the rules</em> that are enforced
        within the game.</p></li>

        <li><a name="6"></a><h3>How do I win?</h3>
        <p>After 6 weeks (in orkfia time this measures 84 years) your tribe leader
        is 100 years old and dying. If you have played well and had a fun time
        with others in your alliance, you are a winner. But true victory
        can be measured many ways, is it killing others you put pride
        in, or maybe winning wars? There are many ways to prove your skill in
        ORKFiA, the most prestigious ones depending on good teamwork and
        the success of your alliance.</p></li>

        <li><a name="7"></a><h3>What do I get if I win?</h3>
        <p>If you survive the full period of 6 weeks that your leader has to live,
        you will start your next tribe with a heritage bonus to land, money
        and fame, based on the success of your previous tribe. </p></li>

        <li><a name="8"></a><h3>Where do all players hang out?</h3>
        <p>First and most important place to hang out will be inside your alliance,
        using the alliance forum. To interact with other players we have two
        official places: the <a
        href="<?php 
    echo HOST;
    ?>
main.php?cat=main&amp;page=forums&amp;set=world">Forum
        </a>, and the <a href="irc://irc.netgamers.org/orkfia" target="_blank"
        class="newWindowLink">#orkfia IRC-channel</a> (located at the netgamers.org
        server).</p></li>

        <li><a name="9"></a><h3>Where can I find more information?</h3>
        <p>The best place for game information is the
        <a href="<?php 
    echo HOST_GUIDE;
    ?>
" target="_blank" class="newWindowLink">
        ORKFiA Player Guide</a>.</p></li>
        </ol>

        <p><em>We wish you the best of luck getting to learn this exciting
        strategy game, and hope to see you inside the game soon!<br />
        ~ The ORKFiA Staff Team</em></p>

    </div>
<?php 
}
示例#7
0
function include_targetfinder_text()
{
    global $Host;
    include_once('inc/functions/tools.php');
    include_once("inc/classes/clsUser.php");
    require_once('inc/races/clsRace.php');


    // value initializations for the echos in the form

    if(!empty($_POST))
    {
        $landMin=stripslashes($_POST["landMin"]);
        $landMax=stripslashes($_POST["landMax"]);
        $strMin=stripslashes($_POST["strMin"]);
        $strMax=stripslashes($_POST["strMax"]);
        $fameMin=stripslashes($_POST["fameMin"]);
        $fameMax=stripslashes($_POST["fameMax"]);
        if(empty($_POST["races"])) {
            echo "<div class=\"center negative\">You need to select at least 1 race</div>";
            $races[0] = "";
        } else {
        $races=$_POST["races"];
        }
        $sort=$_POST["sort"];
        $sortType=$_POST["sortType"];
        $error=false;
        // adding a lil check or max was higher then min
        if(!empty($landMax)&&$landMin>$landMax)
        {
            echo "<div class=\"center negative\">Your land minimum is higher than land maximum!</div>";
            $error=true;
        }
        if(!empty($strMax)&&$strMin>$strMax)
        {
            echo "<div class=\"center negative\">Your strength minimum is higher than strength maximum!</div>";
            $error=true;
        }
        if(!empty($fameMax)&&$fameMin>$fameMax)
        {
            echo "<div class=\"center negative\">Your fame minimum is higher than fame maximum!</div>";
            $error=true;
        }
        if(!is_numeric($landMin)&&!is_numeric($landMax)&&!is_numeric($strMin)&&!is_numeric($strMax)&&!is_numeric($fameMin)&&!is_numeric($fameMax))
        {
            echo "<div class=\"center negative\">You must fill at least one search criterium!</div>";
            $error=true;
        }

    }
    else
    {
        $landMin="";
        $landMax="";
        $strMin="";
        $strMax="";
        $fameMin="";
        $fameMax="";
        /*$races[0]="Uruk Hai";
        $races[1]="Oleg Hai";
        $races[2]="Mori Hai";
        $races[3]="Dark Elf";
        $races[4]="Wood Elf";
        $races[5]="High Elf";
        $races[6]="Dwarf";
        $races[7]="Brittonian";
        $races[8]="Viking";
        $races[9]="Raven";
        $races[10]="Dragon";
        $races[11]="Eagle";
        $races[12]="Nazgul";
        $races[13]="Undead";
        $races[14]="Spirit";*/
        $races = clsRace::getRaces();
        $sort="land";
        $sortType="DESC";
    }
?>

<form id="tFinder" method="post" action="main.php?cat=game&amp;page=targetfinder&amp;z=do">
    <table cellpadding="0" cellspacing="0">
        <tbody>
            <tr class="header">
                <th colspan="3">Target Finder</th>
            </tr>
            <tr class="subheader">
                <th>Type</th>
                <th colspan="2">Option</th>
            </tr>
            <tr class="data">
                <th>Land Size: </th>
                <td>From <input type="text" name="landMin" size="8" maxlength="6" value="<? echo $landMin; ?>" /></td>
                <td>To <input type="text" name="landMax" size="8" maxlength="6" value="<? echo $landMax; ?>" /></td>
            </tr>
            <tr class="data">
                <th>Strength: </th>
                <td>From <input type="text" name="strMin" size="8" maxlength="8" value="<? echo $strMin; ?>" /></td>
                <td>To <input type="text" name="strMax" size="8" maxlength="8" value="<? echo $strMax; ?>" /></td>
            </tr>
            <tr class="data">
                <th>Fame: </th>
                <td>From <input type="text" name="fameMin" size="8" maxlength="6" value="<? echo $fameMin; ?>" /></td>
                <td>To <input type="text" name="fameMax" size="8" maxlength="6" value="<? echo $fameMax; ?>" /></td>
            </tr>
            <tr class="data">
                <th>
                    Races:
                </th>
                <td colspan="2" class="center">
                    <table>
                        <tbody>
<?php 
/*                            <tr class="data">
                                <td class="left"><input name="races[]" type="checkbox" value="Uruk Hai" <? if(in_array("Uruk Hai",$races)) echo "checked=\"checked\""; ?> /> Uruk Hai</td>
                                <td class="left"><input name="races[]" type="checkbox" value="Oleg Hai" <? if(in_array("Oleg Hai",$races)) echo "checked=\"checked\""; ?> /> Oleg Hai</td>
                                <td class="left"><input name="races[]" type="checkbox" value="Mori Hai" <? if(in_array("Mori Hai",$races)) echo "checked=\"checked\""; ?> /> Mori Hai</td>
                            </tr>
                            <tr class="data">
                                <td class="left"><input name="races[]" type="checkbox" value="Dark Elf" <? if(in_array("Dark Elf",$races)) echo "checked=\"checked\""; ?> /> Dark Elf</td>
                                <td class="left"><input name="races[]" type="checkbox" value="Wood Elf" <? if(in_array("Wood Elf",$races)) echo "checked=\"checked\""; ?> /> Wood Elf</td>
                                <td class="left"><input name="races[]" type="checkbox" value="High Elf" <? if(in_array("High Elf",$races)) echo "checked=\"checked\""; ?> /> High Elf</td>
                            </tr>
                            <tr class="data">
                                <td class="left"><input name="races[]" type="checkbox" value="Dwarf" <? if(in_array("Dwarf",$races)) echo "checked=\"checked\""; ?> /> Dwarf</td>
                                <td class="left"><input name="races[]" type="checkbox" value="Brittonian" <? if(in_array("Brittonian",$races)) echo "checked=\"checked\""; ?> /> Brittonian</td>
                                <td class="left"><input name="races[]" type="checkbox" value="Viking" <? if(in_array("Viking",$races)) echo "checked=\"checked\""; ?> /> Viking</td>
                            </tr>
                            <tr class="data">
                                <td class="left"><input name="races[]" type="checkbox" value="Raven" <? if(in_array("Raven",$races)) echo "checked=\"checked\""; ?> /> Raven</td>
                                <td class="left"><input name="races[]" type="checkbox" value="Dragon" <? if(in_array("Dragon",$races)) echo "checked=\"checked\""; ?> /> Dragon</td>
                                <td class="left"><input name="races[]" type="checkbox" value="Eagle" <? if(in_array("Eagle",$races)) echo "checked=\"checked\""; ?> /> Eagle</td>
                            </tr>
                            <tr class="data">
                                <td class="left"><input name="races[]" type="checkbox" value="Nazgul" <? if(in_array("Nazgul",$races)) echo "checked=\"checked\""; ?> /> Nazgul</td>
                                <td class="left"><input name="races[]" type="checkbox" value="Undead" <? if(in_array("Undead",$races)) echo "checked=\"checked\""; ?> /> Undead</td>
                                <td class="left"><input name="races[]" type="checkbox" value="Spirit" <? if(in_array("Spirit",$races)) echo "checked=\"checked\""; ?> /> Spirit</td>
                            </tr> */
foreach (clsRace::getRaces() as $number => $race) {
    if ($number % 3 == 0) {
        echo '<tr class="data">';
    }
    echo "<td class=\"left\"><input name=\"races[]\" type=\"checkbox\" value=\"{$race}\" ";
    if (in_array($race, $races)) {
        echo 'checked="checked"';
    }
    echo " /> {$race}</td>";
    if ($number % 3 == 2) {
        echo '</tr>';
    }
}
?>
                            </tr>
                        </tbody>
                    </table>
                    <a href="#" onclick="var races=document.getElementById('tFinder')['races[]']; for(var i=0,len=races.length;i<len;i++) races[i].checked=true;">Check All</a>
                    |
                    <a href="#" onclick="var races=document.getElementById('tFinder')['races[]']; for(var i=0,len=races.length;i<len;i++) races[i].checked=false;">Uncheck All</a>
                </td>
            </tr>
            <tr class="data">
                <th>Sort By: </th>
                <td colspan="2">
                    <select name="sort">
                        <option value="land" <? if($sort=="land") echo "selected=\"selected\""; ?>>Land</option>
                        <option value="nw" <? if($sort=="nw") echo "selected=\"selected\""; ?>>Strength</option>
                        <option value="fame" <? if($sort=="fame") echo "selected=\"selected\""; ?>>Fame</option>
                    </select>
                </td>
            </tr>
            <tr class="data">
                <th>Sort Type: </th>
                <td colspan="2">
                    <select name="sortType">
                        <option value="DESC" <? if($sortType=="DESC") echo "selected=\"selected\""; ?>>Descending</option>
                        <option value="ASC" <? if($sortType=="ASC") echo "selected=\"selected\""; ?>>Ascending</option>
                    </select>
                </td>
            </tr>
            <tr class="data">
                <td colspan="3"><input type="submit" name="submit" value="Find Targets" /></td>
            </tr>
        </tbody>
    </table>
</form>
<br />
<?
    if(!empty($_POST))
    {
        if(!$error) // call the actual search & print function if something is filled
        {
            call_target_find($landMin,$landMax,$strMin,$strMax,$fameMin,$fameMax,$races,$sort,$sortType);
        }
    }
}
示例#8
0
function getUnitVariables($strRace)
{
    /*
    
    ****************** same here, use the objects ***************
        switch ($strRace) 
        {
    case "Uruk Hai":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);            
        $arrUnitNames     = array(1 => 'Citizen', 'Gnome', 'Brute', 'Shaman', 
        'Half-Giant', 'Black Guard');
        $arrUnitCost      = array(2 => 50, 500, 625, 1360, 550);
        $arrUnitOffence   = array(2 => 0, 7, 0, 16, 0);
        $arrUnitDefence   = array(2 => 0, 2, 6, 1, 0);
        
    break;
    case "Oleg Hai":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Gnome', 'Wolfrider', 
        'White Skull', 'Harpie', 'Thief');
        $arrUnitCost      = array(2 => 50, 550, 700, 80, 440);
        $arrUnitOffence   = array(2 => 0, 7, 0, 4, 0);
        $arrUnitDefence   = array(2 => 1, 0, 6, 1, 0);
        
    break;
    case "Mori Hai":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Gnome', 'Goblin', 
        'Axethrower', 'Ogre', 'Assassin');
        $arrUnitCost      = array(2 => 60, 300, 425, 650, 800);
        $arrUnitOffence   = array(2 => 0, 3, 0, 4, 6);
        $arrUnitDefence   = array(2 => 0, 0, 4, 5, 0);
        
    break;
    case "Dark Elf":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Slinger', 'Nightstalker', 
        'Sorcerer', 'Nightrider', 'Assassin');
        $arrUnitCost      = array(2 => 50, 200, 350, 810, 330);
        $arrUnitOffence   = array(2 => 0, 2, 0, 3, 0);
        $arrUnitDefence   = array(2 => 1, 0, 4, 7, 0);
        
    break;
    case "Wood Elf":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Slinger', 'Woodrider', 
        'Druid', 'Tree Ent', 'Grassrunner');
        $arrUnitCost      = array(2 => 20, 440, 330, 1400, 300);
        $arrUnitOffence   = array(2 => 0, 4, 0, 0, 0);
        $arrUnitDefence   = array(2 => 0, 0, 4, 9, 0);
        
    break;
    case "High Elf":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Slinger', 'Sage', 
        'Longbowmen', 'Priestess', 'Rogue');
        $arrUnitCost      = array(2 => 85, 700, 820, 350, 275);
        $arrUnitOffence   = array(2 => 0, 6, 0, 3, 0);
        $arrUnitDefence   = array(2 => 0, 0, 6, 3, 0);
        
    break;
    case "Dwarf":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Grunt', 'Hammer Smasher', 
        'Stone Thrower', 'Grey Beard', 'Short Cloak');
        $arrUnitCost      = array(2 => 60, 520, 350, 660, 350);
        $arrUnitOffence   = array(2 => 0, 6, 0, 4, 0);
        $arrUnitDefence   = array(2 => 1, 1, 4, 6, 0);
        
    break;
    case "Viking":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Soldier', 'Swordmen', 
        'Archer', 'Berserker', 'Looter');
        $arrUnitCost      = array(2 => 120, 180, 530, 850, 330);
        $arrUnitOffence   = array(2 => 1, 3, 2, 8, 0);
        $arrUnitDefence   = array(2 => 1, 1, 6, 6, 0);
        
    break;
    case "Brittonian":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Soldier', 'Pikemen', 
        'Crossbowmen', 'Knight', 'Rogue');
        $arrUnitCost      = array(2 => 100, 200, 900, 500, 500);
        $arrUnitOffence   = array(2 => 1, 2, 0, 3, 0);
        $arrUnitDefence   = array(2 => 0, 0, 4, 1, 0);
        
    break;
    case "Raven":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Nester', 'Blackclaw', 
        'Razorwing', 'Blackwing', 'Screecher');
        $arrUnitCost      = array(2 => 10, 150, 700, 800, 350);
        $arrUnitOffence   = array(2 => 0, 2, 0, 5, 0);
        $arrUnitDefence   = array(2 => 0, 0, 5, 5, 0);
        
    break;
    case "Dragon":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Baby Dragon', 'Green Dragon', 
        'Yellow Dragon', 'Red Dragon', 'White Dragon');
        $arrUnitCost      = array(2 => 50, 550, 800, 1350, 440);
        $arrUnitOffence   = array(2 => 1, 25, 0, 50, 0);
        $arrUnitDefence   = array(2 => 1, 0, 32, 15, 0);
        
    break;
    case "Eagle":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Nester', 'Emesen', 'Vendo', 
        'Anekonian', 'Razorbeak');
        $arrUnitCost      = array(2 => 35, 10, 380, 1200, 300);
        $arrUnitOffence   = array(2 => 0, 1, 0, 2, 0);
        $arrUnitDefence   = array(2 => 0, 0, 4, 8, 0);
        
    break;
    case "Nazgul":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Mortal', 'Blackrider', 
        'Bloodpet', 'Wraith', 'Gollum');
        $arrUnitCost      = array(2 => 40, 666, 666, 1375, 660);
        $arrUnitOffence   = array(2 => 0, 2, 0, 9, 0);
        $arrUnitDefence   = array(2 => 0, 0, 2, 9, 0);
        
    break;
    case "Undead":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Skeleton', 'Zombie', 
        'Mummy', 'Vampire', 'Imp');
        $arrUnitCost      = array(2 => 120, 700, 400, 1130, 460);
        $arrUnitOffence   = array(2 => 0, 7, 0, 7, 0);
        $arrUnitDefence   = array(2 => 0, 0, 4, 9, 0);
        
    break;
    case "Spirit":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Ghost', 'Phantom', 
        'Poltergeist', 'Ghoul', 'Apparition');
        $arrUnitCost      = array(2 => 50, 250, 810, 600, 275);
        $arrUnitOffence   = array(2 => 0, 2, 2, 6, 0);
        $arrUnitDefence   = array(2 => 0, 0, 7, 3, 0);
        
    break;
    default:
    */
    $objRace = clsRace::getRace($strRace);
    $arrUnitVariables = $objRace->getUnitVariables();
    $arrUnitNames = $objRace->getUnitNames();
    $arrUnitCost = $objRace->getUnitCosts();
    $arrUnitOffence = $objRace->getUnitOffences();
    $arrUnitDefence = $objRace->getUnitDefences();
    /*
        break;
    }
    */
    $arrUnits['variables'] = $arrUnitVariables;
    $arrUnits['output'] = $arrUnitNames;
    $arrUnits['gold'] = $arrUnitCost;
    $arrUnits['offence'] = $arrUnitOffence;
    $arrUnits['defence'] = $arrUnitDefence;
    return $arrUnits;
}
示例#9
0
function military_cost($race)
{
    global $unit_var, $unit_names, $gold_unit;
    // 10/02/2007 AI
    //    Retrofitting this function to use clsRace
    require_once 'inc/races/clsRace.php';
    $objRace = clsRace::getRace($race);
    $gold_unit = $objRace->getUnitCosts();
    $gold_unit = array_merge(array(''), $gold_unit);
    // ---------------------------------------------------------
    //
    // 19/02/2006 es: race changes
    //
    //    Set the numbers to match the manual (age 23).
    //    Changed dwarves, vikings, undeads, ravens as age changed required
    //
    // 15/04/2002 thalura     race changes for round x
    //
    //    Dark Elves elites cost 500 (instead of 450)
    //    Wood Elves defspecs 0/2 (instead of 0/4) and cost 250 (instead of 425)
    //    High Elves homes +50 people, elites 1/2 (instead of 0/2)
    //    Harpies - defspecs 0/4, cost 500, thieves cost 600, suffers double losses when attacking
    //    Spirit thieves cost 450
    //    Mori Hai +5% homes (instead of +10%), defspecs cost 300 (instead of 150)
    //
}
示例#10
0
function include_uberdev_text()
{
    global $building_count, $building_output, $building_variables;
    if ($_SERVER['SERVER_NAME'] != DEV_SERVER_NAME) {
        echo "EVIL!!!! HOW DID YOU GET HERE?!";
        include_game_down();
        exit;
    }
    $objSrcUser =& $GLOBALS['objSrcUser'];
    $userid = $objSrcUser->get_userid();
    // if stuff is posted, do that first
    if ($_SERVER['REQUEST_METHOD'] == "POST") {
        if (!array_empty($_POST['building'])) {
            var_dump($_POST['building']);
            //debug
            foreach ($_POST['building'] as $strToBuild => $strNumber) {
                if ($strNumber == '') {
                    continue;
                }
                if (get_magic_quotes_gpc()) {
                    $strToBuild = stripslashes($strToBuild);
                    $strNumber = stripslashes($strNumber);
                }
                $strToBuild = mysql_real_escape_string($strToBuild);
                $strNumber = mysql_real_escape_string($strNumber);
                //print("<br />" . "UPDATE build SET $strToBuild = $strNumber WHERE id = $userid" . "<br />"); //debug
                var_dump(mysql_query("UPDATE build SET {$strToBuild} = {$strNumber} WHERE id = {$userid}"));
                echo '<br />' . mysql_error();
            }
        }
        if (!array_empty($_POST['population'])) {
            var_dump($_POST['population']);
            //debug
            foreach ($_POST['population'] as $strToTrain => $strNumber) {
                if ($strNumber == '') {
                    continue;
                }
                if (get_magic_quotes_gpc()) {
                    $strToTrain = stripslashes($strToTrain);
                    $strNumber = stripslashes($strNumber);
                }
                $strToTrain = mysql_real_escape_string($strToTrain);
                $strNumber = mysql_real_escape_string($strNumber);
                if ($strToTrain == "citizen") {
                    $objSrcUser->set_pop(CITIZENS, $strNumber);
                    print "<br />true";
                } else {
                    //print("<br />" . "UPDATE army SET $strToTrain = $strNumber WHERE id = $userid" . "<br />"); //debug
                    var_dump(mysql_query("UPDATE army SET {$strToTrain} = {$strNumber} WHERE id = {$userid}"));
                    echo '<br />' . mysql_error();
                }
            }
        }
        if (!empty($_POST['SQL'])) {
            $strSQL = $_POST['SQL'];
            if (get_magic_quotes_gpc()) {
                $strSQL = stripslashes($strSQL);
            }
            var_dump($strSQL);
            //debug
            $res = mysql_query($strSQL);
            if (!$res) {
                echo '<br />' . mysql_error();
            } elseif ($res === true) {
                echo '<br />Success! ' . mysql_affected_rows() . ' rows updated.';
            } else {
                $rows = mysql_num_rows($res);
                echo "{$rows} rows returned<br />";
                if ($rows) {
                    echo "<table class='medium'><tr class='subheader'>";
                    $line = mysql_fetch_assoc($res);
                    foreach (array_keys($line) as $label) {
                        echo "<th>{$label}</th>";
                    }
                    echo "</tr>";
                    do {
                        echo "<tr class='data'>";
                        foreach ($line as $item) {
                            echo '<td>' . $item . '</td>';
                        }
                        echo '</tr>';
                    } while ($line = mysql_fetch_assoc($res));
                    echo '</table>';
                }
            }
        }
    }
    //now for the actual form
    ?>
<form action="<? echo $_SERVER['REQUEST_URI']; ?>" method="post">
    <table class="medium">
        <tr class="header">
            <th>Data</th>
            <th class="right">Value</th>
        </tr>
<?php 
    $objUser =& $GLOBALS["objSrcUser"];
    $arrSrcStats = $objUser->get_stats();
    $level = $arrSrcStats['level'];
    if ($level >= 5) {
        ?>
        <tr class="subheader">
            <th>raw SQL</th>
        </tr>
        <tr class="data">
            <th>SQL</th>
            <td><input type="text" name="SQL" size="50" /></td>
        </tr>
<?php 
    }
    ?>
        <tr class="subheader">
            <th>Buildings</th>
        </tr>
        <tr class="data">
            <th>Total acres</th>
            <td><input type="text" name="building[land]" /></td>
        </tr>

<?php 
    include_once "inc/functions/build.php";
    $arrBuild = $objSrcUser->get_builds();
    $arrStat = $objSrcUser->get_stats();
    //mysql_grab($userid, 'local', 'goods', 'build', 'pop');
    build_cost();
    building_names();
    //general_build();
    for ($i = 1; $i <= $building_count; $i++) {
        echo "<tr class=\"data\">" . "<th>{$building_output[$i]}</th>" . "<td><input type=\"text\" name=\"building[{$building_variables[$i]}]\" /></td>" . "</tr>";
    }
    ?>
        <tr class="subheader">
            <th>Population</th>
        </tr>
<?php 
    $objRace = clsRace::getRace($objSrcUser->get_stat(RACE));
    $arrUnitVar = $objRace->getUnitVariables();
    $arrUnitNames = $objRace->getUnitNames();
    for ($i = 1; $i < 7; $i++) {
        echo "<tr class=\"data\">" . "<th>{$arrUnitNames[$i]}</th>" . "<td><input type=\"text\" name=\"population[{$arrUnitVar[$i]}]\" /></td>" . "</tr>";
    }
    ?>
    </table>
    <input type="submit" value="do crazy stuff" />
</form>
<?php 
}
示例#11
0
function get_unit_names($i_strRace)
{
    $unit_names = "";
    //switch to using clsRace - AI 10/02/2007
    $unit_var = "citizen|unit1|unit2|unit3|unit4|unit5";
    $unit_var = explode("|", $unit_var);
    require_once 'inc/races/clsRace.php';
    $objRace = clsRace::getRace($i_strRace);
    $unit_names = $objRace->getUnitNames();
    return array($unit_var, $unit_names);
}
示例#12
0
function include_rankings_text()
{
    global $Host;
    require_once 'inc/races/clsRace.php';
    include_once 'inc/classes/clsGame.php';
    $objGame = new clsGame();
    $iAgeNumber = $objGame->get_game_time(AGE_NUMBER);
    $show = 'alliance';
    if (isset($_GET['show'])) {
        $show = $_GET['show'];
    }
    echo get_rankings_links($show);
    $link = "main.php?cat=game&amp;page=rankings&amp;show={$show}&amp;type=";
    $rankingsText = '<div id="textBig">';
    switch ($show) {
        case "annual":
            $rankingsText .= "<h2>History Rankings</h2>" . "<h3>Alliance</h3>" . "<p>" . " | <a href=\"" . $link . "currentage\">Current Age</a> |" . "   <a href=\"" . $link . "topalli\">King Of The Hill</a> |" . "   <a href=\"" . $link . "topland\">Largest Alliance</a> |" . "</p>";
            if (!isset($_GET['type'])) {
                $_GET['type'] = 'currentage';
            }
            break;
        case "personal":
            $rankingsText .= "<h2>Personal Rankings</h2>" . "<p> | <a href=\"" . $link . "pland\">Land</a> |" . "   <a href=\"" . $link . "pstr\">Strength</a> |" . "   <a href=\"" . $link . "pfame\">Fame</a> |" . "</p><p>";
            //modified to find out about races dynamically - AI 17/02/2007
            $races = clsRace::getRaces();
            $active_races = clsRace::getActiveRaces();
            foreach ($races as $number => $race) {
                if ($number % 3 == 0) {
                    $rankingsText .= '- ';
                }
                $style = '';
                if (!in_array($race, $active_races)) {
                    $style = 'style="font-style:italic;"';
                }
                $rankingsText .= "<span {$style}>{$race} [ " . "<a href=\"" . $link . "rland&amp;race={$number}\">Land</a> | " . "<a href=\"" . $link . "rstr&amp;race={$number}\">Strength</a> | " . "<a href=\"" . $link . "rfame&amp;race={$number}\">Fame</a> ]  </span>";
                if ($number % 3 == 2) {
                    $rankingsText .= '<br />';
                }
            }
            $rankingsText .= "</p>";
            if (!isset($_GET['type'])) {
                $_GET['type'] = 'pland';
            }
            break;
        case "alliance":
            $rankingsText .= "<h2>Alliance Rankings</h2>" . "<p>| <a href=\"" . $link . "aland\">Land</a> | " . "   <a href=\"" . $link . "astr\">Strength</a> | " . "   <a href=\"" . $link . "afame\">Fame</a> | " . "<a href=\"" . $link . "support\">Top Voting Supporters</a></p>";
            if (!isset($_GET['type'])) {
                $_GET['type'] = 'aland';
            }
            break;
    }
    $rankingsText .= '</div>';
    echo $rankingsText;
    if (!isset($_GET['type'])) {
        include_game_down();
        exit;
    }
    $strType = $_GET["type"];
    if ($strType == "pstr") {
        $strTitle = "Individual Strength Rankings";
        $strRankingType = "p";
        $type = "Strength";
        $dbtype = "nw";
    } elseif ($strType == "pfame") {
        $strTitle = "Individual Fame Rankings";
        $strRankingType = "p";
        $type = "Fame";
        $dbtype = "fame";
    } elseif ($strType == "pland") {
        $strTitle = "Individual Land Rankings";
        $strRankingType = "p";
        $type = "Acres";
        $dbtype = "land";
    } elseif ($strType == "astr") {
        $strTitle = "Alliance Strength Rankings";
        $strRankingType = "a";
        $type = "Strength";
        $dbtype = "nw";
    } elseif ($strType == "aland") {
        $strTitle = "Alliance Land Rankings";
        $strRankingType = "a";
        $type = "Acres";
        $dbtype = "land";
    } elseif ($strType == "afame") {
        $strTitle = "Alliance Fame Rankings";
        $strRankingType = "a";
        $type = "Fame";
        $dbtype = "fame";
    } elseif ($strType == "rstr") {
        $strTitle = "Individual Race Strength Rankings";
        $strRankingType = "r";
        $type = "Strength";
        $dbtype = "nw";
    } elseif ($strType == "rland") {
        $strTitle = "Individual Race Land Rankings";
        $strRankingType = "r";
        $type = "Acres";
        $dbtype = "land";
    } elseif ($strType == "rfame") {
        $strTitle = "Individual Race Fame Rankings";
        $strRankingType = "r";
        $type = "Fame";
        $dbtype = "fame";
    } elseif ($strType == "support") {
        $strTitle = "Top Supporters";
        $strRankingType = "s";
    } elseif ($strType == "topalli") {
        $strTitle = "King Of The Hill History";
        $strRankingType = "ta";
    } elseif ($strType == "topland") {
        $strTitle = "Largest Alliance History";
        $strRankingType = "tl";
    } elseif ($strType == "currentage") {
        $strTitle = "Age {$iAgeNumber} Rankings";
        $strRankingType = "ca";
    }
    //     elseif ($strType == "truetopalli") {
    //         $strTitle = "King Of The Hill (In Recent History)";
    //         $strRankingType = "tta";
    //         $dbtype = "alli_name";
    //     } elseif ($strType == "truetopalliid") {
    //         $strTitle = "King Of The Hill (In Recent History)";
    //         $strRankingType = "tta";
    //         $dbtype = "alli_id";
    //     }
    if (isset($_GET['race'])) {
        $race = $_GET['race'];
        //modified to be dynamic - AI 17/02/2007
        $races = clsRace::getRaces();
        $race = $races[$race];
    }
    echo "<br />";
    if ($strRankingType == "p") {
        $res = mysql_query("SELECT id,tribe_name,race,alli_id," . $dbtype . " FROM rankings_personal WHERE alli_id > 10 ORDER BY " . $dbtype . " DESC LIMIT 200");
        echo "<table class=\"big\" cellpadding=\"0\" cellspacing=\"0\">";
        echo "<tr class=\"header\"><th colspan=\"4\">" . $strTitle . "</th></tr>";
        echo "<tr class=\"subheader\">";
        echo "<th>Tribe Name</th>";
        echo "<th>Race</th>";
        echo "<th>Alliance</th>";
        echo "<th class=\"right\">" . $type . "</th>";
        echo "</tr>";
        $iCount = 1;
        while ($line = mysql_fetch_assoc($res)) {
            $cm = $iCount % 2 == 0 ? " even" : " odd";
            echo "<tr class=\"data" . $cm . "\">";
            echo "<th>{$iCount}. " . stripslashes($line["tribe_name"]) . "</th>";
            echo "<td class=\"left\">" . $line["race"] . "</td>";
            echo "<td class=\"left\">" . "(#<a href=\"main.php?cat=game&amp;page=alliance&amp;aid=" . $line["alli_id"] . "\">" . $line["alli_id"] . "</a>)</td>";
            echo "<td>" . number_format($line[$dbtype]) . "</td>";
            echo "</tr>";
            $iCount++;
        }
    } elseif ($strRankingType == "a") {
        $res = mysql_query("SELECT id,alli_name,alli_desc," . $dbtype . " FROM rankings_alliance WHERE id > 10 ORDER BY " . $dbtype . " DESC LIMIT 50");
        echo "<table class=\"big\" cellpadding=\"0\" cellspacing=\"0\">";
        echo "<tr class=\"header\"><th colspan=\"5\">" . $strTitle . "</th></tr>";
        echo "<tr class=\"subheader\">";
        echo "<th width=\"25\">&nbsp;</th>";
        echo "<th>Alliance Name</th>";
        echo "<th class=\"left\">Alliance Description</th>";
        echo "<th>#</th>";
        echo "<th class=\"right\">" . $type . "</th>";
        echo "</tr>";
        $iCount = 1;
        while ($line = mysql_fetch_assoc($res)) {
            $cm = $iCount % 2 == 0 ? " even" : " odd";
            echo "<tr class=\"data" . $cm . "\">";
            echo "<th class=\"left\">" . $iCount . ".</th>";
            echo "<th class=\"left\">" . stripslashes($line["alli_name"]) . "</th>";
            echo "<td class=\"left\">" . stripslashes($line["alli_desc"]) . "</td>";
            echo "<td class=\"left\">" . "(#<a href=\"main.php?cat=game&amp;page=alliance&amp;aid=" . $line["id"] . "\">" . $line["id"] . "</a>) " . "</td>";
            echo "<td>" . number_format($line[$dbtype]) . "</td>";
            echo "</tr>";
            $iCount++;
        }
    } elseif ($strRankingType == "r") {
        $res = mysql_query("SELECT id,tribe_name,race,alli_id," . $dbtype . " FROM rankings_personal WHERE alli_id > 10 AND race = '" . $race . "' ORDER BY " . $dbtype . " DESC LIMIT 50");
        echo "<table class=\"big\" cellpadding=\"0\" cellspacing=\"0\">";
        echo "<tr class=\"header\"><th colspan=\"4\">" . $strTitle . "</th></tr>";
        echo "<tr class=\"subheader\">";
        echo "<th>Tribe Name</th>";
        echo "<th>Race</th>";
        echo "<th>Alliance</th>";
        echo "<th class=\"right\">" . $type . "</th>";
        echo "</tr>";
        $iCount = 1;
        while ($line = mysql_fetch_assoc($res)) {
            $cm = $iCount % 2 == 0 ? " even" : " odd";
            echo "<tr class=\"data" . $cm . "\">";
            echo "<th>{$iCount}. " . stripslashes($line["tribe_name"]) . "</th>";
            echo "<td class=\"left\">" . $line["race"] . "</td>";
            echo "<td class=\"left\">" . "(#<a href=\"main.php?cat=game&amp;page=alliance&amp;aid=" . $line["alli_id"] . "\">" . $line["alli_id"] . "</a>)</td>";
            echo "<td>" . number_format($line[$dbtype]) . "</td>";
            echo "</tr>";
            $iCount++;
        }
    } elseif ($strRankingType == "s") {
        $query = mysql_query("SELECT id, name, vote_count FROM `" . ALLIANCE . "` WHERE id > 1 ORDER BY vote_count DESC  LIMIT 0 , 50");
        echo "<table class=\"big\" cellpadding=\"0\" cellspacing=\"0\">";
        echo "<tr class=\"header\"><th colspan=\"2\">Top Supporters</th></tr>";
        echo "<tr class=\"subheader\">";
        echo "<th>Alliance Name</th>";
        echo "<th class=\"right\">Votes</th>";
        echo "</tr>";
        $iCount = 1;
        while ($line = mysql_fetch_assoc($query)) {
            $cm = $iCount % 2 == 0 ? " even" : " odd";
            echo "<tr class=\"data" . $cm . "\">";
            echo "<th>{$iCount}. " . stripslashes($line['name']) . " (#<a href=\"main.php?cat=game&amp;page=alliance&amp;aid=" . $line['id'] . "\">" . $line['id'] . "</a>)</th>";
            echo "<td>" . number_format($line['vote_count']) . "</td>";
            echo "</tr>";
            $iCount++;
        }
    } elseif ($strRankingType == "ta") {
        include_once 'inc/classes/clsGame.php';
        $objGame = new clsGame();
        $iCurrentYear = $objGame->get_year_history();
        // Nuvarande
        $resSQL = mysql_query("SELECT alli_id, alli_name, alli_desc, year, land FROM rankings_history WHERE year = {$iCurrentYear} AND year > 105 LIMIT 1");
        // Alla genom history
        $resSQL2 = mysql_query("SELECT year, alli_id, alli_name, alli_desc FROM rankings_history WHERE alli_id > 10 AND year > 105 GROUP BY year ASC");
        // Lista Alla För att summera i PHP
        $old_id = 0;
        $iCount = 0;
        while ($arrRow = mysql_fetch_assoc($resSQL2)) {
            $new_id = $arrRow['alli_id'];
            if ($new_id != $old_id) {
                // prepare for new alliance
                $iCount++;
                // Copy SQL result row
                $arrAlliance[$iCount] = $arrRow;
                // add a starting year column to display period, eg 100 - 106 OE
                $arrAlliance[$iCount]['starting_year'] = $arrRow['year'];
                // add an ending year column to display period, eg 100 - 106 OE
                $arrAlliance[$iCount]['ending_year'] = $arrRow['year'];
                // add a year counter column, starting value = 1
                $arrAlliance[$iCount]['years'] = 1;
                // Save alliance id for next loop
                $old_id = $new_id;
            } elseif ($new_id == $old_id) {
                // add another year to our counter column
                $arrAlliance[$iCount]['years']++;
                // update ending year column
                $arrAlliance[$iCount]['ending_year'] = $arrRow['year'];
            }
        }
        //======================================================================
        // Sort the array
        //======================================================================
        // Obtain the column to sorty by
        foreach ($arrAlliance as $key => $row) {
            $years[$key] = $row['years'];
        }
        // Sort the data with years descending
        // Add $arrAlliance as the last parameter, to sort by the common key
        array_multisort($years, SORT_DESC, $arrAlliance);
        //======================================================================
        // Done sorting ;)
        //======================================================================
        echo "<table class=\"big\" cellpadding=\"0\" cellspacing=\"0\">";
        echo "<tr class=\"header\"><th colspan=\"6\">" . $strTitle . "</th></tr>";
        echo "<tr class=\"subheader\">";
        echo "<th colspan=\"2\"> Alliance Name </th>";
        echo "<th width=\"40%\"> Description </th>";
        echo "<th> # </th>";
        echo "<th> Period </th>";
        echo "<th class=\"right\"> Years </th>";
        echo "</tr>";
        $iCount = 1;
        while ($arrAlliance1 = mysql_fetch_array($resSQL)) {
            // pick out the current year alliance from our history array
            foreach ($arrAlliance as $arrAlliance2) {
                if ($arrAlliance1['year'] == $arrAlliance2['ending_year']) {
                    $arrAlliance1 = $arrAlliance2;
                    break;
                }
            }
            $cm = $iCount % 2 == 0 ? " even" : " odd";
            echo "<tr class=\"data" . $cm . "\">";
            echo "<th width=\"25\" class=\"bsdown\">{$iCount}. </th>";
            echo "<th class=\"bsdown\">" . stripslashes($arrAlliance1['alli_name']) . "</th>";
            echo "<td class=\"bsdown left\">" . $arrAlliance1['alli_desc'] . "</td>";
            echo "<td class=\"bsdown left\">" . "(#<a href=\"main.php?cat=game&amp;page=alliance&amp;aid=" . $arrAlliance1['alli_id'] . "\">" . $arrAlliance1['alli_id'] . "</a>)" . "</td>";
            echo "<td class=\"bsdown left\">" . $arrAlliance1['starting_year'] . ' - <strong>' . $arrAlliance1['ending_year'] . "</strong> OE</td>";
            echo "<td class=\"bsdown\">" . $arrAlliance1['years'] . "</td>";
            echo "</tr>";
            $iCount++;
        }
        foreach ($arrAlliance as $arrAlliance) {
            $cm = $iCount % 2 == 0 ? " even" : " odd";
            echo "<tr class=\"data" . $cm . "\">";
            echo "<th width=\"25\">{$iCount}. </th>";
            echo "<th>" . stripslashes($arrAlliance['alli_name']) . "</th>";
            echo "<td class=\"left\">" . $arrAlliance['alli_desc'] . "</td>";
            echo "<td class=\"left\">" . "(#<a href=\"main.php?cat=game&amp;page=alliance&amp;aid=" . $arrAlliance['alli_id'] . "\">" . $arrAlliance['alli_id'] . "</a>)" . "</td>";
            echo "<td class=\"left\">" . $arrAlliance['starting_year'] . ' - ' . $arrAlliance['ending_year'] . " OE</td>";
            echo "<td>" . $arrAlliance['years'] . "</td>";
            echo "</tr>";
            $iCount++;
            //             if ($iCount == 10)
            //             {
            //                 break;
            //             }
        }
    } elseif ($strRankingType == "tl") {
        include_once 'inc/classes/clsGame.php';
        $objGame = new clsGame();
        $iCurrentYear = $objGame->get_year_history();
        $query1 = mysql_query("SELECT alli_id,alli_name,alli_desc,year,land FROM rankings_history WHERE year = {$iCurrentYear} AND year > 105 LIMIT 1");
        echo "<table class=\"big\" cellpadding=\"0\" cellspacing=\"0\">";
        echo "<tr class=\"header\"><th colspan=\"5\">" . $strTitle . "</th></tr>";
        echo "<tr class=\"subheader\">";
        echo "<th colspan=\"2\"> Alliance Name </th>";
        echo "<th> Description </th>";
        echo "<th class=\"right\"> Year </th>";
        echo "<th class=\"right\"> Acres </th>";
        echo "</tr>";
        $iCount = 1;
        while ($line = mysql_fetch_array($query1)) {
            $cm = $iCount % 2 == 0 ? " even" : " odd";
            echo "<tr class=\"data" . $cm . "\">";
            echo "<th width=\"25\" class=\"bsdown\">{$iCount}.</th>";
            echo "<th class=\"bsdown\">" . stripslashes($line['alli_name']) . " (#<a href=\"main.php?cat=game&amp;page=alliance&amp;aid=" . $line['alli_id'] . "\">" . $line['alli_id'] . "</a>) </th>";
            echo "<td class=\"bsdown\">" . $line['alli_desc'] . "</td>";
            echo "<td class=\"bsdown\">" . $line['year'] . " OE</td>";
            echo "<td class=\"bsdown\">" . number_format($line['land']) . "</td>";
            echo "</tr>";
            $iCount++;
        }
        $query = mysql_query("SELECT alli_id,alli_name,alli_desc,year,MAX(land) as land FROM rankings_history WHERE alli_id > 10 AND year > 105 GROUP BY alli_id ORDER BY land DESC");
        // GROUP BY alli_name
        while ($line = mysql_fetch_array($query)) {
            $cm = $iCount % 2 == 0 ? " even" : " odd";
            echo "<tr class=\"data" . $cm . "\">";
            echo "<th width=\"25\">{$iCount}.</th>";
            echo "<th>" . stripslashes($line['alli_name']) . " (#<a href=\"main.php?cat=game&amp;page=alliance&amp;aid=" . $line['alli_id'] . "\">" . $line['alli_id'] . "</a>)" . "</th>";
            echo "<td>" . $line['alli_desc'] . "</td>";
            echo "<td>" . $line['year'] . " OE</td>";
            echo "<td>" . number_format($line['land']) . "</td>";
            echo "</tr>";
            $iCount++;
        }
    } elseif ($strRankingType == "ca") {
        include_once 'inc/classes/clsGame.php';
        $objGame = new clsGame();
        $iCurrentYear = $objGame->get_year_history();
        $iAgeNumber = $objGame->get_game_time(AGE_NUMBER);
        include_once 'inc/classes/clsAge.php';
        $objNewAge = new clsAge();
        $objNewAge->loadAge($iAgeNumber);
        $iFirstYear = $objNewAge->getFirstYear();
        $iLastYear = $objNewAge->getLastYear();
        // Alla genom history
        $resSQL2 = mysql_query("SELECT year, alli_id, alli_name, alli_desc FROM rankings_history WHERE alli_id > 10 AND year >= {$iFirstYear} AND year <= {$iLastYear} GROUP BY alli_id,year ASC");
        // Lista Alla För att summera i PHP
        $old_id = 0;
        $iCount = 0;
        while ($arrRow = mysql_fetch_assoc($resSQL2)) {
            $new_id = $arrRow['alli_id'];
            if ($new_id != $old_id) {
                // prepare for new alliance
                $iCount++;
                // Copy SQL result row
                $arrAlliance[$iCount] = $arrRow;
                // add a starting year column to display period, eg 100 - 106 OE
                $arrAlliance[$iCount]['starting_year'] = $arrRow['year'];
                // add an ending year column to display period, eg 100 - 106 OE
                $arrAlliance[$iCount]['ending_year'] = $arrRow['year'];
                // add a year counter column, starting value = 1
                $arrAlliance[$iCount]['years'] = 1;
                // Save alliance id for next loop
                $old_id = $new_id;
            } elseif ($new_id == $old_id) {
                // add another year to our counter column
                $arrAlliance[$iCount]['years']++;
                // update ending year column
                $arrAlliance[$iCount]['ending_year'] = $arrRow['year'];
            }
        }
        //======================================================================
        // Sort the array
        //======================================================================
        // Obtain the column to sorty by
        foreach ($arrAlliance as $key => $row) {
            $years[$key] = $row['years'];
        }
        // Sort the data with years descending
        // Add $arrAlliance as the last parameter, to sort by the common key
        array_multisort($years, SORT_DESC, $arrAlliance);
        //======================================================================
        // Done sorting ;)
        //======================================================================
        echo '<div class="center">' . '<h1 style="margin-top: 0;">Age ' . $iAgeNumber . ' Rankings (' . $iFirstYear . ' - ' . $iLastYear . ' OE)</h1>' . '</div>';
        //             echo "<h2>Top Alliance History</h2>";
        $strTopAllianceCurrentTable = '<table class="big" cellpadding="0" cellspacing="0">' . '<tr class="header">' . '<th colspan="5">King of the Hill</th>' . '</tr>' . '<tr class="subheader">' . '<th>&nbsp;</th>' . '<th>Alliance Name</th>' . '<th>Alliance Description</th>' . '<th>#</th>' . '<th class="right">Years</th>' . '</tr>';
        $iCount = 1;
        foreach ($arrAlliance as $arrAlliance) {
            $strTopAllianceCurrentTable .= '<tr class="data">' . '<th width="25">' . $iCount . '.</th>' . '<th>' . stripslashes($arrAlliance['alli_name']) . '</th>' . '<td class="left">' . stripslashes($arrAlliance['alli_desc']) . '</td>' . '<td class="left">' . '(#<a href="main.php?cat=game&amp;page=alliance&amp;aid=' . $arrAlliance['alli_id'] . '">' . $arrAlliance['alli_id'] . '</a>)' . '</td>' . '<td>' . $arrAlliance['years'] . ' years on top</td>' . '</tr>';
            $iCount++;
        }
        $strTopAllianceCurrentTable .= '</table>';
        echo $strTopAllianceCurrentTable;
        //**************************************************************************
        // 2nd LIST
        //**************************************************************************
        function doit1()
        {
            include_once 'inc/classes/clsGame.php';
            $objGame = new clsGame();
            $iCurrentYear = $objGame->get_year_history();
            $iAgeNumber = $objGame->get_game_time(AGE_NUMBER);
            include_once 'inc/classes/clsAge.php';
            $objNewAge = new clsAge();
            $objNewAge->loadAge($iAgeNumber);
            $iFirstYear = $objNewAge->getFirstYear();
            $iLastYear = $objNewAge->getLastYear();
            //             echo "<h2>Top Acreage History</h2>";
            echo '<br />';
            $strTopAcreageCurrentTable = '<table class="big" cellpadding="0" cellspacing="0">' . '<tr class="header">' . '<th colspan="6">Largest Alliance</th>' . '</tr>' . '<tr class="subheader">' . '<th>&nbsp;</th>' . '<th>Alliance Name</th>' . '<th>Alliance Description</th>' . '<th>#</th>' . '<th class="right">Year</th>' . '<th class="right">Acres</th>' . '</tr>';
            $iCount = 1;
            $query = mysql_query("SELECT MAX(land) as land,alli_id,year FROM rankings_history WHERE alli_id > 10 AND year >= {$iFirstYear} AND year <= {$iLastYear} GROUP BY alli_id ORDER BY land DESC");
            while ($line = mysql_fetch_array($query)) {
                $line2 = mysql_fetch_array(mysql_query("SELECT year,alli_name,alli_desc FROM rankings_history WHERE land = {$line['land']} AND alli_id = {$line['alli_id']}"));
                $cm = $iCount % 2 == 0 ? " even" : " odd";
                $strTopAcreageCurrentTable .= '<tr class="data"' . $cm . '">' . '<th width="25">' . $iCount . '.</th>' . '<th>' . stripslashes($line2['alli_name']) . '</th>' . '<td class="left">' . stripslashes($line2['alli_desc']) . '</td>' . '<td class="left">(#<a href="main.php?cat=game&amp;page=alliance&amp;aid=' . $line['alli_id'] . '">' . $line['alli_id'] . '</a>)' . '</td>' . '<td>(' . $line2['year'] . ' OE)</td>' . '<td>' . number_format($line['land']) . ' acres </td>' . '</tr>';
                $iCount++;
            }
            $strTopAcreageCurrentTable .= '</table>';
            echo $strTopAcreageCurrentTable;
        }
        doit1();
        //**************************************************************************
        // 3rd LIST
        //**************************************************************************
        function doit()
        {
            include_once 'inc/classes/clsGame.php';
            $objGame = new clsGame();
            $iCurrentYear = $objGame->get_year_history();
            $iAgeNumber = $objGame->get_game_time(AGE_NUMBER);
            include_once 'inc/classes/clsAge.php';
            $objNewAge = new clsAge();
            $objNewAge->loadAge($iAgeNumber);
            $iFirstYear = $objNewAge->getFirstYear();
            $iLastYear = $objNewAge->getLastYear();
            // Alla genom history
            $resSQL2 = mysql_query("SELECT year, alli_id, alli_name, alli_desc FROM rankings_history WHERE alli_id > 10 AND year >= {$iFirstYear} AND year <= {$iLastYear} GROUP BY year ASC");
            // Lista Alla För att summera i PHP
            $old_id = 0;
            $iCount = 0;
            while ($arrRow = mysql_fetch_assoc($resSQL2)) {
                $new_id = $arrRow['alli_id'];
                if ($new_id != $old_id) {
                    // prepare for new alliance
                    $iCount++;
                    // Copy SQL result row
                    $arrAlliance[$iCount] = $arrRow;
                    // add a starting year column to display period, eg 100 - 106 OE
                    $arrAlliance[$iCount]['starting_year'] = $arrRow['year'];
                    // add an ending year column to display period, eg 100 - 106 OE
                    $arrAlliance[$iCount]['ending_year'] = $arrRow['year'];
                    // add a year counter column, starting value = 1
                    $arrAlliance[$iCount]['years'] = 1;
                    // Save alliance id for next loop
                    $old_id = $new_id;
                } elseif ($new_id == $old_id) {
                    // add another year to our counter column
                    $arrAlliance[$iCount]['years']++;
                    // update ending year column
                    $arrAlliance[$iCount]['ending_year'] = $arrRow['year'];
                }
            }
            //======================================================================
            // Sort the array
            //======================================================================
            // Obtain the column to sorty by
            foreach ($arrAlliance as $key => $row) {
                $years[$key] = $row['starting_year'];
            }
            // Sort the data with years descending
            // Add $arrAlliance as the last parameter, to sort by the common key
            array_multisort($years, SORT_ASC, $arrAlliance);
            //======================================================================
            // Done sorting ;)
            //======================================================================
            //             echo '<div class="center"><h2>Timeline</h2></div>';
            echo '<br />';
            $strTimelineCurrentTable = '<table class="big" cellpadding="0" cellspacing="0">' . '<tr class="header">' . '<th colspan="5">Timeline</th>' . '</tr>' . '<tr class="subheader">' . '<th>Period</th>' . '<th>Alliance Name</th>' . '<th>Alliance Description</th>' . '<th>#</th>' . '<th class="right">Years</th>' . '</tr>';
            $iCount = 1;
            foreach ($arrAlliance as $arrAlliance) {
                $strTimelineCurrentTable .= '<tr class="data">' . '<td class="left">(' . $arrAlliance['starting_year'] . ' - ' . $arrAlliance['ending_year'] . ' OE) </td>' . '<th>' . stripslashes($arrAlliance['alli_name']) . '</th>' . '<td class="left">' . stripslashes($arrAlliance['alli_desc']) . '</td>' . '<td class="left">' . '(#<a href="main.php?cat=game&amp;page=alliance&amp;aid=' . $arrAlliance['alli_id'] . '">' . $arrAlliance['alli_id'] . '</a>)</td>' . '<td>' . $arrAlliance['years'] . ' years on top </td>' . '</tr>';
                $iCount++;
            }
            $strTimelineCurrentTable .= '</table>';
            echo $strTimelineCurrentTable;
        }
        doit();
    }
    //     elseif ($strRankingType == 'tta')
    //     {
    //         $strTable =
    //             '<table class="medium" cellpadding="0" cellspacing="0">' .
    //                 '<tr class="header">' .
    //                     '<th colspan="4">' .$strTitle . '</th>' .
    //                 '</tr>' .
    //                 '<tr class="subheader">' .
    //                     '<th>Alliance Name</th>' .
    //                     '<th>#</th>' .
    //                     '<th class="center">Years</th>' .
    //                     '<th class="right">Active</th>' .
    //                 '</tr>';
    //         $strSQL = "SELECT alli_name, alli_desc, alli_id, count(year) as years, year FROM rankings_history WHERE alli_id > 10 AND year > 105 GROUP BY $dbtype ORDER BY id DESC";
    //         $resSQL = mysql_query($strSQL);
    //         $iCount = 1;
    //         while ($arrAlliance = mysql_fetch_array($resSQL))
    //         {
    //             $strTable .=
    //                 '<tr class="data">' .
    //                     '<th>' . stripslashes($arrAlliance['alli_name']) . '</th>' .
    //                     '<td class="left">' . '(#<a href="main.php?cat=game&amp;page=alliance&amp;aid=' . $arrAlliance['alli_id'] . '">' . $arrAlliance['alli_id'] . '</a>)</td>' .
    //                     '<td class="center">' . $arrAlliance['years'] . '</td>' .
    //                     '<td>~' . $arrAlliance['year'] . ' OE</td>' .
    //                 '</tr>';
    //             $iCount++;
    //         }
    //         echo $strTable;
    //     }
    echo '</table>';
}
示例#13
0
 function get_race()
 {
     if (empty($this->_objRace)) {
         $strRace = $this->get_stat(RACE);
         require_once "inc/races/clsRace.php";
         $_objRace = clsRace::getRace($strRace);
     }
     return $_objRace;
 }
示例#14
0
function form_tribe_info()
{
    echo "<div class=\"row\">";
    echo "<strong>Tribe Information</strong>";
    echo "</div>";
    echo "<div class=\"row\">";
    echo "<span class=\"label\">Tribe Name:</span>";
    echo "<span class=\"formw\"><input maxlength=\"20\" name=\"register[tribe]\" /></span>";
    echo "</div>";
    echo "<div class=\"row\">";
    echo "<span class=\"label\">Leader Name:</span>";
    echo "<span class=\"formw\"><input maxlength=\"20\" name=\"register[alias]\" /></span>";
    echo "</div>";
    echo "<div class=\"row\">";
    echo "<span class=\"label\">Choose Race:</span>";
    echo "<span class=\"formw\">";
    echo "<select size=\"1\" name=\"register[race]\">";
    // AI: do this dynamically using getActiveRaces()
    require_once 'inc/races/clsRace.php';
    foreach (clsRace::getActiveRaces() as $raceName) {
        echo "<option value='{$raceName}'>{$raceName}</option>";
    }
    echo "</select> ";
    if ($_SERVER['SERVER_NAME'] == DINAH_SERVER_NAME) {
        echo "<a href=\"" . HOST_GUIDE . "races2.php?chapter=4\" class=\"newWindowLink\" target =\"_blank\" style=\"cursor: help\">Guide</a></span>";
    } else {
        echo "<a href=\"" . HOST_GUIDE . "races.php?chapter=4\" class=\"newWindowLink\" target =\"_blank\" style=\"cursor: help\">Guide</a></span>";
    }
    echo "</div>";
}
示例#15
0
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&amp;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&amp;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&amp;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 
}