Esempio n. 1
0
 function getList()
 {
     global $db_game, $params;
     $template = tmpl_open("modules/Module_Artefacts/templates/list.ihtml");
     $artefacts = artefact_lib_get_artefacts();
     //tmpl_set($template, 'ARTEFACT', $artefacts);
     foreach ($artefacts as $artefact) {
         // in cave
         if ($artefact['caveID'] && !$artefact['event_movementID']) {
             tmpl_iterate($template, '/ARTEFACTINCAVE');
             tmpl_set($template, '/ARTEFACTINCAVE', $artefact);
         } else {
             if ($artefact['event_movementID']) {
                 tmpl_iterate($template, '/ARTEFACTMOVING');
                 tmpl_set($template, '/ARTEFACTMOVING', $artefact);
             } else {
                 tmpl_iterate($template, '/ARTEFACTLIMBO');
                 tmpl_set($template, '/ARTEFACTLIMBO', $artefact);
             }
         }
     }
     // show messages
     if (sizeof($this->msgs)) {
         foreach ($this->msgs as $msg) {
             tmpl_iterate($template, "/MESSAGE");
             tmpl_set($template, "/MESSAGE/message", $msg);
         }
     }
     return tmpl_parse($template);
 }
Esempio n. 2
0
function tribePlayerList_getContent($caveID, $tribe)
{
    global $db, $no_resource_flag, $config, $params;
    $no_resource_flag = 1;
    $template = tmpl_open($params->SESSION->player->getTemplatePath() . 'tribePlayerList.ihtml');
    tmpl_set($template, 'tribe', $tribe);
    $query = 'SELECT r.rank, r.playerID AS link, r.name, r.average AS points, r.caves, r.religion, r.fame, p.awards ' . ' FROM Ranking r' . ' LEFT JOIN Player p' . ' ON p.playerID = r.playerID' . ' WHERE p.tribe LIKE "' . $tribe . '"' . ' ORDER BY r.rank ASC';
    if (!($dbresult = $db->query($query))) {
        page_dberror();
    }
    while ($row = $dbresult->nextRow(MYSQL_ASSOC)) {
        $i++;
        tmpl_iterate($template, 'ROWS');
        $row['link'] = "main.php?modus=" . PLAYER_DETAIL . "&detailID=" . $row['link'] . "&caveID=" . $caveID;
        if (!empty($row['awards'])) {
            $tmp = explode('|', $row['awards']);
            $awards = array();
            foreach ($tmp as $tag) {
                $awards[] = array('tag' => $tag, 'award_modus' => AWARD_DETAIL);
            }
            $row['award'] = $awards;
        }
        if ($i % 2) {
            tmpl_set($template, 'ROWS/ROW_ALTERNATE', $row);
        } else {
            tmpl_set($template, 'ROWS/ROW', $row);
        }
    }
    return tmpl_parse($template);
}
Esempio n. 3
0
function questionnaire_getQuestionnaire($caveID, &$meineHoehlen)
{
    global $config, $params, $no_resource_flag;
    $no_resource_flag = 1;
    $msg = "";
    if (isset($params->POST->question)) {
        $msg = questionnaire_giveAnswers();
    }
    $template = tmpl_open('./templates/' . $config->template_paths[$params->SESSION->user['template']] . '/questionnaire.ihtml');
    // show message
    if ($msg != "") {
        tmpl_set($template, 'MESSAGE/message', $msg);
    }
    // show my credits
    if ($account = questionnaire_getCredits($params->SESSION->user['questionCredits'])) {
        tmpl_set($template, 'ACCOUNT', $account);
    }
    // show the questions
    $questions = questionnaire_getQuestions();
    if (sizeof($questions)) {
        tmpl_set($template, 'QUESTIONS/QUESTION', $questions);
        // set params
        tmpl_set($template, 'QUESTIONS/PARAMS', array(array('name' => "modus", 'value' => QUESTIONNAIRE)));
    } else {
        tmpl_iterate($template, 'MESSAGE');
        tmpl_set($template, 'MESSAGE/message', "Derzeit liegen keine weiteren Fragen vor.");
    }
    // show the link to the present page
    tmpl_set($template, 'QUESTIONNAIRE_PRESENTS', QUESTIONNAIRE_PRESENTS);
    return tmpl_parse($template);
}
Esempio n. 4
0
/** This function returns basic award details
 *
 *  @param tag       the current award's tag
 */
function award_getAwardDetail($tag)
{
    // get configuration settings
    global $config;
    // get parameters from the page request
    global $params;
    // get db link
    global $db;
    $msgs = array();
    $sql = "SELECT * FROM Awards WHERE tag = '{$tag}'";
    $result = $db->query($sql);
    if (!$result || $result->isEmpty()) {
        $msgs[] = sprintf(_('Dieser Orden existiert nicht: "%s".'), $tag);
        $row = array();
    } else {
        $row = $result->nextRow(MYSQL_ASSOC);
    }
    $template = tmpl_open($params->SESSION->player->getTemplatePath() . 'award_detail.ihtml');
    if (sizeof($msgs)) {
        foreach ($msgs as $msg) {
            tmpl_iterate($template, "MESSAGE");
            tmpl_set($template, "MESSAGE/message", $msg);
        }
    }
    if (sizeof($row)) {
        tmpl_set($template, 'AWARD', $row);
    }
    return tmpl_parse($template);
}
function improvement_deleteConfirm($caveID, $buildingID)
{
    global $config, $db, $no_resource_flag, $buildingTypeList, $params;
    $no_resource_flag = 1;
    // Show confirmation request
    $template = tmpl_open($params->SESSION->player->getTemplatePath() . 'dialog.ihtml');
    tmpl_set($template, 'message', sprintf(_('Möchten Sie 1 %s abreissen?'), $buildingTypeList[$buildingID]->name));
    tmpl_set($template, 'BUTTON/formname', 'confirm');
    tmpl_set($template, 'BUTTON/text', _('Abreißen'));
    tmpl_set($template, 'BUTTON/modus_name', 'modus');
    tmpl_set($template, 'BUTTON/modus_value', IMPROVEMENT_DETAIL);
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_name', 'breakDownConfirm');
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_value', 1);
    tmpl_iterate($template, 'BUTTON/ARGUMENT');
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_name', 'buildingID');
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_value', $buildingID);
    tmpl_iterate($template, 'BUTTON/ARGUMENT');
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_name', 'caveID');
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_value', $caveID);
    tmpl_iterate($template, 'BUTTON');
    tmpl_set($template, 'BUTTON/formname', 'cancel');
    tmpl_set($template, 'BUTTON/text', _('Abbrechen'));
    tmpl_set($template, 'BUTTON/modus_name', 'modus');
    tmpl_set($template, 'BUTTON/modus_value', IMPROVEMENT_DETAIL);
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_name', 'caveID');
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_value', $caveID);
    return tmpl_parse($template);
}
Esempio n. 6
0
function show_adressbook($playerID, $deleteID)
{
    global $buildingTypeList, $defenseSystemTypeList, $resourceTypeList, $unitTypeList, $config, $params, $db;
    // messages
    $messageText = array(0 => "Spieler wurde eingetragen.", 1 => "Es gibt keinen Spieler mit diesem Namen.", 2 => "Dieser Spieler ist schon in der Liste.", 3 => "Spieler aus der Liste gelöscht.", 4 => "Spieler konnte nicht aus der Liste entfernt werden.", 5 => "Verarsch mich nicht!", 6 => "Datenbank Fehler.");
    // enter something new
    if (isset($params->POST->empfaenger)) {
        $messageID = book_newEntry($playerID, $params->POST->empfaenger);
    }
    if (isset($params->POST->newEntryName)) {
        $messageID = book_newEntry($playerID, $params->POST->newEntryName);
    } else {
        if ($deleteID > 0) {
            $messageID = book_deleteEntry($playerID, $deleteID);
        }
    }
    $template = @tmpl_open("./templates/" . $config->template_paths[$params->SESSION->user['template']] . "/message_book.ihtml");
    // Show a special message
    if (isset($messageID)) {
        tmpl_set($template, '/MESSAGE/message', $messageText[$messageID]);
    }
    // Getting entries
    // call our function
    $playerlist = book_getEntries($playerID);
    // Show the player table
    for ($i = 0; $i < sizeof($playerlist[id]); $i++) {
        $playername = $playerlist[name][$i];
        // the current playername
        $tribe = $playerlist[tribe][$i];
        // the current tribe
        $tribelink = "<a href=\"main.php?modus=" . TRIBE_DETAIL . "&tribe=" . urlencode(unhtmlentities($tribe)) . "\" target=\"_blank\">";
        if ($tribe != "") {
            $tribe = "(" . $tribe . ")";
        }
        $playerID = $playerlist[id][$i];
        $link = "<a href=\"main.php?modus=" . NEW_MESSAGE . "&amp;playerID=" . $playername . "\">";
        tmpl_iterate($template, '/PLAYER');
        tmpl_set($template, "PLAYER/alternate", $count++ % 2 ? "alternate" : "");
        if ($playername != "Spieler nicht auffindbar") {
            tmpl_set($template, "PLAYER/LINK/link", $link);
        }
        tmpl_set($template, 'PLAYER', array('name' => $playername, 'tribe' => $tribe, 'tribelink' => $tribelink, 'playerID' => $playerID, 'modus' => NEW_MESSAGE, 'modus_delete' => MESSAGE_BOOK_DELETE));
    }
    if (sizeof($playerlist) < 1) {
        tmpl_set($template, "NOPLAYER/dummy", "");
    }
    return tmpl_parse($template);
}
Esempio n. 7
0
function tribeHistory_getContent($tag)
{
    global $no_resource_flag, $config, $params, $db;
    $no_resource_flag = 1;
    $template = tmpl_open($params->SESSION->player->getTemplatePath() . 'tribeHistory.ihtml');
    $history = relation_getTribeHistory($tag, $db);
    foreach ($history as $key => $values) {
        tmpl_iterate($template, 'ROWS');
        if ($i++ % 2) {
            tmpl_set($template, 'ROWS/ROW_ALTERNATE', $values);
        } else {
            tmpl_set($template, 'ROWS/ROW', $values);
        }
    }
    return tmpl_parse($template);
}
Esempio n. 8
0
 function _list($feedback = NULL)
 {
     global $db_game, $params;
     $this->_getDetails('all');
     if (empty($this->item)) {
         $feedback = 'Keine Einträge vorhanden.';
     }
     $template = tmpl_open("modules/Module_DoYouKnow/templates/list.ihtml");
     foreach ($this->item as $item) {
         tmpl_iterate($template, '/DOYOUKNOW');
         tmpl_set($template, '/DOYOUKNOW', $item);
     }
     if ($feedback) {
         tmpl_set($template, '/MESSAGE/message', $feedback);
     }
     return tmpl_parse($template);
 }
