Ejemplo n.º 1
0
def editToolName(tool, name):
    print("Current name for ["+str(tool.getID())+"] : " + str(name))
    newName = input("Input new name or null to go back: ")
    if newName == "":
        return name
    else:
        return DevHelpers.NameFormat(newName)
Ejemplo n.º 2
0
def editEffectIngName(effect, name):
    print("Current Ingredient name for [" + str(effect.getID()) + "] : " +
          str(name))
    newName = input("Input new name or null to go back: ")
    if newName == "":
        return name
    else:
        return DevHelpers.NameFormat(newName)
Ejemplo n.º 3
0
def changePrereq(ingre, prereq):
    print("\nSelect what to change the prerequisite to [" +
          str(ingre.getID()) + "]")
    print("Gold | Potion | None | Current prereq: " + str(prereq))
    print("Type null to go back")
    newReq = input().upper()
    if newReq == "":
        return prereq
    if newReq == "G" or newReq == "GOLD":
        while (True):
            Value = input("Value: ")
            if Value == "":
                Value = 1
            try:
                Value = int(Value)
            except ValueError:
                print("That is not a integer")
            if type(Value) == int:
                if Value < 0:
                    Value = 1
                break
        prereq = {"Gold": Value}
    if newReq == "P" or newReq == "POTION":
        potName = input("Potion Name: ")
        potName = DevHelpers.NameFormat(potName)
        potCol = input("Potion Color: ")
        potCol = DevHelpers.checkColor(potCol)
        potEff = input("Potion Effect: ")
        #potEff = DevHelpers.checkEffect(potEff)
        prereq = {
            "Potion": {
                "Name": potName,
                "Color": potCol,
                "Effect": potEff
            }
        }

    if newReq == "N" or newReq == "NONE":
        prereq = "None"
    print(prereq)
    return prereq
Ejemplo n.º 4
0
def createRecipe():
    Tools = helpers.InitTools()
    Ingredients = helpers.InitIngredients()
    Ingredients.sort(key=lambda k: k.getName())
    Combinations = helpers.InitCreateRecipes()
    Extractions = helpers.InitExtractRecipes()
    Running = True
    print("=====Create Recipe=====")
    RecipeType = None
    while Running:
        while True:
            print("Type Q to quit")
            option = input(
                "Select Type of Recipe (Combination | Extraction): ").upper()
            option = option.upper()
            if option == "Q" or option == "EXIT" or option == "QUIT" or option == "STOP" or option == "END":
                Running = False
                break
            if option == "COMBINATION" or option == "C":
                RecipeType = "Combination"
                break
            if option == "EXTRACTION" or option == "E":
                RecipeType = "Extraction"
                break
            print("Invalid option\n")

        if RecipeType == None:
            print("How did you get here?")

        while True:
            # Select ID
            ID = input("Input ID: ")
            ID = DevHelpers.IDFormat(ID)

            for T in Tools:
                if T.getID() == ID:
                    print("ID already taken")
                    continue
            break

        # Select Name
        name = input("Input Name: ")
        name = DevHelpers.NameFormat(name)

        #Select Tool
        selectedTool = None
        while True:
            leave = False
            tool = input("Select Tool, Type \'List\' to list tools:")
            if tool.upper() == "LIST" or tool.upper() == "L":
                DevHelpers.printTools(Tools, RecipeType)
                continue
            tool = DevHelpers.IDFormat(tool)
            for i in Tools:
                if i.getID() == tool:
                    if i.getUse() == RecipeType:
                        leave = True
                        selectedTool = i
                        break
                    else:
                        break
            if leave == True:
                break
            print("Invalid Tool [" + str(tool) + "]\n")

        #Select Requrement(s)
        reqs = []
        print("\nType \'List\' to list out ingredients")
        for i in range(selectedTool.getInSlots()):
            while True:
                leave = False
                ingre = input("Input Ingredient requirement #" + str(i + 1) +
                              ": ")
                if ingre.upper() == "LIST" or ingre.upper() == "L":
                    DevHelpers.printIngredients(Ingredients)
                    continue
                ingre = DevHelpers.IDFormat(ingre)
                for ing in Ingredients:
                    if ing.getID() == ingre:
                        reqs.append(ingre)
                        leave = True
                        break
                if leave:
                    break
                print("Invalid Ingredient: [" + ingre + "]\n")
                print("Type \'List\' to list out ingredients")

        # Select Results(s)
        results = []
        print("\nType \'List\' to list out ingredients")
        for i in range(selectedTool.getOutSlots()):
            while True:
                leave = False

                ingre = input("Input Ingredient results #" + str(i + 1) + ": ")
                if ingre.upper() == "LIST" or ingre.upper() == "L":
                    DevHelpers.printIngredients(Ingredients)
                    continue
                ingre = DevHelpers.IDFormat(ingre)
                for ing in Ingredients:
                    if ing.getID() == ingre:
                        results.append(ingre)
                        leave = True
                        break
                if leave:
                    break
                print("Invalid Ingredient: [" + ingre + "]\n")
                print("Type \'List\' to list out ingredients")

        # Select Unlocked status
        unlocked = input("Select unlocked status (True | False): ").upper()
        if unlocked == "TRUE" or unlocked == "T":
            unlocked = True
        elif unlocked == "FALSE" or unlocked == "F":
            unlocked = False
        else:
            print("Invalid input, setting to True")
            unlocked = True

        # Create Recipe
        if RecipeType == "Extraction":
            newRecipe = helpers.ExtractRecipe(ID, name, tool, reqs, results,
                                              unlocked)
            Extractions.append(newRecipe)
        elif RecipeType == "Combination":
            newRecipe = helpers.CombineRecipe(ID, name, tool, reqs, results,
                                              unlocked)
            Combinations.append(newRecipe)
        ans = input("Sucessfully added to list, continue? (y/n): ")
        if ans.upper() != 'Y':
            Running = False
    helpers.saveExtractRecipes(Extractions)
    helpers.saveCreateRecipes(Combinations)
