예제 #1
0
def JobTeam(data):
    """
    Converts a workers.teams.Team object into an industry.Team for assignment to a job.
    """
    workerTeam = data.team
    team = industry.Team(teamID=workerTeam.teamID,
                         activityID=workerTeam.activity,
                         solarSystemID=workerTeam.solarSystemID,
                         isInAuction=data.isInAuction)
    team.modifiers.append(
        industry.CostModifier(1.0 + workerTeam.GetCostModifier() / 100.0,
                              reference=industry.Reference.TEAM,
                              activity=workerTeam.activity))
    for bonusType, amount, groups in workerTeam.GetAllBonuses():
        blueprints = set(
            itertools.chain.from_iterable(
                [GetBlueprintsByProductGroup(groupID) for groupID in groups]))
        if bonusType == workers.qualityEffects.TIME_EFFICIENCY:
            team.modifiers.append(
                industry.TimeModifier(1.0 + amount / 100.0,
                                      reference=industry.Reference.TEAM,
                                      activity=workerTeam.activity,
                                      blueprints=blueprints))
        elif bonusType == workers.qualityEffects.MATERIAL_EFFICIENCY:
            team.modifiers.append(
                industry.MaterialModifier(1.0 + amount / 100.0,
                                          reference=industry.Reference.TEAM,
                                          activity=workerTeam.activity,
                                          blueprints=blueprints))

    team.data = workerTeam
    return team
예제 #2
0
def GetDecryptors(job):
    """
    Returns an industry material with all the decryptors suitable for this blueprint.
    """
    if job.activityID == industry.INVENTION:
        if boot.role == 'client':
            dogma = sm.GetService('godma')
        else:
            dogma = sm.GetService('dogmaStaticMgr')
        options = [industry.Material(mutable=True)]
        for decryptor in cfg.typesByGroups.get(const.groupDecryptors, []):
            options.append(
                industry.Material(
                    mutable=True,
                    typeID=decryptor.typeID,
                    quantity=1,
                    modifiers=[
                        industry.MaxRunsModifier(
                            dogma.GetTypeAttribute(
                                decryptor.typeID,
                                const.attributeInventionMaxRunModifier),
                            output=True,
                            activity=industry.INVENTION,
                            reference=industry.Reference.DECRYPTOR),
                        industry.MaterialModifier(
                            dogma.GetTypeAttribute(
                                decryptor.typeID,
                                const.attributeInventionMEModifier) / 100.0,
                            output=True,
                            activity=industry.INVENTION,
                            reference=industry.Reference.DECRYPTOR),
                        industry.TimeModifier(
                            dogma.GetTypeAttribute(
                                decryptor.typeID,
                                const.attributeInventionPEModifier) / 100.0,
                            output=True,
                            activity=industry.INVENTION,
                            reference=industry.Reference.DECRYPTOR),
                        industry.ProbabilityModifier(
                            dogma.GetTypeAttribute(
                                decryptor.typeID,
                                const.attributeInventionPropabilityMultiplier),
                            activity=industry.INVENTION,
                            reference=industry.Reference.DECRYPTOR)
                    ]))

        decryptor = industry.Material(mutable=True, options=options)
        if job.request:
            allTypes = decryptor.all_types()
            for typeID in job.request['materials']:
                if typeID in allTypes:
                    decryptor.select(typeID)

        if getattr(job, 'optionalTypeID', None) in decryptor.all_types():
            decryptor.select(job.optionalTypeID)
        if getattr(job, 'optionalTypeID2', None) in decryptor.all_types():
            decryptor.select(job.optionalTypeID2)
        return [decryptor]
    return []
예제 #3
0
 def job_modifiers(self, job):
     modifiers = []
     if job.materialEfficiency:
         modifiers.append(
             industry.MaterialModifier(
                 1.0 - job.materialEfficiency / 100.0,
                 reference=industry.Reference.BLUEPRINT))
     if job.timeEfficiency:
         modifiers.append(
             industry.TimeModifier(1.0 - job.timeEfficiency / 100.0,
                                   reference=industry.Reference.BLUEPRINT))
     return modifiers