Exemplo n.º 1
0
function include_alliance_text()
{
    // This bugs pretty badly if the alliance tables are missing
    // Same thing further down too, but for target alliance obj.
    $objSrcUser =& $GLOBALS["objSrcUser"];
    $objSrcAlli = $objSrcUser->get_alliance();
    //==========================================================================
    // Martel: Validate the alliance number so we get an absolutely safe one
    //==========================================================================
    $iAid = intval($objSrcUser->get_stat(ALLIANCE));
    if (isset($_POST['aid'])) {
        $iAid = intval($_POST['aid']);
        if (strlen($_POST['aid']) > 4) {
            require_once 'inc/pages/logout.inc.php';
            include_logout_text();
        }
    } elseif (isset($_GET['aid'])) {
        $iAid = intval($_GET['aid']);
        if (strlen($_GET['aid']) > 4) {
            require_once 'inc/pages/logout.inc.php';
            include_logout_text();
        }
    }
    if ($iAid < 1) {
        $iAid = 1;
    }
    //==========================================================================
    $result = mysql_query("SELECT alli_id FROM rankings_personal WHERE alli_id < {$iAid} ORDER BY alli_id DESC LIMIT 1");
    if (mysql_num_rows($result) == '0') {
        $prevAlli['0'] = $iAid;
    } else {
        $prevAlli = mysql_fetch_row($result);
    }
    $result = mysql_query("SELECT alli_id FROM rankings_personal WHERE alli_id > {$iAid} ORDER BY alli_id ASC LIMIT 1");
    if (mysql_num_rows($result) == '0') {
        $nextAlli['0'] = $iAid;
    } else {
        $nextAlli = mysql_fetch_row($result);
    }
    echo $chooseAlliance = "<div class=\"tableLinkMini\">" . "<a href=\"main.php?cat=game&amp;page=alliance\">Home</a>" . "</div>" . "<form method=\"post\" action=\"main.php?cat=game&amp;page=alliance\" style=\"margin-top: 0pt;\">" . "<table cellpadding=\"0\" cellspacing=\"0\" class=\"mini\">" . "<tr class=\"header\">" . "<th colspan=\"4\">" . "Alliance" . "</th>" . "</tr>" . "<tr class=\"data\">" . "<td>" . "<a id=\"arrowl\" href=\"main.php?cat=game&amp;page=alliance&amp;aid=" . $prevAlli[0] . "\">" . "<span class=\"alt\">" . "&#60;" . "</span>" . "</a>" . "</td>" . "<td>" . "<input type=\"text\" name=\"aid\" size=\"4\" maxlength=\"4\" value=\"" . $iAid . "\" />" . "</td>" . "<td>" . "<input type=\"submit\" name=\"submit\" value=\"View\" />" . "</td>" . "<td>" . "<a id=\"arrowr\" href=\"main.php?cat=game&amp;page=alliance&amp;aid=" . $nextAlli[0] . "\">" . "<span class=\"alt\">" . "&#62;" . "</span>" . "</a>" . "</td>" . "</tr>" . "</table>" . "</form>";
    $res = mysql_query("SELECT COUNT(id) AS cnt FROM rankings_personal WHERE alli_id = {$iAid}");
    $line = mysql_fetch_assoc($res);
    if ($line["cnt"] == '0') {
        $res = mysql_query("SELECT id FROM rankings_alliance ORDER BY id DESC LIMIT 1");
        $max = mysql_fetch_assoc($res);
        $res = mysql_query("SELECT id FROM rankings_alliance ORDER BY id ASC LIMIT 1");
        $min = mysql_fetch_assoc($res);
        echo "Selections range from " . $min["id"] . "-" . $max["id"];
        include_game_down();
        exit;
    }
    ?>
    <div class="center">
<?php 
    //==========================================================================
    // Alliance Banner
    //==========================================================================
    $objTrgAlli = new clsAlliance($iAid);
    $arrAlliance = $objTrgAlli->get_alliance_infos();
    $arrRankingsAlliance = $objTrgAlli->get_rankings_alliances();
    if (trim($arrAlliance[IMAGE]) != '') {
        $arrAlliance[IMAGE] = stripslashes($arrAlliance[IMAGE]);
        $arrAlliance[IMAGE] = htmlspecialchars($arrAlliance[IMAGE]);
        $arrAlliance[IMAGE] = escapeshellcmd($arrAlliance[IMAGE]);
        echo "<img src =\"" . $arrAlliance[IMAGE] . "\" width =\"" . $arrAlliance[IMAGEWIDTH] . "\" height =\"" . $arrAlliance[IMAGEHEIGHT] . "\" alt=\"\" /><br />";
    }
    //==========================================================================
    // War status display
    //==========================================================================
    $arrSrcWar = $objTrgAlli->get_wars();
    if ($arrSrcWar[TARGET] != 0) {
        $targetLink = " (<a href=\"main.php?cat=game&amp;page=alliance&amp;aid=" . $arrSrcWar[TARGET] . "\">#" . $arrSrcWar[TARGET] . "</a>)";
        $objWarTrg = new clsAlliance($arrSrcWar[TARGET]);
        $strAlliName = stripslashes($objWarTrg->get_rankings_alliance('alli_name'));
        echo '<br /><strong class="negative">At war with ' . $strAlliName . $targetLink . '</strong>';
    }
    //==========================================================================
    if ($iAid < 10) {
        $iSpan = 3;
        ?>
        <span style="font-size: 0.8em"><a href="main.php?cat=game&amp;page=message&amp;alliance=<?php 
        echo $iAid;
        ?>
">Submit a report here</a>.</span>
        <br />
<?php 
    } else {
        $iSpan = 6;
        if ($iAid == $objSrcUser->get_stat(ALLIANCE)) {
            $iSpan = 7;
        }
        // bootcamp indication
        if ($arrAlliance[BOOTCAMP] == 'yes') {
            ?>
        <br /><strong class='positive'>[ Boot Camp ]</strong><br />

<?php 
        }
        // M: Graveyard indication
        if ($iAid == 10) {
            echo '<h2>The Graveyard in #10 - Beware of the DEAD.</h2>';
        }
        ?>

<?php 
    }
    ?>
    </div>
    <br />
    <table cellpadding="0" cellspacing="0" class="big">
        <tr class="header">
            <th colspan="<?php 
    echo $iSpan;
    ?>
">
<?php 
    $strAllianceName = stripslashes($arrRankingsAlliance[ALLI_NAME]);
    echo "{$strAllianceName} (#{$iAid})";
    if (trim($arrRankingsAlliance[ALLI_DESC]) != '') {
        $allianceDesc = stripslashes(trim($arrRankingsAlliance[ALLI_DESC]));
        ?>
                <br /><span style="font-size: 0.8em;"><?php 
        echo $allianceDesc;
        ?>
</span>
<?php 
    }
    if ($iAid < 10) {
        ?>
            </th>
        </tr>
        <tr class="subheader">
            <th width="17"></th>
            <td align="left" class="left" width="34%">Staff Tribe</td>
            <td align="left" class="left">Online < 48 hours ago</td>
        </tr>
<?php 
        // Martel: Sort 1-10 on staff ranks and name instead of acres
        $res = mysql_query("SELECT rankings_personal.id, alli_id, tribe_name, hours, rankings_personal.race, land, nw, rankings_personal.fame, player_type, stats.level FROM rankings_personal, stats WHERE alli_id = {$iAid} AND stats.id = rankings_personal.id ORDER BY level DESC, tribe_name ASC");
    } else {
        // Output alliance Rankings
        include_once 'inc/functions/alli_ranking.php';
        if ($iAid != 10) {
            $arrRanking = get_rank_data($iAid);
            echo "<br />Land: " . $arrRanking[LAND] . " &nbsp;&nbsp; Strength: " . $arrRanking[STRENGTH] . " &nbsp;&nbsp; Fame: " . $arrRanking[FAME];
        }
        ?>
            </th>
        </tr>
        <tr class="subheader">
            <th width="17"></th>
            <th>Tribe Name</th>
<?php 
        if ($iAid == $objSrcUser->get_stat(ALLIANCE)) {
            echo '
            <td><em>Ruler Age</em></td>
            ';
        }
        ?>
            <td>Race</td>
            <td>Size</td>
            <td>Strength</td>
            <td>Fame</td>
        </tr>
<?php 
        // Sort tribes by acreage, strength, fame
        $res = mysql_query("SELECT id FROM rankings_personal WHERE alli_id = {$iAid} ORDER BY land DESC, nw DESC, fame DESC");
    }
    $inactivitycheck = $objSrcUser->get_rankings_personals();
    $iCount = 0;
    $inactiveCounter = 0;
    $objTmpUser = new clsUser(0);
    while ($line = mysql_fetch_assoc($res)) {
        // Clear the temporary object to assign a new user
        $iUserid = $line[ID];
        $objTmpUser->set_userid($iUserid);
        $arrTmpRanking = $objTmpUser->get_rankings_personals();
        $arrTmpRanking[TRIBE_NAME] = stripslashes($arrTmpRanking[TRIBE_NAME]);
        $strFame = (string) number_format($arrTmpRanking[FAME]);
        if ($arrTmpRanking[FAME] < 5000) {
            $strFame = '<span class="negative">' . $strFame . '</span>';
        } elseif ($arrTmpRanking[FAME] > 5000) {
            $strFame = '<span class="positive">' . $strFame . '</span>';
        }
        ?>
        <tr class="data">
            <th>
<?php 
        $online = $objTmpUser->get_onlines();
        $old = date(TIMESTAMP_FORMAT, strtotime('-5 minutes'));
        // Martel: New inactivity check.
        // Works with both month changes and leap years ;)
        $inactive = date(TIMESTAMP_FORMAT, strtotime('-2 days'));
        if ($online['time'] < $inactive && $inactivitycheck[PLAYER_TYPE] == "elder" && $inactivitycheck[ALLI_ID] == $iAid) {
            ?>
                <img src="<?php 
            echo HOST_PICS;
            ?>
tribe_inactive.gif" alt="*" height="13" width="13" />
<?php 
        } elseif ($online['time'] < $old) {
            ?>
                <img src="<?php 
            echo HOST_PICS;
            ?>
tribe_offline.gif" alt="" height="13" width="13" />
<?php 
        } else {
            $inactiveCounter++;
            ?>
                <img src="<?php 
            echo HOST_PICS;
            ?>
tribe_online.gif" alt="»" height="13" width="13" />
<?php 
        }
        ?>
            </th>
            <th>
<?php 
        // Begin output of <tr> for each tribe
        if ($iAid >= 10) {
            $strClass = $arrTmpRanking[PLAYER_TYPE] . "";
            if ($objTmpUser->isPaused() || $arrTmpRanking[HOURS] < PROTECTION_HOURS) {
                $strClass = "protected";
            }
            echo '<a href="main.php?cat=game&amp;page=external_affairs&amp;tribe=' . $arrTmpRanking[ID] . "&amp;aid=" . $arrTmpRanking[ALLI_ID] . '" class="' . $strClass . '">' . $arrTmpRanking[TRIBE_NAME] . '</a></th>';
            if ($iAid == $objSrcUser->get_stat(ALLIANCE)) {
                echo "<td><em>" . $objTmpUser->get_ruler_age() . "</em></td>";
            }
            echo "<td>" . $arrTmpRanking[RACE] . "</td>" . "<td>" . number_format($arrTmpRanking[LAND]) . "</td>" . "<td>" . number_format($arrTmpRanking[NW]) . "</td>" . "<td>" . $strFame . "</td>" . "</tr>";
        } else {
            $strClass = "staff";
            if ($objTmpUser->get_stat(LEVEL) > 5) {
                $strClass = "admin";
            } elseif ($objTmpUser->get_stat(LEVEL) == 5) {
                $strClass = "head";
            }
            echo '<a href="main.php?cat=game&amp;page=message&amp;tribe=' . $arrTmpRanking[ID] . "&amp;alliance=" . $arrTmpRanking[ALLI_ID] . '" class="' . $strClass . '">' . $arrTmpRanking[TRIBE_NAME] . '</a></th>';
            if ($online['time'] < $inactive) {
                echo '<td class="left"><em>No</em></td>';
            } else {
                echo '<td class="left"><em class="positive">Yes</em></td>';
            }
            echo '</tr>';
        }
        $iCount++;
    }
    ?>
    </table>

    <div class="center" style="font-size: 0.8em">
        There are <?php 
    echo $iCount;
    ?>
 tribes in this alliance.
    </div>

    <br />

    <table cellpadding="0" cellspacing="0" class="small">
        <tr class="header">
            <th colspan="2">Legend</th>
        </tr>
        <tr class="subheader">
            <th>Mark</th>
            <td>Meaning</td>
        </tr>
<?php 
    if ($iAid >= 10) {
        ?>
        <tr class="data">
            <th class="elder">Gold:</th>
            <td>Elder</td>
        </tr>
        <tr class="data">
            <th class="coelder">Copper:</th>
            <td>Co-elder</td>
        </tr>
        <tr class="data">
            <th class="protected">Light Green:</th>
            <td>In Protection</td>
        </tr>

<?php 
    } else {
        ?>
        <tr class="data">
            <th class="admin">White:</th>
            <td>Orkfian God</td>
        </tr>
        <tr class="data">
            <th class="head">Pink:</th>
            <td>Orkfian Lord</td>
        </tr>
        <tr class="data">
            <th class="staff">Blue:</th>
            <td>ORKFiA Staff</td>
        </tr>
<?php 
    }
    ?>
        <tr class="data">
            <th><img src="<?php 
    echo HOST_PICS;
    ?>
tribe_online.gif" alt="»" height="13" width="13" /></th>
            <td>Online</td>
        </tr>
<?php 
    if ($inactivitycheck[PLAYER_TYPE] == "elder" && $inactivitycheck['alli_id'] == $iAid && $inactiveCounter > 0) {
        ?>
        <tr class="data">
            <th><img src="<?php 
        echo HOST_PICS;
        ?>
tribe_inactive.gif" alt="*" height="13" width="13" /></th>
            <td>Inactive</td>
        </tr>
<?php 
    }
    ?>
    </table>

<?php 
}
Exemplo n.º 2
0
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();
}
Exemplo n.º 3
0
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');
}