def requestFort(self, clanDossier, callback): fortData = yield FortClanStatisticsData.getDataObject() sInfo = yield clanDossier.requestStrongholdInfo() sStats = yield clanDossier.requestStrongholdStatistics() if fortData is not None: fort = fortData.fortCtrl.getFort() dossier = fort.getFortDossier() mapObjects, buildingsCount = self._makeBuildingsList(fort) defModeParams = None if fort.isDefenceHourEnabled(): defModeParams = (fort.getLocalOffDay(), fort.getDefencePeriod(), fort.getVacationDate()) data = _getFortBuildingsVO( FortSortiesStatisticsVO(dossier.getSortiesStats(), sStats.getFsBattlesCount28d(), sStats.getFsWinsCount28d()), FortBattlesStatisticsVO(dossier.getBattlesStats(), sInfo.getFbBattlesCount8(), sInfo.getFbBattlesCount10()), mapObjects, _getFortSortiesSchemaTexts(defModeParams, fort.peripheryID, buildingsCount, len(fort.getOpenedDirections()))) fortData.stopFortListening() else: data = _getNoFortBuildingsVO() callback(data) return
def _requestFortLevel(self, callback): fortData = yield FortClanStatisticsData.getDataObject() if fortData is not None: fortLevel = fortData.fortCtrl.getFort().level fortLevelStr = fort_formatters.getTextLevel(fortLevel) else: fortLevel = 0 fortLevelStr = clan_fmts.DUMMY_UNAVAILABLE_DATA callback((fortLevel, fortLevelStr)) return
def requestFort(self, clanDossier, callback): fortData = yield FortClanStatisticsData.getDataObject() sInfo = yield clanDossier.requestStrongholdInfo() sStats = yield clanDossier.requestStrongholdStatistics() if fortData is not None: fort = fortData.fortCtrl.getFort() dossier = fort.getFortDossier() mapObjects, buildingsCount = self._makeBuildingsList(fort) defModeParams = None if fort.isDefenceHourEnabled(): defModeParams = (fort.getLocalOffDay(), fort.getDefencePeriod(), fort.getVacationDate()) data = _getFortBuildingsVO(FortSortiesStatisticsVO(dossier.getSortiesStats(), sStats.getFsBattlesCount28d(), sStats.getFsWinsCount28d()), FortBattlesStatisticsVO(dossier.getBattlesStats(), sInfo.getFbBattlesCount8(), sInfo.getFbBattlesCount10()), mapObjects, _getFortSortiesSchemaTexts(defModeParams, fort.peripheryID, buildingsCount, len(fort.getOpenedDirections()))) fortData.stopFortListening() else: data = _getNoFortBuildingsVO() callback(data) return