Ejemplo n.º 5
0
def createTool():
    Tools = helpers.InitTools()
    Running = True
    print("=====Create Tool=====")
    while Running:
        print("Type q to quit")

        # Select ID
        ID = input("Input ID: ")
        ID = DevHelpers.IDFormat(ID)
        option = ID.upper()
        if option == "Q" or option == "EXIT" or option == "QUIT" or option == "STOP" or option == "END":
            Running = False
            break
        setContinue = False
        for T in Tools:
            if T.getID() == ID:
                print("ID already taken")
                setContinue = True
                break
        if setContinue:
            continue

        # Select Name
        name = input("Input Name: ")
        name = DevHelpers.NameFormat(name)

        # Select Image Dir
        img = input("Input Image directory: ")
        if not os.path.exists(img):
            print("Path does not exist, setting default")
            img = "sprites/UnknownWhite.png"

        # Select Use
        while True:
            use = input("Input usage for tool (Extraction | Combination): ")
            if use.upper() == "EXTRACTION" or use.upper() == "Combination":
                use = DevHelpers.NameFormat(use)
                break
            if use.upper() == "E":
                use = "Extraction"
                break
            if use.upper() == "C":
                use = "Combination"
                break
            print("Invalid Input\n")

        # Select Inslots
        while True:
            inSlots = input("Input number of input slots (1-5): ")
            if inSlots == "":
                inSlots = 1
                break
            try:
                inSlots = int(inSlots)
            except ValueError:
                print("That is not a integer")
            if type(inSlots) == int:
                if inSlots < 0:
                    inSlots = 1
                if inSlots > 5:
                    inSlots = 5
                break

        # Select OutSlots
        while True:
            outSlots = input("Input number of output slots (1-5): ")
            if outSlots == "":
                outSlots = 1
                break
            try:
                outSlots = int(outSlots)
            except ValueError:
                print("That is not a integer")
            if type(outSlots) == int:
                if outSlots < 0:
                    outSlots = 1
                if outSlots > 5:
                    outSlots = 5
                break

        # Select Unlocked status
        while True:
            unlocked = input("Input unlocked status: ")
            if unlocked.upper() == "TRUE" or unlocked.upper() == "T":
                unlocked = True
                break
            if unlocked.upper() == "FALSE" or unlocked.upper() == "F":
                unlocked = False
                break
            print("Invalid input\n")

        # Create Tool
        newTool = helpers.Tool(ID, name, img, use, inSlots, outSlots, unlocked)
        Tools.append(newTool)
        ans = input("Sucessfully added to list, continue? (y/n): ")
        if ans.upper() != 'Y':
            Running = False
    helpers.saveTools(Tools)
