コード例 #1
0
function call_admin_switches_text()
{
    global $tool;
    include_once 'inc/functions/resort_tools.php';
    if (!user_has_access($tool)) {
        echo "Sorry, this page is restricted to ORKFiA Staff";
        include_game_down();
        exit;
    }
    include_once 'inc/classes/clsGame.php';
    $objGame = new clsGame();
    if (isset($_POST[ON])) {
        $strTool = $_POST['tool'];
        $objGame->set_game_switch($strTool, ON);
        echo '<p>' . "Switch '{$strTool}' is now turned on." . '<br /><br />' . '<a href="main.php?cat=game&amp;page=resort_tools&amp;' . 'tool=admin_switches">' . 'Return to Tool' . '</a>' . '</p>';
    } elseif (isset($_POST[OFF])) {
        $strTool = $_POST['tool'];
        $objGame->set_game_switch($strTool, OFF);
        echo '<p>' . "Switch '{$strTool}' is now turned off." . '<br /><br />' . '<a href="main.php?cat=game&amp;page=resort_tools&amp;' . 'tool=admin_switches">' . 'Return to Tool' . '</a>' . '</p>';
    } else {
        $strDiv = '<h2>' . 'Admin Switches' . '</h2>';
        $arrGameSwitches = $objGame->get_game_switches();
        foreach ($arrGameSwitches as $strName => $strValue) {
            switch ($strValue) {
                case ON:
                    $strDiv .= '<form method="post" action="main.php?cat=game&amp;page=' . 'resort_tools&amp;tool=admin_switches"><p><b class="positive">' . $strName . ' is ON. <br />' . '<input type="hidden" name="tool" value="' . $strName . '">' . '<input type="submit" name="' . OFF . '" value="Switch OFF ' . $strName . '">' . '</b></p></form>';
                    break;
                case OFF:
                    $strDiv .= '<form method="post" action="main.php?cat=game&amp;page=' . 'resort_tools&amp;tool=admin_switches"><p><b class="negative">' . $strName . ' is OFF. <br />' . '<input type="hidden" name="tool" value="' . $strName . '">' . '<input type="submit" name="' . ON . '" value="Switch ON ' . $strName . '">' . '</b></p></form>';
                    break;
            }
        }
        echo $strDiv;
    }
}
コード例 #2
0
ファイル: alli_ranking.php プロジェクト: BrorHolm/Orkfia-2008
function get_rank_data($alliance_id)
{
    $arrRanking[LAND] = get_alli_ranking(LAND, $alliance_id);
    $arrRanking[STRENGTH] = get_alli_ranking(STRENGTH, $alliance_id);
    $arrRanking[FAME] = get_alli_ranking(FAME, $alliance_id);
    //==========================================================================
    //                                                     Martel, July 25, 2006
    // If this alliance is #1 we check if we should update the annual ranks
    //==========================================================================
    if ($arrRanking[LAND] == 1) {
        include_once 'inc/classes/clsGame.php';
        $objGame = new clsGame();
        // Get Game Year & Most Recent Year Saved
        $iOrkYears = $objGame->get_year_oe();
        $iLastYear = $objGame->get_year_history();
        if ($iOrkYears != $iLastYear) {
            include_once 'inc/classes/clsAlliance.php';
            $objTmpAlliance = new clsAlliance($alliance_id);
            $arrTmpRankings = $objTmpAlliance->get_rankings_alliances();
            $strAlliName = $arrTmpRankings[ALLI_NAME];
            $strAlliDesc = $arrTmpRankings[ALLI_DESC];
            $arrNewHistory = array(YEAR => $iOrkYears, LAND => $arrTmpRankings[LAND], RANK_FAME => $arrRanking[FAME], RANK_STRENGTH => $arrRanking[STRENGTH], ALLI_ID => $arrTmpRankings[ID], ALLI_NAME => "'{$strAlliName}'", ALLI_DESC => "'{$strAlliDesc}'", LAST_UPDATE => date(TIMESTAMP_FORMAT, time()));
            $objGame->set_historys($arrNewHistory);
        }
    }
    //==========================================================================
    return $arrRanking;
}
コード例 #3
0
function call_admin_msg_text()
{
    global $tool;
    include_once 'inc/functions/resort_tools.php';
    if (!user_has_access($tool)) {
        echo "Sorry, this page is restricted to ORKFiA Staff";
        include_game_down();
        exit;
    }
    include_once 'inc/classes/clsGame.php';
    $objGame = new clsGame();
    if (isset($_POST['status'])) {
        $strStatus = $_POST['status'];
        $objGame->set_game_info(STATUS, "'{$strStatus}'");
        echo "Admin Message Updated!" . '<br /><br />' . '<a href="main.php?cat=game&amp;page=resort_tools&amp;' . 'tool=admin_msg">' . 'Return to Tool' . '</a>';
    } else {
        echo $strDiv = '<div id="textMedium">' . '<h2>' . 'Change Admin Message' . '</h2>' . '<p>' . 'Please keep this message short and purposeful, and just ' . 'one item at a time. For longer messages add a link that ' . 'point to the announcement forums.' . '</p>' . '<p>' . 'Write "none" without "s to show nothing.' . '</p>' . '</div>';
        echo '<br />';
        $strAdmin = $objGame->get_game_info(STATUS);
        echo $strForm = '<form method="post" action="' . $_SERVER['REQUEST_URI'] . '">' . '<textarea name="status" rows="8" cols="70" wrap="on">' . $strAdmin . '</textarea>' . '<br /><br />' . '<input type="submit" value="Update Admin Message">' . '</form>';
    }
}
コード例 #4
0
 function doit()
 {
     include_once 'inc/classes/clsGame.php';
     $objGame = new clsGame();
     $iCurrentYear = $objGame->get_year_history();
     $iAgeNumber = $objGame->get_game_time(AGE_NUMBER);
     include_once 'inc/classes/clsAge.php';
     $objNewAge = new clsAge();
     $objNewAge->loadAge($iAgeNumber);
     $iFirstYear = $objNewAge->getFirstYear();
     $iLastYear = $objNewAge->getLastYear();
     // Alla genom history
     $resSQL2 = mysql_query("SELECT year, alli_id, alli_name, alli_desc FROM rankings_history WHERE alli_id > 10 AND year >= {$iFirstYear} AND year <= {$iLastYear} GROUP BY year ASC");
     // Lista Alla För att summera i PHP
     $old_id = 0;
     $count = 0;
     while ($arrRow = mysql_fetch_assoc($resSQL2)) {
         $new_id = $arrRow['alli_id'];
         if ($new_id != $old_id) {
             // prepare for new alliance
             $count++;
             // Copy SQL result row
             $arrAlliance[$count] = $arrRow;
             // add a starting year column to display period, eg 100 - 106 OE
             $arrAlliance[$count]['starting_year'] = $arrRow['year'];
             // add an ending year column to display period, eg 100 - 106 OE
             $arrAlliance[$count]['ending_year'] = $arrRow['year'];
             // add a year counter column, starting value = 1
             $arrAlliance[$count]['years'] = 1;
             // Save alliance id for next loop
             $old_id = $new_id;
         } elseif ($new_id == $old_id) {
             // add another year to our counter column
             $arrAlliance[$count]['years']++;
             // update ending year column
             $arrAlliance[$count]['ending_year'] = $arrRow['year'];
         }
     }
     //======================================================================
     // Sort the array
     //======================================================================
     // Obtain the column to sorty by
     foreach ($arrAlliance as $key => $row) {
         $years[$key] = $row['starting_year'];
     }
     // Sort the data with years descending
     // Add $arrAlliance as the last parameter, to sort by the common key
     array_multisort($years, SORT_ASC, $arrAlliance);
     //======================================================================
     // Done sorting ;)
     //======================================================================
     echo "<h2>Timeline</h2>";
     echo "<table class=\"big\" cellpadding=\"0\" cellspacing=\"0\">";
     $count = 1;
     foreach ($arrAlliance as $arrAlliance) {
         echo "<tr class=\"data\">";
         echo "<td class=\"left\">(" . $arrAlliance['starting_year'] . ' - ' . $arrAlliance['ending_year'] . " OE) </td>";
         echo "<th>" . stripslashes($arrAlliance['alli_name']) . "</th>";
         echo "<td class=\"left\">" . "(#<A HREF=\"main.php?cat=game&amp;page=alliance&amp;aid=" . $arrAlliance['alli_id'] . "\">" . $arrAlliance['alli_id'] . "</A>)" . "</td>";
         echo "<td>" . $arrAlliance['years'] . " years on top </td>";
         $count++;
         echo "</tr>";
     }
     echo "</table>";
 }
コード例 #5
0
ファイル: invade2.inc.php プロジェクト: BrorHolm/Orkfia-2008
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&amp;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&amp;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&amp;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&amp;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]);
    }
}
コード例 #6
0
ファイル: main.php プロジェクト: BrorHolm/Orkfia-2008
     $page_up();
     echo $strDiv = '<div id="textMedium"><p>' . 'You are not logged in, please either ' . '<a href="main.php?cat=main&amp;page=main">login to an existing ' . 'account</a> or <a href="main.php?cat=main&amp;page=register1">' . 'sign up for a new account</a>.' . '</p></div>';
     include_game_down();
     exit;
 }
 //==========================================================================
 // Instantiate Objects
 //==========================================================================
 // User
 $GLOBALS['objSrcUser'] = new clsUser($userid);
 $objSrcUser =& $GLOBALS['objSrcUser'];
 $arrSrcUsers = $objSrcUser->get_user_infos();
 $arrSrcStats = $objSrcUser->get_stats();
 // Game
 include_once 'inc/classes/clsGame.php';
 $objGame = new clsGame();
 //==========================================================================
 // frost: For stable switching, change number to 6 for admin-only access
 //==========================================================================
 $strLoginStopper = $objGame->get_game_switch(LOGIN_STOPPER);
 if ($strLoginStopper == 'on' && (isset($arrSrcStats[LEVEL]) && $arrSrcStats[LEVEL] < 5)) {
     $page = 'session_expired';
     $page_up();
     echo $strDiv = '<div id="textMedium"><p>' . 'Currently, you can not login. This may be due to a game change ' . 'or a technical problem.' . '</p><p>' . 'Please visit the game forum for information.' . '</p><p>' . '~ The ORKFiA Staff Team' . '</p></div>';
     include_game_down();
     exit;
 }
 //==========================================================================
 // Martel: Safety check, I would assume this prevents false cookie values
 //==========================================================================
 $md5me = 't1r1p0d4' . $arrSrcUsers[USERNAME];
