Exemple #1
0
def printUpgrades(currentGear, allGear):
    headerString = 'UPGRADES'
    print('\n\n\n%s\n%s\n' % (headerString, '-' * len(headerString)))

    headers = ['DPS Diff', 'Name', 'ilvl', 'Location', 'Boss']

    for slot in sorted(list(currentGear.keys())):
        piece = currentGear[slot]
        print('\n\n\n%s (%s, %.2f DPS)' % (slot, piece['Name'], piece['DPS']))

        actualSlotString = CalcUtil.removeUnderscore(slot)

        outputItems = []

        for otherName in allGear[actualSlotString]:
            otherPiece = copy.deepcopy(allGear[actualSlotString][otherName])
            otherPiece['DPS Diff'] = otherPiece['DPS'] - piece['DPS']

            if (otherPiece['DPS Diff'] > 0):
                outputItems.append(otherPiece)

        outputItems.sort(lambda p1, p2: int(p2['DPS'] - p1['DPS']))

        print('')
        print(DataUtil.getTabulated(outputItems, headers))
        print('')
    def printAllGear(slot, globs):
        nameToPiece = globs.allGear[slot]

        charInfo = globs.charInfo

        for name in nameToPiece:
            piece = nameToPiece[name]
            piece['DPS'] = CalcUtil.calcDPS(piece, charInfo)

        items = sorted(list(nameToPiece.values()),
                       lambda p1, p2: int(p2['DPS'] - p1['DPS']))
        headers = ['Name', 'ilvl', 'DPS', 'Location', 'Boss']

        print(DataUtil.getTabulated(items, headers))
Exemple #3
0
def printAllGear(allGear):
    headerString = 'ALL GEAR'
    print('\n\n\n%s\n%s\n' % (headerString, '-' * len(headerString)))

    for slot in sorted(list(allGear.keys())):
        print('\n\n%s' % slot.upper())

        slotPieces = allGear[slot]

        sortedPieces = sorted(slotPieces.values(),
                              lambda p1, p2: int(p2['DPS'] - p1['DPS']))
        headers = ['DPS', 'Name', 'ilvl', 'Location', 'Boss']

        print('')
        print(DataUtil.getTabulated(sortedPieces, headers))
        print('')
Exemple #4
0
def calculateDiffs(globs):
    # Assign stats to the current gear and print it out
    currentGear = copy.deepcopy(globs.currentGear)

    # Print current gear
    items = [currentGear[slot] for slot in sorted(list(currentGear.keys()))]
    headers = ['Slot', 'Name', 'ilvl', 'Location', 'Boss', 'DPS']

    print('\nCurrent gear (%s %s):\n' %
          (globs.charInfo['Spec'], globs.charInfo['Class']))
    print(DataUtil.getTabulated(items, headers))

    # Print stat DPS
    print('\n\n\nStat DPS:\n')
    for stat in globs.charInfo['Stat DPS']:
        value = globs.charInfo['Stat DPS'][stat]
        print('%s:\t%.4f' % (stat, value))
    print('')

    # TODO
    # Factored this out into the Globals constructor.
    # Might want to get rid of this for sure later.
    # # Partition all gear into slots
    # allGear = CalcUtil.slotifyAllGear(globs.allGear)

    # Return a new object
    # Because mutation is wonky
    out = {}

    for slot in list(globs.allGear.keys()):
        out[slot] = {}

        # curPiece = currentGear[slot]

        actualSlotString = CalcUtil.removeUnderscore(slot)
        otherPieces = globs.allGear[actualSlotString]
        for name in otherPieces:
            # Making a deep copy gets rid of issues with having 2 ring slots.
            # The second DPSDiff calculation would clobber the original DPSDiff calculation.
            otherPiece = copy.deepcopy(otherPieces[name])
            # otherPiece['DPSDiff'] = CalcUtil.calcDPSDiff(curPiece, otherPiece, globs.statDPS)
            otherPiece['DPS'] = CalcUtil.calcDPS(otherPiece, globs.charInfo)

            out[slot][name] = otherPiece

    return out