/** * @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'); }
/** * Get the title for a CR. * * @param Default_Model_CombatReport $report * * @return string */ public function renderTitle(Default_Model_CombatReport $report) { $rounds = $report->getRounds(); // get the attackers $attackers = array(); foreach ($rounds[0]->getAttackers() as $fleet) { /* @var $fleet Default_Model_Fleet */ $attackers[$fleet->getPlayer()] = ''; } $attackers = array_keys($attackers); // get the defenders $defenders = array(); foreach ($rounds[0]->getDefenders() as $fleet) { /* @var $fleet Default_Model_Fleet */ $defenders[$fleet->getPlayer()] = ''; } $defenders = array_keys($defenders); // stats $totalLosses = $report->getLossesAttacker() + $report->getLossesDefender(); return $this->getView()->translate("%s vs %s (A: %s, D: %s) [TOT: %s]", implode($this->getView()->translate(" & "), $attackers), implode($this->getView()->translate(" & "), $defenders), $this->getView()->formatNumber($report->getLossesAttacker()), $this->getView()->formatNumber($report->getLossesDefender()), $this->getView()->formatNumber($totalLosses)); }