コード例 #7
0
ファイル: generic.php プロジェクト: BrorHolm/Orkfia-2008
function obj_test_for_kill(&$objTrgUser, &$objSrcUser)
{
    global $ip;
    // Minimize multi-kills - Martel December 30, 2007
    //  #1 Query DB for kill status (Don't use cached data) #2 Check citz
    $strSQL = 'SELECT killed FROM stats WHERE id = ' . $objTrgUser->get_userid();
    $arrRow = mysql_fetch_row(mysql_query($strSQL));
    if ($arrRow[0] == 0 && $objTrgUser->get_pop(CITIZENS) <= 0) {
        // Separate a reset tribe from a killed (1=age, 2=pk)
        $objTrgUser->set_stat(KILLED, 2);
        // Show kill message
        $arrTrgStats = $objTrgUser->get_stats();
        echo $strDiv = '<div id="textMedium">' . '<p>' . "Congratulations! You watch on as the last citizen of " . '<strong class="negative">' . stripslashes($arrTrgStats[TRIBE]) . ' (#' . $arrTrgStats[ALLIANCE] . ")</strong> dies and their empire crumbles in front of you." . '</p>' . '</div>' . '<br />';
        // Update SrcUser with +1 Kill
        $arrSrcStats = $objSrcUser->get_stats();
        $iKilled = $arrSrcStats[KILLS] + 1;
        $objSrcUser->set_stat(KILLS, $iKilled);
        // Record: Largest Kill
        require_once 'inc/classes/clsGame.php';
        $objGame = new clsGame();
        $arrRecords = $objGame->get_game_records();
        $arrTrgBuilds = $objTrgUser->get_builds();
        if ($arrTrgBuilds[LAND] > $arrRecords[KILLED]) {
            $arrRecords = array(KILLED => $arrTrgBuilds[LAND], KILLED_ID => $objSrcUser->get_userid());
            $objGame->set_game_records($arrRecords);
        }
        // War effects
        require_once "inc/functions/war.php";
        $objSrcAlliance = $objSrcUser->get_alliance();
        if (checkWarBetween($objSrcAlliance, $arrTrgStats[ALLIANCE])) {
            $objTrgAlliance = $objTrgUser->get_alliance();
            // Update land counter in new war system       March 06, 2008 Martel
            $iNeeded = $objSrcAlliance->get_war('land_needed');
            $objSrcAlliance->set_war('land_needed', max(0, $iNeeded - $arrTrgBuilds[LAND]));
            // Wait with adding this until it is 100% sure no multi kills exist
            //             if (($arrGains = testWarVictory($objSrcAlliance, $objTrgAlliance)))
            //             {
            //                 require_once('inc/pages/war_room2.inc.php');
            //                 $strGains = getVictoryReport($arrGains);
            //                 // Show war-win message
            //                 echo $strDiv =
            //                 '<div id="textMedium">' .
            //                     '<p><strong class="positive">Your alliance have won the war!</strong></p>' .
            //                     $strGains .
            //                 '</div>' .
            //                 '<br />';
            //             }
            // Add war-kill to global news
            $strGlobalNews = '<strong class="negative">Alliance #' . $arrSrcStats[ALLIANCE] . " has laid the final blow in " . $arrTrgStats[TRIBE] . "\\'s ORKFiA career during their war.</strong>";
            mysql_query("INSERT INTO news (id, time, ip, type, duser, ouser, " . "result, text, kingdom_text, kingdoma, kingdomb) " . "VALUES ('', NOW(), '---', 'global', 0, 0, 1, '', " . "'{$strGlobalNews}', 0, '')");
            // War events if a killed tribe is in the biggest half of the alli
            $iLand = $arrTrgBuilds[LAND];
            $arrRow1 = mysql_fetch_row(mysql_query("SELECT COUNT(id) FROM rankings_personal WHERE land > {$iLand} AND alli_id = " . $arrTrgStats[ALLIANCE]));
            $arrRow2 = mysql_fetch_row(mysql_query("SELECT COUNT(id) FROM rankings_personal WHERE alli_id = " . $arrTrgStats[ALLIANCE]));
            if ($arrRow1[0] * 2 < $arrRow2[0]) {
                require_once "inc/functions/update.php";
                //==============================================================
                // Bonus for the killing alliance: MP+TP gain, army
                // moved 1 hours closer to home
                //==============================================================
                // Since we don't seem to want a max to the mps/tps here,
                //  why not just add obj_mage_power_growth twice, same for
                //  thieves ofc                              - AI 25/11/2006
                //==============================================================
                $arrUserId = $objSrcAlliance->get_userids();
                foreach ($arrUserId as $iUserid) {
                    check_to_update($iUserid);
                    $objTmpUser = new clsUser($iUserid);
                    $build = $objTmpUser->get_builds();
                    // Bonus to Thievery Credits
                    require_once "inc/functions/ops.php";
                    $bonus1 = 2 * obj_thief_op_growth($objTmpUser);
                    $iNewCredits = $objTmpUser->get_thievery(CREDITS);
                    $iNewCredits += $bonus1;
                    // Bonus to Spell Power
                    require_once "inc/functions/spells.php";
                    $bonus2 = 2 * obj_mage_power_growth($objTmpUser);
                    $iNewPower = $objTmpUser->get_spell(POWER);
                    $iNewPower += $bonus2;
                    // Update User
                    $objTmpUser->set_thievery(CREDITS, $iNewCredits);
                    $objTmpUser->set_spell(POWER, $iNewPower);
                    // Update Military Training 1x time (Mori thieves)
                    $arrTmpStats = $objTmpUser->get_stats();
                    if ($arrTmpStats[RACE] == "Mori Hai") {
                        $arrMercs = $objTmpUser->get_army_mercs();
                        $arrNewMercs = array(MERC_T0 => $arrMercs[MERC_T1], MERC_T1 => $arrMercs[MERC_T2], MERC_T2 => $arrMercs[MERC_T3], MERC_T3 => 0);
                        $objTmpUser->set_army_mercs($arrNewMercs);
                    }
                    // Update Military Training 1x time (Everybody)
                    $arrRets = $objTmpUser->get_milreturns();
                    $arrNewRets = array(UNIT1_T1 => $arrRets[UNIT1_T2], UNIT1_T2 => $arrRets[UNIT1_T3], UNIT1_T3 => $arrRets[UNIT1_T4], UNIT1_T4 => 0, UNIT2_T1 => $arrRets[UNIT2_T2], UNIT2_T2 => $arrRets[UNIT2_T3], UNIT2_T3 => $arrRets[UNIT2_T4], UNIT2_T4 => 0, UNIT3_T1 => $arrRets[UNIT3_T2], UNIT3_T2 => $arrRets[UNIT3_T3], UNIT3_T3 => $arrRets[UNIT3_T4], UNIT3_T4 => 0, UNIT4_T1 => $arrRets[UNIT4_T2], UNIT4_T2 => $arrRets[UNIT4_T3], UNIT4_T3 => $arrRets[UNIT4_T4], UNIT4_T4 => 0, UNIT5_T1 => $arrRets[UNIT5_T2], UNIT5_T2 => $arrRets[UNIT5_T3], UNIT5_T3 => $arrRets[UNIT5_T4], UNIT5_T4 => 0, UNIT6_T1 => $arrRets[UNIT6_T2], UNIT6_T2 => $arrRets[UNIT6_T3], UNIT6_T3 => $arrRets[UNIT6_T4], UNIT6_T4 => 0);
                    $objTmpUser->set_milreturns($arrNewRets);
                    // Update Tribe News
                    $strNews = "The death of one of our enemies has given our " . "troops courage! Armies are returning more quickly, " . "thieves are more willing to risk their lives for the " . "tribe and your mage feels extra powerful.";
                    mysql_query("INSERT INTO news (time, ip, type, duser, " . "ouser, result, text, kingdom_text) VALUES " . "(NOW(), '---', 'local_news', {$iUserid}, '', " . "1, '{$strNews}','')");
                    $objTmpUser->set_user_info(LAST_NEWS, 1);
                }
                // Defiance for the losing alliance, gives bonuses to off/tm-dmg
                $arrUserId = $objTrgAlliance->get_userids();
                foreach ($arrUserId as $iUserid) {
                    check_to_update($iUserid);
                    $objTmpUser = new clsUser($iUserid);
                    $objTmpUser->set_spell(DEFIANCE, 4);
                    $strNews = "The death of one of our big tribes has filled the " . "hearts of our people with anger! For 4 more months " . "we will strike hard at our enemies!";
                    mysql_query("INSERT INTO news (time, ip, type, duser, " . "ouser, result, text, kingdom_text) VALUES " . "(NOW(), '---', 'local_news', {$iUserid}, '', " . "1, '{$strNews}','')");
                    $objTmpUser->set_user_info(LAST_NEWS, 1);
                }
            }
            //top half
        }
        //war
        // Create News
        $timestamp = date(TIMESTAMP_FORMAT);
        $d_news = '<strong class="negative">' . $arrSrcStats[TRIBE] . " (#" . $arrSrcStats[ALLIANCE] . ") has laid the final blow in " . $arrTrgStats[TRIBE] . "\\'s ORKFiA career.</strong>";
        $o_news = '<strong class="positive">Our ' . $arrSrcStats[TRIBE] . " has laid the final blow in " . $arrTrgStats[TRIBE] . " (#" . $arrTrgStats[ALLIANCE] . ")\\'s ORKFiA career.</strong>";
        $strNews = "I am sorry leader, upon your return to your tribe your alliance " . "has sent this message forth to you." . "<br /><br />" . $d_news . "<br /><br />" . "They have also sent us supplies and some citizens to restart " . "our tribe." . "<br /><br />" . "Below this line is news our previous tribe had recieved:";
        $strSQL = "INSERT INTO news (time, ip, type, duser, ouser, result, " . "text, kingdom_text, kingdoma, kingdomb) VALUES ('{$timestamp}', " . "'{$ip}', 'killed', {$arrTrgStats[ID]}, 0, 1, '{$strNews}', " . "'{$d_news}', '{$arrTrgStats[ALLIANCE]}', '')";
        mysql_query($strSQL);
        $strSQL = "INSERT INTO news (time, ip, type, duser, ouser, result, text, " . "kingdom_text, kingdoma, kingdomb) VALUES ('{$timestamp}', '{$ip}', " . "'killed', 0, 0, 1, '', '{$o_news}', '{$arrSrcStats[ALLIANCE]}', '')";
        mysql_query($strSQL);
        //======================================================================
        // Kill the tribe
        //======================================================================
        require_once 'inc/staff/delete.inc.php';
        doBackupTribe($objTrgUser->get_userid(), 'kill');
        obj_kill_user($objTrgUser);
    } else {
        return;
    }
}
コード例 #8
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 
}
コード例 #9
0
ファイル: tribe.inc.php プロジェクト: BrorHolm/Orkfia-2008
function include_tribe_text()
{
    include_once 'inc/functions/tribe.php';
    require_once 'inc/classes/clsGame.php';
    $objGame = new clsGame();
    $strSwitch = $objGame->get_game_switch('update_button');
    $objSrcUser =& $GLOBALS['objSrcUser'];
    $arrSrcStats = $objSrcUser->get_stats();
    $arrSrcUsers = $objSrcUser->get_user_infos();
    $objSrcAlli = $objSrcUser->get_alliance();
    //==========================================================================
    // Elder Message
    //==========================================================================
    if (isset($objSrcAlli) && !empty($objSrcAlli)) {
        echo get_eldermessage_text($objSrcAlli);
    }
    //==========================================================================
    // Free update button
    // 1st case, change for classic oop testing ## 2nd case: devork 1008 updates
    //==========================================================================
    if ($strSwitch == ON && $_SERVER['SERVER_NAME'] == DINAH_SERVER_NAME) {
        $iHours = $arrSrcUsers[HOURS];
        if (isset($_POST['update']) && $iHours >= 0 && $iHours < PROTECTION_HOURS) {
            require_once 'inc/functions/update_script.php';
            generate_updates($objSrcUser, 1);
            $iHours++;
        }
        if ($iHours >= 0 && $iHours < PROTECTION_HOURS) {
            echo '<form id="center" action="main.php?cat=game&amp;page=tribe" method="post">' . '<input type="submit" name="update" value="Update Me" />' . '</form>';
        }
    } elseif ($strSwitch == ON && $_SERVER['SERVER_NAME'] == DEV_SERVER_NAME) {
        $iHours = $arrSrcUsers[HOURS];
        if (isset($_POST['update']) && $iHours >= 0 && $iHours < 1008) {
            require_once 'inc/functions/update_script.php';
            generate_updates($objSrcUser, 1);
            $iHours++;
        }
        if ($iHours >= 0 && $iHours < 1008) {
            echo '<form id="center" action="main.php?cat=game&amp;page=tribe" method="post">' . '<input type="submit" name="update" value="Update Me" />' . '</form>';
        }
    }
    //==========================================================================
    // Show Self Vision
    //==========================================================================
    // Link to Tribe News
    $dtLastNews = $arrSrcUsers[LAST_NEWS];
    $strNewsLink = '<br /><a href="main.php?cat=game&amp;page=news"';
    if ($dtLastNews == 0) {
        $strNewsLink .= '>Tribe News</a>';
    } else {
        $strNewsLink .= ' class = "check_new">Our Tribe Has News!</a>';
    }
    echo '<div class="tableLinkMedium">' . $strNewsLink . ' | ' . '<a href="main.php?cat=game&amp;page=advisors">Internal Affairs</a>' . '</div>';
    echo get_tribe_table($objSrcUser);
    //==========================================================================
    // Area with text below tribe table
    //==========================================================================
    $strText = '<div id="textMedium" style="clear: both;">' . '<h2>' . 'Your head advisor greets you:' . '</h2>';
    // Check First 3 Logins prior to verification
    $strVerificationCode = $objSrcUser->get_preference(EMAIL_ACTIVATION);
    if ($arrSrcUsers[LOGINS] < 3 && $strVerificationCode != 'verified') {
        if ($arrSrcUsers[LOGINS] == 1) {
            $strText .= '<p>Welcome to ORKFiA! You may login once more before you need to <a href="main.php?cat=game&amp;page=verify">verify your email address</a>.</p>';
        } elseif ($arrSrcUsers[LOGINS] == 2) {
            $strText .= '<p>Welcome to ORKFiA! Next time you login you will need to <a href="main.php?cat=game&amp;page=verify">verify your email address</a>.</p>';
        }
    }
    // Check Protection Hours Remaining
    $strText .= '<p>' . obj_check_protection($objSrcUser, 'status') . '</p>';
    // Manual Session handler (warns 20 minutes prior to being logged out)
    $fourHoursAgo = date('Y-m-d H:i:s', strtotime('-4 hours 20 minutes'));
    if ($arrSrcUsers[LAST_LOGIN] < $fourHoursAgo) {
        $strText .= '<p>' . "... Less than 20 minutes before you are required to login again" . " ..." . '</p>';
    }
    // frost: added "accept truce" for elder
    // Martel: recoded to use objects
    $arrSrcWar = $objSrcAlli->get_wars();
    if ($arrSrcWar[TARGET] != 0) {
        $objTrgAlli = new clsAlliance($arrSrcWar[TARGET]);
        $arrTrgWar = $objTrgAlli->get_wars();
        if ($arrTrgWar[TRUCE_OFFER] == 1) {
            $strText .= '<p>' . 'The enemy alliance (#' . $objTrgAlli->get_allianceid() . ') has offered us a ' . '<a href="main.php?cat=game&page=war_alliance">truce</a>.' . '</p>';
        } elseif ($arrSrcWar[TRUCE_OFFER] == 1) {
            $strText .= '<p>' . 'News from our war with alliance (#' . $objTrgAlli->get_allianceid() . '): Our alliance diplomats have been sent to negotiate a truce with the enemy.' . '</p>';
        }
    }
    // If account is paused
    if ($arrSrcUsers[PAUSE_ACCOUNT] > 1 && $arrSrcUsers[PAUSE_ACCOUNT] <= 48) {
        $strText .= '<p>' . 'Your account is currently paused, it will be ' . 'accessible for play in ' . ($arrSrcUsers[PAUSE_ACCOUNT] - 1) . ' updates.' . '<br />' . '(You may remain paused for longer if you so wish.)' . '</p>';
    } elseif ($arrSrcUsers[PAUSE_ACCOUNT] > 1 && $arrSrcUsers[PAUSE_ACCOUNT] > 48) {
        $strText .= '<p>' . 'Your tribe is currently entering vacation mode, it will be ' . 'fully protected in ' . ($arrSrcUsers[PAUSE_ACCOUNT] - 49) . ' updates.' . '<br />' . '(Until then you can be attacked by other players.)' . '</p>';
    } elseif ($arrSrcUsers[PAUSE_ACCOUNT] == 1) {
        $strText .= '<p>' . 'Your account is currently paused but is accessible for ' . 'play now. If you wish to leave protection go to Options -> ' . '<a href="main.php?cat=game&page=preferences&task=pause_account">' . 'Pause Account</a>.' . '</p>';
    }
    $strText .= '<div style="float: left; margin: 0 0 10px 10px; text-align: center; overflow: hidden; border: 3px double #444; background: #FFF; height: 42px; width: 154px; ">' . '<a style="border: 0; display: block; color: #444; font: 15px Georgia, Times, serif; line-height: 17px; padding: 4px 0;" href="http://www.orkfiantimes.co.uk/" target="_blank">The Orkfian Times<br /><span style="font-size: 10px; border-top: #444 3px double; letter-spacing: 0.1pt;">A New Issue Every Week!</span></a>' . '</div>' . '<div style="float: left; margin: 0 0 10px 10px; text-align: center; overflow: hidden; border: 3px double #444; background: #FFF; height: 42px; width: 154px; ">' . '<a style="border: 0; display: block; color: #444; font: italic 16px \'Times new roman\'; line-height: 42px;" href="http://www.orkfiantimes.co.uk/faces.html" target="_blank">The Faces of ORKFiA</a>' . '</div>' . '<hr class="clear" style="visibility: hidden;">';
    echo $strText;
    // Voting Portal Links for ORKFiA
    $voteStatus = '';
    $check = md5($arrSrcStats['id'] . $arrSrcStats[RACE] . date('d'));
    if ($_SERVER['SERVER_NAME'] == 'orkfia.phpsupport.se') {
        $week = date('W', strtotime('-12 hours'));
        if ($arrSrcUsers[HOURS] >= PROTECTION_HOURS) {
            $iBonus = $objSrcUser->get_build(LAND) * 1000;
        } else {
            $iBonus = 100000;
        }
        if ($arrSrcStats[RACE] == "Dragon") {
            $iBonus = floor($iBonus / 2);
        }
        $strBonus = number_format($iBonus);
        if ($arrSrcStats[TWG_VOTE] == $week) {
            $voteStatus = ' (already voted)';
        } else {
            $voteStatus = ' (<strong>' . $strBonus . ' cr</strong>).';
        }
    }
    $strVoteLinks = '<p>Vote for us @ ' . '<a href="http://apexwebgaming.com/in/518" target="_blank">' . 'Apex Web Gaming</a>' . ' and ' . '<a href="http://www.topwebgames.com/in.asp?id=744&amp;vuser='******'&amp;check=' . $check . '" target="_blank">' . 'TWG' . '</a>' . $voteStatus . '</p>';
    echo $strVoteLinks;
    include_once 'inc/functions/forums.php';
    if ($_SERVER['SERVER_NAME'] == DINAH_SERVER_NAME && get_sponsor_badge($arrSrcStats[ID]) == '') {
        ?>

        <hr />
        <h2>Become a Dragon - ORKFiA Classic</h2>
        <hr />

        <form action="https://www.paypal.com/cgi-bin/webscr" method="post" style="margin-left: auto; margin-right: auto; text-align: center;">
            <input type="hidden" name="cmd" value="_xclick" />
            <input type="hidden" name="business" value="*****@*****.**" />
            <input type="hidden" name="undefined_quantity" value="1" />
            <input type="hidden" name="item_name" value="One Week Sponsorship" />
            <input type="hidden" name="item_number" value="Classic Dragon" />
            <input type="hidden" name="amount" value="2.00" />
            <input type="hidden" name="shipping" value="0.00" />
            <input type="hidden" name="no_shipping" value="1" />
            <input type="hidden" name="return" value="<?php 
        echo HOST;
        ?>
main.php?cat=main&amp;page=sponsors&amp;thankyou" />
            <input type="hidden" name="cn" value="Message to admin" />
            <input type="hidden" name="currency_code" value="USD" />
            <input type="hidden" name="tax" value="0.00" />
            <input type="hidden" name="lc" value="SE" />
            <input type="hidden" name="bn" value="PP-BuyNowBF" />
            <table class="small" cellspacing="0" cellpadding="0">
                <tr class="header">
                    <th colspan="3">Become a Classic Dragon</th>
                </tr>
                <tr class="data">
                    <th>Rank 4:</th>
                    <td><span class="elder">Classic Dragon</span></td>
                    <td rowspan="3"><img src="<?php 
        echo HOST_PICS;
        ?>
dragon_classic.gif" alt="Dragon" /></td>
                </tr>
                <tr class="data">
                    <th>Donation:</th>
                    <td>$2 / week</td>
                </tr>
                <tr class="data">
                    <th><input type="hidden" name="on0" value="Login nick" /><label for="i4">Login nick:</label></th>
                    <td><input type="text" name="os0" id="i4" maxlength="60" value="<?php 
        echo $arrSrcUsers[USERNAME];
        ?>
" /></td>
                </tr>
            </table>
            <input type="submit" name="submit" value="Sponsor ORKFiA for 1 week" />
        </form>
        <p>Help us advertise and reduce the server costs. <a href="main.php?cat=game&amp;page=sponsors">Become a Dragon</a> to support ORKFiA Classic.</p>

<?php 
    } elseif ($_SERVER['SERVER_NAME'] != DINAH_SERVER_NAME && get_sponsor_badge($arrSrcStats[ID]) == '') {
        include_once 'inc/pages/sponsors.inc.php';
        echo show_sponsor_options($arrSrcUsers[USERNAME]);
    } elseif (($strBadge = get_sponsor_badge($arrSrcStats[ID])) != '') {
        echo '<hr />' . '<h2>Thank you for supporting ORKFiA!</h2>' . '</hr />' . '<div class="center">' . $strBadge . '</div>';
    }
    echo '</div>';
    //==========================================================================
    // Admin Message (message of the day)
    //==========================================================================
    $iStatus = $arrSrcUsers[STATUS];
    if ($iStatus == 2) {
        echo '<br /><br />';
        include_once 'inc/pages/motd.inc.php';
        include_motd_text();
    } else {
        echo '<br />' . '<div class="center">' . '<a href="main.php?cat=game&amp;page=motd">' . 'View Admin Message' . '</a></div>';
    }
    //==========================================================================
    // Species5618: added a safety-mechanism for the doubleclickprotection on
    // magic, switch will be set to free whenever a tribe looks at the tribepage
    //==========================================================================
    $objSrcUser->set_spell(CASTING_NOW, "'free'");
    //==========================================================================
    // Empty Database from Deleted Tribes (These are "moved" to alliance #0)
    //==========================================================================
    include_once 'inc/classes/clsAlliance.php';
    $objTmpAlliance = new clsAlliance(0);
    $objTmpAlliance->delete_users();
}
コード例 #10
0
function include_orkfiastats_text()
{
    global $orkTime;
    include_once 'inc/classes/clsGame.php';
    $objGame = new clsGame();
    $arrRecords = $objGame->get_game_records();
    $orkTime = date(TIMESTAMP_FORMAT);
    $old = $orkTime - 300;
    $result = mysql_query("SELECT id FROM online WHERE time > {$old}");
    $online = mysql_num_rows($result);
    $maxonline = max($online, $arrRecords[ONLINE]);
    //  $update = mysql_query("Update records set online = $maxonline where id = 1");
    $objGame->set_game_record(ONLINE, $maxonline);
    if ($arrRecords[AGESTART] < time()) {
        $age_time = time_since($arrRecords[AGESTART]);
    } else {
        $age_time = "Yet to start";
    }
    //  echo $age25 = mktime (0,0,0,04,13,2006); //hours,mins,secs,month,day,year
    $fetch1 = mysql_query("SELECT id FROM spells WHERE pest > 0");
    $fetch1 = mysql_num_rows($fetch1);
    $fetch2 = mysql_query("SELECT id FROM stats");
    $fetch2 = mysql_num_rows($fetch2);
    $fetch3 = mysql_query("Select alli_id,alli_name from rankings_personal,rankings_alliance where rankings_personal.id = {$arrRecords['grab_id']} and alli_id = rankings_alliance.id");
    $fetch3 = @mysql_fetch_array($fetch3);
    $fetch4 = mysql_query("Select alli_id,alli_name from rankings_personal,rankings_alliance where rankings_personal.id = {$arrRecords['arson_id']} and alli_id = rankings_alliance.id");
    $fetch4 = @mysql_fetch_array($fetch4);
    $fetch5 = mysql_query("Select alli_id,alli_name from rankings_personal,rankings_alliance where rankings_personal.id = {$arrRecords['killed_id']} and alli_id = rankings_alliance.id");
    $fetch5 = @mysql_fetch_array($fetch5);
    $fetch6 = mysql_query("Select alli_id,alli_name from rankings_personal,rankings_alliance where rankings_personal.id = {$arrRecords['fireball_id']} and alli_id = rankings_alliance.id");
    $fetch6 = @mysql_fetch_array($fetch6);
    $cursed = floor($fetch1 / $fetch2 * 10000);
    $cursed2 = $cursed / 100;
    $infected = $arrRecords[PEST] / 100;
    if ($cursed > $arrRecords[PEST]) {
        //      mysql_query("UPDATE records SET pest = $cursed WHERE id = 1");
        $objGame->set_game_record(PEST, $cursed);
        $infected = $cursed / 100;
    }
    $fetch3['alli_name'] = stripslashes($fetch3['alli_name']);
    $fetch4['alli_name'] = stripslashes($fetch4['alli_name']);
    $fetch5['alli_name'] = stripslashes($fetch5['alli_name']);
    $fetch6['alli_name'] = stripslashes($fetch6['alli_name']);
    // Empty results get their numbers so the game doesn't scream error at us ;)
    if (!isset($fetch3['alli_id'])) {
        $fetch3['alli_id'] = 0;
    }
    if (!isset($fetch4['alli_id'])) {
        $fetch4['alli_id'] = 0;
    }
    if (!isset($fetch5['alli_id'])) {
        $fetch5['alli_id'] = 0;
    }
    if (!isset($fetch6['alli_id'])) {
        $fetch6['alli_id'] = 0;
    }
    if ($online == "1") {
        $plural1 = "was";
        $plural2 = "";
    } else {
        $plural1 = "were";
        $plural2 = "s";
    }
    $check = mysql_query("Select * from build where id = {$arrRecords['grab_id']}");
    $check = @mysql_fetch_array($check);
    if ($check['land_t1'] == $arrRecords['grab'] || $check['land_t2'] == $arrRecords['grab'] || $check['land_t3'] == $arrRecords['grab'] || $check['land_t4'] == $arrRecords['grab']) {
        $fetch3['alli_name'] = "Hidden for now";
        $fetch3['alli_id'] = 0;
    }
    $orkStats = "<table cellspacing=\"0\" cellpadding=\"0\" class=\"medium\">" . "<tr class=\"header\">" . "<th>" . "Stats Running Time" . "</th>" . "</tr>" . "<tr class=\"data\">" . "<td class=\"center\">" . $age_time . "</td>" . "</tr>" . "</table>" . "<br />" . "<table cellspacing=\"0\" cellpadding=\"0\" class=\"medium\">" . "<tr class=\"header\">" . "<th colspan=\"2\">" . "Players Online" . "</th>" . "</tr>" . "<tr class=\"data\">" . "<td class=\"center\" colspan=\"2\">" . "There " . $plural1 . " " . $online . " player" . $plural2 . " online in the last 3 minutes.<br /><br />" . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Most online at one time:" . "</th>" . "<td>" . $maxonline . " Players" . "</td>" . "</tr>" . "</table>" . "<br />" . "<table cellspacing=\"0\" cellpadding=\"0\" class=\"medium\">" . "<tr class=\"header\">" . "<th colspan=\"2\">" . "Pestilence" . "</th>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Percentage Currently Infected:" . "</th>" . "<td>" . $cursed2 . "%" . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Highest Percentage Infected:" . "</th>" . "<td>" . $infected . "%" . "</td>" . "</tr>" . "</table>" . "<br />" . "<table cellspacing=\"0\" cellpadding=\"0\" class=\"medium\">" . "<tr class=\"header\">" . "<th colspan=\"2\">" . "Fireball" . "</th>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Most Damaging Fireball:" . "</th>" . "<td>" . $arrRecords[FIREBALL] . " Citizens" . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "By Alliance:" . "</th>" . "<td>" . $fetch6['alli_name'] . "(#" . $fetch6['alli_id'] . ")" . "</td>" . "</tr>" . "</table>" . "<br />" . "<table cellspacing=\"0\" cellpadding=\"0\" class=\"medium\">" . "<tr class=\"header\">" . "<th colspan=\"2\">" . "Standard Attack" . "</th>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Most Acres Taken:" . "</th>" . "<td>" . $arrRecords[GRAB] . " Acres" . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "By Alliance:" . "</th>" . "<td>" . $fetch3['alli_name'] . "(#" . $fetch3['alli_id'] . ")" . "</td>" . "</tr>" . "</table>" . "<br />" . "<table cellspacing=\"0\" cellpadding=\"0\" class=\"medium\">" . "<tr class=\"header\">" . "<th colspan=\"2\">" . "Arson" . "</th>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Most Damaging Arson:" . "</th>" . "<td>" . $arrRecords[ARSON] . " Homes" . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "By Alliance:" . "</th>" . "<td>" . $fetch4['alli_name'] . "(#" . $fetch4['alli_id'] . ")" . "</td>" . "</tr>" . "</table>" . "<br />" . "<table cellspacing=\"0\" cellpadding=\"0\" class=\"medium\">" . "<tr class=\"header\">" . "<th colspan=\"2\">" . "Largest Kill" . "</th>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Largest Tribe Killed:" . "</th>" . "<td>" . $arrRecords[KILLED] . " Acres" . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "By Alliance:" . "</th>" . "<td>" . $fetch5['alli_name'] . "(#" . $fetch5['alli_id'] . ")" . "</td>" . "</tr>" . "</table>";
    echo $orkStats;
}
コード例 #11
0
ファイル: clsUser.php プロジェクト: BrorHolm/Orkfia-2008
 function isPaused()
 {
     include_once 'inc/classes/clsGame.php';
     $objGame = new clsGame();
     $strPaused = $objGame->get_game_switch(GLOBAL_PAUSE);
     $time = $this->get_user_info(PAUSE_ACCOUNT);
     return $time > 0 && $time <= 49 || $strPaused == ON;
 }
