Example #1
0
def reaction(item_id):
    """ Display the manufacturing page with all data """
    item = Item.query.get(item_id)
    char = current_user.pref.prod_character

    if item is None:
        abort(404)

    if item.max_production_limit is None:
        activity_product = item.product_for_activities.filter_by(
            activity=ActivityEnum.REACTIONS.id).one_or_none()
        if activity_product is not None:
            return redirect(url_for(".reaction",
                                    item_id=activity_product.item_id),
                            code=301)
        abort(404)

    activity = item.activities.filter_by(
        activity=ActivityEnum.REACTIONS.id).one()
    materials = item.activity_materials.filter_by(
        activity=ActivityEnum.REACTIONS.id)
    product = item.activity_products.filter_by(
        activity=ActivityEnum.REACTIONS.id).one()

    return render_template(
        'blueprint/reaction.html', **{
            'blueprint': item,
            'materials': materials,
            'activity': activity,
            'product': product,
            'regions': get_regions(),
            'industry_skills': get_common_industry_skill(char),
        })
Example #2
0
def manufacturing(item_id, me=0, te=0):
    """ Display the manufacturing page with all data """
    item = Item.query.get(item_id)
    char = current_user.pref.prod_character

    if item is None or item.max_production_limit is None:
        abort(404)

    activity = item.activities.filter_by(activity=Activity.MANUFACTURING).one()
    materials = item.activity_materials.filter_by(
        activity=Activity.MANUFACTURING)
    product = item.activity_products.filter_by(
        activity=Activity.MANUFACTURING).one()

    # get science skill name, if applicable
    manufacturing_skills = item.activity_skills.filter_by(
        activity=Activity.MANUFACTURING, ).filter(
            ActivitySkill.skill_id != 3380  # industry
        )

    science_skill = []
    t2_manufacturing_skill = None
    for activity_skill in manufacturing_skills:
        if activity_skill.skill_id in IGNORED_PROD_SKILLS:
            continue
        skill = get_skill_data(activity_skill.skill, char)
        if activity_skill.skill.market_group_id == 369:
            t2_manufacturing_skill = skill

        if activity_skill.skill.market_group_id == 375:
            science_skill.append(skill)

    # is any of the materials manufactured ?
    has_manufactured_components = False
    has_cap_part_components = False

    for material in materials:
        if material.material.is_from_manufacturing:
            has_manufactured_components = True
        if material.material.is_cap_part():
            has_cap_part_components = True

    return render_template(
        'blueprint/manufacturing.html', **{
            'blueprint': item,
            'materials': materials,
            'activity': activity,
            'product': product,
            'regions': get_regions(),
            'has_manufactured_components': has_manufactured_components,
            'has_cap_part_components': has_cap_part_components,
            't2_manufacturing_skill': t2_manufacturing_skill,
            'science_skill': science_skill,
            'industry_skills': get_common_industry_skill(char),
            'me': me,
            'te': te,
        })
Example #3
0
def reaction(item_id):
    """ Display the manufacturing page with all data """
    item = Item.query.get(item_id)
    char = current_user.pref.prod_character

    if item is None:
        abort(404)

    if item.max_production_limit is None:
        activity_product = item.product_for_activities.filter_by(
            activity=ActivityEnum.REACTIONS.id
        ).one_or_none()
        if activity_product is not None:
            return redirect(
                url_for(
                    ".reaction",
                    item_id=activity_product.item_id
                ),
                code=301
            )
        abort(404)

    activity = item.activities.filter_by(
        activity=ActivityEnum.REACTIONS.id
    ).one()
    materials = item.activity_materials.filter_by(
        activity=ActivityEnum.REACTIONS.id
    )
    product = item.activity_products.filter_by(
        activity=ActivityEnum.REACTIONS.id
    ).one()

    return render_template('blueprint/reaction.html', **{
        'blueprint': item,
        'materials': materials,
        'activity': activity,
        'product': product,
        'regions': get_regions(),
        'industry_skills': get_common_industry_skill(char),
    })