Esempio n. 9
0
function doYouKnow_getContent()
{
    global $db, $config;
    $template = tmpl_open($_SESSION['player']->getTemplatePath() . 'doYouKnow.ihtml');
    if (request_var('show', "") == "all") {
        $sql = $db->prepare("SELECT * FROM " . DO_YOU_KNOW_TABLE);
    } else {
        $sql = $db->prepare("SELECT * FROM " . DO_YOU_KNOW_TABLE . " ORDER BY RAND( ) LIMIT 0 , 1");
    }
    $sql->execute();
    while ($row = $sql->fetch(PDO::FETCH_ASSOC)) {
        tmpl_iterate($template, "ELEM");
        tmpl_set($template, array("ELEM/header" => $row['titel'], "ELEM/text" => str_replace("\n", "<br />", $row['content'])));
    }
    if (request_var('show', "") != "all") {
        tmpl_iterate($template, "LINKLIST");
    }
    return tmpl_parse($template);
}
Esempio n. 10
0
function ticker_getMessages($playerID)
{
    // hm need to check this
    global $buildingTypeList, $defenseSystemTypeList, $resourceTypeList, $scienceTypeList, $unitTypeList, $wonderTypeList, $effectTypeList, $terrainList, $config, $params, $db;
    // open the template
    $template = @tmpl_open('./templates/' . $config->template_paths[$params->SESSION->user['template']] . '/ticker_archive.ihtml');
    // Getting the messages
    $messages = getTickerMessages($db);
    // Templating
    $data = array();
    if (!sizeof($messages)) {
        $data['NOMESSAGES'] = array('dummy' => "");
    } else {
        $data['MESSAGES'] = $messages;
        tmpl_iterate($template, 'MESSAGES');
    }
    tmpl_set($template, "/", $data);
    return tmpl_parse($template);
}
Esempio n. 11
0
function doYouKnow_getContent()
{
    global $config;
    global $params;
    global $db;
    $template = tmpl_open($params->SESSION->player->getTemplatePath() . 'doYouKnow.ihtml');
    if ($params->POST->show == "all") {
        $query = "SELECT * FROM `doYouKnow`";
    } else {
        $query = "SELECT * FROM `doYouKnow` ORDER BY RAND( ) LIMIT 0 , 1";
    }
    $result = $db->query($query);
    while ($row = $result->nextRow(MYSQL_ASSOC)) {
        tmpl_iterate($template, "ELEM");
        tmpl_set($template, array("ELEM/header" => $row['titel'], "ELEM/text" => $row['content']));
    }
    if ($params->POST->show != "all") {
        tmpl_iterate($template, "LINKLIST");
    }
    return tmpl_parse($template);
}
Esempio n. 12
0
function profile_deleteAccount($playerID, $data)
{
    global $config, $db, $no_resource_flag, $params;
    $no_resource_flag = 1;
    // try to connect to login db
    $db_login = new DB($config->DB_LOGIN_HOST, $config->DB_LOGIN_USER, $config->DB_LOGIN_PWD, $config->DB_LOGIN_NAME);
    if (!$db_login) {
        page_dberror();
    }
    // proccess form data
    if (isset($data->confirm)) {
        // the only necessary field
        $success = profile_processDeleteAccount($playerID, $db_login);
        $template = @tmpl_open('./templates/' . $config->template_paths[$params->SESSION->user['template']] . '/deleteResponse.ihtml');
        if ($success) {
            session_destroy();
            tmpl_set($template, 'message', "Ihr Account wurde zur L&ouml;schung vorgemerkt. " . "Sie sind jetzt ausgeloggt und k&ouml;nnen das Fenster " . "Schlie&szlig;en.");
            tmpl_set($template, 'link', "http://tntchris.dyndns.org/ugaagga/");
        } else {
            tmpl_set($template, 'message', "Das l&ouml;schen Ihres Accounts ist fehlgeschlagen." . "Bitte wenden Sie sich an das Support Team.");
            tmpl_set($template, 'link', "ugastart.php");
        }
        return tmpl_parse($template);
    }
    // Show confirmation request
    $template = @tmpl_open("./templates/" . $config->template_paths[$params->SESSION->user['template']] . "/dialog.ihtml");
    tmpl_set($template, 'message', "M&ouml;chten Sie Ihren Account unwiderruflich l&ouml;schen? " . "Ihre gesamten Spieldaten gehen verloren, ein neuerliches " . "einloggen als dieser Spieler ist nicht m&ouml;glich. " . "<p> Allerdings steht Ihnen die Emailadresse anschlie&szlig;end " . "f&uuml;r eine Neuanmeldung zur Verf&uuml;gung." . "<p> Beachten Sie, da&szlig; Ihre Siedlung noch f&uuml;r einige " . "Zeit nach der L&ouml;schung f&uuml;r ander Spieler sichtbar ist, " . "da die L&ouml;schungen aus der Datenbank nur einmal am Tag " . "vorgenommen werden.");
    tmpl_set($template, 'BUTTON/formname', 'confirm');
    tmpl_set($template, 'BUTTON/text', 'Account l&ouml;schen');
    tmpl_set($template, 'BUTTON/modus_name', 'modus');
    tmpl_set($template, 'BUTTON/modus_value', DELETE_ACCOUNT);
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_name', 'confirm');
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_value', 1);
    tmpl_iterate($template, 'BUTTON');
    tmpl_set($template, 'BUTTON/formname', 'cancel');
    tmpl_set($template, 'BUTTON/text', 'Abbrechen');
    tmpl_set($template, 'BUTTON/modus_name', 'modus');
    tmpl_set($template, 'BUTTON/modus_value', USER_PROFILE);
    return tmpl_parse($template);
}
Esempio n. 13
0
function profile_deleteAccount($playerID, $data)
{
    global $config, $db, $no_resource_flag, $params;
    $no_resource_flag = 1;
    // try to connect to login db
    $db_login = new DB($config->DB_LOGIN_HOST, $config->DB_LOGIN_USER, $config->DB_LOGIN_PWD, $config->DB_LOGIN_NAME);
    if (!$db_login) {
        page_dberror();
    }
    // proccess form data
    if (isset($data->confirm)) {
        // the only necessary field
        $success = profile_processDeleteAccount($playerID, $db_login);
        $template = tmpl_open($params->SESSION->player->getTemplatePath() . 'deleteResponse.ihtml');
        if ($success) {
            session_destroy();
            tmpl_set($template, 'message', _('Ihr Account wurde zur Löschung vorgemerkt. Sie sind jetzt ausgeloggt und können das Fenster schließen.'));
            tmpl_set($template, 'link', LOGIN_PATH);
        } else {
            tmpl_set($template, 'message', _('Das löschen Ihres Accounts ist fehlgeschlagen. Bitte wenden Sie sich an das Support Team.'));
            tmpl_set($template, 'link', "ugastart.php");
        }
        return tmpl_parse($template);
    }
    // Show confirmation request
    $template = tmpl_open($params->SESSION->player->getTemplatePath() . 'dialog.ihtml');
    tmpl_set($template, 'message', _('Möchten Sie Ihren Account unwiderruflich löschen? Ihre gesamten Spieldaten gehen verloren, ein neuerliches einloggen als dieser Spieler ist nicht möglich. <br /> Allerdings steht Ihnen die Emailadresse anschließend für eine Neuanmeldung zur Verfügung. <br /> Beachten Sie, daß Ihre Höhle noch für einige Zeit nach der Löschung für andere Spieler sichtbar ist, da die Löschungen aus der Datenbank nur einmal am Tag vorgenommen werden.'));
    tmpl_set($template, 'BUTTON/formname', 'confirm');
    tmpl_set($template, 'BUTTON/text', _('Account löschen'));
    tmpl_set($template, 'BUTTON/modus_name', 'modus');
    tmpl_set($template, 'BUTTON/modus_value', DELETE_ACCOUNT);
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_name', 'confirm');
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_value', 1);
    tmpl_iterate($template, 'BUTTON');
    tmpl_set($template, 'BUTTON/formname', 'cancel');
    tmpl_set($template, 'BUTTON/text', _('Abbrechen'));
    tmpl_set($template, 'BUTTON/modus_name', 'modus');
    tmpl_set($template, 'BUTTON/modus_value', USER_PROFILE);
    return tmpl_parse($template);
}
Esempio n. 14
0
 function getContent($modus)
 {
     global $db_login, $params, $cfg;
     $content = "";
     switch ($modus) {
         case 'news_create':
             $template = tmpl_open("modules/Module_News/templates/create.ihtml");
             // Form Submitted
             if (isset($params->creator)) {
                 $sql = "INSERT INTO `Portal_news` (`newsID`, `category`, `archive`, " . "`author`, `date`, `title`, `content`) " . "VALUES (0, '" . $params->newsCategory . "', '" . "0" . "', '" . $params->newsAuthor . "', '" . $params->newsDate . "', '" . $params->newsTitle . "', '" . nl2br(lib_bb_code($params->newsContent)) . "')";
                 if (!$db_login->query($sql)) {
                     die("Datenbankfehler beim Eintragen der News!");
                 }
                 tmpl_set($template, "MESSAGE/message", "News eingetragen!");
             } else {
                 foreach ($cfg['news']['categories'] as $category) {
                     tmpl_iterate($template, '/FORM/CATEGORY');
                     tmpl_set($template, '/FORM/CATEGORY', array('text' => $category, 'value' => $category));
                 }
                 tmpl_set($template, '/FORM/date', date("d-m-Y"));
             }
             $content = tmpl_parse($template);
             break;
         case 'news_show':
             $template = tmpl_open("modules/Module_News/templates/show.ihtml");
             $sql = "SELECT * FROM Portal_news ORDER BY newsID DESC";
             $result = $db_login->query($sql);
             if (!$result || $result->isEmpty()) {
                 return "Error while retrieving news!";
             }
             $news = array();
             while ($row = $result->nextRow()) {
                 $news[] = $row;
             }
             tmpl_set($template, 'NEWS', $news);
             $content = tmpl_parse($template);
             break;
     }
     return $content;
 }