コード例 #12
0
ファイル: layout.php プロジェクト: BrorHolm/Orkfia-2008
function include_game_up()
{
    global $page, $strTitle;
    $objSrcUser =& $GLOBALS['objSrcUser'];
    // clsGame for gametime
    include_once 'inc/classes/clsGame.php';
    $objGame = new clsGame();
    $iGameHours = $objGame->get_game_time(HOUR_COUNTER);
    $iAgeNumber = $objGame->get_game_time(AGE_NUMBER);
    $strPaused = $objGame->get_game_switch(GLOBAL_PAUSE);
    // clsAge for age counters
    include_once 'inc/classes/clsAge.php';
    $objAge = new clsAge();
    $blnCheck = $objAge->loadAge($iAgeNumber);
    // either FALSE or TRUE
    // orkTime for some time functions
    include_once 'inc/functions/orktime.php';
    $arrOrkDate = hoursToYears($iGameHours);
    // Months
    $strMonths = "";
    if ($arrOrkDate['months'] > 0) {
        $strMonths = "Month " . $arrOrkDate['months'] . ", ";
    }
    $arrAgeDisplays = get_age_displays($objGame, $objAge, $blnCheck);
    if ($strPaused == ON) {
        $arrAgeDisplays['str_age_extra'] .= ' <span class="positive">PAUSED</span>';
    }
    // Alliance
    $arrGameHistorys = $objGame->get_historys($arrOrkDate['years']);
    if ($arrGameHistorys[ALLI_NAME] == NULL) {
        // Martel: Prevent year-change lag
        $arrGameHistorys = $objGame->get_historys($arrOrkDate['years'] - 1);
    }
    $strTopAlliance = 'Top Alliance: ' . $arrGameHistorys[ALLI_NAME] . ' (#<a href="main.php?cat=game&amp;page=alliance&amp;aid=' . $arrGameHistorys[ALLI_ID] . '">' . $arrGameHistorys[ALLI_ID] . '</a>)';
    // Design stuff
    if (isset($objSrcUser)) {
        $arrDesign = $objSrcUser->get_designs();
    }
    if (!isset($arrDesign[COLOR])) {
        $arrDesign[COLOR] = 'forest_v1';
    }
    if (!isset($arrDesign[WIDTH]) || $arrDesign[WIDTH] == "") {
        $arrDesign[WIDTH] = '750';
    }
    if (!isset($arrDesign[ALIGNMENT])) {
        $arrDesign[ALIGNMENT] = 'center';
    }
    ?>
    <script language="JavaScript" type="text/javascript">
        <!---
        var serverDate=new Date('<?php 
    echo date("F d, Y H:i:s", time());
    ?>
')
        //-->
    </script>
    <script language="JavaScript" type="text/javascript" src="orkfiaJS.php"></script>
    <link rel="stylesheet" type="text/css" media="all" href="css/<?php 
    echo $arrDesign[COLOR];
    ?>
.css?version=1" />
    <link rel="stylesheet" type="text/css" media="all" href="css/style.css?version=1" />
    <!--[if lte IE 6]><link rel="stylesheet" type="text/css" media="screen" href="css/ie.css" /><![endif]-->

<?php 
    //If my new menu works I will put it here. I will also remove the ID part when a first good part is done.
    if ($objSrcUser->get_userid() == 7160 && $_SERVER['SERVER_NAME'] == DEV_SERVER_NAME) {
        ?>
        <link rel="stylesheet" type="text/css" media="all" href="css/harrytesting.css" />
        <!--[if lte IE 6]><link rel="stylesheet" type="text/css" media="screen" href="css/harryie.css" /><![endif]-->
<?php 
    }
    ?>
</head>

<body onload="clockStart();">

<div id="<?php 
    echo 'container' . $arrDesign[WIDTH] . $arrDesign[ALIGNMENT];
    ?>
">

  <div id="header">
    <h1 style="margin: 0; padding: 0;"><img src="<?php 
    echo HOST_PICS . 'head' . $arrDesign[WIDTH] . '.jpg';
    ?>
" alt="ORKFiA" /></h1>

    <ul id="gameStats">
        <li style="color: #000;">Time: <span style="color: #000;" id="ClockTime"><?php 
    echo date('H:i:s', time());
    ?>
</span></li>
        <li><br /></li>
        <li><a href="main.php?cat=game&amp;page=rankings&amp;show=annual&amp;type=currentage"><?php 
    echo $arrAgeDisplays['str_age'];
    ?>
</a> &nbsp; <em><?php 
    echo $arrAgeDisplays['str_age_extra'];
    ?>
</em></li>
        <li><strong><?php 
    echo $strMonths;
    ?>
Year <?php 
    echo $arrOrkDate['years'];
    ?>
 OE</strong> &nbsp; <em><?php 
    echo $strTopAlliance;
    ?>
</em></li>
    </ul>
  </div>

  <div id="menu">

    <?php 
    include_game_menu();
    ?>

  </div>

  <div id="upper_shadow"></div>

  <div id="portal">
    <div class="center">
      <h2 style="margin: 0;"><img src="<?php 
    echo HOST_PICS;
    ?>
gryph_l.gif" alt=""/><img src="<?php 
    echo HOST_PICS . $page;
    ?>
.gif" alt="<?php 
    echo $strTitle;
    ?>
" /><img src="<?php 
    echo HOST_PICS;
    ?>
gryph_r.gif" alt="" /></h2>
    </div>
<?php 
}
コード例 #13
0
function include_register1_text()
{
    $strHost = $GLOBALS['Host'];
    $strCopyright = $GLOBALS['OrkfiaCopyright'];
    include_once 'inc/classes/clsGame.php';
    $objGame = new clsGame();
    $strTribeSwitch = $objGame->get_game_switch(TRIBE_CREATION);
    $strAllianceSwitch = $objGame->get_game_switch(ALLIANCE_CREATION);
    $strBootcampSwitch = $objGame->get_game_switch(BOOTCAMP_SIGNUPS);
    $link = "main.php?cat=main&amp;page=register1&amp;alliance_type=";
    if (!isset($_GET['alliance_type'])) {
        //======================================================================
        // Signup selection (first part) of registration page
        //======================================================================
        ?>
    <div id="text" style="margin: 15px auto; width: 600px;">

        <h2 style="margin: 15px auto; text-align: center;"><img src="<?php 
        echo $strHost;
        ?>
first_sign_up.gif" alt="ORKFiA Sign Up!" /></h2>

        <h3>Join an Alliance</h3>

        <p>If you have the password of an existing alliance you may join in by
        selecting <em>Join Friends</em>, otherwise <em>Join Random</em> is the
        recommended choice. You can merge any time later if you wish to move
        into another alliance.</p>

<?php 
        if ($strTribeSwitch == ON) {
            echo "<p>| <a href=\"" . $link . "random\">Join Random</a> ";
            echo "| <a href=\"" . $link . "existing\">Join Friends</a> |</p>";
        } else {
            echo "<p><em class=\"positive\">The option to join an alliance has temporarily been disabled.</em></p>";
        }
        ?>

        <h3>Join a Bootcamp</h3>

        <p>Bootcamp leaders will assist you here, answering questions and
        teaching you how to master the game. If you wish to lead or instruct a
        boot camp, contact staff in alliance (#3).</p>
<?php 
        // M: For some reason this stopped working with the new MySQL server
        //         $strSQL = "SELECT kingdom, COUNT(*) as num_players FROM stats GROUP BY kingdom HAVING kingdom IN(SELECT id as kingdom FROM kingdom WHERE bootcamp = 'yes') ORDER BY kingdom DESC";
        //         $resSQL = mysql_query($strSQL);
        $iOpenBootcamps = 0;
        $iSpotsOpen = 0;
        $strSQL = "SELECT id FROM " . TBL_ALLIANCE . " WHERE bootcamp = 'yes' ORDER BY id DESC";
        $resSQL = mysql_query($strSQL);
        while ($arrRES = mysql_fetch_array($resSQL)) {
            $strSQL = "SELECT COUNT(*), " . ALLIANCE . " FROM stats WHERE " . ALLIANCE . " = {$arrRES[ID]} GROUP BY " . ALLIANCE . " ORDER BY " . ALLIANCE . " DESC";
            $resSQL2 = mysql_query($strSQL);
            $arrRES2 = mysql_fetch_row($resSQL2);
            if ($arrRES2[0] < MAX_ALLIANCE_SIZE) {
                $iOpenBootcamps++;
                $iLowestAlliNr = $arrRES2[1];
                $iSpotsOpen = MAX_ALLIANCE_SIZE - $arrRES2[0];
            }
        }
        //         $iOpenBootcamps = 0;
        //         while ($arrRES = mysql_fetch_array($resSQL))
        //         {
        //             if ($arrRES['num_players'] < MAX_ALLIANCE_SIZE)
        //             {
        //                 $iOpenBootcamps++;
        //                 $iLowestAlliNr = $arrRES['kingdom'];
        //                 $iSpotsOpen = MAX_ALLIANCE_SIZE - $arrRES['num_players'];
        //             }
        //         }
        if ($strBootcampSwitch == OFF) {
            ?>
        <p><em class="positive">The option to join a bootcamp has temporarily been disabled.</em></p>
<?php 
        } elseif ($iOpenBootcamps == 0) {
            ?>
        <p><em class="positive">Sorry, currently there are no bootcamps available.</em></p>
<?php 
        } else {
            ?>
        <p>| <a href="<?php 
            echo $link;
            ?>
random&amp;bootcamp=yes">Join Bootcamp</a> | <em>Bootcamp (#<?php 
            echo $iLowestAlliNr;
            ?>
) accepts <?php 
            echo $iSpotsOpen;
            ?>
 more tribes</em></p>
<?php 
        }
        ?>
        <h3>Create an Alliance</h3>

        <p>Recommended if you plan on joining with more than 5 other players as
        the world of Orkfia is a very competitive place. Small alliances tend
        not to lead to greatness.</p>

        <p>

<?php 
        $iEmptyAllianceId = check_empty_alliances();
        if ($strAllianceSwitch == ON && $strTribeSwitch == ON && $iEmptyAllianceId > 0) {
            echo "| <a href=\"" . $link . "new\">Create an Alliance</a> |" . " <em>Alliance (#{$iEmptyAllianceId}) is available</em>";
        } elseif ($iEmptyAllianceId == 0) {
            echo '<em class="positive">Sorry, the option to create an alliance is currently unavailable. (Maximum of ' . MAX_ALLIANCES . ' alliances reached)</em>';
        } else {
            echo '<em class="positive">Alliance creation has temporarily been disabled.</em>';
        }
        ?>

        </p>
    </div>

    <div class="center" style="font-size: 0.8em"><?php 
        echo $strCopyright;
        ?>
</div>

<?php 
    } else {
        //======================================================================
        // Form fields of registration page
        //======================================================================
        ?>

    <div id="text" style="margin: 15px auto; width: 600px;">
        <h2 style="margin: 15px auto; text-align: center;"><img src="<? echo $strHost; ?>first_sign_up.gif" alt="ORKFiA Sign Up!" /></h2>

<?php 
        if (isset($_GET['bootcamp']) && $_GET['bootcamp'] == 'yes') {
            $bootcamp = $_GET['bootcamp'];
        } else {
            $bootcamp = 'no';
        }
        // Validate alliance type input on creation
        $iEmptyAllianceId = check_empty_alliances();
        $strAllianceType = strval($_GET['alliance_type']);
        if ($strAllianceType == 'new' && ($strAllianceSwitch == OFF || $iEmptyAllianceId == 0 || $bootcamp == 'yes')) {
            $strAllianceType = 'random';
        }
        form_head($strAllianceType);
        switch ($strAllianceType) {
            case "random":
                echo "<input type=\"hidden\" value=\"{$bootcamp}\" name=\"register[bootcamp]\" />";
                break;
            case "existing":
                form_join_friends();
                // join existing
                break;
            case "new":
                form_create_alliance();
                // create alliance
                break;
        }
        form_login_info();
        form_tribe_info();
        form_agreement();
        form_random();
        form_post();
        ?>

        </div>

<?php 
    }
}
コード例 #14
0
ファイル: war.php プロジェクト: BrorHolm/Orkfia-2008
function doWarSurrender(&$objSuxAlli, &$objWinAlli)
{
    global $orkTime;
    $winner = $objWinAlli->get_allianceid();
    $looser = $objSuxAlli->get_allianceid();
    // Clear events
    $iEventid1 = $objWinAlli->get_war('event_id');
    $iEventid2 = $objSuxAlli->get_war('event_id');
    clearEvents($iEventid1, $iEventid2);
    // Get game hours
    require_once 'inc/classes/clsGame.php';
    $objGame = new clsGame();
    $arrGameTime = $objGame->get_game_times();
    // M: Update winner alli
    $arrWinWar = $objWinAlli->get_wars();
    $arrNewWinWar = array('target' => 0, 'last_target' => $looser, 'last_outgoing' => 'victory', 'last_end' => $arrGameTime['hour_counter'], 'victory' => $arrWinWar['victory'] + 1, 'event_id' => '');
    $objWinAlli->set_wars($arrNewWinWar);
    // M: Update looser alli
    $arrSuxWar = $objSuxAlli->get_wars();
    $arrNewSuxWar = array('target' => 0, 'last_target' => $winner, 'last_outgoing' => 'surrender', 'last_end' => $arrGameTime['hour_counter'], 'surrender' => $arrSuxWar['surrender'] + 1, 'event_id' => '');
    $objSuxAlli->set_wars($arrNewSuxWar);
    // M: Update winner alli fame
    $objTmpUser = new clsUser(0);
    $arrUserId = $objWinAlli->get_userids();
    foreach ($arrUserId as $iUserid) {
        $objTmpUser->set_userid($iUserid);
        $iNewFame = $objTmpUser->get_stat('fame') + WAR_SURRENDER_FAME;
        $objTmpUser->set_stat('fame', $iNewFame);
    }
    // M: Update looser alli fame
    $arrUserId = $objSuxAlli->get_userids();
    foreach ($arrUserId as $iUserid) {
        $objTmpUser->set_userid($iUserid);
        $iNewFame = max(0, $objTmpUser->get_stat('fame') - WAR_SURRENDER_FAME);
        $objTmpUser->set_stat('fame', $iNewFame);
    }
    // M: Transfer research
    $arrResearch = moveResearch($objSuxAlli, $objWinAlli, WAR_SURRENDER_LOSSES);
    // M: Transfer market goods (Atm this is the same % as regular victory)
    $arrMarket = moveMarketGoods($objSuxAlli, $objWinAlli, WAR_VICTORY_GOODS);
    // News for winner, looser and global
    mysql_query("INSERT INTO news (id, time, ip, type, duser, ouser, result, text, kingdom_text, kingdoma, kingdomb) VALUES ('', '{$orkTime}', '---', 'war-end', '0', '0', '1', '', '<strong class=\"positive\">We were victorious in the war with alliance #{$looser}!</strong>', '{$winner}', '')");
    mysql_query("INSERT INTO news (id, time, ip, type, duser, ouser, result, text, kingdom_text, kingdoma, kingdomb) VALUES ('', '{$orkTime}', '---', 'war-end', '0', '0', '1', '', '<strong class=\"negative\">We have surrendered in the war with #{$winner}!</strong>', '{$looser}', '')");
    mysql_query("INSERT INTO news (id, time, ip, type, duser, ouser, result, text, kingdom_text, kingdoma, kingdomb) VALUES ('', '{$orkTime}', '---', 'global', '0', '0', '1', '', '<strong class=\"positive\">Alliance #{$looser} have surrendered! #{$winner} wins!</strong>', '0', '')");
    return array($arrResearch, $arrMarket);
}
コード例 #15
0
ファイル: update.php プロジェクト: BrorHolm/Orkfia-2008
function check_to_update($user)
{
    //==========================================================================
    //                                                     Martel, July 09, 2006
    // Use global src object if the source == the tribe triggering this update
    // (self update)
    //==========================================================================
    $objSrcUser =& $GLOBALS["objSrcUser"];
    if ($user != $objSrcUser->get_userid()) {
        $objUser = new clsUser($user);
    } else {
        $objUser =& $objSrcUser;
    }
    //==========================================================================
    // Calculate updates owed
    //==========================================================================
    $Last_update_hour = $objUser->get_user_info(LAST_UPDATE_HOUR);
    $Last_update_day = $objUser->get_user_info(LAST_UPDATE_DAY);
    //     $iTribeTick = $objUser->get_user_info(LAST_UPDATE_TICK);
    $day = date("d");
    $hour = date("H");
    $month = date("m");
    $year = date("y");
    $lmonth = $month - 1;
    if ($day < $Last_update_day) {
        if ($lmonth == 0) {
            $lmonth = 12;
        }
        if ($lmonth == 1 || $lmonth == 3 || $lmonth == 5 || $lmonth == 7 || $lmonth == 8 || $lmonth == 10 || $lmonth == 12) {
            $day = $day + 31;
        } elseif ($lmonth == 2) {
            if ($year % 4 == 0) {
                $day = $day + 29;
            } else {
                $day = $day + 28;
            }
        } elseif ($lmonth == 4 || $lmonth == 6 || $lmonth == 9 || $lmonth == 11) {
            $day = $day + 30;
        }
    }
    $iUpdatesOwed = ($day - $Last_update_day) * 24 + ($hour - $Last_update_hour);
    if ($iUpdatesOwed > 36) {
        $iUpdatesOwed = 36;
    }
    $objUser->set_user_info(LAST_UPDATE_DAY, date('d'));
    $objUser->set_user_info(LAST_UPDATE_HOUR, date('H'));
    //     $objUser->set_user_info(LAST_UPDATE_TICK, $iGameTick);
    // Preparing for new method to count owed updates
    include_once 'inc/classes/clsGame.php';
    $objGame = new clsGame();
    //     $iGameTick = $objGame->get_game_time(HOUR_COUNTER);
    //     $iUpdatesOwed = floor($iGameTick - $iTribeTick);
    //==========================================================================
    // FORGET UPDATES - setting updatesOwed to 0 is permanent and will be saved
    // Until the new update system is implemented this is the only feasible way.
    //==========================================================================
    if ($objGame->get_game_switch(GLOBAL_PAUSE) == ON) {
        $iUpdatesOwed = 0;
    }
    // Tribes who are either killed, waiting to be reset or paused
    $strReset = $objUser->get_stat(RESET_OPTION);
    $blnKilled = $objUser->get_stat(KILLED);
    $iPaused = $objUser->get_user_info(PAUSE_ACCOUNT);
    if ($strReset == 'yes' || $blnKilled == 1) {
        $iUpdatesOwed = 0;
    } elseif ($iPaused > 0) {
        // Counter to see how long tribe has left in "forced" protection
        // Expl: only after these updates a tribe can choose to un-pause
        $iPaused -= $iUpdatesOwed;
        if ($iPaused <= 1) {
            $iPaused = 1;
        }
        // Save the last update info
        $objUser->set_user_info(PAUSE_ACCOUNT, $iPaused);
    }
    //==========================================================================
    // Time to hand out updates...
    //==========================================================================
    if ($iUpdatesOwed > 0) {
        // 6 Week limit for Infinity ORKFiA                Martel, July 09, 2006
        $iHours = $objUser->get_user_info(HOURS);
        $objRace = $objUser->get_race();
        $intLifespan = $objRace->getLifespan();
        // M: Perform near-death updates until the tribe is dead
        if ($iHours + $iUpdatesOwed > $intLifespan) {
            include_once 'inc/functions/tribe.php';
            $blnReturn = FALSE;
            // Updates that should be used to determine chance of death
            $iMaxAfter100Owed = $iHours + $iUpdatesOwed - $intLifespan + $iUpdatesOwed;
            $iUpdatesAfter100Owed = min($iUpdatesOwed, $iMaxAfter100Owed);
            // Iterate through each update to see if it's time to die
            for ($i = 1; $i <= $iUpdatesAfter100Owed; $i++) {
                // Correct hour of news event
                $event = $iUpdatesAfter100Owed - $i;
                $event_time = date(TIMESTAMP_FORMAT, strtotime("-{$event} hours"));
                $iRand = rand(1, max(1, 24 - $iMaxAfter100Owed));
                if ($iRand == 1) {
                    // Give remaining updates to tribe
                    $iUpdatesOwedBeforeDeath = $i + ($iUpdatesOwed - $iUpdatesAfter100Owed);
                    call_update_script($iUpdatesOwedBeforeDeath, $objUser);
                    // For use in Alliance News
                    $iRulerAge = getRulerAge($objUser);
                    $strTribe = $objUser->get_stat(TRIBE);
                    // Code for death due to age
                    $objUser->set_stat(KILLED, 1);
                    obj_kill_user($objUser);
                    // Alliance News
                    $strAlliNews = "<b class=\"negative\">The ruler of " . $strTribe . " has died at an age of " . $iRulerAge . ".</b>";
                    $iShowAlli = $objUser->get_stat(ALLIANCE);
                    // Tribe News
                    $strTribeNews = "The death of the old and tired tribe ruler comes as " . "no surprise. Most citizens have left the lands, and " . "the leaderless military rampantly plundered what " . "they could. The citizens remaining wish to " . "contribute goods they hid to support your cause." . "<br /><br />" . $strAlliNews . "<br /><br />" . "Below are the news that your previous tribe recieved:";
                    $blnReturn = TRUE;
                } else {
                    $strAlliNews = '';
                    $iShowAlli = '';
                    $strTribeNews = 'Leader, your age is becoming a problem! The citizens ' . 'are preparing for the worst and your general openly ' . 'disobey you.';
                }
                $strSQL = 'INSERT INTO ' . "news" . ' SET ' . "time" . " = '{$event_time}', " . "type" . " = 'death', " . "duser" . " = {$user}, " . "result" . " = 1, " . "text" . " = '{$strTribeNews}', " . "kingdom_text" . " = '{$strAlliNews}', " . "kingdoma" . " = {$iShowAlli}";
                mysql_query($strSQL);
                if ($blnReturn) {
                    break;
                }
            }
        }
        // Vacation mode 48 hours (+6 hours enter-phase = 54 hours)
        if ($iPaused > 0 && $objUser->get_stat(KILLED) == 0) {
            // (Martel: paused accs will still age - "fair ranking" fix)
            $iNewHours = $objUser->get_user_info(HOURS) + $iUpdatesOwed;
            $objUser->set_user_info(HOURS, $iNewHours);
            // Only "forget" updates while in protection, not during enter-phase
            //                                  Bug-fix February 27, 2008 Martel
            if ($iPaused <= 48) {
                $iUpdatesOwed = 0;
            }
        }
        //======================================================================
        // Update Tribe
        // Martel: Moving this to a separate file            - February 27, 2008
        //======================================================================
        require_once 'inc/functions/update_script.php';
        generate_updates($objUser, $iUpdatesOwed);
    }
}
コード例 #16
0
ファイル: rankings.inc.php プロジェクト: BrorHolm/Orkfia-2008
 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;
 }
