예제 #1
0
function tribe_recalcLeader($tag, $oldLeaderID, $db)
{
    global $governmentList;
    // find the new leader
    if (!($government = government_getGovernmentForTribe($tag, $db))) {
        return -1;
    }
    $det = $governmentList[$government[governmentID]][leaderDeterminationID];
    switch ($det) {
        case 1:
            $newLeader = tribe_recalcLeader1($tag, $db);
            break;
        case 2:
            $newLeader = tribe_recalcLeader2($tag, $db);
            break;
    }
    if ($newLeader < 0) {
        return $newLeader;
    }
    // change the leader
    if ($newLeader == $oldLeaderID) {
        return 0;
    }
    if ($oldLeaderID && !tribe_unmakeLeader($oldLeaderID, $tag, $db)) {
        return -1;
    }
    if ($newLeader && !tribe_makeLeader($newLeader, $tag, $db)) {
        return -1;
    }
    if (!$newLeader) {
        tribe_sendTribeMessage($tag, TRIBE_MESSAGE_LEADER, "Anf&uuml;hrerwechsel", "Ihr Clan hat momentan keinen Anf&uuml;hrer " . "mehr");
    } else {
        $player = getPlayerFromID($newLeader);
        $newLeaderName = $player ? $player[name] : $newLeader;
        tribe_sendTribeMessage($tag, TRIBE_MESSAGE_LEADER, "Anf&uuml;hrerwechsel", "Der Spieler {$newLeaderName} ist soeben neuer " . "Anf&uuml;hrer des Clans geworden.");
    }
    return $newLeader;
}
예제 #2
0
function tribe_recalcLeader($tag, $oldLeaderID, $oldJuniorLeaderID, $db)
{
    global $governmentList;
    // find the new leader
    if (!($government = government_getGovernmentForTribe($tag, $db))) {
        return -1;
    }
    $det = $governmentList[$government['governmentID']]['leaderDeterminationID'];
    switch ($det) {
        case 1:
            $newLeadership = tribe_recalcLeader1($tag, $db);
            break;
        case 2:
            $newLeadership = tribe_recalcLeader2($tag, $db);
            if ($newLeadership[0] == $oldLeaderID) {
                $newLeadership[1] = $oldJuniorLeaderID;
            }
            break;
    }
    if (!is_array($newLeadership)) {
        return $newLeadership;
    }
    //wihthout a Leader also  no JuniorLeader
    if ($newLeadership[0] == 0) {
        $newLeadership[1] = 0;
    }
    // change the leader
    return tribe_ChangeLeader($tag, $newLeadership, $oldLeaderID, $oldJuniorLeaderID, $db);
}
예제 #3
0
파일: tribes.inc.php 프로젝트: norter/Game
function tribe_recalcLeader($tag, $oldLeaderID)
{
    // find the new leader
    if (!($government = government_getGovernmentForTribe($tag))) {
        return -1;
    }
    $det = $GLOBALS['governmentList'][$government['governmentID']]['leaderDeterminationID'];
    switch ($det) {
        case 1:
            $newLeadership = tribe_recalcLeader1($tag);
            break;
        case 2:
            $newLeadership = tribe_recalcLeader2($tag);
            break;
    }
    if (!is_array($newLeadership)) {
        return $newLeadership;
    }
    // change the leader
    return tribe_ChangeLeader($tag, $newLeadership, $oldLeaderID);
}