Ejemplo n.º 1
0
 public function getCrawl()
 {
     $downloaded = 0;
     $items = FileHandler::get_data('Item');
     $libra_base = 'http://img.finalfantasyxiv.com/lds/pc/global/images/itemicon/';
     $img_path = base_path() . '/resources/assets/images/items/';
     $nq_scandir = array_diff(scandir($img_path . 'nq/'), array('.', '..'));
     $hq_scandir = array_diff(scandir($img_path . 'hq/'), array('.', '..'));
     foreach ($items as $item) {
         foreach (['nq', 'hq'] as $q) {
             if (is_null($item->icon->{$q})) {
                 continue;
             }
             // $item->icon->$q == a6/a6586ae9dc19681d22f43aa1f3fdd6d9d104d4fc.png
             $filename = $item->id . '.png';
             $scandir =& ${$q . '_scandir'};
             if (in_array($filename, $scandir)) {
                 continue;
             }
             // echo 'Downloading ' . $png . '<br>';
             $downloaded++;
             $ch = curl_init();
             curl_setopt($ch, CURLOPT_URL, $libra_base . $item->icon->{$q});
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
             curl_setopt($ch, CURLOPT_USERAGENT, 'Libra Eorzea');
             $output = curl_exec($ch);
             curl_close($ch);
             // echo 'Saving as ' . $img_path . $q . '/' . $filename . '<br>';
             file_put_contents($img_path . $q . '/' . $filename, $output);
         }
     }
     flash()->message('Icons downloader finished.  Saved ' . $downloaded . ' files');
     return redirect('/osmose');
 }
Ejemplo n.º 2
0
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     // the app_data table only has one row anyway
     $app_data = AppData::first();
     $tables = array_flip(['ClassJob', 'ClassJobCategory', 'PlaceName', 'ItemUIKind', 'ItemUICategory', 'ItemCategory', 'ItemSeries', 'ItemSpecialBonus', 'BaseParam', 'Item', 'Race', 'BNpcName', 'ENpcResident', 'Shop', 'RecipeElement', 'NotebookDivision', 'Recipe', 'GuardianDeity']);
     foreach ($tables as $table => $val) {
         $tables[$table] = FileHandler::get_version($table);
     }
     return view('osmose.index', compact('app_data', 'tables'));
 }
Ejemplo n.º 3
0
 public function getCompile()
 {
     $maps = json_decode(file_get_contents(FileHandler::path() . 'maps.json'));
     $zoom = '1';
     // https://www.google.com/search?q=image+magick+grid+combine&oq=image+magick+grid+combine
     // http://gotofritz.net/blog/geekery/combining-images-imagemagick/
     // convert *.png -gravity south -splice 0x111 -shave 0x111 -resize 400x400  converted.png
     // montage converted*.png -mode concatenate  -tile 2x2  output.png
     $map_base_path = base_path() . '/resources/assets/maps/';
     $compiled_folder = $map_base_path . 'compiled/';
     foreach ($maps as $id => $sub_maps) {
         #if ($id != 54) continue; // TESTING
         foreach ($sub_maps as $map) {
             $original_folder = $map_base_path . 'original/' . $map->MAPID . '/';
             $compiled_name = strtolower(str_replace(' ', '-', $map->ZONE . '-' . $map->REGION)) . '-' . str_replace('/', '-', $map->MAPID) . '.png';
             if (count($map->BPOINT) + count($map->MPOINT) != 0) {
                 $compiled_name = '_' . $compiled_name;
             }
             $x = $y = 0;
             foreach (range(0, 15) as $i) {
                 $had_file = false;
                 foreach (range(0, 15) as $j) {
                     // i then j gets us up to down
                     // j then i gets us left to right
                     $filename = $zoom . '_' . $i . '_' . $j . '.png';
                     if (!is_file($original_folder . $filename)) {
                         break;
                     }
                     $had_file = true;
                     $y = $j;
                 }
                 if (!$had_file) {
                     break;
                 }
                 $x = $i;
             }
             $x++;
             $y++;
             exec('montage ' . $original_folder . '*.png -mode concatenate -tile ' . $x . 'x' . $y . ' ' . $compiled_folder . $compiled_name);
         }
     }
     flash()->message('Map Image Compiler finished');
     return redirect('/osmose');
 }
Ejemplo n.º 4
0
 private function simple($table)
 {
     $results = \DB::connection('libra')->select('SELECT * FROM ' . $table);
     $data = array();
     foreach ($results as $row) {
         $data[] = array('id' => $row->Key, 'name' => array('en' => $row->Name_en, 'ja' => $row->Name_ja, 'fr' => $row->Name_fr, 'de' => $row->Name_de));
     }
     FileHandler::save($table, $data);
     flash()->message($table . ' completed.');
     if (!$this->all) {
         return redirect('/osmose');
     }
 }