public function actionImage($date)
 {
     $changes = KFile::readJSON('data/master/' . $date . '/changes.json');
     $stypes = KFile::readJSON('data/master/' . $date . '/stype/_summary.json');
     $slotitems = KFile::readJSON('data/master/' . $date . '/slotitem/_summary.json');
     $this->layout = '';
     $this->render('decodes.views.image', array('date' => $date, 'changes' => $changes, 'stypes' => $stypes, 'slotitems' => $slotitems, 'speeds' => array(0 => "N/A", 5 => "Slow", 10 => "Fast"), 'ranges' => array("N/A", "Short", "Medium", "Long", "Very Long"), 'rarity' => array("", "SkyBlue", "SkyBlue", "Cyan", "Silver", "Gold", "Violet", "Violet", "Violet")));
 }
 public function actionIndex()
 {
     $db = Yii::app()->db;
     $latest = $db->createCommand("SELECT rb.*,u.username FROM report_build rb, user u WHERE rb.user=u.id ORDER BY created DESC LIMIT 0,25")->queryAll();
     $this->pagetitle = 'Construction';
     Yii::app()->params['pageName'] = 'Construction';
     Yii::app()->clientScript->registerCssFile($this->module->getAssetsUrl() . '/css/home.css');
     $this->render('build.views.home', array('latest' => $latest, 'shipNames' => KFile::readJSON('data/json/shipName.json')));
 }
