diff --git a/DlgAddGear.py b/DlgAddGear.py
new file mode 100644
index 0000000..5b86d08
--- /dev/null
+++ b/DlgAddGear.py
@@ -0,0 +1,322 @@
+#- * -coding: utf - 8 - * -
+"""
+
+@author: ☙ Ryan McConnell ♈♑ rammcconnell@gmail.com ❧
+"""
+import os
+from PyQt5 import QtWidgets, Qt, QtCore
+from PyQt5.QtGui import QIcon
+import math
+from .QtCommon.Qt_common import QBlockSig
+from .Forms.dlg_add_gear import Ui_dlgSearchGear
+import queue
+import sqlite3
+import urllib3
+from .common import DB_FOLDER, IMG_TMP, GEAR_ID_FMT
+
+
+import operator
+from fuzzywuzzy import process
+
+
+class UniqueList(list):
+ def __init__(self, iterable=None):
+ super(UniqueList, self).__init__()
+ self.set = set()
+ lne = 0
+ if iterable is not None:
+ for i in iterable:
+ self.set.add(i)
+ this_len = len(self.set)
+ if this_len>lne:
+ super(UniqueList, self).append(i)
+ lne = this_len
+
+ def append(self, key):
+ if key not in self.set:
+ super(UniqueList, self).append(key)
+ self.set.add(key)
+
+ def pop(self, index=None):
+ item = super(UniqueList, self).pop(index)
+ self.set.remove(item)
+ return item
+
+ def insert(self, index, object):
+ try:
+ index = self.index(object)
+ super(UniqueList, self).pop(index)
+ except ValueError:
+ self.set.add(object)
+ super(UniqueList, self).insert(index, object)
+
+
+
+
+class FuzzyMatcher(object):
+ def __init__(self, items=None, items_str=None, split_token=' '):
+ if items is None:
+ items = UniqueList()
+ else:
+ items = UniqueList(items)
+ if items_str is None:
+ items_str = []
+ else:
+ items_str = items_str
+ self.items = items
+ self.split_token = split_token
+ self.items_str = items_str
+ self.lookup = None
+ self.tokens = set()
+
+ def add_item(self, item, item_str):
+ self.items.insert(0, item)
+ self.items_str.insert(0, item_str)
+
+ def clear(self):
+ self.items = UniqueList()
+ self.items_str = []
+ self.lookup = None
+ self.tokens = set()
+
+ def insert_many(self, items, items_str):
+ list(map(lambda x: self.add_item(*x), list(zip(items, items_str))))
+
+ def insert_many_f(self, items, str_f):
+ self.insert_many(items, list(map(str_f, items)))
+
+ def compute_lookup_table(self):
+ lookup = {}
+ tokens = self.tokens
+ items_str = self.items_str
+ for i,item in enumerate(self.items):
+ this_tokens = items_str[i].split(self.split_token)
+ for token in this_tokens:
+ try:
+ ar = lookup[token]
+ except KeyError:
+ ar = []
+ lookup[token] = ar
+ ar.append(item)
+ tokens.add(token)
+ self.lookup = lookup
+ self.tokens = tokens
+
+ def search(self, terms):
+ if self.lookup is None:
+ self.compute_lookup_table()
+ tally = {}
+ for i in self.items:
+ tally[i] = 0
+
+ lookup = self.lookup
+ tokens = self.tokens
+
+ for term in terms:
+ sadf = process.extract(term, tokens)
+ for token, val in sadf:
+ for match in lookup[token]:
+ tally[match] += val
+ return sorted(list(tally.items()), key=operator.itemgetter(1), reverse=True)
+
+
+conn = sqlite3.connect(os.path.join(DB_FOLDER, 'gear.sqlite3'))
+cur = conn.cursor()
+gears = {_[0]:_[1:] for _ in cur.execute('SELECT * FROM enh_Gear')}
+conn.close()
+
+gear_tup = [(k,v[0]) for k,v in gears.items()]
+gearzip = [x for x in zip(*gear_tup)]
+
+matcher = FuzzyMatcher(items=gearzip[0], items_str=gearzip[1])
+matcher.compute_lookup_table()
+
+
+class ImageQueueThread(QtCore.QThread):
+ DEATH = -42069
+ sig_icon_ready = QtCore.pyqtSignal(str, object)
+
+ def __init__(self, connection_pool, que):
+ super(ImageQueueThread, self).__init__()
+ self.que = que
+ self.live = True
+ self.connection_pool:urllib3.HTTPSConnectionPool = connection_pool
+
+ def run(self) -> None:
+ while self.live:
+ item = self.que.get(block=True)
+ try:
+ if item is not self.DEATH:
+ url, str_pth, twi = item
+
+ flag = True
+ try:
+ twi.column()
+ except RuntimeError:
+ flag = False
+
+ if flag:
+ dat = self.connection_pool.request('GET', url, preload_content=False)
+ with open(str_pth, 'wb') as f:
+ for chunk in dat.stream(512):
+ f.write(chunk)
+ self.sig_icon_ready.emit(str_pth, twi)
+ finally:
+ self.que.task_done()
+
+ def pull_the_plug(self):
+ self.live = False
+
+
+
+class Dlg_AddGear(QtWidgets.QDialog):
+ sig_gear_chosen = QtCore.pyqtSignal(str,str,str,str, name='sig_gear_chosen')
+
+ def __init__(self, frmMain):
+ super(Dlg_AddGear, self).__init__(parent=frmMain)
+ frmObj = Ui_dlgSearchGear()
+ self .ui = frmObj
+ frmObj.setupUi(self)
+ self.frmMain = frmMain
+
+
+ self.image_que = queue.Queue()
+
+
+ self.image_threads = []
+
+ for i in range(0, self.frmMain.pool_size):
+ th = ImageQueueThread(self.frmMain.connection, self.image_que)
+ th.sig_icon_ready.connect(self.icon_ready)
+ self.image_threads.append(th)
+ th.start()
+
+ self.search_results = []
+
+ frmObj.cmdSearch.clicked.connect(self.cmdSearch_clicked)
+ frmObj.spinPages.valueChanged.connect(self.update_table)
+ frmObj.spinResultsPerPage.valueChanged.connect(self.spinResultsPerPage_valueChanged)
+ frmObj.lstGear.setIconSize(QtCore.QSize(32, 32))
+
+ frmObj.lstGear.itemDoubleClicked.connect(self.lstGear_itemDoubleClicked)
+
+
+ def lstGear_itemDoubleClicked(self, item):
+ frmObj = self.ui
+ frmObj.txtSearch.setEnabled(False)
+ frmObj.cmdSearch.setEnabled(False)
+ frmObj.spinPages.setEnabled(False)
+ frmObj.spinResultsPerPage.setEnabled(False)
+ frmObj.cmdNext.setEnabled(False)
+ frmObj.cmdPrev.setEnabled(False)
+ row = item.row()
+ name = frmObj.lstGear.item(row, 0).text()
+ item_class = frmObj.lstGear.item(row, 1).text()
+ item_grade = frmObj.lstGear.item(row, 2).text()
+ item_id = frmObj.lstGear.item(row, 3).text()
+ self.sig_gear_chosen.emit(name, item_class, item_grade, item_id)
+ self.close()
+
+ def closeEvent(self, a0) -> None:
+ self.kill_pool()
+ super(Dlg_AddGear, self).closeEvent(a0)
+
+ def kill_pool(self):
+ for th in self.image_threads:
+ th.pull_the_plug()
+ for i in range(0, len(self.image_threads)):
+ self.image_que.put_nowait(ImageQueueThread.DEATH)
+
+ def icon_ready(self, path, twi):
+ this_icon = QIcon(path)
+ try:
+ twi.setIcon(this_icon)
+ except RuntimeError:
+ pass
+
+ def spinResultsPerPage_valueChanged(self):
+ self.update_spins()
+ self.update_table()
+
+ def cmdSearch_clicked(self):
+ frmObj = self.ui
+ search_text = frmObj.txtSearch.text().split(' ')
+ self.search_results = matcher.search(search_text)
+ self.update_spins()
+ with QBlockSig(frmObj.spinPages):
+ frmObj.spinPages.setValue(1)
+ self.update_table()
+
+ def update_spins(self):
+ frmObj = self.ui
+ spin_results_pp = frmObj.spinResultsPerPage.value()
+ pages = int(math.ceil(len(self.search_results) / spin_results_pp))
+ frmObj.spinPages.setMaximum(pages)
+
+ def update_table(self):
+ frmObj = self.ui
+ spin_page = frmObj.spinPages.value()
+ results_per_page = frmObj.spinResultsPerPage.value()
+
+ chunk_start = max(0, (spin_page-1) * results_per_page)
+ chunk_end = chunk_start + results_per_page
+
+ lstGear = frmObj.lstGear
+ lstGear.clear()
+ lstGear.setHorizontalHeaderLabels(['Name', 'Class', 'Grade', 'ID'])
+
+ this_page = self.search_results[chunk_start: chunk_end]
+ list_max_idx = lstGear.rowCount() - 1
+ for i,result in enumerate(this_page):
+ if i > list_max_idx:
+ list_max_idx += 1
+ lstGear.insertRow(list_max_idx)
+ itm_id = result[0]
+ this_gear = gears[itm_id]
+ name_item = QtWidgets.QTableWidgetItem(str(this_gear[0]))
+ res_class = this_gear[3]
+ if res_class == 0:
+ res_class_str = 'Weapons'
+ elif res_class == 1:
+ res_class_str = 'Armor'
+ elif res_class == 2:
+ res_class_str = 'Accessories'
+ else:
+ res_class_str = 'Error'
+ res_grade = this_gear[1]
+ if res_grade == 0:
+ res_grade_str = 'White'
+ elif res_grade == 1:
+ res_grade_str = 'Green'
+ elif res_grade == 2:
+ res_grade_str = 'Blue'
+ elif res_grade == 3:
+ res_grade_str = 'Yellow'
+ elif res_grade == 4:
+ res_grade_str = 'Orange'
+ else:
+ res_grade_str = 'Error'
+
+
+
+ name_p_str = f'{itm_id:08}'
+
+ img_file_name = os.path.join(IMG_TMP, name_p_str+'.png')
+
+ if os.path.isfile(img_file_name):
+ self.icon_ready(img_file_name, name_item)
+ else:
+ self.image_que.put((this_gear[2], img_file_name, name_item))
+ #dat = self.connection.urlopen('GET', )
+ #with open(img_file_name, 'wb') as f:
+ # f.write(dat.data)
+
+
+
+ class_item = QtWidgets.QTableWidgetItem(res_class_str)
+ grade_item = QtWidgets.QTableWidgetItem(res_grade_str)
+ id_item = QtWidgets.QTableWidgetItem(name_p_str)
+ lstGear.setItem(i, 0, name_item)
+ lstGear.setItem(i, 1, class_item)
+ lstGear.setItem(i, 2, grade_item)
+ lstGear.setItem(i, 3, id_item)
diff --git a/DlgCompact.py b/DlgCompact.py
index b316168..3cc6ea7 100644
--- a/DlgCompact.py
+++ b/DlgCompact.py
@@ -4,12 +4,14 @@
@author: ☙ Ryan McConnell ♈♑ rammcconnell@gmail.com ❧
"""
from PyQt5 import QtWidgets, Qt, QtCore, QtGui
-from common import Classic_Gear, Smashable
+from .common import Classic_Gear, Smashable
-import FrmMain
-from QtCommon.Qt_common import QBlockSort, QBlockSig
-from Forms.dlgCompact import Ui_dlgCompact
-from QtCommon.track_selection_proto import dlg_Track_Selection_Proto
+from . import FrmMain
+from .QtCommon.Qt_common import QBlockSort, QBlockSig
+from .Forms.dlgCompact import Ui_dlgCompact
+from .QtCommon.track_selection_proto import dlg_Track_Selection_Proto
+
+STR_TW_GEAR = 'lolwut'
class DlgFS(dlg_Track_Selection_Proto):
@@ -53,7 +55,7 @@ def __init__(self, app, parent=None):
def select_gear(self, gear_obj):
for i in range(0, self.ui.tableWidget.rowCount()):
- this_gear = self.ui.tableWidget.item(i, 0).__dict__[FrmMain.STR_TW_GEAR]
+ this_gear = self.ui.tableWidget.item(i, 0).__dict__[STR_TW_GEAR]
if this_gear is gear_obj:
self.select_row(i)
@@ -102,7 +104,7 @@ def dlg_FS_shelf_cellDoubleClicked(self, row, col):
self.ui.spinFS.setValue(row)
def dlg_Choices_cellDoubleClicked(self, row, col):
- dis_gear = self.dlg_Choices.ui.tableWidget.item(row, 0).__dict__[FrmMain.STR_TW_GEAR]
+ dis_gear = self.dlg_Choices.ui.tableWidget.item(row, 0).__dict__[STR_TW_GEAR]
self.set_gear(dis_gear)
def update_dlg_Choices(self):
@@ -112,14 +114,14 @@ def update_dlg_Choices(self):
table_Strat_Equip = self.frmMain.ui.table_Strat_Equip
def add_drc(table):
for i in range(0, table.rowCount()):
- item_twi = table.item(i, 0)
- dis_gear = item_twi.__dict__[FrmMain.STR_TW_GEAR]
- item = item_twi.text()
+ item_twi = table.cellWidget(i, 0)
+ dis_gear = item_twi.gear
+ item = dis_gear.get_full_name()
cost = table.item(i, 1).text()
loss_prevention = table.item(i, 2).text()
dlg_Choices.ui.tableWidget.insertRow(i)
twi = QtWidgets.QTableWidgetItem(item)
- twi.__dict__[FrmMain.STR_TW_GEAR] = dis_gear
+ twi.__dict__[STR_TW_GEAR] = dis_gear
dlg_Choices.ui.tableWidget.setItem(i,0, twi)
dlg_Choices.ui.tableWidget.setItem(i, 1, FrmMain.comma_seperated_twi(cost))
dlg_Choices.ui.tableWidget.setItem(i, 2, FrmMain.numeric_twi(loss_prevention))
@@ -163,7 +165,7 @@ def upgrade_gear(self):
enh_t = self.frmMain.get_enhance_table_item(dis_gear)
if enh_t is None:
return
- self.frmMain.upgrade_gear(dis_gear, enh_t)
+ #self.frmMain.upgrade_gear(dis_gear, enh_t)
self.set_frame()
self.update_dlg_FS_shelf()
@@ -208,9 +210,9 @@ def set_frame(self):
fs_lvl = frmObj.spinFS.value()
with QBlockSig(table_Strat):
table_Strat.selectRow(fs_lvl)
- first_col = table_Strat.item(fs_lvl, 1)
- gear_obj = first_col.__dict__[FrmMain.STR_TW_GEAR]
- frmMain.table_Strat_selectionChanged(first_col)
+ first_col = table_Strat.cellWidget(fs_lvl, 1)
+ gear_obj = first_col.gear
+ frmMain.table_Strat_selectionChanged()
self.update_dlg_Choices()
self.set_gear(gear_obj)
@@ -228,7 +230,7 @@ def set_gear(self, gear_obj):
dlg_FS_shelf = self.frmMain.ui.table_Strat
fail_times = 1
fs_lvl = frmObj.spinFS.value()
- while gear_obj == dlg_FS_shelf.item(fs_lvl, 1).__dict__[FrmMain.STR_TW_GEAR]:
+ while gear_obj == dlg_FS_shelf.cellWidget(fs_lvl, 1).gear:
fs_lvl += gear_obj.fs_gain()
fail_times += 1
fail_times -= 1
@@ -245,5 +247,5 @@ def get_strat_enhance_table_item(self, gear_obj):
table_Equip = self.frmMain.ui.table_Strat_Equip
for rew in range(0, table_Equip.rowCount()):
- if gear_obj is table_Equip.item(rew, 0).__dict__[FrmMain.STR_TW_GEAR]:
+ if gear_obj is table_Equip.cellWidget(rew, 0).gear:
return table_Equip.item(rew, 0)
diff --git a/Forms/Main_Window.py b/Forms/Main_Window.py
index a3837ba..822783d 100644
--- a/Forms/Main_Window.py
+++ b/Forms/Main_Window.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
-# Form implementation generated from reading ui file 'C:\Users\rammc\Documents\PycharmProjects\BDO_Enhancement_Tool\Forms\Main_Window.ui'
+# Form implementation generated from reading ui file 'C:\Users\rammc\Documents\Pycharm3\BDO_Enhancement_Tool\Forms\Main_Window.ui'
#
-# Created by: PyQt5 UI code generator 5.6
+# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
@@ -42,79 +42,126 @@ def setupUi(self, MainWindow):
self.tab_mp = QtWidgets.QWidget()
self.tab_mp.setObjectName("tab_mp")
self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.tab_mp)
- self.verticalLayout_5.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_5.setObjectName("verticalLayout_5")
self.widget_4 = QtWidgets.QWidget(self.tab_mp)
self.widget_4.setObjectName("widget_4")
self.gridLayout = QtWidgets.QGridLayout(self.widget_4)
self.gridLayout.setContentsMargins(8, 8, 8, 8)
self.gridLayout.setObjectName("gridLayout")
- self.label_14 = QtWidgets.QLabel(self.widget_4)
- self.label_14.setObjectName("label_14")
- self.gridLayout.addWidget(self.label_14, 6, 0, 1, 1)
- self.label_2 = QtWidgets.QLabel(self.widget_4)
- self.label_2.setObjectName("label_2")
- self.gridLayout.addWidget(self.label_2, 0, 0, 1, 1)
- self.label_7 = QtWidgets.QLabel(self.widget_4)
- self.label_7.setObjectName("label_7")
- self.gridLayout.addWidget(self.label_7, 2, 0, 1, 1)
- self.label_9 = QtWidgets.QLabel(self.widget_4)
- self.label_9.setObjectName("label_9")
- self.gridLayout.addWidget(self.label_9, 3, 0, 1, 1)
- self.label_11 = QtWidgets.QLabel(self.widget_4)
- self.label_11.setObjectName("label_11")
- self.gridLayout.addWidget(self.label_11, 4, 0, 1, 1)
- spacerItem = QtWidgets.QSpacerItem(20, 205, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
- self.gridLayout.addItem(spacerItem, 8, 1, 1, 1)
- self.label_5 = QtWidgets.QLabel(self.widget_4)
- self.label_5.setObjectName("label_5")
- self.gridLayout.addWidget(self.label_5, 1, 0, 1, 1)
+ self.lblCronStone = QtWidgets.QLabel(self.widget_4)
+ self.lblCronStone.setObjectName("lblCronStone")
+ self.gridLayout.addWidget(self.lblCronStone, 5, 1, 1, 1)
self.spin_Cost_Cleanse = QtWidgets.QSpinBox(self.widget_4)
self.spin_Cost_Cleanse.setProperty("showGroupSeparator", True)
self.spin_Cost_Cleanse.setMaximum(999999999)
self.spin_Cost_Cleanse.setObjectName("spin_Cost_Cleanse")
- self.gridLayout.addWidget(self.spin_Cost_Cleanse, 6, 1, 1, 1)
- self.label_12 = QtWidgets.QLabel(self.widget_4)
- self.label_12.setObjectName("label_12")
- self.gridLayout.addWidget(self.label_12, 5, 0, 1, 1)
+ self.gridLayout.addWidget(self.spin_Cost_Cleanse, 6, 2, 1, 1)
self.spin_Cost_MemFrag = QtWidgets.QSpinBox(self.widget_4)
self.spin_Cost_MemFrag.setProperty("showGroupSeparator", True)
self.spin_Cost_MemFrag.setMaximum(999999999)
self.spin_Cost_MemFrag.setObjectName("spin_Cost_MemFrag")
- self.gridLayout.addWidget(self.spin_Cost_MemFrag, 4, 1, 1, 1)
+ self.gridLayout.addWidget(self.spin_Cost_MemFrag, 4, 2, 1, 1)
self.spin_Cost_Cron = QtWidgets.QSpinBox(self.widget_4)
self.spin_Cost_Cron.setProperty("showGroupSeparator", True)
self.spin_Cost_Cron.setMaximum(999999999)
self.spin_Cost_Cron.setObjectName("spin_Cost_Cron")
- self.gridLayout.addWidget(self.spin_Cost_Cron, 5, 1, 1, 1)
+ self.gridLayout.addWidget(self.spin_Cost_Cron, 5, 2, 1, 1)
+ self.lblGearCleanse = QtWidgets.QLabel(self.widget_4)
+ self.lblGearCleanse.setObjectName("lblGearCleanse")
+ self.gridLayout.addWidget(self.lblGearCleanse, 6, 1, 1, 1)
+ self.lblMemoryFragment = QtWidgets.QLabel(self.widget_4)
+ self.lblMemoryFragment.setObjectName("lblMemoryFragment")
+ self.gridLayout.addWidget(self.lblMemoryFragment, 4, 1, 1, 1)
+ self.lblBlackStoneWeapon = QtWidgets.QLabel(self.widget_4)
+ self.lblBlackStoneWeapon.setObjectName("lblBlackStoneWeapon")
+ self.gridLayout.addWidget(self.lblBlackStoneWeapon, 0, 1, 1, 1)
+ self.lblConcBlackStoneWeapon = QtWidgets.QLabel(self.widget_4)
+ self.lblConcBlackStoneWeapon.setObjectName("lblConcBlackStoneWeapon")
+ self.gridLayout.addWidget(self.lblConcBlackStoneWeapon, 2, 1, 1, 1)
+ self.lblConcBlackStoneArmor = QtWidgets.QLabel(self.widget_4)
+ self.lblConcBlackStoneArmor.setObjectName("lblConcBlackStoneArmor")
+ self.gridLayout.addWidget(self.lblConcBlackStoneArmor, 3, 1, 1, 1)
+ spacerItem = QtWidgets.QSpacerItem(20, 205, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridLayout.addItem(spacerItem, 8, 2, 1, 1)
+ self.lblBlackStoneArmor = QtWidgets.QLabel(self.widget_4)
+ self.lblBlackStoneArmor.setObjectName("lblBlackStoneArmor")
+ self.gridLayout.addWidget(self.lblBlackStoneArmor, 1, 1, 1, 1)
+ self.spin_Cost_BlackStone_Weapon = QtWidgets.QSpinBox(self.widget_4)
+ self.spin_Cost_BlackStone_Weapon.setProperty("showGroupSeparator", True)
+ self.spin_Cost_BlackStone_Weapon.setMaximum(999999999)
+ self.spin_Cost_BlackStone_Weapon.setObjectName("spin_Cost_BlackStone_Weapon")
+ self.gridLayout.addWidget(self.spin_Cost_BlackStone_Weapon, 0, 2, 1, 1)
+ self.lblDragonScale = QtWidgets.QLabel(self.widget_4)
+ self.lblDragonScale.setObjectName("lblDragonScale")
+ self.gridLayout.addWidget(self.lblDragonScale, 7, 1, 1, 1)
+ self.spin_Cost_Dragon_Scale = QtWidgets.QSpinBox(self.widget_4)
+ self.spin_Cost_Dragon_Scale.setProperty("showGroupSeparator", True)
+ self.spin_Cost_Dragon_Scale.setMaximum(999999999)
+ self.spin_Cost_Dragon_Scale.setObjectName("spin_Cost_Dragon_Scale")
+ self.gridLayout.addWidget(self.spin_Cost_Dragon_Scale, 7, 2, 1, 1)
self.spin_Cost_BlackStone_Armor = QtWidgets.QSpinBox(self.widget_4)
self.spin_Cost_BlackStone_Armor.setProperty("showGroupSeparator", True)
self.spin_Cost_BlackStone_Armor.setMaximum(999999999)
self.spin_Cost_BlackStone_Armor.setObjectName("spin_Cost_BlackStone_Armor")
- self.gridLayout.addWidget(self.spin_Cost_BlackStone_Armor, 1, 1, 1, 1)
+ self.gridLayout.addWidget(self.spin_Cost_BlackStone_Armor, 1, 2, 1, 1)
self.spin_Cost_ConcArmor = QtWidgets.QSpinBox(self.widget_4)
self.spin_Cost_ConcArmor.setProperty("showGroupSeparator", True)
self.spin_Cost_ConcArmor.setMaximum(999999999)
self.spin_Cost_ConcArmor.setObjectName("spin_Cost_ConcArmor")
- self.gridLayout.addWidget(self.spin_Cost_ConcArmor, 3, 1, 1, 1)
- self.spin_Cost_BlackStone_Weapon = QtWidgets.QSpinBox(self.widget_4)
- self.spin_Cost_BlackStone_Weapon.setProperty("showGroupSeparator", True)
- self.spin_Cost_BlackStone_Weapon.setMaximum(999999999)
- self.spin_Cost_BlackStone_Weapon.setObjectName("spin_Cost_BlackStone_Weapon")
- self.gridLayout.addWidget(self.spin_Cost_BlackStone_Weapon, 0, 1, 1, 1)
+ self.gridLayout.addWidget(self.spin_Cost_ConcArmor, 3, 2, 1, 1)
self.spin_Cost_Conc_Weapon = QtWidgets.QSpinBox(self.widget_4)
self.spin_Cost_Conc_Weapon.setProperty("showGroupSeparator", True)
self.spin_Cost_Conc_Weapon.setMaximum(999999999)
self.spin_Cost_Conc_Weapon.setObjectName("spin_Cost_Conc_Weapon")
- self.gridLayout.addWidget(self.spin_Cost_Conc_Weapon, 2, 1, 1, 1)
- self.label_3 = QtWidgets.QLabel(self.widget_4)
- self.label_3.setObjectName("label_3")
- self.gridLayout.addWidget(self.label_3, 7, 0, 1, 1)
- self.spin_Cost_Dragon_Scale = QtWidgets.QSpinBox(self.widget_4)
- self.spin_Cost_Dragon_Scale.setProperty("showGroupSeparator", True)
- self.spin_Cost_Dragon_Scale.setMaximum(999999999)
- self.spin_Cost_Dragon_Scale.setObjectName("spin_Cost_Dragon_Scale")
- self.gridLayout.addWidget(self.spin_Cost_Dragon_Scale, 7, 1, 1, 1)
+ self.gridLayout.addWidget(self.spin_Cost_Conc_Weapon, 2, 2, 1, 1)
+ self.lblBlackStoneWeaponPic = QtWidgets.QLabel(self.widget_4)
+ self.lblBlackStoneWeaponPic.setMinimumSize(QtCore.QSize(32, 32))
+ self.lblBlackStoneWeaponPic.setMaximumSize(QtCore.QSize(32, 32))
+ self.lblBlackStoneWeaponPic.setText("")
+ self.lblBlackStoneWeaponPic.setObjectName("lblBlackStoneWeaponPic")
+ self.gridLayout.addWidget(self.lblBlackStoneWeaponPic, 0, 0, 1, 1)
+ self.lblBlackStoneArmorPic = QtWidgets.QLabel(self.widget_4)
+ self.lblBlackStoneArmorPic.setMinimumSize(QtCore.QSize(32, 32))
+ self.lblBlackStoneArmorPic.setMaximumSize(QtCore.QSize(32, 32))
+ self.lblBlackStoneArmorPic.setText("")
+ self.lblBlackStoneArmorPic.setObjectName("lblBlackStoneArmorPic")
+ self.gridLayout.addWidget(self.lblBlackStoneArmorPic, 1, 0, 1, 1)
+ self.lblConcBlackStoneWeaponPic = QtWidgets.QLabel(self.widget_4)
+ self.lblConcBlackStoneWeaponPic.setMinimumSize(QtCore.QSize(32, 32))
+ self.lblConcBlackStoneWeaponPic.setMaximumSize(QtCore.QSize(32, 32))
+ self.lblConcBlackStoneWeaponPic.setText("")
+ self.lblConcBlackStoneWeaponPic.setObjectName("lblConcBlackStoneWeaponPic")
+ self.gridLayout.addWidget(self.lblConcBlackStoneWeaponPic, 2, 0, 1, 1)
+ self.lblConcBlackStoneArmorPic = QtWidgets.QLabel(self.widget_4)
+ self.lblConcBlackStoneArmorPic.setMinimumSize(QtCore.QSize(32, 32))
+ self.lblConcBlackStoneArmorPic.setMaximumSize(QtCore.QSize(32, 32))
+ self.lblConcBlackStoneArmorPic.setText("")
+ self.lblConcBlackStoneArmorPic.setObjectName("lblConcBlackStoneArmorPic")
+ self.gridLayout.addWidget(self.lblConcBlackStoneArmorPic, 3, 0, 1, 1)
+ self.lblMemoryFragmentPic = QtWidgets.QLabel(self.widget_4)
+ self.lblMemoryFragmentPic.setMinimumSize(QtCore.QSize(32, 32))
+ self.lblMemoryFragmentPic.setMaximumSize(QtCore.QSize(32, 32))
+ self.lblMemoryFragmentPic.setText("")
+ self.lblMemoryFragmentPic.setObjectName("lblMemoryFragmentPic")
+ self.gridLayout.addWidget(self.lblMemoryFragmentPic, 4, 0, 1, 1)
+ self.lblCronStonePic = QtWidgets.QLabel(self.widget_4)
+ self.lblCronStonePic.setMinimumSize(QtCore.QSize(32, 32))
+ self.lblCronStonePic.setMaximumSize(QtCore.QSize(32, 32))
+ self.lblCronStonePic.setText("")
+ self.lblCronStonePic.setObjectName("lblCronStonePic")
+ self.gridLayout.addWidget(self.lblCronStonePic, 5, 0, 1, 1)
+ self.lblDragonScalePic = QtWidgets.QLabel(self.widget_4)
+ self.lblDragonScalePic.setMinimumSize(QtCore.QSize(32, 32))
+ self.lblDragonScalePic.setMaximumSize(QtCore.QSize(32, 32))
+ self.lblDragonScalePic.setText("")
+ self.lblDragonScalePic.setObjectName("lblDragonScalePic")
+ self.gridLayout.addWidget(self.lblDragonScalePic, 7, 0, 1, 1)
+ self.lblGearCleansePic = QtWidgets.QLabel(self.widget_4)
+ self.lblGearCleansePic.setMinimumSize(QtCore.QSize(32, 32))
+ self.lblGearCleansePic.setMaximumSize(QtCore.QSize(32, 32))
+ self.lblGearCleansePic.setText("")
+ self.lblGearCleansePic.setObjectName("lblGearCleansePic")
+ self.gridLayout.addWidget(self.lblGearCleansePic, 6, 0, 1, 1)
self.verticalLayout_5.addWidget(self.widget_4)
self.widget_5 = QtWidgets.QWidget(self.tab_mp)
self.widget_5.setObjectName("widget_5")
@@ -130,12 +177,11 @@ def setupUi(self, MainWindow):
self.tab_fs_equip = QtWidgets.QWidget()
self.tab_fs_equip.setObjectName("tab_fs_equip")
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.tab_fs_equip)
- self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.table_FS = QtWidgets.QTableWidget(self.tab_fs_equip)
self.table_FS.setAlternatingRowColors(True)
self.table_FS.setObjectName("table_FS")
- self.table_FS.setColumnCount(8)
+ self.table_FS.setColumnCount(7)
self.table_FS.setRowCount(0)
item = QtWidgets.QTableWidgetItem()
self.table_FS.setHorizontalHeaderItem(0, item)
@@ -151,8 +197,6 @@ def setupUi(self, MainWindow):
self.table_FS.setHorizontalHeaderItem(5, item)
item = QtWidgets.QTableWidgetItem()
self.table_FS.setHorizontalHeaderItem(6, item)
- item = QtWidgets.QTableWidgetItem()
- self.table_FS.setHorizontalHeaderItem(7, item)
self.table_FS.verticalHeader().setVisible(False)
self.verticalLayout_2.addWidget(self.table_FS)
self.widget = QtWidgets.QWidget(self.tab_fs_equip)
@@ -180,7 +224,6 @@ def setupUi(self, MainWindow):
self.tab_FS = QtWidgets.QWidget()
self.tab_FS.setObjectName("tab_FS")
self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.tab_FS)
- self.verticalLayout_4.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_4.setObjectName("verticalLayout_4")
self.table_FS_Cost = QtWidgets.QTableWidget(self.tab_FS)
self.table_FS_Cost.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
@@ -226,32 +269,14 @@ def setupUi(self, MainWindow):
self.tab_equip = QtWidgets.QWidget()
self.tab_equip.setObjectName("tab_equip")
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.tab_equip)
- self.verticalLayout_3.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_3.setObjectName("verticalLayout_3")
- self.table_Equip = QtWidgets.QTableWidget(self.tab_equip)
+ self.table_Equip = QtWidgets.QTreeWidget(self.tab_equip)
+ self.table_Equip.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
self.table_Equip.setAlternatingRowColors(True)
+ self.table_Equip.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
self.table_Equip.setObjectName("table_Equip")
- self.table_Equip.setColumnCount(8)
- self.table_Equip.setRowCount(0)
- item = QtWidgets.QTableWidgetItem()
- self.table_Equip.setHorizontalHeaderItem(0, item)
- item = QtWidgets.QTableWidgetItem()
- self.table_Equip.setHorizontalHeaderItem(1, item)
- item = QtWidgets.QTableWidgetItem()
- self.table_Equip.setHorizontalHeaderItem(2, item)
- item = QtWidgets.QTableWidgetItem()
- self.table_Equip.setHorizontalHeaderItem(3, item)
- item = QtWidgets.QTableWidgetItem()
- self.table_Equip.setHorizontalHeaderItem(4, item)
- item = QtWidgets.QTableWidgetItem()
- self.table_Equip.setHorizontalHeaderItem(5, item)
- item = QtWidgets.QTableWidgetItem()
- self.table_Equip.setHorizontalHeaderItem(6, item)
- item = QtWidgets.QTableWidgetItem()
- self.table_Equip.setHorizontalHeaderItem(7, item)
- self.table_Equip.horizontalHeader().setCascadingSectionResizes(False)
- self.table_Equip.horizontalHeader().setSortIndicatorShown(True)
- self.table_Equip.verticalHeader().setVisible(False)
+ self.table_Equip.header().setCascadingSectionResizes(False)
+ self.table_Equip.header().setStretchLastSection(False)
self.verticalLayout_3.addWidget(self.table_Equip)
self.widget_2 = QtWidgets.QWidget(self.tab_equip)
self.widget_2.setObjectName("widget_2")
@@ -281,7 +306,6 @@ def setupUi(self, MainWindow):
self.tab_strat = QtWidgets.QWidget()
self.tab_strat.setObjectName("tab_strat")
self.verticalLayout_6 = QtWidgets.QVBoxLayout(self.tab_strat)
- self.verticalLayout_6.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_6.setObjectName("verticalLayout_6")
self.splitter = QtWidgets.QSplitter(self.tab_strat)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
@@ -471,14 +495,14 @@ def setupUi(self, MainWindow):
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "Enhancement Optimizer"))
- self.label_14.setText(_translate("MainWindow", "Gear Cleanse Cost"))
- self.label_2.setText(_translate("MainWindow", "Black Stone (Weapon)"))
- self.label_7.setText(_translate("MainWindow", "Concentrated Magical Blackstone (Weapon)"))
- self.label_9.setText(_translate("MainWindow", "Concentrated Magical Blackstone (Armor)"))
- self.label_11.setText(_translate("MainWindow", "Memory Fragment"))
- self.label_5.setText(_translate("MainWindow", "Black Stone (Armor)"))
- self.label_12.setText(_translate("MainWindow", "Cron Stone"))
- self.label_3.setText(_translate("MainWindow", "Dragon Scale Cost"))
+ self.lblCronStone.setText(_translate("MainWindow", "Cron Stone"))
+ self.lblGearCleanse.setText(_translate("MainWindow", "Gear Cleanse Cost"))
+ self.lblMemoryFragment.setText(_translate("MainWindow", "Memory Fragment"))
+ self.lblBlackStoneWeapon.setText(_translate("MainWindow", "Black Stone (Weapon)"))
+ self.lblConcBlackStoneWeapon.setText(_translate("MainWindow", "Concentrated Magical Blackstone (Weapon)"))
+ self.lblConcBlackStoneArmor.setText(_translate("MainWindow", "Concentrated Magical Blackstone (Armor)"))
+ self.lblBlackStoneArmor.setText(_translate("MainWindow", "Black Stone (Armor)"))
+ self.lblDragonScale.setText(_translate("MainWindow", "Dragon Scale Cost"))
self.cmdMonniesMP.setText(_translate("MainWindow", "Refresh Prices"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_mp), _translate("MainWindow", "Monnies / MP"))
item = self.table_FS.horizontalHeaderItem(0)
@@ -490,12 +514,10 @@ def retranslateUi(self, MainWindow):
item = self.table_FS.horizontalHeaderItem(3)
item.setText(_translate("MainWindow", "Level"))
item = self.table_FS.horizontalHeaderItem(4)
- item.setText(_translate("MainWindow", "Max #"))
- item = self.table_FS.horizontalHeaderItem(5)
item.setText(_translate("MainWindow", "Sale Success"))
- item = self.table_FS.horizontalHeaderItem(6)
+ item = self.table_FS.horizontalHeaderItem(5)
item.setText(_translate("MainWindow", "Sale Fail"))
- item = self.table_FS.horizontalHeaderItem(7)
+ item = self.table_FS.horizontalHeaderItem(6)
item.setText(_translate("MainWindow", "Procurement Cost"))
self.cmdFSAutoPrice.setText(_translate("MainWindow", "Auto Check Price"))
self.cmdFSPrice.setText(_translate("MainWindow", "Check Price"))
@@ -519,22 +541,16 @@ def retranslateUi(self, MainWindow):
self.cmdFSEdit.setText(_translate("MainWindow", "Change Item"))
self.cmdFSGraph.setText(_translate("MainWindow", "View Graph"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_FS), _translate("MainWindow", "FS Cost"))
- item = self.table_Equip.horizontalHeaderItem(0)
- item.setText(_translate("MainWindow", "Name"))
- item = self.table_Equip.horizontalHeaderItem(1)
- item.setText(_translate("MainWindow", "Gear Type"))
- item = self.table_Equip.horizontalHeaderItem(2)
- item.setText(_translate("MainWindow", "Base Item Cost"))
- item = self.table_Equip.horizontalHeaderItem(3)
- item.setText(_translate("MainWindow", "Level"))
- item = self.table_Equip.horizontalHeaderItem(4)
- item.setText(_translate("MainWindow", "FS"))
- item = self.table_Equip.horizontalHeaderItem(5)
- item.setText(_translate("MainWindow", "Enhance Cost"))
- item = self.table_Equip.horizontalHeaderItem(6)
- item.setText(_translate("MainWindow", "Num Fails"))
- item = self.table_Equip.horizontalHeaderItem(7)
- item.setText(_translate("MainWindow", "Uses Memfrags"))
+ self.table_Equip.headerItem().setText(0, _translate("MainWindow", "Name"))
+ self.table_Equip.headerItem().setText(1, _translate("MainWindow", "Gear Type"))
+ self.table_Equip.headerItem().setText(2, _translate("MainWindow", "Base Cost"))
+ self.table_Equip.headerItem().setText(3, _translate("MainWindow", "Level"))
+ self.table_Equip.headerItem().setText(4, _translate("MainWindow", "FS"))
+ self.table_Equip.headerItem().setText(5, _translate("MainWindow", "Cost"))
+ self.table_Equip.headerItem().setText(6, _translate("MainWindow", "Mat Cost"))
+ self.table_Equip.headerItem().setText(7, _translate("MainWindow", "Num Fails"))
+ self.table_Equip.headerItem().setText(8, _translate("MainWindow", "Probability"))
+ self.table_Equip.headerItem().setText(9, _translate("MainWindow", "Uses Memfrags"))
self.cmdEquipAutoPrice.setText(_translate("MainWindow", "Auto Check Price"))
self.cmdEquipPrice.setText(_translate("MainWindow", "Check Price"))
self.cmdEquipCost.setText(_translate("MainWindow", "Calculate Costs"))
diff --git a/Forms/Main_Window.ui b/Forms/Main_Window.ui
index af7912d..6d9c392 100644
--- a/Forms/Main_Window.ui
+++ b/Forms/Main_Window.ui
@@ -96,42 +96,79 @@
8
- -
-
+
-
+
+
+ Cron Stone
+
+
+
+ -
+
+
+ true
+
+
+ 999999999
+
+
+
+ -
+
+
+ true
+
+
+ 999999999
+
+
+
+ -
+
+
+ true
+
+
+ 999999999
+
+
+
+ -
+
Gear Cleanse Cost
- -
-
+
-
+
- Black Stone (Weapon)
+ Memory Fragment
- -
-
+
-
+
- Concentrated Magical Blackstone (Weapon)
+ Black Stone (Weapon)
- -
-
+
-
+
- Concentrated Magical Blackstone (Armor)
+ Concentrated Magical Blackstone (Weapon)
- -
-
+
-
+
- Memory Fragment
+ Concentrated Magical Blackstone (Armor)
- -
+
-
Qt::Vertical
@@ -144,15 +181,15 @@
- -
-
+
-
+
Black Stone (Armor)
- -
-
+
-
+
true
@@ -161,15 +198,15 @@
- -
-
+
-
+
- Cron Stone
+ Dragon Scale Cost
- -
-
+
-
+
true
@@ -178,8 +215,8 @@
- -
-
+
-
+
true
@@ -188,8 +225,8 @@
- -
-
+
-
+
true
@@ -198,8 +235,8 @@
- -
-
+
-
+
true
@@ -208,40 +245,155 @@
- -
-
-
- true
+
-
+
+
+
+ 32
+ 32
+
-
- 999999999
+
+
+ 32
+ 32
+
+
+
+
- -
-
-
- true
+
-
+
+
+
+ 32
+ 32
+
-
- 999999999
+
+
+ 32
+ 32
+
+
+
+
+
+
+
+ -
+
+
+
+ 32
+ 32
+
+
+
+
+ 32
+ 32
+
+
+
+
+
+
+
+ -
+
+
+
+ 32
+ 32
+
+
+
+
+ 32
+ 32
+
+
+
+
+
+
+
+ -
+
+
+
+ 32
+ 32
+
+
+
+
+ 32
+ 32
+
+
+
+
+
+
+
+ -
+
+
+
+ 32
+ 32
+
+
+
+
+ 32
+ 32
+
+
+
+
-
-
+
+
+
+ 32
+ 32
+
+
+
+
+ 32
+ 32
+
+
- Dragon Scale Cost
+
- -
-
-
- true
+
-
+
+
+
+ 32
+ 32
+
-
- 999999999
+
+
+ 32
+ 32
+
+
+
+
@@ -311,11 +463,6 @@
Level
-
-
- Max #
-
-
Sale Success
@@ -498,17 +645,20 @@
-
-
+
+
+ QAbstractItemView::NoEditTriggers
+
true
-
+
+ QAbstractItemView::MultiSelection
+
+
false
-
- true
-
-
+
false
@@ -523,7 +673,7 @@
- Base Item Cost
+ Base Cost
@@ -538,7 +688,12 @@
- Enhance Cost
+ Cost
+
+
+
+
+ Mat Cost
@@ -546,6 +701,11 @@
Num Fails
+
+
+ Probability
+
+
Uses Memfrags
diff --git a/Forms/dlgCompact.py b/Forms/dlgCompact.py
index d1b2e16..c2aa051 100644
--- a/Forms/dlgCompact.py
+++ b/Forms/dlgCompact.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
-# Form implementation generated from reading ui file 'C:\Users\rammc\Documents\PycharmProjects\BDO_Enhancement_Tool\Forms\dlgCompact.ui'
+# Form implementation generated from reading ui file 'C:\Users\rammc\Documents\Pycharm3\BDO_Enhancement_Tool\Forms\dlgCompact.ui'
#
-# Created by: PyQt5 UI code generator 5.6
+# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
@@ -11,42 +11,39 @@
class Ui_dlgCompact(object):
def setupUi(self, dlgCompact):
dlgCompact.setObjectName("dlgCompact")
- dlgCompact.resize(438, 111)
+ dlgCompact.resize(465, 116)
self.gridLayout = QtWidgets.QGridLayout(dlgCompact)
self.gridLayout.setObjectName("gridLayout")
- self.lblGear = QtWidgets.QLabel(dlgCompact)
- self.lblGear.setMinimumSize(QtCore.QSize(64, 64))
- self.lblGear.setStyleSheet("")
- self.lblGear.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignHCenter)
- self.lblGear.setWordWrap(True)
- self.lblGear.setObjectName("lblGear")
- self.gridLayout.addWidget(self.lblGear, 0, 4, 1, 1)
- self.label = QtWidgets.QLabel(dlgCompact)
- font = QtGui.QFont()
- font.setPointSize(11)
- font.setBold(True)
- font.setWeight(75)
- self.label.setFont(font)
- self.label.setObjectName("label")
- self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
- self.spinFS = QtWidgets.QSpinBox(dlgCompact)
- font = QtGui.QFont()
- font.setPointSize(14)
- font.setBold(False)
- font.setWeight(50)
- self.spinFS.setFont(font)
- self.spinFS.setMaximum(999)
- self.spinFS.setObjectName("spinFS")
- self.gridLayout.addWidget(self.spinFS, 0, 1, 1, 1)
- self.cmdChoices = QtWidgets.QPushButton(dlgCompact)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
+ self.widget = QtWidgets.QWidget(dlgCompact)
+ self.widget.setObjectName("widget")
+ self.verticalLayout = QtWidgets.QVBoxLayout(self.widget)
+ self.verticalLayout.setContentsMargins(0, 5, 0, 5)
+ self.verticalLayout.setObjectName("verticalLayout")
+ self.cmdDownagrade = QtWidgets.QPushButton(self.widget)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.cmdChoices.sizePolicy().hasHeightForWidth())
- self.cmdChoices.setSizePolicy(sizePolicy)
- self.cmdChoices.setMinimumSize(QtCore.QSize(0, 20))
- self.cmdChoices.setObjectName("cmdChoices")
- self.gridLayout.addWidget(self.cmdChoices, 1, 4, 1, 1)
+ sizePolicy.setHeightForWidth(self.cmdDownagrade.sizePolicy().hasHeightForWidth())
+ self.cmdDownagrade.setSizePolicy(sizePolicy)
+ self.cmdDownagrade.setMinimumSize(QtCore.QSize(25, 0))
+ self.cmdDownagrade.setObjectName("cmdDownagrade")
+ self.verticalLayout.addWidget(self.cmdDownagrade)
+ self.gridLayout.addWidget(self.widget, 0, 2, 1, 1)
+ self.widget_2 = QtWidgets.QWidget(dlgCompact)
+ self.widget_2.setObjectName("widget_2")
+ self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.widget_2)
+ self.verticalLayout_2.setContentsMargins(0, 5, 0, 5)
+ self.verticalLayout_2.setObjectName("verticalLayout_2")
+ self.cmdUpgrade = QtWidgets.QPushButton(self.widget_2)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.cmdUpgrade.sizePolicy().hasHeightForWidth())
+ self.cmdUpgrade.setSizePolicy(sizePolicy)
+ self.cmdUpgrade.setMinimumSize(QtCore.QSize(25, 0))
+ self.cmdUpgrade.setObjectName("cmdUpgrade")
+ self.verticalLayout_2.addWidget(self.cmdUpgrade)
+ self.gridLayout.addWidget(self.widget_2, 0, 5, 1, 1)
self.widget_3 = QtWidgets.QWidget(dlgCompact)
self.widget_3.setObjectName("widget_3")
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.widget_3)
@@ -76,42 +73,81 @@ def setupUi(self, dlgCompact):
self.horizontalLayout.addWidget(self.cmdFail)
self.verticalLayout_3.addWidget(self.widget_4)
self.gridLayout.addWidget(self.widget_3, 0, 6, 1, 1)
- self.widget = QtWidgets.QWidget(dlgCompact)
- self.widget.setObjectName("widget")
- self.verticalLayout = QtWidgets.QVBoxLayout(self.widget)
- self.verticalLayout.setContentsMargins(0, 5, 0, 5)
- self.verticalLayout.setObjectName("verticalLayout")
- self.cmdDownagrade = QtWidgets.QPushButton(self.widget)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.cmdDownagrade.sizePolicy().hasHeightForWidth())
- self.cmdDownagrade.setSizePolicy(sizePolicy)
- self.cmdDownagrade.setMinimumSize(QtCore.QSize(25, 0))
- self.cmdDownagrade.setObjectName("cmdDownagrade")
- self.verticalLayout.addWidget(self.cmdDownagrade)
- self.gridLayout.addWidget(self.widget, 0, 2, 1, 1)
- self.widget_2 = QtWidgets.QWidget(dlgCompact)
- self.widget_2.setObjectName("widget_2")
- self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.widget_2)
- self.verticalLayout_2.setContentsMargins(0, 5, 0, 5)
- self.verticalLayout_2.setObjectName("verticalLayout_2")
- self.cmdUpgrade = QtWidgets.QPushButton(self.widget_2)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
+ self.cmdChoices = QtWidgets.QPushButton(dlgCompact)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.cmdUpgrade.sizePolicy().hasHeightForWidth())
- self.cmdUpgrade.setSizePolicy(sizePolicy)
- self.cmdUpgrade.setMinimumSize(QtCore.QSize(25, 0))
- self.cmdUpgrade.setObjectName("cmdUpgrade")
- self.verticalLayout_2.addWidget(self.cmdUpgrade)
- self.gridLayout.addWidget(self.widget_2, 0, 5, 1, 1)
+ sizePolicy.setHeightForWidth(self.cmdChoices.sizePolicy().hasHeightForWidth())
+ self.cmdChoices.setSizePolicy(sizePolicy)
+ self.cmdChoices.setMinimumSize(QtCore.QSize(0, 20))
+ self.cmdChoices.setObjectName("cmdChoices")
+ self.gridLayout.addWidget(self.cmdChoices, 1, 4, 1, 1)
+ self.label = QtWidgets.QLabel(dlgCompact)
+ font = QtGui.QFont()
+ font.setPointSize(11)
+ font.setBold(True)
+ font.setWeight(75)
+ self.label.setFont(font)
+ self.label.setObjectName("label")
+ self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
+ self.spinFS = QtWidgets.QSpinBox(dlgCompact)
+ font = QtGui.QFont()
+ font.setPointSize(14)
+ font.setBold(False)
+ font.setWeight(50)
+ self.spinFS.setFont(font)
+ self.spinFS.setMaximum(999)
+ self.spinFS.setObjectName("spinFS")
+ self.gridLayout.addWidget(self.spinFS, 0, 1, 1, 1)
self.cmdFsShelf = QtWidgets.QPushButton(dlgCompact)
self.cmdFsShelf.setObjectName("cmdFsShelf")
self.gridLayout.addWidget(self.cmdFsShelf, 1, 1, 1, 1)
self.cmdDigestShelf = QtWidgets.QPushButton(dlgCompact)
self.cmdDigestShelf.setObjectName("cmdDigestShelf")
self.gridLayout.addWidget(self.cmdDigestShelf, 1, 6, 1, 1)
+ self.widget_5 = QtWidgets.QWidget(dlgCompact)
+ self.widget_5.setObjectName("widget_5")
+ self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.widget_5)
+ self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
+ self.horizontalLayout_2.setSpacing(2)
+ self.horizontalLayout_2.setObjectName("horizontalLayout_2")
+ self.widget_6 = QtWidgets.QWidget(self.widget_5)
+ self.widget_6.setObjectName("widget_6")
+ self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.widget_6)
+ self.verticalLayout_4.setObjectName("verticalLayout_4")
+ self.lblGearPicture = QtWidgets.QLabel(self.widget_6)
+ self.lblGearPicture.setMinimumSize(QtCore.QSize(32, 32))
+ self.lblGearPicture.setMaximumSize(QtCore.QSize(16777215, 16777215))
+ self.lblGearPicture.setText("")
+ self.lblGearPicture.setObjectName("lblGearPicture")
+ self.verticalLayout_4.addWidget(self.lblGearPicture)
+ self.lblGear = QtWidgets.QLabel(self.widget_6)
+ self.lblGear.setMinimumSize(QtCore.QSize(0, 0))
+ self.lblGear.setStyleSheet("")
+ self.lblGear.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignHCenter)
+ self.lblGear.setWordWrap(True)
+ self.lblGear.setObjectName("lblGear")
+ self.verticalLayout_4.addWidget(self.lblGear)
+ self.horizontalLayout_2.addWidget(self.widget_6)
+ self.widget_7 = QtWidgets.QWidget(self.widget_5)
+ self.widget_7.setObjectName("widget_7")
+ self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.widget_7)
+ self.verticalLayout_5.setObjectName("verticalLayout_5")
+ self.lblGearPicture_2 = QtWidgets.QLabel(self.widget_7)
+ self.lblGearPicture_2.setMinimumSize(QtCore.QSize(32, 32))
+ self.lblGearPicture_2.setMaximumSize(QtCore.QSize(16777215, 16777215))
+ self.lblGearPicture_2.setText("")
+ self.lblGearPicture_2.setObjectName("lblGearPicture_2")
+ self.verticalLayout_5.addWidget(self.lblGearPicture_2)
+ self.lblGear_2 = QtWidgets.QLabel(self.widget_7)
+ self.lblGear_2.setMinimumSize(QtCore.QSize(0, 0))
+ self.lblGear_2.setStyleSheet("")
+ self.lblGear_2.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignHCenter)
+ self.lblGear_2.setWordWrap(True)
+ self.lblGear_2.setObjectName("lblGear_2")
+ self.verticalLayout_5.addWidget(self.lblGear_2)
+ self.horizontalLayout_2.addWidget(self.widget_7)
+ self.gridLayout.addWidget(self.widget_5, 0, 3, 1, 2)
self.retranslateUi(dlgCompact)
QtCore.QMetaObject.connectSlotsByName(dlgCompact)
@@ -119,18 +155,20 @@ def setupUi(self, dlgCompact):
def retranslateUi(self, dlgCompact):
_translate = QtCore.QCoreApplication.translate
dlgCompact.setWindowTitle(_translate("dlgCompact", "Graveflo Enhance Calc"))
- self.lblGear.setToolTip(_translate("dlgCompact", "Selected Gear"))
- self.lblGear.setText(_translate("dlgCompact", "Gear"))
- self.label.setText(_translate("dlgCompact", "FS:"))
- self.spinFS.setToolTip(_translate("dlgCompact", "Current Failstack Value"))
- self.cmdChoices.setToolTip(_translate("dlgCompact", "Information Shelf"))
- self.cmdChoices.setText(_translate("dlgCompact", "Choices"))
- self.cmdSuccess.setText(_translate("dlgCompact", "SUCCESS"))
- self.cmdFail.setText(_translate("dlgCompact", "FAIL"))
self.cmdDownagrade.setToolTip(_translate("dlgCompact", "Downgrade Gear"))
self.cmdDownagrade.setText(_translate("dlgCompact", "<"))
self.cmdUpgrade.setToolTip(_translate("dlgCompact", "Upgrade Gear"))
self.cmdUpgrade.setText(_translate("dlgCompact", ">"))
+ self.cmdSuccess.setText(_translate("dlgCompact", "SUCCESS"))
+ self.cmdFail.setText(_translate("dlgCompact", "FAIL"))
+ self.cmdChoices.setToolTip(_translate("dlgCompact", "Information Shelf"))
+ self.cmdChoices.setText(_translate("dlgCompact", "Choices"))
+ self.label.setText(_translate("dlgCompact", "FS:"))
+ self.spinFS.setToolTip(_translate("dlgCompact", "Current Failstack Value"))
self.cmdFsShelf.setText(_translate("dlgCompact", "Fail Stacks"))
self.cmdDigestShelf.setText(_translate("dlgCompact", "Digest"))
+ self.lblGear.setToolTip(_translate("dlgCompact", "Selected Gear"))
+ self.lblGear.setText(_translate("dlgCompact", "Gear"))
+ self.lblGear_2.setToolTip(_translate("dlgCompact", "Selected Gear"))
+ self.lblGear_2.setText(_translate("dlgCompact", "Gear"))
diff --git a/Forms/dlgCompact.ui b/Forms/dlgCompact.ui
index c0ae457..f037d64 100644
--- a/Forms/dlgCompact.ui
+++ b/Forms/dlgCompact.ui
@@ -6,90 +6,92 @@
0
0
- 438
- 111
+ 465
+ 116
Graveflo Enhance Calc
- -
-
-
-
- 64
- 64
-
-
-
- Selected Gear
-
-
-
-
-
- Gear
-
-
- Qt::AlignBottom|Qt::AlignHCenter
-
-
- true
-
-
-
- -
-
-
-
- 11
- 75
- true
-
-
-
- FS:
-
-
-
- -
-
-
-
- 14
- 50
- false
-
-
-
- Current Failstack Value
-
-
- 999
-
+
-
+
+
+
+ 0
+
+
+ 5
+
+
+ 0
+
+
+ 5
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 25
+ 0
+
+
+
+ Downgrade Gear
+
+
+ <
+
+
+
+
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 20
-
-
-
- Information Shelf
-
-
- Choices
-
+
-
+
+
+
+ 0
+
+
+ 5
+
+
+ 0
+
+
+ 5
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 25
+ 0
+
+
+
+ Upgrade Gear
+
+
+ >
+
+
+
+
-
@@ -162,100 +164,194 @@ background:red;
- -
-
-
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 20
+
+
+
+ Information Shelf
+
+
+ Choices
+
+
+
+ -
+
+
+
+ 11
+ 75
+ true
+
+
+
+ FS:
+
+
+
+ -
+
+
+
+ 14
+ 50
+ false
+
+
+
+ Current Failstack Value
+
+
+ 999
+
+
+
+ -
+
+
+ Fail Stacks
+
+
+
+ -
+
+
+ Digest
+
+
+
+ -
+
+
+
+ 2
+
0
- 5
+ 0
0
- 5
+ 0
-
-
-
-
- 0
- 0
-
-
-
-
- 25
- 0
-
-
-
- Downgrade Gear
-
-
- <
-
+
+
+
-
+
+
+
+ 32
+ 32
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Selected Gear
+
+
+
+
+
+ Gear
+
+
+ Qt::AlignBottom|Qt::AlignHCenter
+
+
+ true
+
+
+
+
-
-
-
- -
-
-
-
- 0
-
-
- 5
-
-
- 0
-
-
- 5
-
-
-
-
-
- 0
- 0
-
-
-
-
- 25
- 0
-
-
-
- Upgrade Gear
-
-
- >
-
+
+
+
-
+
+
+
+ 32
+ 32
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Selected Gear
+
+
+
+
+
+ Gear
+
+
+ Qt::AlignBottom|Qt::AlignHCenter
+
+
+ true
+
+
+
+
- -
-
-
- Fail Stacks
-
-
-
- -
-
-
- Digest
-
-
-
diff --git a/Forms/dlg_About.py b/Forms/dlg_About.py
index 02ff289..02d08a2 100644
--- a/Forms/dlg_About.py
+++ b/Forms/dlg_About.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
-# Form implementation generated from reading ui file 'C:\Users\rammc\Documents\PycharmProjects\BDO_Enhancement_Tool\Forms\dlg_About.ui'
+# Form implementation generated from reading ui file 'C:\Users\rammc\Documents\Pycharm3\BDO_Enhancement_Tool\Forms\dlg_About.ui'
#
-# Created by: PyQt5 UI code generator 5.6
+# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
@@ -27,7 +27,6 @@ def setupUi(self, Dialog):
self.widget = QtWidgets.QWidget(Dialog)
self.widget.setObjectName("widget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.widget)
- self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName("verticalLayout")
self.textEdit = QtWidgets.QTextEdit(self.widget)
font = QtGui.QFont()
diff --git a/Forms/dlg_Export.py b/Forms/dlg_Export.py
index 49cac95..e2edf1e 100644
--- a/Forms/dlg_Export.py
+++ b/Forms/dlg_Export.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
-# Form implementation generated from reading ui file 'C:\Users\rammc\Documents\PycharmProjects\BDO_Enhancement_Tool\Forms\dlg_Export.ui'
+# Form implementation generated from reading ui file 'C:\Users\rammc\Documents\Pycharm3\BDO_Enhancement_Tool\Forms\dlg_Export.ui'
#
-# Created by: PyQt5 UI code generator 5.6
+# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
diff --git a/Forms/dlg_Sale_Balance.py b/Forms/dlg_Sale_Balance.py
index c8c0618..e6b4c6c 100644
--- a/Forms/dlg_Sale_Balance.py
+++ b/Forms/dlg_Sale_Balance.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
-# Form implementation generated from reading ui file 'C:\Users\rammc\Documents\PycharmProjects\BDO_Enhancement_Tool\Forms\dlg_Sale_Balance.ui'
+# Form implementation generated from reading ui file 'C:\Users\rammc\Documents\Pycharm3\BDO_Enhancement_Tool\Forms\dlg_Sale_Balance.ui'
#
-# Created by: PyQt5 UI code generator 5.6
+# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
@@ -17,13 +17,7 @@ def setupUi(self, DlgSaleBalance):
self.widget = QtWidgets.QWidget(DlgSaleBalance)
self.widget.setObjectName("widget")
self.gridLayout = QtWidgets.QGridLayout(self.widget)
- self.gridLayout.setContentsMargins(0, 0, 0, 0)
self.gridLayout.setObjectName("gridLayout")
- self.spinValue = QtWidgets.QSpinBox(self.widget)
- self.spinValue.setProperty("showGroupSeparator", True)
- self.spinValue.setMaximum(1000000000)
- self.spinValue.setObjectName("spinValue")
- self.gridLayout.addWidget(self.spinValue, 0, 1, 1, 1)
self.lblPercent = QtWidgets.QLabel(self.widget)
self.lblPercent.setObjectName("lblPercent")
self.gridLayout.addWidget(self.lblPercent, 1, 0, 1, 1)
@@ -60,6 +54,11 @@ def setupUi(self, DlgSaleBalance):
self.txtProfit.setObjectName("txtProfit")
self.horizontalLayout.addWidget(self.txtProfit)
self.gridLayout.addWidget(self.widget_2, 3, 1, 1, 1)
+ self.spinValue = QtWidgets.QDoubleSpinBox(self.widget)
+ self.spinValue.setProperty("showGroupSeparator", True)
+ self.spinValue.setMaximum(1000000000000.0)
+ self.spinValue.setObjectName("spinValue")
+ self.gridLayout.addWidget(self.spinValue, 0, 1, 1, 1)
self.verticalLayout.addWidget(self.widget)
self.buttonBox = QtWidgets.QDialogButtonBox(DlgSaleBalance)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
diff --git a/Forms/dlg_Sale_Balance.ui b/Forms/dlg_Sale_Balance.ui
index 6d024d2..b934505 100644
--- a/Forms/dlg_Sale_Balance.ui
+++ b/Forms/dlg_Sale_Balance.ui
@@ -17,16 +17,6 @@
-
-
-
-
-
- true
-
-
- 1000000000
-
-
-
-
@@ -112,6 +102,16 @@
+ -
+
+
+ true
+
+
+ 1000000000000.000000000000000
+
+
+
diff --git a/Forms/dlg_add_gear.py b/Forms/dlg_add_gear.py
new file mode 100644
index 0000000..d2dcb40
--- /dev/null
+++ b/Forms/dlg_add_gear.py
@@ -0,0 +1,115 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'C:\Users\rammc\Documents\Pycharm3\BDO_Enhancement_Tool\Forms\dlg_add_gear.ui'
+#
+# Created by: PyQt5 UI code generator 5.9.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_dlgSearchGear(object):
+ def setupUi(self, dlgSearchGear):
+ dlgSearchGear.setObjectName("dlgSearchGear")
+ dlgSearchGear.resize(683, 477)
+ self.verticalLayout = QtWidgets.QVBoxLayout(dlgSearchGear)
+ self.verticalLayout.setObjectName("verticalLayout")
+ self.widget = QtWidgets.QWidget(dlgSearchGear)
+ self.widget.setObjectName("widget")
+ self.horizontalLayout = QtWidgets.QHBoxLayout(self.widget)
+ self.horizontalLayout.setContentsMargins(2, 2, 2, 2)
+ self.horizontalLayout.setSpacing(5)
+ self.horizontalLayout.setObjectName("horizontalLayout")
+ self.txtSearch = QtWidgets.QLineEdit(self.widget)
+ self.txtSearch.setObjectName("txtSearch")
+ self.horizontalLayout.addWidget(self.txtSearch)
+ self.cmdSearch = QtWidgets.QPushButton(self.widget)
+ self.cmdSearch.setObjectName("cmdSearch")
+ self.horizontalLayout.addWidget(self.cmdSearch)
+ self.cmbGearType = QtWidgets.QComboBox(self.widget)
+ self.cmbGearType.setObjectName("cmbGearType")
+ self.cmbGearType.addItem("")
+ self.cmbGearType.addItem("")
+ self.cmbGearType.addItem("")
+ self.cmbGearType.addItem("")
+ self.horizontalLayout.addWidget(self.cmbGearType)
+ self.verticalLayout.addWidget(self.widget)
+ self.widget_2 = QtWidgets.QWidget(dlgSearchGear)
+ self.widget_2.setObjectName("widget_2")
+ self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.widget_2)
+ self.horizontalLayout_2.setContentsMargins(2, 2, 2, 2)
+ self.horizontalLayout_2.setSpacing(5)
+ self.horizontalLayout_2.setObjectName("horizontalLayout_2")
+ self.label = QtWidgets.QLabel(self.widget_2)
+ self.label.setObjectName("label")
+ self.horizontalLayout_2.addWidget(self.label)
+ self.spinResultsPerPage = QtWidgets.QSpinBox(self.widget_2)
+ self.spinResultsPerPage.setMinimum(1)
+ self.spinResultsPerPage.setMaximum(999999999)
+ self.spinResultsPerPage.setProperty("value", 20)
+ self.spinResultsPerPage.setObjectName("spinResultsPerPage")
+ self.horizontalLayout_2.addWidget(self.spinResultsPerPage)
+ spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.horizontalLayout_2.addItem(spacerItem)
+ self.spinPages = QtWidgets.QSpinBox(self.widget_2)
+ self.spinPages.setMinimum(1)
+ self.spinPages.setMaximum(999999999)
+ self.spinPages.setProperty("value", 1)
+ self.spinPages.setObjectName("spinPages")
+ self.horizontalLayout_2.addWidget(self.spinPages)
+ self.cmdPrev = QtWidgets.QPushButton(self.widget_2)
+ self.cmdPrev.setMaximumSize(QtCore.QSize(20, 20))
+ font = QtGui.QFont()
+ font.setPointSize(6)
+ self.cmdPrev.setFont(font)
+ self.cmdPrev.setObjectName("cmdPrev")
+ self.horizontalLayout_2.addWidget(self.cmdPrev)
+ self.cmdNext = QtWidgets.QPushButton(self.widget_2)
+ self.cmdNext.setMaximumSize(QtCore.QSize(20, 20))
+ font = QtGui.QFont()
+ font.setPointSize(6)
+ self.cmdNext.setFont(font)
+ self.cmdNext.setObjectName("cmdNext")
+ self.horizontalLayout_2.addWidget(self.cmdNext)
+ self.verticalLayout.addWidget(self.widget_2)
+ self.lstGear = QtWidgets.QTableWidget(dlgSearchGear)
+ self.lstGear.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
+ self.lstGear.setObjectName("lstGear")
+ self.lstGear.setColumnCount(4)
+ self.lstGear.setRowCount(0)
+ item = QtWidgets.QTableWidgetItem()
+ self.lstGear.setHorizontalHeaderItem(0, item)
+ item = QtWidgets.QTableWidgetItem()
+ self.lstGear.setHorizontalHeaderItem(1, item)
+ item = QtWidgets.QTableWidgetItem()
+ self.lstGear.setHorizontalHeaderItem(2, item)
+ item = QtWidgets.QTableWidgetItem()
+ self.lstGear.setHorizontalHeaderItem(3, item)
+ self.lstGear.horizontalHeader().setCascadingSectionResizes(True)
+ self.lstGear.verticalHeader().setCascadingSectionResizes(False)
+ self.verticalLayout.addWidget(self.lstGear)
+
+ self.retranslateUi(dlgSearchGear)
+ QtCore.QMetaObject.connectSlotsByName(dlgSearchGear)
+
+ def retranslateUi(self, dlgSearchGear):
+ _translate = QtCore.QCoreApplication.translate
+ dlgSearchGear.setWindowTitle(_translate("dlgSearchGear", "Add Gear"))
+ self.txtSearch.setPlaceholderText(_translate("dlgSearchGear", "Search..."))
+ self.cmdSearch.setText(_translate("dlgSearchGear", "Search"))
+ self.cmbGearType.setItemText(0, _translate("dlgSearchGear", "Any"))
+ self.cmbGearType.setItemText(1, _translate("dlgSearchGear", "Weapon"))
+ self.cmbGearType.setItemText(2, _translate("dlgSearchGear", "Armor"))
+ self.cmbGearType.setItemText(3, _translate("dlgSearchGear", "Accessory"))
+ self.label.setText(_translate("dlgSearchGear", "Results Per Page: "))
+ self.cmdPrev.setText(_translate("dlgSearchGear", "<"))
+ self.cmdNext.setText(_translate("dlgSearchGear", ">"))
+ item = self.lstGear.horizontalHeaderItem(0)
+ item.setText(_translate("dlgSearchGear", "Name"))
+ item = self.lstGear.horizontalHeaderItem(1)
+ item.setText(_translate("dlgSearchGear", "Class"))
+ item = self.lstGear.horizontalHeaderItem(2)
+ item.setText(_translate("dlgSearchGear", "Grade"))
+ item = self.lstGear.horizontalHeaderItem(3)
+ item.setText(_translate("dlgSearchGear", "ID"))
+
diff --git a/Forms/dlg_add_gear.ui b/Forms/dlg_add_gear.ui
new file mode 100644
index 0000000..f2df6cf
--- /dev/null
+++ b/Forms/dlg_add_gear.ui
@@ -0,0 +1,216 @@
+
+
+ dlgSearchGear
+
+
+
+ 0
+ 0
+ 683
+ 477
+
+
+
+ Add Gear
+
+
+ -
+
+
+
+ 5
+
+
+ 2
+
+
+ 2
+
+
+ 2
+
+
+ 2
+
+
-
+
+
+ Search...
+
+
+
+ -
+
+
+ Search
+
+
+
+ -
+
+
-
+
+ Any
+
+
+ -
+
+ Weapon
+
+
+ -
+
+ Armor
+
+
+ -
+
+ Accessory
+
+
+
+
+
+
+
+ -
+
+
+
+ 5
+
+
+ 2
+
+
+ 2
+
+
+ 2
+
+
+ 2
+
+
-
+
+
+ Results Per Page:
+
+
+
+ -
+
+
+ 1
+
+
+ 999999999
+
+
+ 20
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ 1
+
+
+ 999999999
+
+
+ 1
+
+
+
+ -
+
+
+
+ 20
+ 20
+
+
+
+
+ 6
+
+
+
+ <
+
+
+
+ -
+
+
+
+ 20
+ 20
+
+
+
+
+ 6
+
+
+
+ >
+
+
+
+
+
+
+ -
+
+
+ QAbstractItemView::SelectRows
+
+
+ true
+
+
+ false
+
+
+
+ Name
+
+
+
+
+ Class
+
+
+
+
+ Grade
+
+
+
+
+ ID
+
+
+
+
+
+
+
+
+
diff --git a/FrmMain.py b/FrmMain.py
index cc13748..a6a1d94 100644
--- a/FrmMain.py
+++ b/FrmMain.py
@@ -14,22 +14,24 @@
# TODO: Figure out a probability model for strat simulation
# TODO: Minimal mode window
-from Forms.Main_Window import Ui_MainWindow
-from Forms.dlg_Sale_Balance import Ui_DlgSaleBalance
-from Forms.dlgCompact import Ui_dlgCompact
-from dlgAbout import dlg_About
-from dlgExport import dlg_Export
-from QtCommon import Qt_common
-from common import relative_path_convert, gear_types, enumerate_gt_lvl, Classic_Gear, Smashable, enumerate_gt, binVf,\
- ItemStore, generate_gear_obj
-from model import Enhance_model, Invalid_FS_Parameters
+from .Forms.Main_Window import Ui_MainWindow
+from .Forms.dlg_Sale_Balance import Ui_DlgSaleBalance
+from .DlgAddGear import Dlg_AddGear, gears
+from .dlgAbout import dlg_About
+from .dlgExport import dlg_Export
+from .QtCommon import Qt_common
+from .common import relative_path_convert, gear_types, enumerate_gt_lvl, Classic_Gear, Smashable, enumerate_gt, binVf,\
+ ItemStore, generate_gear_obj, Gear, IMG_TMP, GEAR_ID_FMT, ENH_IMG_PATH
+from .model import Enhance_model, Invalid_FS_Parameters
import numpy, types, os
-from PyQt5.QtGui import QPixmap, QPalette
-from PyQt5.QtWidgets import QTableWidgetItem, QHeaderView, QSpinBox, QFileDialog, QMenu, QAction, QDialog, QVBoxLayout
-from PyQt5.QtCore import Qt, pyqtSignal
+from PyQt5.QtGui import QPixmap, QPalette, QIcon, QPainter
+from PyQt5.QtWidgets import QWidget, QTableWidgetItem, QHeaderView, QSpinBox, QFileDialog, QMenu, QAction, QDialog, QTreeWidgetItem
+from PyQt5.QtCore import Qt, pyqtSignal, QSize, QThread
+from PyQt5 import QtWidgets
+import urllib3
#from PyQt5 import QtWidgets
-from DlgCompact import Dlg_Compact
+from .DlgCompact import Dlg_Compact
QBlockSig = Qt_common.QBlockSig
NoScrollCombo = Qt_common.NoScrollCombo
@@ -38,18 +40,29 @@
get_dark_palette = Qt_common.get_dark_palette
QTableWidgetItem_NoEdit = Qt_common.QTableWidgetItem_NoEdit
-STR_TW_GEAR = 'gear_item'
+#STR_TW_GEAR = 'gear_item'
STR_COST_ERROR = 'Cost must be a number.'
MONNIES_FORMAT = "{:,}"
STR_TWO_DEC_FORMAT = "{:.2f}"
-STR_PERCENT_FORMAT = '{:.0f}%'
+STR_PERCENT_FORMAT = '{:.2f}%'
STR_INFINITE = 'INF'
+ITEM_PIC_DIR = relative_path_convert('Images/items/')
+STR_PIC_VALKS = os.path.join(ITEM_PIC_DIR, '00017800.png')
+STR_PIC_BSA = os.path.join(ITEM_PIC_DIR, '00000007.png')
+STR_PIC_BSW = os.path.join(ITEM_PIC_DIR, '00000008.png')
+STR_PIC_CBSA = os.path.join(ITEM_PIC_DIR, '00000019.png')
+STR_PIC_CBSW = os.path.join(ITEM_PIC_DIR, '00000018.png')
+STR_PIC_CRON = os.path.join(ITEM_PIC_DIR, '00016080.png')
+STR_PIC_MEME = os.path.join(ITEM_PIC_DIR, '00044195.png')
+STR_PIC_PRIEST = os.path.join(ITEM_PIC_DIR, 'ic_00017.png')
+STR_PIC_DRAGON_SCALE = os.path.join(ITEM_PIC_DIR, '00044364.png')
+
COL_GEAR_TYPE = 2
-COL_FS_SALE_SUCCESS = 5
-COL_FS_SALE_FAIL = 6
-COL_FS_PROC_COST = 7
+COL_FS_SALE_SUCCESS = 4
+COL_FS_SALE_FAIL = 5
+COL_FS_PROC_COST = 6
remove_numeric_modifiers = lambda x: x.replace(',', '').replace('%','')
@@ -61,11 +74,30 @@ def numeric_less_than(self, y):
# print self.cellWidget(self.row(), self.column())
+class ImageLoadThread(QThread):
+ DEATH = -42069
+ sig_icon_ready = pyqtSignal(str, str, name='sig_icon_ready')
+
+ def __init__(self, connection_pool, url_location, file_dest):
+ super(ImageLoadThread, self).__init__()
+ self.url = url_location
+ self.file_dest = file_dest
+ self.connection_pool:urllib3.HTTPSConnectionPool = connection_pool
+
+ def run(self) -> None:
+ url, str_pth = self.url, self.file_dest
+
+ dat = self.connection_pool.request('GET', url, preload_content=False)
+ with open(str_pth, 'wb') as f:
+ for chunk in dat.stream(512):
+ f.write(chunk)
+ self.sig_icon_ready.emit(url, str_pth)
+
+
class custom_twi(QTableWidgetItem, QSpinBox):
pass
-
class numeric_twi(QTableWidgetItem):
def __lt__(self, other):
return numeric_less_than(self, other)
@@ -102,6 +134,7 @@ def __init__(self, parent, lbl_txt):
self.lbl_txt = lbl_txt
self.balance = 0
+ #frmObj.spinValue.setMaximum(10000000000)
frmObj.buttonBox.accepted.connect(self.buttonBox_accepted)
frmObj.spinValue.valueChanged.connect(self.spinValue_valueChanged)
@@ -130,6 +163,251 @@ def buttonBox_accepted(self):
self.sig_accepted.emit(self.balance)
+class GearWidget(QWidget):
+ sig_gear_changed = pyqtSignal(object, name='sig_gear_changed')
+
+ def __init__(self, gear: Gear, frmMain, parent=None, edit_able=False, default_icon=None, display_full_name=False, check_state=None):
+ super(GearWidget, self).__init__(parent=parent)
+ self.gear = None
+ self.frmMain = frmMain
+ self.model: Enhance_model = frmMain.model
+ self.table_widget = None
+ self.icon = None
+ self.row = None
+ self.col = None
+ self.cmbLevel = None
+ self.cmbType = None
+ self.pixmap = None
+ self.horizontalLayout = QtWidgets.QHBoxLayout(self)
+ self.horizontalLayout.setObjectName("horizontalLayout")
+ self.display_full_name = display_full_name
+ self.edit_able= edit_able
+
+ self.chkInclude = None
+ self.labelIcon = None
+ self.txtEditName = None
+ self.load_thread = None
+ self.dlg_chose_gear = None
+ self.parent_widget = None
+ self.cmbType: QtWidgets.QComboBox = None
+ self.cmbLevel: QtWidgets.QComboBox = None
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+
+
+ self.lblName = Qt_common.CLabel(self)
+ self.horizontalLayout.addWidget(self.lblName)
+
+ self.lblName.sigMouseDoubleClick.connect(self.lblName_sigMouseDoubleClick)
+
+ if check_state is not None:
+ self.setCheckState(check_state)
+
+ if default_icon is not None:
+ self.set_icon(default_icon)
+
+ self.set_gear(gear)
+
+ def lblName_sigMouseDoubleClick(self, ev):
+ if self.edit_able:
+ self.txtEditName = Qt_common.FocusLineEdit(self)
+ self.txtEditName.setText(self.lblName.text())
+ self.txtEditName.selectAll()
+ self.horizontalLayout.replaceWidget(self.lblName, self.txtEditName)
+ self.txtEditName.returnPressed.connect(self.return_lblName)
+ self.txtEditName.sig_lost_focus.connect(self.return_lblName)
+ self.lblName.deleteLater()
+ self.lblName = None
+ self.txtEditName.setFocus()
+
+ def return_lblName(self):
+ if self.txtEditName is not None:
+ self.lblName = Qt_common.CLabel(self)
+ new_name = self.txtEditName.text()
+ self.lblName.setText(new_name)
+ self.gear.name = new_name
+ self.frmMain.ui.table_Equip.resizeColumnToContents(0)
+ self.horizontalLayout.replaceWidget(self.txtEditName, self.lblName)
+ self.lblName.sigMouseDoubleClick.connect(self.lblName_sigMouseDoubleClick)
+ self.txtEditName.deleteLater()
+ self.txtEditName = None
+
+ def load_gear_icon(self):
+ if self.gear.item_id is not None:
+ item_id = self.gear.item_id
+ pad_item_id = GEAR_ID_FMT.format(item_id)
+ try:
+ name, grade,url,itype = gears[item_id]
+ except KeyError:
+ return
+ icon_path = os.path.join(IMG_TMP, pad_item_id + '.png')
+ if os.path.isfile(icon_path):
+ self.set_icon(QIcon(icon_path))
+ else:
+ self.load_thread = ImageLoadThread(self.frmMain.connection, url , icon_path)
+ self.load_thread.sig_icon_ready.connect(lambda _url,_str_path: self.set_icon(QIcon(_str_path)))
+ self.load_thread.start()
+
+ def set_icon(self, icon: QIcon, enhance_overlay=True):
+ self.icon = icon
+ self.set_pixmap(icon.pixmap(QSize(32, 32)), enhance_overlay=enhance_overlay)
+
+ def set_pixmap(self, pixmap:QPixmap, enhance_overlay=True):
+ if self.pixmap is None:
+ self.labelIcon = Qt_common.CLabel(self)
+ self.labelIcon.setMinimumSize(QSize(32, 32))
+ self.labelIcon.setMaximumSize(QSize(32, 32))
+ self.labelIcon.setText("")
+ if self.chkInclude is None:
+ self.horizontalLayout.insertWidget(0, self.labelIcon)
+ else:
+ self.horizontalLayout.insertWidget(1, self.labelIcon)
+ self.labelIcon.sigMouseClick.connect(self.labelIcon_sigMouseClick)
+
+ if self.gear is not None and enhance_overlay:
+ enh_lvl_n = self.gear.enhance_lvl_to_number()
+ if enh_lvl_n > 0:
+ enhance_lvl = self.gear.enhance_lvl_from_number(enh_lvl_n-1)
+ enh_p = os.path.join(ENH_IMG_PATH, enhance_lvl+".png")
+ if os.path.isfile(enh_p):
+ this_pix = QPixmap(QSize(32, 32))
+ this_pix.fill(Qt.transparent)
+ painter = QPainter(this_pix)
+
+ painter.drawPixmap(0, 0, pixmap)
+ painter.drawPixmap(0, 0, QPixmap(enh_p))
+ pixmap = this_pix
+ self.pixmap = pixmap
+ self.labelIcon.setPixmap(pixmap)
+
+ def setCmbLevel(self, cmbLevel:QtWidgets.QComboBox):
+ self.cmbLevel = cmbLevel
+
+ def setCmbType(self, cmbType:QtWidgets.QComboBox):
+ self.cmbType = cmbType
+
+ def set_gear(self, gear:Gear):
+ self.gear = gear
+ self.update_data()
+
+ def update_data(self):
+ gear = self.gear
+ if self.display_full_name:
+ self.lblName.setText(gear.get_full_name())
+ else:
+ self.lblName.setText(gear.name)
+ self.frmMain.ui.table_Equip.resizeColumnToContents(0)
+ self.load_gear_icon()
+
+ def labelIcon_sigMouseClick(self, ev):
+ if self.edit_able:
+ if self.dlg_chose_gear is not None:
+ self.dlg_chose_gear.close()
+ self.dlg_chose_gear.deleteLater()
+ self.dlg_chose_gear = Dlg_AddGear(self.frmMain)
+ self.dlg_chose_gear.sig_gear_chosen.connect(self.dlg_chose_gear_sig_gear_chosen)
+ self.dlg_chose_gear.show()
+
+ def dlg_chose_gear_sig_gear_chosen(self, name, item_class, item_grade, item_id):
+ self.gear.item_id = int(item_id)
+ if self.gear.name is None or self.gear.name == '':
+ self.gear.name = name
+ if item_grade == 'Yellow':
+ item_grade = 'Boss'
+ type_str = item_grade + " " + item_class
+ idx = self.cmbType.findText(type_str)
+ if idx > -1:
+ self.cmbType.setCurrentIndex(idx)
+ self.update_data()
+ self.sig_gear_changed.emit(self)
+
+ def setCheckState(self, state):
+ if self.chkInclude is None:
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ self.chkInclude = QtWidgets.QCheckBox(self)
+ sizePolicy.setHeightForWidth(self.chkInclude.sizePolicy().hasHeightForWidth())
+ self.chkInclude.setSizePolicy(sizePolicy)
+ self.chkInclude.setText("")
+ self.horizontalLayout.insertWidget(0, self.chkInclude)
+ self.chkInclude.setCheckState(state)
+
+ def add_to_table(self, table_widget: QtWidgets.QTableWidget, row, col=0):
+ table_widget.setCellWidget(row, col, self)
+ table_widget.setItem(row, col, QTableWidgetItem(''))
+ if self.icon is not None:
+ table_widget.setRowHeight(row, 45)
+ self.table_widget = table_widget
+ self.row = row
+ self.col = col
+
+ def create_Cmbs(self, tw, model_edit_func=None):
+ if model_edit_func is None:
+ model_edit_func = self.model.swap_gear
+ gear = self.gear
+ cmb_gt = NoScrollCombo(tw)
+ cmb_enh = NoScrollCombo(tw)
+ self.cmbType = cmb_gt
+ self.cmbLevel = cmb_enh
+ self.frmMain.set_sort_gear_cmbBox(list(gear_types.keys()), enumerate_gt, gear.gear_type.name, cmb_gt)
+ gtype_s = cmb_gt.currentText()
+
+
+ self.frmMain.set_sort_gear_cmbBox(list(gear_types[gtype_s].lvl_map.keys()), enumerate_gt_lvl, gear.enhance_lvl, cmb_enh)
+
+ def cmb_gt_currentTextChanged(str_picked):
+ current_enhance_string = cmb_enh.currentText()
+ new_gt = gear_types[str_picked]
+ with QBlockSig(cmb_enh):
+ cmb_enh.clear()
+ self.frmMain.set_sort_gear_cmbBox(list(new_gt.lvl_map.keys()), enumerate_gt_lvl, current_enhance_string, cmb_enh)
+ this_gear = self.gear
+ if str_picked.lower().find('accessor') > -1 or str_picked.lower().find('life') > -1:
+ if not isinstance(this_gear, Smashable):
+ old_g = this_gear
+ this_gear = generate_gear_obj(self.model.settings, base_item_cost=this_gear.base_item_cost, enhance_lvl=cmb_enh.currentText(),
+ gear_type=gear_types[str_picked], name=this_gear.name,
+ sale_balance=this_gear.sale_balance, id=this_gear.item_id)
+ #self.model.edit_fs_item(old_g, this_gear)
+ model_edit_func(old_g, this_gear)
+ else:
+ this_gear.set_gear_params(gear_types[str_picked], cmb_enh.currentText())
+ else:
+ if not isinstance(this_gear, Classic_Gear):
+ old_g = this_gear
+ this_gear = generate_gear_obj(self.model.settings, base_item_cost=this_gear.base_item_cost, enhance_lvl=cmb_enh.currentText(),
+ gear_type=gear_types[str_picked], name=this_gear.name, id=this_gear.item_id)
+ #self.model.edit_fs_item(old_g, this_gear)
+ model_edit_func(old_g, this_gear)
+ else:
+ this_gear.set_gear_params(gear_types[str_picked], cmb_enh.currentText())
+ self.set_gear(this_gear)
+ #self.model.invalidate_failstack_list()
+ self.sig_gear_changed.emit(self)
+ # Sets the hidden value of the table widget so that colors are sorted in the right order
+
+ def cmb_enh_currentTextChanged(str_picked):
+ this_gear = self.gear
+ try:
+ this_gear.set_enhance_lvl(str_picked)
+
+ self.load_gear_icon()
+ except KeyError:
+ self.frmMain.show_critical_error('Enhance level does not appear to be valid.')
+ self.sig_gear_changed.emit(self)
+
+ cmb_gt.currentTextChanged.connect(cmb_gt_currentTextChanged)
+ cmb_enh.currentTextChanged.connect(cmb_enh_currentTextChanged)
+
+ def add_to_tree(self, tree, item, col=0):
+ tree.setItemWidget(item, col, self)
+ self.table_widget = tree
+ self.parent_widget = item
+ self.col = col
+
+
class Frm_Main(Qt_common.lbl_color_MainWindow):
def __init__(self, app):
super(Frm_Main, self).__init__()
@@ -143,10 +421,19 @@ def __init__(self, app):
pix = QPixmap(relative_path_convert('title.png'))
frmObj.label.setPixmap(pix)
+ self.search_icon = QIcon(relative_path_convert('images/lens2.png'))
+
+ self.pool_size = 5
+ self.connection = urllib3.HTTPSConnectionPool('bddatabase.net', maxsize=self.pool_size, block=True)
self.clear_data()
self.fs_c = None
self.eh_c = None
+ self.mod_enhance_me = None
+ self.mod_fail_stackers = None
+ self.mod_enhance_split_idx = None
+
+ self.strat_go_mode = False # The strategy has been calculated and needs to be updated
self.about_win = dlg_About(self)
@@ -178,6 +465,18 @@ def actionMarket_Tax_Calc_triggered():
slg.ui.buttonBox.setVisible(False)
slg.show()
+ frmObj.lblBlackStoneArmorPic.setPixmap(QPixmap(STR_PIC_BSA).scaled(32, 32, transformMode=Qt.SmoothTransformation))
+ frmObj.lblBlackStoneWeaponPic.setPixmap(QPixmap(STR_PIC_BSW).scaled(32, 32, transformMode=Qt.SmoothTransformation))
+ frmObj.lblConcBlackStoneArmorPic.setPixmap(QPixmap(STR_PIC_CBSA).scaled(32, 32, transformMode=Qt.SmoothTransformation))
+ frmObj.lblConcBlackStoneWeaponPic.setPixmap(QPixmap(STR_PIC_CBSW).scaled(32, 32, transformMode=Qt.SmoothTransformation))
+ frmObj.lblCronStonePic.setPixmap(QPixmap(STR_PIC_CRON).scaled(32, 32, transformMode=Qt.SmoothTransformation))
+ frmObj.lblMemoryFragmentPic.setPixmap(QPixmap(STR_PIC_MEME).scaled(32, 32, transformMode=Qt.SmoothTransformation))
+ frmObj.lblGearCleansePic.setPixmap(
+ QPixmap(STR_PIC_PRIEST).scaled(32, 32, transformMode=Qt.SmoothTransformation))
+ frmObj.lblDragonScalePic.setPixmap(
+ QPixmap(STR_PIC_DRAGON_SCALE).scaled(32, 32, transformMode=Qt.SmoothTransformation))
+
+
frmObj.actionAbout.triggered.connect(self.about_win.show)
frmObj.actionExit.triggered.connect(app.exit)
frmObj.actionLoad_Info.triggered.connect(self.open_file_dlg)
@@ -193,20 +492,25 @@ def actionMarket_Tax_Calc_triggered():
table_Strat = frmObj.table_Strat
table_Strat_Equip = frmObj.table_Strat_Equip
+ for i in range(table_Equip.columnCount()):
+ table_Equip.header().setSectionResizeMode(i, QHeaderView.ResizeToContents)
+ table_Equip.header().setSectionResizeMode(0, QHeaderView.Interactive)
+ table_Equip.header().setSectionResizeMode(2, QHeaderView.Interactive)
+
+
def cmdEquipRemove_clicked():
tmodel = self.model
tsettings = tmodel.settings
tw = frmObj.table_Equip
- effect_list = [i.row() for i in tw.selectedItems()]
- effect_list.sort()
- effect_list.reverse()
+ effect_list = [i for i in tw.selectedItems()]
+
enhance_me = tsettings[tsettings.P_ENHANCE_ME]
r_enhance_me = tsettings[tsettings.P_R_ENHANCE_ME]
for i in effect_list:
- thic = tw.item(i, 0).__dict__[STR_TW_GEAR]
+ thic = tw.itemWidget(i, 0).gear
try:
enhance_me.remove(thic)
tmodel.invalidate_enahce_list()
@@ -216,8 +520,12 @@ def cmdEquipRemove_clicked():
r_enhance_me.remove(thic)
except ValueError:
pass
- teem = tw.item(i, 2)
- tw.removeRow(i)
+ p = i.parent()
+ if p is None:
+ tw.takeTopLevelItem(tw.indexOfTopLevelItem(i))
+ #else:
+ # p.removeChild(i)
+ #tw.takeTopLevelItem()
tsettings.changes_made = True
def cmdFSRemove_clicked():
@@ -234,7 +542,7 @@ def cmdFSRemove_clicked():
r_fail_stackers = tsettings[tsettings.P_R_FAIL_STACKERS]
for i in effect_list:
- thic = tw.item(i, 0).__dict__[STR_TW_GEAR]
+ thic = tw.cellWidget(i, 0).gear
try:
fail_stackers.remove(thic)
tmodel.invalidate_failstack_list()
@@ -257,7 +565,7 @@ def cmdFSRemove_clicked():
frmObj.cmdFSAdd.clicked.connect(self.cmdFSAdd_clicked)
frmObj.cmdEquipAdd.clicked.connect(self.cmdEquipAdd_clicked)
frmObj.table_FS.cellChanged.connect(self.table_FS_cellChanged)
- frmObj.table_Equip.cellChanged.connect(self.table_Equip_cellChanged)
+ frmObj.table_Equip.itemChanged.connect(self.table_Equip_itemChanged)
frmObj.cmdFSRefresh.clicked.connect(self.cmdFSRefresh_clicked)
frmObj.cmdFSEdit.clicked.connect(self.cmdFSEdit_clicked)
frmObj.cmdFS_Cost_Clear.clicked.connect(self.cmdFS_Cost_Clear_clicked)
@@ -278,9 +586,9 @@ def cmdCompact_clicked():
frmObj.cmdCompact.clicked.connect(self.compact_window.set_frame)
frmObj.table_FS_Cost.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
- frmObj.table_Equip.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
+ #frmObj.table_Equip.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
- frmObj.table_FS.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
+ #frmObj.table_FS.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
frmObj.table_Strat_FS.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
frmObj.table_Strat.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeToContents)
@@ -290,6 +598,8 @@ def cmdCompact_clicked():
frmObj.table_FS.setSortingEnabled(True)
frmObj.table_Strat_FS.setSortingEnabled(True)
frmObj.table_Strat_Equip.setSortingEnabled(True)
+ frmObj.table_Equip.setIconSize(QSize(32,32))
+ frmObj.table_FS.setIconSize(QSize(32,32))
def give_menu_downgrade(root_menu, event_star, this_item):
@@ -350,12 +660,13 @@ def table_Strat_context_menu(event_star):
table_Strat.contextMenuEvent = table_Strat_context_menu
- def give_menu_sale_balance(root_menu, column_head, accept_func):
+ def give_menu_sale_balance(root_menu, column_head, accept_func, start_val=0):
def open_balance_dialog():
balance_dialog = Dlg_Sale_Balance(self, column_head)
balance_dialog.sig_accepted.connect(accept_func)
balance_dialog.ui.lblSale.setText(column_head)
+ balance_dialog.ui.spinValue.setValue(start_val)
balance_dialog.show()
upgrade_action = QAction(root_menu)
@@ -373,18 +684,29 @@ def table_FS_balance_context_menu(event_star):
dis_gear = root_item.__dict__[STR_TW_GEAR]
header_txt = table_FS.horizontalHeaderItem(col).text()
+ val_txt = table_FS.item(row, col).text()
+ try:
+ val = float(val_txt)
+ except ValueError:
+ val = 0
def accept(balance):
if col == COL_FS_SALE_SUCCESS:
dis_gear.sale_balance = balance
elif col == COL_FS_SALE_FAIL:
dis_gear.fail_sale_balance = balance
this_item.setText(str(balance))
- give_menu_sale_balance(root_menu, header_txt, accept)
+ give_menu_sale_balance(root_menu, header_txt, accept, start_val=val)
root_menu.exec_(event_star.globalPos())
table_FS.contextMenuEvent = table_FS_balance_context_menu
+ frmObj.table_Equip.itemDoubleClicked.connect(self.table_Equip_itemDoubleClicked)
+
+ def table_Equip_itemDoubleClicked(self, item, col):
+ if col == 2:
+ self.ui.table_Equip.editItem(item, col)
+
def closeEvent(self, *args, **kwargs):
model = self.model
model.save_to_file()
@@ -438,11 +760,20 @@ def downgrade_gear(self, dis_gear, this_item):
def get_enhance_table_item(self, gear_obj):
table_Equip = self.ui.table_Equip
- for rew in range(0, table_Equip.rowCount()):
- if gear_obj is table_Equip.item(rew, 0).__dict__[STR_TW_GEAR]:
- return table_Equip.item(rew, 0)
+ for rew in range(0, table_Equip.topLevelItemCount()):
+ item = table_Equip.topLevelItem(rew)
+ if gear_obj is table_Equip.cellWidget(item, 0).gear:
+ return table_Equip.item(item, 0)
def refresh_gear_obj(self, dis_gear, this_item=None):
+ """
+ This change can be in the strat window or in the minimal window. The gear widget object may need to be
+ syncronized
+
+ :param dis_gear:
+ :param this_item:
+ :return:
+ """
table_Equip = self.ui.table_Equip
if this_item is None:
this_item = self.get_enhance_table_item(dis_gear)
@@ -453,7 +784,8 @@ def refresh_gear_obj(self, dis_gear, this_item=None):
self.invalidate_equiptment(this_item.row())
cmb = table_Equip.cellWidget(this_item.row(), 3)
cmb.setCurrentIndex(dis_gear.get_enhance_lvl_idx())
- self.cmdStrat_go_clicked()
+ if self.strat_go_mode:
+ self.cmdStrat_go_clicked()
def clear_data(self):
self.eh_c = None
@@ -498,6 +830,8 @@ def cmdStrat_go_clicked(self):
frmObj = self.ui
tw = frmObj.table_Strat
+ self.strat_go_mode = True
+
#for row in range(0, tw.rowCount()):
# tw.removeRow(0)
self.invalidate_strategy()
@@ -507,8 +841,35 @@ def cmdStrat_go_clicked(self):
if not len(model.equipment_costs) > 0:
self.cmdEquipCost_clicked()
+ mod_idx_gear_map = {}
+
+ mod_enhance_me = enhance_me[:]
+ mod_fail_stackers = fail_stackers[:]
+ current_gear_idx = len(enhance_me)
+ self.mod_enhance_split_idx = current_gear_idx
+ for i in range(0, frmObj.table_Equip.topLevelItemCount()):
+ twi = frmObj.table_Equip.topLevelItem(i)
+ master_gw = frmObj.table_Equip.itemWidget(twi, 0)
+ master_gear = master_gw.gear
+ if master_gear not in enhance_me:
+ continue
+ for j in range(0, twi.childCount()):
+ child = twi.child(j)
+ child_gw = frmObj.table_Equip.itemWidget(child, 0)
+ child_gear = child_gw.gear
+
+ child_gear.cost_vec = numpy.array(master_gear.cost_vec, copy=True)
+ child_gear.restore_cost_vec = numpy.array(master_gear.restore_cost_vec, copy=True)
+ child_gear.cost_vec_min = numpy.array(master_gear.cost_vec_min, copy=True)
+ child_gear.restore_cost_vec_min = numpy.array(master_gear.restore_cost_vec_min, copy=True)
+ mod_idx_gear_map[len(mod_enhance_me)] = child_gear
+ mod_enhance_me.append(child_gear)
+
+ self.mod_enhance_me = mod_enhance_me
+ self.mod_fail_stackers = mod_fail_stackers
+
try:
- fs_c, eh_c = model.calcEnhances()
+ fs_c, eh_c = model.calcEnhances(enhance_me=mod_enhance_me)
self.fs_c = fs_c
self.eh_c = eh_c
except Invalid_FS_Parameters as f:
@@ -517,7 +878,7 @@ def cmdStrat_go_clicked(self):
fs_c_T = fs_c.T
eh_c_T = eh_c.T
- this_enhance_me = enhance_me[:]
+ this_enhance_me = mod_enhance_me[:]
this_fail_stackers = fail_stackers[:]
try:
@@ -525,39 +886,47 @@ def cmdStrat_go_clicked(self):
except TypeError:
# This happens the first time because nothing is connected.
pass
- tw.currentItemChanged.connect(self.table_Strat_selectionChanged)
-
- for i, ev in enumerate(eh_c_T):
- fv = fs_c_T[i]
- tw.insertRow(i)
- twi = QTableWidgetItem(str(i))
- tw.setItem(i, 0, twi)
- ev_min = numpy.argmin(ev)
- fv_min = numpy.argmin(fv)
- if fv[fv_min] > ev[ev_min]:
- dis_gear = this_enhance_me[ev_min]
- twi = QTableWidgetItem(dis_gear.get_full_name())
- twi2 = QTableWidgetItem("YES")
- else:
- dis_gear = this_fail_stackers[fv_min]
- twi = QTableWidgetItem(dis_gear.get_full_name())
- twi2 = QTableWidgetItem("NO")
- twi.__dict__[STR_TW_GEAR] = dis_gear
- tw.setItem(i, 1, twi)
- tw.setItem(i, 2, twi2)
-
- self.eh_c = eh_c
+ tw.itemSelectionChanged.connect(self.table_Strat_selectionChanged)
+
+ with Qt_common.SpeedUpTable(tw):
+
+ for i, ev in enumerate(eh_c_T):
+ fv = fs_c_T[i]
+ tw.insertRow(i)
+ twi = QTableWidgetItem(str(i))
+ tw.setItem(i, 0, twi)
+ ev_min = numpy.argmin(ev)
+ fv_min = numpy.argmin(fv)
+ if fv[fv_min] > ev[ev_min]:
+ dis_gear = this_enhance_me[ev_min]
+ two = GearWidget(dis_gear, self, edit_able=False, display_full_name=True)
+ if ev_min >= self.mod_enhance_split_idx:
+ two.set_icon(QIcon(relative_path_convert('images/items/00017800.png')), enhance_overlay=False)
+ two.lblName.setText('Save Stack: {}'.format(two.lblName.text()))
+ twi2 = QTableWidgetItem("YES")
+ else:
+ twi2 = QTableWidgetItem("NO")
+ else:
+ dis_gear = this_fail_stackers[fv_min]
+ two = GearWidget(dis_gear, self, edit_able=False, display_full_name=True)
+ twi2 = QTableWidgetItem("NO")
+ two.add_to_table(tw, i, col=1)
+ tw.setItem(i, 2, twi2)
+
+ self.eh_c = eh_c
+
self.adjust_equip_splitter()
- def table_Strat_selectionChanged(self, row_obj):
+ def table_Strat_selectionChanged(self):
+ row_obj = self.ui.table_Strat.selectedItems()[0]
if self.eh_c is None or self.fs_c is None:
self.show_critical_error('No details when strategy is not calculated.')
return
frmObj = self.ui
model = self.model
settings = model.settings
- enhance_me = settings[settings.P_ENHANCE_ME]
- fail_stackers = settings[settings.P_FAIL_STACKERS]
+ enhance_me = self.mod_enhance_me
+ fail_stackers = self.mod_fail_stackers
this_enhance_me = enhance_me[:]
this_fail_stackers = fail_stackers[:]
fs_c_T = self.fs_c.T
@@ -581,9 +950,8 @@ def table_Strat_selectionChanged(self, row_obj):
this_sorted_idx = this_sort[i]
this_sorted_item = this_enhance_me[this_sorted_idx]
tw_eh.insertRow(i)
- twi = QTableWidgetItem(str(this_sorted_item.get_full_name()))
- twi.__dict__[STR_TW_GEAR] = this_sorted_item
- tw_eh.setItem(i, 0, twi)
+ two = GearWidget(this_sorted_item, self, display_full_name=True, edit_able=False)
+ two.add_to_table(tw_eh, i, col=0)
twi = self.monnies_twi_factory(this_vec[this_sorted_idx])
#twi.__dict__['__lt__'] = types.MethodType(numeric_less_than, twi)
tw_eh.setItem(i, 1, twi)
@@ -620,9 +988,8 @@ def table_Strat_selectionChanged(self, row_obj):
this_sorted_idx = this_sort[i]
this_sorted_item = this_fail_stackers[this_sorted_idx]
tw_fs.insertRow(i)
- twi = QTableWidgetItem(str(this_sorted_item.get_full_name()))
- twi.__dict__[STR_TW_GEAR] = this_sorted_item
- tw_fs.setItem(i, 0, twi)
+ two = GearWidget(this_sorted_item, self, display_full_name=True, edit_able=False )
+ two.add_to_table(tw_fs, i, col=0)
twi = self.monnies_twi_factory(this_vec[this_sorted_idx])
#twi.__dict__['__lt__'] = types.MethodType(numeric_less_than, twi)
tw_fs.setItem(i, 1, twi)
@@ -645,30 +1012,55 @@ def cmdEquipCost_clicked(self):
except Invalid_FS_Parameters as f:
self.show_warning_msg(str(f))
return
+
tw.setSortingEnabled(False)
- for i in range(0, tw.rowCount()):
- this_head = tw.item(i, 0)
- this_gear = this_head.gear_item
- eh_idx = this_gear.get_enhance_lvl_idx()
- cost_vec_l = this_gear.get_cost_obj()[eh_idx]
+
+ def populate_row(this_head, this_gear, eh_idx):
+
+ cost_vec_l = this_gear.cost_vec[eh_idx]
+ mat_cost_vec_l = this_gear.restore_cost_vec[eh_idx]
idx_ = numpy.argmin(this_gear.cost_vec[eh_idx])
- twi = numeric_twi(str(idx_))
+ #twi = numeric_twi(str(idx_))
#twi.__dict__['__lt__'] = types.MethodType(numeric_less_than, twi)
- tw.setItem(i, 4, twi)
- twi = self.monnies_twi_factory(cost_vec_l[idx_])
+ #tw.setItem(i, 4, twi)
+ this_head.setText(4, str(idx_))
+ #twi = self.monnies_twi_factory(cost_vec_l[idx_])
#twi.__dict__['__lt__'] = types.MethodType(numeric_less_than, twi)
- tw.setItem(i, 5, twi)
+ #tw.setItem(i, 5, twi)
+ this_head.setText(5, MONNIES_FORMAT.format(round(cost_vec_l[idx_])))
+ this_head.setText(6, MONNIES_FORMAT.format(round(mat_cost_vec_l[idx_])))
this_fail_map = numpy.array(this_gear.gear_type.map)[eh_idx]
avg_num_fails = numpy.divide(numpy.ones(this_fail_map.shape), this_fail_map) - 1
- twi = numeric_twi(STR_TWO_DEC_FORMAT.format(avg_num_fails[idx_]))
+ #twi = numeric_twi()
#twi.__dict__['__lt__'] = types.MethodType(numeric_less_than, twi)
- tw.setItem(i, 6, twi)
+ #tw.setItem(i, 6, twi)
+ #this_head.setText(6, STR_TWO_DEC_FORMAT.format(avg_num_fails[idx_]))
+ this_head.setText(7, STR_TWO_DEC_FORMAT.format(avg_num_fails[idx_]))
+ #twi = numeric_twi()
+ #tw.setItem(i, 7, twi)
+ this_head.setText(8, STR_PERCENT_FORMAT.format(this_fail_map[idx_] * 100.0))
try:
- twi = QTableWidgetItem(str(this_gear.using_memfrags))
- tw.setItem(i, 7, twi)
+
+ this_head.setText(9, str(this_gear.using_memfrags))
except AttributeError:
pass
+
+ for i in range(0, tw.topLevelItemCount()):
+ this_head = tw.topLevelItem(i)
+ gear_widget = tw.itemWidget(this_head, 0)
+ this_gear = gear_widget.gear
+ eh_idx = this_gear.get_enhance_lvl_idx()
+ populate_row(this_head, this_gear, eh_idx)
+ for j in range(0, this_head.childCount()):
+ this_child = this_head.child(j)
+ child_gear_widget = tw.itemWidget(this_child, 0)
+ child_gear = child_gear_widget.gear
+ eh_idx = child_gear.get_enhance_lvl_idx()
+ populate_row(this_child, this_gear, eh_idx)
+
+
+
tw.setSortingEnabled(True)
def cmdFS_Cost_Clear_clicked(self):
@@ -683,7 +1075,7 @@ def kill(x):
except KeyError:
pass
settings.changes_made = True
- map(kill, set([r.row() for r in tw.selectedIndexes()]))
+ list(map(kill, set([r.row() for r in tw.selectedIndexes()])))
frmObj.cmdFSRefresh.click()
def add_custom_fs_combobox(self, model, tw, fs_exception_boxes, row_idx):
@@ -714,7 +1106,7 @@ def cmdFSEdit_clicked(self):
selected_rows = set([r.row() for r in tw.selectedIndexes()])
for indx in selected_rows:
- model.edit_fs_exception(indx, tw.item(indx, 0).__dict__[STR_TW_GEAR])
+ model.edit_fs_exception(indx, tw.cellWidget(indx, 0).gear)
self.add_custom_fs_combobox(model, tw, fs_exception_boxes, indx)
def cmdFSRefresh_clicked(self):
@@ -728,132 +1120,103 @@ def cmdFSRefresh_clicked(self):
return
tw = frmObj.table_FS_Cost
- with QBlockSig(tw):
- clear_table(tw)
- fs_items = model.optimal_fs_items
- fs_cost = model.fs_cost
- cum_fs_cost = model.cum_fs_cost
- cum_fs_probs = model.cum_fs_probs
- fs_probs = model.fs_probs
- fs_exception_boxes = self.fs_exception_boxes
-
- for i, this_gear in enumerate(fs_items):
- rc = tw.rowCount()
- tw.insertRow(rc)
- twi = QTableWidgetItem(str(i+1))
- twi.__dict__[STR_TW_GEAR] = this_gear
- tw.setItem(rc, 0, twi)
- if i in fs_exceptions:
- self.add_custom_fs_combobox(model, tw, fs_exception_boxes, i)
- else:
- twi = QTableWidgetItem(this_gear.get_full_name())
- tw.setItem(rc, 1, twi)
- twi = self.monnies_twi_factory(fs_cost[i])
- tw.setItem(rc, 2, twi)
- twi = self.monnies_twi_factory(cum_fs_cost[i])
- tw.setItem(rc, 3, twi)
- twi = QTableWidgetItem(str(fs_probs[i]))
- tw.setItem(rc, 4, twi)
- twi = QTableWidgetItem(str(cum_fs_probs[i]))
- tw.setItem(rc, 5, twi)
- if model.dragon_scale_30:
- if not 19 in fs_exceptions:
- tw.item(19, 1).setText('Dragon Scale x30')
- if model.dragon_scale_350:
- if not 39 in fs_exceptions:
- tw.item(39, 1).setText('Dragon Scale x350')
+ with Qt_common.SpeedUpTable(tw):
+ with QBlockSig(tw):
+ clear_table(tw)
+ fs_items = model.optimal_fs_items
+ fs_cost = model.fs_cost
+ cum_fs_cost = model.cum_fs_cost
+ cum_fs_probs = model.cum_fs_probs
+ fs_probs = model.fs_probs
+ fs_exception_boxes = self.fs_exception_boxes
+
+ for i, this_gear in enumerate(fs_items):
+ rc = tw.rowCount()
+ tw.insertRow(rc)
+ twi = QTableWidgetItem(str(i+1))
+ #twi.__dict__[STR_TW_GEAR] = this_gear
+ tw.setItem(rc, 0, twi)
+ if i in fs_exceptions:
+ self.add_custom_fs_combobox(model, tw, fs_exception_boxes, i)
+ else:
+ two = GearWidget(this_gear, self, edit_able=False, display_full_name=True)
+ two.add_to_table(tw, rc, col=1)
+ twi = self.monnies_twi_factory(fs_cost[i])
+ tw.setItem(rc, 2, twi)
+ twi = self.monnies_twi_factory(cum_fs_cost[i])
+ tw.setItem(rc, 3, twi)
+ twi = QTableWidgetItem(str(fs_probs[i]))
+ tw.setItem(rc, 4, twi)
+ twi = QTableWidgetItem(str(cum_fs_probs[i]))
+ tw.setItem(rc, 5, twi)
+ if model.dragon_scale_30:
+ if not 19 in fs_exceptions:
+ tw.item(19, 1).setText('Dragon Scale x30')
+ if model.dragon_scale_350:
+ if not 39 in fs_exceptions:
+ tw.item(39, 1).setText('Dragon Scale x350')
+ tw.setVisible(True) # Sometimes this is not visible when loading
frmObj.cmdEquipCost.setEnabled(True)
- def table_cellChanged_proto(self, row, col, tw, this_gear):
- this_item = tw.item(row, col)
+ def table_cellChanged_proto(self, this_item, col, this_gear):
if this_item is None:
return
- str_this_item = this_item.text()
- if col == 0:
- this_gear.name = str_this_item
- elif col == 2:
+ if col == 2:
+ str_this_item = this_item.text()
try:
- this_gear.set_cost(float(str_this_item))
+ try:
+ this_gear.set_cost(float(str_this_item))
+ except ValueError:
+ self.ui.statusbar.showMessage('Invalid number: {}'.format(str_this_item))
except ValueError:
self.show_warning_msg('Cost must be a number.')
- def table_Equip_cellChanged(self, row, col):
+ def table_Equip_itemChanged(self, t_item:QTreeWidgetItem, col):
model = self.model
- settings = model.settings
- r_enhance_me = settings[settings.P_R_ENHANCE_ME]
- enhance_me = settings[settings.P_ENHANCE_ME]
tw = self.ui.table_Equip
- t_item = tw.item(row, 0)
- this_gear = t_item.gear_item
- if col == 0:
- if t_item.checkState() == Qt.Checked:
- try:
- r_enhance_me.remove(this_gear)
- except ValueError:
- # Item already removed. This is likely not a check change on col 0
- pass
- enhance_me.append(this_gear)
- settings[settings.P_ENHANCE_ME] = list(set(enhance_me))
- # order here matters to the file is saved after the settings are updated
- self.invalidate_strategy()
- else:
- try:
- enhance_me.remove(this_gear)
- except ValueError:
- # Item already removed. This is likely not a check change on col 0
- pass
+ gear_widget = tw.itemWidget(t_item, 0)
- r_enhance_me.append(this_gear)
- settings[settings.P_R_ENHANCE_ME] = list(set(r_enhance_me))
- # order here matters to the file is saved after the settings are updated
- self.invalidate_strategy()
- elif col == 2:
+ this_gear = gear_widget.gear
+ if col == 2:
# columns that are not 0 are non-cosmetic and may change the cost values
- self.invalidate_equiptment(row)
- self.table_cellChanged_proto(row, col, tw, this_gear)
+ self.invalidate_equiptment(t_item)
+ try:
+ try:
+ this_gear.set_cost(float(t_item.text(2)))
+ except ValueError:
+ self.ui.statusbar.showMessage('Invalid number: {}'.format(t_item.text(2)))
+ except ValueError:
+ self.show_warning_msg('Cost must be a number.')
def table_FS_cellChanged(self, row, col):
model = self.model
- settings = model.settings
- r_fail_stackers = settings[settings.P_R_FAIL_STACKERS]
- fail_stackers = settings[settings.P_FAIL_STACKERS]
- tw = self.ui.table_FS
-
- t_item = tw.item(row, 0)
- this_gear = t_item.gear_item
- if col == 0:
- if t_item.checkState() == Qt.Checked:
- try:
- r_fail_stackers.remove(this_gear)
- except ValueError:
- # Item already removed. This is likely not a check change on col 0
- pass
- fail_stackers.append(this_gear)
- settings[settings.P_FAIL_STACKERS] = list(set(fail_stackers))
- # order here matters to the file is saved after the settings are updated
- self.invalidate_strategy()
- else:
- try:
- fail_stackers.remove(this_gear)
- except ValueError:
- # Item already removed. This is likely not a check change on col 0
- pass
+ tw = self.ui.table_FS
- r_fail_stackers.append(this_gear)
- settings[settings.P_R_FAIL_STACKERS] = list(set(r_fail_stackers))
- # order here matters to the file is saved after the settings are updated
- self.invalidate_strategy()
- elif col == COL_FS_SALE_SUCCESS:
- this_gear.set_sale_balance(float(tw.item(row, 5).text()))
+ t_item = tw.cellWidget(row, 0)
+ this_gear = t_item.gear
+ if col == COL_FS_SALE_SUCCESS:
+ str_val = tw.item(row, COL_FS_SALE_SUCCESS).text()
+ try:
+ this_gear.set_sale_balance(float(str_val))
+ except ValueError:
+ self.ui.statusbar.showMessage('Invalid number: {}'.format(str_val))
elif col == COL_FS_SALE_FAIL:
- this_gear.set_fail_sale_balance(float(tw.item(row, 6).text()))
+ str_val = tw.item(row, COL_FS_SALE_FAIL).text()
+ try:
+ this_gear.set_fail_sale_balance(float(str_val))
+ except ValueError:
+ self.ui.statusbar.showMessage('Invalid number: {}'.format(str_val))
elif col == COL_FS_PROC_COST:
- this_gear.set_procurement_cost(float(tw.item(row, 7).text()))
- self.table_cellChanged_proto(row, col, tw, this_gear)
+ str_val = tw.item(row, COL_FS_PROC_COST).text()
+ try:
+ this_gear.set_procurement_cost(float(str_val))
+ except ValueError:
+ self.ui.statusbar.showMessage('Invalid number: {}'.format(str_val))
+ self.table_cellChanged_proto(tw.item(row, col), col, this_gear)
self.invalidate_fs_list()
def set_sort_gear_cmbBox(self, this_list, compar_f, current_gear_lvl, cmb_box):
@@ -865,10 +1228,51 @@ def set_sort_gear_cmbBox(self, this_list, compar_f, current_gear_lvl, cmb_box):
if key == current_gear_lvl:
cmb_box.setCurrentIndex(i)
- def table_add_gear(self, edit_func, invalidate_func, tw, this_gear, add_fun=None, check_state=Qt.Checked):
- model = self.model
+ def set_cell_lvl_compare(self, twi_lvl, lvl_str):
+ txt_c = str(enumerate_gt_lvl(lvl_str))
+ twi_lvl.setText(txt_c)
+
+ def get_gt_color_compare(self, gt_str):
+ txt_c = gt_str.lower()
+ if txt_c.find('white') > -1:
+ return 'b'
+ elif txt_c.find('green') > -1:
+ return 'c'
+ elif txt_c.find('blue') > -1:
+ return 'd'
+ elif txt_c.find('yellow') > -1 or txt_c.find('boss') > -1:
+ return 'e'
+ else:
+ return 'a'
+
+ def set_cell_color_compare(self, twi_gt, gt_str):
+ twi_gt.setText(self.get_gt_color_compare(gt_str))
+
+ def cmb_equ_change(self, cmb, txt_c):
+ txt_c = txt_c.lower()
+ this_pal = cmb.palette()
+ this_pal.setColor(QPalette.ButtonText, Qt.black)
+ if txt_c.find('white') > -1:
+ this_pal.setColor(QPalette.Button, Qt.white)
+ elif txt_c.find('green') > -1:
+ this_pal.setColor(QPalette.Button, Qt.green)
+ elif txt_c.find('blue') > -1:
+ this_pal.setColor(QPalette.Button, Qt.blue)
+ elif txt_c.find('yellow') > -1 or txt_c.find('boss') > -1:
+ this_pal.setColor(QPalette.Button, Qt.yellow)
+ else:
+ this_pal = get_dark_palette()
+ cmb.setPalette(this_pal)
+ def table_FS_add_gear(self, this_gear, check_state=Qt.Checked, add_fun=None):
+ model = self.model
+ settings = model.settings
+ r_fail_stackers = settings[settings.P_R_FAIL_STACKERS]
+ fail_stackers = settings[settings.P_FAIL_STACKERS]
+ tw = self.ui.table_FS
rc = tw.rowCount()
+
+
tw.insertRow(rc)
with QBlockSig(tw):
# If the rows are not initialized then the context menus will bug out
@@ -876,65 +1280,26 @@ def table_add_gear(self, edit_func, invalidate_func, tw, this_gear, add_fun=None
twi = QTableWidgetItem('')
tw.setItem(rc, i, twi)
- cmb_gt = NoScrollCombo(tw)
- cmb_enh = NoScrollCombo(tw)
- twi_gt = QTableWidgetItem()
- twi_lvl = QTableWidgetItem()
-
+ twi_gt = QTableWidgetItem() # Hidden behind the combo box displays number (for sorting?)
+ twi_lvl = QTableWidgetItem() # Hidden behind the combo box displays number (for sorting?)
- self.set_sort_gear_cmbBox(gear_types.keys(), enumerate_gt, this_gear.gear_type.name, cmb_gt)
- gtype_s = cmb_gt.currentText()
+ f_two = GearWidget(this_gear, self, default_icon=self.search_icon, check_state=check_state, edit_able=True)
+ f_two.create_Cmbs(tw)
+ cmb_gt = f_two.cmbType
+ cmb_enh = f_two.cmbLevel
+ cmb_gt.currentTextChanged.connect(lambda x: self.set_cell_color_compare(twi_gt, x))
+ cmb_enh.currentTextChanged.connect(lambda x: self.set_cell_lvl_compare(twi_lvl, x))
- self.set_sort_gear_cmbBox(gear_types[gtype_s].lvl_map.keys(), enumerate_gt_lvl, this_gear.enhance_lvl, cmb_enh)
- name = this_gear.name
- f_twi = QTableWidgetItem(name)
- f_twi.setCheckState(check_state)
- f_twi.__dict__[STR_TW_GEAR] = this_gear
if add_fun is not None:
add_fun(this_gear)
- def cmb_gt_currentTextChanged(str_picked):
- current_enhance_string = cmb_enh.currentText()
- new_gt = gear_types[str_picked]
- with QBlockSig(cmb_enh):
- cmb_enh.clear()
- self.set_sort_gear_cmbBox(new_gt.lvl_map.keys(), enumerate_gt_lvl, current_enhance_string, cmb_enh)
- this_gear = f_twi.__dict__['gear_item']
- if str_picked.lower().find('accessor') > -1:
- if not isinstance(this_gear, Smashable):
- old_g = this_gear
- this_gear = generate_gear_obj(model.settings, base_item_cost=this_gear.base_item_cost, enhance_lvl=cmb_enh.currentText(),
- gear_type=gear_types[str_picked], name=this_gear.name,
- sale_balance=this_gear.sale_balance)
- edit_func(old_g, this_gear)
- else:
- this_gear.set_gear_params(gear_types[str_picked], cmb_enh.currentText())
- else:
- if not isinstance(this_gear, Classic_Gear):
- old_g = this_gear
- this_gear = generate_gear_obj(model.settings, base_item_cost=this_gear.base_item_cost, enhance_lvl=cmb_enh.currentText(),
- gear_type=gear_types[str_picked], name=this_gear.name)
- edit_func(old_g, this_gear)
- else:
- this_gear.set_gear_params(gear_types[str_picked], cmb_enh.currentText())
- f_twi.__dict__['gear_item'] = this_gear
- invalidate_func()
- # Sets the hidden value of the table widget so that colors are sorted in the right order
- self.set_cell_color_compare(twi_gt, str_picked)
-
- def cmb_enh_currentTextChanged(str_picked):
- # could throw key error
- this_gear = f_twi.__dict__['gear_item']
- try:
- this_gear.set_enhance_lvl(str_picked)
- self.set_cell_lvl_compare(twi_lvl, str_picked)
- except KeyError:
- self.show_critical_error('Enhance level does not appear to be valid.')
with QBlockSig(tw):
- tw.setItem(rc, 0, f_twi)
+ f_two.add_to_table(tw, rc, col=0)
+
+ #tw.setItem(rc, 0, f_twi)
tw.setCellWidget(rc, 1, cmb_gt)
twi = self.monnies_twi_factory(this_gear.base_item_cost)
#twi.__dict__['__lt__'] = types.MethodType(numeric_less_than, twi)
@@ -947,102 +1312,169 @@ def cmb_enh_currentTextChanged(str_picked):
self.set_cell_lvl_compare(twi_lvl, cmb_enh.currentText())
self.set_cell_color_compare(twi_gt, cmb_gt.currentText())
- cmb_gt.currentTextChanged.connect(cmb_gt_currentTextChanged)
- cmb_enh.currentTextChanged.connect(cmb_enh_currentTextChanged)
- cmb_gt.currentTextChanged.connect(lambda x: self.cmb_equ_change(self.sender(), x))
- def set_cell_lvl_compare(self, twi_lvl, lvl_str):
- txt_c = str(enumerate_gt_lvl(lvl_str))
- twi_lvl.setText(txt_c)
+ cmb_gt.currentTextChanged.connect(lambda x: self.cmb_equ_change(self.sender(), x))
- def set_cell_color_compare(self, twi_gt, gt_str):
- txt_c = gt_str.lower()
- if txt_c.find('white') > -1:
- twi_gt.setText('b')
- elif txt_c.find('green') > -1:
- twi_gt.setText('c')
- elif txt_c.find('blue') > -1:
- twi_gt.setText('d')
- elif txt_c.find('yellow') > -1 or txt_c.find('boss') > -1:
- twi_gt.setText('e')
- else:
- twi_gt.setText('a')
- def cmb_equ_change(self, cmb, txt_c):
- txt_c = txt_c.lower()
- this_pal = cmb.palette()
- this_pal.setColor(QPalette.ButtonText, Qt.black)
- if txt_c.find('white') > -1:
- this_pal.setColor(QPalette.Button, Qt.white)
- elif txt_c.find('green') > -1:
- this_pal.setColor(QPalette.Button, Qt.green)
- elif txt_c.find('blue') > -1:
- this_pal.setColor(QPalette.Button, Qt.blue)
- elif txt_c.find('yellow') > -1 or txt_c.find('boss') > -1:
- this_pal.setColor(QPalette.Button, Qt.yellow)
- else:
- this_pal = get_dark_palette()
- cmb.setPalette(this_pal)
-
- def table_FS_add_gear(self, this_gear, check_state=Qt.Checked, add_fun=None):
- model = self.model
- tw = self.ui.table_FS
- rc = tw.rowCount()
- self.table_add_gear(model.edit_fs_item, model.invalidate_failstack_list, tw, this_gear,
- check_state=check_state, add_fun=add_fun)
- def valueChanged_connect(val):
- settings = model.settings
- fail_stackers_counts = settings[settings.P_FAIL_STACKERS_COUNT]
- if val == 0:
+ def chkInclude_stateChanged(state):
+ if state == Qt.Checked:
try:
- del fail_stackers_counts[this_gear]
- except KeyError:
+ r_fail_stackers.remove(this_gear)
+ except ValueError:
+ # Item already removed. This is likely not a check change on col 0
pass
+
+ fail_stackers.append(this_gear)
+ settings[settings.P_FAIL_STACKERS] = list(set(fail_stackers))
+ # order here matters to the file is saved after the settings are updated
+ self.invalidate_strategy()
else:
- fail_stackers_counts[this_gear] = val
- settings.changes_made = True
- self.invalidate_fs_list()
+ try:
+ fail_stackers.remove(this_gear)
+ except ValueError:
+ # Item already removed. This is likely not a check change on col 0
+ pass
+
+ r_fail_stackers.append(this_gear)
+ settings[settings.P_R_FAIL_STACKERS] = list(set(r_fail_stackers))
+ # order here matters to the file is saved after the settings are updated
+ self.invalidate_strategy()
+
+ f_two.chkInclude.stateChanged.connect(chkInclude_stateChanged)
+
+
with QBlockSig(tw):
- thisspin = QSpinBox()
- thisspin.setMaximum(120)
- thisspin.setSpecialValueText(STR_INFINITE)
- settings = model.settings
- fail_stackers_counts = settings[settings.P_FAIL_STACKERS_COUNT]
- try:
- this_val = fail_stackers_counts[this_gear]
- thisspin.setValue(this_val)
- except KeyError:
- pass
- thisspin.valueChanged.connect(valueChanged_connect)
- tw.setCellWidget(rc, 4, thisspin)
twi = self.monnies_twi_factory(this_gear.sale_balance)
#twi.__dict__['__lt__'] = types.MethodType(numeric_less_than, twi)
- tw.setItem(rc, 5, twi)
+ tw.setItem(rc, 4, twi)
twi = self.monnies_twi_factory(this_gear.fail_sale_balance)
#twi.__dict__['__lt__'] = types.MethodType(numeric_less_than, twi)
- tw.setItem(rc, 6, twi)
+ tw.setItem(rc, 5, twi)
twi = self.monnies_twi_factory(this_gear.procurement_cost)
#twi.__dict__['__lt__'] = types.MethodType(numeric_less_than, twi)
- tw.setItem(rc, 7, twi)
+ tw.setItem(rc, 6, twi)
tw.cellWidget(rc, 1).currentTextChanged.connect(self.invalidate_fs_list)
tw.cellWidget(rc, 3).currentTextChanged.connect(self.invalidate_fs_list)
- def table_Eq_add_gear(self, this_gear, check_state=Qt.Checked, add_fun=None):
+ f_two.sig_gear_changed.connect(self.invalidate_fs_list)
+
+ def create_Eq_TreeWidget(self, parent_wid, this_gear, check_state) -> QTreeWidgetItem:
+ tw = self.ui.table_Equip
+ top_lvl = QTreeWidgetItem(parent_wid, [''] * tw.columnCount())
+ top_lvl.setFlags(top_lvl.flags() | Qt.ItemIsEditable)
+
+ f_two = GearWidget(this_gear, self, default_icon=self.search_icon, check_state=check_state, edit_able=True)
+ f_two.create_Cmbs(tw)
+ cmb_gt = f_two.cmbType
+ cmb_enh = f_two.cmbLevel
+
+ cmb_gt.currentTextChanged.connect(lambda x: top_lvl.setText(1, self.get_gt_color_compare(x)))
+ cmb_enh.currentTextChanged.connect(lambda x: top_lvl.setText(3, self.get_gt_color_compare(x)))
+
+ f_two.add_to_tree(tw, top_lvl, col=0)
+
+ # tw.setItem(rc, 0, f_twi)
+ # tw.setCellWidget(rc, 1, cmb_gt)
+ tw.setItemWidget(top_lvl, 1, cmb_gt)
+ # twi = self.monnies_twi_factory(this_gear.base_item_cost)
+ # twi.__dict__['__lt__'] = types.MethodType(numeric_less_than, twi)
+ # tw.setItem(rc, 2, twi)
+ top_lvl.setText(2, str(this_gear.base_item_cost))
+ tw.setItemWidget(top_lvl, 3, cmb_enh)
+
+ self.cmb_equ_change(cmb_gt, cmb_gt.currentText())
+ # self.set_cell_lvl_compare(twi_lvl, cmb_enh.currentText())
+ # self.set_cell_color_compare(twi_gt, cmb_gt.currentText())
+
+ cmb_gt.currentTextChanged.connect(lambda x: self.cmb_equ_change(self.sender(), x)) # Updates color
+
+ two = f_two
+
+ settings = self.model.settings
+ r_enhance_me = settings[settings.P_R_ENHANCE_ME]
+ enhance_me = settings[settings.P_ENHANCE_ME]
+
+ def chkInclude_stateChanged(state):
+ if state == Qt.Checked:
+ try:
+ r_enhance_me.remove(this_gear)
+ except ValueError:
+ # Item already removed. This is likely not a check change on col 0
+ pass
+
+ enhance_me.append(this_gear)
+ settings[settings.P_ENHANCE_ME] = list(set(enhance_me))
+ # order here matters to the file is saved after the settings are updated
+ self.invalidate_strategy()
+ else:
+ try:
+ enhance_me.remove(this_gear)
+ except ValueError:
+ # Item already removed. This is likely not a check change on col 0
+ pass
+
+ r_enhance_me.append(this_gear)
+ settings[settings.P_R_ENHANCE_ME] = list(set(r_enhance_me))
+ # order here matters to the file is saved after the settings are updated
+ self.invalidate_strategy()
+
+ two.chkInclude.stateChanged.connect(chkInclude_stateChanged)
+ return top_lvl
+
+ def table_Eq_add_gear(self, this_gear: Gear, check_state=Qt.Checked):
model = self.model
tw = self.ui.table_Equip
- rc = tw.rowCount()
- self.table_add_gear(model.edit_enhance_item, model.invalidate_enahce_list, tw, this_gear,
- check_state=check_state, add_fun=add_fun)
+
+
with QBlockSig(tw):
- tw.cellWidget(rc, 1).currentTextChanged.connect(lambda: self.invalidate_equiptment(rc))
- tw.cellWidget(rc, 3).currentTextChanged.connect(lambda: self.invalidate_equiptment(rc))
+ top_lvl = self.create_Eq_TreeWidget(tw, this_gear, check_state)
+ master_gw: GearWidget = tw.itemWidget(top_lvl, 0)
+ master_gw.sig_gear_changed.connect(self.master_gw_sig_gear_changed)
+ tw.addTopLevelItem(top_lvl)
+ self.add_children(top_lvl)
+ # lvl_num = this_gear.enhance_lvl_to_number()
+ # len_lvls = len(this_gear.gear_type.lvl_map)
+ # for i in this_gear.target_lvls:
+ # _gear = this_gear.duplicate()
+ # _gear.set_enhance_lvl(this_gear.gear_type.idx_lvl_map[i])
+ # child = self.create_Eq_TreeWidget(top_lvl, _gear, check_state)
+ # top_lvl.addChild(child)
+ tw.resizeColumnToContents(0)
+ master_gw.cmbType.currentIndexChanged.connect(lambda: self.invalidate_equiptment(top_lvl))
+ master_gw.cmbLevel.currentIndexChanged.connect(lambda: self.invalidate_equiptment(top_lvl))
+ #master_gw.cmbType.currentIndexChanged.connect(lambda: add_children(top_lvl))
+ #master_gw.cmbLevel.currentIndexChanged.connect(lambda: add_children(top_lvl))
+
+ def add_children(self, top_lvl_wid: QTreeWidgetItem):
+ tw = self.ui.table_Equip
+ for i in range(0, top_lvl_wid.childCount()):
+ top_lvl_wid.takeChild(0)
+ master_gw = tw.itemWidget(top_lvl_wid, 0)
+ this_gear = master_gw.gear
+ these_lvls = this_gear.guess_target_lvls()
+ for lvl in these_lvls:
+ twi = QTreeWidgetItem(top_lvl_wid, [''] * tw.columnCount())
+ _gear = this_gear.duplicate()
+ _gear.set_enhance_lvl(lvl)
+ this_check_state = Qt.Checked if lvl in this_gear.target_lvls else Qt.Unchecked
+ this_gw = GearWidget(_gear, self, edit_able=False, display_full_name=False,
+ check_state=this_check_state)
+ tw.setItemWidget(twi, 0, this_gw)
+ top_lvl_wid.addChild(twi)
+
+ twi.setText(1, master_gw.cmbType.currentText())
+ twi.setText(2, top_lvl_wid.text(2))
+ twi.setText(3, _gear.enhance_lvl)
+
+ def master_gw_sig_gear_changed(self, gw:GearWidget):
+ self.add_children(gw.parent_widget)
def cmdFSAdd_clicked(self, bool_):
model = self.model
- gear_type = gear_types.items()[0][1]
- enhance_lvl = gear_type.lvl_map.keys()[0]
+ gear_type = list(gear_types.items())[0][1]
+ enhance_lvl = list(gear_type.lvl_map.keys())[0]
this_gear = generate_gear_obj(model.settings, base_item_cost=0, enhance_lvl=enhance_lvl, gear_type=gear_type)
self.table_FS_add_gear(this_gear, add_fun=model.add_fs_item)
self.invalidate_fs_list()
@@ -1050,12 +1482,13 @@ def cmdFSAdd_clicked(self, bool_):
def cmdEquipAdd_clicked(self, bool_):
model = self.model
- gear_type = gear_types.items()[0][1]
- enhance_lvl = gear_type.lvl_map.keys()[0]
+ gear_type = list(gear_types.items())[0][1]
+ enhance_lvl = list(gear_type.lvl_map.keys())[0]
this_gear = generate_gear_obj(model.settings, base_item_cost=0, enhance_lvl=enhance_lvl, gear_type=gear_type)
- self.table_Eq_add_gear( this_gear, add_fun=model.add_equipment_item)
+ self.table_Eq_add_gear( this_gear)
+ model.add_equipment_item(this_gear)
def invalidate_fs_list(self):
frmObj = self.ui
@@ -1065,15 +1498,17 @@ def invalidate_fs_list(self):
clear_table(tw)
self.invalidate_strategy()
- def invalidate_equiptment(self, row_idx):
+ def invalidate_equiptment(self, t_item:QTreeWidgetItem):
frmObj = self.ui
tw = frmObj.table_Equip
self.model.invalidate_enahce_list()
with QBlockSig(tw):
- tw.takeItem(row_idx, 4)
- tw.takeItem(row_idx, 5)
- tw.takeItem(row_idx, 6)
- tw.takeItem(row_idx, 7)
+ t_item.setText(4, '')
+ t_item.setText(5, '')
+ t_item.setText(6, '')
+ t_item.setText(7, '')
+ t_item.setText(8, '')
+
self.invalidate_strategy()
def invalidate_strategy(self):
@@ -1115,8 +1550,9 @@ def open_file_dlg(self):
def clear_all(self):
frmObj = self.ui
self.model = None
- map(lambda x: clear_table(x), [frmObj.table_FS, frmObj.table_Strat, frmObj.table_Equip, frmObj.table_FS_Cost,
- frmObj.table_Strat_Equip, frmObj.table_Strat_FS])
+ list(map(lambda x: clear_table(x), [frmObj.table_FS, frmObj.table_Strat, frmObj.table_FS_Cost,
+ frmObj.table_Strat_Equip, frmObj.table_Strat_FS]))
+ frmObj.table_Equip.clear()
self.clear_data()
self.model = Enhance_model()
@@ -1153,7 +1589,7 @@ def load_file(self, str_path):
self.show_critical_error('Something is wrong with the settings file: ' + str_path)
except KeyError as e:
self.show_critical_error('Something is wrong with the settings file: ' + str_path)
- print e
+ print(e)
self.load_ui_common()
@@ -1162,9 +1598,9 @@ def load_file(self, str_path):
enhance_me = settings[settings.P_ENHANCE_ME]
except KeyError as e:
self.show_critical_error('Something is wrong with the settings file: ' + str_path)
- print e
+ print(e)
for j in self.model.settings:
- print j
+ print(j)
return
tw = frmObj.table_Equip
@@ -1216,7 +1652,7 @@ def spin_Cost_item_textChanged(str_val):
cost_cron = settings[settings.P_CRON_STONE_COST]
cost_meme = item_store.get_cost(ItemStore.P_MEMORY_FRAG)
cost_dscale = item_store.get_cost(ItemStore.P_DRAGON_SCALE)
- map(cost_mat_gen, [
+ list(map(cost_mat_gen, [
[frmObj.spin_Cost_BlackStone_Armor, cost_bs_a, model.set_cost_bs_a, 'Blackstone Armour'],
[frmObj.spin_Cost_BlackStone_Weapon, cost_bs_w, model.set_cost_bs_w, 'Blackstone Weapon'],
[frmObj.spin_Cost_ConcArmor, cost_conc_a, model.set_cost_conc_a, 'Conc Blackstone Armour'],
@@ -1225,4 +1661,4 @@ def spin_Cost_item_textChanged(str_val):
[frmObj.spin_Cost_Cron, cost_cron, model.set_cost_cron, 'Cron Stone'],
[frmObj.spin_Cost_MemFrag, cost_meme, model.set_cost_meme, 'Memory Fragment'],
[frmObj.spin_Cost_Dragon_Scale, cost_dscale, model.set_cost_dragonscale, 'Dragon Scale'],
- ])
+ ]))
diff --git a/GraveflosEnhancementTool_win32.py b/GraveflosEnhancementTool_win32.py
new file mode 100644
index 0000000..aef1ee1
--- /dev/null
+++ b/GraveflosEnhancementTool_win32.py
@@ -0,0 +1,10 @@
+#- * -coding: utf - 8 - * -
+"""
+🛳 NSWCP 🚢 Code 324 🛳
+
+@author: ☙ Ryan McConnell ♈♑ ryan.mcconnell@navy.mil ❧
+"""
+from BDO_Enhancement_Tool import start_ui
+
+if __name__ == '__main__':
+ start_ui.launch()
diff --git a/Images/Equipment.png b/Images/Equipment.png
index 5015c19..a671bd7 100644
Binary files a/Images/Equipment.png and b/Images/Equipment.png differ
diff --git a/Images/gear_lvl/1.png b/Images/gear_lvl/1.png
new file mode 100644
index 0000000..c4825db
Binary files /dev/null and b/Images/gear_lvl/1.png differ
diff --git a/Images/gear_lvl/10.png b/Images/gear_lvl/10.png
new file mode 100644
index 0000000..fc12f27
Binary files /dev/null and b/Images/gear_lvl/10.png differ
diff --git a/Images/gear_lvl/11.png b/Images/gear_lvl/11.png
new file mode 100644
index 0000000..6ba663e
Binary files /dev/null and b/Images/gear_lvl/11.png differ
diff --git a/Images/gear_lvl/12.png b/Images/gear_lvl/12.png
new file mode 100644
index 0000000..9d724e0
Binary files /dev/null and b/Images/gear_lvl/12.png differ
diff --git a/Images/gear_lvl/13.png b/Images/gear_lvl/13.png
new file mode 100644
index 0000000..c0c8c2b
Binary files /dev/null and b/Images/gear_lvl/13.png differ
diff --git a/Images/gear_lvl/14.png b/Images/gear_lvl/14.png
new file mode 100644
index 0000000..9c290ec
Binary files /dev/null and b/Images/gear_lvl/14.png differ
diff --git a/Images/gear_lvl/15.png b/Images/gear_lvl/15.png
new file mode 100644
index 0000000..e168afe
Binary files /dev/null and b/Images/gear_lvl/15.png differ
diff --git a/Images/gear_lvl/2.png b/Images/gear_lvl/2.png
new file mode 100644
index 0000000..4cefcdb
Binary files /dev/null and b/Images/gear_lvl/2.png differ
diff --git a/Images/gear_lvl/3.png b/Images/gear_lvl/3.png
new file mode 100644
index 0000000..28b1875
Binary files /dev/null and b/Images/gear_lvl/3.png differ
diff --git a/Images/gear_lvl/4.png b/Images/gear_lvl/4.png
new file mode 100644
index 0000000..181a1da
Binary files /dev/null and b/Images/gear_lvl/4.png differ
diff --git a/Images/gear_lvl/5.png b/Images/gear_lvl/5.png
new file mode 100644
index 0000000..8dd8199
Binary files /dev/null and b/Images/gear_lvl/5.png differ
diff --git a/Images/gear_lvl/6.png b/Images/gear_lvl/6.png
new file mode 100644
index 0000000..94dcea3
Binary files /dev/null and b/Images/gear_lvl/6.png differ
diff --git a/Images/gear_lvl/7.png b/Images/gear_lvl/7.png
new file mode 100644
index 0000000..4f7aea4
Binary files /dev/null and b/Images/gear_lvl/7.png differ
diff --git a/Images/gear_lvl/8.png b/Images/gear_lvl/8.png
new file mode 100644
index 0000000..eb632e4
Binary files /dev/null and b/Images/gear_lvl/8.png differ
diff --git a/Images/gear_lvl/9.png b/Images/gear_lvl/9.png
new file mode 100644
index 0000000..174400c
Binary files /dev/null and b/Images/gear_lvl/9.png differ
diff --git a/Images/gear_lvl/DUO.png b/Images/gear_lvl/DUO.png
new file mode 100644
index 0000000..ee8d02a
Binary files /dev/null and b/Images/gear_lvl/DUO.png differ
diff --git a/Images/gear_lvl/Gear_Level.psd b/Images/gear_lvl/Gear_Level.psd
new file mode 100644
index 0000000..6496861
Binary files /dev/null and b/Images/gear_lvl/Gear_Level.psd differ
diff --git a/Images/gear_lvl/PEN.png b/Images/gear_lvl/PEN.png
new file mode 100644
index 0000000..079d204
Binary files /dev/null and b/Images/gear_lvl/PEN.png differ
diff --git a/Images/gear_lvl/PRI.png b/Images/gear_lvl/PRI.png
new file mode 100644
index 0000000..7373f76
Binary files /dev/null and b/Images/gear_lvl/PRI.png differ
diff --git a/Images/gear_lvl/TET.png b/Images/gear_lvl/TET.png
new file mode 100644
index 0000000..27fec23
Binary files /dev/null and b/Images/gear_lvl/TET.png differ
diff --git a/Images/gear_lvl/TRI.png b/Images/gear_lvl/TRI.png
new file mode 100644
index 0000000..6554b8f
Binary files /dev/null and b/Images/gear_lvl/TRI.png differ
diff --git a/Images/items/00000007.png b/Images/items/00000007.png
new file mode 100644
index 0000000..b83547c
Binary files /dev/null and b/Images/items/00000007.png differ
diff --git a/Images/items/00000008.png b/Images/items/00000008.png
new file mode 100644
index 0000000..511ba18
Binary files /dev/null and b/Images/items/00000008.png differ
diff --git a/Images/items/00000018.png b/Images/items/00000018.png
new file mode 100644
index 0000000..9030526
Binary files /dev/null and b/Images/items/00000018.png differ
diff --git a/Images/items/00000019.png b/Images/items/00000019.png
new file mode 100644
index 0000000..4660ce9
Binary files /dev/null and b/Images/items/00000019.png differ
diff --git a/Images/items/00016080.png b/Images/items/00016080.png
new file mode 100644
index 0000000..3f057ee
Binary files /dev/null and b/Images/items/00016080.png differ
diff --git a/Images/items/00017644.png b/Images/items/00017644.png
new file mode 100644
index 0000000..df56fc0
Binary files /dev/null and b/Images/items/00017644.png differ
diff --git a/Images/items/00017734.png b/Images/items/00017734.png
new file mode 100644
index 0000000..bfaa4c0
Binary files /dev/null and b/Images/items/00017734.png differ
diff --git a/Images/items/00017735.png b/Images/items/00017735.png
new file mode 100644
index 0000000..f191591
Binary files /dev/null and b/Images/items/00017735.png differ
diff --git a/Images/items/00017736.png b/Images/items/00017736.png
new file mode 100644
index 0000000..08d5b7e
Binary files /dev/null and b/Images/items/00017736.png differ
diff --git a/Images/items/00017800.png b/Images/items/00017800.png
new file mode 100644
index 0000000..da950ba
Binary files /dev/null and b/Images/items/00017800.png differ
diff --git a/Images/items/00044195.png b/Images/items/00044195.png
new file mode 100644
index 0000000..22433a5
Binary files /dev/null and b/Images/items/00044195.png differ
diff --git a/Images/items/00044364.png b/Images/items/00044364.png
new file mode 100644
index 0000000..a818cb5
Binary files /dev/null and b/Images/items/00044364.png differ
diff --git a/Images/items/ic_00017.png b/Images/items/ic_00017.png
new file mode 100644
index 0000000..2f34d11
Binary files /dev/null and b/Images/items/ic_00017.png differ
diff --git a/Images/lens2.png b/Images/lens2.png
new file mode 100644
index 0000000..f4fcc3a
Binary files /dev/null and b/Images/lens2.png differ
diff --git a/QtCommon/Qt_common.py b/QtCommon/Qt_common.py
index 14a8a5b..bb08a80 100644
--- a/QtCommon/Qt_common.py
+++ b/QtCommon/Qt_common.py
@@ -15,12 +15,25 @@
class CLabel(QtWidgets.QLabel):
sigMouseDoubleClick = QtCore.pyqtSignal(object, name="sigMouseDoubleClick")
+ sigMouseClick = QtCore.pyqtSignal(object, name="sigMouseClick")
+
+ def mouseReleaseEvent(self, ev: QtGui.QMouseEvent) -> None:
+ super(CLabel, self).mouseReleaseEvent(ev)
+ self.sigMouseClick.emit(ev)
def mouseDoubleClickEvent(self, QMouseEvent):
super(CLabel, self).mouseDoubleClickEvent(QMouseEvent)
self.sigMouseDoubleClick.emit(QMouseEvent)
+class FocusLineEdit(QtWidgets.QLineEdit):
+ sig_lost_focus = QtCore.pyqtSignal(object, name='sig_lost_focus')
+
+ def focusOutEvent(self, a0: QtGui.QFocusEvent) -> None:
+ super(FocusLineEdit, self).focusOutEvent(a0)
+ self.sig_lost_focus.emit(a0)
+
+
class EventDock(QtWidgets.QDockWidget):
sigCloseEvent = QtCore.pyqtSignal(object, name="sigCloseEvent")
sigShow = QtCore.pyqtSignal(name='sigShow')
@@ -210,7 +223,7 @@ def stat_msg(self, msg):
statusbar.setPalette(this_pal)
statusbar.setAutoFillBackground(True)
if print_msg is not False:
- print print_msg
+ print(print_msg)
orig(message)
def show_critical_error(self, str_msg, silent=False):
@@ -289,3 +302,25 @@ def __exit__(self, exc_type, exc_val, exc_tb):
for _blk, _obj in zip(self.blk, self.obj):
_obj.setSortingEnabled(_blk)
+
+class SpeedUpTable(object):
+ def __init__(self, tbl):
+ self.tble = tbl
+ self.prev_vis = True
+ self.prev_updates = True
+ self.prev_sort = False
+
+ def __enter__(self):
+ self.prev_vis = self.tble.isVisible()
+ self.prev_updates = self.tble.updatesEnabled()
+ self.prev_sort = self.tble.isSortingEnabled()
+
+ self.tble.setVisible(False)
+ self.tble.setSortingEnabled(False)
+ self.tble.setUpdatesEnabled(False)
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ self.tble.setVisible(self.prev_vis)
+ self.tble.setSortingEnabled(self.prev_sort)
+ self.tble.setUpdatesEnabled(self.prev_updates)
+
diff --git a/QtCommon/__init__.py b/QtCommon/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/QtCommon/forms/dlg_Simple_TableWidget.py b/QtCommon/forms/dlg_Simple_TableWidget.py
index fd87e04..51735f9 100644
--- a/QtCommon/forms/dlg_Simple_TableWidget.py
+++ b/QtCommon/forms/dlg_Simple_TableWidget.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
-# Form implementation generated from reading ui file 'C:\Users\rammc\Documents\PycharmProjects\BDO_Enhancement_Tool\QtCommon\forms\dlg_Simple_TableWidget.ui'
+# Form implementation generated from reading ui file 'C:\Users\rammc\Documents\Pycharm3\BDO_Enhancement_Tool\QtCommon\forms\dlg_Simple_TableWidget.ui'
#
-# Created by: PyQt5 UI code generator 5.6
+# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
diff --git a/QtCommon/track_selection_proto.py b/QtCommon/track_selection_proto.py
index 551a76f..c41191a 100644
--- a/QtCommon/track_selection_proto.py
+++ b/QtCommon/track_selection_proto.py
@@ -3,7 +3,7 @@
@author: ☙ Ryan McConnell ♈♑ rammcconnell@gmail.com ❧
"""
-from forms import dlg_Simple_TableWidget
+from .forms import dlg_Simple_TableWidget
from PyQt5 import QtWidgets
#from PyQt5.QtCore import pyqtSignal
diff --git a/README.md b/README.md
index e26aa6c..24c990c 100644
--- a/README.md
+++ b/README.md
@@ -49,17 +49,20 @@ Lastly, on the \"Strategy\" tab click \"Calculate\" to get a list of fail stacks
## Dependencies
-This project depends on a many standard libraries and some libraries of
+This project depends on several libraries and some libraries of
my own. For this project to work the utilities and QtCommon module
collection must be present. These are small versions of larger modules
that I copied and cleaned for convenience.
-Some of the more standard libraries used that are not made by me are:
-* matplotlib (switching to pyqtgraph)
-* numpy
-* PyQt5
-* ctypes (Windows only)
-* json
+See [requirements.txt](https://github.com/ILikesCaviar/BDO_Enhancement_Tool/blob/master/requirements.txt) for details:
+
+* fuzzywuzzy==0.18.0
+* numpy==1.19.0
+* PyQt5==5.15.0
+* PyQt5-sip==12.8.0
+* python-Levenshtein==0.12.0
+* urllib3==1.25.9
+
### Standard
* sys
@@ -75,11 +78,9 @@ project because that is how it was developed.
See: [Downloads | Anaconda](https://www.anaconda.com/download/)
```
> python --version
-Python 2.7.15 :: Anaconda, Inc.
-```
-```
+Python 3.7.6
> python -m conda --version
-conda 4.5.12
+conda 4.8.3
```
## Methods
@@ -131,26 +132,6 @@ F(x) = avg_num_success * op_cost
F(x) = avg_num_success * (black_stone_cost + (suc_rate * (F(x-1) + return_cost)) + (fail_rate * repair_cost))
```
-### Establishing the Fail Stack Gear List
-A complication with [Establishing Fail Stack Cost](#establishing-fail-stack-cost)
-is that items giving multiple fail stacks with one failure. This is
-handled by a second over the fail stack list so the negative cost of
-gaining more fail stacks is factored in. These items do not affect the
-global fail stack cost list because they introduce discontinuities.
-The calculation is the same except the term in the formula for failing
-is different:
-```
-(fail_rate * repair_cost) -> (fail_rate * (repair_cost - (F(x + GAIN) - F(x + 1))))
-```
-
-Here we just have a negative cost deducted from repair_cost. The cost
-subtracted is the cost of the fail stacks gained omitting the cost of
-one fail stack because no other item got the cost of one fail stack omitted.
-
-Items that are cost effective here are displayed as optimal for the fail
- stack in question but the over all cost does NOT effect the global fail
- stack curve used to price items and fail stacks.
-* See: common.py -> simulate_FS_complex
### Calculating Enhancement Cost
@@ -215,58 +196,7 @@ Here we have:
Notice that this method needs to be different for accessories and the like.
### Calculating Enhancement Strategy
-The enhancement cost calculation assumes that the user is smashing
-through trash items to get to a particular level of fail stacks and
-then attempting their enhancement. A more realistic model would be one
-where a user may attempt a win-win situation at relatively low fail
-stack levels on equipment they are trying to enhance, that if they
-would fail they are still gaining the value of building a fail stack
-for items that require more fail stacks to be efficient. The reason this
-is not considered in the previous section is because fail stack prices
-increase exponentially. From my experience it is hard to determine when
-the potential value of gaining fail stacks outweighs the cost and hassle
-of repairing gear.
-
-My solution to this was, first to leave the value of gaining
-a fail stack out of the calculation for optimizing the range at which to
-enhance gear. Gear enhance range is about potential loss not potential gain.
-
-Next, in this second calculation the opportunity cost considers
-the value gained upon failure in fail stack costs and the value of the
-gear obtained by succeeding the enhancement as determined by the enhancement cost.
-Gaining the gear enhancement cost upon success is supposed to balance out the greed for
-exponential fail stacks as the gear cost is based on fail stack price, not to be confused
-with the gear cost \(cost of acquiring\)
-
-This is not the be all and end all calculation for determining what to do. This
-is supposed to suggest a cost efficient method for the dual objective of fail
-stacking and enhancing. In the GUI the user is shown a cost based calculation
-and a cost optimality to show them how efficient an attempt is in cost, not value,
-as well as their chances of succeeding at the average number of fails. With this
-info a user may weigh the value of gaining fail stacks while also considering the
-efficiency of the potential cost.
-
-After the enhancement cost and fail stack costs have been calculated, here is
-the Enhancement Strategy value:
-
-```
-fail_rate = numpy.ones(success_rates.shape) - success_rates
-success_balance = -this_total_cost
-success_cost = success_rates * success_balance
-fail_balance = repair_cost - fail_stack_gains
-
-backtrack_start = lvl_map['TRI']
-if this_lvl >= backtrack_start:
- fail_balance += min(total_cost[this_lvl-1])
-
-fail_cost = fail_rate * fail_balance
-tap_total_cost = success_cost + fail_cost + black_stone_cost
-```
-
-This is very similar to the above except upon failure the cost for the
-next n fail stacks is subtracted \(negative cost\) from the balance and
-when a success happens the gear enhancement cost is subtracted. This attempts
-to balance the dual objective of enhancing the gear and gaining fail stacks.
+This needs an update. The previous explination does not represent the code anymore.
### Calculating Enhancement Probability
diff --git a/Tests/__init__.py b/Tests/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/Tests/test_enhance_strat.py b/Tests/test_enhance_strat.py
index d2a5597..4af6fe5 100644
--- a/Tests/test_enhance_strat.py
+++ b/Tests/test_enhance_strat.py
@@ -58,8 +58,8 @@ def run_test(count_fs=False, devaule_fs=True, count_overflow=True, regress=True,
log_count = 0
- enhc_me_mins = map(lambda x: numpy.argmin(x), enhc_me.T)
- fsers_mins = map(lambda x: numpy.argmin(x), fsers.T)
+ enhc_me_mins = [numpy.argmin(x) for x in enhc_me.T]
+ fsers_mins = [numpy.argmin(x) for x in fsers.T]
enhance_order = [enhc_me[c][i] for i,c in enumerate(enhc_me_mins)]
@@ -97,7 +97,7 @@ def run_test(count_fs=False, devaule_fs=True, count_overflow=True, regress=True,
# only on enhancement success are the avgs saved
- print 'count_fs: {} | devaule_fs: {} | count_overflow: {} | regress: {}'.format(count_fs, devaule_fs, count_overflow, regress)
+ print('count_fs: {} | devaule_fs: {} | count_overflow: {} | regress: {}'.format(count_fs, devaule_fs, count_overflow, regress))
def log_data():
db_trials.insert({
@@ -154,13 +154,13 @@ def log_data():
log_data()
balance = 0
avg.clear()
- map(lambda x: x.clear(), gear_accumulators)
+ list(map(lambda x: x.clear(), gear_accumulators))
log_count += 1
if log_count >= num_logs or (datetime.datetime.utcnow() - start_time).total_seconds() > trials_max_time:
break
except KeyboardInterrupt:
- print 'AVG: {} | NUM_AVG: {}'.format(avg.avg, avg.avgs)
+ print('AVG: {} | NUM_AVG: {}'.format(avg.avg, avg.avgs))
log_data()
mongo_client.close()
sys.exit(0)
diff --git a/Tests/test_enhance_strat_calc.py b/Tests/test_enhance_strat_calc.py
index 9f67a34..0aba556 100644
--- a/Tests/test_enhance_strat_calc.py
+++ b/Tests/test_enhance_strat_calc.py
@@ -22,8 +22,8 @@ def run_test(count_fs=False, devaule_fs=True, count_overflow=True, regress=True,
#fail_stackers = mymodel.fail_stackers
fail_stackers = mymodel.settings[mymodel.settings.P_FAIL_STACKERS]
- enhc_me_mins = map(lambda x: numpy.argmin(x), enhc_me.T)
- fsers_mins = map(lambda x: numpy.argmin(x), fsers.T)
+ enhc_me_mins = [numpy.argmin(x) for x in enhc_me.T]
+ fsers_mins = [numpy.argmin(x) for x in fsers.T]
enhance_order = [enhc_me[c][i] for i,c in enumerate(enhc_me_mins)]
@@ -35,7 +35,7 @@ def run_test(count_fs=False, devaule_fs=True, count_overflow=True, regress=True,
# only on enhancement success are the avgs saved
- print 'count_fs: {} | devaule_fs: {} | count_overflow: {} | regress: {}'.format(count_fs, devaule_fs, count_overflow, regress)
+ print('count_fs: {} | devaule_fs: {} | count_overflow: {} | regress: {}'.format(count_fs, devaule_fs, count_overflow, regress))
for i in range(0, len(fs)):
if enhance_order[i] < fser_order[i]:
@@ -44,7 +44,7 @@ def run_test(count_fs=False, devaule_fs=True, count_overflow=True, regress=True,
else:
fsers_idx = fsers_mins[i]
this_gear = fail_stackers[fsers_idx]
- print '{} : {}'.format(i, this_gear.name)
+ print('{} : {}'.format(i, this_gear.name))
fs_strats = []
@@ -96,8 +96,8 @@ def run_test2(count_fs=False, devaule_fs=True, count_overflow=True, regress=True
#fail_stackers = mymodel.fail_stackers
fail_stackers = mymodel.settings[mymodel.settings.P_FAIL_STACKERS]
- enhc_me_mins = map(lambda x: numpy.argmin(x), enhc_me.T)
- fsers_mins = map(lambda x: numpy.argmin(x), fsers.T)
+ enhc_me_mins = [numpy.argmin(x) for x in enhc_me.T]
+ fsers_mins = [numpy.argmin(x) for x in fsers.T]
enhance_order = [enhc_me[c][i] for i,c in enumerate(enhc_me_mins)]
@@ -109,7 +109,7 @@ def run_test2(count_fs=False, devaule_fs=True, count_overflow=True, regress=True
# only on enhancement success are the avgs saved
- print 'count_fs: {} | devaule_fs: {} | count_overflow: {} | regress: {}'.format(count_fs, devaule_fs, count_overflow, regress)
+ print('count_fs: {} | devaule_fs: {} | count_overflow: {} | regress: {}'.format(count_fs, devaule_fs, count_overflow, regress))
for i in range(0, num_fs+1):
if enhance_order[i] < fser_order[i]:
@@ -118,7 +118,7 @@ def run_test2(count_fs=False, devaule_fs=True, count_overflow=True, regress=True
else:
fsers_idx = fsers_mins[i]
this_gear = fail_stackers[fsers_idx]
- print '{} : {}'.format(i, this_gear.name)
+ print('{} : {}'.format(i, this_gear.name))
fs_strats = []
@@ -180,7 +180,7 @@ def run_ehaust_test(settings='settings_booger.json'):
def clear_cost(x):
x.cost_vec_min = numpy.zeros(len(x.gear_type.map))
x.restore_cost_vec_min = numpy.zeros(len(x.gear_type.map))
- map(clear_cost, fail_stackers)
+ list(map(clear_cost, fail_stackers))
alls = fail_stackers + enhance_me
best = float('inf')
@@ -213,8 +213,8 @@ def fs_cost_strat(fs_num, gear_map):
best_map = comb
if (datetime.utcnow() - t_start).total_seconds() >= t_:
for i, g in enumerate(best_map):
- print 'FS: {}\t{}'.format(i, g.name)
- print best
+ print('FS: {}\t{}'.format(i, g.name))
+ print(best)
t_start = datetime.utcnow()
return best, best_map
@@ -237,7 +237,7 @@ def add_test(count_fs=False, devaule_fs=True, count_overflow=True, regress=True,
import csv
with open('strat_calcs.csv', 'wb') as f:
writer = csv.writer(f)
- rows = zip(*matrix)
+ rows = list(zip(*matrix))
writer.writerow(rows[0])
for rew in rows[1:]:
writer.writerow(rew)
@@ -245,6 +245,6 @@ def add_test(count_fs=False, devaule_fs=True, count_overflow=True, regress=True,
if __name__ == '__main__ NOT':
best, best_map = run_ehaust_test()
for i,g in enumerate(best_map):
- print 'FS: {}\t{}'.format(i, g.name)
- print best
+ print('FS: {}\t{}'.format(i, g.name))
+ print(best)
diff --git a/Tests/test_enhancement_accessories.py b/Tests/test_enhancement_accessories.py
index a9a6303..6d952eb 100644
--- a/Tests/test_enhancement_accessories.py
+++ b/Tests/test_enhancement_accessories.py
@@ -10,7 +10,7 @@
fs_list = []
with open(FAIL_STACK_FILE, 'rb') as f:
reader = csv.reader(f)
- reader.next()
+ next(reader)
for line in reader:
fs_list.append([line[0], float(line[1]), float(line[2]), float(line[3]), float(line[4])])
@@ -29,11 +29,11 @@
trail_at ='PRI'
indx_trail = BOSS_ACCESSORIES.lvl_map[trail_at]
avg_cost_per_fs = []
- print trail_at
+ print(trail_at)
for fs, chance in enumerate(BOSS_ACCESSORIES.map[indx_trail]):
attempts = []
stack_cost = cum_fs[fs]
- for _ in xrange(0, nump_trails):
+ for _ in range(0, nump_trails):
this_attempt_cost = 0
while uniform(0,1) > chance:
this_attempt_cost += BASI_BELT_COST + BASI_BELT_COST
@@ -43,9 +43,9 @@
avg_cost_per_fs.append(this_avg_cost)
#print "FS: " + str(fs) + ": " + str(this_avg_cost)
- print 'Optimal FS: ' + str(numpy.argmin(avg_cost_per_fs))
+ print('Optimal FS: ' + str(numpy.argmin(avg_cost_per_fs)))
PRI_MIN = numpy.min(avg_cost_per_fs)
- print 'Optimal Cost: ' + str(PRI_MIN)
+ print('Optimal Cost: ' + str(PRI_MIN))
import matplotlib.pyplot as plt
plt.plot(avg_cost_per_fs)
@@ -56,11 +56,11 @@
trail_at = 'DUO'
indx_trail = BOSS_ACCESSORIES.lvl_map[trail_at]
avg_cost_per_fs = []
-print trail_at
+print(trail_at)
for fs, chance in enumerate(BOSS_ACCESSORIES.map[indx_trail]):
attempts = []
stack_cost = cum_fs[fs]
- for _ in xrange(0, nump_trails):
+ for _ in range(0, nump_trails):
this_attempt_cost = 0
while uniform(0,1) > chance:
this_attempt_cost += BASI_BELT_COST + PRI_MIN
@@ -70,8 +70,8 @@
avg_cost_per_fs.append(this_avg_cost)
#print "FS: " + str(fs) + ": " + str(this_avg_cost)
-print 'Optimal FS: ' + str(numpy.argmin(avg_cost_per_fs))
-print 'Optimal Cost: ' + str(numpy.min(avg_cost_per_fs))
+print('Optimal FS: ' + str(numpy.argmin(avg_cost_per_fs)))
+print('Optimal Cost: ' + str(numpy.min(avg_cost_per_fs)))
import matplotlib.pyplot as plt
plt.plot(avg_cost_per_fs)
diff --git a/Tests/test_enhancement_gear.py b/Tests/test_enhancement_gear.py
index 473f3be..bcf2cf3 100644
--- a/Tests/test_enhancement_gear.py
+++ b/Tests/test_enhancement_gear.py
@@ -10,7 +10,7 @@
fs_list = []
with open(FAIL_STACK_FILE, 'rb') as f:
reader = csv.reader(f)
- reader.next()
+ next(reader)
for line in reader:
fs_list.append([line[0], float(line[1]), float(line[2]), float(line[3]), float(line[4])])
@@ -30,11 +30,11 @@
trail_at ='DUO'
indx_trail = BOSS_GEAR.lvl_map[trail_at]
avg_cost_per_fs = []
- print trail_at
+ print(trail_at)
for fs, chance in enumerate(BOSS_GEAR.map[indx_trail]):
attempts = []
stack_cost = cum_fs[fs]
- for _ in xrange(0, nump_trails):
+ for _ in range(0, nump_trails):
this_attempt_cost = 0
while uniform(0,1) > chance:
this_attempt_cost += (MEM_FRAG_COST * 10) + CONC_COST
@@ -44,9 +44,9 @@
avg_cost_per_fs.append(this_avg_cost)
#print "FS: " + str(fs) + ": " + str(this_avg_cost)
- print 'Optimal FS: ' + str(numpy.argmin(avg_cost_per_fs))
+ print('Optimal FS: ' + str(numpy.argmin(avg_cost_per_fs)))
PRI_MIN = numpy.min(avg_cost_per_fs)
- print 'Optimal Cost: ' + str(PRI_MIN)
+ print('Optimal Cost: ' + str(PRI_MIN))
import matplotlib.pyplot as plt
plt.plot(avg_cost_per_fs)
@@ -57,11 +57,11 @@
trail_at = 'TRI'
indx_trail = BOSS_GEAR.lvl_map[trail_at]
avg_cost_per_fs = []
-print trail_at
+print(trail_at)
for fs, chance in enumerate(BOSS_GEAR.map[indx_trail]):
attempts = []
stack_cost = cum_fs[fs]
- for _ in xrange(0, nump_trails):
+ for _ in range(0, nump_trails):
this_attempt_cost = 0
while uniform(0,1) > chance:
this_attempt_cost += (MEM_FRAG_COST * 10) + CONC_COST + PRI_MIN
@@ -71,8 +71,8 @@
avg_cost_per_fs.append(this_avg_cost)
#print "FS: " + str(fs) + ": " + str(this_avg_cost)
-print 'Optimal FS: ' + str(numpy.argmin(avg_cost_per_fs))
-print 'Optimal Cost: ' + str(numpy.min(avg_cost_per_fs))
+print('Optimal FS: ' + str(numpy.argmin(avg_cost_per_fs)))
+print('Optimal Cost: ' + str(numpy.min(avg_cost_per_fs)))
import matplotlib.pyplot as plt
plt.plot(avg_cost_per_fs)
diff --git a/Tests/test_oppertunity_cost_method.py b/Tests/test_oppertunity_cost_method.py
index b3f2490..cc70a3f 100644
--- a/Tests/test_oppertunity_cost_method.py
+++ b/Tests/test_oppertunity_cost_method.py
@@ -50,18 +50,18 @@ def binom_cdf(oc, pool, prob):
int_binom_adj = (prob_fail * avg_num_oppertunities * opportunity_cost) + (chance * return_cost)
-print "Opportunity cost: " + str(opportunity_cost)
-print "Adjusted: " + str(adjusted)
-print "Integer Binomial adjusted: " + str(int_binom_adj)
+print("Opportunity cost: " + str(opportunity_cost))
+print("Adjusted: " + str(adjusted))
+print("Integer Binomial adjusted: " + str(int_binom_adj))
-for i in xrange(0, nump_trails):
+for i in range(0, nump_trails):
this_attempt_cost = 0
while uniform(0,1) < chance:
this_attempt_cost += const_rate + return_cost
this_attempt_cost += const_rate + fail_cost
attempts.append(this_attempt_cost)
if i % show_every == 0:
- print numpy.mean(attempts)
+ print(numpy.mean(attempts))
-print 'Final:'
-print numpy.mean(attempts)
+print('Final:')
+print(numpy.mean(attempts))
diff --git a/__init__.py b/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/__main__.py b/__main__.py
new file mode 100644
index 0000000..ded8469
--- /dev/null
+++ b/__main__.py
@@ -0,0 +1,20 @@
+import sys
+'''
+Icon credit:
+Icons made by Kiranshastry from www.flaticon.com
+
+
+'''
+
+if __name__ == "__main__":
+ if '-b' in sys.argv:
+ from .build_run import convert_ui_files, relative_path_convert
+
+ convert_ui_files(relative_path_convert('Forms'))
+ convert_ui_files(relative_path_convert('QtCommon/forms'))
+ if '-bexe' in sys.argv:
+ from .build_exe import do_build
+ do_build(sys.argv[2:])
+ sys.exit(0)
+ from .start_ui import launch
+ launch()
diff --git a/bdo_database/gear.sqlite3 b/bdo_database/gear.sqlite3
new file mode 100644
index 0000000..43e666b
Binary files /dev/null and b/bdo_database/gear.sqlite3 differ
diff --git a/build_exe.py b/build_exe.py
index 2ddbb85..be47006 100644
--- a/build_exe.py
+++ b/build_exe.py
@@ -7,16 +7,18 @@
import sys, os, shutil
from datetime import datetime
from PIL import Image, ImageFilter
-from common import relative_path_convert
-from utilities import center_rect, fitAspectRatio
-from start_ui import RELEASE_VER
+from .common import relative_path_convert
+from .utilities import center_rect, fitAspectRatio
+from .start_ui import RELEASE_VER
import subprocess, numpy
-
-pyinstaller = r'C:\ProgramData\Anaconda2\envs\BDO_Enhancement_Tool\Scripts\pyinstaller.exe'
+venv = r'C:\ProgramData\Anaconda3\envs\BDO_Enhancement_Tool_venv\Scripts'
+pyinstaller = os.path.join(venv, 'pyinstaller.exe')
ISCC = r'C:\Program Files (x86)\Inno Setup 5\ISCC.exe'
UPX = r'C:\Program Files\upx-3.95-win64'
-ENTRY_POINT = 'start_ui.py'
+module_name = 'BDO_Enhancement_Tool'
+
+ENTRY_POINT = 'GraveflosEnhancementTool_win32.py'
ICON_PATH = 'favicon.ico'
INSTALL_ICON_PATH = '../install.png'
@@ -88,11 +90,11 @@ def scale_image(img_, aspect_rat=None, width=None, height=None, AA=Image.LANCZOS
def copy_print(source, dest, copyf=shutil.copy):
try:
copyf(source, dest)
- print '{} -> {}'.format(source, dest)
+ print('{} -> {}'.format(source, dest))
except OSError as e:
- print e
- print 'ERROR: {} -> {}'.format(source, dest)
- raw_input('Press any key to try again... (CTRL+C to cancel program)')
+ print(e)
+ print('ERROR: {} -> {}'.format(source, dest))
+ input('Press any key to try again... (CTRL+C to cancel program)')
copy_print(source, dest, copyf=copyf)
def build_iss(path, script_base, swaps=None, output_script_name=DEFAULT_OUTPUT_INSTALL_SCRIPT):
@@ -100,21 +102,21 @@ def build_iss(path, script_base, swaps=None, output_script_name=DEFAULT_OUTPUT_I
swaps = {}
with open(script_base) as f:
contents = f.read()
- for key,val in swaps.iteritems():
+ for key,val in swaps.items():
contents = contents.replace(key, val)
script_path = os.path.abspath(os.path.join(path, output_script_name))
with open(script_path, 'w') as f:
f.write(contents)
- print 'Building Installer...'
+ print('Building Installer...')
try:
command = [ISCC, script_path]
- print ' '. join(command)
+ print(' '. join(command))
ret = subprocess.check_call(command, shell=False)
- print 'Installer Build Success'
+ print('Installer Build Success')
except subprocess.CalledProcessError as e:
- print e
- print 'Installer Build Failed'
+ print(e)
+ print('Installer Build Failed')
def build_installer(path, icon=None):
if icon is None:
@@ -150,27 +152,54 @@ def build_patch(path, icon=None):
# Convert UI files to python files
def build_exe(path, upx=False, clean=False):
- print 'Building...'
+ print('Building...')
+ my_env = os.environ.copy()
+ my_env["PATH"] = "{};".format(venv) + my_env["PATH"]
try:
command = [pyinstaller, '--noconsole', '--noconfirm', '--distpath={}'.format(path),
- '--icon={}'.format(ICON_PATH),
+ '--icon={}'.format(ICON_PATH), '--hidden-import=pkg_resources.py2_warn',
'{}'.format(ENTRY_POINT)]
if upx:
command.insert(5, '--upx-dir={}'.format(UPX))
if clean:
command.insert(5, '--clean')
- output = subprocess.check_output(command)
- print 'Build Success: ' + str(path)
+ output = subprocess.check_output(command, env=my_env)
+ print('Build Success: ' + str(path))
folder_path = os.path.basename(ENTRY_POINT)
folder_path = folder_path[:folder_path.rfind('.')]
common_dest = os.path.join(path, folder_path)
- copy_print(relative_path_convert(ICON_PATH), common_dest)
- copy_print(relative_path_convert('Graveflo.png'), common_dest)
- copy_print(relative_path_convert('title.png'), common_dest)
- copy_print(relative_path_convert('Data'), os.path.join(common_dest, 'Data'), copyf=shutil.copytree)
+ mod_embed_path = os.path.join(common_dest, module_name)
+ copy_print(relative_path_convert(ICON_PATH), mod_embed_path)
+ copy_print(relative_path_convert('Graveflo.png'), mod_embed_path)
+ copy_print(relative_path_convert('title.png'), mod_embed_path)
+ copy_print(relative_path_convert('Data'), os.path.join(mod_embed_path, 'Data'), copyf=shutil.copytree)
+ images_folder = os.path.join(mod_embed_path, 'Images')
+ try:
+ os.mkdir(images_folder)
+ except FileExistsError:
+ pass
+ shutil.copy(relative_path_convert('Images/lens2.png'), os.path.join(images_folder, 'lens2.png'))
+ copy_print(relative_path_convert('Images/gear_lvl'), os.path.join(images_folder, 'gear_lvl'), copyf=shutil.copytree)
+ copy_print(relative_path_convert('Images/items'), os.path.join(images_folder, 'items'),
+ copyf=shutil.copytree)
+ db_folder = os.path.join(mod_embed_path, 'bdo_database')
+ try:
+ os.mkdir(images_folder)
+ except FileExistsError:
+ pass
+ try:
+ os.mkdir(db_folder)
+ except FileExistsError:
+ pass
+ shutil.copy(relative_path_convert('bdo_database/gear.sqlite3'), db_folder)
+ try:
+ os.mkdir(os.path.join(db_folder, 'tmp_imgs'))
+ except FileExistsError:
+ pass
+ #copy_print(relative_path_convert('Data'), os.path.join(mod_embed_path, 'Data'), copyf=shutil.copytree)
copy_print(relative_path_convert('build'), os.path.join(path, 'build'), copyf=shutil.move)
except subprocess.CalledProcessError:
- print 'Build Failed'
+ print('Build Failed')
def overlay_inst_icon(input_icon_path, overlay_icon_path, save_path):
install_icon = Image.open(overlay_icon_path, 'r')
@@ -185,9 +214,10 @@ def overlay_inst_icon(input_icon_path, overlay_icon_path, save_path):
favicon.save(save_path, sizes=icon_sizes)
-if __name__ == '__main__':
- upx = '--upx' in sys.argv
- clean = '--clean' in sys.argv
+
+def do_build(args):
+ upx = '--upx' in args
+ clean = '--clean' in args
path = relative_path_convert('freeze_' + str(datetime.now().strftime("%m-%d-%y %H %M %S")))
build_exe(path, upx=upx)
inst_icon_path = relative_path_convert(os.path.join(path, OUTPUT_INSTALL_ICON))
@@ -197,3 +227,6 @@ def overlay_inst_icon(input_icon_path, overlay_icon_path, save_path):
inst_icon_path = relative_path_convert(ICON_PATH)
build_installer(path, icon=inst_icon_path)
build_patch(path, icon=inst_icon_path)
+
+if __name__ == '__main__':
+ do_build(sys.argv[1:])
diff --git a/build_run.py b/build_run.py
index c3dcd56..84b7e17 100644
--- a/build_run.py
+++ b/build_run.py
@@ -4,8 +4,8 @@
@author: ☙ Ryan McConnell ♈♑ rammcconnell@gmail.com ❧
"""
import sys, os
-from common import relative_path_convert
-from utilities import FileSearcher
+from .common import relative_path_convert
+from .utilities import FileSearcher
import subprocess
python_dir = os.path.dirname(sys.executable)
@@ -17,14 +17,14 @@ def convert_ui_files(path):
for file_ in fs.NonRecursive():
file_name = os.path.basename(file_)
file_name = file_name[:file_name.rfind('.')]
- output = subprocess.check_output([pyuic5, file_, '-o', os.path.join(os.path.dirname(file_), file_name+'.py')])
+ output = subprocess.check_output([pyuic5, file_, '-o', os.path.join(os.path.dirname(file_), file_name+'.py')]).decode('utf-8')
if output.find('Error') > -1:
- print output
+ print(output)
else:
- print '{} -> {}'.format(file_, file_name+'.py')
+ print('{} -> {}'.format(file_, file_name+'.py'))
if __name__ == '__main__':
convert_ui_files(relative_path_convert('Forms'))
convert_ui_files(relative_path_convert('QtCommon/forms'))
- from start_ui import launch
+ from .start_ui import launch
launch()
\ No newline at end of file
diff --git a/common.py b/common.py
index 0b240b8..f39b081 100644
--- a/common.py
+++ b/common.py
@@ -5,7 +5,7 @@
"""
DEBUG_PRINT_FILE = False
import json, os, numpy
-import utilities as utils
+from . import utilities as utils
def relative_path_convert(x):
@@ -50,6 +50,11 @@ def spc_binom_cdf_X_gte_1(pool, prob):
binVf = numpy.vectorize(spc_binom_cdf_X_gte_1)
+DB_FOLDER = relative_path_convert('bdo_database') # Could be error if this is a file for some reason
+IMG_TMP = os.path.join(DB_FOLDER, 'tmp_imgs')
+ENH_IMG_PATH = relative_path_convert('images/gear_lvl')
+GEAR_ID_FMT = '{:08}'
+
DEFAULT_SETTINGS_PATH = relative_path_convert('settings.json')
@@ -77,7 +82,7 @@ class EnhanceSettings(utils.Settings):
def init_settings(self, sets=None):
this_vec = {
- EnhanceSettings.P_NUM_FS: 120,
+ EnhanceSettings.P_NUM_FS: 300,
EnhanceSettings.P_CRON_STONE_COST: 2000000,
EnhanceSettings.P_CLEANSE_COST: 100000,
EnhanceSettings.P_ITEM_STORE: ItemStore()
@@ -129,7 +134,7 @@ def __setitem__(self, key, value):
self.store_items[key] = value
def iteritems(self):
- return self.store_items.iteritems()
+ return iter(self.store_items.items())
def get_cost(self, item):
return self.__getitem__(item)
@@ -152,6 +157,22 @@ def append(self, object):
super(ge_gen, self).append(object)
def __getitem__(self, idx):
+ if isinstance(idx, slice):
+ start = idx.start
+ stop = idx.stop
+ step = idx.step
+ if start is None:
+ start = 0
+ if stop is None:
+ stop = super(ge_gen, self).__len__()
+ if step is None:
+ step = 1
+
+ if stop < super(ge_gen, self).__len__():
+ return super(ge_gen, self).__getitem__(idx)
+ else:
+ return [self.__getitem__(i) for i in range(start, stop, step)]
+
try:
return super(ge_gen, self).__getitem__(idx)
except IndexError:
@@ -186,9 +207,9 @@ def __str__(self):
def load_txt(self, txt):
load_d = json.loads(txt)
- for key, val in load_d.iteritems():
+ for key, val in load_d.items():
self.__dict__[key] = val
- for key,val in self.lvl_map.iteritems():
+ for key,val in self.lvl_map.items():
self.idx_lvl_map[val] = key
map = self.map
@@ -286,25 +307,26 @@ def dec_enhance_lvl(enhance):
else:
raise Exception('wat')
-def generate_gear_obj(settings, base_item_cost=None, enhance_lvl=None, gear_type=None, name=None, sale_balance=None):
+def generate_gear_obj(settings, gear_type, base_item_cost=None, enhance_lvl=None, name=None, sale_balance=None, id=None):
if gear_type is None:
- gear_type = gear_types.items()[0][1]
+ gear_type = list(gear_types.items())[0][1]
if base_item_cost is None:
# This must have a value or some numerical members may be None
base_item_cost = 0
- str_gear_t = gear_type.name
+ if name is None:
+ name = ''
gear = gear_type.instantiable(settings, base_item_cost=base_item_cost, enhance_lvl=enhance_lvl, gear_type=gear_type,
name=name, sale_balance=sale_balance)
- if str_gear_t.lower().find('dura'):
- gear.fail_dura_cost = 4.0
+ gear.item_id = id
return gear
class Gear(object):
- def __init__(self, settings, base_item_cost=None, enhance_lvl=None, gear_type=None, name=None, sale_balance=None,
- fail_sale_balance=0, procurement_cost=0):
+ def __init__(self, settings, gear_type, base_item_cost=None, enhance_lvl=None, name=None, sale_balance=None,
+ fail_sale_balance=0, procurement_cost=0, target_lvls=None):
if sale_balance is None:
sale_balance = 0
+
self.settings = settings
self.base_item_cost = base_item_cost # Cost of procuring the equipment
self.enhance_lvl = enhance_lvl
@@ -323,6 +345,30 @@ def __init__(self, settings, base_item_cost=None, enhance_lvl=None, gear_type=No
self.fail_sale_balance = fail_sale_balance
self.procurement_cost = procurement_cost
self.repair_bt_start_idx = None
+ self.item_id = None
+ if target_lvls is None:
+ target_lvls = self.guess_target_lvls(enhance_lvl)
+ self.target_lvls = target_lvls
+
+ def guess_target_lvls(self, enhance_lvl=None, prune=None):
+ if enhance_lvl is None:
+ enhance_lvl = self.enhance_lvl
+ if enhance_lvl is None:
+ this_idx = 0
+ else:
+ this_idx = self.get_enhance_lvl_idx(enhance_lvl)
+ backtrack_start = self.get_backtrack_start()-1
+ this_idx = min(this_idx+1, backtrack_start)
+ idx_list = range(this_idx, len(self.gear_type.lvl_map))
+ target_lvls = [self.gear_type.idx_lvl_map[x] for x in idx_list]
+
+ if prune is not None:
+ target_lvls = [x for x in prune if x in target_lvls]
+
+ return target_lvls
+
+ def get_backtrack_start(self):
+ return self.gear_type.lvl_map['TRI']
def set_sale_balance(self, intbal):
self.sale_balance = int(round(intbal))
@@ -333,6 +379,14 @@ def set_fail_sale_balance(self, intbal):
def set_procurement_cost(self, intbal):
self.procurement_cost = int(round(intbal))
+ def enhance_lvl_to_number(self, enhance_lvl=None):
+ if enhance_lvl is None:
+ enhance_lvl = self.enhance_lvl
+ return self.gear_type.lvl_map[enhance_lvl]
+
+ def enhance_lvl_from_number(self, num):
+ return self.gear_type.idx_lvl_map[num]
+
def prep_lvl_calc(self):
gear_type = self.gear_type
enhance_lvl = self.enhance_lvl
@@ -355,8 +409,12 @@ def set_gear_type(self, gear_type):
# Just manually catch this exception
self.lvl_success_rate = gear_type.map[gear_type.lvl_map[enhance_lvl]]
+ def set_gear_type_by_str(self, str_gear_type):
+ self.set_gear_type(gear_types[str_gear_type])
+
def set_gear_params(self, gear_type, enhance_lvl):
- self.gear_type = gear_type
+ self.set_gear_type(gear_type)
+ #self.gear_type = gear_type
self.set_enhance_lvl(enhance_lvl)
def calc_lvl_repair_cost(self, lvl_costs=None):
@@ -387,7 +445,7 @@ def enhance_cost(self, cum_fs):
for glmap in self.gear_type.map:
foo = glmap[num_fs]
num_fs = self.settings[EnhanceSettings.P_NUM_FS]
- p_success = numpy.array(self.gear_type.map)[:,:num_fs+1]
+ p_success = numpy.array(self.gear_type.map, copy=True)[:,:num_fs+1]
num_enhance_lvls = len(p_success)
p_fail = 1-p_success
@@ -403,9 +461,9 @@ def enhance_cost(self, cum_fs):
opportunity_cost = (p_fail * fail_cost) + material_cost[:, numpy.newaxis]
restore_cost = avg_num_attempts * opportunity_cost
total_cost = restore_cost + cum_fs_tile
- min_cost_idxs = map(numpy.argmin, total_cost)
- restore_cost_min = map(lambda x: x[1][min_cost_idxs[x[0]]], enumerate(restore_cost))
- total_cost_min = map(lambda x: x[1][min_cost_idxs[x[0]]], enumerate(total_cost))
+ min_cost_idxs = list(map(numpy.argmin, total_cost))
+ restore_cost_min = [x[1][min_cost_idxs[x[0]]] for x in enumerate(restore_cost)]
+ total_cost_min = [x[1][min_cost_idxs[x[0]]] for x in enumerate(total_cost)]
backtrack_start = self.repair_bt_start_idx
@@ -486,6 +544,7 @@ def fs_lvl_cost(self, cum_fs, lvl=None, count_fs=True):
:return:
"""
self.prep_lvl_calc() # This is for repair cost calculation
+ #self.calc_lvl_repair_cost()
if lvl is None:
lvl = self.enhance_lvl
num_fs = self.settings[EnhanceSettings.P_NUM_FS]
@@ -499,7 +558,7 @@ def fs_lvl_cost(self, cum_fs, lvl=None, count_fs=True):
if count_fs is False:
cum_fs = numpy.zeros(len(cum_fs))
- success_balance = cum_fs + self.calc_FS_enh_success()
+ success_balance = cum_fs + self.calc_FS_enh_success() # calc_FS_enh_success return negative when gain
success_cost = success_rates * success_balance
# Repair cost variable so that backtracking cost is not included
@@ -518,7 +577,9 @@ def __getstate__(self):
'name': self.name,
'sale_balance': self.sale_balance,
'fail_sale_balance': self.fail_sale_balance,
- 'procurement_cost': self.procurement_cost
+ 'procurement_cost': self.procurement_cost,
+ 'item_id': self.item_id,
+ 'target_lvls': self.target_lvls
}
def __setstate__(self, json_obj):
@@ -528,7 +589,7 @@ def __setstate__(self, json_obj):
#self.tap_risk = []
self.lvl_success_rate = None
self.repair_cost = None
- for key, val in json_obj.iteritems():
+ for key, val in json_obj.items():
if key == 'gear_type':
self.gear_type = gear_types[val]
else:
@@ -537,8 +598,10 @@ def __setstate__(self, json_obj):
def simulate_FS(self, fs_count, last_cost):
raise NotImplementedError()
- def get_enhance_lvl_idx(self):
- return self.gear_type.lvl_map[self.enhance_lvl]
+ def get_enhance_lvl_idx(self, enhance_lvl=None):
+ if enhance_lvl is None:
+ enhance_lvl = self.enhance_lvl
+ return self.gear_type.lvl_map[enhance_lvl]
def set_cost(self, cost):
self.base_item_cost = cost
@@ -573,19 +636,28 @@ def downgrade(self):
new_idx = self.gear_type.idx_lvl_map[this_dx - 1]
self.set_enhance_lvl(new_idx)
+ def duplicate(self):
+ retme: Gear = self.gear_type.instantiable(self.settings, self.gear_type)
+ retme.__setstate__(self.__getstate__())
+ return retme
+
class Classic_Gear(Gear):
TYPE_WEAPON = 0
TYPE_ARMOR = 1
- def __init__(self, settings, base_item_cost=None, enhance_lvl=None, gear_type=None, name=None, fail_dura_cost=5.0,
+ def __init__(self, settings, gear_type, base_item_cost=None, enhance_lvl=None, name=None, fail_dura_cost=5.0,
sale_balance=None, fail_sale_balance=0, procurement_cost=0):
- super(Classic_Gear, self).__init__(settings, base_item_cost=base_item_cost, enhance_lvl=enhance_lvl, gear_type=gear_type,
+ super(Classic_Gear, self).__init__(settings, gear_type, base_item_cost=base_item_cost, enhance_lvl=enhance_lvl,
name=name, sale_balance=sale_balance, fail_sale_balance=fail_sale_balance,
procurement_cost=procurement_cost)
- self.fail_dura_cost = fail_dura_cost
+ #self.fail_dura_cost = fail_dura_cost
self.using_memfrags = False
- self.repair_cost = None
+ self.repair_cost = None # This is the repair cost BEFORE multipliers like conc attempts
+ self.repair_bt_start_idx = self.gear_type.lvl_map['TRI']
+
+ def set_gear_type(self, gear_type):
+ super(Classic_Gear, self).set_gear_type(gear_type)
self.repair_bt_start_idx = self.gear_type.lvl_map['TRI']
def set_cost(self, cost):
@@ -597,8 +669,27 @@ def prep_lvl_calc(self):
self.calc_repair_cost()
super(Classic_Gear, self).prep_lvl_calc()
+ def get_durability_cost(self):
+ if self.gear_type.name == r'Green Weapons (Dura)':
+ fail_dura_cost = 4
+ else:
+ fail_dura_cost = 5
+
+ # This is already accounted for
+ #this_lvl = self.get_enhance_lvl_idx()
+ #conc_start = self.gear_type.lvl_map['PRI']
+
+ #if this_lvl >= conc_start:
+ # fail_dura_cost *= 2
+ return fail_dura_cost
+
def calc_repair_cost(self):
- fail_dura_cost = self.fail_dura_cost
+ """
+ This is not the level cost this is the basic repair cost
+ :return:
+ """
+ fail_dura_cost = self.get_durability_cost()
+
mem_frag_cost = self.settings[EnhanceSettings.P_ITEM_STORE].get_cost(ItemStore.P_MEMORY_FRAG)
tentative_cost = self.base_item_cost * (fail_dura_cost / 10.00)
@@ -740,14 +831,13 @@ def simulate_FS(self, fs_count, last_cost):
flat_cost = self.calc_lvl_flat_cost()
fail_rate = 1.0 - suc_rate
- # print fail_rate
- #print '{}: {}, {}'.format(self.name, self.fail_sale_balance, self.sale_balance)
- # We do not want negative fail stack values
- fail_cost = repair_cost + max(0, self.procurement_cost-self.fail_sale_balance)
- success_cost = last_cost + max(0, self.calc_FS_enh_success())
+ # Splitting flat_cost here since it will have a 1.0 ratio when multiplied by succ and fail rate and
+ # it should be negated when the enh_success cost (gain) overrides it
+ fail_cost = flat_cost + repair_cost + max(0, self.procurement_cost-self.fail_sale_balance)
+ success_cost = max(0, flat_cost + last_cost + self.calc_FS_enh_success())
- opportunity_cost = flat_cost + (suc_rate * success_cost) + (fail_rate * fail_cost)
+ opportunity_cost = (suc_rate * success_cost) + (fail_rate * fail_cost)
avg_num_opportunities = numpy.divide(1.0, fail_rate)
#print '{}: {}'.format(self.name, self.fs_gain())
return (avg_num_opportunities * opportunity_cost) / float(self.fs_gain())
@@ -770,15 +860,9 @@ def fail_FS_accum(self):
def clone_down(self):
pass
- def __getstate__(self):
- this_dict = super(Classic_Gear, self).__getstate__()
- this_dict['fail_dura_cost'] = self.fail_dura_cost
- return this_dict
-
class Smashable(Gear):
-
- def __init__(self, settings, base_item_cost=None, enhance_lvl=None, gear_type=None, name=None, sale_balance=None,
+ def __init__(self, settings, gear_type, base_item_cost=None, enhance_lvl=None, name=None, sale_balance=None,
fail_sale_balance=None, procurement_cost=None):
if fail_sale_balance is None:
# this is for PRI
@@ -786,14 +870,20 @@ def __init__(self, settings, base_item_cost=None, enhance_lvl=None, gear_type=No
if procurement_cost is None:
# this is for PRI
procurement_cost = base_item_cost
- super(Smashable, self).__init__(settings, base_item_cost=base_item_cost, enhance_lvl=enhance_lvl, gear_type=gear_type,
+ super(Smashable, self).__init__(settings, gear_type, base_item_cost=base_item_cost, enhance_lvl=enhance_lvl,
name=name, sale_balance=sale_balance, fail_sale_balance=fail_sale_balance,
procurement_cost=procurement_cost)
self.repair_bt_start_idx = 1
+ self.repair_cost = 0 # This is 0 because repair cost is only used for durability and this item does not lose dura
+
+ def prep_lvl_calc(self):
+ self.repair_cost = 0
+ super(Smashable, self).prep_lvl_calc()
def calc_lvl_repair_cost(self, lvl_costs=None):
if lvl_costs is None:
lvl_costs = self.get_min_cost()
+
lvl_indx = self.get_enhance_lvl_idx()
if lvl_indx == 0:
return self.base_item_cost
diff --git a/dlgAbout.py b/dlgAbout.py
index 000b1a0..2f3b3e7 100644
--- a/dlgAbout.py
+++ b/dlgAbout.py
@@ -3,11 +3,11 @@
@author: ☙ Ryan McConnell ♈♑ rammcconnell@gmail.com ❧
"""
-from Forms.dlg_About import Ui_Dialog
+from .Forms.dlg_About import Ui_Dialog
import PyQt5.QtWidgets as QtWidgets
from PyQt5.QtGui import QPixmap
-from common import relative_path_convert
+from .common import relative_path_convert
class dlg_About(QtWidgets.QDialog):
diff --git a/dlgExport.py b/dlgExport.py
index 0a4a1cc..03a5020 100644
--- a/dlgExport.py
+++ b/dlgExport.py
@@ -5,10 +5,10 @@
"""
import os, csv
#from common import relative_path_covnert
-from Forms.dlg_Export import Ui_Dialog_Export
+from .Forms.dlg_Export import Ui_Dialog_Export
import PyQt5.QtWidgets as QtWidgets
from PyQt5.QtWidgets import QFileDialog
-from QtCommon import Qt_common
+from .QtCommon import Qt_common
dlg_format_list = Qt_common.dlg_format_list
@@ -67,19 +67,19 @@ def save_fs_list_csv(self, folder_output):
self.close()
with open(os.path.join(folder_output, 'fs_list.csv'), 'wb') as f:
csv_writer = csv.writer(f)
- fs_items = model.fs_items
+ fs_items = model.optimal_fs_items
fs_cost = model.fs_cost
cum_fs_cost = model.cum_fs_cost
cum_fs_probs = model.cum_fs_probs
fs_probs = model.fs_probs
matrix = [
- ['Name', 'Cost', 'Cumulative Cost', 'Probability', 'Cumulative Probability']
+ ['FS', 'Name', 'Cost', 'Cumulative Cost', 'Probability', 'Cumulative Probability']
]
for i, this_gear in enumerate(fs_items):
matrix.append(
- [this_gear.name, fs_cost[i], cum_fs_cost[i], fs_probs[i], cum_fs_probs[i]]
+ [str(i), this_gear.get_full_name(), fs_cost[i], cum_fs_cost[i], fs_probs[i], cum_fs_probs[i]]
)
for i in zip(matrix):
diff --git a/gpl.txt b/gpl.txt
new file mode 100644
index 0000000..f288702
--- /dev/null
+++ b/gpl.txt
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/model.py b/model.py
index d4ab910..a26240b 100644
--- a/model.py
+++ b/model.py
@@ -4,8 +4,8 @@
@author: ☙ Ryan McConnell ♈♑ rammcconnell@gmail.com ❧
"""
import numpy, json
-import common
-from old_settings import converters
+from . import common
+from .old_settings import converters
Classic_Gear = common.Classic_Gear
Smashable = common.Smashable
@@ -52,10 +52,10 @@ def __getstate__(self):
super_state.update({
self.P_FAIL_STACKERS: [g.__getstate__() for g in fail_stackers],
self.P_ENHANCE_ME: [g.__getstate__() for g in self[self.P_ENHANCE_ME]],
- self.P_FS_EXCEPTIONS: {k:fail_stackers.index(v) for k,v in self[self.P_FS_EXCEPTIONS].iteritems()},
+ self.P_FS_EXCEPTIONS: {k:fail_stackers.index(v) for k,v in self[self.P_FS_EXCEPTIONS].items()},
self.P_R_FAIL_STACKERS: [g.__getstate__() for g in self[self.P_R_FAIL_STACKERS]],
self.P_R_ENHANCE_ME: [g.__getstate__() for g in self[self.P_R_ENHANCE_ME]],
- self.P_FAIL_STACKERS_COUNT: {fail_stackers.index(k):v for k,v in self[self.P_FAIL_STACKERS_COUNT].iteritems()},
+ self.P_FAIL_STACKERS_COUNT: {fail_stackers.index(k):v for k,v in self[self.P_FAIL_STACKERS_COUNT].items()},
self.P_VERSION: Enhance_model.VERSION
})
return super_state
@@ -91,8 +91,8 @@ def __setstate__(self, state):
self.P_ENHANCE_ME: P_ENHANCE_ME,
self.P_R_FAIL_STACKERS: P_R_FAIL_STACKERS,
self.P_R_ENHANCE_ME: P_R_ENHANCE_ME,
- self.P_FS_EXCEPTIONS: {int(k):P_FAIL_STACKERS[int(v)] for k,v in P_FS_EXCEPTIONS.iteritems()},
- self.P_FAIL_STACKERS_COUNT: {P_FAIL_STACKERS[int(k)]:int(v) for k,v in P_FAIL_STACKERS_COUNT.iteritems()}
+ self.P_FS_EXCEPTIONS: {int(k):P_FAIL_STACKERS[int(v)] for k,v in P_FS_EXCEPTIONS.items()},
+ self.P_FAIL_STACKERS_COUNT: {P_FAIL_STACKERS[int(k)]:int(v) for k,v in P_FAIL_STACKERS_COUNT.items()}
}
self.update(update_r)
@@ -199,25 +199,32 @@ def invalidate_failstack_list(self):
def edit_fs_item(self, old_gear, gear_obj):
fail_stackers = self.settings[EnhanceModelSettings.P_FAIL_STACKERS]
- try:
- #self.fail_stackers.remove(old_gear)
+ r_fail_stackers = self.settings[EnhanceModelSettings.P_R_FAIL_STACKERS]
+ if old_gear in fail_stackers:
fail_stackers.remove(old_gear)
- except ValueError:
- pass
- fail_stackers.append(gear_obj)
- self.settings.changes_made = True
+ fail_stackers.append(gear_obj)
+ self.settings.changes_made = True
+ elif old_gear in r_fail_stackers:
+ r_fail_stackers.remove(old_gear)
+ r_fail_stackers.append(gear_obj)
+ self.settings.changes_made = True
self.save()
- #self.fail_stackers.append(gear_obj)
+
+ def swap_gear(self, old_gear: common.Gear, gear_obj: common.Gear):
+ self.edit_fs_item(old_gear, gear_obj)
+ self.edit_enhance_item(old_gear, gear_obj)
def edit_enhance_item(self, old_gear, gear_obj):
enhance_me = self.settings[EnhanceModelSettings.P_ENHANCE_ME]
- try:
- #self.enhance_me.remove(old_gear)
+ r_enhance_me = self.settings[EnhanceModelSettings.P_R_ENHANCE_ME]
+ if old_gear in enhance_me:
enhance_me.remove(old_gear)
- except ValueError:
- pass
- enhance_me.append(gear_obj)
- self.settings.changes_made = True
+ enhance_me.append(gear_obj)
+ self.settings.changes_made = True
+ elif old_gear in r_enhance_me:
+ r_enhance_me.remove(old_gear)
+ r_enhance_me.append(gear_obj)
+ self.settings.changes_made = True
self.save()
#self.enhance_me.append(gear_obj)
@@ -232,7 +239,7 @@ def calcFS(self):
cum_fs_probs = []
fs_probs = []
- map(lambda x: x.prep_lvl_calc(), fail_stackers)
+ list(map(lambda x: x.prep_lvl_calc(), fail_stackers))
if len(fail_stackers) < 1:
@@ -246,7 +253,7 @@ def calcFS(self):
this_fs_item = fs_exceptions[i]
this_fs_cost = this_fs_item.simulate_FS(i, last_rate)
else:
- trys = map(lambda x: x.simulate_FS(i, last_rate), fail_stackers)
+ trys = [x.simulate_FS(i, last_rate) for x in fail_stackers]
this_fs_idx = int(numpy.argmin(trys))
this_fs_cost = trys[this_fs_idx]
this_fs_item = fail_stackers[this_fs_idx]
@@ -279,8 +286,8 @@ def calcFS(self):
cum_fs_cost.append(this_cum_cost)
last_rate = this_cum_cost
- fsa = [x for x in fail_stackers if isinstance(x, Classic_Gear)]
- map(lambda x: x.simulate_Enhance_sale(cum_fs_cost), fsa)
+ #fsa = [x for x in fail_stackers if isinstance(x, Classic_Gear)]
+ #list(map(lambda x: x.simulate_Enhance_sale(cum_fs_cost), fsa))
self.optimal_fs_items = fs_items
self.fs_cost = fs_cost
@@ -294,9 +301,9 @@ def calc_equip_costs(self):
r_enhance_me = self.settings[EnhanceModelSettings.P_R_ENHANCE_ME]
if self.fs_needs_update:
self.calcFS()
- eq_c = map(lambda x: x.enhance_cost(self.cum_fs_cost), enhance_me)
+ eq_c = [x.enhance_cost(self.cum_fs_cost) for x in enhance_me]
if len(eq_c) > 0:
- r_eq_c = map(lambda x: x.enhance_cost(self.cum_fs_cost), r_enhance_me)
+ r_eq_c = [x.enhance_cost(self.cum_fs_cost) for x in r_enhance_me]
self.equipment_costs = eq_c
self.r_equipment_costs = r_eq_c
self.gear_cost_needs_update = False
@@ -304,7 +311,136 @@ def calc_equip_costs(self):
else:
raise Invalid_FS_Parameters('There is no equipment selected for enhancement.')
- def calcEnhances(self, count_fs=False, count_fs_fs=True, devaule_fs=False, regress=False):
+ def calcEnhances(self, enhance_me=None, fail_stackers=None, count_fs=False, count_fs_fs=True, devaule_fs=False, regress=False):
+ if self.fs_needs_update:
+ self.calcFS()
+ if self.gear_cost_needs_update:
+ self.calc_equip_costs()
+ settings = self.settings
+ if enhance_me is None:
+ enhance_me = settings[EnhanceModelSettings.P_ENHANCE_ME]
+ if fail_stackers is None:
+ fail_stackers = settings[EnhanceModelSettings.P_FAIL_STACKERS]
+
+ num_fs = settings[EnhanceSettings.P_NUM_FS]
+ cum_fs_cost = self.cum_fs_cost
+ fs_cost = self.fs_cost
+
+ new_fs_cost = fs_cost[:]
+
+ fs_len = num_fs+1
+
+
+ # This is a bit hacky and confusing but we need a cost estimate on potential fs gain vs recovery loss on items that have no success gain
+ # For fail-stacking items there should not be a total cost gained from success. It only gains value from fail stacks.
+ #zero_out = lambda x: x.enhance_lvl_cost(cum_fs_cost, total_cost=numpy.array([[0]*fs_len]*len(x.gear_type.map)), count_fs=count_fs)
+
+ balance_vec_fser = [x.fs_lvl_cost(cum_fs_cost, count_fs=count_fs_fs) for x in fail_stackers]
+ balance_vec_enh = [x.enhance_lvl_cost(cum_fs_cost, count_fs=count_fs) for x in enhance_me]
+
+ balance_vec_fser = numpy.array(balance_vec_fser)
+ balance_vec_enh = numpy.array(balance_vec_enh)
+
+ min_gear_map = [numpy.argmin(x) for x in balance_vec_enh.T]
+
+ def check_out_gains(balance_vec, gains_lookup_vec, gear_list, fs_cost):
+ """
+ This method adds the value of increasing gains on gear that is ahead in the strategy fs list.
+ For example:
+ When attempting TRI on a weapon, if the user fails enhancement they will gain 3 fail stacks and these fail
+ stacks have a value that is the increased chance of success with the 3 fail stacks. The actual cost is
+ calculated by looking at what price of gear is up for enhancement 3 fail stacks higher then the qgear in
+ question.
+ If the gear ahead happens to be more expensive once the enhancement fails that gain becomes a cost.
+ :param balance_vec:
+ :param gains_lookup_vec:
+ :param gear_list:
+ :param fs_cost:
+ :return:
+ """
+ #gearz = map(lambda x: gear_list[x], min_gear_map)
+ # indexed by enhance_me returns the number of fail stacks gained by a failure
+ gainz = [x.fs_gain() for x in gear_list]
+ # indexed by sort order, returns index of enhance_me
+ arg_sorts = numpy.argsort(gainz)
+ fs_dict = {}
+ #idx_ = 0
+ for idx_, gear_idx in enumerate(arg_sorts):
+ # = arg_sorts[idx_]
+ try:
+ fs_dict[gainz[gear_idx]].append(gear_idx)
+ except KeyError:
+ fs_dict[gainz[gear_idx]] = [gear_idx]
+
+ # indexed by fs, returns list indexed by enhance_me of success chance
+ chances = numpy.array([x.gear_type.map[x.get_enhance_lvl_idx()][:num_fs+1] for x in gear_list]).T
+
+ # The very last item has to be a self pointer only
+ # Not double counting fs cost bc this is a copy
+ this_bal_vec = numpy.copy(balance_vec)
+ # cycle through all fsil stack levels
+ for i in range(1, fs_len+1):
+ lookup_idx = fs_len - i
+ #this_gear = gearz[lookup_idx]
+
+ cost_emmend = numpy.zeros(len(balance_vec))
+ # cycle through all types of gear packaged by the number of fail stacks they will gain. Since it will be
+ # the same gain value
+ for num_fs_gain, gear_idx_list in fs_dict.items():
+ #for gidx in enhance_me_idx_list:
+ # print 'GEAR: {}\t\t| GAIN: {}'.format(enhance_me[gidx].name, num_fs_gain)
+ # the fs position index that the gear will move the FS counter to upon failure
+ fs_pointer_idx = lookup_idx + num_fs_gain
+
+ try:
+ gear_map_pointer_idx = min_gear_map[fs_pointer_idx]
+ except IndexError:
+ fs_pointer_idx = len(min_gear_map) - 1
+ gear_map_pointer_idx = min_gear_map[fs_pointer_idx]
+ gain_vec = fs_cost[lookup_idx: fs_pointer_idx] # The fs costs to be gained from failure
+ gain_cost = -numpy.sum(gain_vec)
+ #print 'FS: {} | Gear {} | Cost: {}'.format(fs_pointer_idx, enhance_me[gear_map_pointer_idx].name, balance_vec_enh[gear_map_pointer_idx][fs_pointer_idx])
+ gear_cost_current_fs = gains_lookup_vec[gear_map_pointer_idx][lookup_idx]
+ gear_cost_ahead_fs = gains_lookup_vec[gear_map_pointer_idx][fs_pointer_idx]
+ gear_pointed_cost = gear_cost_ahead_fs - gear_cost_current_fs
+ if devaule_fs:
+ projected_gain = gear_pointed_cost
+ else:
+ projected_gain = gain_cost
+ # All gear at this FS level and gain level have the same cost diff
+ cost_emmend[gear_idx_list] = projected_gain
+ #print cost_emmend
+
+ fail_rate = 1 - chances[lookup_idx]
+
+ this_bal_vec.T[lookup_idx] += numpy.multiply(fail_rate, cost_emmend)
+
+ if balance_vec is balance_vec_enh: # only update minimums when we are looking at the enhancement gear
+ new_min_idx = numpy.argmin(this_bal_vec.T[lookup_idx])
+ min_gear_map[lookup_idx] = new_min_idx
+ return this_bal_vec
+
+ enh_vec_ammend = check_out_gains(balance_vec_enh, balance_vec_enh, enhance_me, new_fs_cost)
+ fs_vec_ammend = check_out_gains(balance_vec_fser, balance_vec_enh, fail_stackers, new_fs_cost)
+
+ if devaule_fs and regress:
+ max_iter = 100
+ counter = 0
+ changes = True
+ while changes and counter