async def deserialize(dbcog, user_config: UserConfig, ims: dict):
        raw_query = ims['raw_query']
        original_author_id = ims['original_author_id']
        menu_type = ims['menu_type']
        l_query_settings = QuerySettings.deserialize(ims['l_query_settings'])
        r_query_settings = QuerySettings.deserialize(ims['r_query_settings'])

        l_mon, l_query, r_mon, r_query = await leaderskill_query(
            dbcog, raw_query, ims['original_author_id'])
        return LeaderSkillViewState(original_author_id, menu_type, raw_query,
                                    user_config.color, l_mon, r_mon, l_query,
                                    r_query, l_query_settings,
                                    r_query_settings)
Exemple #2
0
 async def query_from_ims(dbcog, ims) -> List[List["MonsterModel"]]:
     series_id = ims['series_id']
     rarity = ims['rarity']
     query_settings = QuerySettings.deserialize(ims['query_settings'])
     paginated_monsters = await SeriesScrollViewState.do_query(
         dbcog, series_id, rarity, query_settings.server)
     return paginated_monsters
Exemple #3
0
    async def deserialize(cls, dbcog, user_config: UserConfig, ims: dict):
        if ims.get('unsupported_transition'):
            return None
        monster = await get_monster_from_ims(dbcog, ims)

        alt_monsters = cls.get_alt_monsters_and_evos(dbcog, monster)

        raw_query = ims['raw_query']
        query = ims.get('query') or raw_query
        query_settings = QuerySettings.deserialize(ims.get('query_settings'))
        original_author_id = ims['original_author_id']
        menu_type = ims['menu_type']
        reaction_list = ims.get('reaction_list')
        is_jp_buffed = dbcog.database.graph.monster_is_discrepant(monster)

        return cls(original_author_id,
                   menu_type,
                   raw_query,
                   query,
                   user_config.color,
                   monster,
                   alt_monsters,
                   is_jp_buffed,
                   query_settings,
                   reaction_list=reaction_list,
                   extra_state=ims)
Exemple #4
0
    async def deserialize(cls, dbcog, user_config: UserConfig, ims: dict):
        # for numberscroll getting to a gap in monster book, or 1, or last monster
        if ims.get('unsupported_transition'):
            return None
        monster = await get_monster_from_ims(dbcog, ims)
        alt_monsters = cls.get_alt_monsters_and_evos(dbcog, monster)
        id_queried_props = await IdViewState.do_query(dbcog, monster)

        raw_query = ims['raw_query']
        # This is to support the 2 vs 1 monster query difference between ^ls and ^id
        query = ims.get('query') or raw_query
        query_settings = QuerySettings.deserialize(ims.get('query_settings'))
        menu_type = ims['menu_type']
        original_author_id = ims['original_author_id']
        reaction_list = ims.get('reaction_list')
        fallback_message = ims.get('message')
        is_child = ims.get('is_child')
        is_jp_buffed = dbcog.database.graph.monster_is_discrepant(monster)

        return cls(original_author_id,
                   menu_type,
                   raw_query,
                   query,
                   user_config.color,
                   monster,
                   alt_monsters,
                   is_jp_buffed,
                   query_settings,
                   id_queried_props,
                   fallback_message=fallback_message,
                   reaction_list=reaction_list,
                   is_child=is_child,
                   extra_state=ims)
Exemple #5
0
    async def deserialize(dbcog, user_config: UserConfig, ims: dict):
        if ims.get('unsupported_transition'):
            return None
        series_id = ims['series_id']
        rarity = ims['rarity']
        all_rarities = ims['all_rarities']
        query_settings = QuerySettings.deserialize(ims.get('query_settings'))
        paginated_monsters = await SeriesScrollViewState.do_query(dbcog, series_id, rarity, query_settings.server)
        current_page = ims['current_page']
        title = ims['title']

        raw_query = ims['raw_query']
        query = ims.get('query') or raw_query
        original_author_id = ims['original_author_id']
        menu_type = ims['menu_type']
        reaction_list = ims.get('reaction_list')
        child_message_id = ims.get('child_message_id')
        current_index = ims.get('current_index')
        current_monster_list = paginated_monsters[current_page]
        max_len_so_far = max(ims['max_len_so_far'] or len(current_monster_list), len(current_monster_list))
        idle_message = ims.get('idle_message')

        return SeriesScrollViewState(original_author_id, menu_type, raw_query, query, user_config.color, series_id,
                                     paginated_monsters, current_page, rarity, query_settings,
                                     all_rarities,
                                     title, idle_message,
                                     current_index=current_index,
                                     max_len_so_far=max_len_so_far,
                                     reaction_list=reaction_list,
                                     extra_state=ims,
                                     child_message_id=child_message_id)
Exemple #6
0
    async def deserialize(cls, dbcog, user_config: UserConfig, ims: dict):
        if ims.get('unsupported_transition'):
            return None
        title = ims['title']

        monster_list = await cls.query_from_ims(dbcog, ims)
        current_page = ims['current_page']
        current_index = ims.get('current_index')

        raw_query = ims['raw_query']
        query = ims.get('query') or raw_query
        query_settings = QuerySettings.deserialize(ims.get('query_settings'))
        original_author_id = ims['original_author_id']
        menu_type = ims['menu_type']
        reaction_list = ims.get('reaction_list')
        child_message_id = ims.get('child_message_id')
        child_menu_type = ims.get('child_menu_type')
        child_reaction_list = ims.get('child_reaction_list')
        idle_message = ims.get('idle_message')
        return ScrollViewState(original_author_id, menu_type, query, user_config.color,
                               monster_list, query_settings,
                               title, idle_message, ims['current_monster_id'],
                               current_page=current_page,
                               current_index=current_index,
                               child_menu_type=child_menu_type,
                               child_reaction_list=child_reaction_list,
                               reaction_list=reaction_list,
                               extra_state=ims,
                               child_message_id=child_message_id
                               )
