Example #1
0
File: main.php Project: norter/Game
}
// init tutorial
$tutorial = new Tutorial();
$tutorialFinish = $tutorial->checkFinish($ownCaves[$caveID]);
if (!$tutorial->noTutorial) {
    if ($tutorialFinish && Request::isPost('nextTutorial')) {
        $tutorial->setFinish($ownCaves[$caveID]);
        $tutorialFinish = $tutorial->checkFinish($ownCaves[$caveID]);
    }
    $template->addVar('tutorial', array('show' => true, 'content' => $tutorialFinish ? $tutorial->finishMsg : $tutorial->startMsg, 'finish' => $tutorialFinish, 'open' => $tutorialFinish || Request::isPost('nextTutorial') ? 'true' : 'false'));
} else {
    $template->addVar('tutorial', array('show' => false));
}
// prepare resource bar
$resources = array();
if ($template->getShowRresource() && isset($resourceTypeList)) {
    foreach ($resourceTypeList as $resource) {
        $amount = floor($ownCaves[$caveID][$resource->dbFieldName]);
        if (!$resource->nodocumentation || $amount > 0) {
            $delta = $ownCaves[$caveID][$resource->dbFieldName . "_delta"];
            if ($delta > 0) {
                $delta = "+" . $delta;
            }
            $resources['resources'][] = array('dbFieldName' => $resource->dbFieldName, 'name' => $resource->name, 'amount' => $amount, 'delta' => $delta, 'safe_storage' => round(eval('return ' . formula_parseToPHP("{$resource->saveStorage};", '$ownCaves[$caveID]'))), 'max_level' => round(eval('return ' . formula_parseToPHP("{$resource->maxLevel};", '$ownCaves[$caveID]'))));
        }
    }
    $template->addVars($resources);
}
// prepare new mail
$newMessageCount = messages_main($caveID, $ownCaves);
// set time