/** * Flag values that are actually zero (instead of those that are missing) for collection data * @param object $dragon */ protected function flagEmptyValues(&$dragon) { if ($dragon['level'] < $dragon['fish_start_level'] || $dragon['fish_start_level'] === null) { $dragon['fish_rate'] = 0; } if ($dragon['level'] < $dragon['wood_start_level'] || $dragon['wood_start_level'] === null) { $dragon['wood_rate'] = 0; } $timeLevel = minNoNulls($dragon['wood_start_level'], $dragon['fish_start_level']); if (!$timeLevel || $dragon['level'] < $timeLevel) { $dragon['collect_time'] = 0; } }
protected function allLevelsTime(&$levels) { foreach ($this->collectTime->data as $cTime) { $levels[$cTime->level]['collect_time'] = $cTime->time; $levels[$cTime->level]['collect_time_updated_at'] = $cTime->updated_at; } $timeFillTo = minNoNulls($this->wood_start_level, $this->fish_start_level); if (!$timeFillTo) { $timeFillTo = Setting::get('max-level') + 1; } for ($i = 1; $i < $timeFillTo; $i++) { $levels[$i]['collect_time'] = 0; $levels[$i]['collect_time_updated_at'] = null; } foreach ($levels as $level => &$data) { if ($data['collect_time'] === null) { $data['collect_time'] = $this->percentageService->estimateTime($level, $levels[Setting::get('max-level')]['collect_time']); $data['collect_time_estimate'] = true; } } }
protected function startCollectingLevel($dragon) { return minNoNulls($dragon->fish_start_level, $dragon->wood_start_level); }