Beispiel #1
0
    def gear_ability2text(gear_ability, unknown='?', languages=None):
        gear_ability_id = IkaUtils.gear_ability2id(gear_ability, unknown=None)

        if gear_ability_id is None:
            return unknown

        if gear_abilities.get(gear_ability_id, None) is None:
            return unknown

        if languages is None:
            languages = Localization.get_languages()

        if not isinstance(languages, list):
            languages = [languages]

        # fallback list
        languages.extend(['en', 'ja'])

        for lang in languages:
            gear_ability_text = gear_abilities[gear_ability_id].get(lang, None)
            if gear_ability_text is not None:
                return gear_ability_text

        # Should not reach here
        return gear_ability_id
Beispiel #2
0
    def gear_ability2text(gear_ability, unknown='?', languages=None):
        gear_ability_id = IkaUtils.gear_ability2id(gear_ability, unknown=None)

        if gear_ability_id is None:
            return unknown

        if gear_abilities.get(gear_ability_id, None) is None:
            return unknown

        if languages is None:
            languages = Localization.get_languages()

        if not isinstance(languages, list):
            languages = [languages]

        # fallback list
        languages.extend(['en', 'ja'])

        for lang in languages:
            gear_ability_text = gear_abilities[gear_ability_id].get(lang, None)
            if gear_ability_text is not None:
                return gear_ability_text

        # Should not reach here
        return gear_ability_id
Beispiel #3
0
    def gear_ability2text(gear_ability, unknown='?', languages=None):
        if gear_ability is None:
            return unknown

        if gear_abilities.get(gear_ability, None) is None:
            return unknown

        for lang in IkaUtils.extend_languages(languages):
            gear_ability_text = gear_abilities[gear_ability].get(lang, None)
            if gear_ability_text is not None:
                return gear_ability_text

        # Should not reach here
        return gear_ability_id
Beispiel #4
0
    def gear_ability2text(gear_ability, unknown='?', languages=None):
        if gear_ability is None:
            return unknown

        if gear_abilities.get(gear_ability, None) is None:
            return unknown

        for lang in IkaUtils.extend_languages(languages):
            gear_ability_text = gear_abilities[gear_ability].get(lang, None)
            if gear_ability_text is not None:
                return gear_ability_text

        # Should not reach here
        return gear_ability_id
Beispiel #5
0
    def dump(self, context):
        for field in context['scenes']['result_gears']:
            if field == 'gears':
                continue
            elif field.startswith('img_'):
                print('  %s: %s' % (field, '(image)'))
            else:
                print('  %s: %s' %
                      (field, context['scenes']['result_gears'][field]))

        for n in range(len(context['scenes']['result_gears']['gears'])):
            gear = context['scenes']['result_gears']['gears'][n]
            for field in gear:
                if field.startswith('img_'):
                    print('  gear %d : %s : %s' % (n, field, '(image)'))
                else:
                    ability = gear_abilities.get(gear[field], { 'ja': None})['ja']
                    ability = ability.encode().decode("unicode-escape").encode("latin1").decode("utf-8")
                    # Mac gives Japanese text, Windows gives escape sequences
                    print('  gear %d : %s : %s' % (n, field, ability))
Beispiel #6
0
    def dump(self, context):
        for field in context['scenes']['result_gears']:
            if field == 'gears':
                continue
            elif field.startswith('img_'):
                print('  %s: %s' % (field, '(image)'))
            else:
                print('  %s: %s' %
                      (field, context['scenes']['result_gears'][field]))

        for n in range(len(context['scenes']['result_gears']['gears'])):
            gear = context['scenes']['result_gears']['gears'][n]
            for field in gear:
                if field.startswith('img_'):
                    print('  gear %d : %s : %s' % (n, field, '(image)'))
                else:
                    ability = gear_abilities.get(gear[field],
                                                 {'ja': None})['ja']
                    ability = ability.encode().decode("unicode-escape").encode(
                        "latin1").decode("utf-8")
                    # Mac gives Japanese text, Windows gives escape sequences
                    print('  gear %d : %s : %s' % (n, field, ability))