当前位置: 首页>>代码示例>>PHP>>正文


PHP FileHandler::get_data方法代码示例

本文整理汇总了PHP中FileHandler::get_data方法的典型用法代码示例。如果您正苦于以下问题:PHP FileHandler::get_data方法的具体用法?PHP FileHandler::get_data怎么用?PHP FileHandler::get_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileHandler的用法示例。


在下文中一共展示了FileHandler::get_data方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run()
 {
     foreach (FileHandler::get_data('Recipe') as $r) {
         $r->reagents = array();
         $this->recipes[$r->id] = $r;
         $this->item_to_recipe[$r->item_id][] = $r->id;
         foreach ($r->extra->reagents as $item_id => $amount) {
             $this->recipes[$r->id]->reagents[] = (object) array('item_id' => $item_id, 'amount' => $amount);
         }
     }
     foreach ($this->recipes as $r) {
         $this->recursive($r, $r->level, $r->classjob, $r->yields);
     }
     list($careers, $career_job) = $this->compile();
     FileHandler::save('careers', $careers);
     FileHandler::save('career_classjob', $career_job);
 }
开发者ID:kidaa,项目名称:ffxivcrafting,代码行数:17,代码来源:Career.php

示例2: run

 public function run()
 {
     // Relevant XIVDB files
     $locations = json_decode(file_get_contents(FileHandler::path() . 'locations.json'));
     $gn = json_decode(file_get_contents(FileHandler::path() . 'gathering_nodes.json'));
     $gni = json_decode(file_get_contents(FileHandler::path() . 'gathering_node_item.json'));
     // Relevant Libra files
     $maps = json_decode(file_get_contents(FileHandler::path() . 'maps.json'));
     $placenames = FileHandler::get_data('PlaceName');
     // We want Placenames to be the "system of record", so we're making everything else conform
     // Let's link up our PlaceName and locations.json
     $location_to_placename = [];
     foreach ($locations as $l) {
         foreach ($placenames as $p) {
             if (strtolower($l->name) == strtolower($p->name->en)) {
                 $location_to_placename[$l->id] = $p->id;
                 continue 2;
             }
         }
     }
     // And we need to link up PlaceName to Map ID
     $map_to_placename = [];
     // Some weren't found, but they were inconsequential
     foreach ($maps as $id => $regions) {
         foreach ($regions as $region) {
             foreach ($placenames as $p) {
                 if (strtolower($region->REGION) == strtolower($p->name->en)) {
                     $map_to_placename[$id] = $p->id;
                     continue 3;
                 }
             }
         }
     }
     // Regions have Clusters
     // Clusters have Nodes
     // Clusters have Items
     // - Nodes semantically have Items, but they're all the same in a Cluster
     $clusters = $icons = [];
     $action_list = array('Logging' => 'mature tree', 'Harvesting' => 'lush vegetation', 'Quarrying' => 'rocky outcrop', 'Mining' => 'mineral deposit');
     // $gn defines out clusters
     foreach ($gn as $cluster) {
         $cluster->placename_id = $location_to_placename[$cluster->location_id];
         // Figure out the cluster nodes
         $cluster->icon = '';
         $cluster->nodes = [];
         foreach ($maps->{$cluster->placename_id} as $map_id => $section) {
             if (!is_array($section->{substr($cluster->class, 0, 1) . 'POINT'})) {
                 continue;
             }
             foreach ($section->{substr($cluster->class, 0, 1) . 'POINT'} as $node) {
                 if ($node->description == '') {
                     continue;
                 }
                 if (preg_match('/bugged/', $node->description)) {
                     continue;
                 }
                 // Get the type and level
                 preg_match('/^lv(\\.?\\s?)?(\\d+)\\b(.*)$/', strtolower($node->description), $matches);
                 if (count($matches) != 4) {
                     // handle special cases
                     // Description may be junk, but it'll be kicked out later
                     $type = $node->description;
                     $level = 50;
                 } else {
                     list($ignore, $ignore, $level, $type) = $matches;
                 }
                 // Compare Levels
                 if ($level != $cluster->level) {
                     continue;
                 }
                 $type = trim(ltrim($type, ' -'));
                 // Tie Action to Type
                 // Rule out bad apples, nonmatching types
                 $continue = true;
                 foreach ($action_list as $a => $t) {
                     if ($cluster->action == $a && preg_match('/' . $t . '/', $type)) {
                         $continue = false;
                     }
                 }
                 if ($continue) {
                     continue;
                 }
                 // We've passed all tests, this node point belongs to this cluster
                 // $icons[] = $node->iconUrl;
                 $cluster->icon = preg_replace('/^.*\\/(\\d+\\.png)$/', '$1', $node->iconUrl);
                 $cluster->nodes[] = array('id' => $node->id, 'description' => ucwords($type), 'x' => number_format($node->locX, 4, '.', ','), 'y' => number_format($node->locY, 4, '.', ','));
             }
         }
         // Find out the "center" of the nodes, and the radius
         $xs = $ys = [];
         $radius = $center_x = $center_y = 0;
         foreach ($cluster->nodes as $n) {
             $xs[] = $n['x'];
             $ys[] = $n['y'];
         }
         // sort($xs);
         // sort($ys);
         $cluster->center_x = count($xs) ? number_format(array_sum($xs) / count($xs), 4, '.', ',') : 0;
         $cluster->center_y = count($ys) ? number_format(array_sum($ys) / count($ys), 4, '.', ',') : 0;
         // var_dump(
//.........这里部分代码省略.........
开发者ID:kidaa,项目名称:ffxivcrafting,代码行数:101,代码来源:Nodes.php


注:本文中的FileHandler::get_data方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。