This repository has been archived on 2022-03-01. You can view files and clone it, but cannot push or open issues or pull requests.
FS22_Webstats/missions.php

99 lines
3.7 KiB
PHP

<?php
file_get_contents('server.php');
require_once 'include/missions_func.php';
$dir = 'styles/fs19webstats/css/';
$files = scandir($dir);
foreach($files as $file){
if($file === '.' || $file === '..')continue;
$file = $dir.$file;
echo '<link rel="stylesheet" type="text/css" href="'.$file.'">';
}
$defaultStyle = 'fs19webstats';
ini_set('display_errors',1);
error_reporting(E_ALL);
session_start ();
$_SESSION ['language'] = 'en';
define ( 'IN_FS19WS', true );
require ('./include/smarty/Smarty.class.php');
require ('./include/language.php');
require_once ('./include/functions.php');
require ('./include/NavItems.class.php');
include ('./include/coockie.php');
$style = $options ['general'] ['style'];
$smarty = new Smarty ();
$smarty->debugging = false;
$smarty->caching = false;
include ('./include/loadConfig.php');
$smarty->assign ( 'onlineUser', sizeof ( $onlineUser ) );
$smarty->assign ( 'hideFooter', $options ['general'] ['hideFooter'] );
include ('./include/savegame/Savegame.class.php');
$savegame = new Savegame ( $webStatsConfig, $_SESSION ['farmId'] );
$smarty->assign ( 'currentDay', $savegame->currentDay );
$smarty->assign ( 'dayTime', $savegame->dayTime );
$smarty->assign ( 'money', $savegame->getFarmMoney ( $_SESSION ['farmId'] ) );
include ('./include/savegame/Missions.class.php');
Mission::extractXML ( $savegame->getXML ( 'missions' ) );
$missions = Mission::getAllMissions ();
include ('./include/savegame/Farm.class.php');
Farm::extractXML ( $savegame::$xml );
$farms = Farm::getAllFarms ();
$smarty->assign ( 'missions', $missions );
$smarty->assign ( 'farms', $farms );
$jsonFarmNames = 'farmNames.json';
$json = json_encode($farms);
$json = file_put_contents($jsonFarmNames,$json);
?>
<div class="container">
<?php
$jsonFileName = 'missions.json';
//$jsonMissionFile = [$field,$type,$reward,$cost,$status];
$json = json_encode($missions);
$json = file_put_contents($jsonFileName,$json);
$i = 0;
echo "```ini<br>";
echo 'Current Date: '. $savegame->currentDay . '<br>';
foreach($missions as $name => $val):
$mission = $missions[$name];
$field = $mission['field'];
$type = $mission['type'];
$fruit = $mission['fruitTypeName'];
$type = translateAssignment($type);
$type = missionType($type,$fruit);
$reward = number_format($mission['reward'],0);
$status = $mission['status'];
$status = $status > 0 ? status($status) . ' by ['. getFarmName($mission['farmId'], $jsonFarmNames) . ']' : status($status);
$cost = number_format($mission['vehicleUseCost'],0);
$equipment = number_format($mission['reward'] - $mission['vehicleUseCost'],0);
$text = "[F$field] $type - $$reward ($$cost)$status<br>";
echo $text;
?>
<?php endforeach;echo "```";?>
</div>
<?php
/* echo '<pre>';
print_r($farmNames);
echo '</pre>';
endforeach; */
?>