Esempio n. 15
0
function cave_giveUpConfirm($caveID)
{
    global $config, $db, $params;
    // Show confirmation request
    $template = @tmpl_open("./templates/" . $config->template_paths[$params->SESSION->user['template']] . "/dialog.ihtml");
    tmpl_set($template, 'message', "M&ouml;chten Sie die Siedlung {$caveID} wirklich aufgeben? Sie " . "verlieren die Kontrolle &uuml;ber alle Rohstoffe und alle " . "Einheiten, die sich hier befinden!");
    tmpl_set($template, 'BUTTON/formname', 'confirm');
    tmpl_set($template, 'BUTTON/text', 'Aufgeben');
    tmpl_set($template, 'BUTTON/modus_name', 'modus');
    tmpl_set($template, 'BUTTON/modus_value', CAVE_DETAIL);
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_name', 'caveGiveUpConfirm');
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_value', 1);
    tmpl_iterate($template, 'BUTTON/ARGUMENT');
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_name', 'giveUpCaveID');
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_value', $caveID);
    tmpl_iterate($template, 'BUTTON');
    tmpl_set($template, 'BUTTON/formname', 'cancel');
    tmpl_set($template, 'BUTTON/text', 'Abbrechen');
    tmpl_set($template, 'BUTTON/modus_name', 'modus');
    tmpl_set($template, 'BUTTON/modus_value', CAVE_DETAIL);
    return tmpl_parse($template);
}
Esempio n. 16
0
function weather_getReport()
{
    global $weatherTypeList;
    init_Weathers();
    $regions = getRegions();
    $template = tmpl_open($_SESSION['player']->getTemplatePath() . 'weather_report.ihtml');
    $tmp = true;
    foreach ($regions as $region) {
        $tmp = $tmp && $region[weather] == -1;
    }
    if ($tmp) {
        // no weather so far
        tmpl_set($template, 'CONTENT/NOWEATHER', array('iterate' => ''));
        return tmpl_parse($template);
    }
    $alt = 0;
    foreach ($regions as $region) {
        $alt = ($alt + 1) % 2;
        // alternates between 0 and 1. Couldn't use regionID, they don't need to be adjacent
        tmpl_iterate($template, 'CONTENT/WEATHER/ROW');
        tmpl_set($template, 'CONTENT/WEATHER/ROW', array('region' => $region['name'], 'weather' => $weatherTypeList[$region['weather']]->name, 'alternate' => $alt));
    }
    return tmpl_parse($template);
}
Esempio n. 17
0
function tribeDelete_getContent($playerID, $tribe, $confirm)
{
    global $config, $db, $no_resource_flag, $params;
    $no_resource_flag = 1;
    // try to connect to login db
    if (!tribe_isLeader($playerID, $tribe, $db)) {
        page_dberror();
    }
    // proccess form data
    if ($confirm) {
        // the only necessary field
        $success = tribe_deleteTribe($tribe, $db);
        $template = @tmpl_open('./templates/' . $config->template_paths[$params->SESSION->user['template']] . '/tribeDeleteResponse.ihtml');
        if ($success) {
            tmpl_set($template, 'message', "Der Clan wurde aufgel&ouml;st. Alle Mitglieder sind jetzt " . "wieder Clanlos. Das Clanmen&uuml; funktioniert bei allen erst " . "nach dem n&auml;chsten einloggen wieder.");
        } else {
            tmpl_set($template, 'message', "Das l&ouml;schen des Clans ist fehlgeschlagen." . "Bitte wenden Sie sich an das Support Team.");
        }
        return tmpl_parse($template);
    }
    // Show confirmation request
    $template = @tmpl_open("./templates/" . $config->template_paths[$params->SESSION->user['template']] . "/dialog.ihtml");
    tmpl_set($template, 'message', "M&ouml;chten Sie diesen Clan unwiderruflich l&ouml;schen? " . "Ihre gesamten Clandaten gehen verloren. ");
    tmpl_set($template, 'BUTTON/formname', 'confirm');
    tmpl_set($template, 'BUTTON/text', 'Clan l&ouml;schen');
    tmpl_set($template, 'BUTTON/modus_name', 'modus');
    tmpl_set($template, 'BUTTON/modus_value', TRIBE_DELETE);
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_name', 'confirm');
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_value', 1);
    tmpl_iterate($template, 'BUTTON');
    tmpl_set($template, 'BUTTON/formname', 'cancel');
    tmpl_set($template, 'BUTTON/text', 'Abbrechen');
    tmpl_set($template, 'BUTTON/modus_name', 'modus');
    tmpl_set($template, 'BUTTON/modus_value', TRIBE_ADMIN);
    return tmpl_parse($template);
}
Esempio n. 18
0
function tribeRelationList_getContent($tribe)
{
    global $db, $no_resource_flag, $config, $params, $relationList;
    $no_resource_flag = 1;
    $template = tmpl_open($params->SESSION->player->getTemplatePath() . 'tribeRelationList.ihtml');
    tmpl_set($template, 'tribe', $tribe);
    $relations = relation_getRelationsForTribe($tribe, $db);
    if (!$relations) {
        page_dberror();
    }
    foreach ($relations['own'] as $target => $relationData) {
        tmpl_iterate($template, 'ROWS');
        $data = array("tribe" => $relationData['tribe_target'], "relationTo" => $relationList[$relationData['relationType']]['name'], "relationFrom" => $relations['other'][$target] ? $relationList[$relations['other'][$target]['relationType']]['name'] : $relationList[0]['name'], "link" => "main.php?modus=" . TRIBE_DETAIL . "&tribe=" . $relationData['tribe_target']);
        $relations['other'][$target] = 0;
        // mark this relation
        if ($i++ % 2) {
            tmpl_set($template, 'ROWS/ROW_ALTERNATE', $data);
        } else {
            tmpl_set($template, 'ROWS/ROW', $data);
        }
    }
    foreach ($relations['other'] as $target => $relationData) {
        if (!$relationData) {
            // already printed out this relation
            continue;
        }
        tmpl_iterate($template, 'ROWS');
        $data = array("tribe" => $relationData['tribe'], "relationFrom" => $relationList[$relationData['relationType']]['name'], "relationTo" => $relationList[0]['name'], "link" => "main.php?modus=" . TRIBE_DETAIL . "&tribe=" . $relationData['tribe']);
        if ($i++ % 2) {
            tmpl_set($template, 'ROWS/ROW_ALTERNATE', $data);
        } else {
            tmpl_set($template, 'ROWS/ROW', $data);
        }
    }
    return tmpl_parse($template);
}
function beginner_endProtectionConfirm($caveID)
{
    global $config, $db, $params;
    // Show confirmation request
    $template = @tmpl_open("./templates/" . $config->template_paths[$params->SESSION->user['template']] . "/dialog.ihtml");
    tmpl_set($template, 'message', "M&ouml;chten Sie den Anf&auml;ngerschutz " . "in Siedlung " . $caveID . " wirklich unwiderruflich aufgeben? Sie k&ouml;nnen dann ab " . "sofort angreifen, aber auch angegriffen werden!");
    tmpl_set($template, 'BUTTON/formname', 'confirm');
    tmpl_set($template, 'BUTTON/text', 'Anf&auml;ngerschutz beenden');
    tmpl_set($template, 'BUTTON/modus_name', 'modus');
    tmpl_set($template, 'BUTTON/modus_value', CAVE_DETAIL);
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_name', 'endProtectionConfirm');
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_value', 1);
    tmpl_iterate($template, 'BUTTON/ARGUMENT');
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_name', 'caveID');
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_value', $caveID);
    tmpl_iterate($template, 'BUTTON');
    tmpl_set($template, 'BUTTON/formname', 'cancel');
    tmpl_set($template, 'BUTTON/text', 'Abbrechen');
    tmpl_set($template, 'BUTTON/modus_name', 'modus');
    tmpl_set($template, 'BUTTON/modus_value', CAVE_DETAIL);
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_name', 'caveID');
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_value', $caveID);
    return tmpl_parse($template);
}
Esempio n. 20
0
function tribeDelete_getContent($playerID, $tribe, $confirm)
{
    global $no_resource_flag;
    $no_resource_flag = 1;
    // try to connect to login db
    if (!tribe_isLeader($playerID, $tribe)) {
        page_dberror();
    }
    // proccess form data
    if ($confirm) {
        // the only necessary field
        $success = tribe_deleteTribe($tribe);
        $template = tmpl_open($_SESSION['player']->getTemplatePath() . 'tribeDeleteResponse.ihtml');
        if ($success) {
            tmpl_set($template, 'message', _('Der Stamm wurde aufgel&ouml;st. Alle Mitglieder sind jetzt wieder stammeslos. Das Stammesmen&uuml; funktioniert bei allen erst nach dem n&auml;chsten einloggen wieder.'));
        } else {
            tmpl_set($template, 'message', _('Das l&ouml;schen des Stammes ist fehlgeschlagen. Bitte wenden Sie sich an das Support Team.'));
        }
        return tmpl_parse($template);
    }
    // Show confirmation request
    $template = tmpl_open($_SESSION['player']->getTemplatePath() . 'dialog.ihtml');
    tmpl_set($template, 'message', _('M&ouml;chten Sie diesen Stamm unwiderruflich l&ouml;schen? Ihre gesamten Stammesdaten gehen verloren.'));
    tmpl_set($template, 'BUTTON/formname', 'confirm');
    tmpl_set($template, 'BUTTON/text', _('Stamm aufl&ouml;sen'));
    tmpl_set($template, 'BUTTON/modus_name', 'modus');
    tmpl_set($template, 'BUTTON/modus_value', TRIBE_DELETE);
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_name', 'confirm');
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_value', 1);
    tmpl_iterate($template, 'BUTTON');
    tmpl_set($template, 'BUTTON/formname', 'cancel');
    tmpl_set($template, 'BUTTON/text', _('Abbrechen'));
    tmpl_set($template, 'BUTTON/modus_name', 'modus');
    tmpl_set($template, 'BUTTON/modus_value', TRIBE_ADMIN);
    return tmpl_parse($template);
}
Esempio n. 21
0
/**
 *
 */