Example #3
0
 public function custom($type, $JP)
 {
     if (!isset(Yii::app()->params['custom_TL_' . $type])) {
         Yii::app()->params['custom_TL_' . $type] = KFile::readJSON('data/json/' . $type . '.json');
     }
     if (isset(Yii::app()->params['custom_TL_' . $type]->{$JP})) {
         return Yii::app()->params['custom_TL_' . $type]->{$JP};
     } else {
         return false;
     }
 }
 public function actionIndex($german = false)
 {
     $start = '2014-07-04';
     $minReport = 100;
     $db = Yii::app()->db;
     if ($german) {
         $recipes = $db->createCommand("SELECT CONCAT(res1,'/',res2,'/',res3,'/',res4,'/',devmats) AS recipe, COUNT(*) as reports FROM `report_build` WHERE created>='" . $start . "' AND res1>0 AND res2>0 AND res3>0 AND res4>0 AND devmats>0 AND flag_id IN (174,310,179,175,311,180) GROUP BY recipe HAVING reports>" . $minReport . " ORDER BY reports DESC LIMIT 0,20")->queryAll();
     } else {
         $recipes = $db->createCommand("SELECT CONCAT(res1,'/',res2,'/',res3,'/',res4,'/',devmats) AS recipe, COUNT(*) as reports FROM `report_build` WHERE created>='" . $start . "' AND res1>0 AND res2>0 AND res3>0 AND res4>0 AND devmats>0 AND flag_id NOT IN (174,310,179,175,311,180) GROUP BY recipe HAVING reports>" . $minReport . "  ORDER BY reports DESC LIMIT 0,20")->queryAll();
     }
     $recipeList = array();
     $summary = array();
     foreach ($recipes as $recipe) {
         $recipeList[] = $recipe['recipe'];
         $summary[$recipe['recipe']] = array('count' => $recipe['reports'], 'ships' => array());
     }
     if ($german) {
         $reportShips = $db->createCommand("SELECT CONCAT(res1,'/',res2,'/',res3,'/',res4,'/',devmats) AS recipe, result, COUNT(result) as reports FROM `report_build` WHERE created>='" . $start . "' AND res1>0 AND res2>0 AND res3>0 AND res4>0 AND devmats>0 AND flag_id IN (174,310,179,175,311,180) GROUP BY recipe,result HAVING recipe IN ('" . implode("','", $recipeList) . "')")->queryAll();
     } else {
         $reportShips = $db->createCommand("SELECT CONCAT(res1,'/',res2,'/',res3,'/',res4,'/',devmats) AS recipe, result, COUNT(result) as reports FROM `report_build` WHERE created>='" . $start . "' AND res1>0 AND res2>0 AND res3>0 AND res4>0 AND devmats>0 AND flag_id NOT IN (174,310,179,175,311,180) GROUP BY recipe,result HAVING recipe IN ('" . implode("','", $recipeList) . "')")->queryAll();
     }
     $shipNames = KFile::readJSON('data/json/shipName.json');
     $shipColors = KFile::readJSON('data/json/shipColors.json');
     $merges = array('78' => array('id' => 501, 'name' => 'Kongo-class', 'color' => '#7A7777'), '79' => array('id' => 501, 'name' => 'Kongo-class', 'color' => '#7A7777'), '85' => array('id' => 501, 'name' => 'Kongo-class', 'color' => '#7A7777'), '86' => array('id' => 501, 'name' => 'Kongo-class', 'color' => '#7A7777'), '74' => array('id' => 502, 'name' => 'CVL', 'color' => '#928484'), '75' => array('id' => 502, 'name' => 'CVL', 'color' => '#928484'), '76' => array('id' => 502, 'name' => 'CVL', 'color' => '#928484'), '92' => array('id' => 502, 'name' => 'CVL', 'color' => '#928484'), '26' => array('id' => 503, 'name' => 'BBV', 'color' => '#928484'), '27' => array('id' => 503, 'name' => 'BBV', 'color' => '#928484'), '77' => array('id' => 503, 'name' => 'BBV', 'color' => '#928484'), '87' => array('id' => 503, 'name' => 'BBV', 'color' => '#928484'), '71' => array('id' => 503, 'name' => 'CA', 'color' => '#5C5C5C'), '72' => array('id' => 503, 'name' => 'CA', 'color' => '#5C5C5C'));
     foreach ($reportShips as $index => $reportShip) {
         if (isset($merges[$reportShip['result']])) {
             $mergeData = $merges[$reportShip['result']];
             if (!isset($summary[$reportShip['recipe']]['ships'][$mergeData['id']])) {
                 $summary[$reportShip['recipe']]['ships'][$mergeData['id']] = array('name' => $mergeData['name'], 'reports' => 0, 'percent' => 0, 'color' => $mergeData['color']);
             }
             $summary[$reportShip['recipe']]['ships'][$mergeData['id']]['reports'] += $reportShip['reports'];
             $summary[$reportShip['recipe']]['ships'][$mergeData['id']]['percent'] += $reportShip['reports'] / $summary[$reportShip['recipe']]['count'] * 100;
         } else {
             $summary[$reportShip['recipe']]['ships'][$reportShip['result']] = array('name' => $shipNames->{$reportShip['result']}, 'reports' => $reportShip['reports'], 'percent' => $reportShip['reports'] / $summary[$reportShip['recipe']]['count'] * 100, 'color' => $shipColors[$reportShip['result']]);
         }
     }
     foreach ($recipes as $recipe) {
         $shipList =& $summary[$recipe['recipe']]['ships'];
         // usort($shipList,"cmp");
         if (isset($shipList['153'])) {
             $shipList = array('153' => $shipList['153']) + $shipList;
         }
         if (isset($shipList['131'])) {
             $shipList = array('131' => $shipList['131']) + $shipList;
         }
     }
     Yii::app()->theme = 'blank';
     Yii::app()->clientScript->registerCssFile($this->module->getAssetsUrl() . '/css/graph.css');
     $this->render('build.views.graph', array('summary' => $summary, 'german' => $german, 'date_start' => $start == '0000-00-00' ? 'ever since' : $start));
 }
Example #5
0
 public static function scanShip($date)
 {
     foreach (array_reverse(KFile::getVersions()) as $version) {
         if ($date != $version) {
             $current = $version;
             break;
         }
     }
     $allShip = KFile::readJSON('data/master/' . $date . '/ship/_raw.json');
     $remodelPointers = array();
     foreach ($allShip as $oneShip) {
         $remodelPointers[@$oneShip->api_aftershipid] = true;
     }
     $_fresh = array();
     $_remodel = array();
     $_updated = array();
     $_abyss = array();
     $records = glob('data/master/' . $date . '/ship/*');
     foreach ($records as $recordFile) {
         $jsonFile = array_pop(explode('/', $recordFile));
         if (!in_array($jsonFile, array('_raw.json', '_summary.json', '_classes.json'))) {
             $oldCounterpart = 'data/master/' . $current . '/ship/' . $jsonFile;
             if (file_exists($oldCounterpart)) {
                 if (md5_file($recordFile) != md5_file($oldCounterpart)) {
                     $newContents = KFile::readJSON($recordFile);
                     $oldContents = KFile::readJSON($oldCounterpart);
                     $_updated[] = self::compareRecords($newContents, $oldContents);
                 }
             } else {
                 $thisData = KFile::readJSON($recordFile);
                 if (isset($remodelPointers[$thisData->api_id])) {
                     $_remodel[] = $thisData;
                 } else {
                     if (@$thisData->api_buildtime > 0) {
                         $_fresh[] = $thisData;
                     } else {
                         $_abyss[] = $thisData;
                     }
                 }
             }
         }
     }
     return array('ship' => array('fresh' => $_fresh, 'remodel' => $_remodel, 'updated' => $_updated, 'abyss' => $_abyss));
 }
