def _ui_metadata_gen(self): if GardeningTuning.is_spliced(self.owner): fruit_names = self.get_root_stock_names() description = LocalizationHelperTuning.get_comma_separated_list( *fruit_names) plant_name = GardeningTuning.SPLICED_PLANT_NAME() else: unidentified_overrides = self._unidentified_overrides if unidentified_overrides is not None and GardeningTuning.is_unidentified( self.owner): description = unidentified_overrides.unidentified_description plant_name = unidentified_overrides.unidentified_name else: if self.is_shoot and self.root_stock is not None: description = LocalizationHelperTuning.get_name_value_pair( GardeningTuning.SHOOT_DESCRIPTION_STRING, LocalizationHelperTuning.get_object_name( self.root_stock.main_spawner.definition)) else: description = LocalizationHelperTuning.get_object_description( self.owner.definition) plant_name = LocalizationHelperTuning.get_object_name( self.owner.definition) yield ('recipe_name', plant_name) yield ('recipe_description', description) subtext = self.owner.get_state_strings() if subtext is not None: yield ('subtext', subtext)
def get_genre_localized_string(obj): genres = Genre.get_genres(obj) if not genres: return strings = tuple(Genre.TAG_TO_TUNING_MAP[genre].localized_name for genre in genres) comma_seperated_list = LocalizationHelperTuning.get_comma_separated_list(*strings) genre_text = Genre.GENRE_PREFIX_STRING_FACTORY(comma_seperated_list) return genre_text
def get_genre_localized_string(obj): genres = Genre.get_genres(obj) if not genres: return strings = tuple(Genre.TAG_TO_TUNING_MAP[genre].localized_name for genre in genres) comma_seperated_list = LocalizationHelperTuning.get_comma_separated_list( *strings) genre_text = Genre.GENRE_PREFIX_STRING_FACTORY(comma_seperated_list) return genre_text
def _populate_spell_entry_message(self, entry_message, spell): entry_message.name = spell.display_name if spell.locked_description and not self._is_unlocked(spell): entry_message.description = spell.locked_description else: entry_message.description = spell.display_description entry_message.icon.type = spell.display_icon.type entry_message.icon.group = spell.display_icon.group entry_message.icon.instance = spell.display_icon.instance ingredients = spell.ingredients.ingredients if ingredients: entry_message.subtext_title = SpellbookTuning.INGREDIENTS_LABEL entry_message.subtext = LocalizationHelperTuning.get_comma_separated_list(*tuple(SpellbookTuning.INGREDIENT_FORMAT(LocalizationHelperTuning.get_object_name(ingredient.ingredient), ingredient.quantity) for ingredient in ingredients))
def get_seasonality_text_from_plant(cls, plant_definition): season_component = plant_definition.cls._components.season_aware_component if season_component is not None: seasons = [] season_tuned_values = season_component._tuned_values for (season_type, season_states ) in season_tuned_values.seasonal_state_mapping.items(): if any(s is GardeningTuning.SEASONALITY_IN_SEASON_STATE_VALUE for s in season_states): season = SeasonsTuning.SEASON_TYPE_MAPPING[season_type] seasons.append((season_type, season)) if seasons: return GardeningTuning.PLANT_SEASONALITY_TEXT( LocalizationHelperTuning.get_comma_separated_list(*tuple( season.season_name for (_, season) in sorted(seasons))))
def _populate_recipe_entry_message(self, entry_message, recipe): recipe_display_mapping = SpellbookTuning.POTION_DISPLAY_DATA recipe_display_data = recipe_display_mapping.get(recipe) entry_message.name = recipe.name() if recipe_display_data is None: logger.error('{} not found in potion display data, update SpellbookTuning.POTION_DISPLAY_DATA', recipe) return if recipe_display_data.locked_description and not self._is_unlocked(recipe): entry_message.description = recipe_display_data.locked_description elif recipe_display_data.potion_description is not None: entry_message.description = recipe_display_data.potion_description else: entry_message.description = recipe.recipe_description() entry_message.icon.type = recipe_display_data.icon.type entry_message.icon.group = recipe_display_data.icon.group entry_message.icon.instance = recipe_display_data.icon.instance if recipe.use_ingredients is not None: entry_message.subtext_title = SpellbookTuning.INGREDIENTS_LABEL entry_message.subtext = LocalizationHelperTuning.get_comma_separated_list(*tuple(SpellbookTuning.INGREDIENT_FORMAT(ingredient.get_diplay_name(), ingredient.count_required) for ingredient in (req_factory() for req_factory in recipe.sorted_ingredient_requirements)))