public function getContent() { $page = new Neuron_Core_Template(); $input = $this->getInputData(); if (isset($input['reset']) && $input['reset'] == 'reset') { $input['action'] = 'reset'; } //return print_r ($input, true); if (isset($input['log'])) { // Update current report return $this->showReportFromRequest($input['log']); } if (isset($input['action']) && $input['action'] == 'simulate') { return $this->simulate(); } $slots = isset($input['slots']) ? intval($input['slots']) : 7; if ($slots < 3 || $slots > 99) { $slots = 7; } $page->set('slots', $slots); $races = Dolumar_Races_Race::getRaceObjects(); $units = array(); foreach ($races as $race) { $tmp = array(); $unitsInput = Dolumar_Units_Unit::getAllUnits($race); foreach ($unitsInput as $v) { $tmp[] = array('id' => $v->getUnitId(), 'name' => $v->getName(), 'img' => $v->getImageUrl()); } $units[] = array('id' => $race->getId(), 'name' => $race->getName(), 'units' => $tmp); } $page->set('units', $units); return $page->parse('battle/simulator/simulator.phpt'); }
private function getUnitStats() { $html = ""; foreach (Dolumar_Races_Race::getRaceObjects() as $race) { $html .= '<div style="width: 450px; float: left; margin: 0px 0px 0px 0px;">'; $html .= '<h2>' . $race->getDisplayName() . '</h2>'; $units = Dolumar_Units_Unit::getAllUnits($race); $page = new Neuron_Core_Template(); $page->set('showConsumption', true); $page->set('showCost', true); $page->set('showSpeed', true); Dolumar_Units_Unit::printStatNames($page); foreach ($units as $v) { $data = array('name' => $v->getName(), 'stats' => $v->getStats(), 'available' => $v->getAvailableAmount(), 'total' => $v->getTotalAmount(), 'consumption' => Dolumar_Tools::resourceToText($v->getConsumption()), 'cost' => Dolumar_Tools::resourceToText($v->getTrainingCost()), 'type' => $v->getAttackType_text(), 'image' => $v->getImageUrl()); $page->addListValue('units', $data); } $html .= $page->parse('structure/unitstats.phpt'); $html .= '</div>'; } return $html; }