Example #6
0
	<div id="luacode">
<textarea>
local <?php 
echo $english;
?>
 = {
<?php 
$ctr = 0;
$BaseForm = $shipData;
do {
    $this->renderPartial('decodes.views.extra.LuaPart', array('model' => $models[$ctr], 'shipData' => $shipData, 'allItems' => $allItems));
    if ($shipData->api_aftershipid > 0) {
        if (file_exists('data/master/' . $date . '/ship/' . $shipData->api_aftershipid . '.json')) {
            $shipData = KFile::readJSON('data/master/' . $date . '/ship/' . $shipData->api_aftershipid . '.json');
        } else {
            $shipData = KFile::readJSON('data/master/' . $mdate . '/ship/' . $shipData->api_aftershipid . '.json');
        }
    } else {
        $shipData = false;
    }
    $ctr++;
} while ($shipData);
?>
	class = {
		_name = "<?php 
echo $this->cond($BaseForm->ctype_name, '?');
?>
",
		_class = <?php 
echo $this->cond($BaseForm->api_cnum, '0', true) == 1 ? 'true' : 'false';
?>
Example #7
0
}
?>


<?php 
if (count($changes->ship->ship->remodel)) {
    ?>
<div class="sectionHead">Remodels</div>
<div class="sectionBody">
	<?php 
    foreach ($changes->ship->ship->remodel as $ship) {
        $firstName = explode(" ", $ship->english);
        $firstName = $firstName[0];
        $shipgraph = KFile::readJSON('data/master/' . $date . '/shipgraph/' . $ship->api_id . '.json');
        $filename = 'http://125.6.184.15/kcs/resources/swf/ships/' . $shipgraph->api_filename . '.swf?VERSION=1';
        KFile::ensureCG($ship->api_id, $shipgraph->api_filename);
        $equips = array(@$ship->api_defeq[0] > -1 ? $slotitems->{@$ship->api_defeq[0]} : false, @$ship->api_defeq[1] > -1 ? $slotitems->{@$ship->api_defeq[1]} : false, @$ship->api_defeq[2] > -1 ? $slotitems->{@$ship->api_defeq[2]} : false, @$ship->api_defeq[3] > -1 ? $slotitems->{@$ship->api_defeq[3]} : false);
        $MaxAircraft = $ship->api_maxeq[0] + $ship->api_maxeq[1] + $ship->api_maxeq[2] + $ship->api_maxeq[3];
        ?>
	<div class="remodel_ship">
		<div class="ship_cg"><img src="<?php 
        echo Yii::app()->baseUrl;
        ?>
/images/<?php 
        echo $ship->api_id;
        ?>
.jpg" /></div>
		<div class="ship_title">
			<div class="ship_ID"><?php 
        echo $ship->api_id;
        ?>
 public function actionVoicecheck()
 {
     $this->layout = 'listing';
     Yii::app()->clientScript->registerCssFile($this->module->getAssetsUrl() . '/css/listing.css');
     $versions = KFile::getVersions();
     $mdate = $versions[count($versions) - 1];
     $allGraphs = KFile::readJSON('data/master/' . $mdate . '/shipgraph/_raw.json');
     $graphIndexed = array();
     foreach ($allGraphs as $allGraph) {
         $graphIndexed[$allGraph->api_id] = $allGraph->api_filename;
     }
     if (isset($_REQUEST['checkdate'])) {
         $checkdate = $_REQUEST['checkdate'];
     } else {
         $tz = new DateTimeZone('Asia/Tokyo');
         $date = new DateTime();
         $date->setTimezone($tz);
         $checkdate = $date->format('Y-m-d');
     }
     if (file_exists('data/voices/dates/' . $checkdate . '.json')) {
         $changes = KFile::readJSON('data/voices/dates/' . $checkdate . '.json');
     } else {
         $changes = array();
     }
     $this->render('decodes.views.extra.VoiceCheck', array('date' => $mdate, 'ships' => KFile::readJSON('data/master/' . $mdate . '/ship/_summary.json'), 'graphs' => $graphIndexed, 'checkdate' => $checkdate, 'changes' => $changes));
 }
Example #9
0
			<?php 
if (!file_exists('data/master/' . date("Y-m-d_H-i") . '/raw.json') && isset($_REQUEST['SHOWDL'])) {
    ?>
			<a href="<?php 
    echo Yii::app()->createUrl('decodes/add/download');
    ?>
">
			<div class="master master_add"><div>+ Add new version</div></div></a>
			
			<div class="master_separator"></div>
			<?php 
}
?>
			
			<?php 
foreach (array_reverse(KFile::getVersions()) as $master) {
    ?>
				<a href="<?php 
    echo Yii::app()->createUrl('decodes/view/index', array('date' => $master));
    ?>
">
				<div class="master master_ver<?php 
    if (Yii::app()->params['activeVersion'] == $master) {
        echo ' master_active';
    }
    ?>
"><div>
					<?php 
    echo $master;
    ?>
				</div></div></a>
 public function actionIndex($date, $master, $id)
 {
     $data = KFile::readJSON('data/master/' . $date . '/' . $master . '/' . $id . '.json');
     $labels = KFile::readJSON('data/json/fieldNames.json');
     $this->render('decodes.views.record', array('labels' => $labels, 'data' => $data));
 }
Example #11
0
 public static function parseShip($date, $masterData)
 {
     $_notes = array();
     $_summary = array();
     $_ID = array();
     $_classes = array();
     $_cnameBlacklist = array();
     // echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';
     // create array with ID indexes
     foreach ($masterData as &$record) {
         $_ID[$record->api_id] =& $record;
         if (@$record->api_aftershipid > 0) {
             $_cnameBlacklist[] = $record->api_aftershipid;
         }
     }
     // note-taking
     foreach ($masterData as &$record) {
         // if not "none", is not abyss, and is not SantaNaka
         if ($record->api_name != 'なし' && $record->api_name != 'S那珂' && $record->api_name != '') {
             // initialize record entry if not exists
             if (!isset($_notes[$record->api_id])) {
                 $_notes[$record->api_id] = array();
             }
             // add english name
             $record->english = KTranslate::t($record->api_name);
             // note if i'm a name-ship, add my name to classes
             if (@$record->api_cnum == 1 && !in_array($record->api_id, $_cnameBlacklist) && $record->api_buildtime > 0) {
                 $_classes[@$record->api_ctype] = array('id' => $record->api_ctype, 'name' => $record->api_name, 'english' => $record->english);
             }
             // note I'm your before remodel
             if (@$record->api_aftershipid > 0) {
                 $_notes[$record->api_aftershipid]['remodel_before'] = 1;
                 $_notes[$record->api_aftershipid]['remodel_fuel'] = 1;
                 $_notes[$record->api_aftershipid]['remodel_ammo'] = 1;
                 $_notes[$record->api_aftershipid]['remodel_level'] = 1;
             }
             // set remodel num if not set
             if (!isset($_notes[$record->api_id]['remodel_stage'])) {
                 $_notes[$record->api_id]['remodel_stage'] = 1;
             }
             // tread remodel line
             /*$currentPlus = $_ID[$record->api_id];
             		while(@$currentPlus->api_aftershipid>0){
             			// increment remodel stage
             			if(!isset($_notes[$currentPlus->api_aftershipid]['remodel_stage'])){
             				$_notes[$currentPlus->api_aftershipid]['remodel_stage'] = 0;
             			}
             			$_notes[$currentPlus->api_aftershipid]['remodel_stage'] += 1;
             			
             			// set next-remodel as current to continue loop
             			$currentPlus = $_ID[$currentPlus->api_aftershipid];
             		}*/
         }
     }
     // record compilation
     foreach ($masterData as &$record) {
         // if not "none", and is not SantaNaka
         if ($record->api_name != 'なし' && $record->api_name != 'S那珂' && $record->api_name != '') {
             // must not end with * = fleet of fog which can be removed anytime to not affect future decodes
             if (mb_substr($record->api_name, -1, 1, "utf-8") != "*") {
                 // add class name
                 if (isset($_classes[@$record->api_ctype])) {
                     $record->ctype_name = $_classes[$record->api_ctype]['english'];
                 } else {
                     $record->ctype_name = '???';
                 }
                 // add base ship model identifiers
                 if ($_notes[$record->api_id]['remodel_stage'] == 0) {
                     // set base to self
                     $_notes[$record->api_id]['base_id'] = $record->api_id;
                     $_notes[$record->api_id]['base_JP'] = $record->api_name;
                     $_notes[$record->api_id]['base_EN'] = $record->english;
                     $_notes[$record->api_id]['base_stats'] = KFile::mapStats($record);
                     // set base to remodels
                     $currentPlus = $_ID[$record->api_id];
                     while (@$currentPlus->api_aftershipid > 0) {
                         $_notes[$currentPlus->api_aftershipid]['base_id'] = $record->api_id;
                         $_notes[$currentPlus->api_aftershipid]['base_JP'] = $record->api_name;
                         $_notes[$currentPlus->api_aftershipid]['base_EN'] = $record->english;
                         $_notes[$currentPlus->api_aftershipid]['base_stats'] = KFile::mapStats($record);
                         // set next-remodel as current to continue loop
                         $currentPlus = $_ID[$currentPlus->api_aftershipid];
                     }
                 }
                 // take highest remodel stats of the same card number
                 $_notes[$record->api_id]['HKai_stats'] = KFile::mapStats($record);
                 $curShip = $_ID[$record->api_id];
                 /*while(@$curShip->api_aftershipid>0){
                 			$myRemodel = $_ID[$curShip->api_aftershipid];
                 			
                 			// must not be a library item
                 			if($myRemodel->api_sortno>300){
                 				$_notes[$record->api_id]['HKai_stats'] = KFile::mapStats($myRemodel);
                 			}
                 			
                 			// set next-remodel as current to continue loop
                 			$curShip = $_ID[$curShip->api_aftershipid];
                 		}*/
                 // add to summary
                 $_summary[] = array('id' => $record->api_id, 'sortno' => @$record->api_sortno, 'name' => $record->api_name, 'english' => $record->english, 'rarity' => @$record->api_backs, 'stype' => $record->api_stype, 'isLib' => @$record->api_sortno < 300, 'isBase' => @$_notes[$record->api_id]['base_id'] == $record->api_id, 'fuel' => @$record->api_fuel_max, 'ammo' => @$record->api_bull_max, 'build' => @$record->api_buildtime);
                 $record->remodel_before = @$_notes[$record->api_id]['remodel_before'];
                 $record->remodel_fuel = @$_notes[$record->api_id]['remodel_fuel'];
                 $record->remodel_ammo = @$_notes[$record->api_id]['remodel_ammo'];
                 $record->remodel_level = @$_notes[$record->api_id]['remodel_level'];
                 $record->remodel_stage = @$_notes[$record->api_id]['remodel_stage'];
                 // create record file
                 file_put_contents('data/master/' . $date . '/ship/' . $record->api_id . '.json', json_encode($record));
             }
         }
     }
     // save _summary file
     file_put_contents('data/master/' . $date . '/ship/_summary.json', json_encode($_summary));
     // save ship classes
     file_put_contents('data/master/' . $date . '/ship/_classes.json', json_encode($_classes));
 }
 public function actionShips()
 {
     $versions = KFile::getVersions();
     $date = $versions[count($versions) - 1];
     $ships = KFile::readJSON('data/master/' . $date . '/ship/_summary.json');
     foreach ($ships as $ship) {
         // if($ship->isBase && $ship->build>0){
         if ($ship->build > 0) {
             $shipData = KFile::readJSON('data/master/' . $date . '/ship/' . $ship->id . '.json');
             // print_r($shipData);
             // if($ship->rarity<4 && $ship->stype==2){
             // echo '('.$ship->id.', "'.$ship->english.'",'.$ship->stype.'),<br />';
             // echo '"'.strtolower($ship->english).'":'.$ship->id.',<br />';
             // echo '('.$ship->id.', "'.$ship->english.'", '.$ship->stype.', '.$shipData->api_afterlv.', '.$shipData->api_aftershipid.'),<br />';//.'	'.$ship->english.'<br />';
             echo $ship->english . '<br />';
             // }
         }
         // }
     }
 }