Beispiel #1
0
function call_tourers_text()
{
    require_once 'inc/functions/resort_tools.php';
    check_access($_GET['tool']);
    require_once 'inc/functions/mail.php';
    // first the "actually do something if asked" thing
    if (isset($_POST['id']) && isset($_POST['submit']) && isset($_POST['sure']) && $_POST['sure'] == 'yes') {
        //get the old values
        $objTrgUser = new clsUser($_POST['id']);
        $arrBuilds = $objTrgUser->get_builds();
        $arrArmys = $objTrgUser->get_armys();
        $intFame = $objTrgUser->get_stat(FAME);
        //make the new values
        $keysBuilds = array_keys($arrBuilds);
        $valsBuilds = array_fill(0, count($arrBuilds), 0);
        $arrBuilds = array_combine($keysBuilds, $valsBuilds);
        $arrBuilds[ID] = $_POST['id'];
        //DO NOT FORGET
        $arrBuilds[LAND] = 1;
        //prevent div0s
        $keysArmys = array_keys($arrArmys);
        $valsArmys = array_fill(0, count($arrArmys), 0);
        $arrArmys = array_combine($keysArmys, $valsArmys);
        $arrArmys[ID] = $_POST['id'];
        //DO NOT FORGET
        $intFame = 0;
        $arrUserInfo = array(NEXT_ATTACK => 1, PAUSE_ACCOUNT => 48);
        //set the new values
        $objTrgUser->set_builds($arrBuilds);
        $objTrgUser->set_armys($arrArmys);
        $objTrgUser->set_stat(FAME, $intFame);
        //update the tribe too
        require_once 'inc/functions/update.php';
        require_once 'inc/functions/update_ranking.php';
        doUpdateRankings($objTrgUser, true);
        check_to_update($objTrgUser->get_userid());
        //do this afterwards, otherwise the updaterankings doesn't work too well
        $objTrgUser->set_user_infos($arrUserInfo);
        //tell them about it
        send_mail($GLOBALS['objSrcUser']->get_userid(), $_POST['id'], "You have been tourified", "This is an automated message indicating that I have used the 'Tourify' tool to turn your tribe into a tourer tribe.");
        echo "User {$_POST['id']} has been tourified. ORKFiA mail has been sent to let him know.<br /><br /><br />";
    }
    echo "'Tourifying' a tribe means setting it to 1 land, 0 fame, removing all military and suspending it. " . "Please make sure you're tourifying the right tribe, because the only way to undo this is resetting." . "<br /><br /><form method=\"post\" action=\"{$_SERVER['REQUEST_URI']}\">" . "<label for=\"id\">User id of tribe to tourify </label>" . "<input type=\"text\" id=\"id\" name=\"id\" size=\"5\" maxlength=\"5\" /><br />" . "<input type=\"checkbox\" id=\"sure\" name=\"sure\" value=\"yes\" />" . "<label for=\"sure\"> I'm sure I want to tourify this tribe</label><br />" . "<input type=\"submit\" name=\"submit\" value=\"tourify\" />" . "</form>";
}
Beispiel #2
0
function unset_external_votes($iAlliance)
{
    include_once('inc/classes/clsAlliance.php');
    $objAlliance = new clsAlliance($iAlliance);
    $arrUserids = $objAlliance->get_userids();

    // Unset votes for tribes that are no longer in the alliance
    foreach ($arrUserids as $iUserid)
    {
        $objTempUser = new clsUser($iUserid);
        if (! in_array($objTempUser->get_stat(VOTE), $arrUserids))
            $objTempUser->set_stat(VOTE, 0);
    }
}
Beispiel #3
0
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);
}