Example #4
0
def reaction(item_id):
    """ Display the manufacturing page with all data """
    item = Item.query.get(item_id)
    char = current_user.pref.prod_character

    if item is None or item.max_production_limit is None:
        abort(404)

    activity = item.activities.filter_by(activity=Activity.REACTIONS).one()
    materials = item.activity_materials.filter_by(activity=Activity.REACTIONS)
    product = item.activity_products.filter_by(
        activity=Activity.REACTIONS).one()

    return render_template(
        'blueprint/reaction.html', **{
            'blueprint': item,
            'materials': materials,
            'activity': activity,
            'product': product,
            'regions': get_regions(),
            'industry_skills': get_common_industry_skill(char),
        })
Example #5
0
def invention(item_id):
    """ Display the invention page with all price data pre calculated """
    item = Item.query.get(item_id)
    char = current_user.pref.invention_character

    if item is None:
        abort(404)

    # check if the blueprint requested actually has invention available
    check_invention = ActivityProduct.query.filter_by(
        item_id=item_id
    ).filter_by(
        activity=ActivityEnum.INVENTION.aid
    ).first()

    if item.max_production_limit is None or check_invention is None:
        # the item_id is not a blueprint, so get the blueprint then redirect
        if item.max_production_limit is None and item.is_from_manufacturing:
            source_blueprint = item.product_for_activities.filter_by(
                activity=ActivityEnum.MANUFACTURING.aid
            ).one_or_none()
            return redirect(
                url_for(
                    ".invention",
                    item_id=source_blueprint.item_id
                ),
                code=301
            )

        # the item id is always a blueprint or an non manufactured item here
        # so we check if it's a blueprint (check_invention is None) and get
        # the source from invention, or abort.
        if item.max_production_limit is not None:
            activity_product = item.product_for_activities.filter_by(
                activity=ActivityEnum.INVENTION.aid
            ).one_or_none()
            if activity_product is not None:
                return redirect(
                    url_for(
                        ".invention",
                        item_id=activity_product.item_id
                    ),
                    code=301
                )

        abort(404)

    # global activity
    activity_copy = item.activities.filter_by(
        activity=ActivityEnum.COPYING.aid
    ).first()

    invention_skills = item.activity_skills.filter_by(
        activity=ActivityEnum.INVENTION.aid
    ).all()

    # copy stuff
    copy_base_cost = 0.0
    if activity_copy is not None:
        # copy base cost, as it's different from the invention
        materials = item.activity_materials.filter_by(
            activity=ActivityEnum.MANUFACTURING.aid
        )
        copy_base_cost = calculate_base_cost(materials)

    # loop through skills for display as we need to do the difference
    # between both skills (not the same bonuses in invention probability)
    encryption_skill = None
    datacore_skills = []
    for s in invention_skills:
        skill = get_skill_data(s.skill, char)
        if skill.name.find('Encryption') == -1:
            datacore_skills.append(skill)
        else:
            encryption_skill = skill

    # other skills

    # calculate baseCost for invention
    materials = item.activity_products.filter_by(
        activity=ActivityEnum.INVENTION.aid
    ).first().product.activity_materials.filter_by(
        activity=ActivityEnum.MANUFACTURING.aid
    )
    invention_base_cost = calculate_base_cost(materials)

    # base solar system
    indexes = IndustryIndex.query.filter(
        IndustryIndex.solarsystem_id == SolarSystem.id,
        SolarSystem.name == current_user.pref.invention_system,
        IndustryIndex.activity.in_([
            ActivityEnum.COPYING.aid,
            ActivityEnum.INVENTION.aid,
        ])
    )

    index_list = {}
    for index in indexes:
        index_list[index.activity] = index.cost_index

    # get decryptor
    decryptors = Decryptor.query.all()

    # display
    return render_template('blueprint/invention.html', **{
        'blueprint': item,
        'activity_copy': activity_copy,
        'activity_invention': item.activities.filter_by(
            activity=ActivityEnum.INVENTION.aid
        ).one(),
        'copy_base_cost': copy_base_cost,
        'invention_base_cost': invention_base_cost,
        'datacore_skills': datacore_skills,
        'decryptors': decryptors,
        'encryption_skill': encryption_skill,
        'index_list': index_list,
        'invention_materials': item.activity_materials.filter_by(
            activity=ActivityEnum.INVENTION.aid
        ).all(),
        'invention_products': item.activity_products.filter_by(
            activity=ActivityEnum.INVENTION.aid
        ).all(),
        'regions': get_regions(),
        'industry_skills': get_common_industry_skill(char),
    })
