Beispiel #1
0
def __convert_to_daily_info(dropship_info: EntityInfo) -> EntityInfo:
    result = {}
    for field_name in DAILY_INFO_FIELDS:
        value = None
        if field_name in dropship_info.keys():
            value = dropship_info[field_name]
        result[field_name] = value
    return result
Beispiel #2
0
def __get_stat_chance(stat_name: str, training_info: EntityInfo, guaranteed: bool = False) -> Optional[Tuple[str, str, str, str]]:
    if stat_name and training_info:
        chance_name = f'{stat_name}Chance'
        if chance_name in training_info.keys():
            stat_chance = int(training_info[chance_name])
            if stat_chance > 0:
                stat_emoji = lookups.STAT_EMOJI_LOOKUP[stat_name]
                stat_unit = lookups.STAT_UNITS_LOOKUP[stat_name]
                operator = '' if guaranteed else '\u2264'
                return (stat_emoji, operator, stat_chance, stat_unit)
    return None
Beispiel #3
0
def get_property_from_entity_info(entity_info: EntityInfo,
                                  entity_property_name: str) -> Any:
    while '.' in entity_property_name:
        split_parameter = entity_property_name.split('.')
        property_name = split_parameter[0]
        entity_property_name = '.'.join(split_parameter[1:])
        if property_name not in entity_info.keys():
            continue
        entity_info = entity_info[property_name]

    if entity_property_name in entity_info.keys():
        result = entity_info[entity_property_name]
        if isinstance(result, str):
            result_lower = result.lower()
            if not result or result_lower == '0' or result_lower == 'none':
                return None
            else:
                return result
        else:
            return result or None
Beispiel #4
0
def __get_daily_news_from_info_as_text(daily_info: EntityInfo) -> List[str]:
    result = ['No news have been provided :(']
    if daily_info and 'News' in daily_info.keys():
        result = [daily_info['News']]
    return result