Esempio n. 1
0
    def confirm(self):
        selectedMod = re.sub(r"[^a-zA-Z0-9]+", ' ',
                             self.modSelector.get()).strip()
        if selectedMod == "":
            selectedMod = self.mods[0]

        text = self.text.get(1.0, END).strip()

        err = xmlParser.checkIfTypesXML(text)
        if err == 1:
            windows.showError(self.window, "Beginning of type is wrong",
                              "type has to start with <type ")

        if err == 2:
            windows.showError(self.window, "End of type is wrong",
                              "Ending is wrong,\n"
                              "Block possibly not closed")
        if err == 0:
            if text.startswith("<type n"):
                types = "<types>\n  " + text + "\n</types>"
            # Outsource this to own logic
            windows.appendTypesToDatabase(
                types, self.window, selectedMod,
                True if self.useNewVal.get() == 1 else False)

        self.window.destroy()
Esempio n. 2
0
    def distributePricing(self):
        rarity_is_set = True if self.v.get() == "rar" else False
        selSubtype = self.subTypeListbox.get(ANCHOR)
        selSubtype = "" if selSubtype == "UNASSIGNED" else selSubtype

        # name, subtype, tradercat, buyprice, sellprice, rarity, nominal, traderexclude
        itemsOfSubtype = dao.getSubtypeForTrader(selSubtype)
        rarities = []

        # rarity, nominal
        for item in itemsOfSubtype:
            rarities.append((item[5], item[6]))
        try:
            pricing = distribute(rarities, int(self.buyEntires[0].get()),
                                 int(self.buyEntires[1].get()),
                                 int(self.sellEntries[0].get()),
                                 int(self.sellEntries[1].get()), rarity_is_set)
        except IndexError:
            windows.showError(
                self.window, "No rarities",
                "Set the rarity for your items, or use nominals")

        buyPricing = pricing[0]
        sellPricing = pricing[1]

        for item in self.traderVal:
            try:
                keyValue = rarityForTrader[
                    item[1][0]] if rarity_is_set else item[1][2]
            except KeyError:
                keyValue = 0
            self.setEntryVal(item[0][1], buyPricing[keyValue])
            self.setEntryVal(item[0][2], sellPricing[keyValue])
Esempio n. 3
0
 def createDatabase(self):
     try:
         dao.createDB(self.database.get())
         dao.loadDB(windows.getContent(windows.dataPath + "\\GENESIS.sql"))
     except Exception as e:
         windows.showError(self.window, "Error",
                           "Failed to connect:\n" + str(e))
         windows.deleteParams()
Esempio n. 4
0
 def testDB(self):
     self.passParams()
     try:
         dao.getNominalByType("gun")
         windows.connectionSuccess(self.window)
     except Exception as e:
         windows.showError(self.window, "Error",
                           "Failed to connect:\n" + str(e))
         windows.deleteParams()
Esempio n. 5
0
    def upgradeDB(self):
        try:
            dao.addColumns()
        except Exception:
            pass
        self.window.withdraw()
        upgradeDB.upgrade()
        self.window.deiconify()

        windows.showError(self.window, "Upgrade", "Your Database has been updated")