Example #6
0
def manufacturing(item_id, me=0, te=0):
    """ Display the manufacturing page with all data """
    item = Item.query.get(item_id)
    char = current_user.pref.prod_character

    if item is None:
        abort(404)

    if item.max_production_limit is None:
        if item.is_from_manufacturing:
            activity_product = item.product_for_activities.filter_by(
                activity=ActivityEnum.MANUFACTURING.id
            ).one()
            return redirect(
                url_for(
                    ".manufacturing",
                    item_id=activity_product.item_id,
                    me=me,
                    te=te
                ),
                code=301
            )
        abort(404)

    activity = item.activities.filter_by(
        activity=ActivityEnum.MANUFACTURING.id
    ).one()
    materials = item.activity_materials.filter_by(
        activity=ActivityEnum.MANUFACTURING.id
    )
    product = item.activity_products.filter_by(
        activity=ActivityEnum.MANUFACTURING.id
    ).one()

    # get science skill name, if applicable
    manufacturing_skills = item.activity_skills.filter_by(
        activity=ActivityEnum.MANUFACTURING.id,
    ).filter(
        ActivitySkill.skill_id != 3380  # industry
    )

    science_skill = []
    t2_manufacturing_skill = None
    for activity_skill in manufacturing_skills:
        if activity_skill.skill_id in IGNORED_PROD_SKILLS:
            continue
        skill = get_skill_data(activity_skill.skill, char)
        if activity_skill.skill.market_group_id == 369:
            t2_manufacturing_skill = skill

        if activity_skill.skill.market_group_id == 375:
            science_skill.append(skill)

    # is any of the materials manufactured ?
    has_manufactured_components = False
    has_cap_part_components = False

    for material in materials:
        if material.material.is_from_manufacturing:
            has_manufactured_components = True
        if material.material.is_cap_part():
            has_cap_part_components = True

    return render_template('blueprint/manufacturing.html', **{
        'blueprint': item,
        'materials': materials,
        'activity': activity,
        'product': product,
        'regions': get_regions(),
        'has_manufactured_components': has_manufactured_components,
        'has_cap_part_components': has_cap_part_components,
        't2_manufacturing_skill': t2_manufacturing_skill,
        'science_skill': science_skill,
        'industry_skills': get_common_industry_skill(char),
        'me': me,
        'te': te,
    })
Example #7
0
def invention(item_id):
    """ Display the invention page with all price data pre calculated """
    item = Item.query.get(item_id)
    char = current_user.pref.invention_character

    if item is None:
        abort(404)

    # check if the blueprint requested actually has invention available
    check_invention = ActivityProduct.query.filter_by(
        item_id=item_id
    ).filter_by(
        activity=ActivityEnum.INVENTION.id
    ).first()

    if item.max_production_limit is None or check_invention is None:
        # the item_id is not a blueprint, so get the blueprint then redirect
        if item.max_production_limit is None and item.is_from_manufacturing:
            source_blueprint = item.product_for_activities.filter_by(
                activity=ActivityEnum.MANUFACTURING.id
            ).one_or_none()
            return redirect(
                url_for(
                    ".invention",
                    item_id=source_blueprint.item_id
                ),
                code=301
            )

        # the item id is always a blueprint or an non manufactured item here
        # so we check if it's a blueprint (check_invention is None) and get
        # the source from invention, or abort.
        if item.max_production_limit is not None:
            activity_product = item.product_for_activities.filter_by(
                activity=ActivityEnum.INVENTION.id
            ).one_or_none()
            if activity_product is not None:
                return redirect(
                    url_for(
                        ".invention",
                        item_id=activity_product.item_id
                    ),
                    code=301
                )

        abort(404)

    # global activity
    activity_copy = item.activities.filter_by(
        activity=ActivityEnum.COPYING.id
    ).first()

    invention_skills = item.activity_skills.filter_by(
        activity=ActivityEnum.INVENTION.id
    ).all()

    # copy stuff
    copy_base_cost = 0.0
    if activity_copy is not None:
        # copy base cost, as it's different from the invention
        materials = item.activity_materials.filter_by(
            activity=ActivityEnum.MANUFACTURING.id
        )
        copy_base_cost = calculate_base_cost(materials)

    # loop through skills for display as we need to do the difference
    # between both skills (not the same bonuses in invention probability)
    encryption_skill = None
    datacore_skills = []
    for s in invention_skills:
        skill = get_skill_data(s.skill, char)
        if skill.name.find('Encryption') == -1:
            datacore_skills.append(skill)
        else:
            encryption_skill = skill

    # other skills

    # calculate baseCost for invention
    materials = item.activity_products.filter_by(
        activity=ActivityEnum.INVENTION.id
    ).first().product.activity_materials.filter_by(
        activity=ActivityEnum.MANUFACTURING.id
    )
    invention_base_cost = calculate_base_cost(materials)

    # base solar system
    indexes = IndustryIndex.query.filter(
        IndustryIndex.solarsystem_id == SolarSystem.id,
        SolarSystem.name == current_user.pref.invention_system,
        IndustryIndex.activity.in_([
            ActivityEnum.COPYING.id,
            ActivityEnum.INVENTION.id,
        ])
    )

    index_list = {}
    for index in indexes:
        index_list[index.activity] = index.cost_index

    # get decryptor
    decryptors = Decryptor.query.all()

    # display
    return render_template('blueprint/invention.html', **{
        'blueprint': item,
        'activity_copy': activity_copy,
        'activity_invention': item.activities.filter_by(
            activity=ActivityEnum.INVENTION.id
        ).one(),
        'copy_base_cost': copy_base_cost,
        'invention_base_cost': invention_base_cost,
        'datacore_skills': datacore_skills,
        'decryptors': decryptors,
        'encryption_skill': encryption_skill,
        'index_list': index_list,
        'invention_materials': item.activity_materials.filter_by(
            activity=ActivityEnum.INVENTION.id
        ).all(),
        'invention_products': item.activity_products.filter_by(
            activity=ActivityEnum.INVENTION.id
        ).all(),
        'regions': get_regions(),
        'industry_skills': get_common_industry_skill(char),
    })
