def setRecord(self, result, reusable): crystalTotal = 0 crystalAchive = 0 for details in result: achievementName, value = details if achievementName == 'originalCrystal': if value > 0: crystalTotal += value self._addRecord( i18n.makeString( BATTLE_RESULTS.DETAILS_CALCULATIONS_CRYSTAL_TOTAL), value) crystalAchive += value if crystalAchive > 0: self._addRecord( i18n.makeString( BATTLE_RESULTS.DETAILS_CALCULATIONS_CRYSTAL_ACHIEVEMENT), crystalAchive) crystalTotal += crystalAchive if crystalTotal > 0: self.addNextComponent(style.EmptyStatRow()) i18nText = i18n.makeString( BATTLE_RESULTS.DETAILS_CALCULATIONS_TOTAL) totalStr = makeHtmlString('html_templates:lobby/battle_results', 'lightText', {'value': i18nText}) self._addRecord(totalStr, crystalTotal)
def __addTotalResults(self, value): self.addNextComponent(style.EmptyStatRow()) i18nText = backport.text( R.strings.battle_results.details.calculations.total()) totalStr = makeHtmlString('html_templates:lobby/battle_results', 'lightText', {'value': i18nText}) self._addRecord(totalStr, value)
def setRecord(self, result, reusable): crystalTotal = 0 for details in result.earned: achievementName, value = details if achievementName == 'originalCrystal': if value > 0: crystalTotal += value self._addRecord(backport.text(R.strings.battle_results.details.calculations.crystal.total()), value) autoBoosters = result.expenses if autoBoosters: self._addRecord(backport.text(R.strings.battle_results.details.calculations.autoBoosters()), autoBoosters) crystalTotal += autoBoosters if crystalTotal > 0: self.addNextComponent(style.EmptyStatRow()) i18nText = backport.text(R.strings.battle_results.details.calculations.total()) totalStr = makeHtmlString('html_templates:lobby/battle_results', 'lightText', {'value': i18nText}) self._addRecord(totalStr, crystalTotal)
def _addEmptyRow(self): self.addNextComponent(style.EmptyStatRow())