Exemple #1
0
    def requiredBaseMaterials(self, typeID):
        """return the total base materials needed for a given item"""
        components = self.requiredComponents(typeID)
        breakDownDict = {}
        for component in components:
            bpTypeID = StaticData.producerID(component)
            if bpTypeID:  #this stupid conditional is needed because producerID returns strings but i need int, but if producerID returns null int throws an error.
                bpTypeID = int(bpTypeID)
            if not bpTypeID:
                breakDownDict[component] = components[component]
                continue
            elif bpTypeID in self.blueprints.blueprints:
                if self.blueprints.blueprints[bpTypeID].BPO.component == 1:
                    mats = self._componentsMaterialsCalculator(
                        components[component],
                        self.blueprints.blueprints[bpTypeID].BPO)
                    breakDownDict[component] = mats
                elif self.blueprints.blueprints[bpTypeID].BPO.component == 0:
                    mats = self.t1MaterialCost(
                        components[component],
                        self.blueprints.blueprints[bpTypeID])
                    breakDownDict[component] = mats

        try:
            return MatsBreakDown(breakDownDict, typeID,
                                 self.blueprints.blueprints[typeID].manufSize,
                                 components)
        except KeyError:
            t1TypeID = StaticData.originatorBp(typeID)
            return MatsBreakDown(
                breakDownDict, typeID,
                self.blueprints.blueprints[t1TypeID].manufSize, components)
Exemple #2
0
 def printTotMats(self):
     """print the total mats required for the optimized items"""
     print "ITEMS BUILDABLE WITH CURRENT RESOURCES:"
     for i in self.itemList:
         print "{}".format(StaticData.idName(StaticData.productID(i)))
     print "\n"
     print "TOTAL REQUIRED COMPONENTS:"
     for key in self.finalDict:
         print "{}\t{}".format(StaticData.idName(key), self.finalDict[key])
     print "\n"
     print "MISSING COMPONENTS:"
     remainingMinerals, requiredMats = StaticData.materialSubtraction(
         self.materials, self.finalDict)
     for key in requiredMats:
         if StaticData.producerID(key):
             print "{}\t{}".format(StaticData.idName(key),
                                   self.finalDict[key])