function externals_builder($caveID, &$cave)
{
    global $config, $db, $params, $buildingTypeList, $defenseSystemTypeList, $resourceTypeList, $unitTypeList;
    // process a cancel-order request
    if (isset($params->POST->eventID)) {
        $message = externals_cancelOrder($params->POST->eventID, $caveID, $db);
        // process a demolish request
    } else {
        if (isset($params->POST->breakDownConfirm)) {
            $message = externals_performDemolishing($params->POST->externalID, $caveID, $cave, $db);
            $reload = 1;
            // process an order request
        } else {
            if (isset($params->POST->externalID)) {
                check_timestamp($params->POST->tstamp);
                $message = externals_performOrder($params->POST->externalID, $caveID, $cave, $db);
                $reload = 1;
            }
        }
    }
    // refresh cave data
    if ($reload) {
        $r = getCaveSecure($caveID, $params->SESSION->player->playerID);
        if ($r->isEmpty()) {
            page_dberror();
        }
        $cave = $r->nextRow();
    }
    // get this cave's queue
    $queue = externals_getQueue($params->SESSION->player->playerID, $caveID);
    // open template
    $template = tmpl_open($params->SESSION->player->getTemplatePath() . 'externalBuilder.ihtml');
    // show special messages
    if (isset($message)) {
        tmpl_set($template, '/MESSAGE/message', $message);
    }
    // show the external table
    for ($i = 0; $i < sizeof($defenseSystemTypeList); $i++) {
        $external = $defenseSystemTypeList[$i];
        $maxLevel = round(eval('return ' . formula_parseToPHP("{$external->maxLevel};", '$cave')));
        $notenough = FALSE;
        $result = rules_checkDependencies($external, $cave);
        // if all requirements are met, but the maxLevel is 0, treat it like a non-buildable
        if ($maxLevel <= 0 && $result === TRUE) {
            $result = $cave[$external->dbFieldName] ? _('Max. Stufe: 0') : FALSE;
        }
        if ($result === TRUE) {
            tmpl_iterate($template, 'DEFENSESYSTEM');
            tmpl_set($template, "DEFENSESYSTEM/alternate", $count++ % 2 ? "alternate" : "");
            tmpl_set($template, 'DEFENSESYSTEM', array('name' => $external->name, 'dbFieldName' => $external->dbFieldName, 'externalID' => $i, 'size' => "0" + $cave[$external->dbFieldName], 'time' => time_formatDuration(eval('return ' . formula_parseToPHP($external->productionTimeFunction . ";", '$cave')) * DEFENSESYSTEM_TIME_BASE_FACTOR)));
            // iterate ressourcecosts
            foreach ($external->resourceProductionCost as $resourceID => $function) {
                $cost = ceil(eval('return ' . formula_parseToPHP($function . ';', '$cave')));
                if ($cost) {
                    tmpl_iterate($template, "DEFENSESYSTEM/RESSOURCECOST");
                    if ($cave[$resourceTypeList[$resourceID]->dbFieldName] >= $cost) {
                        tmpl_set($template, "DEFENSESYSTEM/RESSOURCECOST/ENOUGH/value", $cost);
                    } else {
                        tmpl_set($template, "DEFENSESYSTEM/RESSOURCECOST/LESS/value", $cost);
                        $notenough = TRUE;
                    }
                    tmpl_set($template, "DEFENSESYSTEM/RESSOURCECOST/dbFieldName", $resourceTypeList[$resourceID]->dbFieldName);
                    tmpl_set($template, "DEFENSESYSTEM/RESSOURCECOST/name", $resourceTypeList[$resourceID]->name);
                }
            }
            // iterate unitcosts
            foreach ($external->unitProductionCost as $unitID => $function) {
                $cost = ceil(eval('return ' . formula_parseToPHP($function . ';', '$cave')));
                if ($cost) {
                    tmpl_iterate($template, "DEFENSESYSTEM/UNITCOST");
                    if ($cave[$unitTypeList[$unitID]->dbFieldName] >= $cost) {
                        tmpl_set($template, "DEFENSESYSTEM/UNITCOST/ENOUGH/value", $cost);
                    } else {
                        tmpl_set($template, "DEFENSESYSTEM/UNITCOST/LESS/value", $cost);
                        $notenough = TRUE;
                    }
                    tmpl_set($template, "DEFENSESYSTEM/UNITCOST/name", $unitTypeList[$unitID]->name);
                }
            }
            // iterate buildingcosts
            foreach ($external->buildingProductionCost as $buildingID => $function) {
                $cost = ceil(eval('return ' . formula_parseToPHP($function . ';', '$cave')));
                if ($cost) {
                    tmpl_iterate($template, "DEFENSESYSTEM/BUILDINGCOST");
                    if ($cave[$buildingTypeList[$buildingID]->dbFieldName] >= $cost) {
                        tmpl_set($template, "DEFENSESYSTEM/BUILDINGCOST/ENOUGH/value", $cost);
                    } else {
                        tmpl_set($template, "DEFENSESYSTEM/BUILDINGCOST/LESS/value", $cost);
                        $notenough = TRUE;
                    }
                    tmpl_set($template, "DEFENSESYSTEM/BUILDINGCOST/name", $buildingTypeList[$buildingID]->name);
                }
            }
            // iterate externalcosts
            foreach ($external->externalProductionCost as $externalID => $function) {
                $cost = ceil(eval('return ' . formula_parseToPHP($function . ';', '$cave')));
                if ($cost) {
                    tmpl_iterate($template, "DEFENSESYSTEM/EXTERNALCOST");
                    if ($cave[$defenseSystemTypeList[$externalID]->dbFieldName] >= $cost) {
                        tmpl_set($template, "DEFENSESYSTEM/EXTERNALCOST/ENOUGH/value", $cost);
                    } else {
                        tmpl_set($template, "DEFENSESYSTEM/EXTERNALCOST/LESS/value", $cost);
                        $notenough = TRUE;
                    }
                    tmpl_set($template, "DEFENSESYSTEM/EXTERNALCOST/name", $defenseSystemTypeList[$externalID]->name);
                }
            }
            // show the break down link
            if ($cave[$external->dbFieldName]) {
                tmpl_set($template, 'DEFENSESYSTEM/BREAK_DOWN_LINK', array('externalID' => $external->defenseSystemID));
            }
            // do not show order link
            if ($queue) {
                tmpl_set($template, 'DEFENSESYSTEM/BUILD_LINK_NO/message', _('Ausbau im Gange'));
            } else {
                if ($notenough && $maxLevel > $cave[$external->dbFieldName]) {
                    tmpl_set($template, 'DEFENSESYSTEM/BUILD_LINK_NO/message', _('Zu wenig Rohstoffe'));
                    // show order link
                } else {
                    if ($maxLevel > $cave[$external->dbFieldName]) {
                        tmpl_set($template, 'DEFENSESYSTEM/BUILD_LINK', array('externalID' => $external->defenseSystemID, 'tstamp' => time()));
                        // maxlvl reached
                    } else {
                        tmpl_set($template, '/DEFENSESYSTEM/BUILD_LINK_NO/message', _('Max. Stufe'));
                    }
                }
            }
            // can't build but already in cave
        } else {
            if ($cave[$external->dbFieldName]) {
                tmpl_iterate($template, '/UNWANTEDDEFENSESYSTEMS/DEFENSESYSTEM');
                tmpl_set($template, '/UNWANTEDDEFENSESYSTEMS/DEFENSESYSTEM', array('alternate' => $count_unwanted++ % 2 ? "" : "alternate", 'externalID' => $i, 'size' => $cave[$external->dbFieldName], 'dbFieldName' => $external->dbFieldName, 'name' => $external->name));
                // if building not impossible, show dependencies
                if ($result !== FALSE) {
                    tmpl_set($template, '/UNWANTEDDEFENSESYSTEMS/DEFENSESYSTEM/dependencies', $result);
                }
                // building not impossible, but DONT show dependencies
            } else {
                if ($result !== FALSE && !$external->nodocumentation) {
                    tmpl_iterate($template, '/UNQUALIFIEDDEFENSESYSTEMS/DEFENSESYSTEM');
                    tmpl_set($template, '/UNQUALIFIEDDEFENSESYSTEMS/DEFENSESYSTEM', array('alternate' => $count_unqualified++ % 2 ? "" : "alternate", 'externalID' => $i, 'name' => $external->name, 'dbFieldName' => $external->dbFieldName, 'dependencies' => $result));
                }
            }
        }
    }
    // queue
    if ($queue) {
        $row = $queue->nextRow();
        tmpl_set($template, 'DEFENSESYSTEM_QUEUE', array('name' => $defenseSystemTypeList[$row['defenseSystemID']]->name, 'size' => $cave[$defenseSystemTypeList[$row['defenseSystemID']]->dbFieldName] + 1, 'finish' => time_formatDatetime($row['end']), 'eventID' => $row['event_defenseSystemID']));
    }
    tmpl_set($template, array('rules_path' => RULES_PATH));
    return tmpl_parse($template);
}
Esempio n. 22
0
function wonder_getWonderContent($playerID, $caveID, &$details)
{
    global $buildingTypeList, $resourceTypeList, $wonderTypeList, $unitTypeList, $config, $params, $db;
    // messages
    $messageText = array(-4 => "Die Zielsiedlung steht unter Schutz. Der Zauber kann nicht erwirkt werden.", -3 => "Die angegebene Zielsiedlung wurde nicht gefunden.", -2 => "Der Zauber kann nicht auf die angegbene Zielsiedlung erwirkt " . "werden.", -1 => "Es ist ein Fehler bei der Verarbeitung Ihrer Anfrage aufgetreten. " . "Bitte wenden Sie sich an die Administratoren.", 0 => "Der Zauber kann nicht erwirkt werden. Es fehlen die " . "notwendigen Voraussetzungen.", 1 => "Das Erwirken des Zaubers scheint Erfolg zu haben.", 2 => "Die G&ouml;tter haben Ihr Flehen nicht erh&ouml;rt! Die " . "eingesetzten Opfergaben sind nat&uuml;rlich dennoch verloren. " . "Mehr Gl&uuml;ck beim n&auml;chsten Mal!");
    // ADDED by chris--- for cavebook -----------------------
    if ($params->POST->targetCaveID != -1) {
        $targetCave = getCaveByID($params->POST->targetCaveID);
        $x = $targetCave[xCoord];
        $y = $targetCave[yCoord];
    } else {
        $x = $params->POST->xCoord;
        $y = $params->POST->yCoord;
    }
    // ------------------------------------------------------
    // and changed $params->POST->xCoord to $x etc
    if (isset($params->POST->wonderID)) {
        $messageID = wonder_processOrder($playerID, $params->POST->wonderID, $caveID, $x, $y, $details, $db);
        $reload = 1;
    }
    if ($reload) {
        // this isn't that elegant...
        $r = getCaveSecure($caveID, $params->SESSION->user['playerID']);
        if ($r->isEmpty()) {
            page_dberror();
        }
        $details = $r->nextRow();
    }
    $template = @tmpl_open("./templates/" . $config->template_paths[$params->SESSION->user['template']] . "/wonder.ihtml");
    // Show a special message
    if (isset($messageID)) {
        tmpl_set($template, '/MESSAGE/message', $messageText[$messageID]);
    }
    // ADDED by chris--- for cavebook ---------------------------------
    // Getting entries
    $cavelist = cavebook_getEntries($params->SESSION->user['playerID']);
    // Show the cave table
    $cavebook = array();
    for ($ix = 0; $ix < sizeof($cavelist[id]); $ix++) {
        $cavebook[$ix][cavebook_entry] = $cavelist[name][$ix];
        $cavebook[$ix][cavebook_id] = $cavelist[id][$ix];
        $cavebook[$ix][cavebook_x] = $cavelist[x][$ix];
        $cavebook[$ix][cavebook_y] = $cavelist[y][$ix];
    }
    // --------------------------------------------------------------
    // Show the wonder table
    for ($i = 0; $i < sizeof($wonderTypeList); $i++) {
        $wonder = $wonderTypeList[$i];
        // the current building
        $result = rules_checkDependencies($wonder, $details);
        if ($result === TRUE) {
            tmpl_iterate($template, 'WONDER');
            tmpl_set($template, "WONDER/alternate", $count++ % 2 ? "alternate" : "");
            tmpl_set($template, 'WONDER', array('name' => $wonder->name, 'wonderID' => $i, 'modus' => WONDER_DETAIL, 'caveID' => $caveID));
            // iterate ressourcecosts
            foreach ($wonder->resourceProductionCost as $resourceID => $function) {
                $cost = ceil(eval('return ' . formula_parseToPHP($function . ';', '$details')));
                if ($cost) {
                    tmpl_iterate($template, "WONDER/RESSOURCECOST");
                    if ($details[$resourceTypeList[$resourceID]->dbFieldName] >= $cost) {
                        tmpl_set($template, "WONDER/RESSOURCECOST/ENOUGH/value", $cost);
                    } else {
                        tmpl_set($template, "WONDER/RESSOURCECOST/LESS/value", $cost);
                    }
                    tmpl_set($template, "WONDER/RESSOURCECOST/dbFieldName", $resourceTypeList[$resourceID]->dbFieldName);
                    tmpl_set($template, "WONDER/RESSOURCECOST/name", $resourceTypeList[$resourceID]->name);
                }
            }
            // iterate unitcosts
            foreach ($wonder->unitProductionCost as $unitID => $function) {
                $cost = ceil(eval('return ' . formula_parseToPHP($function . ';', '$details')));
                if ($cost) {
                    tmpl_iterate($template, "WONDER/UNITCOST");
                    if ($details[$unitTypeList[$unitID]->dbFieldName] >= $cost) {
                        tmpl_set($template, "WONDER/UNITCOST/ENOUGH/value", $cost);
                    } else {
                        tmpl_set($template, "WONDER/UNITCOST/LESS/value", $cost);
                    }
                    tmpl_set($template, "WONDER/UNITCOST/name", $unitTypeList[$unitID]->name);
                }
            }
            // show the wonder link
            tmpl_set($template, 'WONDER/BUILD_LINK', array('action' => WONDER, 'wonderID' => $wonder->wonderID, 'cave_book_link' => CAVE_BOOK, 'BOOKENTRY' => $cavebook, 'caveID' => $caveID));
        } else {
            if ($params->SESSION->user['show_unqualified'] && $result !== FALSE && !$wonder->nodocumentation) {
                tmpl_iterate($template, '/UNQUALIFIEDWONDERS/WONDER');
                tmpl_set($template, '/UNQUALIFIEDWONDERS/WONDER', array('alternate' => $count_unqualified++ % 2 ? "" : "alternate", 'modus' => WONDER_DETAIL, 'wonderID' => $i, 'caveID' => $caveID, 'name' => $wonder->name, 'dependencies' => $result));
            }
        }
    }
    return tmpl_parse($template);
}
Esempio n. 23
0
function tribeAdmin_getContent($playerID, $tag)
{
    global $config, $params, $db, $no_resource_flag, $relationList, $governmentList, $wonderTypeList;
    $no_resource_flag = 1;
    // check, for security reasons!
    if (!tribe_isLeaderOrJuniorLeader($playerID, $tag, $db)) {
        page_dberror();
    }
    $isLeader = tribe_isLeader($playerID, $tag, $db);
    $isLeader ? $leaderID = $playerID : ($leaderID = tribe_getLeaderID($tag, $db));
    !$isLeader ? $juniorLeaderID = $playerID : ($juniorLeaderID = tribe_getJuniorLeaderID($tag, $db));
    //get Member Data
    if (!($memberData = tribe_getAllMembers($tag, $db))) {
        page_dberror();
    }
    // get government
    if (!($tribeGovernment = government_getGovernmentForTribe($tag, $db))) {
        page_dberror();
    }
    $tribeGovernment['name'] = $governmentList[$tribeGovernment['governmentID']]['name'];
    //seems to be leader, but not in tribe
    if ($isLeader && !is_array($memberData[$leaderID])) {
        tribe_unmakeLeaderJuniorLeader($leaderID, $tag, $db);
    }
    //seems to be juniorleader, but not in tribe
    if (!$isLeader && !is_array($memberData[$leaderID])) {
        tribe_unmakeJuniorLeader($leaderID, $tag, $db);
    }
    // messages
    $messageText = array(-27 => _('Das Stammeswunder wurde gewirkt.'), -26 => _('Das Stammeswunder konnte nicht gewirkt werden.'), -25 => _('Ihr Kriegsanteil ist nicht hoch genug, um den Gegner zur Aufgabe zu zwingen.'), -24 => _('Nur in der Demokratie sind solche Wahlen m&ouml;glich.'), -23 => _('Sie sind schon Stammesanführer.'), -22 => _('Dieser Spieler ist nicht im Stamm.'), -21 => _('Dies darf nur der Stammesanführer tun.'), -20 => _('Es ist kein gleicher Vorkriegsgegner vorhanden.'), -19 => _('Die Beziehung des anderen Stammes erlauben kein Kriegsbündniss.'), -18 => _('Unsere aktuelle Beziehung erlaubt kein Kriegsbündniss.'), -17 => _('Der Stamm hat noch nicht genug Mitglieder um Beziehungen eingehen zu dürfen'), -16 => _('Die Stammeszugehörigkeit hat sich erst vor kurzem geändert. Warten Sie, bis die Stammeszugehörigkeit geändert werden darf.'), -15 => _('Ihr Stamm befindet sich im Krieg. Sie dürfen derzeit nicht austreten.'), -14 => _('Die Beziehung wurde nicht geändert, weil der ausgewählte Beziehungstyp bereits eingestellt ist.'), -13 => _('Eure Untergebenen weigern sich, diese Beziehung gegenüber einem so großen Stamm einzugehen.'), -12 => _('Eure Untergebenen weigern sich, diese Beziehung gegenüber einem so kleinen Stamm einzugehen.'), -11 => sprintf(_('Die Moral des Gegners ist noch nicht schlecht genug. Sie muss unter %d sinken. Eine weitere Chance besteht, wenn die Mitgliederzahl des gegnerischen Stammes um 30 Prozent gesunken ist. Das Verhältnis Eurer Rankingpunkte zu denen des Gegners muss sich seit Kriegsbeginn verdoppelt haben.'), RELATION_FORCE_MORAL_THRESHOLD), -10 => _('Die zu ändernde Beziehung wurde nicht gefunden!'), -9 => _('Die Regierung konnte nicht geändert werden, weil sie erst vor kurzem geändert wurde.'), -8 => _('Die Regierung konnte aufgrund eines Fehlers nicht aktualisiert werden'), -7 => _('Zu sich selber kann man keine Beziehungen aufnehmen!'), -6 => _('Den Stamm gibt es nicht!'), -5 => _('Von der derzeitigen Beziehung kann nicht direkt auf die ausgewählte Beziehungsart gewechselt werden.'), -4 => _('Die Mindestlaufzeit läuft noch!'), -3 => _('Die Beziehung konnte aufgrund eines Fehlers nicht aktualisiert werden.'), -2 => _('Der Spieler ist ebenfalls Stammesanführer und kann nicht gekickt werden. Er kann nur freiwillig gehen.'), -1 => _('Der Spieler konnte nicht gekickt werden!'), 0 => _('Die Daten wurden erfolgreich aktualisiert.'), 1 => _('Der Spieler wurde erfolgreich gekickt.'), 2 => _('Die Daten konnten gar nicht oder zumindest nicht vollständig aktualisiert werden.'), 3 => _('Die Beziehung wurde umgestellt.'), 4 => _('Die Regierung wurde geändert.'));
    // proccess form data
    if ($params->POST->relationData && $params->POST->forceSurrender) {
        $messageID = relation_forceSurrender($tag, $params->POST->relationData, $db);
    } else {
        if ($params->POST->relationData && !$params->POST->forceSurrender) {
            $messageID = relation_processRelationUpdate($tag, $params->POST->relationData, $db);
        } else {
            if ($params->POST->data) {
                $messageID = tribe_processAdminUpdate($playerID, $tag, $params->POST->data, $db);
            } else {
                if ($params->POST->kick) {
                    if (!$isLeader) {
                        $messageID = -21;
                    } else {
                        $messageID = tribe_processKickMember($params->POST->playerID, $tag, $db);
                    }
                } else {
                    if ($params->POST->governmentData) {
                        if (!$isLeader) {
                            $messageID = -21;
                        } else {
                            $messageID = government_processGovernmentUpdate($tag, $params->POST->governmentData, $db);
                        }
                    } else {
                        if ($params->POST->juniorLeader) {
                            $newleadership = array(0 => $leaderID, 1 => $params->POST->juniorLeader[juniorLeaderID]);
                            if (!$isLeader) {
                                $messageID = -21;
                            } elseif ($newleadership[1] && !is_array($memberData[$newleadership[1]])) {
                                $messageID = -22;
                            } elseif ($newleadership[1] == $newleadership[0]) {
                                $messageID = -23;
                            } elseif ($tribeGovernment['governmentID'] != 2) {
                                $messageID = -24;
                            } elseif (tribe_ChangeLeader($tag, $newleadership, $leaderID, $juniorLeaderID, $db)) {
                                $messageID = 0;
                                //success
                            } else {
                                $messageID = 2;
                                //something went wrong
                            }
                        }
                    }
                }
            }
        }
    }
    // get the tribe data
    if (!($tribeData = tribe_getTribeByTag($tag, $db))) {
        page_dberror();
    }
    $tribeData['description'] = str_replace('<br />', '', $tribeData['description']);
    // get relations
    if (!($tribeRelations = relation_getRelationsForTribe($tag, $db))) {
        page_dberror();
    }
    // get current wars
    $tribeWarTargets = relation_getWarTargetsAndFame($tag, $db);
    $template = tmpl_open($params->SESSION->player->getTemplatePath() . 'tribeAdmin.ihtml');
    // Show a special message
    if (isset($messageID)) {
        tmpl_set($template, '/MESSAGE/message', $messageText[$messageID]);
    }
    // show the profile's data
    tmpl_set($template, 'modus_name', 'modus');
    tmpl_set($template, 'modus_value', TRIBE_ADMIN);
    ////////////// user data //////////////////////
    tmpl_set($template, 'DATA_GROUP/heading', _('Stammesdaten'));
    tmpl_set($template, 'DATA_GROUP/ENTRY_INFO/name', _('Tag'));
    tmpl_set($template, 'DATA_GROUP/ENTRY_INFO/value', $tribeData['tag']);
    tmpl_iterate($template, 'DATA_GROUP/ENTRY_INFO');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/name', _('Name'));
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/dataarray', 'data');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/dataentry', 'name');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/value', $tribeData['name']);
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/size', '20');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/maxlength', '90');
    tmpl_iterate($template, 'DATA_GROUP/ENTRY_INPUT');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/name', _('Password'));
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/dataarray', 'data');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/dataentry', 'password');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/value', $tribeData['password']);
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/size', '15');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/maxlength', '15');
    tmpl_set($template, 'DATA_GROUP/ENTRY_MEMO/name', _('Beschreibung'));
    tmpl_set($template, 'DATA_GROUP/ENTRY_MEMO/dataarray', 'data');
    tmpl_set($template, 'DATA_GROUP/ENTRY_MEMO/dataentry', 'description');
    tmpl_set($template, 'DATA_GROUP/ENTRY_MEMO/value', $tribeData['description']);
    tmpl_set($template, 'DATA_GROUP/ENTRY_MEMO/cols', '25');
    tmpl_set($template, 'DATA_GROUP/ENTRY_MEMO/rows', '8');
    ////////////// junioLeader ////////////////////
    if ($isLeader && $tribeGovernment['governmentID'] == 2) {
        tmpl_set($template, 'JUNIORADMIN', array('modus_name' => "modus", 'modus' => TRIBE_ADMIN, 'caption' => _('Wählen'), 'SELECTOR' => array('dataarray' => 'juniorLeader', 'dataentry' => 'juniorLeaderID')));
        foreach ($memberData as $playerID => $playerData) {
            if ($leaderID == $playerID) {
                continue;
            }
            tmpl_iterate($template, 'JUNIORADMIN/SELECTOR/OPTION');
            tmpl_set($template, 'JUNIORADMIN/SELECTOR/OPTION', array("value" => $playerID, 'selected' => $tribeData['juniorLeaderID'] == $playerID ? "selected" : "", 'text' => $playerData['name']));
        }
        tmpl_iterate($template, 'JUNIORADMIN/SELECTOR/OPTION');
        tmpl_set($template, 'JUNIORADMIN/SELECTOR/OPTION', array("value" => 0, 'selected' => $tribeData['juniorLeaderID'] == 0 ? "selected" : "", 'text' => _('keinen Stellvertreter wählen')));
    }
    ////////////// government /////////////////////
    if ($isLeader) {
        if ($tribeGovernment['isChangeable']) {
            tmpl_set($template, 'GOVERNMENT', array('modus_name' => "modus", 'modus' => TRIBE_ADMIN, 'caption' => _('Ändern'), 'SELECTOR' => array('dataarray' => 'governmentData', 'dataentry' => 'governmentID')));
            foreach ($governmentList as $governmentID => $typeData) {
                tmpl_iterate($template, 'GOVERNMENT/SELECTOR/OPTION');
                tmpl_set($template, 'GOVERNMENT/SELECTOR/OPTION', array('value' => $governmentID, 'selected' => $governmentID == $tribeGovernment['governmentID'] ? "selected" : "", 'text' => $typeData['name']));
            }
        } else {
            tmpl_set($template, 'GOVERNMENT_INFO', array('name' => $tribeGovernment['name'], 'duration' => $tribeGovernment['time']));
        }
    }
    ////////////// tribewonder //////////////////////
    /*
    init_Wonders();
      $tribewonderExists = False;
      for ($i = 0; $i < sizeof($wonderTypeList); $i++){
      	 $wonder = $wonderTypeList[$i];
         if ($wonder->groupID<>3) 
         	 continue;
         $tribewonderExists = True;
         tmpl_iterate($template,'TRIBEWONDER/OPTION');	 
         tmpl_set($template, 'TRIBEWONDER/OPTION',
               array('text'     => $wonder->name,
                     'value'     => $i));
      };
      if ($tribewonderExists) {
        tmpl_set($template, 'TRIBEWONDER/caption',_('erwirken'));
        tmpl_set($template, 'TRIBEWONDER/modus_name',"modus");
        tmpl_set($template, 'TRIBEWONDER/modus', TRIBE_ADMIN);
      };
    */
    ////////////// relations //////////////////////
    tmpl_set($template, 'RELATION_NEW', array('modus_name' => "modus", 'modus' => TRIBE_ADMIN, 'dataarray' => "relationData", 'dataentry' => "tag", 'value' => $params->POST->relationData['tag'], 'size' => 8, 'maxlength' => 8, 'caption' => _('Ändern')));
    tmpl_set($template, 'RELATION_NEW/SELECTOR', array('dataarray' => "relationData", 'dataentry' => "relationID"));
    foreach ($relationList as $relationID => $typeData) {
        tmpl_iterate($template, 'RELATION_NEW/SELECTOR/OPTION');
        tmpl_set($template, 'RELATION_NEW/SELECTOR/OPTION', array('value' => $relationID, 'selected' => $relationID == $params->POST->relationData['relationID'] ? "selected" : "", 'text' => $typeData['name']));
    }
    // existing relations towards other clans //////////////////
    foreach ($tribeRelations['own'] as $target => $targetData) {
        if (!$targetData['changeable']) {
            // relation, that couldn't be changed at the moment
            tmpl_iterate($template, 'RELATION_INFO');
            $relation_info = array('tag' => $target, 'relation' => $relationList[$targetData['relationType']]['name'], 'duration' => $targetData['time'], 'their_relation' => $tribeRelations['other'][$target] ? $relationList[$tribeRelations['other'][$target]['relationType']]['name'] : $relationList[0]['name']);
            // war?
            if ($tribeWarTargets[$target]) {
                $relation_info["WAR/fame_own"] = $tribeWarTargets[$target]["fame_own"];
                $relation_info["WAR/fame_target"] = $tribeWarTargets[$target]["fame_target"];
                $relation_info["WAR/percent_actual"] = $tribeWarTargets[$target]["percent_actual"];
            }
            tmpl_set($template, 'RELATION_INFO', $relation_info);
            // check, if it is possible to get or loose fame, and display if true
            /*if ($targetData['attackerReceivesFame'] ||
                  $targetData['defenderReceivesFame'] ||
                  $tribeRelations['other'][$target]['attackerReceivesFame'] ||
                  $tribeRelations['other'][$target]['defenderReceivesFame']) {
                tmpl_set($template, 'RELATION_INFO/FAME',
                         array('tribe_fame'   => $targetData['fame'],
                               'target_fame'  => $tribeRelations['other'][$target]['fame'],
                               'tribe_moral'  => $targetData['moral'],
                               'target_moral' => $tribeRelations['other'][$target]['moral']));
              }*/
            continue;
        } else {
            // relation, that is changeable
            tmpl_iterate($template, 'RELATION');
            $relation = array('modus_name' => "modus", 'modus' => TRIBE_ADMIN, 'dataarray' => "relationData", 'dataentry' => "tag", 'value' => $target, 'target_points' => $targetData['target_rankingPoints'], 'tribe_points' => $targetData['tribe_rankingPoints'], 'their_relation' => $tribeRelations['other'][$target] ? $relationList[$tribeRelations['other'][$target]['relationType']]['name'] : $relationList[0]['name'], 'caption' => _('Ändern'));
            // war?
            if ($tribeWarTargets[$target]) {
                $wartarget = $tribeWarTargets[$target];
                $relation["WAR/fame_own"] = $wartarget["fame_own"];
                $relation["WAR/fame_target"] = $wartarget["fame_target"];
                $relation["WAR/percent_actual"] = $wartarget["percent_actual"];
                if ($wartarget["isForcedSurrenderTheoreticallyPossible"]) {
                    $relation["WAR/FORCEDSURRENDER/percent_estimated"] = $wartarget["percent_estimated"];
                    if ($wartarget["isForcedSurrenderPracticallyPossible"]) {
                        $relation["WAR/FORCEDSURRENDER/class"] = "enough";
                    } else {
                        if ($target["isForcedSurrenderPracticallyPossibleForTarget"]) {
                            $relation["WAR/FORCEDSURRENDER/class"] = "less";
                        } else {
                            $relation["WAR/FORCEDSURRENDER/class"] = "";
                        }
                    }
                }
            }
            tmpl_set($template, 'RELATION', $relation);
            tmpl_set($template, 'RELATION/SELECTOR', array('dataarray' => "relationData", 'dataentry' => "relationID"));
            // check, if it is possible to get or loose fame, and display if true
            /*if ($targetData['attackerReceivesFame'] ||
                  $targetData['defenderReceivesFame'] ||
                  $tribeRelations['other'][$target]['attackerReceivesFame'] ||
                  $tribeRelations['other'][$target]['defenderReceivesFame']) {
                tmpl_set($template, 'RELATION/FAME',
                         array('tribe_fame'   => $targetData['fame'],
                               'target_fame'  => $tribeRelations['other'][$target]['fame'],
                               'tribe_moral'  => $targetData['moral'],
                               'target_moral' => $tribeRelations['other'][$target]['moral']));
              }*/
            foreach ($relationList as $relationType => $typeData) {
                // get relation of target to tr.
                if ($tribeRelations['other'][$tag]) {
                    $relationTypeTowardsTribe = $tribeRelations['other'][$tag]['relationType'];
                }
                // check, if switch to relationType is possible
                if ($relationTypeTowardsTribe != $relationType && $relationType != $targetData['relationType'] && !relation_isPossible($relationType, $targetData['relationType'])) {
                    continue;
                }
                tmpl_iterate($template, 'RELATION/SELECTOR/OPTION');
                tmpl_set($template, 'RELATION/SELECTOR/OPTION', array('value' => $relationType, 'selected' => $relationType == $targetData['relationType'] ? "selected" : "", 'text' => $typeData['name']));
            }
        }
    }
    ////////////// memberliste ////////////////////
    foreach ($memberData as $playerID => $playerData) {
        if ($isLeader) {
            tmpl_iterate($template, 'MEMBERADMIN');
            tmpl_set($template, 'MEMBERADMIN', array("name" => $playerData['name'], "lastAction" => $playerData['lastAction'], "player_link" => "modus=" . PLAYER_DETAIL . "&detailID={$playerID}", "player_kick_link" => "modus=" . TRIBE_ADMIN . "&playerID={$playerID}&kick=1"));
        } else {
            tmpl_iterate($template, 'MEMBERJUNIORADMIN');
            tmpl_set($template, 'MEMBERJUNIORADMIN', array("name" => $playerData['name'], "lastAction" => $playerData['lastAction'], "player_link" => "modus=" . PLAYER_DETAIL . "&detailID={$playerID}"));
        }
    }
    ////////////// delete tribe ////////////////////
    if ($isLeader) {
        tmpl_set($template, 'DELETE/modus_name', 'modus');
        tmpl_set($template, 'DELETE/modus', TRIBE_DELETE);
        tmpl_set($template, 'DELETE/heading', _('Stamm auflösen'));
        tmpl_set($template, 'DELETE/text', _('Den gesamten Stamm auflösen. Alle Mitglieder sind danach stammeslos.'));
        tmpl_set($template, 'DELETE/caption', sprintf(_('%s auflösen'), $tribe));
    }
    return tmpl_parse($template);
}
Esempio n. 24
0
function getCaveReport($meineHoehlen, $caveID, $targetCaveID)
{
    global $params, $config, $terrainList;
    $cave = getCaveByID($targetCaveID);
    $caveDetails = array();
    $playerDetails = array();
    if ($cave['playerID'] != 0) {
        $caveDetails = getCaves($cave['playerID']);
        $playerDetails = getPlayerByID($cave['playerID']);
    }
    $template = tmpl_open($params->SESSION->player->getTemplatePath() . 'mapdetail.ihtml');
    if ($cave['protected']) {
        tmpl_set($template, 'PROPERTY', _('Anfängerschutz aktiv'));
    }
    if (!$cave['secureCave'] && $cave['playerID']) {
        tmpl_iterate($template, 'PROPERTY');
        tmpl_set($template, 'PROPERTY', _('übernehmbar'));
    }
    $region = getRegionByID($cave['regionID']);
    tmpl_set($template, array('cavename' => $cave['name'], 'xcoord' => $cave['xCoord'], 'ycoord' => $cave['yCoord'], 'terrain' => $terrainList[$cave['terrain']]['name'], 'region' => $region['name'], 'movementlink' => sprintf("?modus=unit_movement&amp;targetXCoord=%d&amp;targetYCoord=%d&amp;targetCaveName=%s", $cave['xCoord'], $cave['yCoord'], unhtmlentities($cave['name'])), 'backlink' => sprintf("?modus=map&amp;xCoord=%d&amp;yCoord=%d", $cave['xCoord'], $cave['yCoord'])));
    if ($cave['playerID'] != 0) {
        tmpl_set($template, '/OCCUPIED', array('playerLink' => "?modus=player_detail&amp;detailID=" . $playerDetails['playerID'], 'caveOwner' => $playerDetails['name']));
        if ($playerDetails['tribe']) {
            tmpl_set($template, '/OCCUPIED/TRIBE', array('tribeLink' => "?modus=tribe_detail&amp;tribe=" . urlencode(unhtmlentities($playerDetails['tribe'])), 'ownersTribe' => $playerDetails['tribe']));
        }
        if ($cave['artefacts'] != 0 && ($playerDetails['tribe'] != GOD_ALLY || $params->SESSION->player->tribe == GOD_ALLY)) {
            tmpl_set($template, '/OCCUPIED/ARTEFACT/artefactLink', "?modus=artefact_list&amp;caveID={$caveID}");
        }
        $caves = array();
        foreach ($caveDetails as $key => $value) {
            $temp = array('caveName' => $value['name'], 'xCoord' => $value['xCoord'], 'ycoord' => $value['yCoord'], 'terrain' => $terrainList[$value['terrain']]['name'], 'caveSize' => floor($value[CAVE_SIZE_DB_FIELD] / 50) + 1, 'movementLink' => "?modus=unit_movement&amp;targetXCoord=" . $value['xCoord'] . "&amp;targetYCoord=" . $value['yCoord'] . "&amp;targetCaveName=" . unhtmlentities($value['name']));
            if ($value['artefacts'] != 0 && ($playerDetails['tribe'] != GOD_ALLY || $params->SESSION->player->tribe == GOD_ALLY)) {
                $temp['ARTEFACT'] = array('artefactLink' => "?modus=artefact_list&amp;caveID={$caveID}");
            }
            if ($value['protected'] && $value['playerID']) {
                $temp['PROPERTY'] = array('text' => _('Anfängerschutz aktiv'));
            } else {
                if (!$value['secureCave']) {
                    $temp['PROPERTY'] = array('text' => _('übernehmbar'));
                }
            }
            $caves[] = $temp;
        }
        tmpl_set($template, '/OCCUPIED/CAVES', $caves);
    } else {
        if (sizeof($meineHoehlen) < $params->SESSION->player->takeover_max_caves && $cave['takeoverable'] == 1) {
            tmpl_set($template, 'TAKEOVERABLE', array('modus' => TAKEOVER, 'caveID' => $caveID, 'targetXCoord' => $cave['xCoord'], 'targetYCoord' => $cave['yCoord']));
        }
    }
    return tmpl_parse($template);
}
Esempio n. 25
0
function show_cavebook($playerID, $deleteID)
{
    global $buildingTypeList, $defenseSystemTypeList, $resourceTypeList, $unitTypeList, $config, $params, $db;
    // messages
    $messageText = array(0 => "Siedlung wurde eingetragen.", 1 => "Diese Siedlung gibt es nicht.", 2 => "Diese Siedlung ist schon in der Liste.", 3 => "Siedlung aus der Liste gel&ouml;scht.", 4 => "Siedlung konnte nicht aus der Liste entfernt werden.", 5 => "Verarsch mich nicht!", 6 => "Datenbank Fehler.");
    // enter something new
    if (isset($params->POST->newEntryName) && $params->POST->newEntryName != "") {
        $messageID = cavebook_newEntry($playerID, $params->POST->newEntryName);
    } else {
        if (isset($params->POST->x) && isset($params->POST->y) && $params->POST->y > 0 && $params->POST->x > 0) {
            $messageID = cavebook_newEntry_coords($playerID, $params->POST->x, $params->POST->y);
        } else {
            if (isset($params->POST->id)) {
                $messageID = cavebook_newEntry_id($playerID, $params->POST->id);
            } else {
                if (isset($params->GET->id)) {
                    $messageID = cavebook_newEntry_id($playerID, $params->GET->id);
                } else {
                    if ($deleteID > 0) {
                        $messageID = cavebook_deleteEntry($playerID, $deleteID);
                    }
                }
            }
        }
    }
    $template = @tmpl_open("./templates/" . $config->template_paths[$params->SESSION->user['template']] . "/cave_book.ihtml");
    // Show a special message
    if (isset($messageID)) {
        tmpl_set($template, '/MESSAGE/message', $messageText[$messageID]);
    }
    // Getting entries
    // call our function
    $cavelist = cavebook_getEntries($playerID);
    // Show the cave table
    for ($i = 0; $i < sizeof($cavelist[id]); $i++) {
        $cavename = $cavelist[name][$i];
        // the current cavename
        $caveX = $cavelist[x][$i];
        $caveY = $cavelist[y][$i];
        $caveID = $cavelist[id][$i];
        $playerName = $cavelist[playerName][$i];
        $playerID = $cavelist[playerID][$i];
        $tribe = $cavelist[tribe][$i];
        // the current tribe
        $tribelink = "<a href=\"main.php?modus=" . TRIBE_DETAIL . "&tribe=" . urlencode(unhtmlentities($tribe)) . "\" target=\"_blank\">";
        if ($tribe != "") {
            $tribe = "(" . $tribe . ")";
        }
        $playerName = "&nbsp;&nbsp;-&nbsp;&nbsp;<a href=\"main.php?modus=" . PLAYER_DETAIL . "&amp;detailID=" . $playerID . "\" target=\"_blank\">" . $playerName . "</a>";
        if ($playerID == 0) {
            $playerName = "";
        }
        $cavename = "<a href=\"main.php?modus=" . MAP_DETAIL . "&amp;targetCaveID=" . $caveID . "\" target=\"_blank\">" . $cavename . "</a>";
        $movementLink = "?modus=" . MOVEMENT . "&targetXCoord=" . $caveX . "&targetYCoord=" . $caveY . "&targetCaveName=" . unhtmlentities($cavelist[name][$i]);
        tmpl_iterate($template, '/CAVES');
        tmpl_set($template, "CAVES/alternate", $count++ % 2 ? "alternate" : "");
        tmpl_set($template, 'CAVES', array('cavename' => $cavename, 'tribe' => $tribe, 'playerName' => $playerName, 'tribelink' => $tribelink, 'movementLink' => $movementLink, 'caveID' => $caveID, 'caveX' => $caveX, 'caveY' => $caveY, 'modus_delete' => CAVE_BOOK_DELETE));
    }
    if (sizeof($cavelist) < 1) {
        tmpl_set($template, "NOCAVES/dummy", "");
    }
    return tmpl_parse($template);
}
Esempio n. 26
0
    tmpl_set($template, '/EFFECT/alternate', $count++ % 2 ? "alternate" : "");
    tmpl_set($template, '/EFFECT/text', $text . "faktor");
    tmpl_set($template, '/EFFECT/name', $effect++);
}
usort($unitTypeList, "nameCompare");
// Show the unit table
foreach ($unitTypeList as $unit) {
    if (!$unit->nodocumentation) {
        tmpl_iterate($template, '/UNIT');
        tmpl_set($template, 'UNIT', array('name' => $unit->name, 'unitID' => $unit->unitID));
    }
}
usort($defenseSystemTypeList, "nameCompare");
// Show the defenseSystem table
foreach ($defenseSystemTypeList as $defenseSystem) {
    if (!$defenseSystem->nodocumentation) {
        tmpl_iterate($template, '/DEFENSESYSTEM');
        tmpl_set($template, 'DEFENSESYSTEM', array('name' => $defenseSystem->name, 'defenseSystemID' => $defenseSystem->defenseSystemID));
    }
}
echo tmpl_parse($template);
function nameCompare($a, $b)
{
    return strcmp($a->name, $b->name);
}
?>