Example #8
0
def invention(item_id):
    """ Display the invention page with all price data pre calculated """
    item = Item.query.get(item_id)
    char = current_user.pref.invention_character

    if item is None or item.max_production_limit is None:
        abort(404)

    # global activity
    activity_copy = item.activities.filter_by(
        activity=Activity.COPYING).first()

    invention_skills = item.activity_skills.filter_by(
        activity=Activity.INVENTION).all()

    # copy stuff
    copy_base_cost = 0.0
    if activity_copy is not None:
        # copy base cost, as it's different from the invention
        materials = item.activity_materials.filter_by(
            activity=Activity.MANUFACTURING)
        copy_base_cost = calculate_base_cost(materials)

    # loop through skills for display as we need to do the difference
    # between both skills (not the same bonuses in invention probability)
    encryption_skill = None
    datacore_skills = []
    for s in invention_skills:
        skill = get_skill_data(s.skill, char)
        if skill.name.find('Encryption') == -1:
            datacore_skills.append(skill)
        else:
            encryption_skill = skill

    # other skills

    # calculate baseCost for invention
    materials = item.activity_products.filter_by(
        activity=Activity.INVENTION).first(
        ).product.activity_materials.filter_by(activity=Activity.MANUFACTURING)
    invention_base_cost = calculate_base_cost(materials)

    # base solar system
    indexes = IndustryIndex.query.filter(
        IndustryIndex.solarsystem_id == SolarSystem.id,
        SolarSystem.name == current_user.pref.invention_system,
        IndustryIndex.activity.in_([
            Activity.COPYING,
            Activity.INVENTION,
        ]))

    index_list = {}
    for index in indexes:
        index_list[index.activity] = index.cost_index

    # get decryptor
    decryptors = Decryptor.query.all()

    # display
    return render_template(
        'blueprint/invention.html', **{
            'blueprint':
            item,
            'activity_copy':
            activity_copy,
            'activity_invention':
            item.activities.filter_by(activity=Activity.INVENTION).one(),
            'copy_base_cost':
            copy_base_cost,
            'invention_base_cost':
            invention_base_cost,
            'datacore_skills':
            datacore_skills,
            'decryptors':
            decryptors,
            'encryption_skill':
            encryption_skill,
            'index_list':
            index_list,
            'invention_materials':
            item.activity_materials.filter_by(
                activity=Activity.INVENTION).all(),
            'invention_products':
            item.activity_products.filter_by(
                activity=Activity.INVENTION).all(),
            'regions':
            get_regions(),
            'industry_skills':
            get_common_industry_skill(char),
        })