public function load() { if (!$this->extended) { destiny()->accountDetails($this); $this->extended = true; } }
public function select($gamertag) { $players = destiny()->player($gamertag); if ($players->count() == 1) { return Redirect::to($players->first()->url); } return View::make('select', ['gamertag' => $gamertag, 'players' => $players]); }
/** * @param $gamertag * @return \Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse */ public function select($gamertag) { $players = destiny()->player($gamertag); if ($players->count() == 1) { return $this->redirect->to($players->first()->url); } return $this->view->make('select', ['gamertag' => $gamertag, 'players' => $players]); }
/** * @param string $platform * @param string $gamertag * @return \Destiny\Player */ protected function findPlayer($platform, $gamertag) { $players = destiny()->player($gamertag); $player = $players->get($platform); if (!$player instanceof Player) { App::abort(404, "The player '{$gamertag}' on '{$platform}' could not be found."); } return $player; }
public function __construct(Advisors $advisors, array $properties) { if ($properties['status']['active']) { try { $vendorXur = destiny()->xur(); $properties['xur'] = $vendorXur; } catch (\Exception $e) { $properties['xur'] = new \Destiny\Xur([]); } } parent::__construct($properties); }
public function fire() { $this->info('Updating manifest'); $manifest = destiny()->manifest(); $this->url = bungie(array_get($manifest, 'mobileWorldContentPaths.en')); $this->version = array_get($manifest, 'version'); $this->versionFile = base_path('database/manifest/.version'); $this->versionDb = base_path("database/manifest/{$this->version}.sqlite"); if (!is_file($this->versionFile)) { \File::put($this->versionFile, ''); } $currentVersion = \File::get($this->versionFile); $versionChanged = $this->version !== $currentVersion || !is_file($this->versionDb); if ($this->option('extract') || $this->option('download') || $versionChanged) { if ($this->option('download') || $versionChanged) { $this->download(); } $this->extract(); $this->call('cache:clear'); } else { $this->comment('No updates available.'); } $this->line("<info>Current version:</info> <comment>{$this->version}</comment>"); }
public function __construct(Character $character, array $activities, array $pves, array $stats) { $this->character = $character; $this->dateActivityStarted = carbon($activities['dateActivityStarted']); $lastReset = last_weekly(); $nextReset = next_weekly(); // raid, arena and nightfall completion status $raidsCompleted = []; $arenasCompleted = []; $activitiesCompleted = []; // need advisors to identify daily $this->dailyChapter = destiny()->advisors()->daily; foreach ($pves as $pve) { $activityHash = (string) $pve['activityDetails']['referenceId']; $activity = manifest()->activity($activityHash); $activityId = sha1($activity->activityName); $activityType = $activity->activityType; $completed = (bool) array_get($pve, 'values.completed.basic.value', false); $date = carbon($pve['period']); if ($activityType->isRaid()) { $activityLevel = $activity->activityLevel; if (!isset($raidsCompleted[$activityId])) { $raidsCompleted[$activityId] = null; } if ($completed && $date > $lastReset && $date < $nextReset) { if ($activityLevel > $raidsCompleted[$activityId]) { $raidsCompleted[$activityId] = $activityLevel; } } } if ($activityType->isArena()) { if (!array_key_exists($activityHash, $arenasCompleted)) { $arenasCompleted[$activityHash] = false; } if ($completed && $date > $lastReset && $date < $nextReset) { $arenasCompleted[$activityHash] = $completed; } } if ($activityType->isNightfall()) { $nightfallHash = $activity->activityType->activityTypeHash; if (!array_key_exists($nightfallHash, $activitiesCompleted)) { $activitiesCompleted[$nightfallHash] = false; } if ($completed && $date > $lastReset && $date < $nextReset) { $activitiesCompleted[$nightfallHash] = $completed; } } if ($activityHash == $this->dailyChapter->activityHash) { if (!array_key_exists($activityHash, $activitiesCompleted)) { $activitiesCompleted[$activityHash] = false; } if ($completed && $date > last_daily() && $date < next_daily()) { $activitiesCompleted[$activityHash] = $completed; } } } // stats grouped by activity hash $statsArray = []; foreach ($stats as $k => $stat) { $activityHash = (string) $stat['activityHash']; $statsArray[$activityHash] = new StatisticsCollection($stat['values']); } // build ActivityCollection foreach ($activities['available'] as $activity) { $activityHash = (string) $activity['activityHash']; $activityStats = array_get($statsArray, $activityHash); $activity = new Activity($character, $activity, $activityStats); $activityId = sha1($activity->activityName); if ($activity->isCompleted && $activity->isWeekly()) { $activity->isCompleted = $character->dateLastPlayed > last_weekly(); } $this->put($activityHash, $activity); if ($activity->isRaid()) { $activity->isCompleted = false; $activityLevelCompleted = array_get($raidsCompleted, $activityId); if (!$activityLevelCompleted) { continue; } if ($activity->activityLevel <= $activityLevelCompleted) { $activity->isCompleted = true; } } if ($activity->isArena()) { $activity->isCompleted = array_get($arenasCompleted, $activityHash, false); } if ($activity->isNightfall()) { $activity->isCompleted = array_get($activitiesCompleted, $activity->activityType->activityTypeHash, false); } if ($activityHash == $this->dailyChapter->activityHash) { $activity->isCompleted = array_get($activitiesCompleted, $activityHash, false); } } }
protected function gGrimoire() { return destiny()->grimoire($this); }