Esempio n. 27
0
function science_getScienceDetail($caveID, &$details)
{
    global $buildingTypeList, $defenseSystemTypeList, $resourceTypeList, $unitTypeList, $scienceTypeList, $config, $params, $db;
    // messages
    $messageText = array(0 => _('Der Forschungsauftrag wurde erfolgreich gestoppt.'), 1 => _('Es konnte kein Forschungsauftrag gestoppt werden.'), 2 => _('Der Auftrag konnte nicht erteilt werden. Es fehlen die notwendigen Voraussetzungen.'), 3 => _('Der Auftrag wurde erteilt'), 4 => _('Dieses Wissen wird schon in einer anderen Höhle erforscht.'), 5 => _('Es wird gerade in einer anderen Höhle Wissen erforscht, dass dieses Wissen ausschließt.'));
    // proccess a cancel-order request
    if (isset($params->POST->eventID)) {
        $messageID = science_processOrderCancel($params->POST->eventID, $caveID, $db);
    }
    if (isset($params->POST->scienceID)) {
        $messageID = science_processOrder($params->POST->scienceID, $caveID, $params->SESSION->player->playerID, $details, $db);
        $r = getCaveSecure($caveID, $params->SESSION->player->playerID);
        if ($r->isEmpty()) {
            page_dberror();
        }
        $details = $r->nextRow();
    }
    $queue = science_getScienceQueueForCave($params->SESSION->player->playerID, $caveID);
    $template = tmpl_open($params->SESSION->player->getTemplatePath() . 'science.ihtml');
    // Show a special message
    if (isset($messageID)) {
        tmpl_set($template, '/MESSAGE/message', $messageText[$messageID]);
    }
    // Show the science table
    for ($i = 0; $i < sizeof($scienceTypeList); $i++) {
        $science = $scienceTypeList[$i];
        // the current science
        $maxLevel = round(eval('return ' . formula_parseToPHP("{$science->maxLevel};", '$details')));
        $notenough = FALSE;
        $result = rules_checkDependencies($science, $details);
        if ($result === TRUE) {
            tmpl_iterate($template, 'SCIENCE');
            tmpl_set($template, "SCIENCE/alternate", $count++ % 2 ? "alternate" : "");
            tmpl_set($template, 'SCIENCE', array('dbFieldName' => $science->dbFieldName, 'name' => $science->name, 'scienceID' => $i, 'modus' => SCIENCE_DETAIL, 'caveID' => $caveID, 'size' => "0" + $details[$science->dbFieldName], 'time' => time_formatDuration(eval('return ' . formula_parseToPHP($science->productionTimeFunction . ";", '$details')) * SCIENCE_TIME_BASE_FACTOR)));
            // iterate ressourcecosts
            foreach ($science->resourceProductionCost as $resourceID => $function) {
                $cost = ceil(eval('return ' . formula_parseToPHP($function . ';', '$details')));
                if ($cost) {
                    tmpl_iterate($template, "SCIENCE/RESSOURCECOST");
                    if ($details[$resourceTypeList[$resourceID]->dbFieldName] >= $cost) {
                        tmpl_set($template, "SCIENCE/RESSOURCECOST/ENOUGH/value", $cost);
                    } else {
                        tmpl_set($template, "SCIENCE/RESSOURCECOST/LESS/value", $cost);
                        $notenough = TRUE;
                    }
                    tmpl_set($template, "SCIENCE/RESSOURCECOST/dbFieldName", $resourceTypeList[$resourceID]->dbFieldName);
                    tmpl_set($template, "SCIENCE/RESSOURCECOST/name", $resourceTypeList[$resourceID]->name);
                }
            }
            // iterate unitcosts
            foreach ($science->unitProductionCost as $unitID => $function) {
                $cost = ceil(eval('return ' . formula_parseToPHP($function . ';', '$details')));
                if ($cost) {
                    tmpl_iterate($template, "SCIENCE/UNITCOST");
                    if ($details[$unitTypeList[$unitID]->dbFieldName] >= $cost) {
                        tmpl_set($template, "SCIENCE/UNITCOST/ENOUGH/value", $cost);
                    } else {
                        tmpl_set($template, "SCIENCE/UNITCOST/LESS/value", $cost);
                        $notenough = TRUE;
                    }
                    tmpl_set($template, "SCIENCE/UNITCOST/name", $unitTypeList[$unitID]->name);
                }
            }
            // iterate buildingcosts
            foreach ($science->buildingProductionCost as $buildingID => $function) {
                $cost = ceil(eval('return ' . formula_parseToPHP($function . ';', '$details')));
                if ($cost) {
                    tmpl_iterate($template, "DEFENSESYSTEM/BUILDINGCOST");
                    if ($details[$buildingTypeList[$buildingID]->dbFieldName] >= $cost) {
                        tmpl_set($template, "DEFENSESYSTEM/BUILDINGCOST/ENOUGH/value", $cost);
                    } else {
                        tmpl_set($template, "DEFENSESYSTEM/BUILDINGCOST/LESS/value", $cost);
                        $notenough = TRUE;
                    }
                    tmpl_set($template, "DEFENSESYSTEM/BUILDINGCOST/name", $buildingTypeList[$buildingID]->name);
                }
            }
            // iterate externalcosts
            foreach ($science->externalProductionCost as $externalID => $function) {
                $cost = ceil(eval('return ' . formula_parseToPHP($function . ';', '$details')));
                if ($cost) {
                    tmpl_iterate($template, "DEFENSESYSTEM/EXTERNALCOST");
                    if ($details[$defenseSystemTypeList[$externalID]->dbFieldName] >= $cost) {
                        tmpl_set($template, "DEFENSESYSTEM/EXTERNALCOST/ENOUGH/value", $cost);
                    } else {
                        tmpl_set($template, "DEFENSESYSTEM/EXTERNALCOST/LESS/value", $cost);
                        $notenough = TRUE;
                    }
                    tmpl_set($template, "DEFENSESYSTEM/EXTERNALCOST/name", $defenseSystemTypeList[$externalID]->name);
                }
            }
            // show the science link ?!
            if ($queue) {
                tmpl_set($template, 'SCIENCE/RESEARCH_LINK_NO/message', _('Erforschung im Gange'));
            } else {
                if ($notenough && $maxLevel > $details[$science->dbFieldName]) {
                    tmpl_set($template, 'SCIENCE/RESEARCH_LINK_NO/message', _('Zu wenig Rohstoffe'));
                } else {
                    if ($maxLevel > $details[$science->dbFieldName]) {
                        tmpl_set($template, 'SCIENCE/RESEARCH_LINK', array('action' => SCIENCE, 'scienceID' => $science->scienceID, 'caveID' => $caveID));
                    } else {
                        tmpl_set($template, '/SCIENCE/RESEARCH_LINK_NO/message', _('Max. Stufe'));
                    }
                }
            }
        } else {
            if ($result !== FALSE && !$science->nodocumentation) {
                tmpl_iterate($template, '/UNQUALIFIEDSCIENCES/SCIENCE');
                tmpl_set($template, '/UNQUALIFIEDSCIENCES/SCIENCE', array('alternate' => $count_unqualified++ % 2 ? "" : "alternate", 'modus' => SCIENCE_DETAIL, 'scienceID' => $science->scienceID, 'caveID' => $caveID, 'dbFieldName' => $science->dbFieldName, 'name' => $science->name, 'dependencies' => $result));
            }
        }
    }
    // Show the science queue
    if ($queue) {
        // display the science queue
        $row = $queue->nextRow();
        tmpl_set($template, 'SCIENCE_QUEUE', array('name' => $scienceTypeList[$row['scienceID']]->name, 'size' => $details[$scienceTypeList[$row['scienceID']]->dbFieldName] + 1, 'finish' => time_formatDatetime($row['end']), 'action' => SCIENCE, 'eventID' => $row['event_scienceID'], 'caveID' => $caveID));
    }
    tmpl_set($template, "rules_path", RULES_PATH);
    return tmpl_parse($template);
}
Esempio n. 28
0
usort($defenseSystemTypeList, "nameCompare");
foreach ($unitTypeList as $unit) {
    if (!$unit->nodocumentation) {
        tmpl_iterate($template, '/UNIT');
        tmpl_set($template, 'UNIT', get_object_vars($unit));
    }
}
foreach ($defenseSystemTypeList as $defenseSystem) {
    if (!$defenseSystem->nodocumentation) {
        tmpl_iterate($template, '/DEFENSESYSTEM');
        tmpl_set($template, 'DEFENSESYSTEM', get_object_vars($defenseSystem));
    }
}
$statsData = array("Fernangriff", "Geb&auml;udeschaden", "Get&uuml;mmelschaden", "Gr&ouml;&szlig;e");
for ($i = 0; $i < sizeof($statsData); $i++) {
    tmpl_iterate($template, '/STATS');
    tmpl_set($template, "/STATS/alternate", $count++ % 2 ? "alternate" : "");
    tmpl_set($template, "/STATS/text", $statsData[$i]);
    tmpl_set($template, "/STATS/defender", $output[$c++]);
    tmpl_set($template, "/STATS/attacker", $output[$c++]);
}
echo tmpl_parse($template);
function nameCompare($a, $b)
{
    return strcmp($a->name, $b->name);
}
?>



