/** * Render the result of the battle. * * @return string */ public function _renderResult() { $this->getView()->totalDebris = 0; foreach ($this->_report->getHarvestReports() as $hr) { $this->getView()->totalDebris += $hr->getMetal() + $hr->getCrystal(); } $this->getView()->totalRaids = $this->_report->getMetal() + $this->_report->getCrystal() + $this->_report->getDeuterium(); foreach ($this->_report->getRaids() as $raid) { $this->getView()->totalRaids += $raid->getMetal() + $raid->getCrystal() + $raid->getDeuterium(); } return $this->_renderWinnerLoot() . $this->_renderLossesMoon() . $this->_renderDebris() . $this->_renderSummary(); }
/** * @return string */ public function _renderResult() { $this->data->totalDebrisAttackers = 0; $this->data->totalDebrisDefenders = 0; $this->data->raidDeutRes = 0; $this->data->totalLossesAttacker = $this->_report->getLossesAttacker(); $this->data->totalLossesDefender = $this->_report->getLossesDefender(); //Harvest reports foreach ($this->_report->getAttackers()->getHarvestReports() as $hr) { $this->data->totalDebrisAttackers += $hr->getMetal() + $hr->getCrystal(); } foreach ($this->_report->getDefenders()->getHarvestReports() as $hr) { $this->data->totalDebrisDefenders += $hr->getMetal() + $hr->getCrystal(); } //Raids $this->data->totalRaids = $this->_report->getMetal() + $this->_report->getCrystal() + $this->_report->getDeuterium(); foreach ($this->_report->getRaids() as $raid) { $this->data->totalRaids += $raid->getMetal() + $raid->getCrystal() + $raid->getDeuterium(); $this->data->raidDeutRes += $raid->getDeuterium(); } // Fuel costs $this->data->totalFuelAttackers = 0; $this->data->totalFuelDefenders = 0; if ($this->_report->getAttackers()->getDeuteriumCosts() > 0) { foreach ($this->_report->getAttackers()->getDeuteriumCosts() as $fuel) { $this->data->totalFuelAttackers += $fuel->getDeuteriumCosts(); } } if ($this->_report->getDefenders()->getDeuteriumCosts() > 0) { foreach ($this->_report->getDefenders()->getDeuteriumCosts() as $fuel) { $this->data->totalFuelDefenders += $fuel->getDeuteriumCosts(); } } // calculate the result $this->data->attackerResult = $this->data->totalDebrisAttackers + $this->data->totalRaids - $this->data->totalFuelAttackers - $this->data->totalLossesAttacker; $this->data->defenderResult = $this->data->totalDebrisDefenders - $this->data->totalFuelDefenders - $this->data->totalLossesDefender; return $this->render('winnerloot') . $this->render('lossesmoon') . $this->render('debris') . $this->render('summary'); //. $this->render('advancedsummary'); }