/** * Handle every iteration of the parsing process. * * @param \pandaac\Exporter\Contracts\Reader $reader * @param \Illuminate\Support\Collection $collection * @return \Illuminate\Support\Collection */ public function iteration(Reader $reader, Collection $collection) { if (!$reader->is('monster')) { return $collection; } if (!($reader->isElement() or $reader->isAttribute() or $reader->isComment())) { return $collection; } // Monster information if ($iteration = $this->information($reader)) { $collection->push($iteration); } // Monster details if ($this->enabled('recursion') and $iteration = $this->details($reader, $collection)) { $monster = $collection->pop(); return $collection->push($iteration->put('paths', $monster)); } return $collection; }
/** * Parse the loot comment information from the monster file. * * @param \pandaac\Exporter\Contracts\Reader $reader * @return string */ protected function lootComments(Reader $reader) { if (!($reader->isComment() and $reader->parent('loot'))) { return false; } return trim($reader->value()); }