Пример #1
0
function quest_getQuestDetails($questID, $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']] . '/quest_details.ihtml');
    $data = array();
    // checking if the given quest is really known to the given player
    if (!questKnownByPlayer($questID, $playerID, $db)) {
        $data['QUESTNOTKNOWN'] = array('dummy' => "");
        tmpl_set($template, "/", $data);
        return tmpl_parse($template);
    }
    $data['QUESTKNOWN'] = array("title" => getQuestTitle($questID, $db), "description" => getQuestDescription($questID, $db), "todo" => getQuestToDo($questID, $db));
    // checking if the given quest is aborted to the given player
    if (questAbortedToPlayer($questID, $playerID, $db)) {
        $data['QUESTABORTED'] = array('message' => getQuestAbortMsg($questID, $db));
    }
    tmpl_set($template, "/", $data);
    return tmpl_parse($template);
}
Пример #2
0
function quest_getQuestOverview($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']] . '/quest.ihtml');
    // Getting the active quests
    $activeQuests = getActiveQuests($playerID, $db);
    if ($activeQuests) {
        $activeQuestsData = array();
        foreach ($activeQuests as $key => $data) {
            $activeQuestsData[] = array("title" => getQuestTitle($data['questID'], $db), "description" => getQuestToDo($data['questID'], $db), "questID" => $data['questID'], "playerID" => $playerID, "modus" => QUEST_DETAIL);
        }
    }
    // Getting the successful quests
    $succeededQuests = getSucceededQuests($playerID, $db);
    if ($succeededQuests) {
        $succeededQuestsData = array();
        foreach ($succeededQuests as $key => $data) {
            $succeededQuestsData[] = array("title" => getQuestTitle($data['questID'], $db), "description" => getQuestToDo($data['questID'], $db), "questID" => $data['questID'], "playerID" => $playerID, "modus" => QUEST_DETAIL);
        }
    }
    // Getting the failed quests
    $failedQuests = getFailedQuests($playerID, $db);
    if ($failedQuests) {
        $failedQuestsData = array();
        foreach ($failedQuests as $key => $data) {
            $failedQuestsData[] = array("title" => getQuestTitle($data['questID'], $db), "description" => getQuestToDo($data['questID'], $db), "questID" => $data['questID'], "playerID" => $playerID, "modus" => QUEST_DETAIL);
        }
    }
    // Getting the aborted quests
    $abortedQuests = getAbortedQuests($playerID, $db);
    if ($abortedQuests) {
        $abortedQuestsData = array();
        foreach ($abortedQuests as $key => $data) {
            $abortedQuestsData[] = array("title" => getQuestTitle($data['questID'], $db), "description" => getQuestAbortMsg($data['questID'], $db), "questID" => $data['questID'], "playerID" => $playerID, "modus" => QUEST_DETAIL);
        }
    }
    // Templating
    $data = array();
    if (!sizeof($activeQuestsData)) {
        $data['NOACTIVEQUESTS'] = array('dummy' => "");
    } else {
        $data['ACTIVEQUESTS'] = $activeQuestsData;
        tmpl_iterate($template, 'ACTIVEQUESTS');
    }
    if (!sizeof($succeededQuestsData)) {
        $data['NOWONQUESTS'] = array('dummy' => "");
    } else {
        $data['WONQUESTS'] = $succeededQuestsData;
        tmpl_iterate($template, 'WONQUESTS');
    }
    if (!sizeof($failedQuestsData)) {
        $data['NOFAILEDQUESTS'] = array('dummy' => "");
    } else {
        $data['FAILEDQUESTS'] = $failedQuestsData;
        tmpl_iterate($template, 'FAILEDQUESTS');
    }
    if (!sizeof($abortedQuestsData)) {
        $data['NOABORTEDQUESTS'] = array('dummy' => "");
    } else {
        $data['ABORTEDQUESTS'] = $abortedQuestsData;
        tmpl_iterate($template, 'ABORTEDQUESTS');
    }
    $data['LINK'] = array('link' => "?modus=" . QUEST_HELP);
    tmpl_set($template, "/", $data);
    return tmpl_parse($template);
}