Esempio n. 29
0
function getCaveReport($meineHoehlen, $caveID, $targetCaveID, $playerID)
{
    global $params, $config, $terrainList;
    $cave = getCaveByID($targetCaveID);
    $caveDetails = array();
    $playerDetails = array();
    // ADDED by chris--- for Quests
    // ----------------------------------------------------------
    global $db;
    // checking if this cave is a quest cave and if its visible to the player (than he knows the quest)
    // if he does not know the quest the cave is invisible
    if (isCaveQuestCave($targetCaveID, $db) && isCaveInvisibleToPlayer($targetCaveID, $playerID, $db)) {
        $cave['playerID'] = 0;
    }
    // ----------------------------------------------------------
    if ($cave['playerID'] != 0) {
        $caveDetails = getCaves($cave['playerID']);
        $playerDetails = getPlayerFromID($cave['playerID']);
        // ADDED by chris--- for farmschutz
        if (FARMSCHUTZ_ACTIVE == 1) {
            $farmschutz = getFarmschutz($cave['playerID']);
        } else {
            $farmschutz = "";
        }
    }
    $template = @tmpl_open('./templates/' . $config->template_paths[$params->SESSION->user['template']] . '/mapdetail.ihtml');
    if ($cave['protected']) {
        tmpl_set($template, 'PROPERTY', 'Anf&auml;ngerschutz aktiv');
    }
    if (!$cave['secureCave'] && $cave['playerID']) {
        tmpl_iterate($template, 'PROPERTY');
        tmpl_set($template, 'PROPERTY', '&uuml;bernehmbar!');
    }
    // ADDED by chris--- for Quests --------------------------------------------------------------------------------
    if ($cave['quest_cave'] && !isCaveInvisibleToPlayer($cave['caveID'], $playerID, $db) && $cave['invisible_name'] != "") {
        $cave['name'] = $cave['invisible_name'];
    }
    // -------------------------------------------------------------------------------------------------------
    $addCaveLink = "?modus=" . CAVE_BOOK_ADD . "&amp;id=" . $targetCaveID;
    // ADDED by chris--- for cavebook
    tmpl_set($template, '/', array('cavename' => $cave['name'], 'xcoord' => $cave['xCoord'], 'ycoord' => $cave['yCoord'], 'terrain' => $terrainList[$cave['terrain']]['name'], 'movementlink' => "?modus=" . MOVEMENT . "&targetXCoord=" . $cave['xCoord'] . "&targetYCoord=" . $cave['yCoord'] . "&targetCaveName=" . unhtmlentities($cave['name']), 'backlink' => "?modus=" . MAP . "&xCoord=" . $cave['xCoord'] . "&yCoord=" . $cave['yCoord']));
    if ($cave['playerID'] != 0) {
        tmpl_set($template, '/OCCUPIED', array('playerLink' => "?modus=" . PLAYER_DETAIL . "&detailID=" . $playerDetails['playerID'], 'caveOwner' => $playerDetails['name'], 'farmschutz' => $farmschutz, 'adressbook_add_modus' => MESSAGE_BOOK_ADD, 'addCaveLink' => $addCaveLink));
        if ($playerDetails['tribe']) {
            tmpl_set($template, '/OCCUPIED/TRIBE', array('tribeLink' => "?modus=" . TRIBE_DETAIL . "&tribe=" . urlencode(unhtmlentities($playerDetails['tribe'])), 'ownersTribe' => $playerDetails['tribe']));
        }
        if ($cave['artefacts'] != 0 && ($playerDetails['tribe'] != GOD_ALLY || $params->SESSION->user['tribe'] == GOD_ALLY)) {
            tmpl_set($template, '/OCCUPIED/ARTEFACT/artefactLink', "?modus=" . ARTEFACT_LIST . "&caveID={$caveID}");
        }
        $caves = array();
        foreach ($caveDetails as $key => $value) {
            if (!(isCaveQuestCave($value['caveID'], $db) && isCaveInvisibleToPlayer($value['caveID'], $playerID, $db))) {
                $temp = array('caveName' => $value['name'], 'xCoord' => $value['xCoord'], 'ycoord' => $value['yCoord'], 'terrain' => $terrainList[$value['terrain']]['name'], 'caveSize' => floor($value[CAVE_SIZE_DB_FIELD] / 50) + 1, 'movementLink' => "?modus=" . MOVEMENT . "&targetXCoord=" . $value['xCoord'] . "&targetYCoord=" . $value['yCoord'] . "&targetCaveName=" . unhtmlentities($value['name']));
                if ($value['artefacts'] != 0 && ($playerDetails['tribe'] != GOD_ALLY || $params->SESSION->user['tribe'] == GOD_ALLY)) {
                    $temp['ARTEFACT'] = array('artefactLink' => "?modus=" . ARTEFACT_LIST . "&caveID={$caveID}");
                }
                if ($value['protected'] && $value['playerID']) {
                    $temp['PROPERTY'] = array('text' => 'Schutz');
                } else {
                    if (!$value['secureCave']) {
                        $temp['PROPERTY'] = array('text' => '&uuml;bernehmbar');
                    }
                }
                $caves[] = $temp;
            }
        }
        tmpl_set($template, '/OCCUPIED/CAVES', $caves);
    } else {
        if (sizeof($meineHoehlen) < $params->SESSION->user['takeover_max_caves'] && $cave['takeoverable'] == 1) {
            tmpl_set($template, 'TAKEOVERABLE', array('modus' => TAKEOVER, 'caveID' => $caveID, 'targetXCoord' => $cave['xCoord'], 'targetYCoord' => $cave['yCoord']));
        }
    }
    return tmpl_parse($template);
}
Esempio n. 30
0
function getCaveDetailsContent($details, $showGiveUp = TRUE, $alternate = FALSE)
{
    global $resourceTypeList, $buildingTypeList, $unitTypeList, $scienceTypeList, $defenseSystemTypeList, $params, $config, $db;
    // give this cave up
    if ($params->POST->caveGiveUpConfirm) {
        if (cave_giveUpCave($params->POST->giveUpCaveID, $params->SESSION->user['playerID'])) {
            return "<p><b>Sie haben sich aus dieser Siedlung zur&uuml;ckgezogen.</b>";
        } else {
            $message = "<p>Diese Siedlung kann nicht aufgegeben werden.</p>";
        }
        // end beginners protection
    } else {
        if ($params->POST->endProtectionConfirm) {
            if (beginner_endProtection($details['caveID'], $params->SESSION->user['playerID'], $db)) {
                $message = "<p><b>Sie haben den Anf&auml;ngerschutz abgeschaltet.</b>";
            } else {
                $message = "<p>Sie konnten den Anf&auml;ngerschutz nicht abschalten.</p>";
            }
        }
    }
    $widthCount = 10;
    $template = @tmpl_open('./templates/' . $config->template_paths[$params->SESSION->user['template']] . '/cave.ihtml');
    if ($message) {
        tmpl_set($template, "/MESSAGE/message", $message);
    }
    // fill give-up form
    if ($showGiveUp) {
        tmpl_context($template, "/GIVE_UP");
        tmpl_set($template, 'ARGUMENT', array(array('arg_name' => "giveUpCaveID", 'arg_value' => $details['caveID']), array('arg_name' => "modus", 'arg_value' => CAVE_GIVE_UP_CONFIRM)));
        tmpl_set($template, "text", "Siedlung " . $details['name'] . " aufgeben");
    }
    // fill end beginner protection form
    if ($details['protected']) {
        tmpl_iterate($template, "/GIVE_UP");
        tmpl_context($template, "/GIVE_UP");
        tmpl_iterate($template, "ARGUMENT");
        tmpl_set($template, "ARGUMENT/arg_name", "caveID");
        tmpl_set($template, "ARGUMENT/arg_value", $details['caveID']);
        tmpl_iterate($template, "ARGUMENT");
        tmpl_set($template, "ARGUMENT/arg_name", "modus");
        tmpl_set($template, "ARGUMENT/arg_value", END_PROTECTION_CONFIRM);
        tmpl_set($template, "text", "Anf&auml;ngerschutz vorzeitig beenden.");
    }
    // fill cave info template
    tmpl_context($template, $alternate ? "/CAVE_ALTERNATE" : "/CAVE");
    if ($details['protected']) {
        tmpl_set($template, "PROPERTY/text", 'Anf&auml;ngerschutz aktiv');
    }
    if (!$details['secureCave']) {
        tmpl_iterate($template, "PROPERTY");
        tmpl_set($template, "PROPERTY/text", '&uuml;bernehmbar');
    }
    if ($details['starting_position'] > 0) {
        tmpl_iterate($template, "PROPERTY");
        tmpl_set($template, "PROPERTY/text", 'Hauptsiedlung');
    }
    tmpl_set($template, 'caveID', $details['caveID']);
    tmpl_set($template, 'name', $details['name']);
    tmpl_set($template, 'xCoord', $details['xCoord']);
    tmpl_set($template, 'yCoord', $details['yCoord']);
    // RESOURCES AUSFUELLEN
    $resources = array();
    for ($i = 0; $i < sizeof($resourceTypeList); ++$i) {
        $resources[] = array('file' => $resourceTypeList[$i]->dbFieldName, 'name' => $resourceTypeList[$i]->name, 'value' => $details[$resourceTypeList[$i]->dbFieldName]);
    }
    if (sizeof($resources)) {
        tmpl_set($template, 'RESOURCES/RESOURCE', $resources);
    }
    // UNITS AUSFUELLEN
    $units = array();
    for ($i = 0; $i < sizeof($unitTypeList); ++$i) {
        $value = $details[$unitTypeList[$i]->dbFieldName];
        if ($value != 0) {
            $units[] = array('file' => $unitTypeList[$i]->dbFieldName, 'name' => $unitTypeList[$i]->name, 'value' => $value);
        }
    }
    if (sizeof($units)) {
        tmpl_set($template, 'UNITS/UNIT', $units);
    }
    // BUILDINGS AUSFUELLEN
    $addons = array();
    for ($i = 0; $i < sizeof($buildingTypeList); ++$i) {
        $value = $details[$buildingTypeList[$i]->dbFieldName];
        if ($value != 0) {
            $addons[] = array('file' => $buildingTypeList[$i]->dbFieldName, 'name' => $buildingTypeList[$i]->name, 'value' => $value);
        }
    }
    if (sizeof($addons)) {
        tmpl_set($template, 'BUILDINGS/BUILDING', $addons);
    }
    // VERTEIDIGUNG AUSFUELLEN
    $defense = array();
    for ($i = 0; $i < sizeof($defenseSystemTypeList); ++$i) {
        $value = $details[$defenseSystemTypeList[$i]->dbFieldName];
        if ($value != 0) {
            $defense[] = array('file' => $defenseSystemTypeList[$i]->dbFieldName, 'name' => $defenseSystemTypeList[$i]->name, 'value' => $value);
        }
    }
    if (sizeof($defense)) {
        tmpl_set($template, 'DEFENSES/DEFENSE', $defense);
    }
    return tmpl_parse($template);
}