Ejemplo n.º 6
0
def createLocation():
    Locations = helpers.InitLocations()
    Ingredients = helpers.InitIngredients()
    Ingredients.sort(key=lambda k: k.getName())
    Running = True
    print("=====Create Location=====")
    while Running:
        print("Type q to quit")

        # Select ID
        ID = input("Input ID: ")
        ID = DevHelpers.IDFormat(ID)
        option = ID.upper()
        if option == "Q" or option == "EXIT" or option == "QUIT" or option == "STOP" or option == "END":
            Running = False
            break
        setContinue = False
        for I in Locations:
            if I.getID() == ID:
                print("ID already taken")
                setContinue = True
                break
        if setContinue:
            continue

        # Select Name
        name = input("Input Name:")
        name = DevHelpers.NameFormat(name)

        # Select ImgDir
        img = input("Input Image directory: ")
        if not os.path.exists(img):
            print("Path does not exist, setting default")
            img = "sprites/UnknownWhite.png"

        # Select Color
        color = input("Input Color: ")
        if DevHelpers.checkColor(color) == None:
            print("Color not recognized, setting to random")
            color = helpers.randCol()
        else:
            color = DevHelpers.checkColor(color)

        # Select Ingredients
        while True:
            ingredients = input(
                "Input Ingredients, separated by a comma - [ing1, ing2]\nType \"list\" for a list of ingredients: "
            )
            if ingredients.upper() == "LIST":
                DevHelpers.printIngredients(Ingredients)
            else:
                break

        # Select Drop Rates for Ingredients
        dropRates = []
        ingreList = ingredients.split(",")
        for i in range(len(ingreList)):
            ingreList[i] = DevHelpers.IDFormat(ingreList[i])
            if ingreList[i] == "_":
                continue
            while True:
                dropRate = input(str(ingreList[i]) + "\'s drop rate (0-1): ")
                if dropRate == "":
                    dropRate = 0.5
                try:
                    dropRate = float(dropRate)
                except ValueError:
                    print("That is not a float")
                if type(dropRate) == float:
                    if dropRate < 0:
                        dropRate = 0.5
                    break
            # Select Drop Amounts for Ingredients
            while True:
                dropAmount = input(str(ingreList[i]) + "\'s drop amount: ")
                if dropAmount == "":
                    dropAmount = 1
                try:
                    dropAmount = int(dropAmount)
                except ValueError:
                    print("That is not a int")
                if type(dropAmount) == int:
                    if dropAmount < 0:
                        dropAmount = 1
                    break
            dropRates.append([dropRate, dropAmount])

        # Select Prereqs
        prereqs = []
        for i in range(3):
            Type = input("Input prerequisite " + str(i + 1) +
                         " options:\n (Gold) (Potion) (None): ")

            # If prereq is gold
            if Type.upper() == "GOLD" or Type.upper() == "G":
                while (True):
                    Value = input("Value: ")
                    if Value == "":
                        Value = 1
                    try:
                        Value = int(Value)
                    except ValueError:
                        print("That is not a integer")
                    if type(Value) == int:
                        if Value < 0:
                            Value = 1
                        break
                prereqs.append({"Gold": Value})

            # If prereq is Potion
            elif Type.upper() == "POTION" or Type.upper() == "P" or Type.upper(
            ) == "POT":
                potName = input("Potion Name: ")
                potName = DevHelpers.NameFormat(potName)
                potCol = input("Potion Color: ")
                potCol = DevHelpers.checkColor(potCol)
                potEff = input("Potion Effect: ")
                # potEff = DevHelpers.checkEffect(potEff)
                prereq = {
                    "Potion": {
                        "Name": potName,
                        "Color": potCol,
                        "Effect": potEff
                    }
                }
            else:
                prereqs.append("None")

        # Create Location
        newLoc = helpers.Location(ID, name, img, color, ingreList, dropRates,
                                  prereqs[0], prereqs[1], prereqs[2])
        Locations.append(newLoc)
        ans = input("Sucessfully added to list, continue? (y/n): ")
        if ans.upper() != 'Y':
            Running = False
    helpers.saveLocations(Locations)