Example #1
0
def try_solve(status: Status, timeLimit=None):
    best = None
    queue = [[status, []]]
    Logger.hideTag("Math")
    record = set()
    start = time.perf_counter()
    while queue:
        if timeLimit is not None and time.perf_counter() - start > timeLimit:
            Logger.showTag("Math")
            return best
        tempData = queue.pop(0)
        allow = allowSkills(tempData[0])
        for skills in allow:
            tempStats = tempData[0]
            for i, skill in enumerate(skills):
                tempStats = tempStats.use_skill(SkillManager[skill])
                if tempStats.ball != BallManager.WhiteBall:
                    tempStats.ball = BallManager.WhiteBall
            if tempStats.get_status_string() not in record:
                record.add(tempStats.get_status_string())
                newData = [tempStats, tempData[1] + skills]
                if tempStats.currentDurability > durReq and (
                        best is None
                        or tempStats.currentQuality > best[0].currentQuality):
                    for s in newData[1]:
                        if s not in AllowBuffs:
                            best = newData
                            break
                queue.append(newData)
    Logger.showTag("Math")
    return best
Example #2
0
    int(config['player']['cp']),
)
target = Target(int(config['target']['rlv']),
                int(config['target']['Durability']),
                int(config['target']['Progress']),
                int(config['target']['Quality']))
'''
Status: object store the craft state
Status([Crafter], [Target], [the ball state])
'''
status = None
memFix = config['MemoryFixStatus']['open'] == 'True'
terminator = config['AutoTerminator']['open'] == 'True'
log_name = "log.txt"

Logger.hideTag("Math")
CraftSolver.init(player, target)
Logger.showTag("Math")
data_queue = []
if memFix: from core.Utils.FFxivCraftMem import fix_status, fix_crafter
if terminator: from solver.stages.Terminator import Terminator
terminate = False


def format_status(status):
    print("#" * 10 + "r %s" % status.rounds + "#" * 10)
    print("ball:\t{}".format(status.ball.name))
    print("durability:\t{}/{}".format(status.currentDurability,
                                      status.target.maxDurability))
    print("progress:\t{}/{}".format(status.currentProgress,
                                    status.target.maxProgress))