Exemple #7
0
    async def deserialize(dbcog, user_config: UserConfig, ims: dict):
        raw_query = ims['raw_query']
        original_author_id = ims['original_author_id']
        menu_type = ims['menu_type']
        monster_ids = ims['resolved_monster_ids']
        base_mon_id = monster_ids[0]
        transformed_mon_id = monster_ids[1]
        query_settings = QuerySettings.deserialize(ims.get('query_settings'))

        base_mon = dbcog.get_monster(base_mon_id, server=query_settings.server)
        transformed_mon = dbcog.get_monster(transformed_mon_id,
                                            server=query_settings.server)

        tfinfo_queried_props = await TransformInfoViewState.do_query(
            dbcog, transformed_mon)
        reaction_list = ims['reaction_list']
        is_jp_buffed = dbcog.database.graph.monster_is_discrepant(
            base_mon) or dbcog.database.graph.monster_is_discrepant(
                transformed_mon)

        return TransformInfoViewState(original_author_id,
                                      menu_type,
                                      raw_query,
                                      user_config.color,
                                      base_mon,
                                      transformed_mon,
                                      tfinfo_queried_props,
                                      monster_ids,
                                      is_jp_buffed,
                                      query_settings,
                                      reaction_list=reaction_list)
Exemple #8
0
    async def deserialize(dbcog, user_config: UserConfig, ims: dict):
        raw_query = ims['raw_query']
        original_author_id = ims['original_author_id']
        menu_type = ims['menu_type']
        query_settings = QuerySettings.deserialize(ims['query_settings'])

        mon = await get_monster_from_ims(dbcog, ims)
        return LeaderSkillSingleViewState(original_author_id, menu_type, raw_query, query_settings, user_config.color, mon)
Exemple #9
0
async def get_monster_from_ims(dbcog, ims: dict):
    query = ims.get('query') or ims['raw_query']
    query_settings = QuerySettings.deserialize(ims.get('query_settings'))

    resolved_monster_id_str = ims.get('resolved_monster_id')
    resolved_monster_id = int(resolved_monster_id_str or 0)
    if resolved_monster_id:
        return dbcog.database.graph.get_monster(resolved_monster_id,
                                                server=query_settings.server)
    monster = await dbcog.find_monster(query, ims['original_author_id'])
    return monster
Exemple #10
0
 async def deserialize(cls, dbcog, user_config: UserConfig, ims: dict):
     raw_query = ims['raw_query']
     original_author_id = ims['original_author_id']
     menu_type = ims['menu_type']
     query_settings = QuerySettings.deserialize(ims['query_settings'])
     display_options = ButtonInfoToggles(ims['players_setting'], ims['device_setting'], ims['max_level_setting'])
     monster = dbcog.get_monster(int(ims['resolved_monster_id']))
     alt_monsters = cls.get_alt_monsters_and_evos(dbcog, monster)
     info = button_info.get_info(dbcog, monster)
     reaction_list = ims['reaction_list']
     return ButtonInfoViewState(original_author_id, menu_type, raw_query, user_config.color, display_options,
                                monster, alt_monsters, info, query_settings, reaction_list=reaction_list)
Exemple #11
0
    async def deserialize(cls, dbcog, user_config: UserConfig, ims: dict):
        if ims.get('unsupported_transition'):
            return None
        monster = await get_monster_from_ims(dbcog, ims)
        mats, usedin, gemid, gemusedin, skillups, skillup_evo_count, link, stackable = \
            await MaterialsViewState.do_query(dbcog, monster)

        if mats is None:
            return None

        alt_monsters = cls.get_alt_monsters_and_evos(dbcog, monster)
        raw_query = ims['raw_query']
        query = ims.get('query') or raw_query
        query_settings = QuerySettings.deserialize(ims.get('query_settings'))
        menu_type = ims['menu_type']
        original_author_id = ims['original_author_id']
        reaction_list = ims.get('reaction_list')
        is_jp_buffed = dbcog.database.graph.monster_is_discrepant(monster)

        return cls(original_author_id,
                   menu_type,
                   raw_query,
                   query,
                   user_config.color,
                   monster,
                   alt_monsters,
                   is_jp_buffed,
                   query_settings,
                   mats,
                   usedin,
                   gemid,
                   gemusedin,
                   skillups,
                   skillup_evo_count,
                   link,
                   stackable,
                   reaction_list=reaction_list,
                   extra_state=ims)
Exemple #12
0
 async def query_from_ims(cls, dbcog, ims) -> List["MonsterModel"]:
     monster_list = await cls.do_query(
         dbcog, ims['raw_query'], ims['original_author_id'],
         QuerySettings.deserialize(ims['query_settings']))
     return monster_list
Exemple #13
0
 async def query_from_ims(cls, dbcog, ims) -> List["MonsterModel"]:
     monster_ids = ims['full_monster_list']
     query_settings = QuerySettings.deserialize(ims['query_settings'])
     monster_list = await cls.do_query(dbcog, monster_ids,
                                       query_settings.server)
     return monster_list