コード例 #17
0
function include_preferences_text()
{
    global $orkTime;
    include_once 'inc/classes/clsGame.php';
    $objSrcUser =& $GLOBALS["objSrcUser"];
    $arrSrcUserInfos = $objSrcUser->get_user_infos();
    $arrSrcStats = $objSrcUser->get_stats();
    $iUserId = $objSrcUser->get_userid();
    $objGame = new clsGame();
    // Navigational Links
    if ($arrSrcStats[TYPE] == 'elder' || $arrSrcStats[TYPE] == 'coelder') {
        echo $topLinks = '<div class="center">| <b>Options</b> ' . '| <a href="main.php?cat=game&page=elder">Elder Options</a> ' . '|' . '</div>';
    }
    echo '<div id="textBig">';
    echo '<h2>Account Settings</h2>' . '<p>' . '<a href="main.php?cat=game&amp;page=preferences&amp;task=layout">Interface Settings</a> :: ' . '<a href="main.php?cat=game&amp;page=preferences&amp;task=profile">Profile Settings</a> :: ' . '<a href="main.php?cat=game&amp;page=preferences&amp;task=request_name">Request Name Change</a>' . '</p>';
    echo '<h2>Account Options</h2>' . '<p>' . '<a href="main.php?cat=game&amp;page=preferences&amp;task=request_merge">Request Merge</a> :: ' . '<a href="main.php?cat=game&amp;page=preferences&amp;task=pause_account">Pause Account</a> :: ' . '<a href="main.php?cat=game&amp;page=preferences&amp;task=reset_account">Reset Account</a> :: ' . '<a href="main.php?cat=game&amp;page=preferences&amp;task=delete_account">Delete Account</a>' . '</p>';
    if ($arrSrcStats[LEVEL] > 1) {
        echo "<h2>Staff Options</h2>" . '<p>' . '<a href="main.php?cat=game&amp;page=resort_tools">Resort Tools</a>' . '</p>';
    }
    echo '</div>';
    //==========================================================================
    // Below you will find the options for people to manage their accounts
    //==========================================================================
    echo '<div id="textBig">';
    $task = '';
    if (isset($_GET['task'])) {
        $task = $_GET['task'];
    }
    switch ($task) {
        case "layout":
            ?>
            <h2>Interface Settings</h2>

<?php 
            // XSS secure May 21, 2006 -Martel & Damadm00
            $widths = array(1 => 750, 1060);
            $alignments = array(1 => 'left', 'center');
            //             $designs    = array( 1 => 'blue', 'ice', 'red');
            $designs = array(1 => 'forest_v1', 'black_v2', 'ork_v2');
            //             $output     = array( 1 => 'Trade Winds', 'Castle Walls', 'Uruk Hatred');
            $output = array(1 => 'Forest Greens', 'Cursed Nights', 'Old Orkfia');
            // Handle POST Requests
            if (isset($_POST['width']) && isset($_POST['alignment']) && isset($_POST['design'])) {
                if (in_array($_POST['width'], $widths) && in_array($_POST['alignment'], $alignments) && in_array($_POST['design'], $designs)) {
                    $arrSrcDesignSafe[WIDTH] = $_POST['width'];
                    $arrSrcDesignSafe[ALIGNMENT] = $_POST['alignment'];
                    $arrSrcDesignSafe[COLOR] = $_POST['design'];
                    $objSrcUser->set_designs($arrSrcDesignSafe);
                    // A gift to you Damadm00 ^^ -Martel
                    header("Location: main.php?cat=game&page=preferences&task=layout");
                }
            } elseif (isset($_POST['guide_links'])) {
                if (isset($_POST['check'])) {
                    echo '<p><strong>Saved!</strong> Guide links will now show.</p>';
                    $objSrcUser->set_preference(GUIDE_LINKS, ON);
                } else {
                    echo '<p><strong>Saved!</strong> Guide links will no longer show.</p>';
                    $objSrcUser->set_preference(GUIDE_LINKS, OFF);
                }
            }
            // GUIDE LINKS OPTION
            $strChecked = '';
            if ($objSrcUser->get_preference(GUIDE_LINKS) == ON) {
                $strChecked = ' CHECKED';
            }
            // INTERFACE OPTIONS
            $arrSrcDesign = $objSrcUser->get_designs();
            ?>
            <h3>Interface Control</h3>

            <form method="post" action="main.php?cat=game&amp;page=preferences&amp;task=layout">

                <label for="skin">Skin:</label><br />
                <select name="design" id="skin">
<?php 
            foreach ($designs as $key => $color) {
                if ($color == $arrSrcDesign['color']) {
                    echo "<option value=\"" . $color . "\" selected=\"selected\">" . $output[$key] . "</option>";
                } else {
                    echo "<option value=\"" . $color . "\">" . $output[$key] . "</option>";
                }
            }
            ?>
                </select><br /><br />

                <label for="screen width">Width:</label><br />
                <select name="width" id="screen width">
<?php 
            foreach ($widths as $width) {
                if ($width == $arrSrcDesign['width']) {
                    echo "<option value=\"" . $width . "\" selected=\"selected\">" . $width . "</option>";
                } else {
                    echo "<option value=\"" . $width . "\">" . $width . "</option>";
                }
            }
            ?>
                </select><br /><br />

                <label for="layout alignment">Alignment:</label><br />
                <select name="alignment" id = "layout alignment">
<?php 
            foreach ($alignments as $alignment) {
                if ($alignment == $arrSrcDesign['alignment']) {
                    echo "<option value=\"" . $alignment . "\" selected=\"selected\">" . $alignment . "</option>";
                } else {
                    echo "<option value=\"" . $alignment . "\">" . $alignment . "</option>";
                }
            }
            ?>
                </select>

                <input type="submit" value="Update interface" />
            </form>

            <h3>Ingame Help System</h3>

            <form method="post" action="main.php?cat=game&amp;page=preferences&amp;task=layout">
                <label for="1">Show Guide Links: </label>
                <input type="checkbox" id="1" name="check" <?php 
            echo $strChecked;
            ?>
>
                <input type="hidden" name="guide_links" />
                <input type="submit" value="Update interface" />
            </form>
<?php 
            break;
        case "profile":
            //==================================================================
            // Action handler part of Profile            October 28, 2007 Martel
            //==================================================================
            if (isset($_POST['realname']) && !empty($_POST['realname'])) {
                // Enforce maxlength in form
                $strSafe = substr($_POST['realname'], 0, 24);
                // Same as in registration, important to keep the order right
                $strSafe = addslashes(strip_tags(trim($strSafe)));
                if (!empty($strSafe)) {
                    $objSrcUser->set_user_info(REALNAME, $strSafe);
                    echo '<p>Thank you, your name has been updated.</p>';
                }
            } elseif (isset($_POST['name']) && !empty($_POST['name'])) {
                // Enforce maxlength in form
                $strSafe = substr($_POST['name'], 0, 16);
                // Same as in registration, important to keep the order right
                $strSafe = addslashes(strip_tags(trim($strSafe)));
                $resSQL = mysql_query("SELECT * FROM stats WHERE name = '{$strSafe}'");
                $arrSQL = mysql_fetch_array($resSQL);
                if ($arrSQL) {
                    echo "<p>Sorry, that leader name is taken.</p>";
                    $strSafe = '';
                }
                if (!empty($strSafe)) {
                    $objSrcUser->set_stat(NAME, $strSafe);
                    echo '<p>Thank you, your name has been updated.</p>';
                }
            } elseif (isset($_POST['password1']) && !empty($_POST['password1'])) {
                $password1 = $_POST['password1'];
                $password2 = $_POST['password2'];
                $password = $_POST['password'];
                $check = mysql_query("SELECT * FROM user WHERE password = sha1('{$password}') AND id = {$iUserId}") or die("Error Retrieving Password From DB.");
                if (mysql_num_rows($check) == 1 && $password1 == $password2) {
                    $strPw1Safe = sha1($password1);
                    $objSrcUser->set_user_info(PASSWORD, $strPw1Safe);
                    echo "<p>Your password has been changed.</p>";
                    $email = stripslashes($objSrcUser->get_preference(EMAIL));
                    $username = stripslashes($arrSrcUserInfos[USERNAME]);
                    mail("{$email}", "ORKFiA New Password", "Hello, \nYour password has been updated with the one you requested =) \n\nUsername: {$username} \nPassword: {$password1}" . SIGNED_ORKFIA, "From: ORKFiA <" . EMAIL_REGISTRATION . ">\r\nX-Mailer: PHP/" . phpversion() . "\r\nX-Priority: Normal");
                } else {
                    echo "<p>Either you entered the wrong current password, or your new password wasn't matching in both entries.</p>";
                }
            } elseif (isset($_POST['email']) && !empty($_POST['email'])) {
                $strEmailSafe = $_POST['email'];
                // This check is used on the registration and verification pages
                if (!ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+' . '@' . '[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\\.' . '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $strEmailSafe)) {
                    echo "<p>Sorry, invalid e-mail address.</p>";
                } else {
                    $pref_search = mysql_query("SELECT * FROM preferences WHERE email = " . quote_smart($strEmailSafe));
                    $pref_search = mysql_fetch_array($pref_search);
                    if ($pref_search) {
                        echo "<p>Sorry, that email is in use.</p>";
                    } else {
                        $strCode = '';
                        for ($i = 0; $i < 12; $i++) {
                            $strCode .= substr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", rand(0, 61), 1);
                        }
                        // Activation email sent to all new players
                        mail($strEmailSafe, "ORKFiA Verification", "Thank you for updating your profile =) \n\nHere is your new verification code: {$strCode} \n\nWe hope you enjoy your stay in ORKFiA =)" . SIGNED_ORKFIA, "From: ORKFiA <" . EMAIL_REGISTRATION . ">\r\nX-Mailer: PHP/" . phpversion() . "\r\nX-Priority: Normal");
                        $arrNewPrefs = array(EMAIL_ACTIVATION => $strCode, EMAIL => $strEmailSafe);
                        $objSrcUser->set_preferences($arrNewPrefs);
                        echo '<p>Thank you, your e-mail has been updated and ' . 'a new verification code has been sent to it.</p>';
                    }
                }
            }
            $arrUsers = $objSrcUser->get_user_infos();
            $arrStats = $objSrcUser->get_stats();
            $arrUsers[REALNAME] = stripslashes($arrUsers[REALNAME]);
            $arrStats[NAME] = stripslashes($arrStats[NAME]);
            $strEmail = stripslashes($objSrcUser->get_preference(EMAIL));
            //==================================================================
            // Output part of Profile                    October 28, 2007 Martel
            //==================================================================
            echo '<h2>Profile Settings</h2>';
            $strRealName = '<h3>Real Name</h3>' . '<p>About your privacy: Only admins and Law & Order ' . 'can see your real name, and only when enforcing the Code ' . 'of Conduct (to help judge that you are a unique individual). ' . 'We believe it is your right to remain anonymous, and you may ' . 'rest assured this will never be shown to anybody else.</p>' . '<form method="post" action="main.php?cat=game&amp;page=preferences&amp;task=profile">' . '<label for="real_name">Your Real Name:</label>' . '<br />' . '<input type="text" name="realname" id="real_name" value="' . $arrUsers[REALNAME] . '" maxlength="24" size="24" /> ' . '<input type="submit" value="Update my profile" />' . "</form>" . '<blockquote>"You also agree that by creating your account, ' . 'all details you have supplied are correct, persons who ' . 'create accounts with false information may be removed from ' . 'ORKFiA."</blockquote>';
            echo $strRealName;
            $strLeaderName = '<h3>Leader Name</h3>' . '<p>Your current nick name with us is <em>' . $arrStats[NAME] . '</em>. This is used in the forums, when sending mail using ' . 'the Orkfia Mail and in various alliance contexts. If someone ' . 'called out "<em>Hey ' . $arrStats[NAME] . '!</em>" in the ' . 'street, would you react to it and think it must be another ' . 'ORKFiAN?</p>' . '<form method="post" action="main.php?cat=game&amp;page=preferences&amp;task=profile">' . '<label for="new_leader_name">Your Leader Name:</label><br />' . '<input type="text" name="name" id="new_leader_name" value="' . $arrStats[NAME] . '" maxlength="16" size="16" /> ' . "<input type=\"submit\" value=\"Update my profile\" />" . "</form>";
            echo $strLeaderName;
            $strPassword = '******' . '<p>For your own safety, make sure your password consists of ' . 'minimum 8 characters including numbers and capital letters.' . '</p>' . '<form method="post" action="main.php?cat=game&amp;page=preferences&amp;task=profile">' . '<label for="current_pw">Current Password:</label><br />' . '<input type="password" name="password" id="current_pw" />' . '<br /><br />' . '<label for="new_pw">New Password:</label><br />' . '<input type="password" name="password1" id="new_pw" ' . 'maxlength="30" />' . '<br /><br />' . '<label for="repeat_pw">Confirm Password:</label><br />' . '<input type="password" name="password2" id="repeat_pw" ' . 'maxlength="30" /> ' . '<input type="submit" value="Update my profile" />' . "</form>";
            echo $strPassword;
            $strEmail = '<h3>E-mail</h3>' . '<p>It is important that you get this right, if you would ' . 'forget your password or if our ORKFiA Staff Team need to ' . 'contact you this e-mail will be used. We will never share ' . 'this with anyone else, privacy is a major concern to us.</p>' . '<form method="post" action="main.php?cat=game&amp;page=preferences&amp;task=profile">' . '<label for="new_email">' . "Your e-mail:" . '</label><br />' . '<input type="text" name="email" id="new_email" value="' . $strEmail . '" maxlength="30" size="30" />' . ' <input type="submit" value="Update my profile" />' . "</form>";
            echo $strEmail;
            break;
        case "request_name":
            $strSwitch = $objGame->get_game_switch(NAME_CHANGE_PROGRAM);
            if ($strSwitch == 'on') {
                echo "<h2> Request Name Change </h2>";
                echo "<p>Here you may request that the ORKFiA Staff Team " . "changes your tribe name. Normally you would only change " . "your tribe name if you reset your account, or if " . "your tribe dies.</p>";
                if (isset($_POST['action']) && $_POST['action'] == "yes") {
                    if (!empty($_POST['newtribename']) && !empty($_POST['reason'])) {
                        $strTribe = $_POST['newtribename'];
                        $strTribe = quote_smart(strip_tags(trim($strTribe)));
                        $reason = quote_smart(str_replace("'", "", strip_tags(trim($_POST['reason']))));
                        $check = mysql_query("SELECT * FROM stats WHERE tribe = {$strTribe}");
                        if (mysql_num_rows($check) != 0) {
                            echo "<p>Sorry, someone is already using that tribe name.</p>";
                        } else {
                            echo "<p>Thank you, your request has been sent to staff. You will soon recieve a confirmation note.</p>";
                            mysql_query("INSERT INTO namechanges (id, tribe, requestedname, reason, mod_id, reason_declined, request_status, oldname) VALUES ( '', '{$arrSrcStats['id']}', {$strTribe}, {$reason}, '0', '0', 'ready', '{$arrSrcStats['tribe']}')");
                        }
                    } else {
                        echo '<p>' . "You need to fill in a new tribe name and a reason." . '</p><p>' . '<a href="main.php?cat=game&amp;page=preferences&amp;task=request_name">Return</a>' . '</p>';
                    }
                } elseif (isset($_POST['action']) && $_POST['action'] == "cancel") {
                    echo "<p>Your request to change your tribe name has been deleted.</p>";
                    mysql_query("UPDATE namechanges SET request_status = 'cancelled' WHERE tribe = {$arrSrcStats['id']} AND request_status = 'ready' ");
                } else {
                    $strSQL = "SELECT requestedname FROM namechanges WHERE tribe = {$arrSrcStats['id']} AND request_status = 'ready'";
                    $result2 = mysql_query($strSQL);
                    if ($result = mysql_fetch_array($result2)) {
                        echo "<p>You have a pending name request.<br /> Your requested name is: " . stripslashes($result['requestedname']) . ".</p><p>If you wish to cancel your name request you may use the button below.</p>" . "<form method=\"post\" action=\"main.php?cat=game&amp;page=preferences&amp;task=request_name\">" . "<input type=hidden value='cancel' name='action'>" . "<input type=submit value='Cancel Request'>" . "</form>";
                    } else {
                        ?>
            <form method="post" action="main.php?cat=game&amp;page=preferences&amp;task=request_name">

                <label for="new tribe name">New Tribe Name:</label><br />
                <input type="text" size="30" name="newtribename"
                maxlength="30" id="new tribe name"
                value="<?php 
                        echo stripslashes($arrSrcStats[TRIBE]);
                        ?>
" /><br /><br />

                <label for="reason">Reason For Changing:</label><br />
                <input type="text" size="48" name="reason" maxlength="100" id="reason" />
                <input type="hidden" name="action" value="yes" />

                <input type="submit" value="Send request to Operations staff" />
            </form>
<?php 
                    }
                }
            } else {
                echo '<p class="positive">Currently name changes are closed. ' . 'It is not possible to request any more name changes.</p>';
            }
            break;
        case "request_merge":
            echo '<h2>Request Merge</h2>';
            $mergeswitch = $objGame->get_game_switch(MERGER_PROGRAM);
            if ($mergeswitch == "on") {
                if (isset($_POST['do']) && $_POST['do'] == "cancel") {
                    $bleh = mysql_query("SELECT * FROM mergers WHERE tribe = {$arrSrcStats['id']} AND ( request_status = 'not ready' OR request_status = 'ready')");
                    $bleh = mysql_fetch_array($bleh);
                    $bleh2 = mysql_query("SELECT * FROM stats WHERE type='elder' AND kingdom='{$bleh['target']}'");
                    $bleh2 = mysql_fetch_array($bleh2);
                    $message = "The merge request done by " . $arrSrcStats[TRIBE] . " (#" . $arrSrcStats[ALLIANCE] . ") has been cancelled by the player.";
                    mysql_query("INSERT INTO messages (id, for_user, from_user, date, subject, text, new, action) VALUES ('', {$bleh2['id']}, 0, {$orkTime}, 'Merge Request Cancelled', " . quote_smart($message) . ", 'new', 'received')");
                    mysql_query("DELETE FROM mergers WHERE tribe = {$arrSrcStats['id']} AND ( request_status = 'not ready' OR request_status = 'ready')");
                    echo "<p>Your merge request has been deleted.</p>";
                    echo '</div>';
                    return;
                }
                $result2 = mysql_query("SELECT * FROM mergers WHERE tribe = {$arrSrcStats['id']} AND ( request_status = 'not ready' OR request_status = 'ready')");
                $result2 = mysql_fetch_array($result2);
                if (isset($result2['target'])) {
                    echo "<p>You have a pending merge request to alliance (#" . $result2['target'] . ").<br />If you want to cancel this " . "merge request click on the button below.</p>";
                    echo $strCancelForm = '<form method="post" action="main.php?cat=game&amp;page=preferences&amp;task=request_merge">' . '<input type="hidden" name="do" value="cancel" />' . '<input type="submit" value="Cancel merge request" />' . '</form>';
                    echo '</div>';
                    return;
                }
                // Action on sent confirmation from target elder (by PM link)
                if (isset($_GET['checker']) && $_GET['checker'] > 0) {
                    $checker = intval($_GET['checker']);
                    $mergerid = intval($_GET['mergerid']);
                    $result = mysql_query("SELECT * FROM mergers WHERE tribe = {$mergerid} ORDER BY id DESC LIMIT 1");
                    if (mysql_num_rows($result) > 0) {
                        $result = mysql_fetch_array($result);
                        if ($checker == 1 && $result['target'] == $arrSrcStats[ALLIANCE]) {
                            mysql_query("UPDATE mergers SET auth = 1, request_status = 'ready' WHERE tribe = {$mergerid} AND request_status = 'not ready'") or die("<p>Error while accepting tribe.</p>");
                            $message = "Your request to merge to alliance {$result['target']} has been accepted by their elder.<br /><br />A member of the Operations Resort will merge you as soon as possible =)";
                            $sqlquery = "INSERT INTO messages (id, for_user, from_user, date, subject, text, new, action) VALUES ('', {$result['tribe']}, 0, {$orkTime}, 'Merge Request Accepted', " . quote_smart($message) . ", 'new', 'received')";
                            mysql_query($sqlquery);
                            echo "<p>Thank you, we have now accepted a new member to the alliance.</p>";
                        } elseif ($checker == 2 && $result['target'] == $arrSrcStats[ALLIANCE]) {
                            mysql_query("DELETE FROM mergers WHERE tribe = {$result['tribe']} AND ( request_status = 'not ready' OR request_status = 'ready') ") or die("<br />Error while rejecting tribe.<br />");
                            $message = "Your request to merge to alliance {$result['target']} has been rejected by their elder.<br /><br />";
                            $sqlquery = "INSERT INTO messages (id, for_user, from_user, date, subject, text, new, action) VALUES ('', {$result['tribe']}, 0, {$orkTime}, 'Merge Request Rejected', " . quote_smart($message) . ", 'new', 'received')";
                            mysql_query($sqlquery);
                            echo "<p>Thank you for answering the request.</p>";
                        } else {
                            echo "<p>This tribe is no longer applying for a merge into your alliance.</p>";
                        }
                    } else {
                        echo "<p>The merge request no longer exists.</p>";
                    }
                } elseif (isset($_POST['do']) && $_POST['do'] == "yes") {
                    $iTargetAlli = intval($_POST['target']);
                    if (empty($iTargetAlli)) {
                        echo "<p>You have to fill in an alliance number that " . "you wish to merge into. Please try again. </p>";
                        unset($_POST['do']);
                        echo '</div>';
                        return;
                    } elseif ($iTargetAlli == $arrSrcStats[ALLIANCE]) {
                        echo "<p>You can not merge into your own alliance. " . "Please fill in another alliance number.</p>";
                        echo '</div>';
                        return;
                    } elseif ($iTargetAlli <= 10) {
                        echo "<p>You can not request to merge into a staff " . "alliance. Please fill in another alliance " . "number.</p>";
                        echo '</div>';
                        return;
                    }
                    $strSQL = "SELECT * FROM " . TBL_ALLIANCE . " WHERE id = " . $iTargetAlli;
                    if (mysql_num_rows(mysql_query($strSQL)) != 1) {
                        echo "<p>We're sorry, this alliance does not exist.</p>";
                        echo '</div>';
                        return;
                    }
                    $objTrgAlliance = new clsAlliance($iTargetAlli);
                    $arrUserids = $objTrgAlliance->get_userids();
                    if (count($arrUserids) >= MAX_ALLIANCE_SIZE) {
                        echo "<p>We're sorry, this alliance is full.</p>";
                        echo '</div>';
                        return;
                    } else {
                        // Default: no name change requested along with merger
                        $newtribename = $arrSrcStats[TRIBE];
                        $safetribename = quote_smart(stripslashes($newtribename));
                        if (isset($_POST['newtribename']) && !empty($_POST['newtribename'])) {
                            $safetribename = quote_smart(strip_tags(trim($_POST['newtribename'])));
                            $id = $objSrcUser->get_userid();
                            $check = mysql_query("SELECT * FROM stats WHERE tribe = {$safetribename} AND id != {$id}");
                            if (mysql_num_rows($check) != 0) {
                                echo "<p>Someone is already using that tribename.</p>";
                                echo '</div>';
                                return;
                            }
                            $message = "You have an awaiting merge request.<br /><br />" . $arrSrcStats[TRIBE] . " (#" . $arrSrcStats[ALLIANCE] . ") wishes to join your alliance.<br />They did also request a new name.<br /><br />Do you <a href= \"main.php?cat=game&amp;page=preferences&amp;task=request_merge&amp;checker=1&amp;mergerid=" . $arrSrcStats['id'] . "\">accept their request</a> or <a href= \"main.php?cat=game&amp;page=preferences&amp;task=request_merge&amp;checker=2&amp;mergerid=" . $arrSrcStats['id'] . "\">deny their request</a>?<br />";
                        } else {
                            $message = "You have an awaiting merge request.<br /><br />" . $arrSrcStats[TRIBE] . " (#" . $arrSrcStats[ALLIANCE] . ") wishes to join your alliance.<br /><br />Do you <a href=\"main.php?cat=game&amp;page=preferences&amp;task=request_merge&amp;checker=1&amp;mergerid=" . $arrSrcStats['id'] . "\">accept</a> or <a href=\"main.php?cat=game&amp;page=preferences&amp;task=request_merge&amp;checker=2&amp;mergerid=" . $arrSrcStats['id'] . "\">deny</a> their request?";
                        }
                        $iElderId = mysql_query("SELECT id FROM stats WHERE type = 'elder' AND " . ALLIANCE . " = {$iTargetAlli}");
                        $iElderId = mysql_fetch_array($iElderId);
                        $iElderId = $iElderId['id'];
                        if (!empty($iElderId)) {
                            mysql_query("INSERT INTO messages (id, for_user, from_user, date, subject, text, new, action) VALUES ('', {$iElderId}, 0, {$orkTime}, 'Merge Request', " . quote_smart($message) . ", 'new', 'received')");
                        } else {
                            echo "<p>There's no elder in this alliance!</p>";
                            echo '</div>';
                            return;
                        }
                        // Insert into mergers
                        mysql_query("INSERT INTO mergers (id, tribe, target, origin, auth, tribe_status, request_status, mtype, merge_time, newname, oldname, mod_id, declined_reason) VALUES ('', {$id}, {$iTargetAlli}, {$arrSrcStats[ALLIANCE]}, 0, " . quote_smart($arrSrcStats[TYPE]) . ", 'not ready', 1, {$orkTime}, {$safetribename}, " . quote_smart($arrSrcStats[TRIBE]) . ", '0', '0')") or die("Merger error");
                        echo "<p>The request was sent to the elder of (#" . $iTargetAlli . ")!</p>";
                    }
                } else {
                    include_once "inc/functions/war.php";
                    $warTarget = war_target($arrSrcStats[ALLIANCE]);
                    $strDate = $objSrcUser->get_gamestat(SIGNUP_TIME);
                    $iHours = $objSrcUser->get_user_info(HOURS);
                    $bAllow = TRUE;
                    if ($warTarget != 0) {
                        echo "<p>The option to merge is not available during war.</p>";
                        $bAllow = FALSE;
                    } elseif (strtotime("-6 weeks") < strtotime($strDate)) {
                        echo '<p>You may merge for another ' . ceil((strtotime($strDate) - strtotime("-6 weeks")) / 86400) . ' days.</p>';
                        $bAllow = TRUE;
                    } elseif ($iHours < 72) {
                        echo '<p>You may merge for another ' . ceil(abs(($iHours - 72) / 12)) . ' orkfian years';
                        $bAllow = TRUE;
                    }
                    if ($bAllow) {
                        echo $strForm = '<h3>Merging into another alliance</h3>' . '<form method="post" action="main.php?cat=game&amp;page=preferences&amp;task=request_merge">' . 'Alliance # you wish to request a merge with: ' . '<input type="text" size="4" name="target" maxlength="4" />' . '<br />' . 'New tribe name you want: ' . '<input type="text" size="16" name="newtribename" maxlength="30" /> (optional)' . '<br /><br />' . '<input type="hidden" name="do" value="yes" />' . '<input type="submit" value="Send merge request" />' . '</form>';
                    } elseif (strtotime("-6 weeks") > strtotime($strDate)) {
                        echo '<p>Currently your ruler is too old to merge.</p>';
                    }
                }
                echo $strRules = '<h3>Merger Rules</h3>' . '<ol>' . '<li>You may request a merge ' . 'anywhere, at any time, within 6 weeks after you ' . 'sign up</li>' . '<li>Veteran players may only merge before their ' . 'ruler age is 22 (within 3 days after restarting)' . '<li>Exception to rule #2: If you were <em>defected' . '</em> you may request a merges at any ruler age, but ' . 'only <em>after</em> 1 week</li>' . '<li>No one may merge during wars</li>' . '</ol>';
            } else {
                echo "<p>Currently merging is closed. You can not request/accept any more mergers.</p>";
            }
            break;
        case "delete_account":
            echo '<h2>Delete Account</h2>';
            include_once "inc/functions/war.php";
            $warTarget = war_target($arrSrcStats[ALLIANCE]);
            if ($warTarget > 0) {
                echo "<p>You are not allowed to delete during war.</p>";
                echo '</div>';
                return;
            }
            $arrSrcArmysOut = $objSrcUser->get_armys_out();
            if (array_sum($arrSrcArmysOut) > 0) {
                echo "<p>Sorry, you can not delete with troops out.</p>";
                echo '</div>';
                return;
            }
            if (isset($_GET['do']) && $_GET['do'] == "yes" && isset($_POST['checker'])) {
                echo "<p>It's so sad to see you go.</p>";
                //include_once("inc/functions/research.php");
                //delete_my_rps($iUserId);
                // no more - AI 07/05/07
                $objSrcUser->set_stat(NAME, 'deleted');
                $objSrcUser->set_stat(ALLIANCE, 0);
                mysql_query("DELETE FROM rankings_personal WHERE id = {$iUserId}");
                setcookie("userid", "");
                echo "<p>...Thank you for playing ORKFiA...</p>";
                // Alliance News
                $iAlliance = $objSrcUser->get_stat(ALLIANCE);
                $orkTime = date("YmdHis");
                $strSQL = "INSERT INTO news (id, time, ip, type, duser, ouser, result, text, kingdom_text, kingdoma, kingdomb) VALUES ('','{$orkTime}', '', 'Selfdeletion', 0, 0, 1, 'tribe deleted', '" . $arrSrcStats[TRIBE] . " deleted their tribe.', " . $iAlliance . ", {$iAlliance})";
                mysql_query($strSQL);
                echo '</div>';
                return;
            } else {
                $strForm = '<form method="post" action="main.php?cat=game&amp;page=preferences&amp;task=delete_account&amp;do=yes">' . 'Are you absolutely sure you want to <em>delete</em> your account? ' . '<input type="checkbox" name="checker" id="y1"> ' . '<label for="y1">(yes)</label>' . '<br /><br />' . 'This action is permanent and cannot be undone.' . '<br /><br />' . '<input type="submit" value="Delete my account">' . '</form>';
                echo $strForm;
            }
            break;
        case "reset_account":
            echo '<h2>Reset Account</h2>';
            include_once "inc/functions/war.php";
            $warTarget = war_target($arrSrcStats[ALLIANCE]);
            if ($warTarget > 0) {
                echo '<p>Sorry, you are not allowed to reset during war.</p>';
                echo '</div>';
                return;
            }
            $arrSrcArmysOut = $objSrcUser->get_armys_out();
            if (array_sum($arrSrcArmysOut) > 0) {
                echo '<p>Sorry, you cannot reset while you have troops out.</p>';
                echo '</div>';
                return;
            }
            if (isset($_GET['do']) && $_GET['do'] == "yes" && isset($_POST['checker'])) {
                // Mark tribe for resetting
                $objSrcUser->set_stat(RESET_OPTION, "'yes'");
                // Force update of rankings
                include_once 'inc/functions/update_ranking.php';
                doUpdateRankings($objSrcUser, 'yes');
                $strP = '<p>' . 'Your account has been reset!' . '</p><p>' . '<a href="main.php?cat=game&amp;page=tribe">' . 'Continue' . '</a>' . '</p>';
                echo $strP;
            } else {
                $strForm = '<form method="post" action="main.php?cat=game&amp;page=preferences&amp;task=reset_account&amp;do=yes">' . 'Are you absolutely sure you want to <em>reset</em> your account? ' . '<input type="checkbox" name="checker" id="1"> ' . '<label for="1">(yes)</label>' . '<br /><br />' . 'This action is permanent and cannot be undone.' . '<br /><br />' . '<input type="submit" value="Reset my account">' . '</form>';
                echo $strForm;
            }
            break;
        case "pause_account":
            echo '<h2>Pause Account</h2>';
            $PauseModeActive = $objGame->get_game_switch(PAUSE_MODE_ACTIVE);
            if ($PauseModeActive != 'on') {
                echo "<p><span class=positive>We're sorry, currently you may " . "not pause your account due to a global event.</span></p>";
                echo '</div>';
                return;
            }
            $arrSrcUserInfos = $objSrcUser->get_user_infos();
            if ($arrSrcUserInfos[PAUSE_ACCOUNT] == 0 && ($arrSrcUserInfos[NEXT_ATTACK] > 0 && $arrSrcUserInfos[HOURS] > 0)) {
                echo "<p>" . $arrSrcUserInfos[NEXT_ATTACK] . " hour(s) left before your troops are home.</p>";
                echo '</div>';
                return;
            }
            $arrSrcBuilds = $objSrcUser->get_builds();
            if ($arrSrcUserInfos[PAUSE_ACCOUNT] == 0 && ($arrSrcBuilds[LAND_T1] > 0 || $arrSrcBuilds[LAND_T2] > 0 || $arrSrcBuilds[LAND_T3] > 0 || $arrSrcBuilds[LAND_T4] > 0)) {
                echo "<p>You can't pause while land is incoming.</p>";
                echo '</div>';
                return;
            }
            if ($arrSrcUserInfos[PAUSE_ACCOUNT] > 49) {
                echo "<p>Your account will be paused in " . ($arrSrcUserInfos[PAUSE_ACCOUNT] - 49) . " updates, you will be able to unpause it in " . ($arrSrcUserInfos[PAUSE_ACCOUNT] - 1) . "</p>";
                echo '</div>';
                return;
            }
            if ($arrSrcUserInfos[PAUSE_ACCOUNT] > 1) {
                echo "<p>" . ($arrSrcUserInfos[PAUSE_ACCOUNT] - 1) . " updates left " . "until you may un-pause your account and play again.</p>";
                echo '</div>';
                return;
            }
            //             if($arrSrcUserInfos[PAUSE_ACCOUNT] == 1 && war_target($arrSrcStats[ALLIANCE]) > 0 )
            //             {
            //                 echo "<p>You cannot unpause during war.</p>";
            //                 echo '</div>';
            //                 return;
            //             }
            if (isset($_POST['do']) && $_POST['do'] == "yes") {
                // Pause Account Routines. Martel July 13, 2006
                $arrSrcUser = $objSrcUser->get_user_infos();
                if ($arrSrcUser[NEXT_ATTACK] <= 1) {
                    $arrSrcUser[NEXT_ATTACK] = 1;
                }
                $arrNewSrcUser = array(NEXT_ATTACK => $arrSrcUser[NEXT_ATTACK], PAUSE_ACCOUNT => 55);
                $objSrcUser->set_user_infos($arrNewSrcUser);
                // Empty Magic and Thievery Points
                $objSrcUser->set_spell(POWER, 0);
                $objSrcUser->set_thievery(CREDITS, 0);
                // Forced Ranking Update
                include_once 'inc/functions/update_ranking.php';
                doUpdateRankings($objSrcUser, 'yes');
                // M: Alliance news (March 07, 2008)
                $objSrcAlliance = $objSrcUser->get_alliance();
                $iWarTarget = $objSrcAlliance->get_war('target');
                // 0=default
                $iAllianceid = $objSrcAlliance->get_allianceid();
                mysql_query("INSERT INTO news (id, time, ip, type, duser, ouser, result, text, kingdom_text, kingdoma, kingdomb) VALUES ('', '{$orkTime}', '---', 'vacation', 0, 0, 1, '', '{$arrSrcStats['tribe']} (#{$iAllianceid}) is entering vacation mode', {$iAllianceid}, {$iWarTarget})");
                echo "<p>Your account has been paused, see you back in 2 or more days =)</p>";
                echo '</div>';
                return;
            } elseif (isset($_POST['do']) && $_POST['do'] == "no") {
                // Un-Pause Account Routines. Martel July 13, 2006
                $arrNewSrcUser = array(NEXT_ATTACK => 0, PAUSE_ACCOUNT => 0);
                $objSrcUser->set_user_infos($arrNewSrcUser);
                // M: Alliance news (March 07, 2008)
                $objSrcAlliance = $objSrcUser->get_alliance();
                $iWarTarget = $objSrcAlliance->get_war('target');
                // 0=default
                $iAllianceid = $objSrcAlliance->get_allianceid();
                mysql_query("INSERT INTO news (id, time, ip, type, duser, ouser, result, text, kingdom_text, kingdoma, kingdomb) VALUES ('', '{$orkTime}', '---', 'vacation', 0, 0, 1, '', '{$arrSrcStats['tribe']} (#{$iAllianceid}) is now back from vacation mode', {$iAllianceid}, {$iWarTarget})");
                echo "<p>Your account has been un-paused, we're glad to see you back =)</p>";
            } else {
                if ($arrSrcUserInfos[PAUSE_ACCOUNT] > 0) {
                    ?>
                <p>You are now allowed to un-pause your account.</p>
                <form method="post" action="main.php?cat=game&amp;page=preferences&amp;task=pause_account">
                    <input type="hidden" name="do" value="no">
                    <input type="submit" value="Leave Vacation Mode">
                </form>
<?php 
                } else {
                    ?>
                <h3>Vacation Mode Rules</h3>
                <ul>
                    <li>Entering Vacation Mode will take 6 hours</li>
                    <li>You <i>may</i> enter Vacation Mode during war</li>
                    <li>You may not enter Vacation Mode if you currently have
                    military out on an attack or if you have incoming acres</li>
                    <li>Your ruler will still age, but your account will be
                    protected during Vacation Mode</li>
                </ul>

                <form method="post" action="main.php?cat=game&amp;page=preferences&amp;task=pause_account">
                    <input type="hidden" name="do" value="yes">
                    <input type="submit" value="Enter vacation mode">
                </form>

                <p>Vacation Mode runs for 48 hours minimum. If you cannot enter
                VM with your account due to circumstances beyond your control,
                you may message a staff member in Law & Order requesting your
                account being suspended and a valid reason why you can't pause
                it yourself.</p>
<?php 
                }
            }
            break;
    }
    echo '</div>';
}
コード例 #18
0
ファイル: main.inc.php プロジェクト: BrorHolm/Orkfia-2008
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>';
}
コード例 #19
0
ファイル: war_room.inc.php プロジェクト: BrorHolm/Orkfia-2008
function include_war_room_text()
{
    // User object
    $objSrcUser = $GLOBALS['objSrcUser'];
    $arrSrcStats = $objSrcUser->get_stats();
    // Alliance object
    $objSrcAlli = $objSrcUser->get_alliance();
    $arrSrcWar = $objSrcAlli->get_wars();
    // Include war functions
    // Show declare war page is default unless the alliance is at war
    $strShow = "declare_war";
    if ($arrSrcWar['target'] != 0) {
        $strShow = "current_war";
    }
    // Show page
    switch ($strShow) {
        case "declare_war":
            // M: Show statistics (if we have been in war)
            $strStatistics = '';
            if ($arrSrcWar['last_target'] != 0) {
                // M: Show statistics, with correct grammar
                $arrS = array('ies', 's', 's', 's');
                if ($arrSrcWar['victory'] == 1) {
                    $arrS[0] = 'y';
                }
                if ($arrSrcWar['defeat'] == 1) {
                    $arrS[1] = '';
                }
                if ($arrSrcWar['surrender'] == 1) {
                    $arrS[2] = '';
                }
                if ($arrSrcWar['truce'] == 1) {
                    $arrS[3] = '';
                }
                $strStatistics .= '<p>' . '<strong class="positive">' . $arrSrcWar['victory'] . " war victor{$arrS['0']}</strong>&#8212;defeated " . $arrSrcWar['defeat'] . " time{$arrS['1']}.<br />" . "We have surrendered " . $arrSrcWar['surrender'] . " time{$arrS['2']} and truced " . $arrSrcWar['truce'] . " time{$arrS['3']}.</strong>" . '</p><p>';
                // Info about who the last wartarget was                - AI
                $objTrgAlli = new clsAlliance($arrSrcWar['last_target']);
                $arrTrgAlli = $objTrgAlli->get_alliance_infos();
                // M: Show continued statistics, with correct grammar
                if ($arrSrcWar['last_outgoing'] == 'surrender') {
                    $strF = 'Our last war ended as a %s to %s (#%d).';
                } elseif ($arrSrcWar['last_outgoing'] == 'victory') {
                    $strF = 'Our last war ended as a %s over %s (#%d).';
                } elseif ($arrSrcWar['last_outgoing'] == 'defeat') {
                    $strF = 'Our last war ended as a %s against %s (#%d).';
                } elseif ($arrSrcWar['last_outgoing'] == 'truce') {
                    $strF = 'Our last war ended in a %s with %s (#%d).';
                }
                // M: Echo continued statistics
                $strStatistics .= sprintf($strF, $arrSrcWar['last_outgoing'], stripslashes($arrTrgAlli['name']), $arrSrcWar['last_target']);
                $strStatistics .= '</p>';
            } else {
                $strStatistics .= '<p>We have not been in a war yet.</p>';
            }
            // M: Find alliances in range
            $iAlliSize = $objSrcAlli->get_alliance_size('land');
            $iUpwardRange = floor($iAlliSize * WAR_UPWARD_MOD);
            $iBottomRange = ceil($iAlliSize * WAR_BOTTOM_MOD);
            $strSQL = "SELECT id FROM rankings_alliance ";
            $strSQL .= "WHERE land BETWEEN {$iBottomRange} and {$iUpwardRange} ";
            $strSQL .= "ORDER BY land DESC";
            $resSQL = mysql_query($strSQL);
            $count = 1;
            $objTmpAlli = new clsAlliance(1);
            $strTableRow = '';
            $strInputList = '<option selected="selected"></option>';
            while ($row = mysql_fetch_assoc($resSQL)) {
                // M: Get temporary alliance object
                $objTmpAlli->set_allianceid($row['id']);
                // M: Check if war is possible
                $arrWarPossible = testWarPossible($objSrcAlli, $objTmpAlli);
                $bWarPossible = $arrWarPossible[0];
                if ($bWarPossible) {
                    // M: Fetch alliance rankings
                    $arrTmpRanks = $objTmpAlli->get_rankings_alliances();
                    $strAllianceLink = "<a href=\"main.php?cat=game&amp;page=" . "alliance&amp;aid={$row['id']}\">{$row['id']}</a>";
                    // M: Create drop-down list with targets in range (for form)
                    $strInputList .= '<option value="' . $row['id'] . '">' . stripslashes($arrTmpRanks['alli_name']) . '</option>';
                    // M: Create "Alliances in range" table data
                    $strTableRow .= "<tr class=data>" . '<th width="22">' . $count . '.</th>' . "<th>" . stripslashes($arrTmpRanks['alli_name']) . " (#{$strAllianceLink})" . "</th>" . "<td>" . number_format($arrTmpRanks['land']) . "</td>" . "<td>" . number_format($arrTmpRanks[STRENGTH]) . "</td>" . "<td>" . number_format($arrTmpRanks['fame']) . "</td>" . "</tr>";
                    $count++;
                }
            }
            if ($count == 1) {
                $strTableRow .= '<tr class="data">' . '<th class="center" colspan="5">' . "There are no alliances that we can declare against." . '</th>' . "</tr>";
                $strForm = "<p>There are no alliances that we can declare against.</p>";
            } elseif ($_SERVER['SERVER_NAME'] == DEV_SERVER_NAME || $arrSrcStats['type'] == "elder" || $arrSrcStats['type'] == "coelder") {
                $strForm = '<form method="post" action="main.php?cat=game&amp;page=war_room2" id="center">' . '<label>Alliance: ' . '<select name="target">' . $strInputList . '</select>' . '</label> ' . '<input type="submit" name="declare" value="Declare War!" />' . '</form><br />';
            } else {
                $strForm = '<p>Only alliance elders can declare war.</p>';
            }
            // M: Show page contents
            echo $strPage = '<div id="textMedium" style="margin-top: 0;">' . '<h2>Declare War</h2>' . '<p>' . "In a war, knowing the enemy is very important. " . "Decipher the enemies' weaknesses and avoid " . "confronting their strengths. Gather information about " . "their tribes and research, and then choose targets for " . "your attackers, thieves and mages." . '</p>' . '<h3>Statistics</h3>' . $strStatistics . '<h3>New war target</h3>' . $strForm . '</div><br />' . '<table class="medium" cellpadding="0" cellspacing="0">' . '<tr class="header">' . '<th colspan="5">Alliances in Range</th>' . '</tr>' . '<tr class="subheader"><th colspan="2">Alliance</th>' . '<th>Acres</th>' . '<th class="right">Strength</th>' . '<th class="right">Fame</th>' . '</tr>' . $strTableRow . '</table>';
            break;
        case "current_war":
            // We are in war
            $objTrgAlli = new clsAlliance($arrSrcWar['target']);
            $arrTrgAlli = $objTrgAlli->get_alliance_infos();
            $arrTrgWar = $objTrgAlli->get_wars();
            // Time of war start
            // Get game hours
            require_once 'inc/classes/clsGame.php';
            require_once 'inc/functions/orktime.php';
            $objGame = new clsGame();
            $iGameHours = $objGame->get_game_time('hour_counter');
            $arrOE = hoursToYears(WAR_LENGTH - ($iGameHours - $arrSrcWar['war_started']));
            $strOrkDate = "{$arrOE['years']} years and {$arrOE['months']} months";
            // Option: Claim Victory (tho should be automatic like "final blow")
            $strDiplomacy = '';
            if ($arrSrcWar['land_needed'] <= 0) {
                $strDiplomacy .= '<p>We have reached our war goal. Do you wish to claim this victory?</p>' . '<form method="post" action="main.php?cat=game&page=war_room2" id="center">' . '<input type="submit" name="victory" value="Claim Victory!">' . "</form><br />";
            } elseif (($_SERVER['SERVER_NAME'] == DEV_SERVER_NAME || $arrSrcStats['type'] == "elder" || $arrSrcStats['type'] == "coelder") && $arrSrcWar['truce_offer'] == 1 && $arrTrgWar['truce_offer'] == 0) {
                $strDiplomacy .= '<p>' . "Alliance #" . $objTrgAlli->get_allianceid() . " has " . "not accepted our generous offer to truce yet. " . '</p>' . '<p>' . "As a last resort and at a greater cost we may " . "surrender. (+40% war losses). The only valid reason " . "to do this is to save our alliance from further damage." . '</p>' . '<p>Do you wish to surrender?</p>' . '<form method="post" action="main.php?cat=game&page=war_room2" id="center">' . '<input type="submit" name="ctruce" value="Withdraw Truce" /> ' . '<input type="submit" name="surrender" value="Surrender War" />' . '</form><br />';
            } elseif (($_SERVER['SERVER_NAME'] == DEV_SERVER_NAME || $arrSrcStats['type'] == "elder" || $arrSrcStats['type'] == "coelder") && $arrSrcWar['truce_offer'] == 0 && $arrTrgWar['truce_offer'] == 0) {
                $strDiplomacy .= '<p>We have the option to offer a truce to the enemy.</p>' . '<form method="post" action="main.php?cat=game&page=war_room2" id="center">' . '<input type="submit" name="otruce" value="Offer truce">' . "</form><br />";
            } elseif (($_SERVER['SERVER_NAME'] == DEV_SERVER_NAME || $arrSrcStats['type'] == "elder" || $arrSrcStats['type'] == "coelder") && $arrSrcWar['truce_offer'] == 0 && $arrTrgWar['truce_offer'] == 1) {
                $strDiplomacy .= '<p>' . "Leader, #<strong>{$arrTrgWar['id']}</strong> has " . "offered us a truce." . '</p>' . '<form method="post" action="main.php?cat=game&page=war_room2" id="center">' . '<input type="submit" name="atruce" value="Accept Truce">' . '</form><br />';
            }
            echo $strPage = '<div class="tableLinkMedium">' . '<a href="main.php?cat=game&amp;page=global_news">Global News</a>' . ' | <a href="main.php?cat=game&amp;page=alliance&amp;aid=' . $arrTrgAlli['id'] . '">Alliance #' . $arrTrgAlli['id'] . '</a>' . '</div>' . '<div id=textMedium style="margin-top: 0;">' . '<h2>Victory conditions</h2>' . '<p>' . '<strong class="positive">Take ' . number_format($arrSrcWar['land_needed']) . ' acres to win</strong>&#8212;lose ' . number_format($arrTrgWar['land_needed']) . " acres for defeat." . '</p>' . "<p><em>{$strOrkDate} left until automatic draw.</em></p>" . '<h3>Diplomacy</h3>' . $strDiplomacy . '</div>';
            break;
    }
    // M: Show guide link + advice
    include_once 'inc/pages/advisors.inc.php';
    echo get_guide_link($objSrcUser, 'war_room', 'textMedium');
}
コード例 #20
0
ファイル: market.php プロジェクト: BrorHolm/Orkfia-2008
function doUpdateMarket(&$objAlliance)
{
    include_once 'inc/classes/clsGame.php';
    $objGame = new clsGame();
    $iHours = $objGame->get_game_time(HOUR_COUNTER);
    $arrAlliance = $objAlliance->get_alliance_infos();
    $iUpdates = $iHours - $arrAlliance[MARKET_HOUR];
    // calculate # of updates and update the market accordingly
    $intUpdatesOwed = $iUpdates;
    if ($intUpdatesOwed > 0) {
        $new_food = $arrAlliance[FOOD];
        $new_wood = $arrAlliance[WOOD];
        // decay of food and wood stacked on market, added loop - AI 03/05/07
        while ($intUpdatesOwed-- > 0) {
            $new_food = $new_food * (1 - 1 / 1500);
            $new_wood = $new_wood * 0.9995000000000001;
        }
        $arrAllianceNew = array(FOOD => round($new_food), WOOD => round($new_wood), MARKET_HOUR => $arrAlliance[MARKET_HOUR] + $iUpdates);
        $objAlliance->set_alliance_infos($arrAllianceNew);
    }
}
コード例 #21
0
function call_age_handler_text()
{
    global $tool;
    include_once 'inc/functions/resort_tools.php';
    if (!user_has_access($tool)) {
        echo "Sorry, this page is restricted to ORKFiA Staff";
        include_game_down();
        exit;
    }
    $objGame = new clsGame();
    //==========================================================================
    // Take care of sent form data
    //==========================================================================
    if (isset($_POST['i_age_start']) && isset($_POST['i_age_end'])) {
        // Get post variables
        $iAgeStart = $_POST['i_age_start'];
        $iAgeEnd = $_POST['i_age_end'];
        // Get last age's id or 0
        $iLastAge = 0;
        $iLastAge = mysql_result(mysql_query("SELECT age_number FROM ages ORDER BY age_number DESC LIMIT 0, 1"), 0);
        $iLastAge++;
        // Instantiate object and save to db
        $objNewAge = new clsAge($iLastAge, $iAgeStart, $iAgeEnd);
        $objNewAge->saveAge();
    } elseif (isset($_POST['i_age_to_make_now'])) {
        $iAgeToMakeNow = $_POST['i_age_to_make_now'];
        $objGame->set_game_time(AGE_NUMBER, $iAgeToMakeNow);
    } elseif (isset($_POST['i_age_to_delete'])) {
        $iAgeToDelete = $_POST['i_age_to_delete'];
        $objNewAge = new clsAge($iAgeToDelete);
        $objNewAge->deleteAge();
    }
    //==========================================================================
    // Show Task Links
    //==========================================================================
    echo 'Select Task:' . '<br /><br />' . ' | ' . '<a href="main.php?cat=game&amp;page=resort_tools' . '&amp;tool=' . $tool . '&amp;show=create">Create Age</a>' . ' | ' . '<a href="main.php?cat=game&amp;page=resort_tools' . '&amp;tool=' . $tool . '&amp;show=remove">Remove Age</a>' . ' | ' . '<a href="main.php?cat=game&amp;page=resort_tools' . '&amp;tool=' . $tool . '&amp;show=current">Current Age</a>' . ' | ' . '<br /><br />';
    //==========================================================================
    // Show table with existing ages
    //==========================================================================
    echo $strAgesTable = '<table class="small" cellspacing="0" cellpadding="0">' . '<tr class="header">' . '<th colspan="3">' . 'Ages' . '</th>' . '</tr>' . '<tr class="subheader">' . '<th>' . "Age #" . '</th>' . '<th class="right">' . "Start" . '</th>' . '<th class="right">' . "End" . '</th>' . '</tr>';
    $resSQL = mysql_query("SELECT * FROM ages ORDER BY age_number ASC");
    while ($arrRES = mysql_fetch_array($resSQL)) {
        echo $strAgesTable = '<tr class="data">' . '<th>' . $arrRES['age_number'] . '</th>' . '<td>' . $arrRES['year_start'] . ' OE</td>' . '<td>' . $arrRES['year_end'] . ' OE</td>' . '</tr>';
    }
    echo $strAgesTable = '</table>' . '<br />';
    //==========================================================================
    // Which option page to show
    //==========================================================================
    $strShow = '';
    if (isset($_GET['show'])) {
        $strShow = strval($_GET['show']);
    }
    switch ($strShow) {
        case "create":
            echo $strForm = '<form method="post" action="main.php?cat=game&amp;page=resort_tools&amp;tool=' . $tool . '&amp;show=create">' . '<label>First Year of new age: ' . '<input type="text" size="6" maxlength="4" name="i_age_start" />' . '</label>' . '<br /><br />' . '<label>Last Year of new age: ' . '<input type="text" size="6" maxlength="4" name="i_age_end" />' . '</label>' . '<br /><br />' . '<input type="submit" value="Create" />' . '<br /><br />' . '</form>';
            break;
        case "remove":
            $iLastAge = @mysql_result(mysql_query("SELECT age_number FROM ages ORDER BY age_number DESC LIMIT 0, 1"), 0);
            echo $strForm = '<form method="post" action="main.php?cat=game&amp;page=resort_tools&amp;tool=' . $tool . '&amp;show=remove">' . '<label>Age to Remove: ' . '<input type="text" size="6" maxlength="4" name="i_age_to_delete" value="' . $iLastAge . '" />' . '</label>' . '<br /><br />' . '<input type="submit" value="Remove" />' . '<br /><br />' . '</form>';
            break;
        case "current":
            $iAgeNumber = $objGame->get_game_time(AGE_NUMBER);
            echo $strForm = '<form method="post" action="main.php?cat=game&amp;page=resort_tools&amp;tool=' . $tool . '&amp;show=current">' . '<label>Current Age: ' . '<input type="text" size="6" maxlength="4" name="i_age_to_make_now" value="' . $iAgeNumber . '" />' . '</label>' . '<br /><br />' . '<input type="submit" value="Save New" />' . '<br /><br />' . '</form>';
            break;
    }
}